borgmcp 0.2.0-beta.8 → 0.3.0

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 (48) hide show
  1. package/README.md +2 -2
  2. package/dist/auth.js +5 -5
  3. package/dist/auth.js.map +1 -1
  4. package/dist/claude.d.ts +9 -4
  5. package/dist/claude.d.ts.map +1 -1
  6. package/dist/claude.js +62 -26
  7. package/dist/claude.js.map +1 -1
  8. package/dist/config-utils.d.ts +32 -0
  9. package/dist/config-utils.d.ts.map +1 -1
  10. package/dist/config-utils.js +159 -0
  11. package/dist/config-utils.js.map +1 -1
  12. package/dist/cubes.d.ts +51 -0
  13. package/dist/cubes.d.ts.map +1 -0
  14. package/dist/cubes.js +161 -0
  15. package/dist/cubes.js.map +1 -0
  16. package/dist/inbox.d.ts +33 -0
  17. package/dist/inbox.d.ts.map +1 -0
  18. package/dist/inbox.js +125 -0
  19. package/dist/inbox.js.map +1 -0
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +353 -25
  23. package/dist/index.js.map +1 -1
  24. package/dist/log-audit.d.ts +27 -0
  25. package/dist/log-audit.d.ts.map +1 -0
  26. package/dist/log-audit.js +161 -0
  27. package/dist/log-audit.js.map +1 -0
  28. package/dist/postinstall.d.ts +1 -1
  29. package/dist/postinstall.d.ts.map +1 -1
  30. package/dist/postinstall.js +4 -4
  31. package/dist/postinstall.js.map +1 -1
  32. package/dist/regen-format.d.ts +53 -0
  33. package/dist/regen-format.d.ts.map +1 -0
  34. package/dist/regen-format.js +164 -0
  35. package/dist/regen-format.js.map +1 -0
  36. package/dist/regen.d.ts +19 -0
  37. package/dist/regen.d.ts.map +1 -0
  38. package/dist/regen.js +35 -0
  39. package/dist/regen.js.map +1 -0
  40. package/dist/remote-client.d.ts +107 -2
  41. package/dist/remote-client.d.ts.map +1 -1
  42. package/dist/remote-client.js +141 -11
  43. package/dist/remote-client.js.map +1 -1
  44. package/dist/setup.js +43 -36
  45. package/dist/setup.js.map +1 -1
  46. package/dist/sync.js +1 -1
  47. package/dist/sync.js.map +1 -1
  48. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -6,16 +6,65 @@
6
6
  * 1. Connects to Claude Code via stdio transport
7
7
  * 2. Authenticates via Google OAuth device flow
8
8
  * 3. Proxies MCP tools to remote server at api.borgmcp.ai
9
- * 4. Provides borg:regen tool for centralized context retrieval
9
+ * 4. Provides the borg: cube tool surface (assimilate / cube / role /
10
+ * roster / read-log) so Claude can act as a Drone in a hive of
11
+ * collaborating sessions.
10
12
  */
11
13
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
12
14
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
13
- import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
14
- import { regenerateContext, checkSubscriptionStatus, createSubscription, } from './remote-client.js';
15
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
16
+ import { assimilate, getCubeInfo, getRoleInfo, getRoster, readLog, appendLog, regen, checkSubscriptionStatus, createSubscription, API_URL, } from './remote-client.js';
17
+ import { getActiveCube, setActiveCube } from './cubes.js';
18
+ import { addSessionStartHook, addUserPromptSubmitHook } from './config-utils.js';
19
+ import { humanAgo, formatRegenMarkdown, getDronePlaybook, getDroneMode } from './regen-format.js';
20
+ import { startInboxPoller } from './inbox.js';
21
+ import open from 'open';
22
+ /**
23
+ * Throw a friendly error if the client has not been assimilated to a cube.
24
+ */
25
+ async function requireActiveCube() {
26
+ const active = await getActiveCube();
27
+ if (!active) {
28
+ throw new Error('Not assimilated to a cube. Use borg:assimilate <cube-name> first.');
29
+ }
30
+ return active;
31
+ }
15
32
  /**
16
33
  * Main entry point - MCP stdio server
17
34
  */
18
35
  async function main() {
36
+ // Auto-register the SessionStart hook so existing users get borg-regen
37
+ // auto-orientation on session start without re-running borg setup. Idempotent.
38
+ try {
39
+ addSessionStartHook();
40
+ }
41
+ catch (err) {
42
+ // Silent on failure — never break the MCP server because of hook registration.
43
+ }
44
+ // Auto-register the UserPromptSubmit audit hook so the drone gets a
45
+ // nudge if the previous assistant span used state-changing tools
46
+ // without calling borg:log. Domain-agnostic — knows nothing about git
47
+ // or any specific convention. Idempotent.
48
+ try {
49
+ addUserPromptSubmitHook();
50
+ }
51
+ catch (err) {
52
+ // Silent on failure — same rationale as above.
53
+ }
54
+ // Spawn the long-poll background poller. This gives drones real-time
55
+ // wakeup: when another drone posts to the cube, a line gets appended
56
+ // to the per-cube inbox file (see inboxPathForCube in cubes.ts) and
57
+ // the launcher's Monitor wakes the active /loop iteration immediately.
58
+ // No truncation needed — the launcher's Monitor uses `tail -n 0 -F`,
59
+ // which starts at end-of-file and only emits new appends. Failure
60
+ // here is non-fatal — the launcher's fallback heartbeat still keeps
61
+ // things moving.
62
+ try {
63
+ startInboxPoller();
64
+ }
65
+ catch {
66
+ // Silent — never break the MCP server because of inbox setup.
67
+ }
19
68
  // Create MCP server
20
69
  const server = new Server({
21
70
  name: 'borg-mcp-client',
@@ -23,6 +72,7 @@ async function main() {
23
72
  }, {
24
73
  capabilities: {
25
74
  tools: {},
75
+ prompts: {},
26
76
  },
27
77
  });
28
78
  // Register tool listing
@@ -31,7 +81,25 @@ async function main() {
31
81
  tools: [
32
82
  {
33
83
  name: 'subscribe',
34
- description: 'Create Stripe checkout session ($2/month, 7-day trial)',
84
+ description: 'Create Stripe checkout session ($1/month, 7-day trial)',
85
+ inputSchema: {
86
+ type: 'object',
87
+ properties: {},
88
+ required: [],
89
+ },
90
+ },
91
+ {
92
+ name: 'subscription_status',
93
+ description: 'Check subscription status',
94
+ inputSchema: {
95
+ type: 'object',
96
+ properties: {},
97
+ required: [],
98
+ },
99
+ },
100
+ {
101
+ name: 'open_dashboard',
102
+ description: 'Open Borg MCP dashboard in browser to manage cubes, roles, and drones',
35
103
  inputSchema: {
36
104
  type: 'object',
37
105
  properties: {},
@@ -40,30 +108,92 @@ async function main() {
40
108
  },
41
109
  {
42
110
  name: 'borg:regen',
43
- description: 'Regenerate centralized context from your active context entries (requires subscription). Returns markdown-formatted hive mind context.',
111
+ description: "Refresh your context as a Drone. Returns the active cube's ground rules, " +
112
+ "your role's detailed playbook, the drone roster, and recent activity log entries — " +
113
+ 'everything you need to be oriented. Call on session start, and again before each new ' +
114
+ 'task to stay in sync with the cube. Returns "not connected" if no active cube; use ' +
115
+ 'borg:assimilate first in that case.',
116
+ inputSchema: {
117
+ type: 'object',
118
+ properties: {},
119
+ required: [],
120
+ },
121
+ },
122
+ {
123
+ name: 'borg:assimilate',
124
+ description: "Connect this Claude session as a Drone to a Cube. Provide the cube's name. " +
125
+ "Returns the cube's ground rules, your assigned role's detailed instructions, " +
126
+ 'and persists a session token locally so subsequent borg: tools work for this cube.',
44
127
  inputSchema: {
45
128
  type: 'object',
46
129
  properties: {
47
- categories: {
48
- type: 'array',
49
- items: {
50
- type: 'string',
51
- },
52
- description: 'Optional: Filter by specific categories (e.g., ["code-style", "commit-rules"])',
130
+ cube_name: {
131
+ type: 'string',
132
+ description: 'The cube to connect to',
53
133
  },
54
134
  },
135
+ required: ['cube_name'],
136
+ },
137
+ },
138
+ {
139
+ name: 'borg:cube',
140
+ description: "Read the active Cube's ground rules and the registry of all roles in it " +
141
+ "(each role's name + short description). Use to remind yourself of cube-wide context.",
142
+ inputSchema: {
143
+ type: 'object',
144
+ properties: {},
55
145
  required: [],
56
146
  },
57
147
  },
58
148
  {
59
- name: 'subscription_status',
60
- description: 'Check subscription status',
149
+ name: 'borg:role',
150
+ description: "Read your assigned role's detailed description (your playbook). " +
151
+ 'Other drones cannot see this — only you (drones in this role).',
61
152
  inputSchema: {
62
153
  type: 'object',
63
154
  properties: {},
64
155
  required: [],
65
156
  },
66
157
  },
158
+ {
159
+ name: 'borg:roster',
160
+ description: "List all currently connected drones in your cube, with each drone's label, role, and last-seen time.",
161
+ inputSchema: {
162
+ type: 'object',
163
+ properties: {},
164
+ required: [],
165
+ },
166
+ },
167
+ {
168
+ name: 'borg:read-log',
169
+ description: "Read recent entries from the cube's shared activity log. Each entry is tagged " +
170
+ "with the drone that wrote it and that drone's role. Optional: since (ISO-8601 " +
171
+ 'timestamp, returns entries strictly after) and limit (1–500, default 50).',
172
+ inputSchema: {
173
+ type: 'object',
174
+ properties: {
175
+ since: {
176
+ type: 'string',
177
+ description: 'ISO-8601 timestamp',
178
+ },
179
+ limit: {
180
+ type: 'number',
181
+ description: 'max entries to return (1-500)',
182
+ },
183
+ },
184
+ },
185
+ },
186
+ {
187
+ name: 'borg:log',
188
+ description: 'Append a message to the cube\'s shared activity log. All connected drones will see your entry, tagged with your drone label and role name. Use this to coordinate work, post review-ready signals, share findings, or anything else the cube\'s ground rules and your role description direct you to communicate.',
189
+ inputSchema: {
190
+ type: 'object',
191
+ properties: {
192
+ message: { type: 'string', description: 'The log message (max 10KB).' },
193
+ },
194
+ required: ['message'],
195
+ },
196
+ },
67
197
  ],
68
198
  };
69
199
  });
@@ -72,6 +202,21 @@ async function main() {
72
202
  const { name, arguments: args } = request.params;
73
203
  try {
74
204
  switch (name) {
205
+ case 'borg:regen': {
206
+ const active = await getActiveCube();
207
+ if (!active) {
208
+ return {
209
+ content: [
210
+ {
211
+ type: 'text',
212
+ text: 'Not connected to a cube. Use `borg:assimilate cube_name="<name>"` to join one.',
213
+ },
214
+ ],
215
+ };
216
+ }
217
+ const result = await regen(active.sessionToken, active.apiUrl);
218
+ return { content: [{ type: 'text', text: formatRegenMarkdown(result, getDroneMode()) }] };
219
+ }
75
220
  case 'subscribe': {
76
221
  const checkoutUrl = await createSubscription();
77
222
  return {
@@ -83,29 +228,163 @@ async function main() {
83
228
  ],
84
229
  };
85
230
  }
86
- case 'borg:regen': {
87
- const categories = Array.isArray(args?.categories) ? args.categories : undefined;
88
- const context = await regenerateContext(categories);
231
+ case 'subscription_status': {
232
+ const status = await checkSubscriptionStatus();
89
233
  return {
90
234
  content: [
91
235
  {
92
236
  type: 'text',
93
- text: context,
237
+ text: JSON.stringify(status, null, 2),
94
238
  },
95
239
  ],
96
240
  };
97
241
  }
98
- case 'subscription_status': {
99
- const status = await checkSubscriptionStatus();
242
+ case 'open_dashboard': {
243
+ const dashboardUrl = 'https://borgmcp.ai/dashboard';
244
+ await open(dashboardUrl);
100
245
  return {
101
246
  content: [
102
247
  {
103
248
  type: 'text',
104
- text: JSON.stringify(status, null, 2),
249
+ text: `◼ Opened dashboard in browser: ${dashboardUrl}`,
105
250
  },
106
251
  ],
107
252
  };
108
253
  }
254
+ case 'borg:assimilate': {
255
+ const cubeName = args?.cube_name;
256
+ if (!cubeName)
257
+ throw new Error('cube_name is required');
258
+ // First-call assimilate uses the env-or-prod default; we then
259
+ // persist that same URL so all subsequent drone calls hit the
260
+ // worker that issued the session token.
261
+ const apiUrl = API_URL;
262
+ const result = await assimilate(cubeName, apiUrl);
263
+ await setActiveCube({
264
+ cubeId: result.cube.id,
265
+ droneId: result.drone.id,
266
+ name: result.cube.name,
267
+ sessionToken: result.sessionToken,
268
+ droneLabel: result.drone.label,
269
+ apiUrl,
270
+ });
271
+ const text = [
272
+ `# Assimilated to cube: ${result.cube.name}`,
273
+ ``,
274
+ `**Drone label:** ${result.drone.label}`,
275
+ `**Assigned role:** ${result.role.name}`,
276
+ `**Mode:** ${getDroneMode()}`,
277
+ ``,
278
+ `## Ground rules`,
279
+ result.cube.ground_rules || '_(none)_',
280
+ ``,
281
+ `## Your role: ${result.role.name}`,
282
+ result.role.detailed_description || '_(no detailed description set)_',
283
+ ``,
284
+ getDronePlaybook(getDroneMode()),
285
+ ].join('\n');
286
+ return { content: [{ type: 'text', text }] };
287
+ }
288
+ case 'borg:cube': {
289
+ const active = await requireActiveCube();
290
+ const { cube, roles } = await getCubeInfo(active.sessionToken, active.apiUrl);
291
+ const lines = [];
292
+ lines.push(`# Cube: ${cube.name}`);
293
+ lines.push(`**Mode:** ${getDroneMode()}`);
294
+ lines.push('');
295
+ lines.push('## Ground rules');
296
+ lines.push(cube.ground_rules || '_(none)_');
297
+ lines.push('');
298
+ lines.push('## Roles in this cube');
299
+ if (!roles.length) {
300
+ lines.push('_(no roles defined)_');
301
+ }
302
+ else {
303
+ for (const r of roles) {
304
+ const marker = r.is_default ? ' (default)' : '';
305
+ const desc = r.short_description || '_(no description)_';
306
+ lines.push(`- **${r.name}**${marker} — ${desc}`);
307
+ }
308
+ }
309
+ lines.push('');
310
+ lines.push(getDronePlaybook(getDroneMode()));
311
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
312
+ }
313
+ case 'borg:role': {
314
+ const active = await requireActiveCube();
315
+ const { role } = await getRoleInfo(active.sessionToken, active.apiUrl);
316
+ const text = [
317
+ `# Your role: ${role.name}`,
318
+ ``,
319
+ role.detailed_description || '_(no detailed description set)_',
320
+ ].join('\n');
321
+ return { content: [{ type: 'text', text }] };
322
+ }
323
+ case 'borg:roster': {
324
+ const active = await requireActiveCube();
325
+ const { drones, roles } = await getRoster(active.sessionToken, active.apiUrl);
326
+ const roleById = new Map();
327
+ for (const r of roles)
328
+ roleById.set(r.id, r);
329
+ const lines = [];
330
+ lines.push(`# Drones in cube: ${active.name}`);
331
+ lines.push('');
332
+ if (!drones.length) {
333
+ lines.push('_(no drones connected)_');
334
+ }
335
+ else {
336
+ for (const d of drones) {
337
+ const role = roleById.get(d.role_id);
338
+ const roleName = role?.name ?? 'unknown';
339
+ lines.push(`- **${d.label}** (${roleName}) — last seen ${humanAgo(d.last_seen)}`);
340
+ }
341
+ }
342
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
343
+ }
344
+ case 'borg:read-log': {
345
+ const active = await requireActiveCube();
346
+ const since = typeof args?.since === 'string' ? args.since : undefined;
347
+ const limit = typeof args?.limit === 'number' ? args.limit : undefined;
348
+ const { entries, drones, roles } = await readLog(active.sessionToken, active.apiUrl, {
349
+ since,
350
+ limit,
351
+ });
352
+ const droneById = new Map();
353
+ for (const d of drones)
354
+ droneById.set(d.id, d);
355
+ const roleById = new Map();
356
+ for (const r of roles)
357
+ roleById.set(r.id, r);
358
+ const lines = [];
359
+ lines.push(`# Activity log: ${active.name}`);
360
+ lines.push('');
361
+ if (!entries.length) {
362
+ lines.push('_(no entries)_');
363
+ }
364
+ else {
365
+ for (const e of entries) {
366
+ const drone = droneById.get(e.drone_id);
367
+ const droneLabel = drone?.label ?? 'unknown-drone';
368
+ const roleName = drone ? roleById.get(drone.role_id)?.name ?? 'unknown' : 'unknown';
369
+ const ts = typeof e.created_at === 'string'
370
+ ? e.created_at
371
+ : new Date(e.created_at).toISOString();
372
+ lines.push(`**[${ts}]** ${droneLabel} (${roleName}): ${e.message}`);
373
+ }
374
+ }
375
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
376
+ }
377
+ case 'borg:log': {
378
+ const message = args?.message;
379
+ if (!message || typeof message !== 'string')
380
+ throw new Error('message is required');
381
+ const active = await getActiveCube();
382
+ if (!active)
383
+ throw new Error('Not assimilated to a cube. Use borg:assimilate <cube-name> first.');
384
+ const result = await appendLog(active.sessionToken, active.apiUrl, message);
385
+ const text = `Logged to cube "${active.name}" as ${active.droneLabel}. (entry id: ${result.entry.id})`;
386
+ return { content: [{ type: 'text', text }] };
387
+ }
109
388
  default:
110
389
  throw new Error(`Unknown tool: ${name}`);
111
390
  }
@@ -113,12 +392,13 @@ async function main() {
113
392
  catch (error) {
114
393
  // Better error messages for auth/subscription issues
115
394
  if (error.message?.includes('Authentication required') ||
395
+ error.message?.includes('Authentication expired') ||
116
396
  error.message?.includes('Failed to refresh')) {
117
397
  return {
118
398
  content: [
119
399
  {
120
400
  type: 'text',
121
- text: '🔐 Authentication expired. Run: borg setup',
401
+ text: ' Authentication expired. Run: borg setup',
122
402
  },
123
403
  ],
124
404
  isError: true,
@@ -135,15 +415,63 @@ async function main() {
135
415
  };
136
416
  }
137
417
  });
418
+ // Register prompts listing
419
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
420
+ return {
421
+ prompts: [
422
+ {
423
+ name: 'subscribe',
424
+ description: 'Set up Borg MCP subscription ($1/month, 7-day trial)',
425
+ },
426
+ {
427
+ name: 'dashboard',
428
+ description: 'Open Borg MCP dashboard to manage cubes',
429
+ },
430
+ ],
431
+ };
432
+ });
433
+ // Register prompt getter
434
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
435
+ const { name } = request.params;
436
+ switch (name) {
437
+ case 'subscribe':
438
+ return {
439
+ description: 'Set up Borg MCP subscription ($1/month, 7-day trial)',
440
+ messages: [
441
+ {
442
+ role: 'user',
443
+ content: {
444
+ type: 'text',
445
+ text: 'Please help me set up a Borg MCP subscription using the subscribe tool.',
446
+ },
447
+ },
448
+ ],
449
+ };
450
+ case 'dashboard':
451
+ return {
452
+ description: 'Open Borg MCP dashboard to manage cubes',
453
+ messages: [
454
+ {
455
+ role: 'user',
456
+ content: {
457
+ type: 'text',
458
+ text: 'Please open the Borg MCP dashboard using the open_dashboard tool.',
459
+ },
460
+ },
461
+ ],
462
+ };
463
+ default:
464
+ throw new Error(`Unknown prompt: ${name}`);
465
+ }
466
+ });
138
467
  // Create stdio transport
139
468
  const transport = new StdioServerTransport();
140
469
  // Connect server to transport
141
470
  await server.connect(transport);
142
- console.error('🚀 Borg MCP Client started');
143
- console.error('💡 Use borg:regen to fetch centralized context from the hive mind');
144
- console.error('🌐 Manage your context entries at https://borgmcp.ai/dashboard');
471
+ console.error(' Borg MCP Client started');
472
+ console.error(' Use borg:assimilate <cube-name> to join a cube as a drone');
473
+ console.error(' Manage your cubes at https://borgmcp.ai/dashboard');
145
474
  }
146
- // Start the server
147
475
  main().catch((error) => {
148
476
  console.error('Fatal error:', error);
149
477
  process.exit(1);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAo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AAI,EAAE,MAAM;gCACZ,IAAI,EAAE,mEAAmE;6BAC1E;yBACF;qBACF;iBACF,CAAC;YAEJ;gBACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,yBAAyB;IACzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,8BAA8B;IAC9B,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC3C,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACvE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * borg-log-audit
4
+ *
5
+ * Domain-agnostic nudge: scans the Claude Code transcript and emits a
6
+ * one-line warning to stdout if the drone has accumulated MATERIAL_THRESHOLD
7
+ * or more state-changing tool calls (Edit / Write / Bash / etc.) since the
8
+ * last borg:log post. Wired in as a UserPromptSubmit hook so the warning
9
+ * becomes additional context for the next turn.
10
+ *
11
+ * Two refinements vs the v1 1-tool threshold (per drone-6's review):
12
+ * 1. Counts material tools across all assistant turns until either the
13
+ * threshold is hit OR a borg:log call is found (cooldown). One
14
+ * diagnostic Bash no longer triggers; substantive work always does.
15
+ * 2. Any borg:log in the scanback suppresses the nudge — so the drone
16
+ * gets a turn of breathing room after each post.
17
+ *
18
+ * Stays generic — knows nothing about git, branches, or any project's
19
+ * conventions. Only the Anthropic tool name `mcp__borg__borg_log` and a
20
+ * small set of canonical mutating tool names. If no cube is active in
21
+ * this project, silently exits.
22
+ *
23
+ * Hook input arrives as JSON on stdin (Claude Code's standard hook
24
+ * contract). The relevant field is `transcript_path`.
25
+ */
26
+ export {};
27
+ //# sourceMappingURL=log-audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-audit.d.ts","sourceRoot":"","sources":["../src/log-audit.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}