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/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # CTO — Stop sending your entire codebase to AI
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
- [![Tests](https://img.shields.io/badge/tests-376_passing-brightgreen.svg)](#)
4
+ [![Tests](https://img.shields.io/badge/tests-550_passing-brightgreen.svg)](#)
5
+ [![Coverage](https://img.shields.io/badge/coverage-91%25-brightgreen.svg)](#)
5
6
  [![npm](https://img.shields.io/npm/v/cto-ai-cli.svg)](https://www.npmjs.com/package/cto-ai-cli)
6
7
 
7
8
  CTO analyzes your project and selects the **minimum set of files** your AI needs — saving tokens, reducing cost, and producing code that actually compiles.
@@ -24179,8 +24179,8 @@ async function analyzeProject(projectPath, config) {
24179
24179
  maxDepth: mergedConfig.analysis.maxDepth
24180
24180
  });
24181
24181
  const tokenMethod = mergedConfig.tokens.method;
24182
- const files = [];
24183
- for (const entry of walkEntries) {
24182
+ const BATCH_SIZE = 50;
24183
+ async function estimateFileTokens(entry) {
24184
24184
  let tokens;
24185
24185
  if (tokenMethod === "tiktoken") {
24186
24186
  try {
@@ -24192,7 +24192,7 @@ async function analyzeProject(projectPath, config) {
24192
24192
  } else {
24193
24193
  tokens = countTokensChars4(entry.size);
24194
24194
  }
24195
- files.push({
24195
+ return {
24196
24196
  path: entry.path,
24197
24197
  relativePath: entry.relativePath,
24198
24198
  extension: entry.extension,
@@ -24201,16 +24201,20 @@ async function analyzeProject(projectPath, config) {
24201
24201
  lines: entry.lines,
24202
24202
  lastModified: entry.lastModified,
24203
24203
  kind: classifyFileKind(entry.relativePath),
24204
- // Graph data — populated by graph analysis
24205
24204
  imports: [],
24206
24205
  importedBy: [],
24207
24206
  isHub: false,
24208
24207
  complexity: 0,
24209
- // Risk data — populated by risk analysis
24210
24208
  riskScore: 0,
24211
24209
  riskFactors: [],
24212
24210
  exclusionImpact: "none"
24213
- });
24211
+ };
24212
+ }
24213
+ const files = [];
24214
+ for (let i = 0; i < walkEntries.length; i += BATCH_SIZE) {
24215
+ const batch = walkEntries.slice(i, i + BATCH_SIZE);
24216
+ const results = await Promise.all(batch.map(estimateFileTokens));
24217
+ files.push(...results);
24214
24218
  }
24215
24219
  const graph = buildProjectGraph(absPath, files);
24216
24220
  for (const file of files) {
@@ -592,8 +592,8 @@ async function analyzeProject(projectPath, config) {
592
592
  maxDepth: mergedConfig.analysis.maxDepth
593
593
  });
594
594
  const tokenMethod = mergedConfig.tokens.method;
595
- const files = [];
596
- for (const entry of walkEntries) {
595
+ const BATCH_SIZE = 50;
596
+ async function estimateFileTokens(entry) {
597
597
  let tokens;
598
598
  if (tokenMethod === "tiktoken") {
599
599
  try {
@@ -605,7 +605,7 @@ async function analyzeProject(projectPath, config) {
605
605
  } else {
606
606
  tokens = countTokensChars4(entry.size);
607
607
  }
608
- files.push({
608
+ return {
609
609
  path: entry.path,
610
610
  relativePath: entry.relativePath,
611
611
  extension: entry.extension,
@@ -614,16 +614,20 @@ async function analyzeProject(projectPath, config) {
614
614
  lines: entry.lines,
615
615
  lastModified: entry.lastModified,
616
616
  kind: classifyFileKind(entry.relativePath),
617
- // Graph data — populated by graph analysis
618
617
  imports: [],
619
618
  importedBy: [],
620
619
  isHub: false,
621
620
  complexity: 0,
622
- // Risk data — populated by risk analysis
623
621
  riskScore: 0,
624
622
  riskFactors: [],
625
623
  exclusionImpact: "none"
626
- });
624
+ };
625
+ }
626
+ const files = [];
627
+ for (let i = 0; i < walkEntries.length; i += BATCH_SIZE) {
628
+ const batch = walkEntries.slice(i, i + BATCH_SIZE);
629
+ const results = await Promise.all(batch.map(estimateFileTokens));
630
+ files.push(...results);
627
631
  }
628
632
  const graph = buildProjectGraph(absPath, files);
629
633
  for (const file of files) {