@rely-ai/caliber 1.29.3 → 1.29.4-dev.1774189303

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 +49 -4
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -3090,6 +3090,7 @@ import path9 from "path";
3090
3090
 
3091
3091
  // src/scoring/utils.ts
3092
3092
  import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
3093
+ import { execFileSync } from "child_process";
3093
3094
  import { join, relative } from "path";
3094
3095
  function readFileOrNull(filePath) {
3095
3096
  try {
@@ -3137,13 +3138,51 @@ var IGNORED_FILES = /* @__PURE__ */ new Set([
3137
3138
  "pnpm-lock.yaml",
3138
3139
  "bun.lockb"
3139
3140
  ]);
3141
+ function isGitRepo2(dir) {
3142
+ try {
3143
+ execFileSync("git", ["rev-parse", "--git-dir"], {
3144
+ cwd: dir,
3145
+ encoding: "utf-8",
3146
+ stdio: ["pipe", "pipe", "pipe"]
3147
+ });
3148
+ return true;
3149
+ } catch {
3150
+ return false;
3151
+ }
3152
+ }
3153
+ function checkGitIgnored(dir, paths) {
3154
+ if (paths.length === 0) return /* @__PURE__ */ new Set();
3155
+ try {
3156
+ const result = execFileSync(
3157
+ "git",
3158
+ ["check-ignore", ...paths],
3159
+ { cwd: dir, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
3160
+ );
3161
+ return new Set(result.split("\n").map((l) => l.trim()).filter(Boolean));
3162
+ } catch (err) {
3163
+ if (err && typeof err === "object" && "status" in err && err.status === 1) {
3164
+ return /* @__PURE__ */ new Set();
3165
+ }
3166
+ return null;
3167
+ }
3168
+ }
3140
3169
  function collectProjectStructure(dir, maxDepth = 2) {
3141
3170
  const dirs = [];
3142
3171
  const files = [];
3172
+ const useGit = isGitRepo2(dir);
3143
3173
  function walk(currentDir, depth) {
3144
3174
  if (depth > maxDepth) return;
3145
3175
  try {
3146
3176
  const entries = readdirSync(currentDir, { withFileTypes: true });
3177
+ const dirEntries = [];
3178
+ for (const entry of entries) {
3179
+ if (!entry.isDirectory()) continue;
3180
+ const name = entry.name;
3181
+ if (IGNORED_DIRS.has(name)) continue;
3182
+ if (name.startsWith(".") && IGNORED_DIRS.has(name)) continue;
3183
+ dirEntries.push({ name, rel: relative(dir, join(currentDir, name)) });
3184
+ }
3185
+ const gitIgnored = useGit ? checkGitIgnored(dir, dirEntries.map((d) => d.rel)) : null;
3147
3186
  for (const entry of entries) {
3148
3187
  const name = entry.name;
3149
3188
  if (name.startsWith(".") && IGNORED_DIRS.has(name)) continue;
@@ -3151,6 +3190,7 @@ function collectProjectStructure(dir, maxDepth = 2) {
3151
3190
  const rel = relative(dir, join(currentDir, name));
3152
3191
  if (entry.isDirectory()) {
3153
3192
  if (IGNORED_DIRS.has(name)) continue;
3193
+ if (gitIgnored?.has(rel)) continue;
3154
3194
  dirs.push(rel);
3155
3195
  walk(join(currentDir, name), depth + 1);
3156
3196
  } else if (entry.isFile()) {
@@ -5194,6 +5234,10 @@ var COPILOT_ONLY_CHECKS = /* @__PURE__ */ new Set([
5194
5234
  var NON_CODEX_CHECKS = /* @__PURE__ */ new Set([
5195
5235
  "agents_md_exists"
5196
5236
  ]);
5237
+ var CLAUDE_OR_CODEX_CHECKS = /* @__PURE__ */ new Set([
5238
+ "skills_exist",
5239
+ "open_skills_format"
5240
+ ]);
5197
5241
  var GRADE_THRESHOLDS = [
5198
5242
  { minScore: 85, grade: "A" },
5199
5243
  { minScore: 70, grade: "B" },
@@ -6070,6 +6114,7 @@ function filterChecksForTarget(checks, target) {
6070
6114
  if (COPILOT_ONLY_CHECKS.has(c.id)) return target.includes("github-copilot");
6071
6115
  if (BOTH_ONLY_CHECKS.has(c.id)) return target.includes("claude") && target.includes("cursor");
6072
6116
  if (NON_CODEX_CHECKS.has(c.id)) return !target.includes("codex");
6117
+ if (CLAUDE_OR_CODEX_CHECKS.has(c.id)) return target.includes("claude") || target.includes("codex");
6073
6118
  return true;
6074
6119
  });
6075
6120
  }
@@ -9328,7 +9373,7 @@ async function regenerateCommand(options) {
9328
9373
  import fs33 from "fs";
9329
9374
  import os7 from "os";
9330
9375
  import path25 from "path";
9331
- import { execFileSync } from "child_process";
9376
+ import { execFileSync as execFileSync2 } from "child_process";
9332
9377
  import chalk18 from "chalk";
9333
9378
  var CONFIG_FILES = ["CLAUDE.md", "AGENTS.md", ".cursorrules", "CALIBER_LEARNINGS.md"];
9334
9379
  var CONFIG_DIRS = [".claude", ".cursor"];
@@ -9338,18 +9383,18 @@ function scoreBaseRef(ref, target) {
9338
9383
  try {
9339
9384
  for (const file of CONFIG_FILES) {
9340
9385
  try {
9341
- const content = execFileSync("git", ["show", `${ref}:${file}`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
9386
+ const content = execFileSync2("git", ["show", `${ref}:${file}`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
9342
9387
  fs33.writeFileSync(path25.join(tmpDir, file), content);
9343
9388
  } catch {
9344
9389
  }
9345
9390
  }
9346
9391
  for (const dir of CONFIG_DIRS) {
9347
9392
  try {
9348
- const files = execFileSync("git", ["ls-tree", "-r", "--name-only", ref, `${dir}/`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n").filter(Boolean);
9393
+ const files = execFileSync2("git", ["ls-tree", "-r", "--name-only", ref, `${dir}/`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n").filter(Boolean);
9349
9394
  for (const file of files) {
9350
9395
  const filePath = path25.join(tmpDir, file);
9351
9396
  fs33.mkdirSync(path25.dirname(filePath), { recursive: true });
9352
- const content = execFileSync("git", ["show", `${ref}:${file}`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
9397
+ const content = execFileSync2("git", ["show", `${ref}:${file}`], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
9353
9398
  fs33.writeFileSync(filePath, content);
9354
9399
  }
9355
9400
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.29.3",
3
+ "version": "1.29.4-dev.1774189303",
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": {