breakaway 1.5.0-main.21 → 1.5.0-main.22

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakaway",
3
- "version": "1.5.0-main.21",
3
+ "version": "1.5.0-main.22",
4
4
  "description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -52,13 +52,23 @@ export function mcpConfig({ url, agent, repo = null, tokenVar }) {
52
52
  * docs/specs/IDEA-25-claude-plugin.md, section 4). Claude Code reads them as JSON from standard output, so the token is
53
53
  * its value here, and only there. Outside a repository the board tracks there's only Authorization, and the repository's
54
54
  * tools say what's missing; without a token there's none, so a session's proxy can add it.
55
- * @param {{ token?: string | null, agent: string, repo?: string | null }} options
55
+ *
56
+ * The agent's name is X-Breakaway-Agent only when the CLI has one of its own (`named`: --as, BREAKAWAY_AGENT, or
57
+ * tasks.env). Otherwise it's `agent`, claude-<branch>, as X-Breakaway-Agent-Default: the helper can't see the plugin's
58
+ * agent_name, which the plugin sends as a static X-Breakaway-Agent that this one would override, and /mcp takes the
59
+ * default only when that's empty (CLI-16).
60
+ * @param {{ token?: string | null, named?: string | null, agent: string, repo?: string | null }} options
56
61
  * @returns {Record<string, string>}
57
62
  */
58
- export function mcpHeaders({ token = null, agent, repo = null }) {
63
+ export function mcpHeaders({ token = null, named = null, agent, repo = null }) {
59
64
  return {
60
65
  ...(token ? { Authorization: `Bearer ${token}` } : {}),
61
- ...(repo ? { 'X-Breakaway-Agent': agent, 'X-Breakaway-Repo': repo } : {}),
66
+ ...(repo
67
+ ? {
68
+ ...(named ? { 'X-Breakaway-Agent': named } : { 'X-Breakaway-Agent-Default': agent }),
69
+ 'X-Breakaway-Repo': repo,
70
+ }
71
+ : {}),
62
72
  };
63
73
  }
64
74
 
package/scripts/tasks.mjs CHANGED
@@ -1637,7 +1637,8 @@ const commands = {
1637
1637
  } catch {
1638
1638
  /* not a git checkout */
1639
1639
  }
1640
- const name = mcpAgent({ named: opts.as ?? setting('AGENT'), branch, fallback: agent() });
1640
+ const named = opts.as ?? setting('AGENT');
1641
+ const name = mcpAgent({ named, branch, fallback: agent() });
1641
1642
  if (opts.headers) {
1642
1643
  const token = setting('TOKEN');
1643
1644
  let remote = null;
@@ -1659,7 +1660,7 @@ const commands = {
1659
1660
  fetch,
1660
1661
  });
1661
1662
  // Standard output is Claude Code's, and only the headers go there: never --json's wrapping, never a line of text.
1662
- console.log(JSON.stringify(mcpHeaders({ token, agent: name, repo })));
1663
+ console.log(JSON.stringify(mcpHeaders({ token, named, agent: name, repo })));
1663
1664
  return;
1664
1665
  }
1665
1666
  const tokenVar = envName('TOKEN');
@@ -2540,8 +2541,9 @@ if (opts.help || command === 'help') {
2540
2541
  process.exitCode = (await import('./tasks/pipeline.js')).run(args, opts);
2541
2542
  } else if (!commands[command]) {
2542
2543
  fail(`no command "${command}". npx breakaway help lists them.`);
2543
- } else if (!BASE && command !== 'init-secrets' && command !== 'hook') {
2544
+ } else if (!BASE && command !== 'init-secrets' && command !== 'hook' && !(command === 'mcp' && opts.headers)) {
2544
2545
  // The hooks stay quiet without a board (a plugin installed but not set up, CLI-8): session-hook.mjs checks for itself.
2546
+ // The plugin's headersHelper never fails, and Claude Code tells it the board's address when only the plugin knows it.
2545
2547
  fail(
2546
2548
  `no board address. Set BREAKAWAY_URL (in the environment or ${ENV_FILE}), sync.server.url in this checkout's .taskrc, or the board's address in the breakaway plugin's settings (or run npx breakaway setup): see docs/tasks.md#another-install.`,
2547
2549
  );