brainclaw 0.24.0 → 0.27.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.
- package/dist/cli.js +33 -2
- package/dist/commands/capability.js +21 -32
- package/dist/commands/check-events.js +36 -0
- package/dist/commands/claim.js +2 -1
- package/dist/commands/context-diff.js +62 -4
- package/dist/commands/discover.js +21 -0
- package/dist/commands/doctor.js +67 -11
- package/dist/commands/explore.js +7 -10
- package/dist/commands/export.js +40 -2
- package/dist/commands/hooks.js +33 -17
- package/dist/commands/init.js +41 -0
- package/dist/commands/mcp.js +417 -75
- package/dist/commands/migrate.js +75 -0
- package/dist/commands/runtime-note.js +1 -0
- package/dist/commands/tool.js +29 -39
- package/dist/core/agent-files.js +13 -0
- package/dist/core/context.js +102 -8
- package/dist/core/coordination.js +25 -0
- package/dist/core/io.js +2 -0
- package/dist/core/migration.js +3 -1
- package/dist/core/project-discovery.js +236 -0
- package/dist/core/registries.js +120 -0
- package/dist/core/schema.js +14 -1
- package/docs/cli.md +7 -5
- package/docs/concepts/plans-and-claims.md +10 -0
- package/docs/integrations/agents.md +2 -1
- package/docs/integrations/mcp.md +1 -1
- package/package.json +7 -1
package/dist/commands/init.js
CHANGED
|
@@ -245,6 +245,8 @@ export async function runInit(options = {}) {
|
|
|
245
245
|
if (initMemoryRepo(cwd)) {
|
|
246
246
|
console.log('✔ Initialized memory git repo for versioning');
|
|
247
247
|
}
|
|
248
|
+
// Install post-merge hook for auto-release of claims after merge
|
|
249
|
+
installPostMergeHookIfMissing(cwd);
|
|
248
250
|
const onboardingPreflight = runBootstrapProfile({ cwd, refresh: true });
|
|
249
251
|
console.log('');
|
|
250
252
|
console.log('Onboarding preflight:');
|
|
@@ -268,6 +270,45 @@ export async function runInit(options = {}) {
|
|
|
268
270
|
console.log('');
|
|
269
271
|
console.log(`Tip: run 'brainclaw context --json' to load the shared memory into your agent session.`);
|
|
270
272
|
}
|
|
273
|
+
function installPostMergeHookIfMissing(cwd) {
|
|
274
|
+
try {
|
|
275
|
+
let dir = path.resolve(cwd);
|
|
276
|
+
let gitRoot;
|
|
277
|
+
while (true) {
|
|
278
|
+
if (fs.existsSync(path.join(dir, '.git'))) {
|
|
279
|
+
gitRoot = dir;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
const parent = path.dirname(dir);
|
|
283
|
+
if (parent === dir)
|
|
284
|
+
break;
|
|
285
|
+
dir = parent;
|
|
286
|
+
}
|
|
287
|
+
if (!gitRoot)
|
|
288
|
+
return;
|
|
289
|
+
const hooksDir = path.join(gitRoot, '.git', 'hooks');
|
|
290
|
+
const hookPath = path.join(hooksDir, 'post-merge');
|
|
291
|
+
if (fs.existsSync(hookPath))
|
|
292
|
+
return; // don't overwrite existing hooks
|
|
293
|
+
if (!fs.existsSync(hooksDir))
|
|
294
|
+
fs.mkdirSync(hooksDir, { recursive: true });
|
|
295
|
+
const script = [
|
|
296
|
+
'#!/bin/sh',
|
|
297
|
+
'# brainclaw post-merge hook — auto-release claims on merged files',
|
|
298
|
+
'BCLAW_CMD=""',
|
|
299
|
+
'if command -v brainclaw >/dev/null 2>&1; then BCLAW_CMD="brainclaw"',
|
|
300
|
+
'elif command -v bclaw >/dev/null 2>&1; then BCLAW_CMD="bclaw"',
|
|
301
|
+
'else BCLAW_CMD="npx --no brainclaw"; fi',
|
|
302
|
+
'$BCLAW_CMD release-claims --from-git-diff 2>/dev/null || true',
|
|
303
|
+
'',
|
|
304
|
+
].join('\n');
|
|
305
|
+
fs.writeFileSync(hookPath, script, { encoding: 'utf-8', mode: 0o755 });
|
|
306
|
+
console.log('✔ Installed post-merge hook for auto-release of claims');
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
// Non-critical — skip silently
|
|
310
|
+
}
|
|
311
|
+
}
|
|
271
312
|
function resolveStorageDir(storageDir) {
|
|
272
313
|
const candidate = (storageDir ?? MEMORY_DIR).trim();
|
|
273
314
|
if (candidate !== MEMORY_DIR) {
|