@rely-ai/caliber 1.20.0-dev.1773686772 → 1.20.0-dev.1773686790

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 +26 -48
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -2136,37 +2136,37 @@ All markdown content inside string values must be properly escaped for JSON (new
2136
2136
 
2137
2137
  If there's nothing worth learning from the events (routine successful operations), return:
2138
2138
  {"claudeMdLearnedSection": null, "skills": null, "explanations": ["No actionable patterns found in these events."]}`;
2139
- var FINGERPRINT_SYSTEM_PROMPT = `You are an expert at detecting programming languages, frameworks, and external tools/services from project file trees and dependency files.
2139
+ var FINGERPRINT_SYSTEM_PROMPT = `You are an expert at detecting programming languages, frameworks, and external tools/services from project structure.
2140
2140
 
2141
- Analyze the provided file tree and dependency file contents. Return a JSON object with:
2142
- - "languages": array of programming languages used (e.g. "TypeScript", "Python", "Go", "Rust", "HCL")
2143
- - "frameworks": array of frameworks and key libraries detected (e.g. "FastAPI", "React", "Celery", "Django", "Express", "Next.js", "Terraform")
2144
- - "tools": array of external tools, services, and platforms the project integrates with \u2014 things that could have an MCP server or API integration (e.g. "PostgreSQL", "Redis", "Stripe", "Sentry", "AWS", "GCP", "GitHub", "Slack", "Docker", "Kubernetes", "Datadog", "PagerDuty", "MongoDB", "Elasticsearch")
2141
+ Analyze the provided file tree and file extension distribution. Return a JSON object with:
2142
+ - "languages": array of programming languages used, ordered by prominence in the project (most files first)
2143
+ - "frameworks": array of frameworks and key libraries detected, ordered by prominence
2144
+ - "tools": array of external tools, services, and platforms the project integrates with, ordered by prominence
2145
2145
 
2146
- Be thorough \u2014 look for signals in:
2147
- - Dependency files (package.json, pyproject.toml, requirements.txt, go.mod, Cargo.toml, etc.)
2148
- - File extensions and directory structure
2146
+ Use the file extension distribution to determine the ordering \u2014 technologies with more files should appear first.
2147
+
2148
+ Be thorough \u2014 reason from:
2149
+ - File extensions and their frequency distribution
2150
+ - Directory structure and naming conventions
2149
2151
  - Configuration files (e.g. next.config.js implies Next.js, .tf files imply Terraform + cloud providers)
2150
2152
  - Infrastructure-as-code files (Terraform, CloudFormation, Pulumi, Dockerfiles, k8s manifests)
2151
2153
  - CI/CD configs (.github/workflows, .gitlab-ci.yml, Jenkinsfile)
2152
- - Dockerfile base images (e.g. FROM python:3.11 implies Python, FROM node:20 implies Node.js)
2153
2154
 
2154
2155
  Only include items you're confident about. Return ONLY the JSON object.`;
2155
2156
 
2156
2157
  // src/ai/detect.ts
2157
- async function detectProjectStack(fileTree, fileContents) {
2158
+ async function detectProjectStack(fileTree, suffixCounts) {
2158
2159
  const parts = ["Analyze this project and detect languages, frameworks, and external tools/services.\n"];
2159
2160
  if (fileTree.length > 0) {
2160
2161
  const cappedTree = fileTree.slice(0, 500);
2161
2162
  parts.push(`File tree (${cappedTree.length}/${fileTree.length} entries):`);
2162
2163
  parts.push(cappedTree.join("\n"));
2163
2164
  }
2164
- if (Object.keys(fileContents).length > 0) {
2165
- parts.push("\nDependency file contents:");
2166
- for (const [filePath, content] of Object.entries(fileContents)) {
2167
- parts.push(`
2168
- [${filePath}]`);
2169
- parts.push(content);
2165
+ const sorted = Object.entries(suffixCounts).sort((a, b) => b[1] - a[1]);
2166
+ if (sorted.length > 0) {
2167
+ parts.push("\nFile extension distribution (sorted by frequency):");
2168
+ for (const [ext, count] of sorted) {
2169
+ parts.push(`${ext}: ${count}`);
2170
2170
  }
2171
2171
  }
2172
2172
  const fastModel = getFastModel();
@@ -2200,7 +2200,7 @@ async function collectFingerprint(dir) {
2200
2200
  existingConfigs,
2201
2201
  codeAnalysis
2202
2202
  };
2203
- await enrichWithLLM(fingerprint, dir);
2203
+ await enrichWithLLM(fingerprint);
2204
2204
  return fingerprint;
2205
2205
  }
2206
2206
  function readPackageName(dir) {
@@ -2213,42 +2213,20 @@ function readPackageName(dir) {
2213
2213
  return void 0;
2214
2214
  }
2215
2215
  }
2216
- var DEP_FILE_PATTERNS = [
2217
- "package.json",
2218
- "pyproject.toml",
2219
- "requirements.txt",
2220
- "setup.py",
2221
- "Pipfile",
2222
- "Cargo.toml",
2223
- "go.mod",
2224
- "Gemfile",
2225
- "build.gradle",
2226
- "pom.xml",
2227
- "composer.json"
2228
- ];
2229
- var MAX_CONTENT_SIZE = 50 * 1024;
2230
- async function enrichWithLLM(fingerprint, dir) {
2216
+ async function enrichWithLLM(fingerprint) {
2231
2217
  try {
2232
2218
  const config = loadConfig();
2233
2219
  if (!config) return;
2234
- const fileContents = {};
2235
- let totalSize = 0;
2236
- for (const treePath of fingerprint.fileTree) {
2237
- const basename = path5.basename(treePath);
2238
- if (!DEP_FILE_PATTERNS.includes(basename)) continue;
2239
- const fullPath = path5.join(dir, treePath);
2240
- if (!fs6.existsSync(fullPath)) continue;
2241
- try {
2242
- const content = fs6.readFileSync(fullPath, "utf-8");
2243
- if (totalSize + content.length > MAX_CONTENT_SIZE) break;
2244
- fileContents[treePath] = content;
2245
- totalSize += content.length;
2246
- } catch {
2247
- continue;
2220
+ if (fingerprint.fileTree.length === 0) return;
2221
+ const suffixCounts = {};
2222
+ for (const entry of fingerprint.fileTree) {
2223
+ if (entry.endsWith("/")) continue;
2224
+ const ext = path5.extname(entry).toLowerCase();
2225
+ if (ext) {
2226
+ suffixCounts[ext] = (suffixCounts[ext] || 0) + 1;
2248
2227
  }
2249
2228
  }
2250
- if (Object.keys(fileContents).length === 0 && fingerprint.fileTree.length === 0) return;
2251
- const result = await detectProjectStack(fingerprint.fileTree, fileContents);
2229
+ const result = await detectProjectStack(fingerprint.fileTree, suffixCounts);
2252
2230
  if (result.languages?.length) fingerprint.languages = result.languages;
2253
2231
  if (result.frameworks?.length) fingerprint.frameworks = result.frameworks;
2254
2232
  if (result.tools?.length) fingerprint.tools = result.tools;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.20.0-dev.1773686772",
3
+ "version": "1.20.0-dev.1773686790",
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": {