@rely-ai/caliber 1.12.18 → 1.13.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.
Files changed (2) hide show
  1. package/dist/bin.js +60 -20
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -446,9 +446,9 @@ var CONFIG_FILE_NAMES = /* @__PURE__ */ new Set([
446
446
  var CONFIG_GLOBS_DIRS = [
447
447
  { dir: ".github/workflows", pattern: /\.ya?ml$/ }
448
448
  ];
449
- var TOTAL_BUDGET = 5e4;
450
- var CONFIG_BUDGET = Math.floor(TOTAL_BUDGET * 0.3);
451
- var SOURCE_BUDGET = Math.floor(TOTAL_BUDGET * 0.7);
449
+ var TOTAL_BUDGET = 4e5;
450
+ var CONFIG_BUDGET = Math.floor(TOTAL_BUDGET * 0.15);
451
+ var SOURCE_BUDGET = Math.floor(TOTAL_BUDGET * 0.85);
452
452
  function analyzeCode(dir) {
453
453
  const sourceFiles = [];
454
454
  const configFiles = [];
@@ -465,27 +465,56 @@ function analyzeCode(dir) {
465
465
  let sourceChars = 0;
466
466
  let truncated = false;
467
467
  const fileSummaries = [];
468
+ const MAX_CONTENT_LINE_COUNT = 300;
469
+ const CONTENT_BUDGET = Math.floor(SOURCE_BUDGET * 0.75);
470
+ const SUMMARY_BUDGET = SOURCE_BUDGET - CONTENT_BUDGET;
468
471
  for (const relPath of sourceFiles) {
469
472
  const fullPath = path3.join(dir, relPath);
470
- let content;
473
+ let fileContent;
471
474
  try {
472
- content = fs3.readFileSync(fullPath, "utf-8");
475
+ fileContent = fs3.readFileSync(fullPath, "utf-8");
473
476
  } catch {
474
477
  continue;
475
478
  }
476
- const lineCount = content.split("\n").length;
477
- if (lineCount > 500) continue;
479
+ const lineCount = fileContent.split("\n").length;
480
+ if (lineCount > MAX_CONTENT_LINE_COUNT) continue;
478
481
  const ext = path3.extname(relPath);
479
482
  const language = resolveLanguage(ext);
480
483
  if (!language) continue;
481
- const summary = language === "py" ? extractPython(relPath, content) : extractTypeScriptJavaScript(relPath, content, language);
484
+ const summary = language === "py" ? extractPython(relPath, fileContent) : extractTypeScriptJavaScript(relPath, fileContent, language);
485
+ summary.content = fileContent;
486
+ const entrySize = estimateSummarySize(summary) + fileContent.length;
487
+ if (sourceChars + entrySize > CONTENT_BUDGET) {
488
+ truncated = true;
489
+ break;
490
+ }
491
+ fileSummaries.push(summary);
492
+ sourceChars += entrySize;
493
+ }
494
+ const processedPaths = new Set(fileSummaries.map((f) => f.path));
495
+ let summaryChars = 0;
496
+ for (const relPath of sourceFiles) {
497
+ if (processedPaths.has(relPath)) continue;
498
+ const fullPath = path3.join(dir, relPath);
499
+ let fileContent;
500
+ try {
501
+ fileContent = fs3.readFileSync(fullPath, "utf-8");
502
+ } catch {
503
+ continue;
504
+ }
505
+ const lineCount = fileContent.split("\n").length;
506
+ if (lineCount > 1e3) continue;
507
+ const ext = path3.extname(relPath);
508
+ const language = resolveLanguage(ext);
509
+ if (!language) continue;
510
+ const summary = language === "py" ? extractPython(relPath, fileContent) : extractTypeScriptJavaScript(relPath, fileContent, language);
482
511
  const summarySize = estimateSummarySize(summary);
483
- if (sourceChars + summarySize > SOURCE_BUDGET) {
512
+ if (summaryChars + summarySize > SUMMARY_BUDGET) {
484
513
  truncated = true;
485
514
  break;
486
515
  }
487
516
  fileSummaries.push(summary);
488
- sourceChars += summarySize;
517
+ summaryChars += summarySize;
489
518
  }
490
519
  return { fileSummaries, configFiles: trimmedConfigs, truncated };
491
520
  }
@@ -2436,15 +2465,16 @@ async function generateMonolithic(fingerprint, targetAgent, prompt, callbacks, f
2436
2465
  return attemptGeneration();
2437
2466
  }
2438
2467
  var LIMITS = {
2439
- FILE_TREE_ENTRIES: 200,
2468
+ FILE_TREE_ENTRIES: 500,
2440
2469
  EXISTING_CONFIG_CHARS: 8e3,
2441
2470
  SKILLS_MAX: 10,
2442
2471
  SKILL_CHARS: 3e3,
2443
2472
  RULES_MAX: 10,
2444
- CONFIG_FILES_MAX: 15,
2445
- CONFIG_FILE_CHARS: 3e3,
2446
- ROUTES_MAX: 50,
2447
- FILE_SUMMARIES_MAX: 60
2473
+ CONFIG_FILES_MAX: 20,
2474
+ CONFIG_FILE_CHARS: 5e3,
2475
+ ROUTES_MAX: 100,
2476
+ FILE_SUMMARIES_MAX: 200,
2477
+ FILE_CONTENT_CHARS: 8e3
2448
2478
  };
2449
2479
  function truncate(text, maxChars) {
2450
2480
  if (text.length <= maxChars) return text;
@@ -2575,9 +2605,19 @@ ${truncate(cfg.content, LIMITS.CONFIG_FILE_CHARS)}`);
2575
2605
  parts.push(`(${allRoutes.length - LIMITS.ROUTES_MAX} more routes omitted)`);
2576
2606
  }
2577
2607
  }
2578
- if (ca.fileSummaries.length > 0) {
2608
+ const filesWithContent = ca.fileSummaries.filter((f) => f.content);
2609
+ const filesWithoutContent = ca.fileSummaries.filter((f) => !f.content);
2610
+ if (filesWithContent.length > 0) {
2611
+ parts.push("\n--- Source Files (full content \u2014 use these to extract patterns for skills) ---");
2612
+ for (const f of filesWithContent.slice(0, LIMITS.FILE_SUMMARIES_MAX)) {
2613
+ parts.push(`
2614
+ [${f.path}] (${f.language})`);
2615
+ parts.push(truncate(f.content, LIMITS.FILE_CONTENT_CHARS));
2616
+ }
2617
+ }
2618
+ if (filesWithoutContent.length > 0) {
2579
2619
  parts.push("\n--- Source File Summaries ---");
2580
- for (const f of ca.fileSummaries.slice(0, LIMITS.FILE_SUMMARIES_MAX)) {
2620
+ for (const f of filesWithoutContent.slice(0, LIMITS.FILE_SUMMARIES_MAX)) {
2581
2621
  const sections = [`[${f.path}] (${f.language})`];
2582
2622
  if (f.imports.length > 0) sections.push(` imports: ${f.imports.slice(0, 10).join("; ")}`);
2583
2623
  if (f.exports.length > 0) sections.push(` exports: ${f.exports.slice(0, 10).join(", ")}`);
@@ -2586,9 +2626,9 @@ ${truncate(cfg.content, LIMITS.CONFIG_FILE_CHARS)}`);
2586
2626
  if (f.types.length > 0) sections.push(` types: ${f.types.slice(0, 10).join(", ")}`);
2587
2627
  parts.push(sections.join("\n"));
2588
2628
  }
2589
- if (ca.fileSummaries.length > LIMITS.FILE_SUMMARIES_MAX) {
2629
+ if (filesWithoutContent.length > LIMITS.FILE_SUMMARIES_MAX) {
2590
2630
  parts.push(`
2591
- (${ca.fileSummaries.length - LIMITS.FILE_SUMMARIES_MAX} more files omitted)`);
2631
+ (${filesWithoutContent.length - LIMITS.FILE_SUMMARIES_MAX} more files omitted)`);
2592
2632
  }
2593
2633
  }
2594
2634
  if (ca.truncated) {
@@ -2598,7 +2638,7 @@ ${truncate(cfg.content, LIMITS.CONFIG_FILE_CHARS)}`);
2598
2638
  const allDeps = extractAllDeps(process.cwd());
2599
2639
  if (allDeps.length > 0) {
2600
2640
  parts.push(`
2601
- DEPENDENCY COVERAGE \u2014 mention at least 85% of these ${allDeps.length} packages by name in CLAUDE.md or skills for full coverage points:`);
2641
+ Project dependencies (${allDeps.length}):`);
2602
2642
  parts.push(allDeps.join(", "));
2603
2643
  }
2604
2644
  if (prompt) parts.push(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.12.18",
3
+ "version": "1.13.0",
4
4
  "description": "Analyze your codebase and generate optimized AI agent configs (CLAUDE.md, .cursorrules, skills) — no API key needed",
5
5
  "type": "module",
6
6
  "bin": {