@zivis/cli 0.1.0-alpha.39 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/app/index.d.ts +8 -0
- package/dist/commands/app/index.js +14 -2
- package/dist/commands/app/index.js.map +1 -0
- package/dist/commands/auth/index.js +2 -19
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/init.d.ts +0 -1
- package/dist/commands/auth/init.js +73 -245
- package/dist/commands/auth/init.js.map +1 -0
- package/dist/commands/auth/login.d.ts +0 -1
- package/dist/commands/auth/login.js +9 -34
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.js +7 -19
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/sessions.js +4 -7
- package/dist/commands/auth/sessions.js.map +1 -0
- package/dist/commands/auth/status.js +12 -33
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/credits/index.js +3 -2
- package/dist/commands/credits/index.js.map +1 -0
- package/dist/commands/mcp/index.js +14 -81
- package/dist/commands/mcp/index.js.map +1 -0
- package/dist/commands/open/index.d.ts +8 -0
- package/dist/commands/open/index.js +11 -0
- package/dist/commands/open/index.js.map +1 -0
- package/dist/commands/scan/index.js +8 -2
- package/dist/commands/scan/index.js.map +1 -0
- package/dist/commands/target/index.js +3 -0
- package/dist/commands/target/index.js.map +1 -0
- package/dist/commands/tm/index.js +10 -3
- package/dist/commands/tm/index.js.map +1 -0
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -0
- package/dist/internal/extractor/adapters/go/index.d.ts +4 -0
- package/dist/internal/extractor/adapters/go/index.js +6 -0
- package/dist/internal/extractor/adapters/go/index.js.map +1 -0
- package/dist/internal/extractor/adapters/go/manifest.d.ts +17 -0
- package/dist/internal/extractor/adapters/go/manifest.js +25 -19
- package/dist/internal/extractor/adapters/go/manifest.js.map +1 -0
- package/dist/internal/extractor/adapters/go/parser.d.ts +4 -0
- package/dist/internal/extractor/adapters/go/parser.js +5 -0
- package/dist/internal/extractor/adapters/go/parser.js.map +1 -0
- package/dist/internal/extractor/adapters/go/scanner.d.ts +20 -0
- package/dist/internal/extractor/adapters/go/scanner.js +43 -0
- package/dist/internal/extractor/adapters/go/scanner.js.map +1 -0
- package/dist/internal/extractor/adapters/python/index.d.ts +3 -0
- package/dist/internal/extractor/adapters/python/index.js +4 -0
- package/dist/internal/extractor/adapters/python/index.js.map +1 -0
- package/dist/internal/extractor/adapters/python/manifest.d.ts +8 -0
- package/dist/internal/extractor/adapters/python/manifest.js +18 -21
- package/dist/internal/extractor/adapters/python/manifest.js.map +1 -0
- package/dist/internal/extractor/adapters/python/parser.d.ts +3 -0
- package/dist/internal/extractor/adapters/python/parser.js +4 -0
- package/dist/internal/extractor/adapters/python/parser.js.map +1 -0
- package/dist/internal/extractor/adapters/python/scanner.d.ts +18 -0
- package/dist/internal/extractor/adapters/python/scanner.js +54 -1
- package/dist/internal/extractor/adapters/python/scanner.js.map +1 -0
- package/dist/internal/extractor/adapters/typescript/index.d.ts +7 -0
- package/dist/internal/extractor/adapters/typescript/index.js +21 -1
- package/dist/internal/extractor/adapters/typescript/index.js.map +1 -0
- package/dist/internal/extractor/adapters/typescript/manifest.d.ts +14 -0
- package/dist/internal/extractor/adapters/typescript/manifest.js +17 -26
- package/dist/internal/extractor/adapters/typescript/manifest.js.map +1 -0
- package/dist/internal/extractor/adapters/typescript/parser.d.ts +8 -0
- package/dist/internal/extractor/adapters/typescript/parser.js +9 -0
- package/dist/internal/extractor/adapters/typescript/parser.js.map +1 -0
- package/dist/internal/extractor/adapters/typescript/scanner.d.ts +24 -0
- package/dist/internal/extractor/adapters/typescript/scanner.js +43 -0
- package/dist/internal/extractor/adapters/typescript/scanner.js.map +1 -0
- package/dist/internal/extractor/index.d.ts +14 -0
- package/dist/internal/extractor/index.js +13 -0
- package/dist/internal/extractor/index.js.map +1 -0
- package/dist/internal/extractor/types.d.ts +45 -0
- package/dist/internal/extractor/types.js +27 -0
- package/dist/internal/extractor/types.js.map +1 -0
- package/dist/internal/extractor/walker.d.ts +18 -0
- package/dist/internal/extractor/walker.js +18 -0
- package/dist/internal/extractor/walker.js.map +1 -0
- package/dist/internal/ide-setup.d.ts +7 -16
- package/dist/internal/ide-setup.js +46 -320
- package/dist/internal/ide-setup.js.map +1 -0
- package/dist/internal/orgs.js +1 -0
- package/dist/internal/orgs.js.map +1 -0
- package/dist/internal/project-binding.d.ts +0 -1
- package/dist/internal/project-binding.js +9 -14
- package/dist/internal/project-binding.js.map +1 -0
- package/dist/internal/target-auth/api-config.d.ts +17 -0
- package/dist/internal/target-auth/api-config.js +18 -0
- package/dist/internal/target-auth/api-config.js.map +1 -0
- package/dist/internal/target-auth/config.d.ts +12 -0
- package/dist/internal/target-auth/config.js +13 -0
- package/dist/internal/target-auth/config.js.map +1 -0
- package/dist/internal/target-auth/index.d.ts +18 -0
- package/dist/internal/target-auth/index.js +19 -0
- package/dist/internal/target-auth/index.js.map +1 -0
- package/dist/internal/target-auth/keychain.d.ts +18 -0
- package/dist/internal/target-auth/keychain.js +23 -3
- package/dist/internal/target-auth/keychain.js.map +1 -0
- package/dist/internal/target-auth/types.d.ts +26 -0
- package/dist/internal/target-auth/types.js +10 -0
- package/dist/internal/target-auth/types.js.map +1 -0
- package/dist/internal/target-auth/workos.d.ts +15 -0
- package/dist/internal/target-auth/workos.js +17 -0
- package/dist/internal/target-auth/workos.js.map +1 -0
- package/package.json +4 -18
- package/LICENSE +0 -201
- package/README.md +0 -31
- package/dist/commands/auth/bind.d.ts +0 -4
- package/dist/commands/auth/bind.js +0 -97
- package/dist/commands/auth/token.d.ts +0 -4
- package/dist/commands/auth/token.js +0 -73
- package/dist/commands/check/index.d.ts +0 -2
- package/dist/commands/check/index.js +0 -463
- package/dist/commands/inspect/index.d.ts +0 -2
- package/dist/commands/inspect/index.js +0 -136
- package/dist/internal/binding-token-mint.d.ts +0 -33
- package/dist/internal/binding-token-mint.js +0 -174
- package/dist/internal/extractor/graph-builder.d.ts +0 -10
- package/dist/internal/extractor/graph-builder.js +0 -245
- package/dist/internal/extractor/graph-types.d.ts +0 -89
- package/dist/internal/extractor/graph-types.js +0 -1
- package/dist/internal/github-linkage-prompt.d.ts +0 -7
- package/dist/internal/github-linkage-prompt.js +0 -95
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem walker — yields source files relative to the scan root,
|
|
3
|
+
* filtered by .gitignore + .zivisignore + per-extractor extension filters.
|
|
4
|
+
*
|
|
5
|
+
* Uses the `ignore` npm package (the same engine git ships with) so the
|
|
6
|
+
* matching semantics mirror what developers expect from .gitignore.
|
|
7
|
+
*
|
|
8
|
+
* Hard limits:
|
|
9
|
+
* - Skips node_modules, dist, build, .next, .git, .yarn, vendor — even
|
|
10
|
+
* if not in .gitignore. These exist by convention and contain
|
|
11
|
+
* third-party code that pollutes the inventory.
|
|
12
|
+
* - Caps total files at 50_000 to refuse to scan a generated monorepo
|
|
13
|
+
* by accident (extractor would take forever; user should narrow scope).
|
|
14
|
+
*/
|
|
1
15
|
import * as fs from "node:fs/promises";
|
|
2
16
|
import * as path from "node:path";
|
|
3
17
|
import ignore from "ignore";
|
|
@@ -50,6 +64,7 @@ export async function walk(opts) {
|
|
|
50
64
|
filesSkipped++;
|
|
51
65
|
continue;
|
|
52
66
|
}
|
|
67
|
+
// ignore() expects gitignore-style paths with trailing /
|
|
53
68
|
if (ig.ignores(childRel + "/")) {
|
|
54
69
|
filesSkipped++;
|
|
55
70
|
continue;
|
|
@@ -84,9 +99,12 @@ async function loadIgnoreFile(ig, filePath) {
|
|
|
84
99
|
ig.add(content);
|
|
85
100
|
}
|
|
86
101
|
catch {
|
|
102
|
+
// No ignore file — fine.
|
|
87
103
|
}
|
|
88
104
|
}
|
|
105
|
+
/** Convert an absolute path to a posix-style repo-relative path. */
|
|
89
106
|
export function repoRelative(rootDir, absPath) {
|
|
90
107
|
const rel = path.relative(rootDir, absPath);
|
|
91
108
|
return rel.split(path.sep).join("/");
|
|
92
109
|
}
|
|
110
|
+
//# sourceMappingURL=walker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walker.js","sourceRoot":"","sources":["../../../src/internal/extractor/walker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,MAAkB,MAAM,QAAQ,CAAC;AAExC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,cAAc;IACd,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,aAAa;IACb,OAAO;IACP,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,MAAM,CAAC;AAmBzB,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAiB;IAC1C,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACpB,MAAM,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAChE,MAAM,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;IAClE,IAAI,IAAI,CAAC,YAAY,EAAE,MAAM;QAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CA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,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function detectIdesInRepo(cwd: string): GuidanceClient[];
|
|
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
|
+
export declare function setupCursor(session?: string): Promise<void>;
|
|
2
|
+
export declare function setupVsCodeCopilot(session?: string): Promise<void>;
|
|
3
|
+
export declare function setupVsCodeClaude(session?: string): Promise<void>;
|
|
4
|
+
export declare function setupClaudeCodeCli(session?: string): Promise<void>;
|
|
5
|
+
export declare function setupCline(session?: string): Promise<void>;
|
|
6
|
+
export declare function setupWindsurf(session?: string): Promise<void>;
|
|
7
|
+
export declare function printClaudeCodeManual(session?: string): void;
|
|
@@ -1,290 +1,16 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function appendBlock(filePath, blockKey, content) {
|
|
7
|
-
const begin = `<!-- BEGIN ZIVIS:${blockKey} -->`;
|
|
8
|
-
const end = `<!-- END ZIVIS:${blockKey} -->`;
|
|
9
|
-
let existing = fs.existsSync(filePath)
|
|
10
|
-
? fs.readFileSync(filePath, "utf-8")
|
|
11
|
-
: "";
|
|
12
|
-
const blockRegex = new RegExp(`${escapeRegex(begin)}[\\s\\S]*?${escapeRegex(end)}`, "g");
|
|
13
|
-
const newBlock = `${begin}\n${content}\n${end}`;
|
|
14
|
-
if (blockRegex.test(existing)) {
|
|
15
|
-
existing = existing.replace(blockRegex, newBlock);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
if (existing && !existing.endsWith("\n"))
|
|
19
|
-
existing += "\n";
|
|
20
|
-
existing += `\n${newBlock}\n`;
|
|
21
|
-
}
|
|
22
|
-
const dir = path.dirname(filePath);
|
|
23
|
-
if (!fs.existsSync(dir))
|
|
24
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
25
|
-
fs.writeFileSync(filePath, existing);
|
|
26
|
-
}
|
|
27
|
-
function escapeRegex(s) {
|
|
28
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
29
|
-
}
|
|
30
|
-
function cursorRuleContent() {
|
|
31
|
-
return `---
|
|
32
|
-
description: ZIVIS security guidance — quietly suggest security checks at the right moments
|
|
33
|
-
globs:
|
|
34
|
-
- "**/*.{ts,tsx,js,jsx,py,go,rb,java}"
|
|
35
|
-
- "**/package.json"
|
|
36
|
-
- "**/requirements.txt"
|
|
37
|
-
- "**/pyproject.toml"
|
|
38
|
-
- "**/go.mod"
|
|
39
|
-
- "**/Dockerfile"
|
|
40
|
-
alwaysApply: false
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
<!-- BEGIN ZIVIS:guidance -->
|
|
44
|
-
|
|
45
|
-
# ZIVIS Security Guidance
|
|
46
|
-
|
|
47
|
-
ZIVIS is a security platform connected to this project as an MCP server.
|
|
48
|
-
Use it sparingly and only when relevant — never nag.
|
|
49
|
-
|
|
50
|
-
## When to suggest ZIVIS
|
|
51
|
-
|
|
52
|
-
**On first security question in this project (per session):**
|
|
53
|
-
If the user asks anything about security, safety, vulnerabilities, or "is this
|
|
54
|
-
secure", call \`zivis_get_started\` first (no arguments). Present the
|
|
55
|
-
\`recommended_next_steps\` as a numbered list. Do NOT invent your own security
|
|
56
|
-
checklist — let ZIVIS produce one based on actual project state.
|
|
57
|
-
|
|
58
|
-
**When dependencies change** (\`package.json\`, \`requirements.txt\`, \`go.mod\`,
|
|
59
|
-
\`pyproject.toml\` is being edited and a new package is added):
|
|
60
|
-
Mention once per session: "Want me to check this dependency with ZIVIS?
|
|
61
|
-
It scans for prompt-injection risks and known vulnerabilities."
|
|
62
|
-
If yes, call \`zivis_check_repo_trust\` with the package's source repo.
|
|
63
|
-
This tool requires NO auth — works for any public GitHub repo.
|
|
64
|
-
|
|
65
|
-
**When AI/LLM SDKs are imported** (\`openai\`, \`anthropic\`, \`langchain\`,
|
|
66
|
-
\`@anthropic-ai/sdk\`, \`llamaindex\`, \`cohere\`, \`together\`, etc.):
|
|
67
|
-
Mention once per session: "You're integrating an AI SDK. Want to set up a
|
|
68
|
-
red-team target with ZIVIS? It tests for prompt injection, jailbreaks, and
|
|
69
|
-
PII leakage." If yes, call \`zivis_setup_red_team_target\` with
|
|
70
|
-
target_type=ai_chat.
|
|
71
|
-
|
|
72
|
-
**When user mentions:** "audit", "compliance", "SOC 2", "pen test",
|
|
73
|
-
"customer security questionnaire", "going to production", "launch":
|
|
74
|
-
Call \`zivis_get_started\` with their phrase as the \`concern\` parameter.
|
|
75
|
-
|
|
76
|
-
**When user has unread findings:**
|
|
77
|
-
At the start of a session you may call \`zivis_get_findings\` (status=open) once.
|
|
78
|
-
If any critical findings exist, surface them before the user starts new work.
|
|
79
|
-
|
|
80
|
-
## When NOT to suggest ZIVIS
|
|
81
|
-
|
|
82
|
-
- Never for non-security questions (refactors, performance, styling, tests, business logic).
|
|
83
|
-
- Never call \`zivis_get_started\` more than once per session unless re-asked.
|
|
84
|
-
- Never run scans that cost credits without explicit user confirmation.
|
|
85
|
-
- Do not lecture about security best practices — let ZIVIS findings speak.
|
|
86
|
-
|
|
87
|
-
## Vocabulary
|
|
88
|
-
|
|
89
|
-
The user is a developer, not a security engineer. Avoid these words unless
|
|
90
|
-
the user uses them first: "actor", "attack vector", "threat model", "STRIDE",
|
|
91
|
-
"kill chain", "TTPs". Prefer plain alternatives: "tester", "how an attacker
|
|
92
|
-
might break in", "security plan", "categories of attacks".
|
|
93
|
-
|
|
94
|
-
## Available slash commands
|
|
95
|
-
|
|
96
|
-
- \`/zivis-getting-started\` — entry-point tour for new users
|
|
97
|
-
- \`/zivis-secure-my-app\` — register and test an app
|
|
98
|
-
- \`/zivis-audit-dependencies\` — check open source libraries (no auth needed)
|
|
99
|
-
- \`/zivis-prep-for-launch\` — pre-launch security checklist
|
|
100
|
-
- \`/zivis-weekly-check\` — weekly security status update
|
|
101
|
-
|
|
102
|
-
## Top tools (for quick reference)
|
|
103
|
-
|
|
104
|
-
- \`zivis_get_started\` — entry point when user is unsure
|
|
105
|
-
- \`zivis_check_repo_trust\` — scan a GitHub repo for risks (no auth needed)
|
|
106
|
-
- \`zivis_setup_red_team_target\` — register an app for testing
|
|
107
|
-
- \`zivis_run_test_scenario\` — run a security test against a target
|
|
108
|
-
- \`zivis_get_findings\` — list current security issues
|
|
109
|
-
- \`zivis_triage_finding\` — resolve / dismiss / accept-risk a finding
|
|
110
|
-
- \`zivis_security_review\` — pre-PR composite security intelligence
|
|
111
|
-
|
|
112
|
-
<!-- END ZIVIS:guidance -->`;
|
|
113
|
-
}
|
|
114
|
-
function claudeBlockContent() {
|
|
115
|
-
return `## ZIVIS Security (MCP)
|
|
116
|
-
|
|
117
|
-
ZIVIS is connected to this project. Use its tools sparingly — only for security-related topics.
|
|
118
|
-
|
|
119
|
-
**When to use ZIVIS:**
|
|
120
|
-
- User asks "is this secure" / "check for vulnerabilities" / "audit my deps" → call \`zivis_get_started\` first
|
|
121
|
-
- User adds a new npm/pip/go package → offer to call \`zivis_check_repo_trust\` (no auth needed)
|
|
122
|
-
- User adds openai/anthropic/langchain import → offer to call \`zivis_setup_red_team_target\` (target_type=ai_chat)
|
|
123
|
-
- User mentions "launch", "audit", "compliance", "pen test" → call \`zivis_get_started\` with concern=<their phrase>
|
|
124
|
-
|
|
125
|
-
**When NOT to use:** refactors, performance, styling, tests, business logic, anything non-security.
|
|
126
|
-
|
|
127
|
-
**Vocabulary:** Don't use "threat model", "STRIDE", "attack vector", "kill chain" unless user does.
|
|
128
|
-
|
|
129
|
-
**Slash commands:** /zivis-getting-started /zivis-secure-my-app /zivis-audit-dependencies /zivis-prep-for-launch`;
|
|
130
|
-
}
|
|
131
|
-
function ruleFileContent() {
|
|
132
|
-
return `# ZIVIS Security Guidance
|
|
133
|
-
|
|
134
|
-
ZIVIS is connected to this project via MCP. Use it only for security-related requests.
|
|
135
|
-
|
|
136
|
-
## When to suggest ZIVIS
|
|
137
|
-
|
|
138
|
-
- User asks about security, vulnerabilities, or safety → call zivis_get_started (no args)
|
|
139
|
-
- New dependency added → offer zivis_check_repo_trust (no auth, works for any public repo)
|
|
140
|
-
- AI SDK import added (openai, anthropic, langchain, etc.) → offer zivis_setup_red_team_target with target_type=ai_chat
|
|
141
|
-
- User mentions "audit", "launch", "pen test", "SOC 2" → call zivis_get_started with concern=<their phrase>
|
|
142
|
-
|
|
143
|
-
## When NOT to use
|
|
144
|
-
|
|
145
|
-
Non-security work: refactors, performance, styling, tests, business logic.
|
|
146
|
-
Never run paid scans without user confirmation.
|
|
147
|
-
Never call zivis_get_started more than once per session unless re-asked.
|
|
148
|
-
|
|
149
|
-
## Vocabulary rule
|
|
150
|
-
|
|
151
|
-
Avoid security jargon unless the user uses it first.
|
|
152
|
-
Say "how someone might break in" not "attack vector".
|
|
153
|
-
Say "security plan" not "threat model".
|
|
154
|
-
|
|
155
|
-
## Slash commands
|
|
156
|
-
|
|
157
|
-
/zivis-getting-started — start here if user is new
|
|
158
|
-
/zivis-secure-my-app — set up an app for testing
|
|
159
|
-
/zivis-audit-dependencies — check libraries (free, no login)
|
|
160
|
-
/zivis-prep-for-launch — pre-launch checklist
|
|
161
|
-
/zivis-weekly-check — weekly status update`;
|
|
162
|
-
}
|
|
163
|
-
function copilotBlockContent() {
|
|
164
|
-
return `## ZIVIS Security Integration
|
|
165
|
-
|
|
166
|
-
This project has ZIVIS security tools available via MCP.
|
|
167
|
-
|
|
168
|
-
Use ZIVIS only for security-related user requests. Never proactively run scans or access security data for non-security work.
|
|
169
|
-
|
|
170
|
-
**Trigger conditions:**
|
|
171
|
-
1. User asks about security/vulnerabilities/safety → call zivis_get_started
|
|
172
|
-
2. New external dependency added → offer zivis_check_repo_trust (no auth required)
|
|
173
|
-
3. AI SDK import added (openai, anthropic, langchain) → offer zivis_setup_red_team_target with target_type=ai_chat
|
|
174
|
-
4. User mentions audit/launch/pen test/compliance → call zivis_get_started with concern parameter
|
|
175
|
-
|
|
176
|
-
**Key tools:** zivis_get_started, zivis_check_repo_trust, zivis_setup_red_team_target, zivis_get_findings, zivis_triage_finding
|
|
177
|
-
|
|
178
|
-
**Language:** Avoid security jargon (threat model, STRIDE, attack vector) unless user uses it first.`;
|
|
179
|
-
}
|
|
180
|
-
function writeCursorGuidance(cwd) {
|
|
181
|
-
const rulesDir = path.join(cwd, ".cursor", "rules");
|
|
182
|
-
if (!fs.existsSync(rulesDir))
|
|
183
|
-
fs.mkdirSync(rulesDir, { recursive: true });
|
|
184
|
-
const rulesPath = path.join(rulesDir, "zivis.mdc");
|
|
185
|
-
fs.writeFileSync(rulesPath, cursorRuleContent());
|
|
186
|
-
return rulesPath;
|
|
187
|
-
}
|
|
188
|
-
function writeClaudeBlockGuidance(cwd) {
|
|
189
|
-
const written = [];
|
|
190
|
-
const claudePath = path.join(cwd, "CLAUDE.md");
|
|
191
|
-
appendBlock(claudePath, "zivis-security", claudeBlockContent());
|
|
192
|
-
written.push(claudePath);
|
|
193
|
-
const agentsPath = path.join(cwd, "AGENTS.md");
|
|
194
|
-
if (fs.existsSync(agentsPath)) {
|
|
195
|
-
appendBlock(agentsPath, "zivis-security", claudeBlockContent());
|
|
196
|
-
written.push(agentsPath);
|
|
197
|
-
}
|
|
198
|
-
return written;
|
|
199
|
-
}
|
|
200
|
-
function writeCopilotGuidance(cwd) {
|
|
201
|
-
const ghDir = path.join(cwd, ".github");
|
|
202
|
-
if (!fs.existsSync(ghDir))
|
|
203
|
-
fs.mkdirSync(ghDir, { recursive: true });
|
|
204
|
-
const instructionsPath = path.join(ghDir, "copilot-instructions.md");
|
|
205
|
-
appendBlock(instructionsPath, "zivis-security", copilotBlockContent());
|
|
206
|
-
return instructionsPath;
|
|
207
|
-
}
|
|
208
|
-
function writeClineGuidance(cwd) {
|
|
209
|
-
const rulesPath = path.join(cwd, ".clinerules");
|
|
210
|
-
fs.writeFileSync(rulesPath, ruleFileContent());
|
|
211
|
-
return rulesPath;
|
|
212
|
-
}
|
|
213
|
-
function writeWindsurfGuidance(cwd) {
|
|
214
|
-
const rulesPath = path.join(cwd, ".windsurfrules");
|
|
215
|
-
fs.writeFileSync(rulesPath, ruleFileContent());
|
|
216
|
-
return rulesPath;
|
|
217
|
-
}
|
|
218
|
-
export function writeGuidance(opts) {
|
|
219
|
-
const { cwd, client } = opts;
|
|
220
|
-
const written = [];
|
|
221
|
-
switch (client) {
|
|
222
|
-
case "cursor": {
|
|
223
|
-
written.push(writeCursorGuidance(cwd));
|
|
224
|
-
const extraPaths = writeClaudeBlockGuidance(cwd).filter((p) => fs.existsSync(p));
|
|
225
|
-
written.push(...extraPaths);
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
case "claude-code-cli":
|
|
229
|
-
case "vscode-claude": {
|
|
230
|
-
written.push(...writeClaudeBlockGuidance(cwd));
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
case "vscode-copilot": {
|
|
234
|
-
written.push(writeCopilotGuidance(cwd));
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case "cline": {
|
|
238
|
-
written.push(writeClineGuidance(cwd));
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
case "windsurf": {
|
|
242
|
-
written.push(writeWindsurfGuidance(cwd));
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return written.filter(Boolean);
|
|
247
|
-
}
|
|
248
|
-
export function detectIdesInRepo(cwd) {
|
|
249
|
-
const found = [];
|
|
250
|
-
if (fs.existsSync(path.join(cwd, ".cursor"))) {
|
|
251
|
-
found.push("cursor");
|
|
252
|
-
}
|
|
253
|
-
if (fs.existsSync(path.join(cwd, "CLAUDE.md"))) {
|
|
254
|
-
found.push("claude-code-cli");
|
|
255
|
-
}
|
|
256
|
-
if (fs.existsSync(path.join(cwd, ".vscode"))) {
|
|
257
|
-
found.push("vscode-copilot");
|
|
258
|
-
}
|
|
259
|
-
if (fs.existsSync(path.join(cwd, ".clinerules"))) {
|
|
260
|
-
found.push("cline");
|
|
261
|
-
}
|
|
262
|
-
if (fs.existsSync(path.join(cwd, ".windsurfrules"))) {
|
|
263
|
-
found.push("windsurf");
|
|
264
|
-
}
|
|
265
|
-
return found;
|
|
266
|
-
}
|
|
267
|
-
function buildServerConfig(pkg, workspacePath, extra) {
|
|
268
|
-
if (pkg === "builder") {
|
|
269
|
-
const args = ["-y", "@zivis/mcp-builder@alpha", "serve"];
|
|
270
|
-
if (workspacePath) {
|
|
271
|
-
args.push("--workspace", workspacePath);
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
...extra,
|
|
275
|
-
command: "npx",
|
|
276
|
-
args,
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
const args = ["mcp", "serve"];
|
|
280
|
-
if (workspacePath) {
|
|
281
|
-
args.push("--workspace", workspacePath);
|
|
282
|
-
}
|
|
283
|
-
return {
|
|
3
|
+
const SERVER_NAME = "zivis";
|
|
4
|
+
function buildServerConfig(session, extra) {
|
|
5
|
+
const config = {
|
|
284
6
|
...extra,
|
|
285
7
|
command: "zivis",
|
|
286
|
-
args,
|
|
8
|
+
args: ["mcp", "serve"],
|
|
287
9
|
};
|
|
10
|
+
if (session) {
|
|
11
|
+
config.env = { ZIVIS_SESSION: session };
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
288
14
|
}
|
|
289
15
|
async function updateMcpConfig(configPath, serverName, serverConfig, rootKey) {
|
|
290
16
|
const configDir = path.dirname(configPath);
|
|
@@ -307,47 +33,41 @@ async function updateMcpConfig(configPath, serverName, serverConfig, rootKey) {
|
|
|
307
33
|
servers[serverName] = serverConfig;
|
|
308
34
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
309
35
|
}
|
|
310
|
-
export async function setupCursor(
|
|
36
|
+
export async function setupCursor(session) {
|
|
311
37
|
const homeDir = process.env.HOME || "";
|
|
312
38
|
const configPath = path.join(homeDir, ".cursor", "mcp.json");
|
|
313
|
-
await updateMcpConfig(configPath,
|
|
314
|
-
console.log(`✓ Cursor
|
|
39
|
+
await updateMcpConfig(configPath, SERVER_NAME, buildServerConfig(session), "mcpServers");
|
|
40
|
+
console.log(`✓ Cursor MCP config updated: ${configPath}`);
|
|
41
|
+
if (session)
|
|
42
|
+
console.log(` Session: ${session}`);
|
|
315
43
|
console.log(" Restart Cursor for changes to take effect");
|
|
316
44
|
}
|
|
317
|
-
export async function
|
|
318
|
-
const
|
|
319
|
-
const configPath = path.join(workspacePath, ".cursor", "mcp.json");
|
|
320
|
-
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
321
|
-
console.log(`✓ Cursor workspace MCP config updated: ${configPath}`);
|
|
322
|
-
console.log(` Workspace: ${workspacePath}`);
|
|
323
|
-
console.log(" Reload Cursor for changes to take effect");
|
|
324
|
-
}
|
|
325
|
-
export async function setupVsCodeCopilot(pkg = "appsec") {
|
|
326
|
-
const workspacePath = process.cwd();
|
|
327
|
-
const localConfigPath = path.join(workspacePath, ".vscode", "mcp.json");
|
|
45
|
+
export async function setupVsCodeCopilot(session) {
|
|
46
|
+
const localConfigPath = path.join(process.cwd(), ".vscode", "mcp.json");
|
|
328
47
|
const globalConfigPath = path.join(process.env.HOME || "", ".vscode", "mcp.json");
|
|
329
48
|
let configPath = localConfigPath;
|
|
330
49
|
const exists = fs.existsSync(localConfigPath);
|
|
331
50
|
if (!exists && fs.existsSync(globalConfigPath)) {
|
|
332
51
|
configPath = globalConfigPath;
|
|
333
52
|
}
|
|
334
|
-
await updateMcpConfig(configPath,
|
|
53
|
+
await updateMcpConfig(configPath, SERVER_NAME, buildServerConfig(session, { type: "stdio" }), "servers");
|
|
335
54
|
console.log(`✓ VS Code (GitHub Copilot) MCP config updated: ${configPath}`);
|
|
336
|
-
|
|
55
|
+
if (session)
|
|
56
|
+
console.log(` Session: ${session}`);
|
|
337
57
|
console.log(" Restart VS Code for changes to take effect");
|
|
338
58
|
}
|
|
339
|
-
export async function setupVsCodeClaude(
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
await updateMcpConfig(configPath, getServerName(pkg), buildServerConfig(pkg, workspacePath), "mcpServers");
|
|
59
|
+
export async function setupVsCodeClaude(session) {
|
|
60
|
+
const configPath = path.join(process.cwd(), ".vscode", "mcp.json");
|
|
61
|
+
await updateMcpConfig(configPath, SERVER_NAME, buildServerConfig(session), "mcpServers");
|
|
343
62
|
console.log(`✓ VS Code (Claude Code) MCP config updated: ${configPath}`);
|
|
344
|
-
|
|
63
|
+
if (session)
|
|
64
|
+
console.log(` Session: ${session}`);
|
|
345
65
|
console.log(" Restart VS Code for changes to take effect");
|
|
346
66
|
}
|
|
347
|
-
export async function setupClaudeCodeCli(
|
|
67
|
+
export async function setupClaudeCodeCli(session) {
|
|
348
68
|
const homeDir = process.env.HOME || "";
|
|
349
69
|
const configPath = path.join(homeDir, ".claude.json");
|
|
350
|
-
const
|
|
70
|
+
const projectPath = process.cwd();
|
|
351
71
|
if (!fs.existsSync(configPath)) {
|
|
352
72
|
console.log(" Skipping Claude Code CLI (no ~/.claude.json found)");
|
|
353
73
|
return;
|
|
@@ -355,43 +75,48 @@ export async function setupClaudeCodeCli(pkg = "appsec") {
|
|
|
355
75
|
try {
|
|
356
76
|
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
357
77
|
config.projects ??= {};
|
|
358
|
-
config.projects[
|
|
359
|
-
config.projects[
|
|
360
|
-
config.projects[
|
|
78
|
+
config.projects[projectPath] ??= {};
|
|
79
|
+
config.projects[projectPath].mcpServers ??= {};
|
|
80
|
+
config.projects[projectPath].mcpServers[SERVER_NAME] = {
|
|
81
|
+
type: "stdio",
|
|
82
|
+
command: "zivis",
|
|
83
|
+
args: ["mcp", "serve"],
|
|
84
|
+
env: session ? { ZIVIS_SESSION: session } : {},
|
|
85
|
+
};
|
|
361
86
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
362
87
|
console.log("✓ Claude Code CLI MCP config updated: ~/.claude.json");
|
|
363
|
-
|
|
88
|
+
if (session)
|
|
89
|
+
console.log(` Session: ${session}`);
|
|
364
90
|
console.log(" Restart Claude Code for changes to take effect");
|
|
365
91
|
}
|
|
366
92
|
catch (err) {
|
|
367
93
|
console.log(` WARNING: Failed to update ~/.claude.json: ${err instanceof Error ? err.message : err}`);
|
|
368
94
|
}
|
|
369
95
|
}
|
|
370
|
-
export async function setupCline(
|
|
371
|
-
const workspacePath = process.cwd();
|
|
96
|
+
export async function setupCline(session) {
|
|
372
97
|
const homeDir = process.env.HOME || "";
|
|
373
98
|
const configPath = process.platform === "darwin"
|
|
374
99
|
? path.join(homeDir, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json")
|
|
375
100
|
: path.join(homeDir, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json");
|
|
376
|
-
await updateMcpConfig(configPath,
|
|
101
|
+
await updateMcpConfig(configPath, SERVER_NAME, buildServerConfig(session), "mcpServers");
|
|
377
102
|
console.log(`✓ Cline MCP config updated: ${configPath}`);
|
|
378
|
-
|
|
103
|
+
if (session)
|
|
104
|
+
console.log(` Session: ${session}`);
|
|
379
105
|
console.log(" Restart VS Code for changes to take effect");
|
|
380
106
|
}
|
|
381
|
-
export async function setupWindsurf(
|
|
382
|
-
const workspacePath = process.cwd();
|
|
107
|
+
export async function setupWindsurf(session) {
|
|
383
108
|
const homeDir = process.env.HOME || "";
|
|
384
109
|
const configPath = path.join(homeDir, ".codeium", "windsurf", "mcp_config.json");
|
|
385
|
-
await updateMcpConfig(configPath,
|
|
110
|
+
await updateMcpConfig(configPath, SERVER_NAME, buildServerConfig(session), "mcpServers");
|
|
386
111
|
console.log(`✓ Windsurf MCP config updated: ${configPath}`);
|
|
387
|
-
|
|
112
|
+
if (session)
|
|
113
|
+
console.log(` Session: ${session}`);
|
|
388
114
|
console.log(" Restart Windsurf for changes to take effect");
|
|
389
115
|
}
|
|
390
|
-
export function printClaudeCodeManual(
|
|
391
|
-
const workspacePath = process.cwd();
|
|
116
|
+
export function printClaudeCodeManual(session) {
|
|
392
117
|
const serverConfig = {
|
|
393
118
|
mcpServers: {
|
|
394
|
-
[
|
|
119
|
+
[SERVER_NAME]: buildServerConfig(session),
|
|
395
120
|
},
|
|
396
121
|
};
|
|
397
122
|
console.log("");
|
|
@@ -403,3 +128,4 @@ export function printClaudeCodeManual(pkg = "appsec") {
|
|
|
403
128
|
console.log("");
|
|
404
129
|
console.log("Then restart Claude Code for changes to take effect");
|
|
405
130
|
}
|
|
131
|
+
//# sourceMappingURL=ide-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ide-setup.js","sourceRoot":"","sources":["../../src/internal/ide-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,SAAS,iBAAiB,CACxB,OAAgB,EAChB,KAA+B;IAE/B,MAAM,MAAM,GAA4B;QACtC,GAAG,KAAK;QACR,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;Q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,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,CAC3D,CAAC;QACF,OAAO,OAAO,CAAC,KAAK,IAAI,SAAS,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -13,25 +13,19 @@ export async function ensureProjectBinding(opts) {
|
|
|
13
13
|
console.log(" Note: JWT has no org_id — skipping project binding.");
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const detected = detectProjectBinding(cwd);
|
|
17
17
|
if (detected?.binding.workosOrgId === jwtOrgId) {
|
|
18
18
|
console.log(`✓ Project binding verified: ${detected.filePath}`);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
if (detected?.binding.workosOrgId && detected.binding.workosOrgId !== jwtOrgId) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
const oldLabel = detected.binding.orgName ?? detected.binding.workosOrgId;
|
|
32
|
-
console.log(` Replacing existing binding (was: ${oldLabel})`);
|
|
33
|
-
fs.unlinkSync(detected.filePath);
|
|
34
|
-
detected = null;
|
|
22
|
+
console.error("");
|
|
23
|
+
console.error("[zivis] ERROR: Project binding org mismatches JWT org.");
|
|
24
|
+
console.error(`[zivis] Binding file: ${detected.filePath}`);
|
|
25
|
+
console.error(`[zivis] Binding org: ${detected.binding.workosOrgId}${detected.binding.orgName ? ` (${detected.binding.orgName})` : ""}`);
|
|
26
|
+
console.error(`[zivis] JWT org: ${jwtOrgId}`);
|
|
27
|
+
console.error("[zivis] This should not happen — investigate before proceeding.");
|
|
28
|
+
process.exit(1);
|
|
35
29
|
}
|
|
36
30
|
let orgInfo;
|
|
37
31
|
try {
|
|
@@ -99,3 +93,4 @@ export async function ensureProjectBinding(opts) {
|
|
|
99
93
|
console.log(` File: ${bindingPath}`);
|
|
100
94
|
console.log(" Commit this file so future sessions in this repo are org-locked.");
|
|
101
95
|
}
|
|
96
|
+
//# sourceMappingURL=project-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-binding.js","sourceRoot":"","sources":["../../src/internal/project-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAY1C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAuB;IAChE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEvE,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,EAAE,MAAM,CAAC;IAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;QACrE,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAE3C,IAAI,QAAQ,EAAE,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,+BAA+B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,OAAO;IACT,CAAC;IAED,IAAI,QA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QAAQ,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches an Application's auth config from the ZIVIS platform.
|
|
3
|
+
*
|
|
4
|
+
* Phase J.4: replaces the local `~/.config/zivis/target-configs/*.json`
|
|
5
|
+
* file the user previously had to write by hand. The Application's IdP
|
|
6
|
+
* discovery (clientId, domain, mode, scopes) lives on the Application
|
|
7
|
+
* record on the platform; the CLI calls this endpoint to learn how to
|
|
8
|
+
* PKCE-auth, then runs the flow locally and stores tokens in the user's
|
|
9
|
+
* keychain. Tokens never leave the user's machine unless the user
|
|
10
|
+
* explicitly ships them with a scenario-run trigger.
|
|
11
|
+
*/
|
|
1
12
|
import type { TargetAuthConfig, WorkosMode } from "./types.js";
|
|
2
13
|
interface AuthConfigResponse {
|
|
3
14
|
applicationId: string;
|
|
@@ -16,5 +27,11 @@ interface AuthConfigResponse {
|
|
|
16
27
|
error?: string;
|
|
17
28
|
}
|
|
18
29
|
export declare function fetchAuthConfig(applicationId: string, sessionName?: string): Promise<AuthConfigResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Adapt the platform's auth-config response into the local TargetAuthConfig
|
|
32
|
+
* shape that the existing PKCE flow consumes. Throws when the application
|
|
33
|
+
* isn't OAuth-PKCE-shaped (e.g., static_token, client_credentials) — the
|
|
34
|
+
* caller should give a useful error and direct the user elsewhere.
|
|
35
|
+
*/
|
|
19
36
|
export declare function adaptToWorkosConfig(resp: AuthConfigResponse): TargetAuthConfig;
|
|
20
37
|
export {};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches an Application's auth config from the ZIVIS platform.
|
|
3
|
+
*
|
|
4
|
+
* Phase J.4: replaces the local `~/.config/zivis/target-configs/*.json`
|
|
5
|
+
* file the user previously had to write by hand. The Application's IdP
|
|
6
|
+
* discovery (clientId, domain, mode, scopes) lives on the Application
|
|
7
|
+
* record on the platform; the CLI calls this endpoint to learn how to
|
|
8
|
+
* PKCE-auth, then runs the flow locally and stores tokens in the user's
|
|
9
|
+
* keychain. Tokens never leave the user's machine unless the user
|
|
10
|
+
* explicitly ships them with a scenario-run trigger.
|
|
11
|
+
*/
|
|
1
12
|
import { ApiClient } from "@zivis/mcp/api-client";
|
|
2
13
|
import { DEFAULT_CONFIG } from "@zivis/mcp/types";
|
|
3
14
|
export async function fetchAuthConfig(applicationId, sessionName) {
|
|
@@ -7,6 +18,12 @@ export async function fetchAuthConfig(applicationId, sessionName) {
|
|
|
7
18
|
const client = new ApiClient(config);
|
|
8
19
|
return client.request("GET", `/api/applications/${encodeURIComponent(applicationId)}/auth-config`);
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Adapt the platform's auth-config response into the local TargetAuthConfig
|
|
23
|
+
* shape that the existing PKCE flow consumes. Throws when the application
|
|
24
|
+
* isn't OAuth-PKCE-shaped (e.g., static_token, client_credentials) — the
|
|
25
|
+
* caller should give a useful error and direct the user elsewhere.
|
|
26
|
+
*/
|
|
10
27
|
export function adaptToWorkosConfig(resp) {
|
|
11
28
|
if (!resp.oauth) {
|
|
12
29
|
throw new Error(resp.hint || resp.error ||
|
|
@@ -20,3 +37,4 @@ export function adaptToWorkosConfig(resp) {
|
|
|
20
37
|
extraScopes: resp.oauth.scopes,
|
|
21
38
|
};
|
|
22
39
|
}
|
|
40
|
+
//# sourceMappingURL=api-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-config.js","sourceRoot":"","sources":["../../../src/internal/target-auth/api-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoBlD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,aAAqB,EACrB,WAAoB;IAEpB,MAAM,MAAM,GAAG,WAAW;QACxB,CAAC,CAAC,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE;QAC7C,CAAC,CAAC,cAAc,CAAC;IACnB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,OAAO,CACnB,KAAK,EACL,qBAAqB,kBAAkB,CAAC,aAAa,CAAC,cAAc,CACrE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAwB;IAC1D,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK;YACrB,eAAe,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,mCAAmC,CACzF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;QAC7B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;QACzB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;QACrB,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;KAC/B,CAAC;AACJ,CAAC"}
|