MCPcopy Create free account
hub / github.com/codeaashu/claude-code / createCategorySquares

Function createCategorySquares

src/utils/analyzeContext.ts:1206–1233  ·  view source on GitHub ↗
(
    category: (typeof categorySquares)[0],
  )

Source from the content-addressed store, hash-verified

1204
1205 // Helper function to create grid squares for a category
1206 function createCategorySquares(
1207 category: (typeof categorySquares)[0],
1208 ): GridSquare[] {
1209 const squares: GridSquare[] = []
1210 const exactSquares = (category.tokens / contextWindow) * TOTAL_SQUARES
1211 const wholeSquares = Math.floor(exactSquares)
1212 const fractionalPart = exactSquares - wholeSquares
1213
1214 for (let i = 0; i < category.squares; i++) {
1215 // Determine fullness: full squares get 1.0, partial square gets fractional amount
1216 let squareFullness = 1.0
1217 if (i === wholeSquares && fractionalPart > 0) {
1218 // This is the partial square
1219 squareFullness = fractionalPart
1220 }
1221
1222 squares.push({
1223 color: category.color,
1224 isFilled: true,
1225 categoryName: category.name,
1226 tokens: category.tokens,
1227 percentage: category.percentageOfTotal,
1228 squareFullness,
1229 })
1230 }
1231
1232 return squares
1233 }
1234
1235 // Build the grid as an array of squares with full metadata
1236 const gridSquares: GridSquare[] = []

Callers 1

analyzeContextUsageFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected