@axtary/cli 0.0.1 → 0.2.0

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 (49) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +140 -6
  3. package/dist/bin.js +10 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/claude-code-hook.d.ts +65 -0
  6. package/dist/claude-code-hook.d.ts.map +1 -0
  7. package/dist/claude-code-hook.js +326 -0
  8. package/dist/claude-code-hook.js.map +1 -0
  9. package/dist/codex-hook.d.ts +48 -0
  10. package/dist/codex-hook.d.ts.map +1 -0
  11. package/dist/codex-hook.js +259 -0
  12. package/dist/codex-hook.js.map +1 -0
  13. package/dist/credentials.d.ts +101 -0
  14. package/dist/credentials.d.ts.map +1 -0
  15. package/dist/credentials.js +277 -0
  16. package/dist/credentials.js.map +1 -0
  17. package/dist/cursor-hook.d.ts +51 -0
  18. package/dist/cursor-hook.d.ts.map +1 -0
  19. package/dist/cursor-hook.js +214 -0
  20. package/dist/cursor-hook.js.map +1 -0
  21. package/dist/hook-install.d.ts +21 -0
  22. package/dist/hook-install.d.ts.map +1 -0
  23. package/dist/hook-install.js +179 -0
  24. package/dist/hook-install.js.map +1 -0
  25. package/dist/index.d.ts +897 -5
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +6750 -513
  28. package/dist/index.js.map +1 -1
  29. package/dist/mcp-fs-normalize.d.ts +18 -0
  30. package/dist/mcp-fs-normalize.d.ts.map +1 -0
  31. package/dist/mcp-fs-normalize.js +39 -0
  32. package/dist/mcp-fs-normalize.js.map +1 -0
  33. package/dist/mcp-oauth.d.ts +67 -0
  34. package/dist/mcp-oauth.d.ts.map +1 -0
  35. package/dist/mcp-oauth.js +242 -0
  36. package/dist/mcp-oauth.js.map +1 -0
  37. package/dist/oauth.d.ts +90 -0
  38. package/dist/oauth.d.ts.map +1 -0
  39. package/dist/oauth.js +339 -0
  40. package/dist/oauth.js.map +1 -0
  41. package/dist/render.d.ts +103 -0
  42. package/dist/render.d.ts.map +1 -0
  43. package/dist/render.js +172 -0
  44. package/dist/render.js.map +1 -0
  45. package/dist/shell-file-normalize.d.ts +21 -0
  46. package/dist/shell-file-normalize.d.ts.map +1 -0
  47. package/dist/shell-file-normalize.js +269 -0
  48. package/dist/shell-file-normalize.js.map +1 -0
  49. package/package.json +17 -13
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,22 +1,156 @@
1
1
  # @axtary/cli
2
2
 
3
- Axtary local CLI for deterministic proxy demos.
3
+ Axtary local CLI: the fail-closed runtime proxy, agent hooks, MCP wrapper, policy testing, and ledger tooling in one binary.
4
4
 
5
- This package is private workspace code while `axtary proxy --config axtary.yml` is being shaped.
5
+ Early `0.x` release: the runtime path is real and tested, but the API is not stable yet and may change between minor versions.
6
+
7
+ ## Quickstart
8
+
9
+ ```sh
10
+ npm install -g @axtary/cli # or: npx @axtary/cli <command>
11
+
12
+ axtary init # scaffold a starter axtary.yml
13
+ axtary demo # run fake GitHub/Slack/Linear actions through the proxy + ledger
14
+ ```
15
+
16
+ `init` then `demo` reaches a first blocked action in under a minute with no credentials. The full rail — proxy, gating a real agent via the Claude Code hook or the MCP wrapper — is in the [Quickstart](https://www.axtary.com/docs/quickstart).
17
+
18
+ To start from a scoped policy, use one of the PRD templates:
19
+
20
+ ```sh
21
+ axtary init --template repo-only-coding
22
+ axtary policy test .axtary/policy-tests/repo-only-coding.policies.test.yml --config axtary.yml
23
+ axtary demo --config axtary.yml --template repo-only-coding
24
+ ```
25
+
26
+ Available templates: `repo-only-coding`, `staging-reads`, `incident-investigation`, `ticket-updates`, `doc-search`, and `guarded-prod`.
6
27
 
7
28
  ## Commands
8
29
 
9
30
  ```sh
31
+ axtary init [--template repo-only-coding|staging-reads|incident-investigation|ticket-updates|doc-search|guarded-prod]
10
32
  axtary demo --config axtary.yml --json
33
+ axtary demo --config axtary.yml --template repo-only-coding
34
+ axtary doctor connectors --config axtary.yml --json
11
35
  axtary proxy --config axtary.yml
36
+ axtary revoke ap_<id> [--reason "..."] [--by user:operator]
37
+ axtary revocations [--json]
38
+ axtary issuer-keys [--rotate] [--retire-after 1200]
39
+ axtary status [--json]
40
+ axtary caep-map --issuer https://idp.example --subject '{"format":"opaque","id":"session"}' --root ap_<id>
12
41
  axtary smoke --config axtary.yml
42
+ axtary policy simulate action.json --config examples/axtary.policies.yml
43
+ axtary policy test examples/policies.test.yml --config examples/axtary.policies.yml
13
44
  axtary test-policy --config axtary.yml --fixtures examples/policy-fixtures
45
+ axtary run workflow github-pr-review --real --config examples/axtary.real.yml [--tamper]
46
+ axtary run workflow github-depth --real --config examples/axtary.real.yml --repo org/repo
47
+ axtary run workflow postgres-read --real --config examples/axtary.postgres.yml --database appdb --statement 'SELECT id FROM public.items WHERE tenant_id = $1' --parameters '["tenant-a"]'
48
+ axtary hook install claude --owner user:operator --repo org/repo
49
+ axtary hook install cursor --owner user:operator --repo org/repo
50
+ axtary hook install codex --owner user:operator --repo org/repo
51
+ axtary hook claude-code --proxy http://127.0.0.1:7331
52
+ axtary hook cursor --proxy http://127.0.0.1:7331
53
+ axtary hook codex --proxy http://127.0.0.1:7331
54
+ axtary mcp serve --config axtary.yml [--wrap '<upstream mcp command>' | --wrap-url https://host/mcp]
55
+ axtary mcp login --wrap-url https://host/mcp [--scope 'a b']
56
+ axtary mcp sessions [--json]
57
+ axtary mcp logout --wrap-url https://host/mcp
58
+ axtary mcp pins [--pins axtary.mcp-pins.json] [--json]
59
+ axtary mcp trust-publisher --publisher mcp-publisher://acme --jwks publisher.jwks.json
60
+ axtary mcp publishers
61
+ axtary mcp verify-definition --definition tool.json --statement tool.jwt --publisher mcp-publisher://acme
62
+ axtary mcp review --wrap-url https://host/mcp [--signed-definitions .axtary/mcp-signed-definitions.json] [--accept]
63
+ axtary mcp conformance --wrap-url https://host/mcp --tool read_tool --arguments '{}' [--accept]
64
+ axtary mcp drift-demo [--json]
65
+ axtary connect linear [--client-id <id> | --client-id-env NAME]
66
+ axtary connect slack --redirect-uri https://<tunnel>/callback
67
+ axtary connect jira --redirect-uri https://<tunnel>/callback [--cloud-id ID]
68
+ axtary connect drive --redirect-uri https://<tunnel>/callback
69
+ axtary connections [--json]
70
+ axtary disconnect <provider>
71
+ axtary run workflow drive-read --real --config examples/axtary.drive.yml
72
+ axtary attest-ledger --ledger .axtary/actions.jsonl --out attestation.json
73
+ axtary verify-export attestation.json
74
+ axtary prove-inclusion attestation.json --record ap_<jti> --out proof.json
75
+ axtary prove-consistency first.json second.json --out proof.json
76
+ axtary verify-proof proof.json --bundle attestation.json
77
+ axtary forensics attestation.json
78
+ axtary export-ledger --format siem-jsonl
79
+ axtary sync-ledger --endpoint https://app.example/api/ledger/sync
80
+ axtary export-otel --endpoint http://127.0.0.1:4318/v1/traces
14
81
  ```
15
82
 
16
- - `demo` loads config, creates an ephemeral signing key, runs fake GitHub, Slack, Linear, and Jira actions through the proxy, writes the local JSONL ledger, and prints a structured result.
17
- - `proxy` starts a long-running local HTTP enforcement point with `GET /health`, `GET /state`, and `POST /actions`. It uses fake SaaS adapters by default and can route GitHub, Slack, Linear, AWS, GCP, and local docs actions when their adapter modes are enabled. File-backed configs are cached and policy is reloaded when `axtary.yml` changes.
18
- - `smoke` validates configured providers without writes: GitHub REST calls `/user`, Slack Web calls `auth.test`, Linear GraphQL queries `viewer`, AWS calls STS `GetCallerIdentity`, GCP checks project access, and local docs checks configured roots.
19
- - `test-policy` evaluates JSON fixtures against the loaded YAML policy and fails when an expected decision or reason differs.
83
+ - `init` scaffolds a starter `axtary.yml` and prints the quickstart rail (`docs/quickstart.md`). `--template <name>` applies one of the six reusable scope templates and writes `.axtary/policy-tests/<name>.policies.test.yml` so the scaffold can be tested immediately.
84
+ - `demo` loads config, creates an ephemeral signing key, runs fake GitHub, Slack, Linear, and Jira actions through the proxy, writes the local JSONL ledger, and prints a structured result. `demo --template <name>` is policy-only: it runs the template's representative allow/deny fixtures and makes no provider calls.
85
+ - `doctor connectors` reports per-provider readiness mode, missing env names,
86
+ required scopes, smoke commands without leaking secret values. Jira and
87
+ Linear, Postgres, and Google Drive plans are generated by their native connector descriptors; current
88
+ reported scopes are Jira `read:jira-work`/`write:jira-work` and Linear
89
+ `read`/`write`.
90
+ - `proxy` starts a long-running local HTTP enforcement point with `GET /health`, `GET /state`, `GET /revocations`, `GET /.well-known/jwks.json`, `GET /statuslists/actionpasses`, `POST /ssf/events`, `POST /actions` (authorize + execute), and `POST /authorize` (decision, ActionPass, and ledger record without execution — the agent-hook path). It uses fake SaaS adapters by default and can route GitHub, Slack, Linear, Jira Cloud, AWS, GCP, and local docs actions when their adapter modes are enabled. File-backed configs are cached and policy is reloaded when `axtary.yml` changes.
91
+ - `revoke` writes a durable local revocation for one ActionPass `jti`;
92
+ `revocations` lists that state. Both share
93
+ `.axtary/actionpass-trust-store.json` with the proxy and MCP wrapper by
94
+ default, or an explicit `--trust-store` path. Running processes re-check the
95
+ source on every pass presentation, so revocation takes effect without a
96
+ restart; unreadable or corrupt state blocks execution.
97
+ - With `runtime.status.enabled` (the default), the proxy issues ActionPass v2,
98
+ persists a private issuer keyring and status allocation store, publishes
99
+ public JWKS and a signed freshness-bounded status list, and updates that list
100
+ when `revoke` targets an allocated pass. `issuer-keys --rotate` changes the
101
+ durable active key; restart the proxy to begin issuing with it. CLI and HTTP
102
+ metadata never return private keys.
103
+ - `runtime.caep.enabled` opts into a generic final SSF/CAEP receiver. Configure
104
+ transmitter issuer, audience, and JWKS URI, then use `caep-map` to associate
105
+ an exact SSF subject with live root pass IDs. Valid `session-revoked` events
106
+ invalidate those roots; duplicate deliveries are idempotent. This is not a
107
+ claim of vendor-specific IdP support.
108
+ - `smoke` validates configured providers without writes: GitHub REST calls `/user`, Slack Web calls `auth.test`, Linear GraphQL queries `viewer`, Jira REST calls `/myself`, AWS calls STS `GetCallerIdentity`, GCP checks project access, and local docs checks configured roots.
109
+ - `policy simulate` dry-runs one normalized action and reports the selected decision, determining rule, every rule match/miss, and attached obligations.
110
+ - `policy test` runs a `policies.test.yml` fixture harness and exits non-zero on a decision, reason, or determining-rule mismatch, making the policy file directly CI-testable.
111
+ - `test-policy` evaluates JSON fixtures against the loaded YAML policy and fails when an expected decision or reason differs. `--parity` additionally runs the same fixtures through executable Cedar and OPA/Rego engines and fails on any cross-engine disagreement (see `examples/policies/README.md`).
112
+ - `run workflow github-pr-review --real` executes the design-partner workflow (Linear read → docs search → GitHub branch/file/PR → approved Slack post) through proxy-compatible wiring; `--tamper` mutates the approved payload and proves the block (see `docs/sandbox-runbook.md`).
113
+ - `run workflow github-depth --real` is GitHub-only depth: it opens a draft PR,
114
+ then writes an inline review comment, a check run, and an issue comment — each
115
+ step governed and ledgered. `run workflow postgres-read --real` runs one
116
+ parameterized SELECT through policy, ActionPass, a read-only transaction, and
117
+ RLS checks; writes are denied before execution.
118
+ - `connect <linear|slack|jira|drive>` runs the provider's browser OAuth flow and
119
+ stores the token in the local credential broker (macOS keychain or a `0600`
120
+ file) — tokens are never pasted or printed. `connections` lists connected
121
+ providers (metadata only); `disconnect <provider>` removes a stored credential.
122
+ - `hook install <claude|cursor|codex>` writes the project runtime hook config
123
+ (`.claude/settings.json`, `.cursor/hooks.json`, or `.codex/hooks.json`) with
124
+ the resolved local CLI path. It is idempotent and preserves unrelated hooks.
125
+ - `hook claude-code`, `hook cursor`, and `hook codex` read their runtime's
126
+ pre-tool payload from stdin, normalize supported file operations into content
127
+ actions, and return the runtime-specific decision from the running proxy.
128
+ - `mcp serve` runs a stdio MCP server whose stdio or Streamable HTTP upstream tools are policy-gated at persisted definition hashes (see `docs/mcp-wrapper.md`).
129
+ - `mcp trust-publisher` registers public JWKS in the local owner-readable
130
+ publisher trust store; `mcp publishers` lists identities and key ids;
131
+ `mcp verify-definition` verifies one statement against the exact definition.
132
+ - `mcp review` compares a live server's advertised definitions with persisted
133
+ pins and an optional signed-definition registry. It displays verified
134
+ publisher/semver evidence and the version-chain verdict (`continuous`,
135
+ `broken_chain`, or `version_not_incremented`); untrusted or invalid
136
+ signatures cannot be accepted.
137
+ - `mcp conformance` executes one explicitly selected live tool through pins → policy → ActionPass v1/DPoP → ledger, proves a labeled synthetic pin mismatch is quarantined, independently verifies a signed ledger export, and writes a secret-free per-server receipt for the dashboard.
138
+ - `mcp drift-demo` reproduces the tool-poisoning block in one command: the definition mutates after review, the hash drifts, and the identical call is denied before the upstream invoker runs — approved and attempted hashes land in the ledger.
139
+ - `mcp login` runs OAuth 2.1 discovery + PKCE consent for an OAuth-protected
140
+ remote MCP server and stores the bearer in the local broker; `mcp sessions`
141
+ lists sessions (resource/issuer/scopes/expiry, never tokens); `mcp logout`
142
+ deletes one; `mcp pins` lists the persisted tool-definition pins.
143
+ - `export-ledger` / `sync-ledger` export verified ledger records locally or upload them to the hosted control plane with signed sync tokens. `attest-ledger` / `verify-export` create and independently verify signed, self-contained ledger evidence.
144
+ - `prove-inclusion` / `prove-consistency` / `verify-proof` produce and
145
+ independently verify RFC 6962 Merkle inclusion and consistency proofs over
146
+ attested exports, so a third party can check one record or two heads without
147
+ trusting Axtary. `forensics` reconstructs an incident offline from the ledger:
148
+ authority attenuation, reconstructibility, and cascade containment.
149
+ - `export-otel` posts a verified ledger segment to an OTLP/HTTP trace endpoint
150
+ as payload-free GenAI `execute_tool` spans. `proxy --otlp-endpoint` streams
151
+ the same projection after each durable append. These spans carry decisions,
152
+ reasons, hashes, and audit dimensions, never payload bodies, tokens, file
153
+ contents, result rows, or raw shell commands.
20
154
 
21
155
  ## Real Provider Smoke Test
22
156
 
package/dist/bin.js CHANGED
@@ -1,4 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { runAxtaryCli } from "./index.js";
3
+ function exitQuietlyOnBrokenPipe(stream) {
4
+ stream.on("error", (error) => {
5
+ if (error.code === "EPIPE") {
6
+ process.exit(0);
7
+ }
8
+ throw error;
9
+ });
10
+ }
11
+ exitQuietlyOnBrokenPipe(process.stdout);
12
+ exitQuietlyOnBrokenPipe(process.stderr);
3
13
  process.exitCode = await runAxtaryCli();
4
14
  //# sourceMappingURL=bin.js.map
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,CAAC,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,SAAS,uBAAuB,CAAC,MAA0B;IACzD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE;QAClD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxC,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAExC,OAAO,CAAC,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { type JsonValue, type NormalizedAction } from "@axtary/actionpass";
2
+ export declare const CLAUDE_CODE_HOOK_SCHEMA_VERSION = "axtary.claude_code_hook.v0";
3
+ export declare const DEFAULT_PROXY_URL = "http://127.0.0.1:7331";
4
+ export declare const DEFAULT_HOOK_TIMEOUT_MS = 5000;
5
+ export type ClaudeCodeHookPayload = {
6
+ sessionId: string | null;
7
+ cwd: string | null;
8
+ toolName: string;
9
+ toolInput: Record<string, JsonValue>;
10
+ };
11
+ export type ClaudeCodeNormalization = {
12
+ mapped: true;
13
+ action: NormalizedAction;
14
+ actions: NormalizedAction[];
15
+ } | {
16
+ mapped: false;
17
+ reason: string;
18
+ };
19
+ export type ClaudeCodeNormalizeOptions = {
20
+ repoResource?: string;
21
+ humanOwner?: string;
22
+ branch?: string;
23
+ };
24
+ export type ClaudeCodeHookStatus = "allow" | "ask" | "deny" | "no_opinion";
25
+ export type ClaudeCodeHookRunInput = {
26
+ payloadText: string;
27
+ proxyUrl?: string;
28
+ repoResource?: string;
29
+ humanOwner?: string;
30
+ branch?: string;
31
+ timeoutMs?: number;
32
+ fetch?: typeof fetch;
33
+ };
34
+ export type ClaudeCodeHookRunResult = {
35
+ schemaVersion: typeof CLAUDE_CODE_HOOK_SCHEMA_VERSION;
36
+ status: ClaudeCodeHookStatus;
37
+ tool: string | null;
38
+ normalizedTool: string | null;
39
+ reason: string | null;
40
+ output: string | null;
41
+ exitCode: number;
42
+ };
43
+ export declare function parseClaudeCodeHookPayload(payloadText: string): ClaudeCodeHookPayload;
44
+ export declare function normalizeClaudeCodeToolCall(payload: ClaudeCodeHookPayload, options?: ClaudeCodeNormalizeOptions): ClaudeCodeNormalization;
45
+ export declare function runClaudeCodeHook(input: ClaudeCodeHookRunInput): Promise<ClaudeCodeHookRunResult>;
46
+ export type ProxyAuthorizeHttpResponse = {
47
+ status: "authorized" | "step_up" | "blocked" | "malformed";
48
+ decision?: {
49
+ reasons?: string[];
50
+ };
51
+ ledger?: {
52
+ lineNumber?: number;
53
+ };
54
+ hints?: string[];
55
+ explanation?: {
56
+ summary?: string;
57
+ };
58
+ };
59
+ export declare const DENY_RANK = 3;
60
+ /** Severity rank for picking the most restrictive decision across ops. */
61
+ export declare function authorizeRank(status: ProxyAuthorizeHttpResponse["status"]): number;
62
+ export declare function postAuthorize(fetchImpl: typeof fetch | undefined, url: string, action: NormalizedAction, timeoutMs: number): Promise<ProxyAuthorizeHttpResponse>;
63
+ export declare function workspaceRelativePath(path: string, cwd: string | null): string;
64
+ export declare function errorReason(error: unknown): string;
65
+ //# source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