brainclaw 0.29.2 → 1.5.4
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/LICENSE +21 -74
- package/README.md +199 -176
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli.js +710 -25
- package/dist/commands/accept.js +3 -0
- package/dist/commands/add-step.js +11 -26
- package/dist/commands/agent-board.js +70 -3
- package/dist/commands/audit.js +19 -0
- package/dist/commands/check-policy.js +54 -0
- package/dist/commands/check-security-mcp.js +145 -0
- package/dist/commands/check-security.js +106 -0
- package/dist/commands/claim-resource.js +1 -0
- package/dist/commands/codev.js +672 -0
- package/dist/commands/compact.js +74 -0
- package/dist/commands/complete-step.js +16 -26
- package/dist/commands/constraint.js +8 -20
- package/dist/commands/decision.js +9 -20
- package/dist/commands/delete-plan.js +10 -12
- package/dist/commands/delete-step.js +16 -0
- package/dist/commands/dispatch.js +163 -0
- package/dist/commands/doctor.js +1122 -49
- package/dist/commands/enable-agent.js +1 -0
- package/dist/commands/export.js +280 -22
- package/dist/commands/handoff.js +33 -0
- package/dist/commands/harvest.js +189 -0
- package/dist/commands/hooks.js +82 -25
- package/dist/commands/inbox.js +169 -0
- package/dist/commands/init.js +38 -31
- package/dist/commands/install-hooks.js +71 -44
- package/dist/commands/link.js +89 -0
- package/dist/commands/list-claims.js +48 -3
- package/dist/commands/list-plans.js +129 -25
- package/dist/commands/loops-handlers.js +409 -0
- package/dist/commands/mcp-read-handlers.js +1628 -0
- package/dist/commands/mcp-schemas.generated.js +269 -0
- package/dist/commands/mcp.js +4224 -1501
- package/dist/commands/plan-resource.js +64 -0
- package/dist/commands/plan.js +12 -26
- package/dist/commands/prune.js +37 -2
- package/dist/commands/reflect.js +20 -7
- package/dist/commands/release-claim.js +11 -6
- package/dist/commands/release-notes.js +170 -0
- package/dist/commands/repair.js +210 -0
- package/dist/commands/run-profile.js +57 -0
- package/dist/commands/sequence.js +113 -0
- package/dist/commands/session-end.js +423 -14
- package/dist/commands/session-start.js +214 -41
- package/dist/commands/setup-security.js +103 -0
- package/dist/commands/setup.js +42 -4
- package/dist/commands/stale.js +109 -0
- package/dist/commands/switch.js +100 -2
- package/dist/commands/trap.js +14 -31
- package/dist/commands/update-handoff.js +63 -4
- package/dist/commands/update-plan.js +21 -28
- package/dist/commands/update-step.js +37 -0
- package/dist/commands/upgrade.js +313 -6
- package/dist/commands/usage.js +102 -0
- package/dist/commands/version.js +20 -0
- package/dist/commands/who.js +33 -5
- package/dist/commands/worktree.js +105 -0
- package/dist/core/actions.js +315 -0
- package/dist/core/agent-capability.js +610 -17
- package/dist/core/agent-context.js +7 -1
- package/dist/core/agent-files.js +1169 -85
- package/dist/core/agent-integrations.js +160 -5
- package/dist/core/agent-inventory.js +2 -0
- package/dist/core/agent-profiles.js +93 -0
- package/dist/core/agent-registry.js +162 -30
- package/dist/core/agentrun-reconciler.js +345 -0
- package/dist/core/agentruns.js +424 -0
- package/dist/core/ai-agent-detection.js +31 -10
- package/dist/core/archival.js +77 -0
- package/dist/core/assignment-sweeper.js +82 -0
- package/dist/core/assignments.js +367 -0
- package/dist/core/audit.js +30 -0
- package/dist/core/brainclaw-version.js +94 -2
- package/dist/core/candidates.js +93 -2
- package/dist/core/claims.js +419 -0
- package/dist/core/codev-metrics.js +77 -0
- package/dist/core/codev-personas.js +31 -0
- package/dist/core/codev-plan-gen.js +35 -0
- package/dist/core/codev-prompts.js +74 -0
- package/dist/core/codev-responses.js +62 -0
- package/dist/core/codev-rounds.js +218 -0
- package/dist/core/config.js +4 -0
- package/dist/core/context.js +381 -34
- package/dist/core/coordination.js +201 -6
- package/dist/core/cross-project.js +230 -16
- package/dist/core/default-profiles/doctor.yaml +11 -0
- package/dist/core/default-profiles/janitor.yaml +11 -0
- package/dist/core/default-profiles/onboarder.yaml +11 -0
- package/dist/core/default-profiles/reviewer.yaml +13 -0
- package/dist/core/dispatcher.js +1189 -0
- package/dist/core/duplicates.js +2 -2
- package/dist/core/entity-operations.js +450 -0
- package/dist/core/entity-registry.js +344 -0
- package/dist/core/events.js +106 -2
- package/dist/core/execution-adapters.js +154 -0
- package/dist/core/execution-context.js +63 -0
- package/dist/core/execution-profile.js +270 -0
- package/dist/core/execution.js +255 -0
- package/dist/core/facade-schema.js +81 -0
- package/dist/core/federation-cloud.js +99 -0
- package/dist/core/federation-message.js +52 -0
- package/dist/core/federation-transport.js +65 -0
- package/dist/core/gc-semantic.js +482 -0
- package/dist/core/governance.js +247 -0
- package/dist/core/guards.js +19 -0
- package/dist/core/ideation.js +72 -0
- package/dist/core/identity.js +110 -25
- package/dist/core/ids.js +6 -0
- package/dist/core/input-validation.js +2 -2
- package/dist/core/instruction-templates.js +344 -136
- package/dist/core/io.js +90 -11
- package/dist/core/lock.js +6 -2
- package/dist/core/loops/brief-assembly.js +213 -0
- package/dist/core/loops/facade-schema.js +148 -0
- package/dist/core/loops/index.js +7 -0
- package/dist/core/loops/iteration-engine.js +139 -0
- package/dist/core/loops/lock.js +385 -0
- package/dist/core/loops/store.js +201 -0
- package/dist/core/loops/types.js +403 -0
- package/dist/core/loops/verbs.js +534 -0
- package/dist/core/markdown.js +15 -3
- package/dist/core/memory-compactor.js +432 -0
- package/dist/core/memory-git.js +152 -8
- package/dist/core/messaging.js +278 -0
- package/dist/core/migration.js +32 -1
- package/dist/core/mutation-pipeline.js +4 -2
- package/dist/core/operations/memory-mutation.js +129 -0
- package/dist/core/operations/memory-write.js +78 -0
- package/dist/core/operations/plan.js +190 -0
- package/dist/core/policy.js +169 -0
- package/dist/core/reputation.js +9 -3
- package/dist/core/schema.js +491 -6
- package/dist/core/search.js +21 -2
- package/dist/core/security-cache.js +71 -0
- package/dist/core/security-guard.js +152 -0
- package/dist/core/security-scoring.js +86 -0
- package/dist/core/sequence.js +130 -0
- package/dist/core/socket-client.js +113 -0
- package/dist/core/staleness.js +246 -0
- package/dist/core/state.js +98 -22
- package/dist/core/store-resolution.js +43 -11
- package/dist/core/toml-writer.js +76 -0
- package/dist/core/upgrades/backup.js +232 -0
- package/dist/core/upgrades/health-check.js +169 -0
- package/dist/core/upgrades/patches/candidate-archive.js +145 -0
- package/dist/core/upgrades/patches/handoff-review-strip.js +128 -0
- package/dist/core/upgrades/patches/provenance-rollout.js +136 -0
- package/dist/core/upgrades/schema-version.js +97 -0
- package/dist/core/worktree.js +606 -0
- package/dist/facts.js +114 -0
- package/dist/facts.json +111 -0
- package/docs/architecture/project-refs.md +5 -1
- package/docs/cli.md +690 -43
- package/docs/concepts/ideation-loop.md +317 -0
- package/docs/concepts/loop-engine.md +456 -0
- package/docs/concepts/mcp-governance.md +268 -0
- package/docs/concepts/memory-staleness.md +122 -0
- package/docs/concepts/multi-agent-workflows.md +166 -0
- package/docs/concepts/plans-and-claims.md +31 -6
- package/docs/concepts/project-md-convention.md +35 -0
- package/docs/concepts/troubleshooting.md +220 -0
- package/docs/concepts/upgrade-cli.md +202 -0
- package/docs/concepts/upgrade-dogfood-procedure.md +114 -0
- package/docs/context-format-changelog.md +2 -2
- package/docs/context-format.md +2 -2
- package/docs/index.md +68 -0
- package/docs/integrations/agents.md +15 -16
- package/docs/integrations/cline.md +88 -0
- package/docs/integrations/codex.md +75 -23
- package/docs/integrations/continue.md +60 -0
- package/docs/integrations/copilot.md +67 -9
- package/docs/integrations/kilocode.md +72 -0
- package/docs/integrations/mcp.md +304 -21
- package/docs/integrations/mistral-vibe.md +122 -0
- package/docs/integrations/opencode.md +84 -0
- package/docs/integrations/overview.md +23 -8
- package/docs/integrations/roo.md +74 -0
- package/docs/integrations/windsurf.md +83 -0
- package/docs/mcp-schema-changelog.md +191 -1
- package/docs/playbooks/integration/index.md +121 -0
- package/docs/playbooks/productivity/index.md +102 -0
- package/docs/playbooks/team/index.md +122 -0
- package/docs/product/agent-first-model.md +184 -0
- package/docs/product/entity-model-audit.md +462 -0
- package/docs/product/positioning.md +10 -10
- package/docs/quickstart-existing-project.md +135 -0
- package/docs/quickstart.md +124 -37
- package/docs/release-maintenance.md +79 -0
- package/docs/review.md +2 -0
- package/docs/server-operations.md +118 -0
- package/package.json +21 -13
- package/dist/commands/claude-desktop-extension.js +0 -18
- package/dist/commands/diff.js +0 -99
- package/dist/core/claude-desktop-extension.js +0 -224
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { spawnSync } from 'node:child_process';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { memoryExists } from './io.js';
|
|
6
|
-
const CLAUDE_DESKTOP_TOOLS = [
|
|
7
|
-
{ name: 'bclaw_session_start', description: 'Open a Brainclaw session and surface Claude-targeted tasks plus compact execution context.' },
|
|
8
|
-
{ name: 'bclaw_get_context', description: 'Retrieve ranked Brainclaw project context for the current task or path.' },
|
|
9
|
-
{ name: 'bclaw_list_surface_tasks', description: 'List queued or completed Brainclaw tasks delegated to Claude Desktop.' },
|
|
10
|
-
{ name: 'bclaw_update_surface_task', description: 'Mark a delegated Claude Desktop task as in progress or completed.' },
|
|
11
|
-
];
|
|
12
|
-
export function buildClaudeDesktopExtension(options = {}) {
|
|
13
|
-
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
14
|
-
if (!memoryExists(cwd)) {
|
|
15
|
-
throw new Error('Project memory not initialized. Run `brainclaw init` first.');
|
|
16
|
-
}
|
|
17
|
-
const workspaceDir = path.resolve(options.workspaceDir ?? path.join(cwd, 'internal-docs', 'desktop-extensions', 'claude-desktop-brainclaw'));
|
|
18
|
-
const outputFile = path.resolve(options.outputFile ?? path.join(cwd, 'internal-docs', 'desktop-extensions', 'brainclaw-claude-desktop.mcpb'));
|
|
19
|
-
if (outputFile.startsWith(`${workspaceDir}${path.sep}`) || outputFile === workspaceDir) {
|
|
20
|
-
throw new Error('The .mcpb output file must live outside the extension workspace directory.');
|
|
21
|
-
}
|
|
22
|
-
const projectRoot = path.resolve(options.projectRoot ?? cwd);
|
|
23
|
-
const runtimeRoot = path.resolve(options.runtimeRootOverride ?? resolveRuntimeRoot());
|
|
24
|
-
const packageRoot = path.resolve(options.packageRootOverride ?? findPackageRoot(runtimeRoot));
|
|
25
|
-
const metadata = readPackageMetadata(packageRoot);
|
|
26
|
-
const copiedDependencies = options.dependenciesOverride ?? resolveRuntimeDependencies(packageRoot);
|
|
27
|
-
fs.rmSync(workspaceDir, { recursive: true, force: true });
|
|
28
|
-
fs.mkdirSync(workspaceDir, { recursive: true });
|
|
29
|
-
fs.cpSync(runtimeRoot, path.join(workspaceDir, 'runtime'), { recursive: true });
|
|
30
|
-
fs.mkdirSync(path.join(workspaceDir, 'server'), { recursive: true });
|
|
31
|
-
fs.mkdirSync(path.dirname(outputFile), { recursive: true });
|
|
32
|
-
for (const dep of copiedDependencies) {
|
|
33
|
-
const sourceDir = path.join(packageRoot, 'node_modules', dep);
|
|
34
|
-
if (!fs.existsSync(sourceDir)) {
|
|
35
|
-
throw new Error(`Missing runtime dependency for Claude Desktop extension: ${dep}`);
|
|
36
|
-
}
|
|
37
|
-
fs.cpSync(sourceDir, path.join(workspaceDir, 'node_modules', dep), { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
const version = metadata.version ?? '0.0.0';
|
|
40
|
-
const manifestPath = path.join(workspaceDir, 'manifest.json');
|
|
41
|
-
const entryPointPath = path.join(workspaceDir, 'server', 'index.js');
|
|
42
|
-
const packageJsonPath = path.join(workspaceDir, 'package.json');
|
|
43
|
-
fs.writeFileSync(entryPointPath, buildServerEntryPoint(), 'utf-8');
|
|
44
|
-
fs.writeFileSync(packageJsonPath, `${JSON.stringify({
|
|
45
|
-
name: 'brainclaw-claude-desktop-extension',
|
|
46
|
-
private: true,
|
|
47
|
-
type: 'module',
|
|
48
|
-
version,
|
|
49
|
-
}, null, 2)}\n`, 'utf-8');
|
|
50
|
-
fs.writeFileSync(manifestPath, `${JSON.stringify(buildManifest(metadata, version, projectRoot), null, 2)}\n`, 'utf-8');
|
|
51
|
-
const packed = options.pack !== false ? packClaudeDesktopExtension(workspaceDir, outputFile) : false;
|
|
52
|
-
return {
|
|
53
|
-
workspaceDir,
|
|
54
|
-
outputFile,
|
|
55
|
-
packed,
|
|
56
|
-
manifestPath,
|
|
57
|
-
entryPointPath,
|
|
58
|
-
packageRoot,
|
|
59
|
-
runtimeRoot,
|
|
60
|
-
projectRoot,
|
|
61
|
-
copiedDependencies,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function buildServerEntryPoint() {
|
|
65
|
-
return `import process from 'node:process';
|
|
66
|
-
|
|
67
|
-
const projectRoot = process.env.BRAINCLAW_PROJECT_ROOT?.trim();
|
|
68
|
-
if (projectRoot) {
|
|
69
|
-
process.chdir(projectRoot);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const { runMcp } = await import('../runtime/commands/mcp.js');
|
|
73
|
-
runMcp();
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
function buildManifest(metadata, version, projectRoot) {
|
|
77
|
-
return {
|
|
78
|
-
manifest_version: '0.3',
|
|
79
|
-
name: 'brainclaw-claude-desktop',
|
|
80
|
-
display_name: 'Brainclaw Project Memory',
|
|
81
|
-
version,
|
|
82
|
-
description: 'Brainclaw local project memory and delegated task inbox for Claude Desktop.',
|
|
83
|
-
author: {
|
|
84
|
-
name: 'Brainclaw',
|
|
85
|
-
...(metadata.homepage ? { url: metadata.homepage } : {}),
|
|
86
|
-
},
|
|
87
|
-
...(typeof metadata.repository === 'string'
|
|
88
|
-
? { repository: { type: 'git', url: metadata.repository } }
|
|
89
|
-
: metadata.repository
|
|
90
|
-
? { repository: metadata.repository }
|
|
91
|
-
: {}),
|
|
92
|
-
...(metadata.homepage ? { homepage: metadata.homepage } : {}),
|
|
93
|
-
server: {
|
|
94
|
-
type: 'node',
|
|
95
|
-
entry_point: 'server/index.js',
|
|
96
|
-
mcp_config: {
|
|
97
|
-
command: 'node',
|
|
98
|
-
args: ['${__dirname}/server/index.js'],
|
|
99
|
-
env: {
|
|
100
|
-
BRAINCLAW_PROJECT_ROOT: '${user_config.project_root}',
|
|
101
|
-
BRAINCLAW_SKIP_SETUP_REQUIREMENT: '1',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
tools: CLAUDE_DESKTOP_TOOLS,
|
|
106
|
-
compatibility: {
|
|
107
|
-
platforms: ['win32', 'darwin'],
|
|
108
|
-
runtimes: {
|
|
109
|
-
node: '>=20.0.0',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
user_config: {
|
|
113
|
-
project_root: {
|
|
114
|
-
type: 'directory',
|
|
115
|
-
title: 'Project Root',
|
|
116
|
-
description: 'Brainclaw project root that Claude Desktop should operate on.',
|
|
117
|
-
required: true,
|
|
118
|
-
default: projectRoot,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function resolveRuntimeRoot() {
|
|
124
|
-
return path.resolve(fileURLToPath(new URL('..', import.meta.url)));
|
|
125
|
-
}
|
|
126
|
-
function findPackageRoot(startDir) {
|
|
127
|
-
let current = startDir;
|
|
128
|
-
while (true) {
|
|
129
|
-
const candidate = path.join(current, 'package.json');
|
|
130
|
-
if (fs.existsSync(candidate)) {
|
|
131
|
-
return current;
|
|
132
|
-
}
|
|
133
|
-
const parent = path.dirname(current);
|
|
134
|
-
if (parent === current) {
|
|
135
|
-
throw new Error(`Could not locate package.json from ${startDir}`);
|
|
136
|
-
}
|
|
137
|
-
current = parent;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function readPackageMetadata(packageRoot) {
|
|
141
|
-
const packageJsonPath = path.join(packageRoot, 'package.json');
|
|
142
|
-
return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
143
|
-
}
|
|
144
|
-
function resolveRuntimeDependencies(packageRoot) {
|
|
145
|
-
const metadata = readPackageMetadata(packageRoot);
|
|
146
|
-
return Object.keys(metadata.dependencies ?? {});
|
|
147
|
-
}
|
|
148
|
-
function packClaudeDesktopExtension(workspaceDir, outputFile) {
|
|
149
|
-
fs.rmSync(outputFile, { force: true });
|
|
150
|
-
const pythonCommand = resolveAvailableCommand(process.platform === 'win32'
|
|
151
|
-
? ['python', 'py', 'python3']
|
|
152
|
-
: ['python3', 'python', 'py']);
|
|
153
|
-
if (pythonCommand) {
|
|
154
|
-
const script = [
|
|
155
|
-
'import os, sys, zipfile',
|
|
156
|
-
'src, dest = sys.argv[1], sys.argv[2]',
|
|
157
|
-
'with zipfile.ZipFile(dest, "w", zipfile.ZIP_DEFLATED) as zf:',
|
|
158
|
-
' for root, _, files in os.walk(src):',
|
|
159
|
-
' for name in files:',
|
|
160
|
-
' full = os.path.join(root, name)',
|
|
161
|
-
' rel = os.path.relpath(full, src)',
|
|
162
|
-
' zf.write(full, rel)',
|
|
163
|
-
].join('; ');
|
|
164
|
-
const result = spawnSync(pythonCommand, ['-c', script, workspaceDir, outputFile], {
|
|
165
|
-
encoding: 'utf-8',
|
|
166
|
-
});
|
|
167
|
-
if (result.status === 0) {
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (process.platform === 'win32') {
|
|
172
|
-
const shell = resolveAvailableCommand(['pwsh', 'powershell']);
|
|
173
|
-
if (!shell) {
|
|
174
|
-
throw new Error('Could not find Python or PowerShell to create the Claude Desktop .mcpb archive.');
|
|
175
|
-
}
|
|
176
|
-
const command = `Compress-Archive -Path (Join-Path '${escapePowerShellPath(workspaceDir)}' '*') -DestinationPath '${escapePowerShellPath(outputFile)}' -Force`;
|
|
177
|
-
const result = spawnSync(shell, ['-NoProfile', '-Command', command], {
|
|
178
|
-
encoding: 'utf-8',
|
|
179
|
-
});
|
|
180
|
-
if (result.status === 0) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const zipCommand = resolveAvailableCommand(['zip']);
|
|
185
|
-
if (zipCommand) {
|
|
186
|
-
const result = spawnSync(zipCommand, ['-qr', outputFile, '.'], {
|
|
187
|
-
cwd: workspaceDir,
|
|
188
|
-
encoding: 'utf-8',
|
|
189
|
-
});
|
|
190
|
-
if (result.status === 0) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
throw new Error('Failed to create a .mcpb archive. Install Python 3, PowerShell, or zip.');
|
|
195
|
-
}
|
|
196
|
-
function resolveAvailableCommand(candidates) {
|
|
197
|
-
for (const candidate of candidates) {
|
|
198
|
-
const result = spawnSync(candidate, ['--version'], { encoding: 'utf-8' });
|
|
199
|
-
if (result.status === 0) {
|
|
200
|
-
return candidate;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
function escapePowerShellPath(value) {
|
|
206
|
-
return value.replace(/'/g, "''");
|
|
207
|
-
}
|
|
208
|
-
export function renderClaudeDesktopExtensionSummary(result) {
|
|
209
|
-
const lines = [
|
|
210
|
-
'Claude Desktop extension scaffold ready.',
|
|
211
|
-
`Workspace: ${path.relative(process.cwd(), result.workspaceDir) || result.workspaceDir}`,
|
|
212
|
-
`Manifest: ${path.relative(process.cwd(), result.manifestPath) || result.manifestPath}`,
|
|
213
|
-
`Server entry: ${path.relative(process.cwd(), result.entryPointPath) || result.entryPointPath}`,
|
|
214
|
-
];
|
|
215
|
-
if (result.packed) {
|
|
216
|
-
lines.push(`Package: ${path.relative(process.cwd(), result.outputFile) || result.outputFile}`);
|
|
217
|
-
lines.push('Install in Claude Desktop via Developer -> Extensions -> Install Extension.');
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
lines.push('Archive packing skipped (--no-pack).');
|
|
221
|
-
}
|
|
222
|
-
return lines.join('\n');
|
|
223
|
-
}
|
|
224
|
-
//# sourceMappingURL=claude-desktop-extension.js.map
|