@botbuddy/cli 1.30.1 → 1.30.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/package.json +1 -1
  2. package/src/commands.mjs +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbuddy/cli",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/commands.mjs CHANGED
@@ -323,8 +323,16 @@ function gitHint(cwd, args) {
323
323
  catch { return null; }
324
324
  }
325
325
 
326
- /** Best-effort display-only context. It is never an authorization input. */
327
- export function deriveCallerHint({ env = process.env, cwd = process.cwd() } = {}) {
326
+ /**
327
+ * Best-effort display-only context. It is never an authorization input.
328
+ *
329
+ * `git` is injectable so a test can exercise the branch/remote parsing without
330
+ * depending on the ambient checkout: a detached-HEAD checkout (the npm publish
331
+ * lane checks out the promoted SHA, not a branch) has no branch name, which used
332
+ * to make the branch-recognition assertion fail only in CI (BOT-1649 publish run
333
+ * 35328434334). Production still defaults to the real git resolver.
334
+ */
335
+ export function deriveCallerHint({ env = process.env, cwd = process.cwd(), git = gitHint } = {}) {
328
336
  let cachedAgentId = null;
329
337
  try {
330
338
  const path = join(cwd, ".botbuddy", "agent-state.json");
@@ -333,9 +341,9 @@ export function deriveCallerHint({ env = process.env, cwd = process.cwd() } = {}
333
341
  cachedAgentId = typeof parsed?.agent_id === "string" && parsed.agent_id ? parsed.agent_id : null;
334
342
  }
335
343
  } catch { /* a malformed cache is not a login failure */ }
336
- const branch = gitHint(cwd, ["branch", "--show-current"]);
344
+ const branch = git(cwd, ["branch", "--show-current"]);
337
345
  const ticket = branch?.match(/(?:^|\/)((?:bot|ent)-\d+)(?:-|$)/i)?.[1]?.toUpperCase() ?? null;
338
- const remote = gitHint(cwd, ["remote", "get-url", "origin"]);
346
+ const remote = git(cwd, ["remote", "get-url", "origin"]);
339
347
  const repo = remote?.match(/(?:github\.com[:/])([^/]+\/[^/.]+)(?:\.git)?$/i)?.[1] ?? null;
340
348
  const harness = env.BOTBUDDY_CALLER_HARNESS
341
349
  || (env.CLAUDE_CODE || env.CLAUDECODE ? "claude-code" : Object.keys(env).some((key) => key.startsWith("CODEX_")) ? "codex" : null);