@rely-ai/caliber 1.45.1 → 1.45.2

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 +36 -9
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -186,11 +186,19 @@ var resolve_caliber_exports = {};
186
186
  __export(resolve_caliber_exports, {
187
187
  isCaliberCommand: () => isCaliberCommand,
188
188
  isNpxResolution: () => isNpxResolution,
189
+ pickExecutable: () => pickExecutable,
189
190
  resetResolvedCaliber: () => resetResolvedCaliber,
190
191
  resolveCaliber: () => resolveCaliber
191
192
  });
192
193
  import fs6 from "fs";
193
194
  import { execSync as execSync5 } from "child_process";
195
+ function pickExecutable(out) {
196
+ const lines = out.split("\n").map((l) => l.trim()).filter(Boolean);
197
+ if (process.platform === "win32") {
198
+ return lines.find((l) => WINDOWS_EXEC_EXT.test(l)) ?? lines[0] ?? "";
199
+ }
200
+ return lines[0] ?? "";
201
+ }
194
202
  function resolveCaliber() {
195
203
  if (_resolved) return _resolved;
196
204
  const whichCmd = process.platform === "win32" ? "where caliber" : "which caliber";
@@ -199,7 +207,7 @@ function resolveCaliber() {
199
207
  if (isNpx) {
200
208
  try {
201
209
  const out = execSync5(whichCmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
202
- const caliberPath = out.split("\n")[0].trim();
210
+ const caliberPath = pickExecutable(out);
203
211
  if (caliberPath) {
204
212
  _resolved = caliberPath;
205
213
  return _resolved;
@@ -211,7 +219,7 @@ function resolveCaliber() {
211
219
  encoding: "utf-8",
212
220
  stdio: ["pipe", "pipe", "pipe"]
213
221
  }).trim();
214
- const npxPath = out.split("\n")[0].trim();
222
+ const npxPath = pickExecutable(out);
215
223
  if (npxPath) {
216
224
  _resolved = `${npxPath} --yes @rely-ai/caliber`;
217
225
  return _resolved;
@@ -226,7 +234,7 @@ function resolveCaliber() {
226
234
  encoding: "utf-8",
227
235
  stdio: ["pipe", "pipe", "pipe"]
228
236
  }).trim();
229
- const caliberPath = out.split("\n")[0].trim();
237
+ const caliberPath = pickExecutable(out);
230
238
  if (caliberPath) {
231
239
  _resolved = caliberPath;
232
240
  return _resolved;
@@ -243,7 +251,8 @@ function resolveCaliber() {
243
251
  }
244
252
  function isNpxResolution() {
245
253
  const r = resolveCaliber();
246
- return r === "npx --yes @rely-ai/caliber" || r.endsWith("/npx --yes @rely-ai/caliber");
254
+ if (r === "npx --yes @rely-ai/caliber") return true;
255
+ return NPX_RESOLUTION_RE.test(r);
247
256
  }
248
257
  function resetResolvedCaliber() {
249
258
  _resolved = null;
@@ -257,11 +266,13 @@ function isCaliberCommand(command, subcommandTail) {
257
266
  if (command.endsWith(`/npx @rely-ai/caliber ${subcommandTail}`)) return true;
258
267
  return false;
259
268
  }
260
- var _resolved;
269
+ var _resolved, WINDOWS_EXEC_EXT, NPX_RESOLUTION_RE;
261
270
  var init_resolve_caliber = __esm({
262
271
  "src/lib/resolve-caliber.ts"() {
263
272
  "use strict";
264
273
  _resolved = null;
274
+ WINDOWS_EXEC_EXT = /\.(cmd|exe|bat)$/i;
275
+ NPX_RESOLUTION_RE = /[\\/]npx(?:\.(?:cmd|exe|bat))? --yes @rely-ai\/caliber$/i;
265
276
  }
266
277
  });
267
278
 
@@ -13973,10 +13984,26 @@ async function learnObserveCommand(options) {
13973
13984
  const logFd = fs47.openSync(logPath, "a");
13974
13985
  const NPX_SUFFIX = " --yes @rely-ai/caliber";
13975
13986
  const [exe, binArgs] = isNpxResolution2() ? [bin.slice(0, -NPX_SUFFIX.length) || "npx", ["--yes", "@rely-ai/caliber"]] : [bin, []];
13976
- spawn5(exe, [...binArgs, "learn", "finalize", "--auto", "--incremental"], {
13977
- detached: true,
13978
- stdio: ["ignore", logFd, logFd]
13979
- }).unref();
13987
+ const isWin = process.platform === "win32";
13988
+ const spawnExe = isWin ? `"${exe}"` : exe;
13989
+ const child = spawn5(
13990
+ spawnExe,
13991
+ [...binArgs, "learn", "finalize", "--auto", "--incremental"],
13992
+ {
13993
+ detached: true,
13994
+ stdio: ["ignore", logFd, logFd],
13995
+ ...isWin && { shell: true }
13996
+ }
13997
+ );
13998
+ child.on("error", () => {
13999
+ try {
14000
+ const s = readState2();
14001
+ s.lastAnalysisEventCount = s.eventCount;
14002
+ writeState2(s);
14003
+ } catch {
14004
+ }
14005
+ });
14006
+ child.unref();
13980
14007
  fs47.closeSync(logFd);
13981
14008
  } catch {
13982
14009
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.45.1",
3
+ "version": "1.45.2",
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": {