@atbash/cli 0.5.15-dev.8 → 0.6.0-dev.1

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 (58) hide show
  1. package/README.md +287 -26
  2. package/dist/bin/atbash.js +31 -5
  3. package/dist/bin/atbash.js.map +1 -1
  4. package/dist/commands/connect.d.ts +40 -50
  5. package/dist/commands/connect.js +60 -108
  6. package/dist/commands/connect.js.map +1 -1
  7. package/dist/commands/github-scan.d.ts +104 -0
  8. package/dist/commands/github-scan.js +1054 -0
  9. package/dist/commands/github-scan.js.map +1 -0
  10. package/dist/commands/held.js +7 -2
  11. package/dist/commands/held.js.map +1 -1
  12. package/dist/commands/history.js +4 -1
  13. package/dist/commands/history.js.map +1 -1
  14. package/dist/commands/judge-options.d.ts +21 -0
  15. package/dist/commands/judge-options.js +24 -0
  16. package/dist/commands/judge-options.js.map +1 -0
  17. package/dist/commands/judge.js +4 -1
  18. package/dist/commands/judge.js.map +1 -1
  19. package/dist/commands/policy.js +4 -1
  20. package/dist/commands/policy.js.map +1 -1
  21. package/dist/commands/scan.d.ts +45 -0
  22. package/dist/commands/scan.js +301 -0
  23. package/dist/commands/scan.js.map +1 -0
  24. package/dist/commands/setup.d.ts +1 -209
  25. package/dist/commands/setup.js +128 -947
  26. package/dist/commands/setup.js.map +1 -1
  27. package/dist/commands/stats.js +3 -1
  28. package/dist/commands/stats.js.map +1 -1
  29. package/dist/commands/status.js +4 -1
  30. package/dist/commands/status.js.map +1 -1
  31. package/dist/commands/tier.js +4 -1
  32. package/dist/commands/tier.js.map +1 -1
  33. package/dist/commands/tools.js +11 -4
  34. package/dist/commands/tools.js.map +1 -1
  35. package/dist/commands/whoami.js +4 -1
  36. package/dist/commands/whoami.js.map +1 -1
  37. package/dist/lib/grade-llm.d.ts +38 -0
  38. package/dist/lib/grade-llm.js +64 -0
  39. package/dist/lib/grade-llm.js.map +1 -0
  40. package/dist/lib/llm.d.ts +34 -0
  41. package/dist/lib/llm.js +101 -0
  42. package/dist/lib/llm.js.map +1 -0
  43. package/dist/lib/policy.d.ts +40 -0
  44. package/dist/lib/policy.js +94 -0
  45. package/dist/lib/policy.js.map +1 -0
  46. package/dist/lib/risk.d.ts +112 -0
  47. package/dist/lib/risk.js +288 -0
  48. package/dist/lib/risk.js.map +1 -0
  49. package/dist/lib/threats-llm.d.ts +39 -0
  50. package/dist/lib/threats-llm.js +72 -0
  51. package/dist/lib/threats-llm.js.map +1 -0
  52. package/package.json +4 -4
  53. package/dist/commands/mcp-cmd.d.ts +0 -13
  54. package/dist/commands/mcp-cmd.js +0 -216
  55. package/dist/commands/mcp-cmd.js.map +0 -1
  56. package/dist/shared/atbash-targets.d.ts +0 -49
  57. package/dist/shared/atbash-targets.js +0 -63
  58. package/dist/shared/atbash-targets.js.map +0 -1
package/README.md CHANGED
@@ -139,6 +139,168 @@ atbash judge 'grant admin access to CI service account'
139
139
  The agent cannot retry or self-unjail. An operator must review and release at [https://atbash.ai/](https://atbash.ai/).
140
140
 
141
141
 
142
+ ## Local scan
143
+
144
+ `atbash scan` reports what is installed on this machine. It needs no account, no pairing code and no dashboard. The report is printed in your terminal and is never uploaded.
145
+
146
+ ```bash
147
+ # What is installed here
148
+ atbash scan
149
+
150
+ # Ask each MCP server what tools it actually has
151
+ atbash scan --introspect
152
+
153
+ # Add a draft boundary: red lines and actions that need approval
154
+ atbash scan --introspect --policy
155
+
156
+ # Machine-readable output
157
+ atbash scan --introspect --json
158
+ ```
159
+
160
+ Output:
161
+
162
+ ```
163
+ Atbash local scan
164
+ ────────────────────────────
165
+ Machine : my-laptop
166
+ Found : 1 runtime
167
+
168
+ OpenClaw — 5 skills / plugins
169
+ • delete-customer-records
170
+ • export-crm-contacts
171
+ • issue-refund
172
+ • list-tickets
173
+ • send-email
174
+
175
+ Risk
176
+ ────────────────────────────
177
+ Level : High (92/100)
178
+ Method : deterministic
179
+ 5 authorized action paths (3 high-severity).
180
+
181
+ high delete-customer-records — destructive action
182
+ irreversible data/infrastructure loss
183
+ high export-crm-contacts — data access / egress
184
+ data leakage / privacy breach
185
+ high issue-refund — financial
186
+ direct financial loss
187
+ medium send-email — external communication
188
+ external message sent on the owner's behalf (monitored)
189
+ low list-tickets — read / research
190
+ low-consequence information access
191
+ ```
192
+
193
+ With `--policy` it also prints a draft boundary you can edit and enforce:
194
+
195
+ ```
196
+ Recommended boundary
197
+ ────────────────────────────
198
+ Red lines (auto-deny)
199
+ • Never perform destructive action autonomously (e.g. delete-customer-records).
200
+ • Never perform data access / egress autonomously (e.g. export-crm-contacts).
201
+ • Never modify its own mandate, red lines, or authority.
202
+
203
+ Needs approval
204
+ • Require human approval before financial (e.g. issue-refund).
205
+ ```
206
+
207
+ ### What leaves your machine
208
+
209
+ Nothing, unless you ask for it.
210
+
211
+ | Command | Requests sent |
212
+ | --- | --- |
213
+ | `atbash scan` | none |
214
+ | `--introspect` | one per MCP server configured with an `http` URL, sent to that URL |
215
+ | `--api-key` | one, to your LLM provider |
216
+ | `--threats` | one, to your LLM provider |
217
+
218
+ Nothing is ever sent to Atbash. `--json` reports the actual count as `networkRequests`, so you can check it.
219
+
220
+ Credentials found in your config files are removed before anything is printed or sent. That covers `env` values, `headers`, tokens, and secrets embedded in command paths.
221
+
222
+ ### Using your own LLM key
223
+
224
+ The built-in rules classify tools by name and description. Some tools match no rule. Supply your own [OpenRouter](https://openrouter.ai) key and the CLI will grade those as well. With `--threats` it also looks for risks that only appear when tools are combined, such as reading customer data and sending mail.
225
+
226
+ The key is read from the first of these that is set:
227
+
228
+ 1. `--api-key <key>`
229
+ 2. `ATBASH_SCAN_API_KEY`
230
+ 3. `OPENROUTER_API_KEY`
231
+
232
+ On a shared machine, use an environment variable rather than `--api-key`. Command arguments are visible to other users through `ps`.
233
+
234
+ First get a key from [openrouter.ai/settings/keys](https://openrouter.ai/settings/keys). It looks like `sk-or-v1-` followed by 64 hex characters.
235
+
236
+ **macOS keychain.** The keychain stores every secret under the name "password", so the prompt says `password data for new item:`. That is where the API key goes. Do not type a login password.
237
+
238
+ ```bash
239
+ security add-generic-password -a "$USER" -s atbash-openrouter -U -w
240
+ ```
241
+
242
+ It prompts twice:
243
+
244
+ ```
245
+ password data for new item: <- paste the sk-or-v1-... key
246
+ retype password for new item: <- paste it again
247
+ ```
248
+
249
+ Nothing is echoed as you paste, and the two entries must match or it fails with `passwords don't match`. Check what actually got stored:
250
+
251
+ ```bash
252
+ v=$(security find-generic-password -a "$USER" -s atbash-openrouter -w); echo "${#v} chars, starts ${v:0:9}"
253
+ # expect: 73 chars, starts sk-or-v1-
254
+ ```
255
+
256
+ If that prints anything else, the wrong value was stored. Run the `add` command again; `-U` overwrites it.
257
+
258
+ Then use it:
259
+
260
+ ```bash
261
+ export ATBASH_SCAN_API_KEY="$(security find-generic-password -a "$USER" -s atbash-openrouter -w)"
262
+ atbash scan --introspect --threats --policy
263
+ ```
264
+
265
+ **Linux, or anywhere without a keychain.** Use a file only you can read:
266
+
267
+ ```bash
268
+ mkdir -p ~/.config/atbash && chmod 700 ~/.config/atbash
269
+ (umask 077; touch ~/.config/atbash/openrouter.key)
270
+ $EDITOR ~/.config/atbash/openrouter.key # paste the key, save
271
+
272
+ export ATBASH_SCAN_API_KEY="$(cat ~/.config/atbash/openrouter.key)"
273
+ ```
274
+
275
+ **CI.** Store the key as a repository secret and map it to the environment variable. Never put it in a file in the repo.
276
+
277
+ ```yaml
278
+ - run: atbash scan --introspect --fail-on high
279
+ env:
280
+ ATBASH_SCAN_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
281
+ ```
282
+
283
+ Pick a different model with `--model <id>`. The default is `z-ai/glm-5.3-flash`.
284
+
285
+ If the key is missing, wrong, or the provider is down, the scan still finishes using the built-in grading and tells you what failed. You never lose the report.
286
+
287
+ ### Use in CI
288
+
289
+ `--fail-on` turns the risk level into an exit code.
290
+
291
+ ```bash
292
+ atbash scan --introspect --fail-on high
293
+ ```
294
+
295
+ | Exit code | Meaning |
296
+ | --- | --- |
297
+ | 0 | risk level is below the threshold |
298
+ | 1 | risk level reached the threshold |
299
+ | 2 | the `--fail-on` value was not `low`, `elevated` or `high` |
300
+
301
+ Run the gate without an API key. Built-in grading returns the same answer every time. Model grading varies between runs, which would make the gate flaky.
302
+
303
+
142
304
  ## End-to-end example: guarding a production deploy
143
305
 
144
306
  A CI agent is about to apply a database migration to production. The operator policy holds all production applies for review before execution.
@@ -331,6 +493,29 @@ If any check fails — an integrity value that does not match the deployment's m
331
493
 
332
494
  ## Command reference
333
495
 
496
+ ### `atbash scan`
497
+
498
+ Scan this machine and print the report here. No account and no pairing code. See [Local scan](#local-scan) for the full walkthrough.
499
+
500
+ ```bash
501
+ npx --yes @atbash/cli scan --introspect --policy
502
+ ```
503
+
504
+ | Flag | Description |
505
+ |------|-------------|
506
+ | `--introspect` | Ask each configured MCP server what tools it advertises. Starts stdio servers locally and contacts `http` servers at their own URL. No tool is ever called |
507
+ | `--policy` | Also print a draft boundary: red lines and actions that need approval |
508
+ | `--threats` | Also list risks that come from tools used in combination. Needs an API key |
509
+ | `--api-key <key>` | Your own LLM provider key. Also read from `ATBASH_SCAN_API_KEY` or `OPENROUTER_API_KEY` |
510
+ | `--model <id>` | Model used for grading. Default `z-ai/glm-5.3-flash` |
511
+ | `--fail-on <level>` | Exit 1 when the risk level reaches `low`, `elevated` or `high` |
512
+ | `--json` | Machine-readable output |
513
+ | `--home <dir>` | Home directory to scan (for testing) |
514
+
515
+ Without a key the report is produced entirely on this machine. `--threats` and
516
+ `--api-key` send tool names and descriptions to the provider you chose, never to
517
+ Atbash.
518
+
334
519
  ### `atbash connect <code>`
335
520
 
336
521
  Link a machine to a hosted Atbash onboarding session. A browser can't read your disk and the Atbash server only sees its own, so this runs on the machine you want to govern, enumerates the agents / MCP tools configured there (read-only), and relays their *surface* to your onboarding session via the one-time pairing code shown in the browser.
@@ -397,11 +582,11 @@ Wherever it comes from, the key is written once to
397
582
 
398
583
  - It never transmits the private key. The only network call is a registration
399
584
  check, and that sends the **public** key.
400
- - It never writes the private key into an MCP client config. The entry it writes
401
- points at `atbash mcp`, which reads the key from `guard-client-key` and hands it
402
- to the server through the child process environment — so the config file carries
403
- no credential, and an entry you previously hand-wired with one has the key
404
- removed.
585
+ - It never writes the private key into an MCP client config. The documented
586
+ `@atbash/mcp` wiring carries the key as an `ATBASH_AGENT_PRIVKEY` value inside
587
+ files like `claude_desktop_config.json`, and that package has no key-file
588
+ fallback today. MCP clients are detected and the snippet is printed for you to
589
+ add by hand.
405
590
  - It never edits your application source. Code-level integrations (LangChain,
406
591
  LangGraph, AutoGen, Eliza, the SDK boundary) stay yours to write.
407
592
  - It never rewrites a config that uses comments or trailing commas — reserializing
@@ -413,27 +598,6 @@ Wherever it comes from, the key is written once to
413
598
  Every file it changes is copied to a `.atbash-bak` alongside it first, and repeat
414
599
  runs are idempotent.
415
600
 
416
- ### `atbash mcp`
417
-
418
- Runs the Atbash MCP server, reading the agent key from `~/.config/atbash/guard-client-key` instead of from a config file. You do not normally run this by hand — it is what `atbash setup` puts in your MCP client's server list:
419
-
420
- ```json
421
- { "mcpServers": { "atbash": { "command": "npx", "args": ["--yes", "@atbash/cli", "mcp"] } } }
422
- ```
423
-
424
- | Flag | Description |
425
- |------|-------------|
426
- | `--key-file <path>` | Agent key file to read (default: `~/.config/atbash/guard-client-key`) |
427
- | `--endpoint <url>` | Atbash endpoint the server should use |
428
-
429
- **Why this exists.** `@atbash/mcp` reads its identity from `ATBASH_AGENT_PRIVKEY` and has no key-file fallback, so the wiring in its own docs puts a raw private key inside `claude_desktop_config.json` — a file people sync between machines and paste into help requests. This launcher keeps the key in the 0600 file and passes it to the server through the child process environment, so nothing secret is written to a config file.
430
-
431
- An `ATBASH_AGENT_PRIVKEY` already present in the environment still wins, so if you deliberately inject the key at launch time nothing changes for you.
432
-
433
- **Known issue it works around.** Every published `@atbash/mcp` (0.1.0–0.1.3) fails to start: they import `getOrgTierInfo` as a named export from `@atbash/sdk`, and `@atbash/sdk@0.3.24` removed it, so their `^0.3.19` range resolves to a version that cannot satisfy the import. This launcher installs the compatible pair together (`@atbash/mcp@0.1.3` with `@atbash/sdk@0.3.23`). That pinned SDK is itself deprecated — the real fix is republishing `@atbash/mcp` against `@atbash/sdk@^0.7`.
434
-
435
- First launch takes ~10–15s while npx caches the packages, then about a second. A client with a short startup timeout may fail once and succeed on retry.
436
-
437
601
  ### `atbash judge <action>`
438
602
 
439
603
  Submit a pending action for judgment. The action string is the exact operation the agent is about to execute — a transfer, a command, a mutation.
@@ -553,6 +717,97 @@ Tool Call Details
553
717
  Latency: 2340ms
554
718
  ```
555
719
 
720
+ ### `atbash github-scan`
721
+
722
+ Read-only GitHub inventory and change-risk triage. The scanner calls GitHub's REST
723
+ API directly; it does not invoke the `gh` CLI and it never makes a mutating API
724
+ request.
725
+
726
+ ```bash
727
+ # Use a classic/fine-grained user token or GitHub App installation token with
728
+ # read access to every repository and organization that should be inventoried.
729
+ # Set GITHUB_TOKEN or GH_TOKEN in the process environment; tokens are never
730
+ # accepted as command-line arguments.
731
+
732
+ atbash github-scan --owner Atbash-Ai --expect-repos 13 --since 2026-08-01 --json
733
+ atbash github-scan --repo Atbash-Ai/atbash-cli --branch main
734
+ ```
735
+
736
+ `--owner` and `--repo` are repeatable. `--branch` limits branch inventory,
737
+ commits, and merged-PR base branch. `--since` accepts an ISO-8601 date or
738
+ timestamp and defaults to 30 days. Bots are excluded unless `--include-bots` is
739
+ set. Use `--owner` for scheduled organization audits: without it, `/user/repos`
740
+ intentionally inventories every owner visible to the token, which may include
741
+ private personal or unrelated organization repositories. `--expect-repos`
742
+ makes a known inventory size an exact fail-closed assertion.
743
+
744
+ The command verifies the authenticated user or GitHub App installation, records
745
+ OAuth scopes when GitHub supplies the `X-OAuth-Scopes` header, verifies
746
+ repository metadata permissions and organization visibility, and validates REST
747
+ pagination. A full page without a `Link` header is not accepted as terminal:
748
+ the scanner probes explicit sequential page numbers until a short/empty page or
749
+ a terminal `Link` relation is verified. Duplicate pages/items, changed filters,
750
+ cycles, non-sequential links, and the 1,000-page hard ceiling fail the scan.
751
+ This establishes completeness for the authenticated API view and selected
752
+ filters; it cannot prove that the token was granted access to repositories
753
+ GitHub never exposes to it. GitHub REST pagination is not snapshot-isolated:
754
+ concurrent repository changes can move items between pages. Duplicate/cycle
755
+ checks fail on detectable drift, but the `completeness.snapshotConsistency`
756
+ field explicitly records that snapshot consistency is not guaranteed; rerun a
757
+ scheduled audit if the organization changed during collection.
758
+
759
+ The network contract is GET-only: identity (`/user` or `/installation`),
760
+ repository inventory (`/user/repos` or `/installation/repositories`),
761
+ organization metadata, branches, closed pull requests, PR file metadata,
762
+ commits, commit file metadata, and commit-to-PR associations. Tests reject any
763
+ non-GET request across these paths.
764
+
765
+ JSON output is sorted and schema-versioned. It includes a `completeness` object,
766
+ rate-limit status, public/private counts, branches, recent merged PR metadata,
767
+ commit metadata, changed filenames, and deterministic risk flags.
768
+
769
+ Bound controls fail rather than truncate:
770
+
771
+ - `--max-repos` (default 1,000)
772
+ - `--max-branches` per repository (default 1,000)
773
+ - `--max-prs` recent closed PRs inspected per repository (default 1,000)
774
+ - `--max-commits` per branch (default 1,000)
775
+ - `--max-files` per PR or commit (default 3,000)
776
+
777
+ Lower these for tightly bounded scheduled jobs. Raise them deliberately for a
778
+ larger organization; exceeding any bound exits nonzero without output or state
779
+ advancement.
780
+
781
+ Security and limits:
782
+
783
+ - Set exactly one of `GITHUB_TOKEN` or `GH_TOKEN`; if both differ, the command
784
+ fails. Tokens are held in memory, sent only in the GitHub authorization
785
+ header, and redacted from errors.
786
+ - The scanner never fetches blobs, trees, patches, diffs, or private file
787
+ contents. It reads repository/change metadata and changed filenames. Private
788
+ repository names and filenames still remain sensitive; protect JSON output.
789
+ - Human output exposes authenticated identity, repository names/visibility,
790
+ aggregate counts, and risk-category names. JSON additionally exposes branch
791
+ names, PR titles/authors/timestamps, commit subjects/authors/timestamps, URLs,
792
+ changed filenames, and permission metadata. Treat either output as sensitive;
793
+ redirect JSON only to an access-controlled destination.
794
+ - The complete result is buffered before anything is printed. Authentication,
795
+ permission, malformed response, pagination, REST, or rate-limit failure exits
796
+ nonzero and emits no partial scan. The scanner writes no cursor or checkpoint,
797
+ so a failed run cannot advance state.
798
+ - Risk flags are deterministic path-based triage for Rell/contracts,
799
+ encryption/keys/auth, decision semantics, SDK/plugin APIs,
800
+ workflows/releases/dependencies, and direct commits detected on protected
801
+ branches. They are not semantic code analysis and are explicitly **not a full
802
+ SAST assessment**.
803
+ - Direct-commit detection asks GitHub whether a protected-branch commit belongs
804
+ to a merged PR. Branch rules, merge queues, force pushes, and GitHub's
805
+ commit-to-PR association can limit that inference.
806
+ - Fine-grained tokens and GitHub App installations should receive read-only
807
+ metadata, contents, pull-request, and organization access as applicable.
808
+ GitHub may not report named scopes for these token types; successful endpoint
809
+ access is the permission check.
810
+
556
811
  ### `atbash whoami` / `atbash policy show` / `atbash tier`
557
812
 
558
813
  Inspect the current agent's identity, assigned policy, and org tier.
@@ -638,7 +893,13 @@ atbash unset endpoint
638
893
  | Agent key | `--agent-key` | `ATBASH_AGENT_KEY` | `atbash set agent-key <hex>` |
639
894
  | Org name | `--org` | `ATBASH_ORG_NAME` | `atbash set org-name <name>` |
640
895
  | API endpoint | `--endpoint` | `ATBASH_ENDPOINT` | `atbash set endpoint <url>` |
896
+ | Self-hosted judge signing key | `--verify-pubkey` (judge) | `ATBASH_JUDGE_VERIFY_PUBKEY` | config key `judgeVerifyPubKey` |
641
897
  | Blockchain RID | — | `ATBASH_BLOCKCHAIN_RID` | `atbash set rid <hex>` |
898
+
899
+ > **Self-hosted judge:** the SDK only accepts an endpoint outside the trusted allowlist
900
+ > when the judge's 66-hex response-signing pubkey is supplied too, so every verdict can be
901
+ > verified. Set `ATBASH_JUDGE_VERIFY_PUBKEY` (or `--verify-pubkey` on `judge`) together with
902
+ > `--endpoint`; without it a non-default endpoint is refused.
642
903
  | Inference provider | `--provider` | `ATBASH_PROVIDER` | `atbash set provider <name>` |
643
904
  | Model | `--model` | `ATBASH_PROVIDER_MODEL` | `atbash set model <model>` |
644
905
 
@@ -19,22 +19,46 @@ const tier_1 = require("../commands/tier");
19
19
  const tools_1 = require("../commands/tools");
20
20
  const held_1 = require("../commands/held");
21
21
  const connect_1 = require("../commands/connect");
22
+ const scan_1 = require("../commands/scan");
22
23
  const setup_1 = require("../commands/setup");
23
- const mcp_cmd_1 = require("../commands/mcp-cmd");
24
+ const github_scan_1 = require("../commands/github-scan");
24
25
  // ── Autocomplete ────────────────────────────────────────────────
25
26
  const commands = [
26
27
  "judge", "whoami", "policy", "tier", "tools", "held",
27
28
  "history", "stats", "status", "keygen", "set", "unset",
28
- "wipe", "config", "connect", "setup", "mcp", "help",
29
+ "wipe", "config", "connect", "scan", "setup", "github-scan", "help",
29
30
  ];
30
31
  const subcommands = {
31
- judge: ["--context", "--agent-key", "--provider", "--model", "--org", "--endpoint", "--timeout", "--json"],
32
+ judge: [
33
+ "--context",
34
+ "--agent-key",
35
+ "--provider",
36
+ "--model",
37
+ "--org",
38
+ "--endpoint",
39
+ "--timeout",
40
+ "--json",
41
+ ],
32
42
  policy: ["show"],
33
43
  tools: ["--agent", "--org", "--count", "--json", "inspect", "count"],
34
44
  held: ["--org", "--count", "--json", "reviews"],
35
45
  connect: ["--host", "--home"],
36
- mcp: ["--key-file", "--endpoint"],
46
+ scan: ["--home", "--introspect", "--api-key", "--model", "--threats", "--policy", "--fail-on", "--json"],
37
47
  setup: ["--key", "--key-file", "--keys-dir", "--host", "--runtime", "--dry-run", "--yes", "--no-install", "--skip-verify", "--home"],
48
+ "github-scan": [
49
+ "--owner",
50
+ "--repo",
51
+ "--branch",
52
+ "--since",
53
+ "--expect-repos",
54
+ "--max-repos",
55
+ "--max-branches",
56
+ "--max-prs",
57
+ "--max-commits",
58
+ "--max-files",
59
+ "--include-bots",
60
+ "--json",
61
+ ],
38
62
  set: ["agent-key", "org-name", "endpoint", "rid", "provider", "model"],
39
63
  unset: ["agent-key", "org-name", "endpoint", "rid", "provider", "model"],
40
64
  show: ["--agent-key", "--endpoint", "--json"],
@@ -89,8 +113,10 @@ program
89
113
  (0, config_cmd_1.registerConfigCommand)(program);
90
114
  // Onboarding
91
115
  (0, connect_1.registerConnectCommand)(program);
116
+ (0, scan_1.registerScanCommand)(program);
92
117
  (0, setup_1.registerSetupCommand)(program);
93
- (0, mcp_cmd_1.registerMcpCommand)(program);
118
+ // External scanning
119
+ (0, github_scan_1.registerGithubScanCommand)(program);
94
120
  async function main() {
95
121
  await program.parseAsync(process.argv);
96
122
  await (0, sdk_1.shutdownTelemetry)();
@@ -1 +1 @@
1
- {"version":3,"file":"atbash.js","sourceRoot":"","sources":["../../src/bin/atbash.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoC;AACpC,wDAAgC;AAChC,qCAAgE;AAChE,6CAAyD;AACzD,+CAA2D;AAC3D,+CAA2D;AAC3D,iDAA6D;AAC7D,6CAAyD;AACzD,uDAA+D;AAC/D,+CAA2D;AAC3D,+CAA2D;AAC3D,2CAAuD;AACvD,6CAAyD;AACzD,2CAAuD;AACvD,iDAA6D;AAC7D,6CAAyD;AACzD,iDAAyD;AAEzD,mEAAmE;AACnE,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IACpD,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO;IACtD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CACpD,CAAC;AAEF,MAAM,WAAW,GAA6B;IAC5C,KAAK,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,CAAC;IAC1G,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EA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AAmB,EAAC,OAAO,CAAC,CAAC;AAE7B,aAAa;AACb,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;AAE9B,oBAAoB;AACpB,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC;AAE7B,OAAO;AACP,IAAA,gCAAsB,EAAC,OAAO,CAAC,CAAC;AAChC,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;AAC9B,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B,QAAQ;AACR,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;AAC/B,IAAA,kCAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B,aAAa;AACb,IAAA,gCAAsB,EAAC,OAAO,CAAC,CAAC;AAChC,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC;AAC7B,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;AAE9B,oBAAoB;AACpB,IAAA,uCAAyB,EAAC,OAAO,CAAC,CAAC;AAEnC,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAA,uBAAiB,GAAE,CAAC;AAC5B,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -14,6 +14,25 @@ import { Command } from "commander";
14
14
  * The discovery mirrors the dashboard's src/lib/scan/discover.ts and produces
15
15
  * the same relay-safe payload the session endpoint expects.
16
16
  */
17
+ /**
18
+ * Official Atbash deployments that legitimately serve the onboarding flow.
19
+ *
20
+ * The pairing screen builds `--host` from the page you opened, so every origin
21
+ * that can host onboarding must appear here. If production were missing, the real
22
+ * atbash.ai would be flagged "unrecognized destination" — a false alarm on the
23
+ * genuine article, which is worse than silence: it teaches people and agents to
24
+ * wave through the one warning that actually catches a swapped host.
25
+ *
26
+ * Matched on EXACT hostname, never a suffix — "atbash.ai.evil.com" must not pass.
27
+ * Deliberately not a *.vercel.app wildcard: that would bless anyone's preview.
28
+ */
29
+ export declare const KNOWN_HOSTS: Set<string>;
30
+ /**
31
+ * Used when neither --host nor ATBASH_HOST is given. Still the dev deployment,
32
+ * because it is the one running the current connector API; switch this to
33
+ * https://atbash.ai once production serves it (KNOWN_HOSTS already allows it).
34
+ */
35
+ export declare const DEFAULT_HOST = "https://chromia-verified-ai-dev-two.vercel.app";
17
36
  interface DeclaredTool {
18
37
  name: string;
19
38
  description?: string;
@@ -34,7 +53,6 @@ type Agent = {
34
53
  detail: string;
35
54
  declaredTools: DeclaredTool[];
36
55
  surfaceEvidence?: SurfaceEvidence;
37
- governance?: Governance;
38
56
  } | {
39
57
  type: "config";
40
58
  label: string;
@@ -52,6 +70,10 @@ declare function describeSkill(text: string | undefined, fallback: string): stri
52
70
  declare function safeDescription(raw: string): string | undefined;
53
71
  /** Walk a skills root (bounded) → declared tools. Mirrors src/lib/scan/adapters/local-skills.ts. */
54
72
  declare function enumerateSkills(root: string, maxDepth?: number, cap?: number): DeclaredTool[];
73
+ export declare const MCP_CONFIGS: {
74
+ label: string;
75
+ segs: string[];
76
+ }[];
55
77
  /**
56
78
  * THE sanitization boundary. Reduce an mcpServers map to the SANITIZED structural
57
79
  * signal the hosted scanner needs — server name, host+path of the endpoint, and
@@ -65,55 +87,23 @@ declare function enumerateSkills(root: string, maxDepth?: number, cap?: number):
65
87
  * size against the input size and label the result partial — see `discover()`.
66
88
  */
67
89
  declare function relaySafeServers(servers: Record<string, unknown>): Record<string, unknown>;
68
- /**
69
- * Atbash's own wiring on this machine — is the boundary actually in place?
70
- *
71
- * The relay reported an agent's TOOL SURFACE and nothing about whether Atbash
72
- * governs it, so the dashboard's "re-scan to confirm it reports as enforcing"
73
- * had nothing to read. Worse, the two failures that matter most are invisible in
74
- * a file listing: a plugin installed but never enabled, and a plugin enabled but
75
- * pointed at no key. Both leave a machine that looks wired and enforces nothing.
76
- *
77
- * FILE READS ONLY. No processes are spawned, so this stays inside the read-only
78
- * promise the onboarding page makes about this command. Everything below is a
79
- * documented location:
80
- *
81
- * - OpenClaw: the plugin entry in `~/.openclaw/openclaw.json`. Both the current
82
- * `openclaw` key and the legacy `atbash-plugin` key count, since the dashboard
83
- * recognizes either.
84
- * - Hermes: plugins are OPT-IN via a `plugins.enabled` allow-list in
85
- * `~/.hermes/config.yaml` (hermes_cli/plugins.py:_get_enabled_plugins — a
86
- * missing key means nothing loads), and the plugin reads its key path from
87
- * `~/.hermes/.env`.
88
- *
89
- * `enforcing` is only ever true when BOTH the hook is switched on and a key path
90
- * is configured. Reporting enforcement on the strength of an installed package
91
- * would recreate the exact false green this is meant to catch.
92
- */
93
- interface Governance {
94
- installed: boolean;
95
- enforcing: boolean;
96
- entry?: string;
97
- keyPathConfigured: boolean;
98
- agentPubkey?: string;
99
- /**
100
- * Every agent this machine has been wired to, newest-known last.
101
- *
102
- * A machine governs exactly ONE agent at a time: the plugin config names one
103
- * key path and that file holds one identity, so each `atbash setup` run
104
- * displaces the previous agent and archives its key under
105
- * `~/.config/atbash/keys/<pubkey>.key`. On a real box that had quietly rotated
106
- * five times, nothing anywhere said so — the browser could not tell "already
107
- * protected" from "protected, but for a different agent than the one you are
108
- * onboarding".
109
- *
110
- * Only PUBLIC keys leave the machine, and only from filenames — the archived
111
- * files are never opened. The current agent's key is included so the caller can
112
- * mark which of the list is live without a second lookup.
113
- */
114
- knownAgents?: string[];
115
- }
116
90
  /** Enumerate the agents/MCP tools configured on this machine. Read-only. */
117
91
  declare function discover(home: string): Agent[];
92
+ /**
93
+ * ⚠️ SECURITY INVARIANT — this returns RAW, UNSANITIZED server specs.
94
+ * The values here contain live secrets: url credentials, `env`, `headers`,
95
+ * `token`, `apiKey`, and absolute command paths. They exist ONLY so `--introspect`
96
+ * can reach a server locally. They MUST NEVER be put into the relay payload
97
+ * directly. Every path that turns these into an `Agent` MUST route them through
98
+ * `relaySafeServers()` first (the single sanitization boundary). If you add a new
99
+ * consumer, sanitize before it leaves this file. Callers today: `discover()`
100
+ * (sanitizes), `connect --introspect` and `atbash scan --introspect` (both local
101
+ * only, never relayed — scan has no relay path at all).
102
+ */
103
+ declare function readAllMcpServers(home: string): {
104
+ label: string;
105
+ servers: Record<string, unknown>;
106
+ }[];
118
107
  export declare function registerConnectCommand(program: Command): void;
119
- export { discover, enumerateSkills, describeSkill, relaySafeServers, safeDescription };
108
+ export { discover, enumerateSkills, describeSkill, relaySafeServers, safeDescription, readAllMcpServers };
109
+ export type { Agent, DeclaredTool };