@rely-ai/caliber 1.16.0 → 1.17.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/bin.js +21 -4
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -641,6 +641,7 @@ function analyzeCode(dir) {
|
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
const readFiles = [];
|
|
644
|
+
let compressedChars = 0;
|
|
644
645
|
for (const relPath of allFiles) {
|
|
645
646
|
const fullPath = path3.join(dir, relPath);
|
|
646
647
|
let rawContent;
|
|
@@ -652,6 +653,7 @@ function analyzeCode(dir) {
|
|
|
652
653
|
if (rawContent.split("\n").length > 500) continue;
|
|
653
654
|
const ext = path3.extname(relPath).toLowerCase();
|
|
654
655
|
const compressed = compressContent(rawContent, ext);
|
|
656
|
+
compressedChars += compressed.length;
|
|
655
657
|
readFiles.push({
|
|
656
658
|
path: relPath,
|
|
657
659
|
content: compressed,
|
|
@@ -660,6 +662,7 @@ function analyzeCode(dir) {
|
|
|
660
662
|
});
|
|
661
663
|
}
|
|
662
664
|
const deduped = deduplicateFiles(readFiles);
|
|
665
|
+
const dupGroups = deduped.filter((f) => f.path.startsWith("[similar")).length;
|
|
663
666
|
let includedChars = 0;
|
|
664
667
|
let truncated = false;
|
|
665
668
|
const files = [];
|
|
@@ -676,7 +679,11 @@ function analyzeCode(dir) {
|
|
|
676
679
|
files,
|
|
677
680
|
truncated,
|
|
678
681
|
totalProjectTokens: Math.ceil(totalChars / 4),
|
|
679
|
-
|
|
682
|
+
compressedTokens: Math.ceil(compressedChars / 4),
|
|
683
|
+
includedTokens: Math.ceil(includedChars / 4),
|
|
684
|
+
filesAnalyzed: readFiles.length,
|
|
685
|
+
filesIncluded: files.length,
|
|
686
|
+
duplicateGroups: dupGroups
|
|
680
687
|
};
|
|
681
688
|
}
|
|
682
689
|
function walkDir(base, rel, depth, maxDepth, files) {
|
|
@@ -6169,15 +6176,25 @@ async function initCommand(options) {
|
|
|
6169
6176
|
spinner.succeed("Project analyzed");
|
|
6170
6177
|
log(options.verbose, `Fingerprint: ${fingerprint.languages.length} languages, ${fingerprint.frameworks.length} frameworks, ${fingerprint.fileTree.length} files`);
|
|
6171
6178
|
if (options.verbose && fingerprint.codeAnalysis) {
|
|
6172
|
-
log(options.verbose, `Code analysis: ${fingerprint.codeAnalysis.
|
|
6179
|
+
log(options.verbose, `Code analysis: ${fingerprint.codeAnalysis.filesIncluded}/${fingerprint.codeAnalysis.filesAnalyzed} files, ~${fingerprint.codeAnalysis.includedTokens.toLocaleString()} tokens, ${fingerprint.codeAnalysis.duplicateGroups} dedup groups`);
|
|
6173
6180
|
}
|
|
6174
6181
|
trackInitProjectDiscovered(fingerprint.languages.length, fingerprint.frameworks.length, fingerprint.fileTree.length);
|
|
6175
6182
|
console.log(chalk8.dim(` Languages: ${fingerprint.languages.join(", ") || "none detected"}`));
|
|
6176
6183
|
console.log(chalk8.dim(` Files: ${fingerprint.fileTree.length} found`));
|
|
6177
6184
|
if (fingerprint.codeAnalysis) {
|
|
6178
6185
|
const ca = fingerprint.codeAnalysis;
|
|
6179
|
-
const
|
|
6180
|
-
|
|
6186
|
+
const compressionPct = ca.totalProjectTokens > 0 ? Math.round((1 - ca.compressedTokens / ca.totalProjectTokens) * 100) : 0;
|
|
6187
|
+
const parts = [`Context: ~${ca.includedTokens.toLocaleString()} tokens sent`];
|
|
6188
|
+
if (ca.truncated) {
|
|
6189
|
+
parts.push(`(${Math.round(ca.includedTokens / ca.totalProjectTokens * 100)}% of ${ca.totalProjectTokens.toLocaleString()} total)`);
|
|
6190
|
+
}
|
|
6191
|
+
if (compressionPct > 5) {
|
|
6192
|
+
parts.push(`compressed ${compressionPct}%`);
|
|
6193
|
+
}
|
|
6194
|
+
if (ca.duplicateGroups > 0) {
|
|
6195
|
+
parts.push(`${ca.duplicateGroups} duplicate group${ca.duplicateGroups === 1 ? "" : "s"} merged`);
|
|
6196
|
+
}
|
|
6197
|
+
console.log(chalk8.dim(` ${parts.join(" \xB7 ")}`));
|
|
6181
6198
|
}
|
|
6182
6199
|
console.log("");
|
|
6183
6200
|
if (report) {
|
package/package.json
CHANGED