cadre-ai 3.4.0 → 3.5.1
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/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/plugin.json +2 -2
- package/CHANGELOG.md +90 -0
- package/README.md +52 -20
- package/dist/cadre-cli.mjs +398 -92
- package/dist/cadre-mcp.mjs +455 -195
- package/package.json +3 -2
- package/skills/archive/SKILL.md +6 -6
- package/skills/create/SKILL.md +4 -4
- package/skills/implement/SKILL.md +4 -4
- package/skills/implement/references/governed-mode.md +1 -1
- package/skills/refresh/SKILL.md +3 -3
- package/skills/revert/SKILL.md +3 -3
- package/skills/review/SKILL.md +5 -5
- package/skills/revise/SKILL.md +4 -4
- package/skills/status/SKILL.md +2 -1
- package/skills/track/SKILL.md +5 -5
- package/skills/wisp/SKILL.md +3 -3
package/dist/cadre-cli.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// scripts/cli.ts
|
|
4
|
-
import { existsSync as
|
|
5
|
-
import { dirname as
|
|
4
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
5
|
+
import { dirname as dirname7, join as join7, resolve as resolve7 } from "node:path";
|
|
6
6
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7
7
|
|
|
8
8
|
// scripts/install.ts
|
|
9
|
-
import { existsSync as
|
|
10
|
-
import { homedir as
|
|
11
|
-
import { basename as basename2, dirname as
|
|
9
|
+
import { existsSync as existsSync5, mkdtempSync, mkdirSync as mkdirSync4, readFileSync as readFileSync5, renameSync as renameSync2 } from "node:fs";
|
|
10
|
+
import { homedir as homedir3 } from "node:os";
|
|
11
|
+
import { basename as basename2, dirname as dirname5, join as join5, parse as parse4, resolve as resolve5 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// scripts/cli-options.ts
|
|
14
14
|
import { homedir } from "node:os";
|
|
@@ -16,7 +16,7 @@ import { join, resolve } from "node:path";
|
|
|
16
16
|
|
|
17
17
|
// scripts/native-clients.ts
|
|
18
18
|
import { spawnSync } from "node:child_process";
|
|
19
|
-
var CLIENTS = ["codex", "claude"];
|
|
19
|
+
var CLIENTS = ["codex", "claude", "zed"];
|
|
20
20
|
function commandExists(command) {
|
|
21
21
|
const lookup = process.platform === "win32" ? "where" : "which";
|
|
22
22
|
return spawnSync(lookup, [command], { stdio: "ignore" }).status === 0;
|
|
@@ -47,7 +47,7 @@ function runJson(command, args) {
|
|
|
47
47
|
// scripts/cli-options.ts
|
|
48
48
|
function parseClient(value) {
|
|
49
49
|
if (value === "all" || value === "auto" || CLIENTS.includes(value)) return value;
|
|
50
|
-
throw new Error("--target/--agent must be auto, all, codex, or
|
|
50
|
+
throw new Error("--target/--agent must be auto, all, codex, claude, or zed");
|
|
51
51
|
}
|
|
52
52
|
function defaultMarketplaceRoot() {
|
|
53
53
|
const cadreHome = process.env.CADRE_HOME ? resolve(process.env.CADRE_HOME) : join(homedir(), ".cadre");
|
|
@@ -63,8 +63,8 @@ function marketplaceFromHome(home) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// scripts/package-plugin.ts
|
|
66
|
-
import { cpSync, existsSync as
|
|
67
|
-
import { dirname as
|
|
66
|
+
import { cpSync as cpSync2, existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
67
|
+
import { dirname as dirname3, join as join4, resolve as resolve4 } from "node:path";
|
|
68
68
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
69
69
|
|
|
70
70
|
// src/domain/templates.ts
|
|
@@ -74,7 +74,7 @@ import { dirname, extname, join as join2, relative, resolve as resolve2, sep } f
|
|
|
74
74
|
import { fileURLToPath } from "node:url";
|
|
75
75
|
|
|
76
76
|
// src/domain/version.ts
|
|
77
|
-
var CADRE_RUNTIME_VERSION = "3.
|
|
77
|
+
var CADRE_RUNTIME_VERSION = "3.5.1";
|
|
78
78
|
var TEMPLATE_SET_VERSION = "v2";
|
|
79
79
|
|
|
80
80
|
// src/domain/templates.ts
|
|
@@ -185,8 +185,130 @@ function templateCatalog() {
|
|
|
185
185
|
return catalogCache.map((template) => ({ ...template }));
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
// scripts/zed.ts
|
|
189
|
+
import {
|
|
190
|
+
cpSync,
|
|
191
|
+
existsSync as existsSync2,
|
|
192
|
+
lstatSync,
|
|
193
|
+
mkdirSync,
|
|
194
|
+
readFileSync as readFileSync2,
|
|
195
|
+
readlinkSync,
|
|
196
|
+
rmSync,
|
|
197
|
+
symlinkSync,
|
|
198
|
+
unlinkSync,
|
|
199
|
+
writeFileSync
|
|
200
|
+
} from "node:fs";
|
|
201
|
+
import { homedir as homedir2 } from "node:os";
|
|
202
|
+
import { dirname as dirname2, join as join3, resolve as resolve3 } from "node:path";
|
|
203
|
+
var CADRE_WORKFLOWS = [
|
|
204
|
+
"create",
|
|
205
|
+
"track",
|
|
206
|
+
"implement",
|
|
207
|
+
"review",
|
|
208
|
+
"revise",
|
|
209
|
+
"archive",
|
|
210
|
+
"refresh",
|
|
211
|
+
"revert",
|
|
212
|
+
"status",
|
|
213
|
+
"wisp"
|
|
214
|
+
];
|
|
215
|
+
var ZED_COMPATIBILITY = `## Zed compatibility
|
|
216
|
+
|
|
217
|
+
Zed Agent consumes Cadre templates through tools rather than MCP resource discovery. Whenever this workflow calls \`template_get_many\`, include \`contentMode: "text"\`. Use known template IDs and descriptor tools such as \`styleguide_resolve\`; do not attempt to list or read MCP resources directly. When recommending another Cadre workflow, use its Zed command \`/cadre-<workflow>\` and never a dollar-prefixed or colon command.`;
|
|
218
|
+
function pathExists(path) {
|
|
219
|
+
try {
|
|
220
|
+
lstatSync(path);
|
|
221
|
+
return true;
|
|
222
|
+
} catch {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function zedSettingsPath() {
|
|
227
|
+
return join3(homedir2(), ".config", "zed", "settings.json");
|
|
228
|
+
}
|
|
229
|
+
function zedSkillsRoot() {
|
|
230
|
+
return join3(homedir2(), ".agents", "skills");
|
|
231
|
+
}
|
|
232
|
+
function zedAdapterRoot(marketplaceRoot) {
|
|
233
|
+
return join3(resolve3(marketplaceRoot), "plugins", "cadre", "zed-skills");
|
|
234
|
+
}
|
|
235
|
+
function createZedSkillAdapters(pluginRoot) {
|
|
236
|
+
const adapterRoot = join3(pluginRoot, "zed-skills");
|
|
237
|
+
if (existsSync2(adapterRoot)) throw new Error(`Zed skill adapter output already exists: ${adapterRoot}`);
|
|
238
|
+
mkdirSync(adapterRoot, { recursive: true });
|
|
239
|
+
for (const workflow of CADRE_WORKFLOWS) {
|
|
240
|
+
const source = join3(pluginRoot, "skills", workflow);
|
|
241
|
+
const target = join3(adapterRoot, `cadre-${workflow}`);
|
|
242
|
+
cpSync(source, target, { recursive: true });
|
|
243
|
+
const codexMetadata = join3(target, "agents");
|
|
244
|
+
if (existsSync2(codexMetadata)) rmSync(codexMetadata, { recursive: true });
|
|
245
|
+
const skillPath = join3(target, "SKILL.md");
|
|
246
|
+
const body = readFileSync2(skillPath, "utf8");
|
|
247
|
+
const expectedName = `name: ${workflow}`;
|
|
248
|
+
const namePattern = new RegExp(`^${expectedName}$`, "m");
|
|
249
|
+
if (!namePattern.test(body)) throw new Error(`${skillPath}: expected ${expectedName}`);
|
|
250
|
+
const renamed = body.replace(namePattern, `name: cadre-${workflow}`);
|
|
251
|
+
const frontmatterEnd = renamed.indexOf("\n---\n", 4);
|
|
252
|
+
if (frontmatterEnd === -1) throw new Error(`${skillPath}: invalid skill frontmatter`);
|
|
253
|
+
const insertionPoint = frontmatterEnd + "\n---\n".length;
|
|
254
|
+
const adapted = `${renamed.slice(0, insertionPoint)}
|
|
255
|
+
${ZED_COMPATIBILITY}
|
|
256
|
+
${renamed.slice(insertionPoint)}`;
|
|
257
|
+
writeFileSync(skillPath, adapted);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function expectedSkillLink(marketplaceRoot, workflow) {
|
|
261
|
+
return {
|
|
262
|
+
destination: join3(zedSkillsRoot(), `cadre-${workflow}`),
|
|
263
|
+
target: join3(zedAdapterRoot(marketplaceRoot), `cadre-${workflow}`)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function linkTarget(path) {
|
|
267
|
+
if (!pathExists(path) || !lstatSync(path).isSymbolicLink()) return null;
|
|
268
|
+
return resolve3(dirname2(path), readlinkSync(path));
|
|
269
|
+
}
|
|
270
|
+
function preflightZedSkillLinks(marketplaceRoot) {
|
|
271
|
+
for (const workflow of CADRE_WORKFLOWS) {
|
|
272
|
+
const link = expectedSkillLink(marketplaceRoot, workflow);
|
|
273
|
+
if (!pathExists(link.destination)) continue;
|
|
274
|
+
if (linkTarget(link.destination) !== link.target) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`${link.destination} already exists and is not owned by Cadre; move it before installing Zed support`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function installZedSkillLinks(marketplaceRoot) {
|
|
282
|
+
preflightZedSkillLinks(marketplaceRoot);
|
|
283
|
+
mkdirSync(zedSkillsRoot(), { recursive: true });
|
|
284
|
+
const installed = [];
|
|
285
|
+
for (const workflow of CADRE_WORKFLOWS) {
|
|
286
|
+
const link = expectedSkillLink(marketplaceRoot, workflow);
|
|
287
|
+
if (!pathExists(link.destination)) {
|
|
288
|
+
symlinkSync(link.target, link.destination, process.platform === "win32" ? "junction" : "dir");
|
|
289
|
+
}
|
|
290
|
+
installed.push(link.destination);
|
|
291
|
+
}
|
|
292
|
+
return installed;
|
|
293
|
+
}
|
|
294
|
+
function removeZedSkillLinks(marketplaceRoot) {
|
|
295
|
+
const removed = [];
|
|
296
|
+
const retained = [];
|
|
297
|
+
for (const workflow of CADRE_WORKFLOWS) {
|
|
298
|
+
const link = expectedSkillLink(marketplaceRoot, workflow);
|
|
299
|
+
if (!pathExists(link.destination)) continue;
|
|
300
|
+
if (linkTarget(link.destination) === link.target) {
|
|
301
|
+
unlinkSync(link.destination);
|
|
302
|
+
removed.push(link.destination);
|
|
303
|
+
} else {
|
|
304
|
+
retained.push(link.destination);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return { removed, retained };
|
|
308
|
+
}
|
|
309
|
+
|
|
188
310
|
// scripts/package-plugin.ts
|
|
189
|
-
var sourceRoot =
|
|
311
|
+
var sourceRoot = resolve4(dirname3(fileURLToPath2(import.meta.url)), "..");
|
|
190
312
|
var requiredEntries = [
|
|
191
313
|
"skills",
|
|
192
314
|
"templates",
|
|
@@ -198,11 +320,11 @@ var requiredEntries = [
|
|
|
198
320
|
];
|
|
199
321
|
var optionalEntries = ["hooks", "hooks.json", ".app.json", "assets", "commands", "agents"];
|
|
200
322
|
function readJson(path) {
|
|
201
|
-
return JSON.parse(
|
|
323
|
+
return JSON.parse(readFileSync3(path, "utf8"));
|
|
202
324
|
}
|
|
203
325
|
function writeJson(path, value) {
|
|
204
|
-
|
|
205
|
-
|
|
326
|
+
mkdirSync2(dirname3(path), { recursive: true });
|
|
327
|
+
writeFileSync2(path, `${JSON.stringify(value, null, 2)}
|
|
206
328
|
`);
|
|
207
329
|
}
|
|
208
330
|
function withCachebuster(version, product, cachebuster) {
|
|
@@ -214,36 +336,37 @@ function defaultCachebuster() {
|
|
|
214
336
|
}
|
|
215
337
|
function packagePluginMarketplace(outputRoot, requestedCachebuster = defaultCachebuster()) {
|
|
216
338
|
templateCatalog();
|
|
217
|
-
const targetRoot =
|
|
339
|
+
const targetRoot = resolve4(outputRoot);
|
|
218
340
|
const cachebuster = requestedCachebuster.trim();
|
|
219
341
|
if (!/^[0-9A-Za-z-]+$/.test(cachebuster)) {
|
|
220
342
|
throw new Error("cachebuster must contain only letters, digits, and hyphens");
|
|
221
343
|
}
|
|
222
|
-
const pluginRoot =
|
|
223
|
-
if (
|
|
224
|
-
|
|
344
|
+
const pluginRoot = join4(targetRoot, "plugins", "cadre");
|
|
345
|
+
if (existsSync3(pluginRoot)) throw new Error(`plugin output already exists: ${pluginRoot}`);
|
|
346
|
+
mkdirSync2(pluginRoot, { recursive: true });
|
|
225
347
|
for (const entry of requiredEntries) {
|
|
226
|
-
const source =
|
|
227
|
-
if (!
|
|
228
|
-
|
|
348
|
+
const source = join4(sourceRoot, entry);
|
|
349
|
+
if (!existsSync3(source)) throw new Error(`required plugin entry is missing: ${entry}`);
|
|
350
|
+
cpSync2(source, join4(pluginRoot, entry), { recursive: true });
|
|
229
351
|
}
|
|
230
352
|
for (const entry of optionalEntries) {
|
|
231
|
-
const source =
|
|
232
|
-
if (
|
|
353
|
+
const source = join4(sourceRoot, entry);
|
|
354
|
+
if (existsSync3(source)) cpSync2(source, join4(pluginRoot, entry), { recursive: true });
|
|
233
355
|
}
|
|
234
|
-
|
|
356
|
+
createZedSkillAdapters(pluginRoot);
|
|
357
|
+
const codexManifest = readJson(join4(sourceRoot, ".codex-plugin", "plugin.json"));
|
|
235
358
|
codexManifest.version = withCachebuster(codexManifest.version, "codex", cachebuster);
|
|
236
|
-
writeJson(
|
|
237
|
-
const claudeManifest = readJson(
|
|
359
|
+
writeJson(join4(pluginRoot, ".codex-plugin", "plugin.json"), codexManifest);
|
|
360
|
+
const claudeManifest = readJson(join4(sourceRoot, ".claude-plugin", "plugin.json"));
|
|
238
361
|
claudeManifest.version = withCachebuster(claudeManifest.version, "claude", cachebuster);
|
|
239
|
-
writeJson(
|
|
362
|
+
writeJson(join4(pluginRoot, ".claude-plugin", "plugin.json"), claudeManifest);
|
|
240
363
|
writeJson(
|
|
241
|
-
|
|
242
|
-
readJson(
|
|
364
|
+
join4(targetRoot, ".agents", "plugins", "marketplace.json"),
|
|
365
|
+
readJson(join4(sourceRoot, "marketplace", "codex.json"))
|
|
243
366
|
);
|
|
244
367
|
writeJson(
|
|
245
|
-
|
|
246
|
-
readJson(
|
|
368
|
+
join4(targetRoot, ".claude-plugin", "marketplace.json"),
|
|
369
|
+
readJson(join4(sourceRoot, "marketplace", "claude.json"))
|
|
247
370
|
);
|
|
248
371
|
return { targetRoot, pluginRoot, cachebuster };
|
|
249
372
|
}
|
|
@@ -1660,17 +1783,17 @@ function applyEdits(text, edits) {
|
|
|
1660
1783
|
// scripts/permissions.ts
|
|
1661
1784
|
import {
|
|
1662
1785
|
chmodSync,
|
|
1663
|
-
existsSync as
|
|
1664
|
-
lstatSync,
|
|
1665
|
-
mkdirSync as
|
|
1786
|
+
existsSync as existsSync4,
|
|
1787
|
+
lstatSync as lstatSync2,
|
|
1788
|
+
mkdirSync as mkdirSync3,
|
|
1666
1789
|
realpathSync,
|
|
1667
1790
|
renameSync,
|
|
1668
1791
|
statSync,
|
|
1669
|
-
unlinkSync,
|
|
1670
|
-
writeFileSync as
|
|
1671
|
-
readFileSync as
|
|
1792
|
+
unlinkSync as unlinkSync2,
|
|
1793
|
+
writeFileSync as writeFileSync3,
|
|
1794
|
+
readFileSync as readFileSync4
|
|
1672
1795
|
} from "node:fs";
|
|
1673
|
-
import { basename, dirname as
|
|
1796
|
+
import { basename, dirname as dirname4 } from "node:path";
|
|
1674
1797
|
|
|
1675
1798
|
// ../node_modules/.pnpm/smol-toml@1.7.1/node_modules/smol-toml/dist/date.js
|
|
1676
1799
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
@@ -2354,25 +2477,53 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2354
2477
|
return res;
|
|
2355
2478
|
}
|
|
2356
2479
|
|
|
2480
|
+
// src/mcp/tool-names.ts
|
|
2481
|
+
var CADRE_MCP_TOOLS = {
|
|
2482
|
+
workflowElicit: "workflow_elicit",
|
|
2483
|
+
templateGetMany: "template_get_many",
|
|
2484
|
+
styleguideResolve: "styleguide_resolve",
|
|
2485
|
+
projectStatus: "project_status",
|
|
2486
|
+
stateValidate: "state_validate",
|
|
2487
|
+
candidateStagePrepare: "candidate_stage_prepare",
|
|
2488
|
+
candidateInspect: "candidate_inspect",
|
|
2489
|
+
executionGraphValidate: "execution_graph_validate",
|
|
2490
|
+
reviewComplete: "review_complete",
|
|
2491
|
+
archiveBatchCandidate: "archive_batch_candidate",
|
|
2492
|
+
archiveBatchRecord: "archive_batch_record",
|
|
2493
|
+
executionStart: "execution_start",
|
|
2494
|
+
executionCheckpoint: "execution_checkpoint",
|
|
2495
|
+
executionStatus: "execution_status",
|
|
2496
|
+
executionFinish: "execution_finish",
|
|
2497
|
+
worktreeCreate: "worktree_create",
|
|
2498
|
+
integration: "integration",
|
|
2499
|
+
worktreeCleanup: "worktree_cleanup",
|
|
2500
|
+
projectInitCandidate: "project_init_candidate",
|
|
2501
|
+
setupRecordCommit: "setup_record_commit",
|
|
2502
|
+
setupRecordGitInitialized: "setup_record_git_initialized",
|
|
2503
|
+
tracksRender: "tracks_render"
|
|
2504
|
+
};
|
|
2505
|
+
var CADRE_MCP_TOOL_NAMES = Object.freeze(Object.values(CADRE_MCP_TOOLS));
|
|
2506
|
+
|
|
2357
2507
|
// scripts/permissions.ts
|
|
2358
2508
|
var CODEX_SECTION = '[plugins."cadre@cadre".mcp_servers.cadre]';
|
|
2359
2509
|
var CODEX_APPROVAL = 'default_tools_approval_mode = "approve"';
|
|
2360
2510
|
var CLAUDE_APPROVAL = "mcp__cadre__*";
|
|
2361
2511
|
var CLAUDE_SERVER_APPROVAL = "cadre";
|
|
2512
|
+
var ZED_MCP_PERMISSION_KEYS = CADRE_MCP_TOOL_NAMES.map((name) => `mcp:cadre:${name}`);
|
|
2362
2513
|
function isRecord(value) {
|
|
2363
2514
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2364
2515
|
}
|
|
2365
2516
|
function atomicWrite(path, content) {
|
|
2366
|
-
const effectivePath =
|
|
2367
|
-
const directory =
|
|
2368
|
-
|
|
2517
|
+
const effectivePath = existsSync4(path) && lstatSync2(path).isSymbolicLink() ? realpathSync(path) : path;
|
|
2518
|
+
const directory = dirname4(effectivePath);
|
|
2519
|
+
mkdirSync3(directory, { recursive: true });
|
|
2369
2520
|
const temporary = `${directory}/.${basename(effectivePath)}.cadre-${process.pid}-${Date.now()}`;
|
|
2370
2521
|
try {
|
|
2371
|
-
|
|
2372
|
-
if (
|
|
2522
|
+
writeFileSync3(temporary, content, { encoding: "utf8", flag: "wx" });
|
|
2523
|
+
if (existsSync4(effectivePath)) chmodSync(temporary, statSync(effectivePath).mode);
|
|
2373
2524
|
renameSync(temporary, effectivePath);
|
|
2374
2525
|
} finally {
|
|
2375
|
-
if (
|
|
2526
|
+
if (existsSync4(temporary)) unlinkSync2(temporary);
|
|
2376
2527
|
}
|
|
2377
2528
|
}
|
|
2378
2529
|
function cadreCodexPolicy(value) {
|
|
@@ -2385,7 +2536,7 @@ function cadreCodexPolicy(value) {
|
|
|
2385
2536
|
return isRecord(server) ? server : void 0;
|
|
2386
2537
|
}
|
|
2387
2538
|
function configureCodexMcpApproval(configPath) {
|
|
2388
|
-
const existing =
|
|
2539
|
+
const existing = existsSync4(configPath) ? readFileSync4(configPath, "utf8") : "";
|
|
2389
2540
|
let parsed;
|
|
2390
2541
|
try {
|
|
2391
2542
|
parsed = parse3(existing);
|
|
@@ -2459,7 +2610,7 @@ function deniesCadre(rule) {
|
|
|
2459
2610
|
return rule === "mcp__*" || rule === "mcp__cadre" || rule.startsWith("mcp__cadre__");
|
|
2460
2611
|
}
|
|
2461
2612
|
function configureClaudeMcpApproval(settingsPath) {
|
|
2462
|
-
const existing =
|
|
2613
|
+
const existing = existsSync4(settingsPath) ? readFileSync4(settingsPath, "utf8") : "{}\n";
|
|
2463
2614
|
const errors = [];
|
|
2464
2615
|
const parsed = parse2(existing, errors, { allowTrailingComma: true });
|
|
2465
2616
|
if (errors.length) {
|
|
@@ -2517,6 +2668,132 @@ function configureClaudeMcpApproval(settingsPath) {
|
|
|
2517
2668
|
`);
|
|
2518
2669
|
return { path: settingsPath, changed: true, rule: CLAUDE_APPROVAL };
|
|
2519
2670
|
}
|
|
2671
|
+
function parseJsoncSettings(settingsPath) {
|
|
2672
|
+
const existing = existsSync4(settingsPath) ? readFileSync4(settingsPath, "utf8") : "{}\n";
|
|
2673
|
+
const errors = [];
|
|
2674
|
+
const parsed = parse2(existing, errors, { allowTrailingComma: true });
|
|
2675
|
+
if (errors.length) {
|
|
2676
|
+
const detail = errors.map((error) => `${printParseErrorCode(error.error)} at ${error.offset}`).join(", ");
|
|
2677
|
+
throw new Error(`Cannot update invalid Zed settings ${settingsPath}: ${detail}`);
|
|
2678
|
+
}
|
|
2679
|
+
if (!isRecord(parsed)) throw new Error(`${settingsPath}: Zed settings root must be an object`);
|
|
2680
|
+
return { existing, root: parsed };
|
|
2681
|
+
}
|
|
2682
|
+
function assertRecordField(owner, field, settingsPath) {
|
|
2683
|
+
const value = owner[field];
|
|
2684
|
+
if (value === void 0) return {};
|
|
2685
|
+
if (!isRecord(value)) throw new Error(`${settingsPath}: ${field} must be an object`);
|
|
2686
|
+
return value;
|
|
2687
|
+
}
|
|
2688
|
+
function zedServerMatches(server, nodePath, mcpPath) {
|
|
2689
|
+
if (!isRecord(server) || server.command !== nodePath || !Array.isArray(server.args)) return false;
|
|
2690
|
+
return server.args.length === 1 && server.args[0] === mcpPath;
|
|
2691
|
+
}
|
|
2692
|
+
function zedServerTargetsMcp(server, mcpPath) {
|
|
2693
|
+
return isRecord(server) && Array.isArray(server.args) && server.args.length === 1 && server.args[0] === mcpPath;
|
|
2694
|
+
}
|
|
2695
|
+
function hasBlockingZedRule(rule, field) {
|
|
2696
|
+
const value = rule[field];
|
|
2697
|
+
return value !== void 0 && (!Array.isArray(value) || value.length > 0);
|
|
2698
|
+
}
|
|
2699
|
+
function configureZedCadre(settingsPath, nodePath, mcpPath, autoApproveMcp) {
|
|
2700
|
+
const { existing, root } = parseJsoncSettings(settingsPath);
|
|
2701
|
+
const contextServers = assertRecordField(root, "context_servers", settingsPath);
|
|
2702
|
+
const currentServer = contextServers.cadre;
|
|
2703
|
+
if (currentServer !== void 0 && !zedServerMatches(currentServer, nodePath, mcpPath)) {
|
|
2704
|
+
throw new Error(
|
|
2705
|
+
`${settingsPath}: context_servers.cadre is not the Cadre-managed server; remove or rename it before installation`
|
|
2706
|
+
);
|
|
2707
|
+
}
|
|
2708
|
+
if (isRecord(currentServer) && currentServer.enabled === false) {
|
|
2709
|
+
throw new Error(`${settingsPath}: context_servers.cadre is disabled; enable it before installation`);
|
|
2710
|
+
}
|
|
2711
|
+
const agent = assertRecordField(root, "agent", settingsPath);
|
|
2712
|
+
const toolPermissions = assertRecordField(agent, "tool_permissions", settingsPath);
|
|
2713
|
+
const tools = assertRecordField(toolPermissions, "tools", settingsPath);
|
|
2714
|
+
if (autoApproveMcp) {
|
|
2715
|
+
for (const key of ZED_MCP_PERMISSION_KEYS) {
|
|
2716
|
+
const current = tools[key];
|
|
2717
|
+
if (current === void 0) continue;
|
|
2718
|
+
if (!isRecord(current)) throw new Error(`${settingsPath}: agent.tool_permissions.tools.${key} must be an object`);
|
|
2719
|
+
if (hasBlockingZedRule(current, "always_deny") || hasBlockingZedRule(current, "always_confirm")) {
|
|
2720
|
+
throw new Error(
|
|
2721
|
+
`${settingsPath}: ${key} has a higher-precedence deny/confirm rule; remove it or rerun with --prompt-mcp-tools`
|
|
2722
|
+
);
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
const formattingOptions = { insertSpaces: true, tabSize: 2, eol: "\n" };
|
|
2727
|
+
const serverChanged = currentServer === void 0;
|
|
2728
|
+
let proposed = existing;
|
|
2729
|
+
if (serverChanged) {
|
|
2730
|
+
proposed = applyEdits(proposed, modify(
|
|
2731
|
+
proposed,
|
|
2732
|
+
["context_servers", "cadre"],
|
|
2733
|
+
{ command: nodePath, args: [mcpPath], env: {} },
|
|
2734
|
+
{ formattingOptions }
|
|
2735
|
+
));
|
|
2736
|
+
}
|
|
2737
|
+
let permissionsChanged = false;
|
|
2738
|
+
if (autoApproveMcp) {
|
|
2739
|
+
for (const key of ZED_MCP_PERMISSION_KEYS) {
|
|
2740
|
+
const current = isRecord(tools[key]) ? tools[key] : {};
|
|
2741
|
+
if (current.default === "allow") continue;
|
|
2742
|
+
proposed = applyEdits(proposed, modify(
|
|
2743
|
+
proposed,
|
|
2744
|
+
["agent", "tool_permissions", "tools", key, "default"],
|
|
2745
|
+
"allow",
|
|
2746
|
+
{ formattingOptions }
|
|
2747
|
+
));
|
|
2748
|
+
permissionsChanged = true;
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
const verificationErrors = [];
|
|
2752
|
+
const verified = parse2(proposed, verificationErrors, { allowTrailingComma: true });
|
|
2753
|
+
const verifiedRoot = isRecord(verified) ? verified : {};
|
|
2754
|
+
const verifiedServers = isRecord(verifiedRoot.context_servers) ? verifiedRoot.context_servers : {};
|
|
2755
|
+
if (verificationErrors.length || !zedServerMatches(verifiedServers.cadre, nodePath, mcpPath)) {
|
|
2756
|
+
throw new Error("Generated Zed settings did not contain the Cadre MCP server");
|
|
2757
|
+
}
|
|
2758
|
+
if (autoApproveMcp) {
|
|
2759
|
+
const verifiedAgent = isRecord(verifiedRoot.agent) ? verifiedRoot.agent : {};
|
|
2760
|
+
const verifiedPermissions = isRecord(verifiedAgent.tool_permissions) ? verifiedAgent.tool_permissions : {};
|
|
2761
|
+
const verifiedTools = isRecord(verifiedPermissions.tools) ? verifiedPermissions.tools : {};
|
|
2762
|
+
if (ZED_MCP_PERMISSION_KEYS.some((key) => !isRecord(verifiedTools[key]) || verifiedTools[key].default !== "allow")) {
|
|
2763
|
+
throw new Error("Generated Zed settings did not contain every exact Cadre MCP approval rule");
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
const changed = serverChanged || permissionsChanged;
|
|
2767
|
+
if (changed) atomicWrite(settingsPath, proposed.endsWith("\n") ? proposed : `${proposed}
|
|
2768
|
+
`);
|
|
2769
|
+
return {
|
|
2770
|
+
path: settingsPath,
|
|
2771
|
+
changed,
|
|
2772
|
+
serverChanged,
|
|
2773
|
+
permissionsChanged,
|
|
2774
|
+
rule: `${ZED_MCP_PERMISSION_KEYS.length} exact Cadre MCP tools`
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
function removeZedCadreServer(settingsPath, mcpPath) {
|
|
2778
|
+
if (!existsSync4(settingsPath)) return { changed: false, retainedConflict: false };
|
|
2779
|
+
const { existing, root } = parseJsoncSettings(settingsPath);
|
|
2780
|
+
const contextServers = assertRecordField(root, "context_servers", settingsPath);
|
|
2781
|
+
const currentServer = contextServers.cadre;
|
|
2782
|
+
if (currentServer === void 0) return { changed: false, retainedConflict: false };
|
|
2783
|
+
if (!zedServerTargetsMcp(currentServer, mcpPath)) {
|
|
2784
|
+
return { changed: false, retainedConflict: true };
|
|
2785
|
+
}
|
|
2786
|
+
const formattingOptions = { insertSpaces: true, tabSize: 2, eol: "\n" };
|
|
2787
|
+
const proposed = applyEdits(existing, modify(
|
|
2788
|
+
existing,
|
|
2789
|
+
["context_servers", "cadre"],
|
|
2790
|
+
void 0,
|
|
2791
|
+
{ formattingOptions }
|
|
2792
|
+
));
|
|
2793
|
+
atomicWrite(settingsPath, proposed.endsWith("\n") ? proposed : `${proposed}
|
|
2794
|
+
`);
|
|
2795
|
+
return { changed: true, retainedConflict: false };
|
|
2796
|
+
}
|
|
2520
2797
|
|
|
2521
2798
|
// scripts/install.ts
|
|
2522
2799
|
var marketplaceName = "cadre";
|
|
@@ -2537,7 +2814,7 @@ function parseInstallOptions(args) {
|
|
|
2537
2814
|
options.selection = parseClient(optionValue(args, index, arg));
|
|
2538
2815
|
index += 1;
|
|
2539
2816
|
} else if (arg === "--marketplace-root") {
|
|
2540
|
-
options.marketplaceRoot =
|
|
2817
|
+
options.marketplaceRoot = resolve5(optionValue(args, index, arg));
|
|
2541
2818
|
index += 1;
|
|
2542
2819
|
} else if (arg === "--home") {
|
|
2543
2820
|
options.marketplaceRoot = marketplaceFromHome(optionValue(args, index, arg));
|
|
@@ -2574,7 +2851,7 @@ function claudeMarketplaces() {
|
|
|
2574
2851
|
function replaceMarketplaceIfNeeded(client, existing, targetRoot, allowReplacement) {
|
|
2575
2852
|
if (!existing) return false;
|
|
2576
2853
|
const currentPath = marketplacePath(existing);
|
|
2577
|
-
if (currentPath &&
|
|
2854
|
+
if (currentPath && resolve5(currentPath) === targetRoot) return true;
|
|
2578
2855
|
if (!allowReplacement) {
|
|
2579
2856
|
throw new Error(
|
|
2580
2857
|
`${client} already has a ${marketplaceName} marketplace at ${currentPath ?? "an unknown path"}; review it and rerun with --replace-marketplace`
|
|
@@ -2594,8 +2871,8 @@ function installCodex(targetRoot, allowReplacement, autoApproveMcp) {
|
|
|
2594
2871
|
throw new Error(`Codex did not report ${pluginId} as installed and enabled`);
|
|
2595
2872
|
}
|
|
2596
2873
|
if (autoApproveMcp) {
|
|
2597
|
-
const codexRoot = process.env.CODEX_HOME ?
|
|
2598
|
-
const update = configureCodexMcpApproval(
|
|
2874
|
+
const codexRoot = process.env.CODEX_HOME ? resolve5(process.env.CODEX_HOME) : join5(homedir3(), ".codex");
|
|
2875
|
+
const update = configureCodexMcpApproval(join5(codexRoot, "config.toml"));
|
|
2599
2876
|
process.stdout.write(`${update.changed ? "Added" : "Retained"} Codex Cadre MCP approval in ${update.path}
|
|
2600
2877
|
`);
|
|
2601
2878
|
}
|
|
@@ -2616,31 +2893,41 @@ function installClaude(targetRoot, allowReplacement, autoApproveMcp) {
|
|
|
2616
2893
|
throw new Error(`Claude did not report ${pluginId} as installed and enabled`);
|
|
2617
2894
|
}
|
|
2618
2895
|
if (autoApproveMcp) {
|
|
2619
|
-
const claudeRoot = process.env.CLAUDE_HOME ?? process.env.CLAUDE_CONFIG_DIR ??
|
|
2620
|
-
const update = configureClaudeMcpApproval(
|
|
2896
|
+
const claudeRoot = process.env.CLAUDE_HOME ?? process.env.CLAUDE_CONFIG_DIR ?? join5(homedir3(), ".claude");
|
|
2897
|
+
const update = configureClaudeMcpApproval(join5(resolve5(claudeRoot), "settings.json"));
|
|
2621
2898
|
process.stdout.write(`${update.changed ? "Added" : "Retained"} Claude Cadre MCP approval in ${update.path}
|
|
2622
2899
|
`);
|
|
2623
2900
|
}
|
|
2624
2901
|
}
|
|
2902
|
+
function installZed(targetRoot, autoApproveMcp) {
|
|
2903
|
+
const pluginRoot = join5(targetRoot, "plugins", "cadre");
|
|
2904
|
+
const mcpPath = join5(pluginRoot, "dist", "cadre-mcp.mjs");
|
|
2905
|
+
const links = installZedSkillLinks(targetRoot);
|
|
2906
|
+
const update = configureZedCadre(zedSettingsPath(), resolve5(process.execPath), mcpPath, autoApproveMcp);
|
|
2907
|
+
process.stdout.write(`${update.changed ? "Updated" : "Retained"} Zed Cadre MCP configuration in ${update.path}
|
|
2908
|
+
`);
|
|
2909
|
+
process.stdout.write(`Installed ${links.length} Cadre workflow skill links for Zed Agent.
|
|
2910
|
+
`);
|
|
2911
|
+
}
|
|
2625
2912
|
function assertSafeTarget(targetRoot) {
|
|
2626
|
-
if (targetRoot === parse4(targetRoot).root || targetRoot ===
|
|
2913
|
+
if (targetRoot === parse4(targetRoot).root || targetRoot === resolve5(homedir3())) {
|
|
2627
2914
|
throw new Error(`refusing to use broad marketplace root ${targetRoot}`);
|
|
2628
2915
|
}
|
|
2629
2916
|
if (basename2(targetRoot) !== "cadre") throw new Error("marketplace root must end in a directory named cadre");
|
|
2630
2917
|
}
|
|
2631
2918
|
function prepareMarketplace(targetRoot, cachebuster) {
|
|
2632
|
-
const parent =
|
|
2633
|
-
|
|
2634
|
-
const stagingRoot = mkdtempSync(
|
|
2919
|
+
const parent = dirname5(targetRoot);
|
|
2920
|
+
mkdirSync4(parent, { recursive: true });
|
|
2921
|
+
const stagingRoot = mkdtempSync(join5(parent, ".cadre-staging-"));
|
|
2635
2922
|
const packaged = packagePluginMarketplace(stagingRoot, cachebuster ?? void 0);
|
|
2636
2923
|
let backupRoot = null;
|
|
2637
|
-
if (
|
|
2924
|
+
if (existsSync5(targetRoot)) {
|
|
2638
2925
|
const catalogs = [
|
|
2639
|
-
|
|
2640
|
-
|
|
2926
|
+
join5(targetRoot, ".agents", "plugins", "marketplace.json"),
|
|
2927
|
+
join5(targetRoot, ".claude-plugin", "marketplace.json")
|
|
2641
2928
|
];
|
|
2642
|
-
const owned = catalogs.every((path) =>
|
|
2643
|
-
if (!owned) throw new Error(`${targetRoot} exists but is not a Cadre
|
|
2929
|
+
const owned = catalogs.every((path) => existsSync5(path) && JSON.parse(readFileSync5(path, "utf8")).name === marketplaceName);
|
|
2930
|
+
if (!owned) throw new Error(`${targetRoot} exists but is not a Cadre marketplace payload`);
|
|
2644
2931
|
backupRoot = `${targetRoot}.backup-${Date.now()}`;
|
|
2645
2932
|
renameSync2(targetRoot, backupRoot);
|
|
2646
2933
|
}
|
|
@@ -2652,7 +2939,7 @@ function runInstall(args) {
|
|
|
2652
2939
|
assertSafeTarget(options.marketplaceRoot);
|
|
2653
2940
|
const clients = selectedClients(options.selection);
|
|
2654
2941
|
if (!options.prepareOnly && clients.length === 0) {
|
|
2655
|
-
throw new Error("No supported client detected. Install Codex or
|
|
2942
|
+
throw new Error("No supported client detected. Install Codex, Claude, or Zed, or pass --target codex|claude|zed|all");
|
|
2656
2943
|
}
|
|
2657
2944
|
for (const client of clients) {
|
|
2658
2945
|
if (!commandExists(client) && !options.prepareOnly && !options.dryRun) {
|
|
@@ -2662,10 +2949,14 @@ function runInstall(args) {
|
|
|
2662
2949
|
if (options.dryRun) {
|
|
2663
2950
|
process.stdout.write(`Would prepare Cadre marketplace at ${options.marketplaceRoot}
|
|
2664
2951
|
`);
|
|
2665
|
-
for (const client of clients)
|
|
2952
|
+
for (const client of clients) {
|
|
2953
|
+
const identity = client === "zed" ? "Cadre skills and MCP server" : pluginId;
|
|
2954
|
+
process.stdout.write(`Would install ${identity} for ${client} at user scope
|
|
2666
2955
|
`);
|
|
2956
|
+
}
|
|
2667
2957
|
return 0;
|
|
2668
2958
|
}
|
|
2959
|
+
if (!options.prepareOnly && clients.includes("zed")) preflightZedSkillLinks(options.marketplaceRoot);
|
|
2669
2960
|
const backupRoot = prepareMarketplace(options.marketplaceRoot, options.cachebuster);
|
|
2670
2961
|
process.stdout.write(`Prepared Cadre plugin marketplace at ${options.marketplaceRoot}
|
|
2671
2962
|
`);
|
|
@@ -2675,17 +2966,18 @@ function runInstall(args) {
|
|
|
2675
2966
|
const autoApproveMcp = !options.promptMcpTools;
|
|
2676
2967
|
for (const client of clients) {
|
|
2677
2968
|
if (client === "codex") installCodex(options.marketplaceRoot, options.replaceMarketplace, autoApproveMcp);
|
|
2678
|
-
else installClaude(options.marketplaceRoot, options.replaceMarketplace, autoApproveMcp);
|
|
2969
|
+
else if (client === "claude") installClaude(options.marketplaceRoot, options.replaceMarketplace, autoApproveMcp);
|
|
2970
|
+
else installZed(options.marketplaceRoot, autoApproveMcp);
|
|
2679
2971
|
}
|
|
2680
|
-
process.stdout.write(`Installed
|
|
2972
|
+
process.stdout.write(`Installed Cadre for ${clients.join(", ")}.
|
|
2681
2973
|
`);
|
|
2682
|
-
process.stdout.write("Start a new
|
|
2974
|
+
process.stdout.write("Start a new client conversation; in Claude Code, run /reload-plugins first.\n");
|
|
2683
2975
|
return 0;
|
|
2684
2976
|
}
|
|
2685
2977
|
|
|
2686
2978
|
// scripts/uninstall.ts
|
|
2687
|
-
import { existsSync as
|
|
2688
|
-
import { basename as basename3, dirname as
|
|
2979
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, readdirSync as readdirSync2, rmSync as rmSync2 } from "node:fs";
|
|
2980
|
+
import { basename as basename3, dirname as dirname6, join as join6, resolve as resolve6 } from "node:path";
|
|
2689
2981
|
var marketplaceName2 = "cadre";
|
|
2690
2982
|
var pluginId2 = "cadre@cadre";
|
|
2691
2983
|
function parseUninstallOptions(args) {
|
|
@@ -2700,7 +2992,7 @@ function parseUninstallOptions(args) {
|
|
|
2700
2992
|
options.selection = parseClient(optionValue(args, index, arg));
|
|
2701
2993
|
index += 1;
|
|
2702
2994
|
} else if (arg === "--marketplace-root") {
|
|
2703
|
-
options.marketplaceRoot =
|
|
2995
|
+
options.marketplaceRoot = resolve6(optionValue(args, index, arg));
|
|
2704
2996
|
index += 1;
|
|
2705
2997
|
} else if (arg === "--home") {
|
|
2706
2998
|
options.marketplaceRoot = marketplaceFromHome(optionValue(args, index, arg));
|
|
@@ -2720,42 +3012,53 @@ function selectedClients2(selection) {
|
|
|
2720
3012
|
return [selection];
|
|
2721
3013
|
}
|
|
2722
3014
|
function ownedMarketplace(root) {
|
|
2723
|
-
if (!
|
|
3015
|
+
if (!existsSync6(root)) return false;
|
|
2724
3016
|
const catalogs = [
|
|
2725
|
-
|
|
2726
|
-
|
|
3017
|
+
join6(root, ".agents", "plugins", "marketplace.json"),
|
|
3018
|
+
join6(root, ".claude-plugin", "marketplace.json")
|
|
2727
3019
|
];
|
|
2728
3020
|
return catalogs.every((path) => {
|
|
2729
|
-
if (!
|
|
3021
|
+
if (!existsSync6(path)) return false;
|
|
2730
3022
|
try {
|
|
2731
|
-
return JSON.parse(
|
|
3023
|
+
return JSON.parse(readFileSync6(path, "utf8")).name === marketplaceName2;
|
|
2732
3024
|
} catch {
|
|
2733
3025
|
return false;
|
|
2734
3026
|
}
|
|
2735
3027
|
});
|
|
2736
3028
|
}
|
|
2737
|
-
function uninstallClient(client) {
|
|
3029
|
+
function uninstallClient(client, marketplaceRoot) {
|
|
2738
3030
|
if (client === "codex") {
|
|
2739
3031
|
runCommand("codex", ["plugin", "remove", pluginId2, "--json"]);
|
|
2740
3032
|
runCommand("codex", ["plugin", "marketplace", "remove", marketplaceName2]);
|
|
2741
|
-
} else {
|
|
3033
|
+
} else if (client === "claude") {
|
|
2742
3034
|
runCommand("claude", ["plugin", "uninstall", "--scope", "user", "--yes", pluginId2]);
|
|
2743
3035
|
runCommand("claude", ["plugin", "marketplace", "remove", "--scope", "user", marketplaceName2]);
|
|
3036
|
+
} else {
|
|
3037
|
+
const skills = removeZedSkillLinks(marketplaceRoot);
|
|
3038
|
+
const mcpPath = join6(marketplaceRoot, "plugins", "cadre", "dist", "cadre-mcp.mjs");
|
|
3039
|
+
const settings = removeZedCadreServer(zedSettingsPath(), mcpPath);
|
|
3040
|
+
if (skills.retained.length) {
|
|
3041
|
+
process.stderr.write(`Retained non-Cadre Zed skill paths: ${skills.retained.join(", ")}
|
|
3042
|
+
`);
|
|
3043
|
+
}
|
|
3044
|
+
if (settings.retainedConflict) {
|
|
3045
|
+
process.stderr.write("Retained Zed context_servers.cadre because it no longer matches the Cadre installation.\n");
|
|
3046
|
+
}
|
|
2744
3047
|
}
|
|
2745
3048
|
}
|
|
2746
3049
|
function removeOwnedMarketplaces(root) {
|
|
2747
3050
|
const removed = [];
|
|
2748
3051
|
const candidates = [root];
|
|
2749
|
-
const parent =
|
|
3052
|
+
const parent = dirname6(root);
|
|
2750
3053
|
const prefix = `${basename3(root)}.backup-`;
|
|
2751
|
-
if (
|
|
3054
|
+
if (existsSync6(parent)) {
|
|
2752
3055
|
for (const entry of readdirSync2(parent)) {
|
|
2753
|
-
if (entry.startsWith(prefix)) candidates.push(
|
|
3056
|
+
if (entry.startsWith(prefix)) candidates.push(join6(parent, entry));
|
|
2754
3057
|
}
|
|
2755
3058
|
}
|
|
2756
3059
|
for (const candidate of candidates) {
|
|
2757
3060
|
if (!ownedMarketplace(candidate)) continue;
|
|
2758
|
-
|
|
3061
|
+
rmSync2(candidate, { recursive: true, force: true });
|
|
2759
3062
|
removed.push(candidate);
|
|
2760
3063
|
}
|
|
2761
3064
|
return removed;
|
|
@@ -2764,22 +3067,25 @@ function runUninstall(args) {
|
|
|
2764
3067
|
const options = parseUninstallOptions(args);
|
|
2765
3068
|
const clients = selectedClients2(options.selection);
|
|
2766
3069
|
if (options.dryRun) {
|
|
2767
|
-
for (const client of clients)
|
|
3070
|
+
for (const client of clients) {
|
|
3071
|
+
const identity = client === "zed" ? "Cadre skills and MCP server" : pluginId2;
|
|
3072
|
+
process.stdout.write(`Would uninstall ${identity} from ${client} at user scope
|
|
2768
3073
|
`);
|
|
3074
|
+
}
|
|
2769
3075
|
if (options.selection === "all") process.stdout.write(`Would remove owned marketplace: ${options.marketplaceRoot}
|
|
2770
3076
|
`);
|
|
2771
3077
|
return 0;
|
|
2772
3078
|
}
|
|
2773
3079
|
let failed = false;
|
|
2774
3080
|
for (const client of clients) {
|
|
2775
|
-
if (!commandExists(client)) {
|
|
3081
|
+
if (client !== "zed" && !commandExists(client)) {
|
|
2776
3082
|
process.stderr.write(`${client} is not available; continuing local cleanup.
|
|
2777
3083
|
`);
|
|
2778
3084
|
continue;
|
|
2779
3085
|
}
|
|
2780
3086
|
try {
|
|
2781
|
-
uninstallClient(client);
|
|
2782
|
-
process.stdout.write(`Uninstalled
|
|
3087
|
+
uninstallClient(client, options.marketplaceRoot);
|
|
3088
|
+
process.stdout.write(`Uninstalled Cadre from ${client}.
|
|
2783
3089
|
`);
|
|
2784
3090
|
} catch (error) {
|
|
2785
3091
|
failed = true;
|
|
@@ -2792,7 +3098,7 @@ function runUninstall(args) {
|
|
|
2792
3098
|
if (removed.length) process.stdout.write(`Removed ${removed.join(", ")}
|
|
2793
3099
|
`);
|
|
2794
3100
|
else process.stdout.write("No owned Cadre marketplace files found to remove.\n");
|
|
2795
|
-
} else if (
|
|
3101
|
+
} else if (existsSync6(options.marketplaceRoot)) {
|
|
2796
3102
|
process.stdout.write(`Retained shared marketplace at ${options.marketplaceRoot} for other clients.
|
|
2797
3103
|
`);
|
|
2798
3104
|
}
|
|
@@ -2805,15 +3111,15 @@ function usage() {
|
|
|
2805
3111
|
"Cadre CLI",
|
|
2806
3112
|
"",
|
|
2807
3113
|
"Usage:",
|
|
2808
|
-
" cadre-ai install [--target auto|codex|claude|all] [--scope user] [--dry-run] [--replace-marketplace]",
|
|
2809
|
-
" cadre-ai uninstall [--target codex|claude|all] [--scope user] [--dry-run]",
|
|
3114
|
+
" cadre-ai install [--target auto|codex|claude|zed|all] [--scope user] [--dry-run] [--replace-marketplace]",
|
|
3115
|
+
" cadre-ai uninstall [--target codex|claude|zed|all] [--scope user] [--dry-run]",
|
|
2810
3116
|
" cadre-ai doctor",
|
|
2811
3117
|
" cadre-ai --version",
|
|
2812
3118
|
" cadre-ai help"
|
|
2813
3119
|
].join("\n");
|
|
2814
3120
|
}
|
|
2815
3121
|
function packageRoot() {
|
|
2816
|
-
return
|
|
3122
|
+
return resolve7(dirname7(fileURLToPath3(import.meta.url)), "..");
|
|
2817
3123
|
}
|
|
2818
3124
|
function runDoctor() {
|
|
2819
3125
|
const root = packageRoot();
|
|
@@ -2825,11 +3131,11 @@ function runDoctor() {
|
|
|
2825
3131
|
"skills",
|
|
2826
3132
|
"templates"
|
|
2827
3133
|
];
|
|
2828
|
-
const missing = required.filter((entry) => !
|
|
2829
|
-
const packageJson =
|
|
3134
|
+
const missing = required.filter((entry) => !existsSync7(join7(root, entry)));
|
|
3135
|
+
const packageJson = join7(root, "package.json");
|
|
2830
3136
|
let identity = `cadre-ai@${CADRE_RUNTIME_VERSION}`;
|
|
2831
|
-
if (
|
|
2832
|
-
const metadata = JSON.parse(
|
|
3137
|
+
if (existsSync7(packageJson)) {
|
|
3138
|
+
const metadata = JSON.parse(readFileSync7(packageJson, "utf8"));
|
|
2833
3139
|
identity = `${metadata.name ?? "cadre-ai"}@${metadata.version ?? CADRE_RUNTIME_VERSION}`;
|
|
2834
3140
|
}
|
|
2835
3141
|
process.stdout.write(`${identity}
|