@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.
- package/package.json +1 -1
- package/src/commands.mjs +12 -4
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -323,8 +323,16 @@ function gitHint(cwd, args) {
|
|
|
323
323
|
catch { return null; }
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
/**
|
|
327
|
-
|
|
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 =
|
|
344
|
+
const branch = git(cwd, ["branch", "--show-current"]);
|
|
337
345
|
const ticket = branch?.match(/(?:^|\/)((?:bot|ent)-\d+)(?:-|$)/i)?.[1]?.toUpperCase() ?? null;
|
|
338
|
-
const remote =
|
|
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);
|