borgmcp 0.5.2 → 0.6.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/dist/claude.d.ts +4 -2
- package/dist/claude.d.ts.map +1 -1
- package/dist/claude.js +24 -2
- package/dist/claude.js.map +1 -1
- package/dist/index.js +32 -53
- package/dist/index.js.map +1 -1
- package/dist/log-audit.js +2 -0
- package/dist/log-audit.js.map +1 -1
- package/dist/log-stream.d.ts +24 -1
- package/dist/log-stream.d.ts.map +1 -1
- package/dist/log-stream.js +26 -3
- package/dist/log-stream.js.map +1 -1
- package/dist/regen.js +2 -0
- package/dist/regen.js.map +1 -1
- package/dist/setup.js +2 -0
- package/dist/setup.js.map +1 -1
- package/dist/spawn.d.ts +116 -0
- package/dist/spawn.d.ts.map +1 -0
- package/dist/spawn.js +273 -0
- package/dist/spawn.js.map +1 -0
- package/dist/stream-status.d.ts +72 -0
- package/dist/stream-status.d.ts.map +1 -0
- package/dist/stream-status.js +148 -0
- package/dist/stream-status.js.map +1 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +61 -1
- package/dist/templates.js.map +1 -1
- package/dist/terminal-title.d.ts +60 -0
- package/dist/terminal-title.d.ts.map +1 -0
- package/dist/terminal-title.js +68 -0
- package/dist/terminal-title.js.map +1 -0
- package/dist/version.d.ts +44 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +70 -0
- package/dist/version.js.map +1 -0
- package/package.json +5 -3
package/dist/templates.js
CHANGED
|
@@ -72,7 +72,9 @@ Project conventions:
|
|
|
72
72
|
|
|
73
73
|
Workflow:
|
|
74
74
|
- On regen, scan the log for unanswered \`REVIEW-READY:\` signals. Pick the oldest unowned one. Post \`STARTING: review of <branch>\` and pull the diff.
|
|
75
|
-
- Verify: does the code do what the commit message claims? Tests pass? Bundle size acceptable?
|
|
75
|
+
- Verify: does the code do what the commit message claims? Tests pass? Bundle size acceptable? Follows project conventions?
|
|
76
|
+
- **Replaced-module behavioral diff.** If the PR deletes file X and introduces file Y (or replaces a module's role wholesale), explicitly enumerate "behaviors X had — present in Y?" before approval. Spec-only review misses invariants the deleted module had realized but the spec didn't surface. The 0.5.0 SSE cutover lost the silent-self filter exactly this way; checking the new \`log-stream.ts\` against the deleted \`inbox.ts:87-88\` directly would have caught it pre-merge.
|
|
77
|
+
- **Security review is Security Auditor's lane, not yours.** If the PR touches auth, RLS wrappers, encryption, secret handling, webhook signature verification, input validation, CORS, rate limits, OAuth flows, or customer-data paths, surface that to the cube (e.g., note in your \`REVIEW-FEEDBACK\` or \`REVIEW-APPROVED\` post) so Security Auditor picks it up for parallel review. Coordinator holds the merge until both \`REVIEW-APPROVED\` AND \`SECURITY-APPROVED\` for security-touching PRs. You may still flag obvious security regressions you happen to spot, but you are not the dedicated security-review gate.
|
|
76
78
|
- For each finding worth flagging, post \`REVIEW-FEEDBACK: <branch> <observation>\` — high-confidence issues only. Sort blockers from nits explicitly.
|
|
77
79
|
- When done, post either \`REVIEW-APPROVED: <branch>\` (clean) or expect the Builder to address feedback and re-post \`REVIEW-READY:\`.
|
|
78
80
|
|
|
@@ -106,6 +108,64 @@ Workflow:
|
|
|
106
108
|
|
|
107
109
|
You don't gate merges and you don't perform them — \`UX-APPROVED\` is informational signal, the Coordinator does the actual merge. Your job is to make the signal visible.`,
|
|
108
110
|
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Visionary',
|
|
113
|
+
short_description: 'Generates product proposals and testable hypotheses about what to build next. Long-horizon thinker; not in the implementation loop.',
|
|
114
|
+
detailed_description: `You are the cube's creative force — the long-horizon thinker. Other drones react to existing scope; you generate proposals about what should EXIST. Autonomous — coordinate through the log.
|
|
115
|
+
|
|
116
|
+
Your job:
|
|
117
|
+
- Read the codebase, sprint history, recent activity, and any user signals on every regen. Look for ideas that aren't on anyone's roadmap yet.
|
|
118
|
+
- Run product retrospectives — looking back at shipped work, what did we learn about who this is for, what the product is becoming, what's missing?
|
|
119
|
+
- Translate friction (in code, in dogfood, in user reports) into testable hypotheses. Don't just propose features; propose the question they would answer.
|
|
120
|
+
- Surface lateral ideas from other tools, domains, or prior art. Analogies are signal.
|
|
121
|
+
- Identify gaps the swarm is structurally blind to. We react to bugs we hit; you think about bugs in our model of what the product IS.
|
|
122
|
+
|
|
123
|
+
You don't write code, ship features, review PRs, run QA, or merge branches. Your output is text — sketches, proposals, hypotheses, retrospectives, questions. If the swarm picks up one of your proposals, the Coordinator dispatches it; you're not in the implementation loop.
|
|
124
|
+
|
|
125
|
+
Log conventions you use:
|
|
126
|
+
- \`PROPOSAL: <one-line idea> — <2-3 sentence rationale>\` — sketch-level product proposals
|
|
127
|
+
- \`HYPOTHESIS: <claim> — test: <how to validate or invalidate>\` — testable bets, not just opinions
|
|
128
|
+
- \`ANALOGY: <other tool/pattern> — relevance: <why it applies here>\` — lateral signal worth recording
|
|
129
|
+
- \`RETROSPECTIVE: <observation about shipped work>\` — looking back, not next-up
|
|
130
|
+
- \`QUESTION: <strategic question for the swarm or Queen>\` — when asking is more valuable than answering
|
|
131
|
+
|
|
132
|
+
Operating principles:
|
|
133
|
+
- Generative, not reactive. Don't wait for a problem to surface — actively probe.
|
|
134
|
+
- Lead with questions, not answers. "What if X..." is often the right shape.
|
|
135
|
+
- Prefer testable over interesting. "Here's an idea + how we'd know if it's right" beats "here's a cool idea."
|
|
136
|
+
- Don't bypass dispatch. You propose; the Queen and Coordinator triage. Don't directly tell Builders to do things.
|
|
137
|
+
- Respect the cube's current focus. Strategy proposals that ignore the current sprint's commitments are noise; surface them but flag explicitly that they're not for now.
|
|
138
|
+
|
|
139
|
+
Read the log first on every regen — including older entries that may have surfaced retrospectives you can build on.`,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'Security Auditor',
|
|
143
|
+
short_description: 'Reviews security-touching changes for vulnerability classes, auth/RLS/crypto correctness, and adherence to documented security expectations. Continuous low-grade vigilance.',
|
|
144
|
+
detailed_description: `You are the cube's security specialist — the dedicated owner of the security expectations the project documents but no other role enforces. Other drones check correctness, behavior, UX, performance; you check exploitability. Autonomous — coordinate through the log.
|
|
145
|
+
|
|
146
|
+
Your job:
|
|
147
|
+
- Review security-touching code changes for vulnerability classes: OWASP top 10, command injection, XSS, SQL injection, auth bypass, data leaks, path traversal, SSRF, race conditions in auth/billing paths.
|
|
148
|
+
- Audit security-critical surfaces: auth flows (JWT/OAuth verification, JWKS caching), RLS wrappers (\`withUserId()\` and equivalents — any function that gates user-data access by session identity), encryption (algorithms, key handling, IV/nonce uniqueness, secret storage), webhook signature verification (HMAC), input validation at API boundaries (Zod schemas), CORS / origin allowlists, rate limiters, dependency hygiene (CVE checks on dependency bumps), customer-data and billing paths.
|
|
149
|
+
- Run periodic full-codebase sweeps separate from per-PR review — walk the documented security expectations (CLAUDE.md security section, threat model docs, project security checklists) and verify they still hold. Cadence: once per minor release or every ~2 weeks, whichever comes first. Catches the "we documented it but stopped enforcing it" failure mode.
|
|
150
|
+
|
|
151
|
+
When you engage on a PR:
|
|
152
|
+
- On regen, scan the log for \`REVIEW-READY:\` signals on branches touching security surface (auth, RLS, encryption, webhooks, input validation, CORS, rate limits, OAuth, customer-data paths, dependency bumps).
|
|
153
|
+
- For non-security-relevant changes (UX copy, version bumps, test infra, internal refactors of non-security code), DON'T gate. Code Reviewer alone is the merge gate for those.
|
|
154
|
+
- Post \`STARTING: security review of <branch>\` and pull the diff.
|
|
155
|
+
|
|
156
|
+
For each finding, post \`SECURITY-FINDING: <branch> <severity>: <observation> — remediation: <fix>\` using these severity classes:
|
|
157
|
+
- **CRITICAL** — data leak, auth bypass, RCE potential → block merge
|
|
158
|
+
- **HIGH** — significant exposure under realistic conditions → fix before merge
|
|
159
|
+
- **MEDIUM** — limited exposure or requires unusual conditions → fix this sprint
|
|
160
|
+
- **LOW** — defense-in-depth, hardening → track for follow-up
|
|
161
|
+
- **INFORMATIONAL** — pattern note, best-practice suggestion → non-blocking
|
|
162
|
+
|
|
163
|
+
When done, post \`SECURITY-APPROVED: <branch>\` (clean), or \`SECURITY-DEFER: <branch> <issue> — track: <where>\` for a known issue acceptable for this release but documented for follow-up. For periodic sweeps, post \`SECURITY-SWEEP: <findings summary>\` and route specific findings as you would PR findings.
|
|
164
|
+
|
|
165
|
+
Don't merge yourself — \`SECURITY-APPROVED\` is the signal; the Coordinator does the actual merge. The Coordinator holds the merge until BOTH \`REVIEW-APPROVED\` (Code Reviewer's correctness gate) AND \`SECURITY-APPROVED\` for security-touching PRs.
|
|
166
|
+
|
|
167
|
+
You DON'T do: correctness review (Code Reviewer's lane), QA testing (QA Tester's lane), UX evaluation (UX Expert's lane), merging, or releasing. Your output is \`SECURITY-FINDING:\` / \`SECURITY-APPROVED:\` / \`SECURITY-DEFER:\` / \`SECURITY-SWEEP:\` signals on the log.`,
|
|
168
|
+
},
|
|
109
169
|
],
|
|
110
170
|
};
|
|
111
171
|
export const TEMPLATES = {
|
package/dist/templates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAgBH,MAAM,YAAY,GAAa;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yIAAyI;IAC3I,KAAK,EAAE;QACL;YACE,IAAI,EAAE,aAAa;YACnB,cAAc,EAAE,IAAI;YACpB,iBAAiB,EACf,qFAAqF;YACvF,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;mEAuBuC;SAC9D;QACD;YACE,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,IAAI;YAChB,iBAAiB,EAAE,2FAA2F;YAC9G,oBAAoB,EAAE;;;;;;;;;;;uFAW2D;SAClF;QACD;YACE,IAAI,EAAE,eAAe;YACrB,iBAAiB,EAAE,oFAAoF;YACvG,oBAAoB,EAAE
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAgBH,MAAM,YAAY,GAAa;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yIAAyI;IAC3I,KAAK,EAAE;QACL;YACE,IAAI,EAAE,aAAa;YACnB,cAAc,EAAE,IAAI;YACpB,iBAAiB,EACf,qFAAqF;YACvF,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;mEAuBuC;SAC9D;QACD;YACE,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,IAAI;YAChB,iBAAiB,EAAE,2FAA2F;YAC9G,oBAAoB,EAAE;;;;;;;;;;;uFAW2D;SAClF;QACD;YACE,IAAI,EAAE,eAAe;YACrB,iBAAiB,EAAE,oFAAoF;YACvG,oBAAoB,EAAE;;;;;;;;;;yGAU6E;SACpG;QACD;YACE,IAAI,EAAE,WAAW;YACjB,iBAAiB,EAAE,6FAA6F;YAChH,oBAAoB,EAAE;;;;;;;;;;iNAUqL;SAC5M;QACD;YACE,IAAI,EAAE,WAAW;YACjB,iBAAiB,EAAE,+EAA+E;YAClG,oBAAoB,EAAE;;;;;;;;2KAQ+I;SACtK;QACD;YACE,IAAI,EAAE,WAAW;YACjB,iBAAiB,EAAE,qIAAqI;YACxJ,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;oHAyBwF;SAC/G;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,iBAAiB,EAAE,8KAA8K;YACjM,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;+QAuBmP;SAC1Q;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD,cAAc,EAAE,YAAY;CAC7B,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-title setter for borg drone sessions.
|
|
3
|
+
*
|
|
4
|
+
* Multiple Claude Code sessions across sibling worktrees are visually
|
|
5
|
+
* indistinguishable in Cmd-Tab / tab bars / Mission Control on macOS,
|
|
6
|
+
* and likewise on most Linux terminal emulators. Setting the terminal
|
|
7
|
+
* title via the OSC 0 / OSC 2 escape gives each window a free per-
|
|
8
|
+
* session identity.
|
|
9
|
+
*
|
|
10
|
+
* Format (Queen-specified):
|
|
11
|
+
* - Assimilated drone session: `borg · <label> · <cubeName>`
|
|
12
|
+
* - Unassimilated session: `borg · <repo-basename>`
|
|
13
|
+
*
|
|
14
|
+
* Why OSC 0 (`\x1b]0;…\x07`): sets both window title AND icon name on
|
|
15
|
+
* most terminals. OSC 2 sets only window title; OSC 1 sets only icon
|
|
16
|
+
* name. OSC 0 is the maximally-portable choice — works in iTerm2,
|
|
17
|
+
* macOS Terminal, kitty, alacritty, ghostty, GNOME Terminal, xterm.
|
|
18
|
+
*
|
|
19
|
+
* Lifetime: the escape is emitted once, before spawning Claude Code.
|
|
20
|
+
* Claude Code itself does not set its own window title (verified
|
|
21
|
+
* 2026-05-11), so the borg-set title persists for the whole session.
|
|
22
|
+
*
|
|
23
|
+
* Limitations (acceptable for v1; flagged for future):
|
|
24
|
+
* - Title doesn't update mid-session on `borg:assimilate`. The
|
|
25
|
+
* borgmcp client process can't write the escape post-spawn
|
|
26
|
+
* because stdio is owned by Claude Code at that point (and stdio
|
|
27
|
+
* to Claude is JSON-RPC — terminal escapes would be parsed as
|
|
28
|
+
* invalid messages).
|
|
29
|
+
* - Falls back to repo-basename for the unassimilated case; loses
|
|
30
|
+
* drone identity until the cube is joined. Typical pattern is
|
|
31
|
+
* "drone has been around long enough that cubes.json is already
|
|
32
|
+
* populated," so the assimilated path is the common case.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Pure: compose the title string for a session. Exported so tests can
|
|
36
|
+
* exercise every branch without TTY / process / fs dependencies.
|
|
37
|
+
*
|
|
38
|
+
* @param activeDrone — `{label, cubeName}` if this project is
|
|
39
|
+
* assimilated to a cube, null otherwise.
|
|
40
|
+
* @param repoBasename — fallback identity for the unassimilated case
|
|
41
|
+
* (typically `basename(process.cwd())`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function composeTerminalTitle(activeDrone: {
|
|
44
|
+
label: string;
|
|
45
|
+
cubeName: string;
|
|
46
|
+
} | null, repoBasename: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Side-effecting: emit the OSC 0 escape to stdout, but only if stdout
|
|
49
|
+
* is a TTY. When stdout is piped (CI, redirection, scripted
|
|
50
|
+
* invocation), emitting the raw escape would pollute the captured
|
|
51
|
+
* output without doing anything useful — so we no-op.
|
|
52
|
+
*
|
|
53
|
+
* Returns the title string that WOULD have been emitted, regardless of
|
|
54
|
+
* TTY state, so callers can log it independently for diagnostics.
|
|
55
|
+
*/
|
|
56
|
+
export declare function setTerminalTitle(activeDrone: {
|
|
57
|
+
label: string;
|
|
58
|
+
cubeName: string;
|
|
59
|
+
} | null, repoBasename: string, stdout?: NodeJS.WriteStream): string;
|
|
60
|
+
//# sourceMappingURL=terminal-title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-title.d.ts","sourceRoot":"","sources":["../src/terminal-title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EACvD,YAAY,EAAE,MAAM,GACnB,MAAM,CAKR;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EACvD,YAAY,EAAE,MAAM,EACpB,MAAM,GAAE,MAAM,CAAC,WAA4B,GAC1C,MAAM,CASR"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-title setter for borg drone sessions.
|
|
3
|
+
*
|
|
4
|
+
* Multiple Claude Code sessions across sibling worktrees are visually
|
|
5
|
+
* indistinguishable in Cmd-Tab / tab bars / Mission Control on macOS,
|
|
6
|
+
* and likewise on most Linux terminal emulators. Setting the terminal
|
|
7
|
+
* title via the OSC 0 / OSC 2 escape gives each window a free per-
|
|
8
|
+
* session identity.
|
|
9
|
+
*
|
|
10
|
+
* Format (Queen-specified):
|
|
11
|
+
* - Assimilated drone session: `borg · <label> · <cubeName>`
|
|
12
|
+
* - Unassimilated session: `borg · <repo-basename>`
|
|
13
|
+
*
|
|
14
|
+
* Why OSC 0 (`\x1b]0;…\x07`): sets both window title AND icon name on
|
|
15
|
+
* most terminals. OSC 2 sets only window title; OSC 1 sets only icon
|
|
16
|
+
* name. OSC 0 is the maximally-portable choice — works in iTerm2,
|
|
17
|
+
* macOS Terminal, kitty, alacritty, ghostty, GNOME Terminal, xterm.
|
|
18
|
+
*
|
|
19
|
+
* Lifetime: the escape is emitted once, before spawning Claude Code.
|
|
20
|
+
* Claude Code itself does not set its own window title (verified
|
|
21
|
+
* 2026-05-11), so the borg-set title persists for the whole session.
|
|
22
|
+
*
|
|
23
|
+
* Limitations (acceptable for v1; flagged for future):
|
|
24
|
+
* - Title doesn't update mid-session on `borg:assimilate`. The
|
|
25
|
+
* borgmcp client process can't write the escape post-spawn
|
|
26
|
+
* because stdio is owned by Claude Code at that point (and stdio
|
|
27
|
+
* to Claude is JSON-RPC — terminal escapes would be parsed as
|
|
28
|
+
* invalid messages).
|
|
29
|
+
* - Falls back to repo-basename for the unassimilated case; loses
|
|
30
|
+
* drone identity until the cube is joined. Typical pattern is
|
|
31
|
+
* "drone has been around long enough that cubes.json is already
|
|
32
|
+
* populated," so the assimilated path is the common case.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Pure: compose the title string for a session. Exported so tests can
|
|
36
|
+
* exercise every branch without TTY / process / fs dependencies.
|
|
37
|
+
*
|
|
38
|
+
* @param activeDrone — `{label, cubeName}` if this project is
|
|
39
|
+
* assimilated to a cube, null otherwise.
|
|
40
|
+
* @param repoBasename — fallback identity for the unassimilated case
|
|
41
|
+
* (typically `basename(process.cwd())`).
|
|
42
|
+
*/
|
|
43
|
+
export function composeTerminalTitle(activeDrone, repoBasename) {
|
|
44
|
+
if (activeDrone) {
|
|
45
|
+
return `borg · ${activeDrone.label} · ${activeDrone.cubeName}`;
|
|
46
|
+
}
|
|
47
|
+
return `borg · ${repoBasename}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Side-effecting: emit the OSC 0 escape to stdout, but only if stdout
|
|
51
|
+
* is a TTY. When stdout is piped (CI, redirection, scripted
|
|
52
|
+
* invocation), emitting the raw escape would pollute the captured
|
|
53
|
+
* output without doing anything useful — so we no-op.
|
|
54
|
+
*
|
|
55
|
+
* Returns the title string that WOULD have been emitted, regardless of
|
|
56
|
+
* TTY state, so callers can log it independently for diagnostics.
|
|
57
|
+
*/
|
|
58
|
+
export function setTerminalTitle(activeDrone, repoBasename, stdout = process.stdout) {
|
|
59
|
+
const title = composeTerminalTitle(activeDrone, repoBasename);
|
|
60
|
+
if (stdout.isTTY) {
|
|
61
|
+
// OSC 0: ESC ] 0 ; <title> BEL
|
|
62
|
+
// (BEL terminator is honored by all OSC-supporting terminals;
|
|
63
|
+
// ST = `ESC \` is an alternative but BEL has wider compat.)
|
|
64
|
+
stdout.write(`\x1b]0;${title}\x07`);
|
|
65
|
+
}
|
|
66
|
+
return title;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=terminal-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-title.js","sourceRoot":"","sources":["../src/terminal-title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,WAAuD,EACvD,YAAoB;IAEpB,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,UAAU,WAAW,CAAC,KAAK,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,UAAU,YAAY,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAAuD,EACvD,YAAoB,EACpB,SAA6B,OAAO,CAAC,MAAM;IAE3C,MAAM,KAAK,GAAG,oBAAoB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,+BAA+B;QAC/B,8DAA8D;QAC9D,4DAA4D;QAC5D,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime version reader.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the borgmcp client version — read at runtime
|
|
5
|
+
* from `package.json` relative to `import.meta.url`, NOT hardcoded.
|
|
6
|
+
*
|
|
7
|
+
* Consumers:
|
|
8
|
+
* - `index.ts` — passed into the MCP `Server({ name, version })`
|
|
9
|
+
* constructor so Claude Code's `/mcp` view shows the real version
|
|
10
|
+
* instead of the long-standing hardcoded "0.1.0".
|
|
11
|
+
* - `claude.ts` / `setup.ts` / `regen.ts` / `log-audit.ts` — each
|
|
12
|
+
* binary supports a `--version` flag that prints `borgmcp X.Y.Z`
|
|
13
|
+
* and exits 0 before any side-effecting work begins.
|
|
14
|
+
*
|
|
15
|
+
* Implementation notes:
|
|
16
|
+
* - Uses `readFileSync` on the resolved path relative to this module's
|
|
17
|
+
* `import.meta.url`. The compiled `dist/version.js` sits one level
|
|
18
|
+
* above `package.json` at the package root, so `../package.json` is
|
|
19
|
+
* the relative resolution. This works under both `node dist/...`
|
|
20
|
+
* and `npm run start`; the path resolution is independent of CWD.
|
|
21
|
+
* - Result is cached at module-eval time. The package.json is part of
|
|
22
|
+
* the published tarball and immutable for any given install.
|
|
23
|
+
* - Falls back to `'unknown'` if the read fails (corrupted install,
|
|
24
|
+
* someone deleted package.json, etc.) — never throws, so a fresh
|
|
25
|
+
* `--version` invocation can't kill a CLI launch.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Return the installed borgmcp version (the same string as
|
|
29
|
+
* `client/package.json`'s `version` field). Cached at module load.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getPackageVersion(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Standard `--version` handler — call near the top of any CLI entry
|
|
34
|
+
* point. If `process.argv` contains `--version` or `-v`, prints
|
|
35
|
+
* `borgmcp X.Y.Z` to stdout and exits 0. Otherwise returns silently
|
|
36
|
+
* so the caller can continue with normal CLI work.
|
|
37
|
+
*
|
|
38
|
+
* Examples:
|
|
39
|
+
* - `borg --version` → "borgmcp 0.6.0"
|
|
40
|
+
* - `borg-mcp -v` → "borgmcp 0.6.0"
|
|
41
|
+
* - `borg-setup` → continues to interactive wizard
|
|
42
|
+
*/
|
|
43
|
+
export declare function handleVersionFlag(): void;
|
|
44
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAKxC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime version reader.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the borgmcp client version — read at runtime
|
|
5
|
+
* from `package.json` relative to `import.meta.url`, NOT hardcoded.
|
|
6
|
+
*
|
|
7
|
+
* Consumers:
|
|
8
|
+
* - `index.ts` — passed into the MCP `Server({ name, version })`
|
|
9
|
+
* constructor so Claude Code's `/mcp` view shows the real version
|
|
10
|
+
* instead of the long-standing hardcoded "0.1.0".
|
|
11
|
+
* - `claude.ts` / `setup.ts` / `regen.ts` / `log-audit.ts` — each
|
|
12
|
+
* binary supports a `--version` flag that prints `borgmcp X.Y.Z`
|
|
13
|
+
* and exits 0 before any side-effecting work begins.
|
|
14
|
+
*
|
|
15
|
+
* Implementation notes:
|
|
16
|
+
* - Uses `readFileSync` on the resolved path relative to this module's
|
|
17
|
+
* `import.meta.url`. The compiled `dist/version.js` sits one level
|
|
18
|
+
* above `package.json` at the package root, so `../package.json` is
|
|
19
|
+
* the relative resolution. This works under both `node dist/...`
|
|
20
|
+
* and `npm run start`; the path resolution is independent of CWD.
|
|
21
|
+
* - Result is cached at module-eval time. The package.json is part of
|
|
22
|
+
* the published tarball and immutable for any given install.
|
|
23
|
+
* - Falls back to `'unknown'` if the read fails (corrupted install,
|
|
24
|
+
* someone deleted package.json, etc.) — never throws, so a fresh
|
|
25
|
+
* `--version` invocation can't kill a CLI launch.
|
|
26
|
+
*/
|
|
27
|
+
import { readFileSync } from 'node:fs';
|
|
28
|
+
import { fileURLToPath } from 'node:url';
|
|
29
|
+
import { dirname, join } from 'node:path';
|
|
30
|
+
function readPackageVersion() {
|
|
31
|
+
try {
|
|
32
|
+
const here = fileURLToPath(import.meta.url);
|
|
33
|
+
const pkgPath = join(dirname(here), '..', 'package.json');
|
|
34
|
+
const raw = readFileSync(pkgPath, 'utf-8');
|
|
35
|
+
const parsed = JSON.parse(raw);
|
|
36
|
+
if (typeof parsed.version === 'string' && parsed.version.length > 0) {
|
|
37
|
+
return parsed.version;
|
|
38
|
+
}
|
|
39
|
+
return 'unknown';
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return 'unknown';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const VERSION = readPackageVersion();
|
|
46
|
+
/**
|
|
47
|
+
* Return the installed borgmcp version (the same string as
|
|
48
|
+
* `client/package.json`'s `version` field). Cached at module load.
|
|
49
|
+
*/
|
|
50
|
+
export function getPackageVersion() {
|
|
51
|
+
return VERSION;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Standard `--version` handler — call near the top of any CLI entry
|
|
55
|
+
* point. If `process.argv` contains `--version` or `-v`, prints
|
|
56
|
+
* `borgmcp X.Y.Z` to stdout and exits 0. Otherwise returns silently
|
|
57
|
+
* so the caller can continue with normal CLI work.
|
|
58
|
+
*
|
|
59
|
+
* Examples:
|
|
60
|
+
* - `borg --version` → "borgmcp 0.6.0"
|
|
61
|
+
* - `borg-mcp -v` → "borgmcp 0.6.0"
|
|
62
|
+
* - `borg-setup` → continues to interactive wizard
|
|
63
|
+
*/
|
|
64
|
+
export function handleVersionFlag() {
|
|
65
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
66
|
+
process.stdout.write(`borgmcp ${VERSION}\n`);
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,OAAO,IAAI,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "borgmcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Multi-agent coordination for Claude Code — cubes, drones, and a shared activity log.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"dev": "tsc --watch",
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
19
|
"postinstall": "node dist/postinstall.js || true",
|
|
20
|
-
"
|
|
20
|
+
"test:integration": "vitest run --config ./vitest.integration.config.ts",
|
|
21
|
+
"prepublishOnly": "npm run build && npm run test:integration"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|
|
@@ -57,7 +58,8 @@
|
|
|
57
58
|
"@types/node": "^22.10.2",
|
|
58
59
|
"@types/prompts": "^2.4.9",
|
|
59
60
|
"@types/which": "^3.0.4",
|
|
60
|
-
"typescript": "^6.0.3"
|
|
61
|
+
"typescript": "^6.0.3",
|
|
62
|
+
"vitest": "^3.2.4"
|
|
61
63
|
},
|
|
62
64
|
"publishConfig": {
|
|
63
65
|
"access": "public"
|