@neurodock/cli 0.2.0 → 0.6.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/CHANGELOG.md +198 -1
- package/README.md +155 -27
- package/dist/assets/hooks/neurodock_daemon.py +506 -0
- package/dist/assets/hooks/proactive_guardrail.py +520 -0
- package/dist/clients/claude-code.d.ts.map +1 -1
- package/dist/clients/claude-code.js +3 -1
- package/dist/clients/claude-code.js.map +1 -1
- package/dist/clients/claude-desktop.d.ts.map +1 -1
- package/dist/clients/claude-desktop.js +3 -1
- package/dist/clients/claude-desktop.js.map +1 -1
- package/dist/clients/cursor.d.ts.map +1 -1
- package/dist/clients/cursor.js +3 -1
- package/dist/clients/cursor.js.map +1 -1
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +59 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/examples.d.ts +28 -0
- package/dist/commands/examples.d.ts.map +1 -0
- package/dist/commands/examples.js +168 -0
- package/dist/commands/examples.js.map +1 -0
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +1 -1
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +14 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install-all.d.ts +78 -0
- package/dist/commands/install-all.d.ts.map +1 -0
- package/dist/commands/install-all.js +283 -0
- package/dist/commands/install-all.js.map +1 -0
- package/dist/commands/install-hooks.d.ts +20 -0
- package/dist/commands/install-hooks.d.ts.map +1 -0
- package/dist/commands/install-hooks.js +356 -0
- package/dist/commands/install-hooks.js.map +1 -0
- package/dist/commands/plugin.d.ts +122 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +545 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +11 -2
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/sync.d.ts +24 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +179 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +11 -3
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +13 -22
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +11 -172
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +12 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +196 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/json-patch.d.ts.map +1 -1
- package/dist/lib/json-patch.js +1 -1
- package/dist/lib/json-patch.js.map +1 -1
- package/dist/lib/mcp-entries.d.ts.map +1 -1
- package/dist/lib/mcp-entries.js +25 -3
- package/dist/lib/mcp-entries.js.map +1 -1
- package/dist/lib/paths.d.ts +10 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +19 -2
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/plugin-schema.d.ts +12 -0
- package/dist/lib/plugin-schema.d.ts.map +1 -0
- package/dist/lib/plugin-schema.js +71 -0
- package/dist/lib/plugin-schema.js.map +1 -0
- package/dist/profile/defaults.d.ts.map +1 -1
- package/dist/profile/defaults.js +3 -1
- package/dist/profile/defaults.js.map +1 -1
- package/dist/profile/loader.d.ts.map +1 -1
- package/dist/profile/loader.js +3 -1
- package/dist/profile/loader.js.map +1 -1
- package/dist/profile/validator.d.ts.map +1 -1
- package/dist/profile/validator.js +5 -1
- package/dist/profile/validator.js.map +1 -1
- package/package.json +31 -14
- package/LICENSE +0 -11
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `neurodock install-hooks` — wire NeuroDock's proactive guardrails into
|
|
3
|
+
* Claude Code's hook system.
|
|
4
|
+
*
|
|
5
|
+
* What this does (idempotent):
|
|
6
|
+
*
|
|
7
|
+
* 1. Copies the bundled `proactive_guardrail.py` script to
|
|
8
|
+
* `~/.neurodock/hooks/proactive_guardrail.py` (creating dirs as needed).
|
|
9
|
+
* 2. Merges four hook entries (SessionStart / PreToolUse / PostToolUse /
|
|
10
|
+
* Stop) into `~/.claude/settings.json`, preserving any existing hooks
|
|
11
|
+
* from other tools and skipping if NeuroDock entries are already
|
|
12
|
+
* present.
|
|
13
|
+
* 3. Optionally runs the script's `self-test` to verify Python is on
|
|
14
|
+
* PATH and the heuristics fire.
|
|
15
|
+
*
|
|
16
|
+
* Why a CLI command and not just docs:
|
|
17
|
+
*
|
|
18
|
+
* The setup is fiddly enough that asking users to hand-edit JSON to
|
|
19
|
+
* wire four hooks is the kind of friction that defeats the whole
|
|
20
|
+
* proactive-guardrails purpose. The user types one command.
|
|
21
|
+
*
|
|
22
|
+
* Opt-out:
|
|
23
|
+
*
|
|
24
|
+
* `neurodock install-hooks --uninstall` removes the hook entries
|
|
25
|
+
* (leaves the script in place — re-enabling is just a re-run).
|
|
26
|
+
* Environment variable `NEURODOCK_GUARDRAILS=off` disables the hook
|
|
27
|
+
* without touching settings.json.
|
|
28
|
+
*/
|
|
29
|
+
import { mkdirSync, readFileSync, writeFileSync, existsSync, copyFileSync, } from "node:fs";
|
|
30
|
+
import { dirname, join, resolve } from "node:path";
|
|
31
|
+
import { fileURLToPath } from "node:url";
|
|
32
|
+
import { homedir } from "node:os";
|
|
33
|
+
import { spawnSync } from "node:child_process";
|
|
34
|
+
const HOOK_EVENTS = [
|
|
35
|
+
"SessionStart",
|
|
36
|
+
"PreToolUse",
|
|
37
|
+
"PostToolUse",
|
|
38
|
+
"Stop",
|
|
39
|
+
];
|
|
40
|
+
const SUBCOMMAND_FOR_EVENT = {
|
|
41
|
+
SessionStart: "session-start",
|
|
42
|
+
PreToolUse: "pre-tool",
|
|
43
|
+
PostToolUse: "post-tool",
|
|
44
|
+
Stop: "stop",
|
|
45
|
+
};
|
|
46
|
+
const NEURODOCK_MARKER = "neurodock-proactive-guardrail";
|
|
47
|
+
export async function runInstallHooks(options) {
|
|
48
|
+
const messages = [];
|
|
49
|
+
const hookDir = join(homedir(), ".neurodock", "hooks");
|
|
50
|
+
const targetScript = join(hookDir, "proactive_guardrail.py");
|
|
51
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
52
|
+
if (options.uninstall) {
|
|
53
|
+
return uninstallHooks(settingsPath, options.dryRun);
|
|
54
|
+
}
|
|
55
|
+
// 1. Copy the bundled script(s).
|
|
56
|
+
const sourceScript = resolveBundledScript("proactive_guardrail.py");
|
|
57
|
+
if (sourceScript === null) {
|
|
58
|
+
return {
|
|
59
|
+
messages: [
|
|
60
|
+
"[install-hooks] could not locate the bundled proactive_guardrail.py.",
|
|
61
|
+
" This is a packaging bug — the script should ship with @neurodock/cli.",
|
|
62
|
+
],
|
|
63
|
+
exitCode: 1,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const daemonSource = resolveBundledScript("neurodock_daemon.py");
|
|
67
|
+
const daemonTarget = join(hookDir, "neurodock_daemon.py");
|
|
68
|
+
if (options.dryRun) {
|
|
69
|
+
messages.push(`[install-hooks] would copy ${sourceScript} -> ${targetScript}`);
|
|
70
|
+
if (daemonSource !== null) {
|
|
71
|
+
messages.push(`[install-hooks] would copy ${daemonSource} -> ${daemonTarget}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
mkdirSync(hookDir, { recursive: true });
|
|
76
|
+
copyFileSync(sourceScript, targetScript);
|
|
77
|
+
messages.push(`[install-hooks] copied script -> ${targetScript}`);
|
|
78
|
+
if (daemonSource !== null) {
|
|
79
|
+
copyFileSync(daemonSource, daemonTarget);
|
|
80
|
+
messages.push(`[install-hooks] copied daemon -> ${daemonTarget}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 2. Merge hook entries into settings.json.
|
|
84
|
+
const command = buildHookCommand(targetScript);
|
|
85
|
+
// Always echo the exact command string we're about to write. The
|
|
86
|
+
// Windows-path-escape bug (0.0.x ~/.neurodock/hooks/... mangled by
|
|
87
|
+
// bash) was a silent foot-gun precisely because the install summary
|
|
88
|
+
// didn't show it. Now it does, and a quick scan tells you whether
|
|
89
|
+
// forward slashes survived.
|
|
90
|
+
messages.push(`[install-hooks] hook command: ${command} <subcommand>`);
|
|
91
|
+
const merged = mergeSettings(settingsPath, command);
|
|
92
|
+
if (merged.changed) {
|
|
93
|
+
if (options.dryRun) {
|
|
94
|
+
messages.push("[install-hooks] would update ~/.claude/settings.json:");
|
|
95
|
+
for (const line of merged.diff)
|
|
96
|
+
messages.push(` ${line}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
100
|
+
writeFileSync(settingsPath, merged.json + "\n", "utf8");
|
|
101
|
+
messages.push("[install-hooks] updated ~/.claude/settings.json");
|
|
102
|
+
for (const line of merged.diff)
|
|
103
|
+
messages.push(` ${line}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
messages.push("[install-hooks] settings.json already wired — no change needed.");
|
|
108
|
+
}
|
|
109
|
+
// 3. Optionally self-test.
|
|
110
|
+
if (options.selfTest && !options.dryRun) {
|
|
111
|
+
const selfTest = runSelfTest(targetScript);
|
|
112
|
+
messages.push(`[install-hooks] self-test: ${selfTest.summary}`);
|
|
113
|
+
if (selfTest.exitCode !== 0) {
|
|
114
|
+
return { messages, exitCode: 1 };
|
|
115
|
+
}
|
|
116
|
+
if (daemonSource !== null) {
|
|
117
|
+
const daemonSelfTest = runSelfTest(daemonTarget);
|
|
118
|
+
messages.push(`[install-hooks] daemon self-test: ${daemonSelfTest.summary}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// 4. Optionally wire the daemon at user-login autostart.
|
|
122
|
+
if (options.installDaemon === true && !options.dryRun) {
|
|
123
|
+
if (daemonSource === null) {
|
|
124
|
+
messages.push("[install-hooks] daemon script not bundled — skipping autostart.");
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const result = spawnSync("python", [daemonTarget, "install"], {
|
|
128
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
129
|
+
encoding: "utf8",
|
|
130
|
+
});
|
|
131
|
+
if (result.error) {
|
|
132
|
+
messages.push(`[install-hooks] daemon autostart skipped — python not on PATH (${result.error.message}).`);
|
|
133
|
+
}
|
|
134
|
+
else if (result.status !== 0) {
|
|
135
|
+
messages.push(`[install-hooks] daemon autostart failed: ${result.stderr.trim()}`);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
messages.push(`[install-hooks] daemon autostart: ${result.stdout.trim()}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (options.installDaemon === true && options.dryRun) {
|
|
143
|
+
messages.push("[install-hooks] would register daemon autostart (HKCU Run / LaunchAgent / systemd --user)");
|
|
144
|
+
}
|
|
145
|
+
messages.push("");
|
|
146
|
+
messages.push("Done. Open a new Claude Code session to activate the hooks.");
|
|
147
|
+
messages.push("Opt out anytime by setting NEURODOCK_GUARDRAILS=off in your environment,");
|
|
148
|
+
messages.push("or run: neurodock install-hooks --uninstall");
|
|
149
|
+
return { messages, exitCode: 0 };
|
|
150
|
+
}
|
|
151
|
+
function uninstallHooks(settingsPath, dryRun) {
|
|
152
|
+
const messages = [];
|
|
153
|
+
// 0.0.23: also try to remove the daemon autostart entry. Best-effort
|
|
154
|
+
// — if the daemon was never installed, the uninstall is a no-op.
|
|
155
|
+
if (!dryRun) {
|
|
156
|
+
const daemonTarget = join(homedir(), ".neurodock", "hooks", "neurodock_daemon.py");
|
|
157
|
+
if (existsSync(daemonTarget)) {
|
|
158
|
+
const result = spawnSync("python", [daemonTarget, "uninstall"], {
|
|
159
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
160
|
+
encoding: "utf8",
|
|
161
|
+
});
|
|
162
|
+
if (!result.error && result.status === 0) {
|
|
163
|
+
messages.push("[install-hooks] removed daemon autostart entry");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
messages.push("[install-hooks] would also remove daemon autostart entry");
|
|
169
|
+
}
|
|
170
|
+
if (!existsSync(settingsPath)) {
|
|
171
|
+
return {
|
|
172
|
+
messages: [
|
|
173
|
+
...messages,
|
|
174
|
+
"[install-hooks] no ~/.claude/settings.json to clean — nothing to do.",
|
|
175
|
+
],
|
|
176
|
+
exitCode: 0,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const raw = readFileSync(settingsPath, "utf8");
|
|
180
|
+
const settings = parseSettings(raw);
|
|
181
|
+
const hooks = isObject(settings.hooks) ? { ...settings.hooks } : {};
|
|
182
|
+
let removedAny = false;
|
|
183
|
+
for (const event of HOOK_EVENTS) {
|
|
184
|
+
const entries = hooks[event];
|
|
185
|
+
if (!Array.isArray(entries))
|
|
186
|
+
continue;
|
|
187
|
+
const filtered = entries.filter((entry) => !isNeurodockHookEntry(entry));
|
|
188
|
+
if (filtered.length !== entries.length) {
|
|
189
|
+
removedAny = true;
|
|
190
|
+
if (filtered.length === 0) {
|
|
191
|
+
delete hooks[event];
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
hooks[event] = filtered;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!removedAny) {
|
|
199
|
+
return {
|
|
200
|
+
messages: [
|
|
201
|
+
"[install-hooks] no NeuroDock hook entries found — nothing to do.",
|
|
202
|
+
],
|
|
203
|
+
exitCode: 0,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const next = { ...settings, hooks };
|
|
207
|
+
// Drop empty hooks object so we don't leave dead structure behind.
|
|
208
|
+
if (Object.keys(hooks).length === 0)
|
|
209
|
+
delete next["hooks"];
|
|
210
|
+
const formatted = JSON.stringify(next, null, 2);
|
|
211
|
+
if (dryRun) {
|
|
212
|
+
messages.push("[install-hooks] would remove NeuroDock entries from ~/.claude/settings.json");
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
writeFileSync(settingsPath, formatted + "\n", "utf8");
|
|
216
|
+
messages.push("[install-hooks] removed NeuroDock entries from ~/.claude/settings.json");
|
|
217
|
+
}
|
|
218
|
+
messages.push("Hook script left at ~/.neurodock/hooks/ — delete manually if you want it gone.");
|
|
219
|
+
return { messages, exitCode: 0 };
|
|
220
|
+
}
|
|
221
|
+
function mergeSettings(settingsPath, command) {
|
|
222
|
+
let raw = "{}";
|
|
223
|
+
if (existsSync(settingsPath)) {
|
|
224
|
+
try {
|
|
225
|
+
raw = readFileSync(settingsPath, "utf8");
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
raw = "{}";
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const settings = parseSettings(raw);
|
|
232
|
+
const hooks = isObject(settings.hooks) ? { ...settings.hooks } : {};
|
|
233
|
+
const diff = [];
|
|
234
|
+
let changed = false;
|
|
235
|
+
for (const event of HOOK_EVENTS) {
|
|
236
|
+
const existing = Array.isArray(hooks[event]) ? [...hooks[event]] : [];
|
|
237
|
+
if (existing.some(isNeurodockHookEntry))
|
|
238
|
+
continue;
|
|
239
|
+
const newEntry = buildHookEntry(event, command);
|
|
240
|
+
existing.push(newEntry);
|
|
241
|
+
hooks[event] = existing;
|
|
242
|
+
diff.push(`+ ${event} -> ${SUBCOMMAND_FOR_EVENT[event]}`);
|
|
243
|
+
changed = true;
|
|
244
|
+
}
|
|
245
|
+
if (!changed) {
|
|
246
|
+
return { changed: false, json: raw, diff: [] };
|
|
247
|
+
}
|
|
248
|
+
const next = { ...settings, hooks };
|
|
249
|
+
return {
|
|
250
|
+
changed: true,
|
|
251
|
+
json: JSON.stringify(next, null, 2),
|
|
252
|
+
diff,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function buildHookEntry(event, command) {
|
|
256
|
+
const subcommand = SUBCOMMAND_FOR_EVENT[event];
|
|
257
|
+
return {
|
|
258
|
+
// Claude Code reads this as a "matcher group". An empty matcher
|
|
259
|
+
// applies to all events of this type, which is what we want — the
|
|
260
|
+
// proactive guardrail evaluates on every event and decides whether
|
|
261
|
+
// to fire based on its own state.
|
|
262
|
+
matcher: "",
|
|
263
|
+
hooks: [
|
|
264
|
+
{
|
|
265
|
+
type: "command",
|
|
266
|
+
command: `${command} ${subcommand}`,
|
|
267
|
+
// Tag the entry so neurodock install-hooks can find and remove
|
|
268
|
+
// it later without scanning the entire command string.
|
|
269
|
+
description: NEURODOCK_MARKER,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function buildHookCommand(scriptPath) {
|
|
275
|
+
// Always normalise to forward slashes. Python accepts them on Windows,
|
|
276
|
+
// and bash-style shells (Git Bash / MinGW — what Claude Code uses on
|
|
277
|
+
// Windows) strip backslashes from unquoted Windows paths, mangling
|
|
278
|
+
// the path passed to python. Quoting alone isn't enough because the
|
|
279
|
+
// JSON-decoded value goes through one more shell pass that strips
|
|
280
|
+
// escape sequences like `\U`, `\h`. Forward slashes side-step it.
|
|
281
|
+
const normalised = scriptPath.replace(/\\/g, "/");
|
|
282
|
+
const quoted = `"${normalised}"`;
|
|
283
|
+
return `python ${quoted}`;
|
|
284
|
+
}
|
|
285
|
+
function isNeurodockHookEntry(entry) {
|
|
286
|
+
if (!isObject(entry))
|
|
287
|
+
return false;
|
|
288
|
+
const hooks = entry.hooks;
|
|
289
|
+
if (!Array.isArray(hooks))
|
|
290
|
+
return false;
|
|
291
|
+
return hooks.some((h) => {
|
|
292
|
+
if (!isObject(h))
|
|
293
|
+
return false;
|
|
294
|
+
const command = h.command;
|
|
295
|
+
if (typeof command === "string" &&
|
|
296
|
+
command.includes("proactive_guardrail.py")) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
const description = h.description;
|
|
300
|
+
return typeof description === "string" && description === NEURODOCK_MARKER;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function parseSettings(raw) {
|
|
304
|
+
try {
|
|
305
|
+
const parsed = JSON.parse(raw);
|
|
306
|
+
return isObject(parsed) ? parsed : {};
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return {};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function isObject(value) {
|
|
313
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
314
|
+
}
|
|
315
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
316
|
+
// Locate the bundled script in dev (monorepo) and prod (npm install)
|
|
317
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
318
|
+
function resolveBundledScript(filename) {
|
|
319
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
320
|
+
const candidates = [
|
|
321
|
+
// Built: dist/commands/install-hooks.js -> ../assets/hooks/...
|
|
322
|
+
resolve(here, "..", "assets", "hooks", filename),
|
|
323
|
+
// Monorepo source: src/commands/install-hooks.ts -> ../assets/hooks/...
|
|
324
|
+
resolve(here, "..", "..", "src", "assets", "hooks", filename),
|
|
325
|
+
// node_modules install
|
|
326
|
+
resolve(here, "..", "..", "node_modules", "@neurodock", "cli", "dist", "assets", "hooks", filename),
|
|
327
|
+
];
|
|
328
|
+
for (const c of candidates) {
|
|
329
|
+
if (existsSync(c))
|
|
330
|
+
return c;
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
function runSelfTest(scriptPath) {
|
|
335
|
+
const result = spawnSync("python", [scriptPath, "self-test"], {
|
|
336
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
337
|
+
encoding: "utf8",
|
|
338
|
+
});
|
|
339
|
+
if (result.error) {
|
|
340
|
+
return {
|
|
341
|
+
summary: `python not on PATH (${result.error.message}). Install Python 3.11+ and re-run.`,
|
|
342
|
+
exitCode: 1,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
if (result.status !== 0) {
|
|
346
|
+
return {
|
|
347
|
+
summary: `self-test failed (exit ${result.status}): ${result.stderr.trim()}`,
|
|
348
|
+
exitCode: result.status ?? 1,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
summary: result.stdout.trim() || "passed",
|
|
353
|
+
exitCode: 0,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=install-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-hooks.js","sourceRoot":"","sources":["../../src/commands/install-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAsB/C,MAAM,WAAW,GAAG;IAClB,cAAc;IACd,YAAY;IACZ,aAAa;IACb,MAAM;CACE,CAAC;AAIX,MAAM,oBAAoB,GAA8B;IACtD,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA4B;IAE5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACv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,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,0BACP,MAAM,CAAC,MACT,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;YAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC;SAC7B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,QAAQ;QACzC,QAAQ,EAAE,CAAC;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { readEnv } from "../lib/env.js";
|
|
2
|
+
import { type PluginValidationViolation } from "../lib/plugin-schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Marker file written by `neurodock plugin enable <name>` inside the
|
|
5
|
+
* plugin's install directory. Chosen over a central `plugins.yaml`
|
|
6
|
+
* registry because:
|
|
7
|
+
* - presence-on-disk is the single source of truth for both "is
|
|
8
|
+
* installed" and "is enabled"
|
|
9
|
+
* - filesystem-only state lets the substrate walk
|
|
10
|
+
* `<pluginsDir>/<name>/` exactly per ADR 0007 with no extra file
|
|
11
|
+
* to keep in sync
|
|
12
|
+
* - removing the plugin directory naturally removes the enable state
|
|
13
|
+
*/
|
|
14
|
+
export declare const ENABLED_MARKER = ".enabled";
|
|
15
|
+
/**
|
|
16
|
+
* Minimum manifest shape the CLI reads. Forward-compat: unknown fields are
|
|
17
|
+
* preserved on disk (we never re-serialize the manifest), and any field we
|
|
18
|
+
* read but don't recognise is ignored without error.
|
|
19
|
+
*/
|
|
20
|
+
export interface PluginManifest {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly type: string;
|
|
23
|
+
readonly version: string;
|
|
24
|
+
readonly description?: string;
|
|
25
|
+
}
|
|
26
|
+
export type ExitCode = 0 | 1 | 2 | 3;
|
|
27
|
+
export interface PluginDependencies {
|
|
28
|
+
readonly envOverrides?: Parameters<typeof readEnv>[0];
|
|
29
|
+
/**
|
|
30
|
+
* Prompt the user with a yes/no question. Tests can stub.
|
|
31
|
+
* Defaults to interactive `prompts` (cancellation returns false).
|
|
32
|
+
*/
|
|
33
|
+
readonly confirm?: (message: string) => Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
export interface PluginAddOptions {
|
|
36
|
+
readonly source: string;
|
|
37
|
+
readonly yes: boolean;
|
|
38
|
+
readonly dryRun: boolean;
|
|
39
|
+
readonly force: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface PluginAddResult {
|
|
42
|
+
readonly source: string;
|
|
43
|
+
readonly resolvedSource: string;
|
|
44
|
+
readonly destination: string;
|
|
45
|
+
readonly manifest: PluginManifest | null;
|
|
46
|
+
readonly action: "installed" | "overwritten" | "dry-run" | "aborted" | "fail";
|
|
47
|
+
readonly messages: ReadonlyArray<string>;
|
|
48
|
+
readonly violations: ReadonlyArray<PluginValidationViolation>;
|
|
49
|
+
readonly exitCode: ExitCode;
|
|
50
|
+
}
|
|
51
|
+
export declare function runPluginAdd(options: PluginAddOptions, deps?: PluginDependencies): Promise<PluginAddResult>;
|
|
52
|
+
export interface PluginRemoveOptions {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly yes: boolean;
|
|
55
|
+
readonly dryRun: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface PluginRemoveResult {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly destination: string;
|
|
60
|
+
readonly action: "removed" | "dry-run" | "aborted" | "missing";
|
|
61
|
+
readonly messages: ReadonlyArray<string>;
|
|
62
|
+
readonly exitCode: 0 | 1;
|
|
63
|
+
}
|
|
64
|
+
export declare function runPluginRemove(options: PluginRemoveOptions, deps?: PluginDependencies): Promise<PluginRemoveResult>;
|
|
65
|
+
export interface PluginListEntry {
|
|
66
|
+
readonly name: string;
|
|
67
|
+
readonly path: string;
|
|
68
|
+
readonly enabled: boolean;
|
|
69
|
+
readonly manifest: PluginManifest | null;
|
|
70
|
+
readonly invalid: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface PluginListOptions {
|
|
73
|
+
readonly json: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface PluginListResult {
|
|
76
|
+
readonly root: string;
|
|
77
|
+
readonly plugins: ReadonlyArray<PluginListEntry>;
|
|
78
|
+
readonly messages: ReadonlyArray<string>;
|
|
79
|
+
}
|
|
80
|
+
export declare function runPluginList(options: PluginListOptions, deps?: PluginDependencies): Promise<PluginListResult>;
|
|
81
|
+
export interface PluginEnableOptions {
|
|
82
|
+
readonly name: string;
|
|
83
|
+
}
|
|
84
|
+
export interface PluginEnableResult {
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly destination: string;
|
|
87
|
+
readonly markerPath: string;
|
|
88
|
+
readonly action: "enabled" | "already-enabled" | "missing";
|
|
89
|
+
readonly messages: ReadonlyArray<string>;
|
|
90
|
+
readonly exitCode: 0 | 1;
|
|
91
|
+
}
|
|
92
|
+
export declare function runPluginEnable(options: PluginEnableOptions, deps?: PluginDependencies): Promise<PluginEnableResult>;
|
|
93
|
+
export interface PluginDisableOptions {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
}
|
|
96
|
+
export interface PluginDisableResult {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly destination: string;
|
|
99
|
+
readonly markerPath: string;
|
|
100
|
+
readonly action: "disabled" | "already-disabled" | "missing";
|
|
101
|
+
readonly messages: ReadonlyArray<string>;
|
|
102
|
+
readonly exitCode: 0 | 1;
|
|
103
|
+
}
|
|
104
|
+
export declare function runPluginDisable(options: PluginDisableOptions, deps?: PluginDependencies): Promise<PluginDisableResult>;
|
|
105
|
+
export interface PluginValidateOptions {
|
|
106
|
+
readonly source: string;
|
|
107
|
+
readonly json: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface PluginValidateResult {
|
|
110
|
+
readonly source: string;
|
|
111
|
+
readonly resolvedSource: string;
|
|
112
|
+
readonly manifestPath: string;
|
|
113
|
+
readonly valid: boolean;
|
|
114
|
+
readonly missing: boolean;
|
|
115
|
+
readonly parseError?: string;
|
|
116
|
+
readonly violations: ReadonlyArray<PluginValidationViolation>;
|
|
117
|
+
readonly manifest: PluginManifest | null;
|
|
118
|
+
readonly messages: ReadonlyArray<string>;
|
|
119
|
+
readonly exitCode: 0 | 1 | 2;
|
|
120
|
+
}
|
|
121
|
+
export declare function runPluginValidate(options: PluginValidateOptions, deps?: PluginDependencies): Promise<PluginValidateResult>;
|
|
122
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,aAAa,CAAC;AAMzC;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAErC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D;AAcD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,O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