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.
- package/dist/assimilate-cmd.js +39 -511
- package/dist/assimilate-deps.js +3 -177
- package/dist/assimilate-welcome.js +2 -24
- package/dist/auth-env.js +1 -107
- package/dist/auth.js +23 -612
- package/dist/claude.js +11 -281
- package/dist/cli-help.js +29 -50
- package/dist/cli-platform.js +4 -94
- package/dist/codex-app-server.js +4 -228
- package/dist/codex-app-wake.js +2 -122
- package/dist/codex-launch.js +1 -81
- package/dist/codex-remote.js +1 -250
- package/dist/config-utils.js +3 -385
- package/dist/config.js +1 -190
- package/dist/console-prefix.js +1 -86
- package/dist/cube-name.js +1 -65
- package/dist/cubes.js +4 -269
- package/dist/debug.js +1 -71
- package/dist/device-auth.js +1 -167
- package/dist/direct-log.js +1 -11
- package/dist/health-beat.js +1 -168
- package/dist/inbox-monitor.js +1 -129
- package/dist/index.js +26 -1378
- package/dist/lifecycle-log-guard.js +2 -93
- package/dist/list-roles-render.js +6 -39
- package/dist/log-audit.js +3 -186
- package/dist/log-stream.js +9 -848
- package/dist/name-validator.js +1 -22
- package/dist/parse-assimilate-args.js +1 -82
- package/dist/postinstall.js +8 -22
- package/dist/regen-format.js +11 -337
- package/dist/regen.js +5 -83
- package/dist/remote-client.js +1 -695
- package/dist/role-resolver.js +1 -36
- package/dist/role-section.js +8 -208
- package/dist/roster-render.js +3 -96
- package/dist/setup.js +36 -251
- package/dist/shell-escape.js +1 -22
- package/dist/spawn.js +10 -29
- package/dist/stale-version-check.js +1 -102
- package/dist/stream-owner.js +2 -202
- package/dist/stream-status.js +3 -211
- package/dist/subscription-retry.js +1 -23
- package/dist/sync-roles-render.js +3 -118
- package/dist/sync.js +22 -286
- package/dist/templates.js +120 -626
- package/dist/terminal-title.js +1 -68
- package/dist/token-crypto.js +1 -91
- package/dist/token-store.js +1 -222
- package/dist/types.js +0 -5
- package/dist/version.js +2 -78
- package/dist/worktree-lifecycle.js +2 -173
- package/package.json +11 -2
- package/dist/assimilate-cmd.d.ts.map +0 -1
- package/dist/assimilate-cmd.js.map +0 -1
- package/dist/assimilate-deps.d.ts.map +0 -1
- package/dist/assimilate-deps.js.map +0 -1
- package/dist/assimilate-welcome.d.ts.map +0 -1
- package/dist/assimilate-welcome.js.map +0 -1
- package/dist/auth-env.d.ts.map +0 -1
- package/dist/auth-env.js.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/claude.d.ts.map +0 -1
- package/dist/claude.js.map +0 -1
- package/dist/cli-help.d.ts.map +0 -1
- package/dist/cli-help.js.map +0 -1
- package/dist/cli-platform.d.ts.map +0 -1
- package/dist/cli-platform.js.map +0 -1
- package/dist/codex-app-server.d.ts.map +0 -1
- package/dist/codex-app-server.js.map +0 -1
- package/dist/codex-app-wake.d.ts.map +0 -1
- package/dist/codex-app-wake.js.map +0 -1
- package/dist/codex-launch.d.ts.map +0 -1
- package/dist/codex-launch.js.map +0 -1
- package/dist/codex-remote.d.ts.map +0 -1
- package/dist/codex-remote.js.map +0 -1
- package/dist/config-utils.d.ts.map +0 -1
- package/dist/config-utils.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/console-prefix.d.ts.map +0 -1
- package/dist/console-prefix.js.map +0 -1
- package/dist/cube-name.d.ts.map +0 -1
- package/dist/cube-name.js.map +0 -1
- package/dist/cubes.d.ts.map +0 -1
- package/dist/cubes.js.map +0 -1
- package/dist/debug.d.ts.map +0 -1
- package/dist/debug.js.map +0 -1
- package/dist/device-auth.d.ts.map +0 -1
- package/dist/device-auth.js.map +0 -1
- package/dist/direct-log.d.ts.map +0 -1
- package/dist/direct-log.js.map +0 -1
- package/dist/health-beat.d.ts.map +0 -1
- package/dist/health-beat.js.map +0 -1
- package/dist/inbox-monitor.d.ts.map +0 -1
- package/dist/inbox-monitor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lifecycle-log-guard.d.ts.map +0 -1
- package/dist/lifecycle-log-guard.js.map +0 -1
- package/dist/list-roles-render.d.ts.map +0 -1
- package/dist/list-roles-render.js.map +0 -1
- package/dist/log-audit.d.ts.map +0 -1
- package/dist/log-audit.js.map +0 -1
- package/dist/log-stream.d.ts.map +0 -1
- package/dist/log-stream.js.map +0 -1
- package/dist/name-validator.d.ts.map +0 -1
- package/dist/name-validator.js.map +0 -1
- package/dist/parse-assimilate-args.d.ts.map +0 -1
- package/dist/parse-assimilate-args.js.map +0 -1
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js.map +0 -1
- package/dist/regen-format.d.ts.map +0 -1
- package/dist/regen-format.js.map +0 -1
- package/dist/regen.d.ts.map +0 -1
- package/dist/regen.js.map +0 -1
- package/dist/remote-client.d.ts.map +0 -1
- package/dist/remote-client.js.map +0 -1
- package/dist/role-resolver.d.ts.map +0 -1
- package/dist/role-resolver.js.map +0 -1
- package/dist/role-section.d.ts.map +0 -1
- package/dist/role-section.js.map +0 -1
- package/dist/roster-render.d.ts.map +0 -1
- package/dist/roster-render.js.map +0 -1
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js.map +0 -1
- package/dist/shell-escape.d.ts.map +0 -1
- package/dist/shell-escape.js.map +0 -1
- package/dist/spawn.d.ts.map +0 -1
- package/dist/spawn.js.map +0 -1
- package/dist/stale-version-check.d.ts.map +0 -1
- package/dist/stale-version-check.js.map +0 -1
- package/dist/stream-owner.d.ts.map +0 -1
- package/dist/stream-owner.js.map +0 -1
- package/dist/stream-status.d.ts.map +0 -1
- package/dist/stream-status.js.map +0 -1
- package/dist/subscription-retry.d.ts.map +0 -1
- package/dist/subscription-retry.js.map +0 -1
- package/dist/sync-roles-render.d.ts.map +0 -1
- package/dist/sync-roles-render.js.map +0 -1
- package/dist/sync.d.ts.map +0 -1
- package/dist/sync.js.map +0 -1
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js.map +0 -1
- package/dist/terminal-title.d.ts.map +0 -1
- package/dist/terminal-title.js.map +0 -1
- package/dist/token-crypto.d.ts.map +0 -1
- package/dist/token-crypto.js.map +0 -1
- package/dist/token-store.d.ts.map +0 -1
- package/dist/token-store.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/worktree-lifecycle.d.ts.map +0 -1
- 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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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)});
|