borgmcp 1.0.6 → 1.0.7

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 (157) hide show
  1. package/dist/assimilate-cmd.js +39 -511
  2. package/dist/assimilate-deps.js +3 -177
  3. package/dist/assimilate-welcome.js +2 -24
  4. package/dist/auth-env.js +1 -107
  5. package/dist/auth.js +23 -612
  6. package/dist/claude.js +11 -281
  7. package/dist/cli-help.js +29 -50
  8. package/dist/cli-platform.js +4 -94
  9. package/dist/codex-app-server.js +4 -228
  10. package/dist/codex-app-wake.js +2 -122
  11. package/dist/codex-launch.js +1 -81
  12. package/dist/codex-remote.js +1 -250
  13. package/dist/config-utils.js +3 -385
  14. package/dist/config.js +1 -190
  15. package/dist/console-prefix.js +1 -86
  16. package/dist/cube-name.js +1 -65
  17. package/dist/cubes.js +4 -269
  18. package/dist/debug.js +1 -71
  19. package/dist/device-auth.js +1 -167
  20. package/dist/direct-log.js +1 -11
  21. package/dist/health-beat.js +1 -168
  22. package/dist/inbox-monitor.js +1 -129
  23. package/dist/index.js +26 -1378
  24. package/dist/lifecycle-log-guard.js +2 -93
  25. package/dist/list-roles-render.js +6 -39
  26. package/dist/log-audit.js +3 -186
  27. package/dist/log-stream.js +9 -848
  28. package/dist/name-validator.js +1 -22
  29. package/dist/parse-assimilate-args.js +1 -82
  30. package/dist/postinstall.js +8 -22
  31. package/dist/regen-format.js +11 -337
  32. package/dist/regen.js +5 -83
  33. package/dist/remote-client.js +1 -695
  34. package/dist/role-resolver.js +1 -36
  35. package/dist/role-section.js +8 -208
  36. package/dist/roster-render.js +3 -96
  37. package/dist/setup.js +36 -251
  38. package/dist/shell-escape.js +1 -22
  39. package/dist/spawn.js +10 -29
  40. package/dist/stale-version-check.js +1 -102
  41. package/dist/stream-owner.js +2 -202
  42. package/dist/stream-status.js +3 -211
  43. package/dist/subscription-retry.js +1 -23
  44. package/dist/sync-roles-render.js +3 -118
  45. package/dist/sync.js +22 -286
  46. package/dist/templates.js +120 -626
  47. package/dist/terminal-title.js +1 -68
  48. package/dist/token-crypto.js +1 -91
  49. package/dist/token-store.js +1 -222
  50. package/dist/types.js +0 -5
  51. package/dist/version.js +2 -78
  52. package/dist/worktree-lifecycle.js +2 -173
  53. package/package.json +11 -2
  54. package/dist/assimilate-cmd.d.ts.map +0 -1
  55. package/dist/assimilate-cmd.js.map +0 -1
  56. package/dist/assimilate-deps.d.ts.map +0 -1
  57. package/dist/assimilate-deps.js.map +0 -1
  58. package/dist/assimilate-welcome.d.ts.map +0 -1
  59. package/dist/assimilate-welcome.js.map +0 -1
  60. package/dist/auth-env.d.ts.map +0 -1
  61. package/dist/auth-env.js.map +0 -1
  62. package/dist/auth.d.ts.map +0 -1
  63. package/dist/auth.js.map +0 -1
  64. package/dist/claude.d.ts.map +0 -1
  65. package/dist/claude.js.map +0 -1
  66. package/dist/cli-help.d.ts.map +0 -1
  67. package/dist/cli-help.js.map +0 -1
  68. package/dist/cli-platform.d.ts.map +0 -1
  69. package/dist/cli-platform.js.map +0 -1
  70. package/dist/codex-app-server.d.ts.map +0 -1
  71. package/dist/codex-app-server.js.map +0 -1
  72. package/dist/codex-app-wake.d.ts.map +0 -1
  73. package/dist/codex-app-wake.js.map +0 -1
  74. package/dist/codex-launch.d.ts.map +0 -1
  75. package/dist/codex-launch.js.map +0 -1
  76. package/dist/codex-remote.d.ts.map +0 -1
  77. package/dist/codex-remote.js.map +0 -1
  78. package/dist/config-utils.d.ts.map +0 -1
  79. package/dist/config-utils.js.map +0 -1
  80. package/dist/config.d.ts.map +0 -1
  81. package/dist/config.js.map +0 -1
  82. package/dist/console-prefix.d.ts.map +0 -1
  83. package/dist/console-prefix.js.map +0 -1
  84. package/dist/cube-name.d.ts.map +0 -1
  85. package/dist/cube-name.js.map +0 -1
  86. package/dist/cubes.d.ts.map +0 -1
  87. package/dist/cubes.js.map +0 -1
  88. package/dist/debug.d.ts.map +0 -1
  89. package/dist/debug.js.map +0 -1
  90. package/dist/device-auth.d.ts.map +0 -1
  91. package/dist/device-auth.js.map +0 -1
  92. package/dist/direct-log.d.ts.map +0 -1
  93. package/dist/direct-log.js.map +0 -1
  94. package/dist/health-beat.d.ts.map +0 -1
  95. package/dist/health-beat.js.map +0 -1
  96. package/dist/inbox-monitor.d.ts.map +0 -1
  97. package/dist/inbox-monitor.js.map +0 -1
  98. package/dist/index.d.ts.map +0 -1
  99. package/dist/index.js.map +0 -1
  100. package/dist/lifecycle-log-guard.d.ts.map +0 -1
  101. package/dist/lifecycle-log-guard.js.map +0 -1
  102. package/dist/list-roles-render.d.ts.map +0 -1
  103. package/dist/list-roles-render.js.map +0 -1
  104. package/dist/log-audit.d.ts.map +0 -1
  105. package/dist/log-audit.js.map +0 -1
  106. package/dist/log-stream.d.ts.map +0 -1
  107. package/dist/log-stream.js.map +0 -1
  108. package/dist/name-validator.d.ts.map +0 -1
  109. package/dist/name-validator.js.map +0 -1
  110. package/dist/parse-assimilate-args.d.ts.map +0 -1
  111. package/dist/parse-assimilate-args.js.map +0 -1
  112. package/dist/postinstall.d.ts.map +0 -1
  113. package/dist/postinstall.js.map +0 -1
  114. package/dist/regen-format.d.ts.map +0 -1
  115. package/dist/regen-format.js.map +0 -1
  116. package/dist/regen.d.ts.map +0 -1
  117. package/dist/regen.js.map +0 -1
  118. package/dist/remote-client.d.ts.map +0 -1
  119. package/dist/remote-client.js.map +0 -1
  120. package/dist/role-resolver.d.ts.map +0 -1
  121. package/dist/role-resolver.js.map +0 -1
  122. package/dist/role-section.d.ts.map +0 -1
  123. package/dist/role-section.js.map +0 -1
  124. package/dist/roster-render.d.ts.map +0 -1
  125. package/dist/roster-render.js.map +0 -1
  126. package/dist/setup.d.ts.map +0 -1
  127. package/dist/setup.js.map +0 -1
  128. package/dist/shell-escape.d.ts.map +0 -1
  129. package/dist/shell-escape.js.map +0 -1
  130. package/dist/spawn.d.ts.map +0 -1
  131. package/dist/spawn.js.map +0 -1
  132. package/dist/stale-version-check.d.ts.map +0 -1
  133. package/dist/stale-version-check.js.map +0 -1
  134. package/dist/stream-owner.d.ts.map +0 -1
  135. package/dist/stream-owner.js.map +0 -1
  136. package/dist/stream-status.d.ts.map +0 -1
  137. package/dist/stream-status.js.map +0 -1
  138. package/dist/subscription-retry.d.ts.map +0 -1
  139. package/dist/subscription-retry.js.map +0 -1
  140. package/dist/sync-roles-render.d.ts.map +0 -1
  141. package/dist/sync-roles-render.js.map +0 -1
  142. package/dist/sync.d.ts.map +0 -1
  143. package/dist/sync.js.map +0 -1
  144. package/dist/templates.d.ts.map +0 -1
  145. package/dist/templates.js.map +0 -1
  146. package/dist/terminal-title.d.ts.map +0 -1
  147. package/dist/terminal-title.js.map +0 -1
  148. package/dist/token-crypto.d.ts.map +0 -1
  149. package/dist/token-crypto.js.map +0 -1
  150. package/dist/token-store.d.ts.map +0 -1
  151. package/dist/token-store.js.map +0 -1
  152. package/dist/types.d.ts.map +0 -1
  153. package/dist/types.js.map +0 -1
  154. package/dist/version.d.ts.map +0 -1
  155. package/dist/version.js.map +0 -1
  156. package/dist/worktree-lifecycle.d.ts.map +0 -1
  157. package/dist/worktree-lifecycle.js.map +0 -1
package/dist/regen.js CHANGED
@@ -1,84 +1,6 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * borg-regen CLI
4
- *
5
- * Prints a markdown-formatted regen of the active cube to stdout.
6
- * Designed to be wired into a Claude Code SessionStart hook so that
7
- * each new session begins fully oriented to the cube.
8
- *
9
- * Behavior:
10
- * - No active cube: print a friendly notice to stdout, exit 0.
11
- * (A SessionStart hook should not block session start over a missing
12
- * cube — the user may not be using Borg in this directory.)
13
- * - Active cube + success: print regen markdown to stdout, exit 0.
14
- * - Active cube + HTTP/auth error: print one-line message to stderr,
15
- * exit non-zero so the hook surfaces the failure but doesn't drown
16
- * the session in a stack trace.
17
- */
18
- import { regen, listCubes } from './remote-client.js';
19
- import { getActiveCube } from './cubes.js';
20
- import { formatRegenMarkdown } from './regen-format.js';
21
- import { handleVersionFlag } from './version.js';
22
- async function main() {
23
- handleVersionFlag();
24
- const active = await getActiveCube();
25
- if (!active) {
26
- await emitUnassimilatedNotice();
27
- return;
28
- }
29
- const result = await regen(active.sessionToken, active.apiUrl);
30
- process.stdout.write(formatRegenMarkdown(result) + '\n');
31
- }
32
- /**
33
- * Render a discoverability stub for a session that's running with the
34
- * borg MCP server installed but no cube assimilated in this project.
35
- * Informs the user which cubes exist on their account. Written as a
36
- * status report TO THE USER, not as instructions to the drone — the
37
- * drone must wait for explicit user approval before calling
38
- * borg:assimilate or any other state-changing borg tool.
39
- */
40
- async function emitUnassimilatedNotice() {
41
- const lines = [];
42
- lines.push('# Borg MCP — not connected to a cube');
43
- lines.push('');
44
- lines.push('The borg MCP server is installed in this project but no cube has been joined here yet.');
45
- lines.push('');
46
- lines.push('**Drone instructions:**');
47
- lines.push('1. **Tell the user** which cubes exist on their account (see the list below) and ask them which one to join, or whether to create a new cube. This is the first thing you should surface in this session.');
48
- lines.push('2. **Do not** call `borg:assimilate`, `borg:create-cube`, or any other state-changing borg tool until the user has chosen.');
49
- lines.push('3. The user may also decline to use borg in this project at all — that\'s a valid choice; just stop suggesting it.');
50
- lines.push('');
51
- // Best-effort: list the user's cubes so the user can see what's
52
- // available if they decide to join one. Network failure or auth
53
- // issue here is non-fatal — the SessionStart hook should never
54
- // block session start.
55
- try {
56
- const { cubes } = await listCubes();
57
- if (cubes.length > 0) {
58
- lines.push('## Cubes on your account');
59
- for (const c of cubes) {
60
- lines.push(`- **${c.name}** (id: ${c.id})`);
61
- }
62
- }
63
- else {
64
- lines.push('## Cubes on your account');
65
- lines.push('_(none yet — offer to create one via `borg:create-cube` once the user confirms)_');
66
- }
67
- }
68
- catch (err) {
69
- lines.push('## Cubes on your account');
70
- lines.push('_(could not list — ' + (err?.message ?? String(err)) + ')_');
71
- }
72
- lines.push('');
73
- lines.push('## Tools you can call once the user has chosen');
74
- lines.push('- Join an existing cube: `borg:assimilate cube_name="<their choice>"`');
75
- lines.push('- Create a new cube: `borg:create-cube name="<name>" cube_directive="<markdown>"` (optionally `template="software-dev"`)');
76
- lines.push('- See available templates: `borg:list-templates`');
77
- process.stdout.write(lines.join('\n') + '\n');
78
- }
79
- main().catch((error) => {
80
- const msg = error?.message ?? String(error);
81
- process.stderr.write(`borg-regen: ${msg}\n`);
82
- process.exit(1);
83
- });
84
- //# sourceMappingURL=regen.js.map
2
+ import{regen as o,listCubes as n}from"./remote-client.js";import{getActiveCube as i}from"./cubes.js";import{formatRegenMarkdown as a}from"./regen-format.js";import{handleVersionFlag as r}from"./version.js";async function c(){r();const e=await i();if(!e){await u();return}const s=await o(e.sessionToken,e.apiUrl);process.stdout.write(a(s)+`
3
+ `)}async function u(){const e=[];e.push("# Borg MCP \u2014 not connected to a cube"),e.push(""),e.push("The borg MCP server is installed in this project but no cube has been joined here yet."),e.push(""),e.push("**Drone instructions:**"),e.push("1. **Tell the user** which cubes exist on their account (see the list below) and ask them which one to join, or whether to create a new cube. This is the first thing you should surface in this session."),e.push("2. **Do not** call `borg:assimilate`, `borg:create-cube`, or any other state-changing borg tool until the user has chosen."),e.push("3. The user may also decline to use borg in this project at all \u2014 that's a valid choice; just stop suggesting it."),e.push("");try{const{cubes:s}=await n();if(s.length>0){e.push("## Cubes on your account");for(const t of s)e.push(`- **${t.name}** (id: ${t.id})`)}else e.push("## Cubes on your account"),e.push("_(none yet \u2014 offer to create one via `borg:create-cube` once the user confirms)_")}catch(s){e.push("## Cubes on your account"),e.push("_(could not list \u2014 "+(s?.message??String(s))+")_")}e.push(""),e.push("## Tools you can call once the user has chosen"),e.push('- Join an existing cube: `borg:assimilate cube_name="<their choice>"`'),e.push('- Create a new cube: `borg:create-cube name="<name>" cube_directive="<markdown>"` (optionally `template="software-dev"`)'),e.push("- See available templates: `borg:list-templates`"),process.stdout.write(e.join(`
4
+ `)+`
5
+ `)}c().catch(e=>{const s=e?.message??String(e);process.stderr.write(`borg-regen: ${s}
6
+ `),process.exit(1)});