cto-ai-cli 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp/v2.js CHANGED
@@ -14369,8 +14369,8 @@ async function analyzeProject(projectPath, config2) {
14369
14369
  maxDepth: mergedConfig.analysis.maxDepth
14370
14370
  });
14371
14371
  const tokenMethod = mergedConfig.tokens.method;
14372
- const files = [];
14373
- for (const entry of walkEntries) {
14372
+ const BATCH_SIZE = 50;
14373
+ async function estimateFileTokens(entry) {
14374
14374
  let tokens;
14375
14375
  if (tokenMethod === "tiktoken") {
14376
14376
  try {
@@ -14382,7 +14382,7 @@ async function analyzeProject(projectPath, config2) {
14382
14382
  } else {
14383
14383
  tokens = countTokensChars4(entry.size);
14384
14384
  }
14385
- files.push({
14385
+ return {
14386
14386
  path: entry.path,
14387
14387
  relativePath: entry.relativePath,
14388
14388
  extension: entry.extension,
@@ -14391,16 +14391,20 @@ async function analyzeProject(projectPath, config2) {
14391
14391
  lines: entry.lines,
14392
14392
  lastModified: entry.lastModified,
14393
14393
  kind: classifyFileKind(entry.relativePath),
14394
- // Graph data — populated by graph analysis
14395
14394
  imports: [],
14396
14395
  importedBy: [],
14397
14396
  isHub: false,
14398
14397
  complexity: 0,
14399
- // Risk data — populated by risk analysis
14400
14398
  riskScore: 0,
14401
14399
  riskFactors: [],
14402
14400
  exclusionImpact: "none"
14403
- });
14401
+ };
14402
+ }
14403
+ const files = [];
14404
+ for (let i = 0; i < walkEntries.length; i += BATCH_SIZE) {
14405
+ const batch = walkEntries.slice(i, i + BATCH_SIZE);
14406
+ const results = await Promise.all(batch.map(estimateFileTokens));
14407
+ files.push(...results);
14404
14408
  }
14405
14409
  const graph = buildProjectGraph(absPath, files);
14406
14410
  for (const file2 of files) {