@zivis/cli 0.1.0-alpha.34 → 0.1.0-alpha.36

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.
Files changed (135) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -0
  3. package/dist/commands/app/index.d.ts +0 -8
  4. package/dist/commands/app/index.js +0 -12
  5. package/dist/commands/auth/bind.d.ts +0 -10
  6. package/dist/commands/auth/bind.js +0 -11
  7. package/dist/commands/auth/index.js +0 -1
  8. package/dist/commands/auth/init.js +0 -19
  9. package/dist/commands/auth/login.d.ts +0 -1
  10. package/dist/commands/auth/login.js +0 -6
  11. package/dist/commands/auth/logout.js +0 -3
  12. package/dist/commands/auth/sessions.js +0 -1
  13. package/dist/commands/auth/status.js +0 -2
  14. package/dist/commands/auth/token.d.ts +0 -13
  15. package/dist/commands/auth/token.js +0 -18
  16. package/dist/commands/check/index.d.ts +0 -18
  17. package/dist/commands/check/index.js +1 -37
  18. package/dist/commands/credits/index.js +0 -1
  19. package/dist/commands/inspect/index.d.ts +0 -15
  20. package/dist/commands/inspect/index.js +0 -23
  21. package/dist/commands/mcp/index.js +0 -9
  22. package/dist/commands/open/index.d.ts +0 -8
  23. package/dist/commands/open/index.js +0 -11
  24. package/dist/commands/scan/index.js +0 -6
  25. package/dist/commands/target/index.js +0 -3
  26. package/dist/commands/tm/index.js +0 -7
  27. package/dist/index.js +9 -1
  28. package/dist/internal/binding-token-mint.d.ts +0 -29
  29. package/dist/internal/binding-token-mint.js +0 -28
  30. package/dist/internal/extractor/adapters/go/index.d.ts +0 -4
  31. package/dist/internal/extractor/adapters/go/index.js +0 -6
  32. package/dist/internal/extractor/adapters/go/manifest.d.ts +0 -17
  33. package/dist/internal/extractor/adapters/go/manifest.js +1 -25
  34. package/dist/internal/extractor/adapters/go/parser.d.ts +0 -4
  35. package/dist/internal/extractor/adapters/go/parser.js +0 -5
  36. package/dist/internal/extractor/adapters/go/scanner.d.ts +0 -20
  37. package/dist/internal/extractor/adapters/go/scanner.js +0 -43
  38. package/dist/internal/extractor/adapters/python/index.d.ts +0 -3
  39. package/dist/internal/extractor/adapters/python/index.js +0 -4
  40. package/dist/internal/extractor/adapters/python/manifest.d.ts +0 -8
  41. package/dist/internal/extractor/adapters/python/manifest.js +3 -18
  42. package/dist/internal/extractor/adapters/python/parser.d.ts +0 -3
  43. package/dist/internal/extractor/adapters/python/parser.js +0 -4
  44. package/dist/internal/extractor/adapters/python/scanner.d.ts +0 -18
  45. package/dist/internal/extractor/adapters/python/scanner.js +1 -54
  46. package/dist/internal/extractor/adapters/typescript/index.d.ts +0 -7
  47. package/dist/internal/extractor/adapters/typescript/index.js +1 -21
  48. package/dist/internal/extractor/adapters/typescript/manifest.d.ts +0 -14
  49. package/dist/internal/extractor/adapters/typescript/manifest.js +1 -20
  50. package/dist/internal/extractor/adapters/typescript/parser.d.ts +0 -8
  51. package/dist/internal/extractor/adapters/typescript/parser.js +0 -9
  52. package/dist/internal/extractor/adapters/typescript/scanner.d.ts +0 -24
  53. package/dist/internal/extractor/adapters/typescript/scanner.js +0 -43
  54. package/dist/internal/extractor/graph-builder.d.ts +0 -25
  55. package/dist/internal/extractor/graph-builder.js +1 -39
  56. package/dist/internal/extractor/graph-types.d.ts +0 -10
  57. package/dist/internal/extractor/graph-types.js +0 -11
  58. package/dist/internal/extractor/index.d.ts +0 -14
  59. package/dist/internal/extractor/index.js +0 -13
  60. package/dist/internal/extractor/types.d.ts +0 -45
  61. package/dist/internal/extractor/types.js +0 -27
  62. package/dist/internal/extractor/walker.d.ts +0 -18
  63. package/dist/internal/extractor/walker.js +0 -18
  64. package/dist/internal/github-linkage-prompt.d.ts +0 -19
  65. package/dist/internal/github-linkage-prompt.js +1 -27
  66. package/dist/internal/ide-setup.d.ts +0 -23
  67. package/dist/internal/ide-setup.js +0 -53
  68. package/dist/internal/orgs.js +0 -1
  69. package/dist/internal/project-binding.d.ts +0 -1
  70. package/dist/internal/project-binding.js +0 -5
  71. package/dist/internal/target-auth/api-config.d.ts +0 -17
  72. package/dist/internal/target-auth/api-config.js +0 -18
  73. package/dist/internal/target-auth/config.d.ts +0 -12
  74. package/dist/internal/target-auth/config.js +0 -13
  75. package/dist/internal/target-auth/index.d.ts +0 -18
  76. package/dist/internal/target-auth/index.js +0 -19
  77. package/dist/internal/target-auth/keychain.d.ts +0 -18
  78. package/dist/internal/target-auth/keychain.js +3 -23
  79. package/dist/internal/target-auth/types.d.ts +0 -26
  80. package/dist/internal/target-auth/types.js +0 -10
  81. package/dist/internal/target-auth/workos.d.ts +0 -15
  82. package/dist/internal/target-auth/workos.js +0 -17
  83. package/package.json +22 -13
  84. package/dist/commands/app/index.js.map +0 -1
  85. package/dist/commands/auth/bind.js.map +0 -1
  86. package/dist/commands/auth/index.js.map +0 -1
  87. package/dist/commands/auth/init.js.map +0 -1
  88. package/dist/commands/auth/login.js.map +0 -1
  89. package/dist/commands/auth/logout.js.map +0 -1
  90. package/dist/commands/auth/sessions.js.map +0 -1
  91. package/dist/commands/auth/status.js.map +0 -1
  92. package/dist/commands/auth/token.js.map +0 -1
  93. package/dist/commands/check/index.js.map +0 -1
  94. package/dist/commands/credits/index.js.map +0 -1
  95. package/dist/commands/inspect/index.js.map +0 -1
  96. package/dist/commands/mcp/index.js.map +0 -1
  97. package/dist/commands/open/index.js.map +0 -1
  98. package/dist/commands/scan/index.js.map +0 -1
  99. package/dist/commands/target/index.js.map +0 -1
  100. package/dist/commands/tm/index.js.map +0 -1
  101. package/dist/index.js.map +0 -1
  102. package/dist/internal/binding-token-mint.js.map +0 -1
  103. package/dist/internal/extractor/adapters/go/index.js.map +0 -1
  104. package/dist/internal/extractor/adapters/go/manifest.js.map +0 -1
  105. package/dist/internal/extractor/adapters/go/parser.js.map +0 -1
  106. package/dist/internal/extractor/adapters/go/scanner.js.map +0 -1
  107. package/dist/internal/extractor/adapters/python/index.js.map +0 -1
  108. package/dist/internal/extractor/adapters/python/manifest.js.map +0 -1
  109. package/dist/internal/extractor/adapters/python/parser.js.map +0 -1
  110. package/dist/internal/extractor/adapters/python/scanner.js.map +0 -1
  111. package/dist/internal/extractor/adapters/typescript/index.js.map +0 -1
  112. package/dist/internal/extractor/adapters/typescript/manifest.js.map +0 -1
  113. package/dist/internal/extractor/adapters/typescript/parser.js.map +0 -1
  114. package/dist/internal/extractor/adapters/typescript/scanner.js.map +0 -1
  115. package/dist/internal/extractor/graph-builder.js.map +0 -1
  116. package/dist/internal/extractor/graph-types.js.map +0 -1
  117. package/dist/internal/extractor/index.js.map +0 -1
  118. package/dist/internal/extractor/types.js.map +0 -1
  119. package/dist/internal/extractor/walker.js.map +0 -1
  120. package/dist/internal/github-linkage-prompt.js.map +0 -1
  121. package/dist/internal/ide-setup.js.map +0 -1
  122. package/dist/internal/orgs.js.map +0 -1
  123. package/dist/internal/pattern-pack/index.d.ts +0 -123
  124. package/dist/internal/pattern-pack/index.js +0 -230
  125. package/dist/internal/pattern-pack/index.js.map +0 -1
  126. package/dist/internal/project-binding.js.map +0 -1
  127. package/dist/internal/target-auth/api-config.js.map +0 -1
  128. package/dist/internal/target-auth/config.js.map +0 -1
  129. package/dist/internal/target-auth/index.js.map +0 -1
  130. package/dist/internal/target-auth/keychain.js.map +0 -1
  131. package/dist/internal/target-auth/types.js.map +0 -1
  132. package/dist/internal/target-auth/workos.js.map +0 -1
  133. package/dist/pattern-packs/zivis-public-0.1.0/capsules/agents/privilege-separation.yaml +0 -228
  134. package/dist/pattern-packs/zivis-public-0.1.0/manifest.json +0 -31
  135. package/dist/pattern-packs/zivis-public-0.1.0/prompts/agents/privilege-separation/identify.md +0 -54
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 ADDED
@@ -0,0 +1,31 @@
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).
@@ -1,10 +1,2 @@
1
1
  import type { Command } from "commander";
2
- /**
3
- * Phase J.4 command group. The customer-facing primitive is "Application" —
4
- * the thing they built and want tested. This group replaces the older
5
- * `zivis target` set: same keychain layout, but auth config is pulled from
6
- * the platform instead of read from a local file. Teammates discover an
7
- * Application's IdP by querying the API; their tokens still stay in their
8
- * own keychain.
9
- */
10
2
  export declare function registerAppCommands(program: Command): void;
@@ -5,14 +5,6 @@ import { getStorageName } from "../../internal/target-auth/keychain.js";
5
5
  import { decodeJwtPayload } from "../../internal/target-auth/workos.js";
6
6
  import { fetchAuthConfig } from "../../internal/target-auth/api-config.js";
7
7
  const DEFAULT_PERSONA = "default";
8
- /**
9
- * Phase J.4 command group. The customer-facing primitive is "Application" —
10
- * the thing they built and want tested. This group replaces the older
11
- * `zivis target` set: same keychain layout, but auth config is pulled from
12
- * the platform instead of read from a local file. Teammates discover an
13
- * Application's IdP by querying the API; their tokens still stay in their
14
- * own keychain.
15
- */
16
8
  export function registerAppCommands(program) {
17
9
  const app = program
18
10
  .command("app")
@@ -71,9 +63,6 @@ export function registerAppCommands(program) {
71
63
  baseUrl: opts.baseUrl,
72
64
  type: opts.type,
73
65
  useEphemeralCreds: useEphemeral,
74
- // PKCE-only public-client mode is the whole reason for ephemeral creds —
75
- // require oauth_pkce as the auth type. Non-PKCE flows (static_token,
76
- // client_credentials, bearer_refresh) need their own subcommands.
77
66
  authType: "oauth_pkce",
78
67
  };
79
68
  if (opts.description)
@@ -242,4 +231,3 @@ function buildClient(opts) {
242
231
  const config = opts.session ? { ...resolveConfigFromBinding(process.cwd()), session: opts.session } : resolveConfigFromBinding(process.cwd());
243
232
  return new ApiClient(config);
244
233
  }
245
- //# sourceMappingURL=index.js.map
@@ -1,13 +1,3 @@
1
- /**
2
- * zivis auth bind
3
- *
4
- * **Explicit** mint-only command: OAuth once, POST /api/auth/bind, persist apikey.<session>.
5
- * After `zivis auth login`, the same mint usually runs automatically when the repo is bound.
6
- * Use `bind` to repair a missing MCP key without re-running full login prompts, or force a
7
- * mint when auto-mint failed.
8
- *
9
- * OAuth from this command is discarded after minting — MCP uses the minted WorkOS API key.
10
- */
11
1
  export interface BindCmdOpts {
12
2
  yes?: boolean;
13
3
  }
@@ -1,13 +1,3 @@
1
- /**
2
- * zivis auth bind
3
- *
4
- * **Explicit** mint-only command: OAuth once, POST /api/auth/bind, persist apikey.<session>.
5
- * After `zivis auth login`, the same mint usually runs automatically when the repo is bound.
6
- * Use `bind` to repair a missing MCP key without re-running full login prompts, or force a
7
- * mint when auto-mint failed.
8
- *
9
- * OAuth from this command is discarded after minting — MCP uses the minted WorkOS API key.
10
- */
11
1
  import { login } from "@zivis/mcp/auth";
12
2
  import { keychainClearSession } from "@zivis/mcp/auth";
13
3
  import { detectProjectBinding, resolveConfigFromBinding } from "@zivis/mcp/project-binding";
@@ -105,4 +95,3 @@ export async function bindCommand(opts) {
105
95
  console.log("");
106
96
  process.exit(0);
107
97
  }
108
- //# sourceMappingURL=bind.js.map
@@ -64,4 +64,3 @@ export function registerAuthCommands(program) {
64
64
  await tokenCommand(apiKey, opts);
65
65
  });
66
66
  }
67
- //# sourceMappingURL=index.js.map
@@ -8,11 +8,6 @@ import { discardOauthAfterLogin, tryAutoMintBindingTokenAfterLogin, } from "../.
8
8
  import { decodeJwtPayload } from "@zivis/mcp/auth/jwt";
9
9
  import { detectIdesInRepo, writeGuidance } from "../../internal/ide-setup.js";
10
10
  import { buildLinkagePrompt } from "../../internal/github-linkage-prompt.js";
11
- /**
12
- * Print the GitHub App / repo linkage nudge if the user hasn't installed
13
- * it yet. Best-effort; swallows errors. Shared between the two
14
- * successful-init paths below.
15
- */
16
11
  async function maybePromptGitHubLinkage(config) {
17
12
  try {
18
13
  const msg = await buildLinkagePrompt({ config });
@@ -20,7 +15,6 @@ async function maybePromptGitHubLinkage(config) {
20
15
  console.log(msg);
21
16
  }
22
17
  catch {
23
- // Swallow — init has already succeeded.
24
18
  }
25
19
  }
26
20
  async function prompt(question) {
@@ -32,10 +26,6 @@ async function prompt(question) {
32
26
  rl.close();
33
27
  }
34
28
  }
35
- /**
36
- * After project binding succeeds, offer to write IDE guidance files.
37
- * This is the prime moment to ask — the user is already in setup mode.
38
- */
39
29
  async function offerGuidanceInstall(cwd) {
40
30
  const detectedIdes = detectIdesInRepo(cwd);
41
31
  if (detectedIdes.length === 0)
@@ -73,8 +63,6 @@ async function offerGuidanceInstall(cwd) {
73
63
  }
74
64
  }
75
65
  export async function initCommand(opts) {
76
- // Prefer URL config from the existing project binding (if any) so that
77
- // re-running `zivis auth init` in a staging repo hits staging automatically.
78
66
  const config = {
79
67
  ...DEFAULT_CONFIG,
80
68
  ...resolveConfigFromBinding(process.cwd()),
@@ -83,7 +71,6 @@ export async function initCommand(opts) {
83
71
  const envLabel = config.apiBaseUrl.includes("staging") ? "staging" : "production";
84
72
  console.log(`Environment: ${envLabel} (${config.apiBaseUrl})`);
85
73
  console.log("");
86
- // Step 1: Open browser — no org pre-selection. User picks the org in their browser.
87
74
  console.log("Opening browser for authentication...");
88
75
  console.log("Log into the org you want to bind this project to.\n");
89
76
  let tokens;
@@ -95,11 +82,9 @@ export async function initCommand(opts) {
95
82
  process.exit(1);
96
83
  }
97
84
  const email = extractEmail(tokens.id_token);
98
- // Step 2: Determine which org the JWT is scoped to
99
85
  const claims = decodeJwtPayload(tokens.access_token);
100
86
  const jwtOrgId = claims?.org_id;
101
87
  if (jwtOrgId) {
102
- // Look up org name before confirming
103
88
  let orgName;
104
89
  try {
105
90
  const orgs = await fetchUserOrgs(config, tokens.access_token);
@@ -131,7 +116,6 @@ export async function initCommand(opts) {
131
116
  console.error("Login failed:", err instanceof Error ? err.message : err);
132
117
  process.exit(1);
133
118
  }
134
- // Recurse by re-entering the confirmation flow with the new tokens
135
119
  tokens = retryTokens;
136
120
  const retryClaims = decodeJwtPayload(retryTokens.access_token);
137
121
  const retryOrgId = retryClaims?.org_id;
@@ -205,8 +189,6 @@ export async function initCommand(opts) {
205
189
  await maybePromptGitHubLinkage(config);
206
190
  }
207
191
  else {
208
- // No org in JWT — user is authenticated but not scoped to an org yet.
209
- // Fetch orgs and let them pick, then do a scoped login.
210
192
  console.log("\nYour account isn't scoped to a specific org yet.");
211
193
  console.log("Fetching your organizations...\n");
212
194
  let orgs;
@@ -286,4 +268,3 @@ export async function initCommand(opts) {
286
268
  }
287
269
  process.exit(0);
288
270
  }
289
- //# sourceMappingURL=init.js.map
@@ -4,7 +4,6 @@ export interface LoginCmdOpts {
4
4
  yes?: boolean;
5
5
  bind?: boolean;
6
6
  noBind?: boolean;
7
- /** CLI `--skip-mint-key`: do not POST /auth/bind after OAuth succeeds */
8
7
  skipMintKey?: boolean;
9
8
  }
10
9
  export declare function loginCommand(opts: LoginCmdOpts): Promise<void>;
@@ -73,18 +73,13 @@ export async function loginCommand(opts) {
73
73
  skip: opts.skipMintKey === true,
74
74
  warnOnFailure: true,
75
75
  });
76
- // OAuth has done its job (mint, org verify). MCP only reads apikey.<session>,
77
- // so any OAuth tokens left in the keychain are dead weight + drift risk.
78
76
  await discardOauthAfterLogin({ session, config });
79
- // Nudge the user to install the GitHub App if they haven't yet.
80
- // Best-effort — never fails the login.
81
77
  try {
82
78
  const linkagePrompt = await buildLinkagePrompt({ config });
83
79
  if (linkagePrompt)
84
80
  console.log(linkagePrompt);
85
81
  }
86
82
  catch {
87
- // Swallow — login already succeeded.
88
83
  }
89
84
  process.exit(0);
90
85
  }
@@ -93,4 +88,3 @@ export async function loginCommand(opts) {
93
88
  process.exit(1);
94
89
  }
95
90
  }
96
- //# sourceMappingURL=login.js.map
@@ -8,9 +8,7 @@ export async function logoutCommand(opts) {
8
8
  const sessionName = opts.session ??
9
9
  detectProjectBinding(process.cwd())?.binding.session;
10
10
  if (sessionName) {
11
- // Clear OAuth tokens for the session
12
11
  await keychainClearSession(sessionName, st);
13
- // Also clear the Local Project Binding Token stored as apikey.<session>.
14
12
  const apiKeyAccount = `apikey.${sessionName}`;
15
13
  const hadApiKey = !!(await keychainRead(apiKeyAccount, st).catch(() => null));
16
14
  if (hadApiKey) {
@@ -26,4 +24,3 @@ export async function logoutCommand(opts) {
26
24
  console.log("✓ Default credentials cleared");
27
25
  console.log(" Note: Named sessions are not affected. Use 'zivis auth sessions' to list them.");
28
26
  }
29
- //# sourceMappingURL=logout.js.map
@@ -31,4 +31,3 @@ export async function sessionsCommand(opts) {
31
31
  console.log("To use a session in a project, add to .mcp.json:");
32
32
  console.log(' "env": { "ZIVIS_SESSION": "<session-name>" }');
33
33
  }
34
- //# sourceMappingURL=sessions.js.map
@@ -33,7 +33,6 @@ export async function statusCommand(opts) {
33
33
  const masked = key.startsWith("sk_")
34
34
  ? `${key.slice(0, 10)}...${key.slice(-4)}`
35
35
  : "***";
36
- // Determine source: Local Project Binding Token (apikey.<session>), env var, or global key.
37
36
  const sessionApiKeyAccount = session ? `apikey.${session}` : null;
38
37
  const isSessionKey = sessionApiKeyAccount
39
38
  ? !!(await keychainRead(sessionApiKeyAccount, st))
@@ -73,4 +72,3 @@ export async function statusCommand(opts) {
73
72
  }
74
73
  console.log(`API: ${resolveConfig.apiBaseUrl}`);
75
74
  }
76
- //# sourceMappingURL=status.js.map
@@ -1,16 +1,3 @@
1
- /**
2
- * zivis auth token
3
- *
4
- * Store a ZIVIS API access token in the OS keychain for a named session.
5
- * API tokens are the preferred auth method for the MCP server and CI pipelines
6
- * — they don't expire and don't require browser interaction.
7
- *
8
- * Usage:
9
- * zivis auth token sk_<...> # default session
10
- * zivis auth token sk_<...> --session zivis # named session
11
- *
12
- * Tokens are generated in the ZIVIS platform: Settings → API Tokens
13
- */
14
1
  export interface TokenCmdOpts {
15
2
  session?: string;
16
3
  }
@@ -1,16 +1,3 @@
1
- /**
2
- * zivis auth token
3
- *
4
- * Store a ZIVIS API access token in the OS keychain for a named session.
5
- * API tokens are the preferred auth method for the MCP server and CI pipelines
6
- * — they don't expire and don't require browser interaction.
7
- *
8
- * Usage:
9
- * zivis auth token sk_<...> # default session
10
- * zivis auth token sk_<...> --session zivis # named session
11
- *
12
- * Tokens are generated in the ZIVIS platform: Settings → API Tokens
13
- */
14
1
  import { keychainStore, getStorageName } from "@zivis/mcp/auth";
15
2
  import { detectProjectBinding, resolveConfigFromBinding } from "@zivis/mcp/project-binding";
16
3
  import { DEFAULT_CONFIG, credentialStorageFromConfig } from "@zivis/mcp/types";
@@ -23,14 +10,12 @@ function validateKeyFormat(key) {
23
10
  return API_KEY_REGEX.test(key);
24
11
  }
25
12
  export async function tokenCommand(apiKey, opts) {
26
- // Validate format
27
13
  if (!validateKeyFormat(apiKey)) {
28
14
  console.error(`Invalid API token format. Expected: ${API_KEY_PREFIX}<token value>`);
29
15
  console.error(`Got: ${apiKey.substring(0, 20)}...`);
30
16
  console.error(`\nGenerate a token at: Settings → API Tokens in the ZIVIS platform.`);
31
17
  process.exit(1);
32
18
  }
33
- // Determine session from opts or project binding
34
19
  const cwd = process.cwd();
35
20
  const detected = detectProjectBinding(cwd);
36
21
  const session = opts.session ?? detected?.binding.session;
@@ -65,7 +50,6 @@ export async function tokenCommand(apiKey, opts) {
65
50
  console.log(` Tip: Run with --session ${detected.binding.session} to scope this token to that org.`);
66
51
  }
67
52
  }
68
- // Optionally verify the key works against the API
69
53
  try {
70
54
  const response = await fetch(`${config.apiBaseUrl}/api/mcp/session`, {
71
55
  headers: { "X-API-Key": apiKey, "User-Agent": "@zivis/cli" },
@@ -83,9 +67,7 @@ export async function tokenCommand(apiKey, opts) {
83
67
  }
84
68
  }
85
69
  catch {
86
- // Network error — token is stored, just couldn't verify
87
70
  console.log(`\n Note: Could not reach the ZIVIS API to verify the token (stored anyway).`);
88
71
  }
89
72
  process.exit(0);
90
73
  }
91
- //# sourceMappingURL=token.js.map
@@ -1,20 +1,2 @@
1
- /**
2
- * `zivis check` — the user-facing front door.
3
- *
4
- * Flow:
5
- * 1. Resolve auth (interactive sign-up/in menu in TTY; CI must have ZIVIS_API_KEY).
6
- * 2. Build the local repo graph (same extractor as `zivis inspect`).
7
- * 3. Persist the artifact to the user cache so the matcher (and any
8
- * subsequent IDE-side `zivis_inspect`) can read it.
9
- * 4. Run the local pattern matcher against the artifact + source files.
10
- * 5. POST artifact + matches to `/api/cli/check`, which promotes them
11
- * into the platform threat model (components, data flows, actors,
12
- * findings, scenarios + kill-chain).
13
- * 6. Render a summary that tells the user what landed in their threat
14
- * model and where to view it.
15
- *
16
- * Spec: docs/plans/ZIVIS-CHECK-CLI-SPEC.md
17
- * Bridge: zivis-api/services/cli-check-promotion.service.ts
18
- */
19
1
  import type { Command } from "commander";
20
2
  export declare function registerCheckCommands(program: Command): void;
@@ -1,21 +1,3 @@
1
- /**
2
- * `zivis check` — the user-facing front door.
3
- *
4
- * Flow:
5
- * 1. Resolve auth (interactive sign-up/in menu in TTY; CI must have ZIVIS_API_KEY).
6
- * 2. Build the local repo graph (same extractor as `zivis inspect`).
7
- * 3. Persist the artifact to the user cache so the matcher (and any
8
- * subsequent IDE-side `zivis_inspect`) can read it.
9
- * 4. Run the local pattern matcher against the artifact + source files.
10
- * 5. POST artifact + matches to `/api/cli/check`, which promotes them
11
- * into the platform threat model (components, data flows, actors,
12
- * findings, scenarios + kill-chain).
13
- * 6. Render a summary that tells the user what landed in their threat
14
- * model and where to view it.
15
- *
16
- * Spec: docs/plans/ZIVIS-CHECK-CLI-SPEC.md
17
- * Bridge: zivis-api/services/cli-check-promotion.service.ts
18
- */
19
1
  import * as crypto from "node:crypto";
20
2
  import * as readline from "node:readline";
21
3
  import * as fs from "node:fs/promises";
@@ -32,7 +14,6 @@ import { buildRepoGraphArtifact } from "../../internal/extractor/graph-builder.j
32
14
  import { loginCommand } from "../auth/login.js";
33
15
  import { buildLinkagePrompt } from "../../internal/github-linkage-prompt.js";
34
16
  const execAsync = promisify(exec);
35
- // Packages whose presence indicates an LLM integration (for the local summary).
36
17
  const LLM_PACKAGE_NAMES = new Set([
37
18
  "openai",
38
19
  "@anthropic-ai/sdk",
@@ -74,9 +55,8 @@ export function registerCheckCommands(program) {
74
55
  async function runCheck(opts) {
75
56
  const rootDir = opts.cwd ?? process.cwd();
76
57
  const format = opts.format === "json" ? "json" : "human";
77
- const network = opts.network !== false; // --no-network sets to false
58
+ const network = opts.network !== false;
78
59
  const config = { ...DEFAULT_CONFIG, ...resolveConfigFromBinding(rootDir) };
79
- // 1. Auth gate.
80
60
  const authStatus = await resolveAuth(config);
81
61
  if (authStatus.method === "none") {
82
62
  const handled = await handleUnauthenticated({ format, config });
@@ -90,7 +70,6 @@ async function runCheck(opts) {
90
70
  }
91
71
  }
92
72
  const creds = await resolveAuth(config);
93
- // 2. Build the graph.
94
73
  const startedAt = Date.now();
95
74
  const extractorOutput = await runExtractor({
96
75
  rootDir,
@@ -107,23 +86,18 @@ async function runCheck(opts) {
107
86
  branch: gitMeta.branch,
108
87
  analysisMode: "local",
109
88
  });
110
- // 3. Persist artifact to user cache so the matcher can read it.
111
89
  const artifactPath = await writeArtifactToCache(artifact);
112
- // 4. Run the local matcher.
113
90
  let matcherFindings = [];
114
91
  try {
115
92
  const matcherResult = await runMatcher({ artifactPath, cwd: rootDir });
116
93
  matcherFindings = matcherResult.findings;
117
94
  }
118
95
  catch (err) {
119
- // Matcher failure shouldn't abort — the graph + server promotion is
120
- // still valuable. Surface in stderr, keep going.
121
96
  const msg = err instanceof Error ? err.message : String(err);
122
97
  process.stderr.write(`\n[zivis check] matcher failed (continuing without pattern matches): ${msg}\n`);
123
98
  }
124
99
  const durationMs = Date.now() - startedAt;
125
100
  const summary = summarizeArtifact(artifact, matcherFindings);
126
- // 5. POST to the server unless --no-network.
127
101
  let promotion;
128
102
  let promotionError;
129
103
  if (network) {
@@ -140,12 +114,6 @@ async function runCheck(opts) {
140
114
  promotionError = err instanceof Error ? err.message : String(err);
141
115
  }
142
116
  }
143
- // 6. GitHub linkage nudge — non-blocking, network-gated. Surfaces:
144
- // a) "install the GitHub App" if the org hasn't yet, OR
145
- // b) "link a repo to this application" if the app is bound but
146
- // has no repos linked yet.
147
- // Prefer the just-promoted application id (may have been auto-created
148
- // by the POST) over the project-binding id when both are available.
149
117
  let linkagePrompt = null;
150
118
  if (network) {
151
119
  try {
@@ -155,10 +123,8 @@ async function runCheck(opts) {
155
123
  });
156
124
  }
157
125
  catch {
158
- // Best-effort; never blocks the check output.
159
126
  }
160
127
  }
161
- // 7. Render.
162
128
  if (format === "json") {
163
129
  process.stdout.write(JSON.stringify(buildJsonOutput(artifact, summary, durationMs, promotion, promotionError, network, linkagePrompt), null, 2) + "\n");
164
130
  }
@@ -341,7 +307,6 @@ function friendlyLlmName(pkg) {
341
307
  return "vercel-ai";
342
308
  return pkg;
343
309
  }
344
- // ── Rendering ──
345
310
  function renderHumanOutput(_artifact, summary, durationMs, promotion, promotionError, network, linkagePrompt) {
346
311
  const seconds = (durationMs / 1000).toFixed(1);
347
312
  let out = `\nZIVIS read your repo (${seconds}s):\n\n`;
@@ -496,4 +461,3 @@ function formatRunId(commitSha, extractedAt) {
496
461
  return `nogit-${compactTs}`;
497
462
  return `${commitSha.slice(0, 7)}-${compactTs}`;
498
463
  }
499
- //# sourceMappingURL=index.js.map
@@ -48,4 +48,3 @@ export function registerCreditsCommands(program) {
48
48
  }
49
49
  });
50
50
  }
51
- //# sourceMappingURL=index.js.map