@zivis/cli 0.1.0-alpha.35 → 0.1.0-alpha.37
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.
|
@@ -50,38 +50,46 @@ export function registerMcpCommands(program) {
|
|
|
50
50
|
.command("install")
|
|
51
51
|
.description("write MCP config for a supported IDE client (run from your project root)")
|
|
52
52
|
.option("--client <name>", `target client (${KNOWN_CLIENTS.join(" | ")})`)
|
|
53
|
-
.option("--
|
|
53
|
+
.option("--package <name>", "which ZIVIS MCP package to register: 'appsec' (default, @zivis/mcp) or 'builder' (@zivis/mcp-builder)", "appsec")
|
|
54
|
+
.option("--with-guidance", "also write IDE guidance files so the AI knows when to suggest security checks (no prompt). Only applies to the appsec package; builder ships its own cadence block via zivis_setup.")
|
|
54
55
|
.option("--no-guidance", "skip writing IDE guidance files (no prompt)")
|
|
55
56
|
.action(async (opts) => {
|
|
56
57
|
const client = opts.client?.toLowerCase();
|
|
58
|
+
const pkgArg = opts.package?.toLowerCase() ?? "appsec";
|
|
57
59
|
if (!client) {
|
|
58
60
|
console.error("Specify a client with --client <name>:");
|
|
59
61
|
for (const c of KNOWN_CLIENTS)
|
|
60
62
|
console.error(` zivis mcp install --client ${c}`);
|
|
61
63
|
process.exit(1);
|
|
62
64
|
}
|
|
65
|
+
if (pkgArg !== "appsec" && pkgArg !== "builder") {
|
|
66
|
+
console.error(`Unknown --package value: ${pkgArg}`);
|
|
67
|
+
console.error("Supported: appsec, builder");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
const pkg = pkgArg;
|
|
63
71
|
try {
|
|
64
72
|
switch (client) {
|
|
65
73
|
case "cursor":
|
|
66
|
-
await setupCursorWorkspace();
|
|
74
|
+
await setupCursorWorkspace(pkg);
|
|
67
75
|
break;
|
|
68
76
|
case "claude-code":
|
|
69
|
-
printClaudeCodeManual();
|
|
77
|
+
printClaudeCodeManual(pkg);
|
|
70
78
|
break;
|
|
71
79
|
case "claude-code-cli":
|
|
72
|
-
await setupClaudeCodeCli();
|
|
80
|
+
await setupClaudeCodeCli(pkg);
|
|
73
81
|
break;
|
|
74
82
|
case "cline":
|
|
75
|
-
await setupCline();
|
|
83
|
+
await setupCline(pkg);
|
|
76
84
|
break;
|
|
77
85
|
case "windsurf":
|
|
78
|
-
await setupWindsurf();
|
|
86
|
+
await setupWindsurf(pkg);
|
|
79
87
|
break;
|
|
80
88
|
case "vscode-copilot":
|
|
81
|
-
await setupVsCodeCopilot();
|
|
89
|
+
await setupVsCodeCopilot(pkg);
|
|
82
90
|
break;
|
|
83
91
|
case "vscode-claude":
|
|
84
|
-
await setupVsCodeClaude();
|
|
92
|
+
await setupVsCodeClaude(pkg);
|
|
85
93
|
break;
|
|
86
94
|
default:
|
|
87
95
|
console.error(`Unknown client: ${client}`);
|
|
@@ -95,6 +103,8 @@ export function registerMcpCommands(program) {
|
|
|
95
103
|
}
|
|
96
104
|
if (client === "claude-code")
|
|
97
105
|
return;
|
|
106
|
+
if (pkg === "builder")
|
|
107
|
+
return;
|
|
98
108
|
const guidanceClient = toGuidanceClient(client);
|
|
99
109
|
if (!guidanceClient)
|
|
100
110
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type Package = "appsec" | "builder";
|
|
1
2
|
export type GuidanceClient = "cursor" | "claude-code-cli" | "vscode-copilot" | "vscode-claude" | "cline" | "windsurf";
|
|
2
3
|
export interface GuidanceOptions {
|
|
3
4
|
cwd: string;
|
|
@@ -5,11 +6,11 @@ export interface GuidanceOptions {
|
|
|
5
6
|
}
|
|
6
7
|
export declare function writeGuidance(opts: GuidanceOptions): string[];
|
|
7
8
|
export declare function detectIdesInRepo(cwd: string): GuidanceClient[];
|
|
8
|
-
export declare function setupCursor(): Promise<void>;
|
|
9
|
-
export declare function setupCursorWorkspace(): Promise<void>;
|
|
10
|
-
export declare function setupVsCodeCopilot(): Promise<void>;
|
|
11
|
-
export declare function setupVsCodeClaude(): Promise<void>;
|
|
12
|
-
export declare function setupClaudeCodeCli(): Promise<void>;
|
|
13
|
-
export declare function setupCline(): Promise<void>;
|
|
14
|
-
export declare function setupWindsurf(): Promise<void>;
|
|
15
|
-
export declare function printClaudeCodeManual(): void;
|
|
9
|
+
export declare function setupCursor(pkg?: Package): Promise<void>;
|
|
10
|
+
export declare function setupCursorWorkspace(pkg?: Package): Promise<void>;
|
|
11
|
+
export declare function setupVsCodeCopilot(pkg?: Package): Promise<void>;
|
|
12
|
+
export declare function setupVsCodeClaude(pkg?: Package): Promise<void>;
|
|
13
|
+
export declare function setupClaudeCodeCli(pkg?: Package): Promise<void>;
|
|
14
|
+
export declare function setupCline(pkg?: Package): Promise<void>;
|
|
15
|
+
export declare function setupWindsurf(pkg?: Package): Promise<void>;
|
|
16
|
+
export declare function printClaudeCodeManual(pkg?: Package): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
|
|
3
|
+
function getServerName(pkg) {
|
|
4
|
+
return pkg === "builder" ? "zivis-builder" : "zivis";
|
|
5
|
+
}
|
|
4
6
|
function appendBlock(filePath, blockKey, content) {
|
|
5
7
|
const begin = `<!-- BEGIN ZIVIS:${blockKey} -->`;
|
|
6
8
|
const end = `<!-- END ZIVIS:${blockKey} -->`;
|
|
@@ -262,7 +264,18 @@ export function detectIdesInRepo(cwd) {
|
|
|
262
264
|
}
|
|
263
265
|
return found;
|
|
264
266
|
}
|
|
265
|
-
function buildServerConfig(workspacePath, extra) {
|
|
267
|
+
function buildServerConfig(pkg, workspacePath, extra) {
|
|
268
|
+
if (pkg === "builder") {
|
|
269
|
+
const args = ["-y", "@zivis/mcp-builder", "serve"];
|
|
270
|
+
if (workspacePath) {
|
|
271
|
+
args.push("--workspace", workspacePath);
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
...extra,
|
|
275
|
+
command: "npx",
|
|
276
|
+
args,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
266
279
|
const args = ["mcp", "serve"];
|
|
267
280
|
if (workspacePath) {
|
|
268
281
|
args.push("--workspace", workspacePath);
|
|
@@ -294,22 +307,22 @@ async function updateMcpConfig(configPath, serverName, serverConfig, rootKey) {
|
|
|
294
307
|
servers[serverName] = serverConfig;
|
|
295
308
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
296
309
|
}
|
|
297
|
-
export async function setupCursor() {
|
|
310
|
+
export async function setupCursor(pkg = "appsec") {
|
|
298
311
|
const homeDir = process.env.HOME || "";
|
|
299
312
|
const configPath = path.join(homeDir, ".cursor", "mcp.json");
|
|
300
|
-
await updateMcpConfig(configPath,
|
|
313
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg), "mcpServers");
|
|
301
314
|
console.log(`✓ Cursor global MCP config updated: ${configPath}`);
|
|
302
315
|
console.log(" Restart Cursor for changes to take effect");
|
|
303
316
|
}
|
|
304
|
-
export async function setupCursorWorkspace() {
|
|
317
|
+
export async function setupCursorWorkspace(pkg = "appsec") {
|
|
305
318
|
const workspacePath = process.cwd();
|
|
306
319
|
const configPath = path.join(workspacePath, ".cursor", "mcp.json");
|
|
307
|
-
await updateMcpConfig(configPath,
|
|
320
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
308
321
|
console.log(`✓ Cursor workspace MCP config updated: ${configPath}`);
|
|
309
322
|
console.log(` Workspace: ${workspacePath}`);
|
|
310
323
|
console.log(" Reload Cursor for changes to take effect");
|
|
311
324
|
}
|
|
312
|
-
export async function setupVsCodeCopilot() {
|
|
325
|
+
export async function setupVsCodeCopilot(pkg = "appsec") {
|
|
313
326
|
const workspacePath = process.cwd();
|
|
314
327
|
const localConfigPath = path.join(workspacePath, ".vscode", "mcp.json");
|
|
315
328
|
const globalConfigPath = path.join(process.env.HOME || "", ".vscode", "mcp.json");
|
|
@@ -318,20 +331,20 @@ export async function setupVsCodeCopilot() {
|
|
|
318
331
|
if (!exists && fs.existsSync(globalConfigPath)) {
|
|
319
332
|
configPath = globalConfigPath;
|
|
320
333
|
}
|
|
321
|
-
await updateMcpConfig(configPath,
|
|
334
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath, { type: "stdio" }), "servers");
|
|
322
335
|
console.log(`✓ VS Code (GitHub Copilot) MCP config updated: ${configPath}`);
|
|
323
336
|
console.log(` Workspace: ${workspacePath}`);
|
|
324
337
|
console.log(" Restart VS Code for changes to take effect");
|
|
325
338
|
}
|
|
326
|
-
export async function setupVsCodeClaude() {
|
|
339
|
+
export async function setupVsCodeClaude(pkg = "appsec") {
|
|
327
340
|
const workspacePath = process.cwd();
|
|
328
341
|
const configPath = path.join(workspacePath, ".vscode", "mcp.json");
|
|
329
|
-
await updateMcpConfig(configPath,
|
|
342
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
330
343
|
console.log(`✓ VS Code (Claude Code) MCP config updated: ${configPath}`);
|
|
331
344
|
console.log(` Workspace: ${workspacePath}`);
|
|
332
345
|
console.log(" Restart VS Code for changes to take effect");
|
|
333
346
|
}
|
|
334
|
-
export async function setupClaudeCodeCli() {
|
|
347
|
+
export async function setupClaudeCodeCli(pkg = "appsec") {
|
|
335
348
|
const homeDir = process.env.HOME || "";
|
|
336
349
|
const configPath = path.join(homeDir, ".claude.json");
|
|
337
350
|
const workspacePath = process.cwd();
|
|
@@ -344,11 +357,7 @@ export async function setupClaudeCodeCli() {
|
|
|
344
357
|
config.projects ??= {};
|
|
345
358
|
config.projects[workspacePath] ??= {};
|
|
346
359
|
config.projects[workspacePath].mcpServers ??= {};
|
|
347
|
-
config.projects[workspacePath].mcpServers[
|
|
348
|
-
type: "stdio",
|
|
349
|
-
command: "zivis",
|
|
350
|
-
args: ["mcp", "serve", "--workspace", workspacePath],
|
|
351
|
-
};
|
|
360
|
+
config.projects[workspacePath].mcpServers[getServerName(pkg)] = buildServerConfig(pkg, workspacePath, { type: "stdio" });
|
|
352
361
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
353
362
|
console.log("✓ Claude Code CLI MCP config updated: ~/.claude.json");
|
|
354
363
|
console.log(` Workspace: ${workspacePath}`);
|
|
@@ -358,31 +367,31 @@ export async function setupClaudeCodeCli() {
|
|
|
358
367
|
console.log(` WARNING: Failed to update ~/.claude.json: ${err instanceof Error ? err.message : err}`);
|
|
359
368
|
}
|
|
360
369
|
}
|
|
361
|
-
export async function setupCline() {
|
|
370
|
+
export async function setupCline(pkg = "appsec") {
|
|
362
371
|
const workspacePath = process.cwd();
|
|
363
372
|
const homeDir = process.env.HOME || "";
|
|
364
373
|
const configPath = process.platform === "darwin"
|
|
365
374
|
? path.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json")
|
|
366
375
|
: path.join(homeDir, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json");
|
|
367
|
-
await updateMcpConfig(configPath,
|
|
376
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
368
377
|
console.log(`✓ Cline MCP config updated: ${configPath}`);
|
|
369
378
|
console.log(` Workspace: ${workspacePath}`);
|
|
370
379
|
console.log(" Restart VS Code for changes to take effect");
|
|
371
380
|
}
|
|
372
|
-
export async function setupWindsurf() {
|
|
381
|
+
export async function setupWindsurf(pkg = "appsec") {
|
|
373
382
|
const workspacePath = process.cwd();
|
|
374
383
|
const homeDir = process.env.HOME || "";
|
|
375
384
|
const configPath = path.join(homeDir, ".codeium", "windsurf", "mcp_config.json");
|
|
376
|
-
await updateMcpConfig(configPath,
|
|
385
|
+
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
377
386
|
console.log(`✓ Windsurf MCP config updated: ${configPath}`);
|
|
378
387
|
console.log(` Workspace: ${workspacePath}`);
|
|
379
388
|
console.log(" Restart Windsurf for changes to take effect");
|
|
380
389
|
}
|
|
381
|
-
export function printClaudeCodeManual() {
|
|
390
|
+
export function printClaudeCodeManual(pkg = "appsec") {
|
|
382
391
|
const workspacePath = process.cwd();
|
|
383
392
|
const serverConfig = {
|
|
384
393
|
mcpServers: {
|
|
385
|
-
[
|
|
394
|
+
[getServerName(pkg)]: buildServerConfig(pkg, workspacePath),
|
|
386
395
|
},
|
|
387
396
|
};
|
|
388
397
|
console.log("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zivis/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.37",
|
|
4
4
|
"description": "ZIVIS CLI — threat modeling, scans, and MCP server for IDE integration",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://zivis.ai",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ignore": "^7.0.5",
|
|
33
33
|
"open": "^10.1.0",
|
|
34
34
|
"web-tree-sitter": "^0.26.8",
|
|
35
|
-
"@zivis/mcp": "0.1.0-alpha.
|
|
35
|
+
"@zivis/mcp": "0.1.0-alpha.26"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/js-yaml": "^4.0.9",
|