@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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth config storage (local-only, v1).
|
|
3
|
+
*
|
|
4
|
+
* Per-target IdP config (domain, client_id, mode, callback port) lives under
|
|
5
|
+
* `~/.config/zivis/target-configs/<targetId>.json`. This is *config*, not
|
|
6
|
+
* credentials — safe to commit a sanitized version to your repo if you want
|
|
7
|
+
* teammates to share it.
|
|
8
|
+
*
|
|
9
|
+
* v2: ZIVIS will serve target-auth config from the API so any team member's
|
|
10
|
+
* CLI can discover it. For now, configure once locally with `zivis target
|
|
11
|
+
* configure` and check in the file if you want it shared.
|
|
12
|
+
*/
|
|
1
13
|
import type { TargetAuthConfig } from "./types.js";
|
|
2
14
|
export declare function loadTargetConfig(targetId: string): Promise<TargetAuthConfig | null>;
|
|
3
15
|
export declare function saveTargetConfig(targetId: string, cfg: TargetAuthConfig): Promise<string>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth config storage (local-only, v1).
|
|
3
|
+
*
|
|
4
|
+
* Per-target IdP config (domain, client_id, mode, callback port) lives under
|
|
5
|
+
* `~/.config/zivis/target-configs/<targetId>.json`. This is *config*, not
|
|
6
|
+
* credentials — safe to commit a sanitized version to your repo if you want
|
|
7
|
+
* teammates to share it.
|
|
8
|
+
*
|
|
9
|
+
* v2: ZIVIS will serve target-auth config from the API so any team member's
|
|
10
|
+
* CLI can discover it. For now, configure once locally with `zivis target
|
|
11
|
+
* configure` and check in the file if you want it shared.
|
|
12
|
+
*/
|
|
1
13
|
import * as fs from "node:fs/promises";
|
|
2
14
|
import * as path from "node:path";
|
|
3
15
|
import * as os from "node:os";
|
|
@@ -43,3 +55,4 @@ export async function listTargetConfigs() {
|
|
|
43
55
|
export function getConfigPath(targetId) {
|
|
44
56
|
return configPath(targetId);
|
|
45
57
|
}
|
|
58
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/internal/target-auth/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,QAAQ,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB;IACrD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,GAAqB;IAErB,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9D,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9C,MAAM,GAAG,GAA8C,EAAE,CAAC;QAC1D,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,SAAS;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAChD,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7C,IAAI,GAAG;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth orchestrator: load config, run the right IdP flow, manage tokens.
|
|
3
|
+
*
|
|
4
|
+
* Public API:
|
|
5
|
+
* getValidTargetToken(targetId, persona) — returns access_token; refreshes if near expiry
|
|
6
|
+
* loginTarget(targetId, persona) — runs the appropriate IdP flow
|
|
7
|
+
* logoutTarget(targetId, persona) — clears stored tokens
|
|
8
|
+
*
|
|
9
|
+
* Designed so RT-runner-side ephemeral cred plumbing only sees a flat
|
|
10
|
+
* { accessToken, refreshToken?, expiresAt, idpType } bundle — no IdP
|
|
11
|
+
* specifics leak past this boundary.
|
|
12
|
+
*/
|
|
1
13
|
import type { EphemeralTargetCreds, TargetTokens } from "./types.js";
|
|
2
14
|
export declare function loginTarget(targetId: string, persona: string): Promise<TargetTokens>;
|
|
15
|
+
/**
|
|
16
|
+
* J.4 path: log in against an Application by id. Auth config comes from
|
|
17
|
+
* the platform (no local config file required). Tokens are stored under
|
|
18
|
+
* the existing keychain namespace using applicationId as the key — same
|
|
19
|
+
* keychain layout, no migration needed for already-stored tokens.
|
|
20
|
+
*/
|
|
3
21
|
export declare function loginApplication(applicationId: string, persona: string, sessionName?: string): Promise<TargetTokens>;
|
|
4
22
|
export declare function logoutTarget(targetId: string, persona: string): Promise<void>;
|
|
5
23
|
export declare function getValidTargetToken(targetId: string, persona: string): Promise<TargetTokens | null>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth orchestrator: load config, run the right IdP flow, manage tokens.
|
|
3
|
+
*
|
|
4
|
+
* Public API:
|
|
5
|
+
* getValidTargetToken(targetId, persona) — returns access_token; refreshes if near expiry
|
|
6
|
+
* loginTarget(targetId, persona) — runs the appropriate IdP flow
|
|
7
|
+
* logoutTarget(targetId, persona) — clears stored tokens
|
|
8
|
+
*
|
|
9
|
+
* Designed so RT-runner-side ephemeral cred plumbing only sees a flat
|
|
10
|
+
* { accessToken, refreshToken?, expiresAt, idpType } bundle — no IdP
|
|
11
|
+
* specifics leak past this boundary.
|
|
12
|
+
*/
|
|
1
13
|
import { loadTargetConfig } from "./config.js";
|
|
2
14
|
import { loadTokens, storeTokens, deleteTokens } from "./keychain.js";
|
|
3
15
|
import { loginWorkos, refreshWorkos } from "./workos.js";
|
|
@@ -9,6 +21,12 @@ export async function loginTarget(targetId, persona) {
|
|
|
9
21
|
await storeTokens(targetId, persona, tokens);
|
|
10
22
|
return tokens;
|
|
11
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* J.4 path: log in against an Application by id. Auth config comes from
|
|
26
|
+
* the platform (no local config file required). Tokens are stored under
|
|
27
|
+
* the existing keychain namespace using applicationId as the key — same
|
|
28
|
+
* keychain layout, no migration needed for already-stored tokens.
|
|
29
|
+
*/
|
|
12
30
|
export async function loginApplication(applicationId, persona, sessionName) {
|
|
13
31
|
const resp = await fetchAuthConfig(applicationId, sessionName);
|
|
14
32
|
const cfg = adaptToWorkosConfig(resp);
|
|
@@ -80,3 +98,4 @@ async function runRefresh(cfg, refreshToken) {
|
|
|
80
98
|
throw new Error(`Unsupported IdP type: ${cfg.type}`);
|
|
81
99
|
}
|
|
82
100
|
}
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/target-auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAQvE,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,OAAe;IAEf,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,MAAM,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,MAAM,CAA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AAC,GAAqB,EAAE,OAAe;IAC5D,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACnC;YACE,MAAM,IAAI,KAAK,CAAC,yBAA0B,GAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CACvB,GAAqB,EACrB,YAAoB;IAEpB,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC1C;YACE,MAAM,IAAI,KAAK,CAAC,yBAA0B,GAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth keychain.
|
|
3
|
+
*
|
|
4
|
+
* Distinct namespace from the user's ZIVIS-platform tokens (handled by
|
|
5
|
+
* `zivis-mcp-security`'s keychain module). A user can be logged into
|
|
6
|
+
* ZIVIS itself AND to N customer-target IdPs simultaneously, each with
|
|
7
|
+
* multiple personas (admin, user_a, …) for permutation testing.
|
|
8
|
+
*
|
|
9
|
+
* Storage layout
|
|
10
|
+
* service: zivis.target.<targetId>.<persona>
|
|
11
|
+
* account: zivis-target
|
|
12
|
+
* value: JSON-serialised TargetTokens
|
|
13
|
+
*
|
|
14
|
+
* macOS-only for v1 (matches the engagement helper). Linux/Windows fall
|
|
15
|
+
* back to an encrypted file on disk; the underlying impl lives in
|
|
16
|
+
* `@zivis/mcp/auth/keychain.ts` for the platform login — we
|
|
17
|
+
* deliberately don't share that module to keep the namespaces isolated.
|
|
18
|
+
*/
|
|
1
19
|
import type { TargetTokens } from "./types.js";
|
|
2
20
|
export declare function storeTokens(targetId: string, persona: string, tokens: TargetTokens): Promise<void>;
|
|
3
21
|
export declare function loadTokens(targetId: string, persona: string): Promise<TargetTokens | null>;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth keychain.
|
|
3
|
+
*
|
|
4
|
+
* Distinct namespace from the user's ZIVIS-platform tokens (handled by
|
|
5
|
+
* `zivis-mcp-security`'s keychain module). A user can be logged into
|
|
6
|
+
* ZIVIS itself AND to N customer-target IdPs simultaneously, each with
|
|
7
|
+
* multiple personas (admin, user_a, …) for permutation testing.
|
|
8
|
+
*
|
|
9
|
+
* Storage layout
|
|
10
|
+
* service: zivis.target.<targetId>.<persona>
|
|
11
|
+
* account: zivis-target
|
|
12
|
+
* value: JSON-serialised TargetTokens
|
|
13
|
+
*
|
|
14
|
+
* macOS-only for v1 (matches the engagement helper). Linux/Windows fall
|
|
15
|
+
* back to an encrypted file on disk; the underlying impl lives in
|
|
16
|
+
* `@zivis/mcp/auth/keychain.ts` for the platform login — we
|
|
17
|
+
* deliberately don't share that module to keep the namespaces isolated.
|
|
18
|
+
*/
|
|
1
19
|
import { execFile } from "node:child_process";
|
|
2
20
|
import { promisify } from "node:util";
|
|
3
21
|
import * as fs from "node:fs/promises";
|
|
@@ -15,6 +33,7 @@ function fallbackPath(targetId, persona) {
|
|
|
15
33
|
return path.join(dir, `${targetId}.${persona}.enc`);
|
|
16
34
|
}
|
|
17
35
|
function fallbackKey() {
|
|
36
|
+
// Same scheme as the platform-side keychain fallback: derive from username.
|
|
18
37
|
return new Uint8Array(crypto.scryptSync(os.userInfo().username || "zivis", "zivis-target-salt", 32));
|
|
19
38
|
}
|
|
20
39
|
async function macStore(targetId, persona, value) {
|
|
@@ -23,7 +42,7 @@ async function macStore(targetId, persona, value) {
|
|
|
23
42
|
"delete-generic-password", "-a", ACCOUNT, "-s", svc(targetId, persona),
|
|
24
43
|
]);
|
|
25
44
|
}
|
|
26
|
-
catch { }
|
|
45
|
+
catch { /* not present */ }
|
|
27
46
|
await execFileAsync("security", [
|
|
28
47
|
"add-generic-password", "-a", ACCOUNT, "-s", svc(targetId, persona), "-w", value,
|
|
29
48
|
]);
|
|
@@ -45,7 +64,7 @@ async function macDelete(targetId, persona) {
|
|
|
45
64
|
"delete-generic-password", "-a", ACCOUNT, "-s", svc(targetId, persona),
|
|
46
65
|
]);
|
|
47
66
|
}
|
|
48
|
-
catch { }
|
|
67
|
+
catch { /* not present */ }
|
|
49
68
|
}
|
|
50
69
|
async function fileStore(targetId, persona, value) {
|
|
51
70
|
const p = fallbackPath(targetId, persona);
|
|
@@ -86,7 +105,7 @@ async function fileDelete(targetId, persona) {
|
|
|
86
105
|
try {
|
|
87
106
|
await fs.unlink(fallbackPath(targetId, persona));
|
|
88
107
|
}
|
|
89
|
-
catch { }
|
|
108
|
+
catch { /* not present */ }
|
|
90
109
|
}
|
|
91
110
|
async function tryMac() {
|
|
92
111
|
if (process.platform !== "darwin")
|
|
@@ -128,3 +147,4 @@ export function getStorageName() {
|
|
|
128
147
|
? "macOS Keychain"
|
|
129
148
|
: "encrypted file (~/.config/zivis/target-tokens)";
|
|
130
149
|
}
|
|
150
|
+
//# sourceMappingURL=keychain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../../src/internal/target-auth/keychain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,OAAO,GAAG,cAAc,CAAC;AAE/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AAC,CAAC;IAC9D,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,OAAe;IAEf,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC;QAC1B,CAAC,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC;QAClC,CAAC,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAiB,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,OAAe;IAClE,IAAI,MAAM,MAAM,EAAE;QAAE,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAClC,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,gDAAgD,CAAC;AACvD,CAAC"}
|
|
@@ -1,25 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth: PKCE auth flows against the *customer's* identity provider.
|
|
3
|
+
*
|
|
4
|
+
* The user authenticates locally against the target system's IdP. Tokens
|
|
5
|
+
* stay in the user's OS keychain. When a scenario run is triggered, the
|
|
6
|
+
* CLI ships a short-lived access token (and optionally a refresh token)
|
|
7
|
+
* to the ZIVIS platform, which uses it for the duration of the run only.
|
|
8
|
+
* ZIVIS never persists target-system credentials.
|
|
9
|
+
*/
|
|
1
10
|
export type IdpType = "workos" | "auth0" | "apikey" | "none";
|
|
11
|
+
/** WorkOS path layout — three observed flavors. */
|
|
2
12
|
export type WorkosMode = "user_management" | "authkit" | "workos";
|
|
3
13
|
export interface WorkosConfig {
|
|
4
14
|
type: "workos";
|
|
15
|
+
/** WorkOS client_id (AuthKit application). */
|
|
5
16
|
clientId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Auth host. e.g. `api.workos.com` (user_management/legacy) or
|
|
19
|
+
* `<custom>.authkit.app` (custom AuthKit domain).
|
|
20
|
+
*/
|
|
6
21
|
domain: string;
|
|
22
|
+
/** Path layout flavor. Defaults to `user_management`. */
|
|
7
23
|
mode?: WorkosMode;
|
|
24
|
+
/** localhost callback port for the PKCE redirect. Defaults to 5174. */
|
|
8
25
|
callbackPort?: number;
|
|
26
|
+
/** Extra OAuth scopes beyond `openid profile email offline_access`. */
|
|
9
27
|
extraScopes?: string[];
|
|
10
28
|
}
|
|
11
29
|
export type TargetAuthConfig = WorkosConfig;
|
|
12
30
|
export interface TargetTokens {
|
|
31
|
+
/** OAuth access token. */
|
|
13
32
|
access_token: string;
|
|
33
|
+
/** OAuth refresh token, if the IdP issued one. */
|
|
14
34
|
refresh_token?: string;
|
|
35
|
+
/** Unix-ms expiry, derived from JWT exp claim or `expires_in`. */
|
|
15
36
|
expires_at: number;
|
|
37
|
+
/** Optional id_token for client-side claim inspection. */
|
|
16
38
|
id_token?: string;
|
|
39
|
+
/** When this token bundle was obtained (unix-ms). */
|
|
17
40
|
obtained_at: number;
|
|
18
41
|
}
|
|
42
|
+
/** Bundle shipped to ZIVIS on `scenario run` — RT consumes ephemerally. */
|
|
19
43
|
export interface EphemeralTargetCreds {
|
|
20
44
|
idpType: IdpType;
|
|
21
45
|
accessToken: string;
|
|
22
46
|
refreshToken?: string;
|
|
47
|
+
/** Unix-ms expiry of the access token. */
|
|
23
48
|
expiresAt: number;
|
|
49
|
+
/** Echo of the persona, useful for audit logs. */
|
|
24
50
|
persona?: string;
|
|
25
51
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-auth: PKCE auth flows against the *customer's* identity provider.
|
|
3
|
+
*
|
|
4
|
+
* The user authenticates locally against the target system's IdP. Tokens
|
|
5
|
+
* stay in the user's OS keychain. When a scenario run is triggered, the
|
|
6
|
+
* CLI ships a short-lived access token (and optionally a refresh token)
|
|
7
|
+
* to the ZIVIS platform, which uses it for the duration of the run only.
|
|
8
|
+
* ZIVIS never persists target-system credentials.
|
|
9
|
+
*/
|
|
1
10
|
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/target-auth/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkOS PKCE login + refresh against a *target* IdP.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from `zivis-rt/specs/engagements/meshmesh-cred-threat-model/scripts/authkit-helper.mjs`,
|
|
5
|
+
* which is itself adapted from `@zivis/mcp/src/auth/oauth.ts`. Three
|
|
6
|
+
* known WorkOS flavors are supported:
|
|
7
|
+
* - user_management — api.workos.com/user_management/{authorize,authenticate}
|
|
8
|
+
* - authkit — <custom>.authkit.app/oauth2/{authorize,token}
|
|
9
|
+
* - workos — legacy auth.workos.com/{authorize,oauth/token}
|
|
10
|
+
*
|
|
11
|
+
* Why a copy and not a shared module: the platform-side login uses a fixed
|
|
12
|
+
* client_id and our own AuthKit. Target login uses the *customer's* IdP
|
|
13
|
+
* config, parameterized per target. Same primitives, different config
|
|
14
|
+
* surface — keeping them separate avoids accidental cross-tenant token mixing.
|
|
15
|
+
*/
|
|
1
16
|
import type { TargetTokens, WorkosConfig } from "./types.js";
|
|
2
17
|
export declare function decodeJwtPayload(jwt: string): Record<string, unknown> | null;
|
|
3
18
|
declare function refreshTokens(cfg: WorkosConfig, refreshToken: string): Promise<TargetTokens>;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkOS PKCE login + refresh against a *target* IdP.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from `zivis-rt/specs/engagements/meshmesh-cred-threat-model/scripts/authkit-helper.mjs`,
|
|
5
|
+
* which is itself adapted from `@zivis/mcp/src/auth/oauth.ts`. Three
|
|
6
|
+
* known WorkOS flavors are supported:
|
|
7
|
+
* - user_management — api.workos.com/user_management/{authorize,authenticate}
|
|
8
|
+
* - authkit — <custom>.authkit.app/oauth2/{authorize,token}
|
|
9
|
+
* - workos — legacy auth.workos.com/{authorize,oauth/token}
|
|
10
|
+
*
|
|
11
|
+
* Why a copy and not a shared module: the platform-side login uses a fixed
|
|
12
|
+
* client_id and our own AuthKit. Target login uses the *customer's* IdP
|
|
13
|
+
* config, parameterized per target. Same primitives, different config
|
|
14
|
+
* surface — keeping them separate avoids accidental cross-tenant token mixing.
|
|
15
|
+
*/
|
|
1
16
|
import * as crypto from "node:crypto";
|
|
2
17
|
import * as http from "node:http";
|
|
3
18
|
import { execFile } from "node:child_process";
|
|
@@ -170,6 +185,7 @@ export async function loginWorkos(cfg, persona) {
|
|
|
170
185
|
await open(authUrl);
|
|
171
186
|
}
|
|
172
187
|
catch {
|
|
188
|
+
// open() can fail in headless envs — print the URL and let the user click.
|
|
173
189
|
await execFileAsync("printf", [authUrl]).catch(() => { });
|
|
174
190
|
process.stderr.write(`[zivis] open ${authUrl}\n`);
|
|
175
191
|
}
|
|
@@ -177,3 +193,4 @@ export async function loginWorkos(cfg, persona) {
|
|
|
177
193
|
return exchangeCode(cfg, code, verifier);
|
|
178
194
|
}
|
|
179
195
|
export { refreshTokens as refreshWorkos };
|
|
196
|
+
//# sourceMappingURL=workos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workos.js","sourceRoot":"","sources":["../../../src/internal/target-auth/workos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AAC;IAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,iBAAiB,CAAC,KAAK,iBAAiB,EAAE,CAAC;QAC1D,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IACzE,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAErD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,OAAO,KAAK,CAAC,CAAC;IACzF,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,IAAI,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;IAC/B,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zivis/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"description": "ZIVIS CLI — threat modeling, scans, and MCP server for IDE integration",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"homepage": "https://zivis.ai",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/zivisai/zivis-platform.git",
|
|
10
|
-
"directory": "zivis-cli"
|
|
11
|
-
},
|
|
12
5
|
"type": "module",
|
|
13
6
|
"bin": {
|
|
14
7
|
"zivis": "./dist/index.js"
|
|
15
8
|
},
|
|
16
9
|
"files": [
|
|
17
10
|
"dist",
|
|
18
|
-
"package.json"
|
|
19
|
-
"README.md",
|
|
20
|
-
"LICENSE"
|
|
11
|
+
"package.json"
|
|
21
12
|
],
|
|
22
13
|
"publishConfig": {
|
|
23
14
|
"access": "restricted"
|
|
@@ -32,21 +23,16 @@
|
|
|
32
23
|
"ignore": "^7.0.5",
|
|
33
24
|
"open": "^10.1.0",
|
|
34
25
|
"web-tree-sitter": "^0.26.8",
|
|
35
|
-
"@zivis/mcp": "0.1.0-alpha.
|
|
26
|
+
"@zivis/mcp": "0.1.0-alpha.2"
|
|
36
27
|
},
|
|
37
28
|
"devDependencies": {
|
|
38
|
-
"@types/js-yaml": "^4.0.9",
|
|
39
29
|
"@types/node": "^22.0.0",
|
|
40
|
-
"ajv": "^8.17.1",
|
|
41
|
-
"ajv-formats": "^3.0.1",
|
|
42
|
-
"js-yaml": "^4.1.0",
|
|
43
|
-
"tsx": "^4.19.2",
|
|
44
30
|
"typescript": "^5.7.0",
|
|
45
31
|
"vitest": "^3.0.0"
|
|
46
32
|
},
|
|
47
33
|
"scripts": {
|
|
48
34
|
"build:workspace-deps": "pnpm --filter @zivis/mcp run build",
|
|
49
|
-
"build": "pnpm run build:workspace-deps && tsc
|
|
35
|
+
"build": "pnpm run build:workspace-deps && tsc && node scripts/ensure-symlink.cjs",
|
|
50
36
|
"dev": "tsc --watch",
|
|
51
37
|
"start": "node dist/index.js",
|
|
52
38
|
"lint": "pnpm run build:workspace-deps && tsc --noEmit",
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for describing the origin of the Work and
|
|
141
|
-
reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2026 ZIVIS, Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
package/README.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# @zivis/cli
|
|
2
|
-
|
|
3
|
-
The ZIVIS command-line interface — interactive setup, threat-model and security operations, and the launcher for the ZIVIS MCP server used by IDE assistants (Cursor, Claude Code, VS Code Copilot, Cline, Windsurf).
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
# Install (per-project)
|
|
7
|
-
pnpm add -D @zivis/cli
|
|
8
|
-
|
|
9
|
-
# Or run on demand
|
|
10
|
-
npx @zivis/cli init
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Common commands
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
zivis init # interactive setup: log in, pick org, bind this repo
|
|
17
|
-
zivis check # local architecture inspection + delta from last run
|
|
18
|
-
zivis mcp serve # stdio MCP server (called by your IDE, not directly)
|
|
19
|
-
zivis auth status # show current auth state and active session
|
|
20
|
-
zivis auth logout # clear stored credentials
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Credentials are stored in your OS keychain (macOS Keychain / Windows Credential Manager / libsecret on Linux). They are not written to any `.env` file.
|
|
24
|
-
|
|
25
|
-
## What is ZIVIS?
|
|
26
|
-
|
|
27
|
-
ZIVIS is an architecture-inspection security platform — it looks at the components in your app, how they connect, and what trust boundaries exist between them. See <https://zivis.ai>.
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
Apache 2.0 — see [`LICENSE`](./LICENSE).
|