@rely-ai/caliber 1.47.2 → 1.48.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 +37 -8
  2. package/package.json +4 -1
package/dist/bin.js CHANGED
@@ -2629,6 +2629,20 @@ function quoteForWindows(arg) {
2629
2629
  return '"' + arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1") + '"';
2630
2630
  }
2631
2631
 
2632
+ // src/lib/subprocess-sentinel.ts
2633
+ var CALIBER_SUBPROCESS_ENV = "CALIBER_SUBPROCESS";
2634
+ var CALIBER_SUBPROCESS_LEGACY_ENV = "CALIBER_SPAWNED";
2635
+ function isCaliberSubprocess() {
2636
+ return process.env[CALIBER_SUBPROCESS_ENV] === "1";
2637
+ }
2638
+ function withCaliberSubprocessEnv(env) {
2639
+ return {
2640
+ ...env,
2641
+ [CALIBER_SUBPROCESS_ENV]: "1",
2642
+ [CALIBER_SUBPROCESS_LEGACY_ENV]: "1"
2643
+ };
2644
+ }
2645
+
2632
2646
  // src/llm/cursor-acp.ts
2633
2647
  var IS_WINDOWS = process.platform === "win32";
2634
2648
  var _agentBin = null;
@@ -2704,7 +2718,10 @@ var CursorAcpProvider = class {
2704
2718
  const targetModel = model || this.defaultModel;
2705
2719
  if (this.warmProcess && !this.warmProcess.killed && this.warmModel === targetModel) return;
2706
2720
  const args = this.buildArgs(targetModel, false);
2707
- const env = { ...process.env, ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey } };
2721
+ const env = withCaliberSubprocessEnv({
2722
+ ...process.env,
2723
+ ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey }
2724
+ });
2708
2725
  this.warmProcess = IS_WINDOWS ? spawn([quoteForWindows(resolveAgentBin()), ...args.map(quoteForWindows)].join(" "), {
2709
2726
  stdio: ["pipe", "pipe", "pipe"],
2710
2727
  env,
@@ -2755,7 +2772,10 @@ var CursorAcpProvider = class {
2755
2772
  return { child: warm, stderrChunks: stderrChunks2 };
2756
2773
  }
2757
2774
  const args = this.buildArgs(model, streaming);
2758
- const env = { ...process.env, ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey } };
2775
+ const env = withCaliberSubprocessEnv({
2776
+ ...process.env,
2777
+ ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey }
2778
+ });
2759
2779
  const child = IS_WINDOWS ? spawn([quoteForWindows(resolveAgentBin()), ...args.map(quoteForWindows)].join(" "), {
2760
2780
  stdio: ["pipe", "pipe", "pipe"],
2761
2781
  env,
@@ -3006,7 +3026,7 @@ function cleanClaudeEnv() {
3006
3026
  }
3007
3027
  function spawnClaude(args) {
3008
3028
  const bin = resolveClaudeBin();
3009
- const env = { ...cleanClaudeEnv(), CALIBER_SPAWNED: "1" };
3029
+ const env = withCaliberSubprocessEnv(cleanClaudeEnv());
3010
3030
  return IS_WINDOWS2 ? spawn2([bin, ...args].join(" "), {
3011
3031
  cwd: process.cwd(),
3012
3032
  stdio: ["pipe", "pipe", "pipe"],
@@ -3174,7 +3194,7 @@ function isClaudeCliLoggedIn() {
3174
3194
  input: "",
3175
3195
  stdio: ["pipe", "pipe", "pipe"],
3176
3196
  timeout: 5e3,
3177
- env: cleanClaudeEnv()
3197
+ env: withCaliberSubprocessEnv(cleanClaudeEnv())
3178
3198
  });
3179
3199
  const output = result.toString().trim();
3180
3200
  try {
@@ -3224,7 +3244,7 @@ function isOpenCodeLoggedIn() {
3224
3244
  return cachedLoggedIn2;
3225
3245
  }
3226
3246
  function spawnOpenCode(args) {
3227
- const env = { ...process.env, OPENCODE_DISABLE_AUTOCOMPACT: "TRUE" };
3247
+ const env = withCaliberSubprocessEnv({ ...process.env, OPENCODE_DISABLE_AUTOCOMPACT: "TRUE" });
3228
3248
  if (IS_WINDOWS3) {
3229
3249
  return spawn3([OPENCODE_BIN, ...args].join(" "), {
3230
3250
  cwd: process.cwd(),
@@ -4705,6 +4725,10 @@ function createScriptHook(config) {
4705
4725
  return { isInstalled, install, remove };
4706
4726
  }
4707
4727
  var STOP_HOOK_SCRIPT_CONTENT = `#!/bin/sh
4728
+ # Don't block headless claude sessions spawned by caliber itself (e.g. during caliber refresh)
4729
+ if [ "$CALIBER_SUBPROCESS" = "1" ] || [ -n "$CALIBER_SPAWNED" ]; then
4730
+ exit 0
4731
+ fi
4708
4732
  if grep -q "caliber" .git/hooks/pre-commit 2>/dev/null; then
4709
4733
  exit 0
4710
4734
  fi
@@ -4727,6 +4751,11 @@ var removeStopHook = stopHook.remove;
4727
4751
  function getFreshnessScript() {
4728
4752
  const bin = resolveCaliber();
4729
4753
  return `#!/bin/sh
4754
+ # Don't run inside a caliber-spawned headless session \u2014 the systemMessage would
4755
+ # pollute the spawned agent's output and serves no purpose there.
4756
+ if [ "$CALIBER_SUBPROCESS" = "1" ] || [ -n "$CALIBER_SPAWNED" ]; then
4757
+ exit 0
4758
+ fi
4730
4759
  STATE_FILE=".caliber/.caliber-state.json"
4731
4760
  [ ! -f "$STATE_FILE" ] && exit 0
4732
4761
  LAST_SHA=$(grep -o '"lastRefreshSha":"[^"]*"' "$STATE_FILE" 2>/dev/null | cut -d'"' -f4)
@@ -13114,7 +13143,7 @@ async function refreshSingleRepo(repoDir, options) {
13114
13143
  }
13115
13144
  async function refreshCommand(options) {
13116
13145
  const quiet = !!options.quiet;
13117
- if (quiet && process.env.CALIBER_SPAWNED === "1") return;
13146
+ if (quiet && isCaliberSubprocess()) return;
13118
13147
  if (quiet) {
13119
13148
  const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
13120
13149
  if (isCaliberRunning2()) return;
@@ -14082,7 +14111,7 @@ function readFinalizeError() {
14082
14111
  }
14083
14112
  }
14084
14113
  async function learnObserveCommand(options) {
14085
- if (process.env.CALIBER_SPAWNED === "1") return;
14114
+ if (isCaliberSubprocess()) return;
14086
14115
  try {
14087
14116
  const raw = await readStdin();
14088
14117
  if (!raw.trim()) return;
@@ -14162,7 +14191,7 @@ async function learnObserveCommand(options) {
14162
14191
  async function learnFinalizeCommand(options) {
14163
14192
  const isAuto = options?.auto === true;
14164
14193
  const isIncremental = options?.incremental === true;
14165
- if (isAuto && process.env.CALIBER_SPAWNED === "1") return;
14194
+ if (isAuto && isCaliberSubprocess()) return;
14166
14195
  if (!options?.force && !isAuto) {
14167
14196
  const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
14168
14197
  if (isCaliberRunning2()) {
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.47.2",
3
+ "version": "1.48.0",
4
4
  "description": "AI context infrastructure for coding agents — keeps CLAUDE.md, Cursor rules, and skills in sync as your codebase evolves",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "caliber": "./dist/bin.js"
8
8
  },
9
9
  "scripts": {
10
+ "prebuild": "npm run build:skills:check",
10
11
  "build": "tsup",
12
+ "build:skills": "node scripts/generate-skills.mjs",
13
+ "build:skills:check": "node scripts/generate-skills.mjs --check",
11
14
  "dev": "tsup --watch",
12
15
  "dev:install": "npm run build && npm link",
13
16
  "test": "vitest run",