cadre-ai 1.1.0 → 1.1.2
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/package.json +1 -1
- package/scripts/cadre-cli.js +231 -41
- package/scripts/mcp/cadre-server.js +1 -1
package/package.json
CHANGED
package/scripts/cadre-cli.js
CHANGED
|
@@ -27,12 +27,196 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
|
|
29
29
|
// src/cli/install.ts
|
|
30
|
+
var import_node_fs2 = __toESM(require("node:fs"));
|
|
31
|
+
var import_node_os2 = __toESM(require("node:os"));
|
|
32
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
33
|
+
var import_node_child_process = require("node:child_process");
|
|
34
|
+
|
|
35
|
+
// src/cli/client-approvals.ts
|
|
30
36
|
var import_node_fs = __toESM(require("node:fs"));
|
|
31
37
|
var import_node_os = __toESM(require("node:os"));
|
|
32
38
|
var import_node_path = __toESM(require("node:path"));
|
|
33
|
-
var
|
|
39
|
+
var CADRE_MCP_TOOLS = [
|
|
40
|
+
"cadre_resource",
|
|
41
|
+
"cadre_workflow",
|
|
42
|
+
"cadre_project",
|
|
43
|
+
"cadre_status",
|
|
44
|
+
"cadre_track",
|
|
45
|
+
"cadre_parallel",
|
|
46
|
+
"cadre_mutate",
|
|
47
|
+
"cadre_complete_task",
|
|
48
|
+
"cadre_job",
|
|
49
|
+
"cadre_review",
|
|
50
|
+
"cadre_intel",
|
|
51
|
+
"cadre_artifact"
|
|
52
|
+
];
|
|
53
|
+
var CLAUDE_CADRE_ALLOW_RULES = [
|
|
54
|
+
"mcp__plugin_cadre_cadre__*",
|
|
55
|
+
"mcp__cadre__*"
|
|
56
|
+
];
|
|
57
|
+
function approvalConfigPath(target) {
|
|
58
|
+
if (target === "codex") {
|
|
59
|
+
return import_node_path.default.join(process.env.CODEX_HOME || import_node_path.default.join(import_node_os.default.homedir(), ".codex"), "config.toml");
|
|
60
|
+
}
|
|
61
|
+
return import_node_path.default.join(process.env.CLAUDE_HOME || process.env.CLAUDE_CONFIG_DIR || import_node_path.default.join(import_node_os.default.homedir(), ".claude"), "settings.json");
|
|
62
|
+
}
|
|
63
|
+
function bootstrapClientApprovals(target) {
|
|
64
|
+
return target === "codex" ? bootstrapCodexApprovals() : bootstrapClaudeApprovals();
|
|
65
|
+
}
|
|
66
|
+
function checkClientApprovals(target) {
|
|
67
|
+
return target === "codex" ? checkCodexApprovals() : checkClaudeApprovals();
|
|
68
|
+
}
|
|
69
|
+
function approvalSummary(target) {
|
|
70
|
+
const file = approvalConfigPath(target);
|
|
71
|
+
if (target === "codex") return `Cadre codex MCP tool approvals: ${file}`;
|
|
72
|
+
return `Cadre claude MCP tool approvals: ${file}`;
|
|
73
|
+
}
|
|
74
|
+
function codexToolSection(tool) {
|
|
75
|
+
return `[plugins."cadre@cadre".mcp_servers.cadre.tools.${tool}]`;
|
|
76
|
+
}
|
|
77
|
+
function codexApprovalSnippet(tool) {
|
|
78
|
+
return `${codexToolSection(tool)}
|
|
79
|
+
approval_mode = "approve"
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
function bootstrapCodexApprovals() {
|
|
83
|
+
const file = approvalConfigPath("codex");
|
|
84
|
+
let text = "";
|
|
85
|
+
if (import_node_fs.default.existsSync(file)) text = import_node_fs.default.readFileSync(file, "utf8");
|
|
86
|
+
const before = text;
|
|
87
|
+
for (const tool of CADRE_MCP_TOOLS) text = upsertCodexApproval(text, tool);
|
|
88
|
+
if (text !== before) {
|
|
89
|
+
import_node_fs.default.mkdirSync(import_node_path.default.dirname(file), { recursive: true });
|
|
90
|
+
import_node_fs.default.writeFileSync(file, text);
|
|
91
|
+
}
|
|
92
|
+
return { ok: true, target: "codex", path: file, changed: text !== before, configured: true, rules: [...CADRE_MCP_TOOLS] };
|
|
93
|
+
}
|
|
94
|
+
function checkCodexApprovals() {
|
|
95
|
+
const file = approvalConfigPath("codex");
|
|
96
|
+
if (!import_node_fs.default.existsSync(file)) {
|
|
97
|
+
return { ok: false, target: "codex", path: file, changed: false, configured: false, rules: [...CADRE_MCP_TOOLS], error: `missing ${file}` };
|
|
98
|
+
}
|
|
99
|
+
const text = import_node_fs.default.readFileSync(file, "utf8");
|
|
100
|
+
const missing = CADRE_MCP_TOOLS.filter((tool) => !codexToolApproved(text, tool));
|
|
101
|
+
const result = {
|
|
102
|
+
ok: missing.length === 0,
|
|
103
|
+
target: "codex",
|
|
104
|
+
path: file,
|
|
105
|
+
changed: false,
|
|
106
|
+
configured: missing.length === 0,
|
|
107
|
+
rules: missing.length === 0 ? [...CADRE_MCP_TOOLS] : missing
|
|
108
|
+
};
|
|
109
|
+
if (missing.length > 0) result.error = `missing Codex Cadre tool approvals: ${missing.join(", ")}`;
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
function upsertCodexApproval(text, tool) {
|
|
113
|
+
let next = text.endsWith("\n") || text.length === 0 ? text : `${text}
|
|
114
|
+
`;
|
|
115
|
+
const header = codexToolSection(tool);
|
|
116
|
+
const lines = next.split("\n");
|
|
117
|
+
const start = lines.findIndex((line) => line.trim() === header);
|
|
118
|
+
if (start === -1) {
|
|
119
|
+
const spacer = next.trim().length > 0 && !next.endsWith("\n\n") ? "\n" : "";
|
|
120
|
+
return `${next}${spacer}${codexApprovalSnippet(tool)}`;
|
|
121
|
+
}
|
|
122
|
+
let end = lines.length;
|
|
123
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
124
|
+
if (lines[index]?.trim().startsWith("[")) {
|
|
125
|
+
end = index;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (let index = start + 1; index < end; index += 1) {
|
|
130
|
+
if (/^\s*approval_mode\s*=/.test(lines[index] || "")) {
|
|
131
|
+
lines[index] = 'approval_mode = "approve"';
|
|
132
|
+
return lines.join("\n");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
lines.splice(start + 1, 0, 'approval_mode = "approve"');
|
|
136
|
+
return lines.join("\n");
|
|
137
|
+
}
|
|
138
|
+
function codexToolApproved(text, tool) {
|
|
139
|
+
const lines = text.split(/\r?\n/);
|
|
140
|
+
const header = codexToolSection(tool);
|
|
141
|
+
const start = lines.findIndex((line) => line.trim() === header);
|
|
142
|
+
if (start === -1) return false;
|
|
143
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
144
|
+
const line = lines[index]?.trim() || "";
|
|
145
|
+
if (line.startsWith("[")) return false;
|
|
146
|
+
if (line === 'approval_mode = "approve"' || line === "approval_mode = 'approve'") return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
function bootstrapClaudeApprovals() {
|
|
151
|
+
const file = approvalConfigPath("claude");
|
|
152
|
+
const parsed = readClaudeSettings(file);
|
|
153
|
+
if (!parsed.ok) return parsed.result;
|
|
154
|
+
const settings = parsed.settings;
|
|
155
|
+
const permissions = isRecord(settings.permissions) ? settings.permissions : {};
|
|
156
|
+
const currentAllow = Array.isArray(permissions.allow) ? permissions.allow.filter((item) => typeof item === "string") : [];
|
|
157
|
+
const nextAllow = [...currentAllow];
|
|
158
|
+
for (const rule of CLAUDE_CADRE_ALLOW_RULES) {
|
|
159
|
+
if (!nextAllow.includes(rule)) nextAllow.push(rule);
|
|
160
|
+
}
|
|
161
|
+
const changed = nextAllow.length !== currentAllow.length || !isRecord(settings.permissions) || !Array.isArray(permissions.allow);
|
|
162
|
+
if (changed) {
|
|
163
|
+
settings.permissions = { ...permissions, allow: nextAllow };
|
|
164
|
+
import_node_fs.default.mkdirSync(import_node_path.default.dirname(file), { recursive: true });
|
|
165
|
+
import_node_fs.default.writeFileSync(file, `${JSON.stringify(settings, null, 2)}
|
|
166
|
+
`);
|
|
167
|
+
}
|
|
168
|
+
return { ok: true, target: "claude", path: file, changed, configured: true, rules: [...CLAUDE_CADRE_ALLOW_RULES] };
|
|
169
|
+
}
|
|
170
|
+
function checkClaudeApprovals() {
|
|
171
|
+
const file = approvalConfigPath("claude");
|
|
172
|
+
const parsed = readClaudeSettings(file);
|
|
173
|
+
if (!parsed.ok) return parsed.result;
|
|
174
|
+
const permissions = isRecord(parsed.settings.permissions) ? parsed.settings.permissions : {};
|
|
175
|
+
const allow = Array.isArray(permissions.allow) ? permissions.allow.filter((item) => typeof item === "string") : [];
|
|
176
|
+
const missing = CLAUDE_CADRE_ALLOW_RULES.filter((rule) => !allow.includes(rule));
|
|
177
|
+
const result = {
|
|
178
|
+
ok: missing.length === 0,
|
|
179
|
+
target: "claude",
|
|
180
|
+
path: file,
|
|
181
|
+
changed: false,
|
|
182
|
+
configured: missing.length === 0,
|
|
183
|
+
rules: missing.length === 0 ? [...CLAUDE_CADRE_ALLOW_RULES] : missing
|
|
184
|
+
};
|
|
185
|
+
if (missing.length > 0) result.error = `missing Claude Cadre tool allow rules: ${missing.join(", ")}`;
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
function readClaudeSettings(file) {
|
|
189
|
+
if (!import_node_fs.default.existsSync(file)) return { ok: true, settings: {} };
|
|
190
|
+
try {
|
|
191
|
+
const parsed = JSON.parse(import_node_fs.default.readFileSync(file, "utf8"));
|
|
192
|
+
if (isRecord(parsed)) return { ok: true, settings: parsed };
|
|
193
|
+
return {
|
|
194
|
+
ok: false,
|
|
195
|
+
result: { ok: false, target: "claude", path: file, changed: false, configured: false, rules: [...CLAUDE_CADRE_ALLOW_RULES], error: `${file} must contain a JSON object` }
|
|
196
|
+
};
|
|
197
|
+
} catch (error) {
|
|
198
|
+
return {
|
|
199
|
+
ok: false,
|
|
200
|
+
result: {
|
|
201
|
+
ok: false,
|
|
202
|
+
target: "claude",
|
|
203
|
+
path: file,
|
|
204
|
+
changed: false,
|
|
205
|
+
configured: false,
|
|
206
|
+
rules: [...CLAUDE_CADRE_ALLOW_RULES],
|
|
207
|
+
error: error instanceof Error ? error.message : String(error)
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function isRecord(value) {
|
|
213
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/cli/install.ts
|
|
34
217
|
var PACKAGE_PLUGIN_NAME = "cadre";
|
|
35
218
|
var PACKAGE_DISPLAY_NAME = "Cadre";
|
|
219
|
+
var MARKETPLACE_PLUGIN_SOURCE = "./plugins/cadre";
|
|
36
220
|
function usage() {
|
|
37
221
|
return [
|
|
38
222
|
"Cadre CLI",
|
|
@@ -51,7 +235,7 @@ function parseInstall(argv) {
|
|
|
51
235
|
check: false,
|
|
52
236
|
force: false,
|
|
53
237
|
yes: false,
|
|
54
|
-
cadreHome: process.env.CADRE_HOME ||
|
|
238
|
+
cadreHome: process.env.CADRE_HOME || import_node_path2.default.join(import_node_os2.default.homedir(), ".cadre")
|
|
55
239
|
};
|
|
56
240
|
for (let index = 0; index < argv.length; index += 1) {
|
|
57
241
|
const arg = argv[index];
|
|
@@ -72,7 +256,7 @@ function parseInstall(argv) {
|
|
|
72
256
|
} else if (arg === "--home") {
|
|
73
257
|
const value = argv[index + 1];
|
|
74
258
|
if (!value) throw new Error("--home requires a path");
|
|
75
|
-
parsed.cadreHome =
|
|
259
|
+
parsed.cadreHome = import_node_path2.default.resolve(value);
|
|
76
260
|
index += 1;
|
|
77
261
|
} else {
|
|
78
262
|
throw new Error(`Unknown install option: ${arg}`);
|
|
@@ -81,19 +265,15 @@ function parseInstall(argv) {
|
|
|
81
265
|
return parsed;
|
|
82
266
|
}
|
|
83
267
|
function runtimePaths() {
|
|
84
|
-
const runtimeRoot =
|
|
268
|
+
const runtimeRoot = import_node_path2.default.resolve(__dirname, "..");
|
|
85
269
|
return {
|
|
86
270
|
runtimeRoot,
|
|
87
271
|
nodePath: process.execPath,
|
|
88
|
-
mcpServer:
|
|
272
|
+
mcpServer: import_node_path2.default.join(runtimeRoot, "scripts", "mcp", "cadre-server.js")
|
|
89
273
|
};
|
|
90
274
|
}
|
|
91
275
|
function commandExists(command) {
|
|
92
|
-
const result =
|
|
93
|
-
encoding: "utf8",
|
|
94
|
-
shell: process.platform !== "win32",
|
|
95
|
-
stdio: "ignore"
|
|
96
|
-
});
|
|
276
|
+
const result = process.platform === "win32" ? (0, import_node_child_process.spawnSync)("where", [command], { stdio: "ignore" }) : (0, import_node_child_process.spawnSync)("which", [command], { stdio: "ignore" });
|
|
97
277
|
return result.status === 0;
|
|
98
278
|
}
|
|
99
279
|
function selectedTargets(options) {
|
|
@@ -102,17 +282,16 @@ function selectedTargets(options) {
|
|
|
102
282
|
return ["codex", "claude"].filter((target) => commandExists(target));
|
|
103
283
|
}
|
|
104
284
|
function targetPaths(home, target) {
|
|
105
|
-
const
|
|
106
|
-
const marketplaceRoot = import_node_path.default.join(home, "marketplaces", target);
|
|
285
|
+
const marketplaceRoot = import_node_path2.default.join(home, "marketplaces", target);
|
|
107
286
|
return {
|
|
108
|
-
pluginRoot,
|
|
287
|
+
pluginRoot: import_node_path2.default.join(marketplaceRoot, "plugins", PACKAGE_PLUGIN_NAME),
|
|
109
288
|
marketplaceRoot,
|
|
110
|
-
marketplaceFile: target === "codex" ?
|
|
289
|
+
marketplaceFile: target === "codex" ? import_node_path2.default.join(marketplaceRoot, ".agents", "plugins", "marketplace.json") : import_node_path2.default.join(marketplaceRoot, ".claude-plugin", "marketplace.json")
|
|
111
290
|
};
|
|
112
291
|
}
|
|
113
292
|
function readPackageMetadata(runtimeRoot) {
|
|
114
293
|
try {
|
|
115
|
-
const json = JSON.parse(
|
|
294
|
+
const json = JSON.parse(import_node_fs2.default.readFileSync(import_node_path2.default.join(runtimeRoot, "package.json"), "utf8"));
|
|
116
295
|
return {
|
|
117
296
|
version: typeof json.version === "string" ? json.version : "0.0.0",
|
|
118
297
|
description: typeof json.description === "string" ? json.description : "MCP-first Cadre workflows.",
|
|
@@ -172,7 +351,7 @@ function mcpConfig(runtime) {
|
|
|
172
351
|
}
|
|
173
352
|
};
|
|
174
353
|
}
|
|
175
|
-
function marketplace(target,
|
|
354
|
+
function marketplace(target, runtime) {
|
|
176
355
|
const metadata = readPackageMetadata(runtime.runtimeRoot);
|
|
177
356
|
if (target === "codex") {
|
|
178
357
|
return {
|
|
@@ -180,7 +359,7 @@ function marketplace(target, pluginRoot, runtime) {
|
|
|
180
359
|
interface: { displayName: PACKAGE_DISPLAY_NAME },
|
|
181
360
|
plugins: [{
|
|
182
361
|
name: PACKAGE_PLUGIN_NAME,
|
|
183
|
-
source: { source: "local", path:
|
|
362
|
+
source: { source: "local", path: MARKETPLACE_PLUGIN_SOURCE },
|
|
184
363
|
policy: { installation: "AVAILABLE", authentication: "ON_INSTALL" },
|
|
185
364
|
category: "Productivity"
|
|
186
365
|
}]
|
|
@@ -192,7 +371,7 @@ function marketplace(target, pluginRoot, runtime) {
|
|
|
192
371
|
description: "Cadre MCP-first workflows for Claude Code.",
|
|
193
372
|
plugins: [{
|
|
194
373
|
name: PACKAGE_PLUGIN_NAME,
|
|
195
|
-
source:
|
|
374
|
+
source: MARKETPLACE_PLUGIN_SOURCE,
|
|
196
375
|
description: metadata.description,
|
|
197
376
|
version: metadata.version,
|
|
198
377
|
author: { name: "Vishal Kumar" },
|
|
@@ -202,26 +381,26 @@ function marketplace(target, pluginRoot, runtime) {
|
|
|
202
381
|
};
|
|
203
382
|
}
|
|
204
383
|
function writeJson(file, value) {
|
|
205
|
-
|
|
206
|
-
|
|
384
|
+
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(file), { recursive: true });
|
|
385
|
+
import_node_fs2.default.writeFileSync(file, `${JSON.stringify(value, null, 2)}
|
|
207
386
|
`);
|
|
208
387
|
}
|
|
209
388
|
function writeText(file, text) {
|
|
210
|
-
|
|
211
|
-
|
|
389
|
+
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(file), { recursive: true });
|
|
390
|
+
import_node_fs2.default.writeFileSync(file, text.endsWith("\n") ? text : `${text}
|
|
212
391
|
`);
|
|
213
392
|
}
|
|
214
393
|
function writeThinPlugin(target, paths, runtime, skillShim) {
|
|
215
|
-
|
|
216
|
-
writeText(
|
|
394
|
+
import_node_fs2.default.rmSync(paths.pluginRoot, { recursive: true, force: true });
|
|
395
|
+
writeText(import_node_path2.default.join(paths.pluginRoot, "skills", "cadre", "SKILL.md"), skillShim);
|
|
217
396
|
if (target === "codex") {
|
|
218
|
-
writeJson(
|
|
219
|
-
writeJson(
|
|
397
|
+
writeJson(import_node_path2.default.join(paths.pluginRoot, ".codex-plugin", "plugin.json"), pluginManifest(target, runtime));
|
|
398
|
+
writeJson(import_node_path2.default.join(paths.pluginRoot, ".mcp.json"), mcpConfig(runtime));
|
|
220
399
|
} else {
|
|
221
|
-
writeJson(
|
|
222
|
-
writeJson(
|
|
400
|
+
writeJson(import_node_path2.default.join(paths.pluginRoot, ".claude-plugin", "plugin.json"), pluginManifest(target, runtime));
|
|
401
|
+
writeJson(import_node_path2.default.join(paths.pluginRoot, "mcp-config.json"), mcpConfig(runtime));
|
|
223
402
|
}
|
|
224
|
-
writeJson(paths.marketplaceFile, marketplace(target,
|
|
403
|
+
writeJson(paths.marketplaceFile, marketplace(target, runtime));
|
|
225
404
|
}
|
|
226
405
|
function installCommands(target, paths, scope) {
|
|
227
406
|
if (target === "codex") {
|
|
@@ -232,7 +411,8 @@ function installCommands(target, paths, scope) {
|
|
|
232
411
|
}
|
|
233
412
|
return [
|
|
234
413
|
{ command: "claude", args: ["plugin", "marketplace", "add", "--scope", scope, paths.marketplaceRoot] },
|
|
235
|
-
{ command: "claude", args: ["plugin", "install", "--scope", scope, "cadre@cadre"] }
|
|
414
|
+
{ command: "claude", args: ["plugin", "install", "--scope", scope, "cadre@cadre"] },
|
|
415
|
+
{ command: "claude", args: ["plugin", "update", "--scope", scope, "cadre@cadre"] }
|
|
236
416
|
];
|
|
237
417
|
}
|
|
238
418
|
function runCommand(plan) {
|
|
@@ -240,11 +420,11 @@ function runCommand(plan) {
|
|
|
240
420
|
return { ok: result.status === 0, status: result.status, stderr: result.stderr || "" };
|
|
241
421
|
}
|
|
242
422
|
function assertNoThinPluginPayload(paths) {
|
|
243
|
-
const forbidden = ["assets", "agents", "scripts"].filter((name) =>
|
|
423
|
+
const forbidden = ["assets", "agents", "scripts"].filter((name) => import_node_fs2.default.existsSync(import_node_path2.default.join(paths.pluginRoot, name)));
|
|
244
424
|
return forbidden.map((name) => `${paths.pluginRoot}/${name}`);
|
|
245
425
|
}
|
|
246
426
|
function pingMcp(runtime) {
|
|
247
|
-
if (!
|
|
427
|
+
if (!import_node_fs2.default.existsSync(runtime.mcpServer)) return { ok: false, reason: `missing MCP server: ${runtime.mcpServer}` };
|
|
248
428
|
const request = {
|
|
249
429
|
jsonrpc: "2.0",
|
|
250
430
|
id: 1,
|
|
@@ -273,15 +453,15 @@ function pingMcp(runtime) {
|
|
|
273
453
|
}
|
|
274
454
|
function checkTarget(target, paths, runtime) {
|
|
275
455
|
const errors = [];
|
|
276
|
-
const skill =
|
|
277
|
-
if (!
|
|
278
|
-
const manifest = target === "codex" ?
|
|
279
|
-
const mcp = target === "codex" ?
|
|
280
|
-
if (!
|
|
281
|
-
if (!
|
|
456
|
+
const skill = import_node_path2.default.join(paths.pluginRoot, "skills", "cadre", "SKILL.md");
|
|
457
|
+
if (!import_node_fs2.default.existsSync(skill)) errors.push(`missing ${skill}`);
|
|
458
|
+
const manifest = target === "codex" ? import_node_path2.default.join(paths.pluginRoot, ".codex-plugin", "plugin.json") : import_node_path2.default.join(paths.pluginRoot, ".claude-plugin", "plugin.json");
|
|
459
|
+
const mcp = target === "codex" ? import_node_path2.default.join(paths.pluginRoot, ".mcp.json") : import_node_path2.default.join(paths.pluginRoot, "mcp-config.json");
|
|
460
|
+
if (!import_node_fs2.default.existsSync(manifest)) errors.push(`missing ${manifest}`);
|
|
461
|
+
if (!import_node_fs2.default.existsSync(mcp)) errors.push(`missing ${mcp}`);
|
|
282
462
|
errors.push(...assertNoThinPluginPayload(paths).map((entry) => `thin plugin contains forbidden payload ${entry}`));
|
|
283
|
-
if (
|
|
284
|
-
const config = JSON.parse(
|
|
463
|
+
if (import_node_fs2.default.existsSync(mcp)) {
|
|
464
|
+
const config = JSON.parse(import_node_fs2.default.readFileSync(mcp, "utf8"));
|
|
285
465
|
const server = config.mcpServers?.cadre;
|
|
286
466
|
if (server?.command !== runtime.nodePath) errors.push(`${mcp} does not point at the current Node runtime`);
|
|
287
467
|
if (server?.args?.[0] !== runtime.mcpServer) errors.push(`${mcp} does not point at ${runtime.mcpServer}`);
|
|
@@ -317,10 +497,18 @@ function runInstall(argv, context) {
|
|
|
317
497
|
const commands = installCommands(target, paths, options.scope);
|
|
318
498
|
if (options.dryRun) {
|
|
319
499
|
printPlan(target, paths, commands);
|
|
500
|
+
process.stdout.write(`Would configure: ${approvalSummary(target)}
|
|
501
|
+
`);
|
|
320
502
|
continue;
|
|
321
503
|
}
|
|
322
504
|
if (!options.check) writeThinPlugin(target, paths, runtime, context.skillShim);
|
|
323
505
|
const errors = checkTarget(target, paths, runtime);
|
|
506
|
+
if (!options.check) {
|
|
507
|
+
const approvals = bootstrapClientApprovals(target);
|
|
508
|
+
if (!approvals.ok) errors.push(`${target} approval bootstrap failed: ${approvals.error || approvals.path}`);
|
|
509
|
+
}
|
|
510
|
+
const approvalCheck = checkClientApprovals(target);
|
|
511
|
+
if (!approvalCheck.ok) errors.push(`${target} approval check failed: ${approvalCheck.error || approvalCheck.path}`);
|
|
324
512
|
if (errors.length > 0) {
|
|
325
513
|
ok = false;
|
|
326
514
|
for (const error of errors) process.stderr.write(`${error}
|
|
@@ -329,6 +517,8 @@ function runInstall(argv, context) {
|
|
|
329
517
|
}
|
|
330
518
|
if (options.check) {
|
|
331
519
|
process.stdout.write(`Cadre ${target} plugin is installed and points at ${runtime.mcpServer}
|
|
520
|
+
`);
|
|
521
|
+
process.stdout.write(`Cadre ${target} MCP tool approvals are configured in ${approvalCheck.path}
|
|
332
522
|
`);
|
|
333
523
|
continue;
|
|
334
524
|
}
|
|
@@ -346,7 +536,7 @@ function runInstall(argv, context) {
|
|
|
346
536
|
`);
|
|
347
537
|
}
|
|
348
538
|
}
|
|
349
|
-
if (ok) process.stdout.write(`Installed Cadre ${target} plugin through ${paths.marketplaceRoot}
|
|
539
|
+
if (ok) process.stdout.write(`Installed Cadre ${target} plugin through ${paths.marketplaceRoot}; MCP tool approvals configured in ${approvalCheck.path}
|
|
350
540
|
`);
|
|
351
541
|
}
|
|
352
542
|
return ok ? 0 : 1;
|