@agledger/cli 0.4.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +115 -22
- package/README.md +74 -42
- package/SKILL.md +51 -17
- package/dist/api-client.js +1 -1
- package/dist/base.d.ts +43 -22
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +76 -87
- package/dist/base.js.map +1 -1
- package/dist/commands/admin/create-agent.d.ts.map +1 -1
- package/dist/commands/admin/create-agent.js +1 -2
- package/dist/commands/admin/create-agent.js.map +1 -1
- package/dist/commands/admin/create-enterprise.d.ts.map +1 -1
- package/dist/commands/admin/create-enterprise.js +1 -2
- package/dist/commands/admin/create-enterprise.js.map +1 -1
- package/dist/commands/admin/set-config.d.ts.map +1 -1
- package/dist/commands/admin/set-config.js +6 -8
- package/dist/commands/admin/set-config.js.map +1 -1
- package/dist/commands/agent/list.d.ts +3 -0
- package/dist/commands/agent/list.d.ts.map +1 -1
- package/dist/commands/agent/list.js +10 -2
- package/dist/commands/agent/list.js.map +1 -1
- package/dist/commands/api.d.ts +42 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +174 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/auth.d.ts +5 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +12 -4
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/config.d.ts +24 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +75 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/discover.d.ts +20 -0
- package/dist/commands/discover.d.ts.map +1 -0
- package/dist/commands/discover.js +44 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/federation/create-token.d.ts.map +1 -1
- package/dist/commands/federation/create-token.js +1 -2
- package/dist/commands/federation/create-token.js.map +1 -1
- package/dist/commands/federation/revoke-gateway.d.ts.map +1 -1
- package/dist/commands/federation/revoke-gateway.js +1 -2
- package/dist/commands/federation/revoke-gateway.js.map +1 -1
- package/dist/commands/help-json.d.ts.map +1 -1
- package/dist/commands/help-json.js +4 -4
- package/dist/commands/help-json.js.map +1 -1
- package/dist/commands/list-commands.d.ts +8 -1
- package/dist/commands/list-commands.d.ts.map +1 -1
- package/dist/commands/list-commands.js +22 -57
- package/dist/commands/list-commands.js.map +1 -1
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +16 -14
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +14 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +33 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/mandate/accept.d.ts +1 -0
- package/dist/commands/mandate/accept.d.ts.map +1 -1
- package/dist/commands/mandate/accept.js +9 -2
- package/dist/commands/mandate/accept.js.map +1 -1
- package/dist/commands/mandate/cancel.d.ts +1 -0
- package/dist/commands/mandate/cancel.d.ts.map +1 -1
- package/dist/commands/mandate/cancel.js +5 -0
- package/dist/commands/mandate/cancel.js.map +1 -1
- package/dist/commands/mandate/counter-propose.d.ts +3 -1
- package/dist/commands/mandate/counter-propose.d.ts.map +1 -1
- package/dist/commands/mandate/counter-propose.js +18 -3
- package/dist/commands/mandate/counter-propose.js.map +1 -1
- package/dist/commands/mandate/create.d.ts.map +1 -1
- package/dist/commands/mandate/create.js +14 -10
- package/dist/commands/mandate/create.js.map +1 -1
- package/dist/commands/mandate/list.js +1 -1
- package/dist/commands/mandate/list.js.map +1 -1
- package/dist/commands/mandate/outcome.d.ts +3 -1
- package/dist/commands/mandate/outcome.d.ts.map +1 -1
- package/dist/commands/mandate/outcome.js +21 -4
- package/dist/commands/mandate/outcome.js.map +1 -1
- package/dist/commands/mandate/receipts.d.ts +20 -0
- package/dist/commands/mandate/receipts.d.ts.map +1 -0
- package/dist/commands/mandate/receipts.js +29 -0
- package/dist/commands/mandate/receipts.js.map +1 -0
- package/dist/commands/mandate/reject.d.ts +1 -0
- package/dist/commands/mandate/reject.d.ts.map +1 -1
- package/dist/commands/mandate/reject.js +5 -0
- package/dist/commands/mandate/reject.js.map +1 -1
- package/dist/commands/mandate/request-revision.d.ts +1 -0
- package/dist/commands/mandate/request-revision.d.ts.map +1 -1
- package/dist/commands/mandate/request-revision.js +5 -0
- package/dist/commands/mandate/request-revision.js.map +1 -1
- package/dist/commands/mandate/transition.d.ts +3 -1
- package/dist/commands/mandate/transition.d.ts.map +1 -1
- package/dist/commands/mandate/transition.js +15 -4
- package/dist/commands/mandate/transition.js.map +1 -1
- package/dist/commands/receipt/list.d.ts +1 -0
- package/dist/commands/receipt/list.d.ts.map +1 -1
- package/dist/commands/receipt/list.js +1 -0
- package/dist/commands/receipt/list.js.map +1 -1
- package/dist/commands/receipt/submit.d.ts.map +1 -1
- package/dist/commands/receipt/submit.js +7 -16
- package/dist/commands/receipt/submit.js.map +1 -1
- package/dist/commands/schema/blank-template.d.ts.map +1 -1
- package/dist/commands/schema/blank-template.js +5 -3
- package/dist/commands/schema/blank-template.js.map +1 -1
- package/dist/commands/schema/check-compatibility.d.ts.map +1 -1
- package/dist/commands/schema/check-compatibility.js +2 -3
- package/dist/commands/schema/check-compatibility.js.map +1 -1
- package/dist/commands/schema/deprecate.d.ts.map +1 -1
- package/dist/commands/schema/deprecate.js +1 -2
- package/dist/commands/schema/deprecate.js.map +1 -1
- package/dist/commands/schema/diff.d.ts.map +1 -1
- package/dist/commands/schema/diff.js +2 -0
- package/dist/commands/schema/diff.js.map +1 -1
- package/dist/commands/schema/export.d.ts.map +1 -1
- package/dist/commands/schema/export.js +5 -3
- package/dist/commands/schema/export.js.map +1 -1
- package/dist/commands/schema/import.d.ts.map +1 -1
- package/dist/commands/schema/import.js +2 -4
- package/dist/commands/schema/import.js.map +1 -1
- package/dist/commands/schema/list.d.ts +3 -0
- package/dist/commands/schema/list.d.ts.map +1 -1
- package/dist/commands/schema/list.js +14 -3
- package/dist/commands/schema/list.js.map +1 -1
- package/dist/commands/schema/meta-schema.d.ts.map +1 -1
- package/dist/commands/schema/meta-schema.js +5 -3
- package/dist/commands/schema/meta-schema.js.map +1 -1
- package/dist/commands/schema/preview.d.ts.map +1 -1
- package/dist/commands/schema/preview.js +3 -2
- package/dist/commands/schema/preview.js.map +1 -1
- package/dist/commands/schema/register.d.ts.map +1 -1
- package/dist/commands/schema/register.js +2 -4
- package/dist/commands/schema/register.js.map +1 -1
- package/dist/commands/schema/template.d.ts.map +1 -1
- package/dist/commands/schema/template.js +5 -3
- package/dist/commands/schema/template.js.map +1 -1
- package/dist/commands/schema/validate.d.ts.map +1 -1
- package/dist/commands/schema/validate.js +3 -2
- package/dist/commands/schema/validate.js.map +1 -1
- package/dist/commands/schema/versions.d.ts +3 -0
- package/dist/commands/schema/versions.d.ts.map +1 -1
- package/dist/commands/schema/versions.js +14 -4
- package/dist/commands/schema/versions.js.map +1 -1
- package/dist/commands/verdict/render.d.ts +1 -0
- package/dist/commands/verdict/render.d.ts.map +1 -1
- package/dist/commands/verdict/render.js +5 -0
- package/dist/commands/verdict/render.js.map +1 -1
- package/dist/commands/verify.d.ts +27 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +85 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/webhook/create.d.ts.map +1 -1
- package/dist/commands/webhook/create.js +1 -2
- package/dist/commands/webhook/create.js.map +1 -1
- package/dist/commands/webhook/delete.d.ts +1 -0
- package/dist/commands/webhook/delete.d.ts.map +1 -1
- package/dist/commands/webhook/delete.js +9 -2
- package/dist/commands/webhook/delete.js.map +1 -1
- package/dist/commands/webhook/list.d.ts +3 -0
- package/dist/commands/webhook/list.d.ts.map +1 -1
- package/dist/commands/webhook/list.js +10 -3
- package/dist/commands/webhook/list.js.map +1 -1
- package/dist/util/config.d.ts +17 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +37 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/field-parser.d.ts +28 -0
- package/dist/util/field-parser.d.ts.map +1 -0
- package/dist/util/field-parser.js +138 -0
- package/dist/util/field-parser.js.map +1 -0
- package/oclif.manifest.json +1167 -570
- package/package.json +2 -1
package/LICENSE
CHANGED
|
@@ -2,33 +2,126 @@ Copyright (c) 2026 AGLedger LLC. All rights reserved.
|
|
|
2
2
|
|
|
3
3
|
PROPRIETARY SOFTWARE LICENSE
|
|
4
4
|
|
|
5
|
-
This software
|
|
6
|
-
proprietary property of AGLedger LLC. The Software is
|
|
7
|
-
|
|
5
|
+
This software, together with its associated documentation files (the "Software"),
|
|
6
|
+
is the proprietary property of AGLedger LLC ("Licensor"). The Software is
|
|
7
|
+
licensed, not sold. Your right to use the Software is limited as set out below.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
BY DOWNLOADING, INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE (INCLUDING
|
|
10
|
+
VIA `npm install`, `pip install`, OR ANY EQUIVALENT PACKAGE-MANAGER COMMAND),
|
|
11
|
+
YOU AGREE TO THE TERMS OF THIS LICENSE. IF YOU DO NOT AGREE, DO NOT DOWNLOAD,
|
|
12
|
+
INSTALL, OR USE THE SOFTWARE.
|
|
12
13
|
|
|
13
|
-
1.
|
|
14
|
-
copies of the Software, except as required to use it with the AGLedger API.
|
|
14
|
+
1. GRANT OF USE
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Licensor grants you a limited, non-exclusive, non-transferable, revocable
|
|
17
|
+
license to install and use the Software solely for the purpose of integrating
|
|
18
|
+
with a self-hosted AGLedger deployment operated by you or your organization, or
|
|
19
|
+
by a third party on your behalf with your authorization. The Software is not
|
|
20
|
+
designed for, and is not licensed for use with, any AGLedger-hosted service.
|
|
21
|
+
AGLedger operates the AGLedger software on a self-hosted model; there is no
|
|
22
|
+
hosted AGLedger API.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
except to the extent permitted by applicable law.
|
|
24
|
+
2. RESTRICTIONS
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
https://agledger.ai/terms.
|
|
26
|
+
You may not:
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
(a) copy, modify, merge, publish, distribute, sublicense, sell, rent, lease,
|
|
29
|
+
or transfer copies of the Software, except as strictly required to use
|
|
30
|
+
the Software for its intended integration purpose;
|
|
31
|
+
(b) offer the Software, or the functionality enabled by the Software, as a
|
|
32
|
+
hosted or managed service to third parties, whether as a standalone
|
|
33
|
+
offering or embedded within a larger service;
|
|
34
|
+
(c) use the Software to build, train, or benchmark a product or service that
|
|
35
|
+
competes with AGLedger;
|
|
36
|
+
(d) reverse engineer, decompile, or disassemble the Software, except to the
|
|
37
|
+
extent expressly permitted by applicable law that cannot be waived by
|
|
38
|
+
contract;
|
|
39
|
+
(e) circumvent, disable, or tamper with any authentication, license, or usage-
|
|
40
|
+
enforcement mechanism of the Software or of any AGLedger deployment;
|
|
41
|
+
(f) remove, alter, or obscure any copyright, trademark, patent, or other
|
|
42
|
+
proprietary notice in the Software;
|
|
43
|
+
(g) use the Software in violation of U.S. Export Administration Regulations,
|
|
44
|
+
economic sanctions, or other applicable export and trade-control laws.
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
3. OPEN SOURCE COMPONENTS
|
|
32
47
|
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
The Software may include third-party open-source components, each subject to
|
|
49
|
+
its own license terms. A list of such components and their licenses is included
|
|
50
|
+
with or referenced from the Software. In the event of a conflict between this
|
|
51
|
+
License and an open-source license, the open-source license governs solely with
|
|
52
|
+
respect to that component.
|
|
53
|
+
|
|
54
|
+
4. NO WARRANTY
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
|
|
57
|
+
KIND, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE
|
|
58
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
|
59
|
+
NONINFRINGEMENT. AGLEDGER LLC DOES NOT WARRANT THAT THE SOFTWARE WILL BE ERROR-
|
|
60
|
+
FREE, SECURE, OR UNINTERRUPTED.
|
|
61
|
+
|
|
62
|
+
5. LIMITATION OF LIABILITY
|
|
63
|
+
|
|
64
|
+
The limitations in this Section 5 are a material inducement to AGLedger LLC to
|
|
65
|
+
make the Software publicly available at no charge, and they apply notwithstanding
|
|
66
|
+
any failure of essential purpose of any limited remedy and regardless of the
|
|
67
|
+
theory of liability (contract, tort, strict liability, statute, or otherwise).
|
|
68
|
+
|
|
69
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL AGLEDGER
|
|
70
|
+
LLC BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY,
|
|
71
|
+
OR PUNITIVE DAMAGES, OR FOR LOSS OF PROFITS, REVENUE, DATA, USE, GOODWILL, OR
|
|
72
|
+
BUSINESS OPPORTUNITY, ARISING FROM OR RELATED TO THE SOFTWARE, EVEN IF ADVISED
|
|
73
|
+
OF THE POSSIBILITY OF SUCH DAMAGES. AGLEDGER LLC'S TOTAL AGGREGATE LIABILITY
|
|
74
|
+
FOR ALL CLAIMS RELATED TO THE SOFTWARE SHALL NOT EXCEED ONE HUNDRED U.S.
|
|
75
|
+
DOLLARS ($100.00). Any claim must be commenced within one (1) year after the
|
|
76
|
+
cause of action accrues, to the maximum extent permitted by applicable law.
|
|
77
|
+
|
|
78
|
+
6. EXPORT COMPLIANCE
|
|
79
|
+
|
|
80
|
+
The Software may include cryptographic functionality (including Ed25519, AES-
|
|
81
|
+
256-GCM, SHA-256, and X25519). AGLedger LLC classifies the Software under
|
|
82
|
+
ECCN 5D002 in good faith. To the extent AGLedger LLC makes the source code of
|
|
83
|
+
the Software publicly available through a public repository, that source code
|
|
84
|
+
is subject to the treatment afforded under 15 CFR § 742.15(b) of the U.S.
|
|
85
|
+
Export Administration Regulations. Binary and object-code distributions are
|
|
86
|
+
subject to License Exception ENC under 15 CFR § 740.17, subject to the one-
|
|
87
|
+
time notification and any required Encryption Registration to the U.S. Bureau
|
|
88
|
+
of Industry and Security (BIS) and the NSA ENC Encryption Request Coordinator.
|
|
89
|
+
This statement is not a warranty; you are responsible for independently
|
|
90
|
+
confirming the correct classification and license authority for your use,
|
|
91
|
+
destination, and end-user. You shall not export or re-export the Software to
|
|
92
|
+
any destination, entity, or end-use prohibited by applicable export, sanctions,
|
|
93
|
+
or trade-control laws.
|
|
94
|
+
|
|
95
|
+
7. TRADEMARKS
|
|
96
|
+
|
|
97
|
+
AGLedger, Agentic Ledger, Settlement Signal, and Agentic Operations and
|
|
98
|
+
Accountability Protocol (AOAP) are trademarks of AGLedger LLC. All other
|
|
99
|
+
trademarks are the property of their respective owners.
|
|
100
|
+
|
|
101
|
+
8. PATENTS
|
|
102
|
+
|
|
103
|
+
The Software is covered by one or more U.S. patent applications pending before
|
|
104
|
+
the U.S. Patent and Trademark Office in AGLedger LLC's patent portfolio.
|
|
105
|
+
|
|
106
|
+
9. RELATIONSHIP TO OTHER AGLEDGER AGREEMENTS
|
|
107
|
+
|
|
108
|
+
If you are also a Licensee under an AGLedger Software License Agreement
|
|
109
|
+
executed with an Order Form, that Software License Agreement governs your
|
|
110
|
+
organization's use of the Licensed Software (including the Software distributed
|
|
111
|
+
under this License) and supersedes this License to the extent of any conflict.
|
|
112
|
+
Absent such an agreement, this License is the exclusive and entire license
|
|
113
|
+
between you and AGLedger LLC for the Software.
|
|
114
|
+
|
|
115
|
+
10. GOVERNING LAW
|
|
116
|
+
|
|
117
|
+
This License is governed by the laws of the State of Idaho, without regard to
|
|
118
|
+
its conflict-of-laws provisions. Any dispute arising out of or related to this
|
|
119
|
+
License shall first be subject to good-faith negotiation for thirty (30) days,
|
|
120
|
+
and then, at AGLedger LLC's option, to binding arbitration under the rules of
|
|
121
|
+
the American Arbitration Association in Ada County, Idaho, or to the state or
|
|
122
|
+
federal courts located in Ada County, Idaho. You consent to the personal
|
|
123
|
+
jurisdiction and venue of those forums.
|
|
124
|
+
|
|
125
|
+
11. CONTACT
|
|
126
|
+
|
|
127
|
+
For licensing inquiries, contact: legal@agledger.ai
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @agledger/cli
|
|
2
2
|
|
|
3
|
-
The official CLI for the [AGLedger](https://agledger.ai) API
|
|
3
|
+
The official CLI for the [AGLedger](https://www.agledger.ai) API — accountability and audit infrastructure for agentic systems.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A **thin cover** over the API. The CLI passes your request straight through to the API and forwards the response — no hand-coded per-endpoint wrappers, no flag-to-body translation, no drift. Every AGLedger API route is reachable via `agledger api <METHOD> <path>`.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -13,73 +13,105 @@ npm install -g @agledger/cli
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
# Authenticate
|
|
17
16
|
export AGLEDGER_API_KEY=ach_ent_...
|
|
18
|
-
export AGLEDGER_API_URL=
|
|
17
|
+
export AGLEDGER_API_URL=https://your-agledger-instance
|
|
19
18
|
|
|
20
|
-
#
|
|
21
|
-
agledger
|
|
22
|
-
|
|
19
|
+
# Check health, identity, scopes, and get the quickstart workflow
|
|
20
|
+
agledger discover
|
|
21
|
+
|
|
22
|
+
# List contract types
|
|
23
|
+
agledger api GET /v1/schemas
|
|
24
|
+
|
|
25
|
+
# Create a mandate (raw JSON body)
|
|
26
|
+
agledger api POST /v1/mandates --data '{
|
|
27
|
+
"contractType": "ACH-PROC-v1",
|
|
28
|
+
"criteria": { "item_spec": "500 units copper wire", "quantity": { "target": 500 } }
|
|
29
|
+
}'
|
|
30
|
+
|
|
31
|
+
# Or build the body with typed fields
|
|
32
|
+
agledger api POST /v1/mandates \
|
|
33
|
+
-F contractType=ACH-PROC-v1 \
|
|
34
|
+
-F criteria.item_spec='500 units copper wire' \
|
|
35
|
+
-F criteria.quantity.target=500
|
|
23
36
|
|
|
24
37
|
# Submit a receipt
|
|
25
|
-
agledger
|
|
26
|
-
--data '{"
|
|
38
|
+
agledger api POST /v1/mandates/<mandate-id>/receipts \
|
|
39
|
+
--data '{"evidence":{"items_delivered":"copper wire","quantity_delivered":500}}'
|
|
27
40
|
|
|
28
41
|
# Render a verdict
|
|
29
|
-
agledger
|
|
42
|
+
agledger api POST /v1/mandates/<mandate-id>/outcome \
|
|
43
|
+
-F receiptId=<receipt-id> -F outcome=PASS
|
|
30
44
|
```
|
|
31
45
|
|
|
32
|
-
##
|
|
46
|
+
## Why a thin cover?
|
|
47
|
+
|
|
48
|
+
- **Zero drift.** When the API adds, renames, or removes a route, the CLI keeps working — no code change required.
|
|
49
|
+
- **One mental model.** The API docs are the CLI docs. What you read in the OpenAPI spec is what you type.
|
|
50
|
+
- **All 250+ routes on day one.** You get full parity, not a hand-picked subset.
|
|
51
|
+
|
|
52
|
+
## Ways to pass a body
|
|
53
|
+
|
|
54
|
+
| Flag | When to use |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `--data '{...}'` | Agent-friendly: one JSON string |
|
|
57
|
+
| `--input file.json` | Complex payloads; reuse files |
|
|
58
|
+
| `--input -` | Pipe JSON from stdin |
|
|
59
|
+
| `-F key=value` (repeatable) | Shell-friendly; typed (`true`/`false`/`null`/numbers); nested via `a.b=v`; arrays via `arr[]=v`; JSON literals via `k={...}` / `k=[...]` |
|
|
33
60
|
|
|
34
|
-
|
|
61
|
+
Merging order (low → high): `--data` → `--input` → `-F` → `--query`. Later sources override earlier keys.
|
|
35
62
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
63
|
+
## Agent-native DX
|
|
64
|
+
|
|
65
|
+
- `--json` on every command (auto when stdout is piped)
|
|
66
|
+
- `--quiet` suppresses output (exit code only)
|
|
67
|
+
- `--dry-run` on `agledger api` shows the request without sending
|
|
68
|
+
- `--paginate` on GET follows cursor pagination and streams NDJSON
|
|
69
|
+
- Structured errors on stderr: `{error: true, code, message, suggestion, ...}` — API errors pass through verbatim
|
|
70
|
+
- Semantic exit codes: 0 (OK), 2 (usage), 3 (auth), 4 (forbidden), 5 (not found), 6 (conflict), 7 (rate limit), 8 (server), 9 (network), 10 (timeout)
|
|
71
|
+
- `NO_COLOR` supported per [no-color.org](https://no-color.org)
|
|
43
72
|
|
|
44
73
|
## Discovery
|
|
45
74
|
|
|
46
75
|
```bash
|
|
47
|
-
#
|
|
48
|
-
agledger
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
agledger help-json "mandate create" --json
|
|
76
|
+
agledger list-commands --json # 9 CLI-local commands
|
|
77
|
+
agledger help-json api --json # Schema for `api` (args + flags)
|
|
78
|
+
agledger discover # Health + identity + quickstart
|
|
79
|
+
agledger api GET /openapi.json # Full API route catalog
|
|
52
80
|
```
|
|
53
81
|
|
|
54
|
-
##
|
|
82
|
+
## CLI-local commands (everything else is `agledger api`)
|
|
55
83
|
|
|
56
|
-
|
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
84
|
+
| Command | Purpose |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `api` | Call any API endpoint |
|
|
87
|
+
| `discover` | Health + identity + scopes + quickstart |
|
|
88
|
+
| `login` | Verify API key, store in `~/.agledger/config.json` (0600) |
|
|
89
|
+
| `logout` | Remove profile(s) |
|
|
90
|
+
| `auth` | Check current login state (exit 0 either way) |
|
|
91
|
+
| `config` | `list` / `get` / `use <profile>` / `path` |
|
|
92
|
+
| `verify` | Offline audit export verification (hash chain + Ed25519, no network) |
|
|
93
|
+
| `list-commands` | Inventory (this list) |
|
|
94
|
+
| `help-json` | Per-command schema |
|
|
67
95
|
|
|
68
96
|
## Authentication
|
|
69
97
|
|
|
70
|
-
Set `AGLEDGER_API_KEY` environment variable or pass `--api-key` flag:
|
|
71
|
-
|
|
72
98
|
```bash
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
# Verifies the key against the API, stores under ~/.agledger/config.json
|
|
100
|
+
agledger login --api-key ach_ent_... --profile prod
|
|
101
|
+
|
|
102
|
+
# Switch profiles
|
|
103
|
+
agledger config use prod
|
|
104
|
+
|
|
105
|
+
# Or just use env vars per-invocation
|
|
106
|
+
AGLEDGER_API_KEY=... AGLEDGER_API_URL=... agledger api GET /v1/mandates
|
|
75
107
|
```
|
|
76
108
|
|
|
77
|
-
Agent keys (`ach_age_*`)
|
|
109
|
+
Agent keys (`ach_age_*`) and enterprise keys (`ach_ent_*`) are both accepted — the API routes them appropriately.
|
|
78
110
|
|
|
79
111
|
## Requirements
|
|
80
112
|
|
|
81
113
|
- Node.js >= 22.0.0
|
|
82
|
-
- A running [AGLedger API](https://agledger.ai) instance
|
|
114
|
+
- A running [AGLedger API](https://www.agledger.ai) instance
|
|
83
115
|
|
|
84
116
|
## License
|
|
85
117
|
|
package/SKILL.md
CHANGED
|
@@ -1,25 +1,59 @@
|
|
|
1
1
|
# AGLedger CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Thin cover over the AGLedger API. The CLI passes your call through to the API and forwards the response — no flag-to-body translation, no drift.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
|
-
Requires: `AGLEDGER_API_KEY` env var or `--api-key` flag.
|
|
6
|
+
Requires: `AGLEDGER_API_KEY` env var or `--api-key` flag. Optional: `AGLEDGER_API_URL`.
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
1. `agledger schema list` — see available contract types
|
|
11
|
-
2. `agledger schema get <type>` — see required fields and examples
|
|
12
|
-
3. `agledger mandate create --type <type> --data '{"criteria":{...}}'` — create a mandate
|
|
13
|
-
4. `agledger receipt submit <mandateId> --data '{"evidence":{...}}'` — submit evidence when done
|
|
14
|
-
5. `agledger verdict render <mandateId> PASS --reason "..."` — record the outcome
|
|
8
|
+
## Primary command: `agledger api`
|
|
9
|
+
Call any API endpoint:
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
```
|
|
12
|
+
agledger api <METHOD> <PATH> [--data JSON | --input FILE | -F key=value ...]
|
|
13
|
+
```
|
|
19
14
|
|
|
20
|
-
##
|
|
15
|
+
## Workflow (start here)
|
|
16
|
+
1. `agledger discover` — health, identity, scopes, quickstart steps.
|
|
17
|
+
2. `agledger api GET /v1/schemas` — list contract types.
|
|
18
|
+
3. `agledger api GET /v1/schemas/{contractType}` — required fields + examples.
|
|
19
|
+
4. `agledger api POST /v1/mandates --data '{"contractType":"...","criteria":{...}}'` — create a mandate.
|
|
20
|
+
5. `agledger api POST /v1/mandates/{id}/receipts --data '{"evidence":{...}}'` — submit receipt when done.
|
|
21
|
+
6. Every API response includes `nextSteps` — follow them.
|
|
22
|
+
|
|
23
|
+
## Ways to pass a body
|
|
24
|
+
- `--data '{"k":"v"}'` — raw JSON string (agent-friendly)
|
|
25
|
+
- `--input file.json` — read JSON from file
|
|
26
|
+
- `--input -` — read JSON from stdin
|
|
27
|
+
- `-F key=value` — repeatable; types parsed (`true`/`false`/`null`/numbers); nested via `a.b=v`; arrays via `arr[]=v`
|
|
28
|
+
|
|
29
|
+
## Discovery commands
|
|
30
|
+
- `agledger list-commands --json` — full CLI inventory (9 commands)
|
|
31
|
+
- `agledger help-json <command> --json` — per-command schema with args and flags
|
|
32
|
+
- `agledger api GET /openapi.json` — full API route catalog
|
|
33
|
+
|
|
34
|
+
## Offline audit verification
|
|
35
|
+
- `agledger verify <audit-export.json>` — verify a mandate audit export offline (RFC 8785 hash chain + Ed25519). No network, no API key. Exit 0 if valid, 1 if broken; `--json` for structured output; `--keys <file>` overrides embedded keys; `--require-key-id <id>` for high-assurance flows.
|
|
36
|
+
|
|
37
|
+
**What verification proves:**
|
|
38
|
+
- Every entry was signed by a key listed in the export (or supplied via `--keys`) at the moment the vault wrote it.
|
|
39
|
+
- Payloads have not been altered since signing (SHA-256 recomputation matches stored `payloadHash`).
|
|
40
|
+
- The hash chain is contiguous — no entries were inserted, removed, or reordered between positions.
|
|
41
|
+
|
|
42
|
+
**What verification does NOT prove:**
|
|
43
|
+
- That the signing key is *legitimate* — verify the key against `/.well-known/agledger-vault-keys.json` on the issuing instance (or the `/v1/verification-keys` API) out-of-band.
|
|
44
|
+
- That the export is *complete* — a vault operator can still truncate the export at either end.
|
|
45
|
+
- That the *content* the payload describes actually happened. Payloads record what the agent reported (declared intent); the verifier does not cross-check against external systems.
|
|
46
|
+
|
|
47
|
+
## Agent-native patterns
|
|
21
48
|
- `--json` on every command (auto when piped)
|
|
22
|
-
- `--
|
|
23
|
-
- `--dry-run` on
|
|
24
|
-
-
|
|
25
|
-
-
|
|
49
|
+
- `--quiet` for exit-code-only operation
|
|
50
|
+
- `--dry-run` on `agledger api` shows the request without sending
|
|
51
|
+
- `--paginate` on GET follows cursors, streams NDJSON
|
|
52
|
+
- Structured errors on stderr: `{code, message, suggestion, ...}`
|
|
53
|
+
- Semantic exit codes (0-10)
|
|
54
|
+
|
|
55
|
+
## Credentials
|
|
56
|
+
- `agledger login --api-key <key> [--profile NAME]` — verifies key, stores in `~/.agledger/config.json` (0600)
|
|
57
|
+
- `agledger logout [--profile NAME | --all]`
|
|
58
|
+
- `agledger config list | get | use <profile> | path`
|
|
59
|
+
- `agledger auth` — check login state (exit 0 whether logged in or not)
|
package/dist/api-client.js
CHANGED
|
@@ -19,7 +19,7 @@ export class ApiClient {
|
|
|
19
19
|
const headers = {
|
|
20
20
|
Authorization: `Bearer ${this.apiKey}`,
|
|
21
21
|
Accept: 'application/json',
|
|
22
|
-
'User-Agent': 'agledger-cli/0.
|
|
22
|
+
'User-Agent': 'agledger-cli/0.5.2',
|
|
23
23
|
};
|
|
24
24
|
if (options?.body !== undefined) {
|
|
25
25
|
headers['Content-Type'] = 'application/json';
|
package/dist/base.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AGLedger CLI — Base command with dual-mode output and
|
|
3
|
-
*
|
|
2
|
+
* AGLedger CLI — Base command with dual-mode output, auth, and error forwarding.
|
|
3
|
+
* The CLI is a thin pass-through over the API — this base exists to make that
|
|
4
|
+
* pass-through consistent (same exit codes, same error shape, same output modes).
|
|
4
5
|
*/
|
|
5
6
|
import { Command } from '@oclif/core';
|
|
6
7
|
import { ApiClient } from './api-client.js';
|
|
7
8
|
import type { ApiResponse } from './api-client.js';
|
|
8
|
-
/** Semantic exit codes for agent consumption. */
|
|
9
|
+
/** Semantic exit codes for agent consumption. Stable across releases. */
|
|
9
10
|
export declare const ExitCode: {
|
|
10
11
|
readonly SUCCESS: 0;
|
|
11
12
|
readonly GENERAL_ERROR: 1;
|
|
@@ -19,6 +20,24 @@ export declare const ExitCode: {
|
|
|
19
20
|
readonly NETWORK_ERROR: 9;
|
|
20
21
|
readonly TIMEOUT: 10;
|
|
21
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Canonical CLI-origin error codes emitted in the `code` field of structured errors.
|
|
25
|
+
* Used only when the CLI itself can't forward an API error (no auth, bad JSON input,
|
|
26
|
+
* network failure). API-origin codes come through untouched from the API response body.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ErrorCode: {
|
|
29
|
+
readonly AUTH_REQUIRED: "AUTH_REQUIRED";
|
|
30
|
+
readonly COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND";
|
|
31
|
+
readonly MISSING_INPUT: "MISSING_INPUT";
|
|
32
|
+
readonly INVALID_JSON_INPUT: "INVALID_JSON_INPUT";
|
|
33
|
+
readonly INVALID_PATH: "INVALID_PATH";
|
|
34
|
+
readonly INVALID_METHOD: "INVALID_METHOD";
|
|
35
|
+
readonly INVALID_FIELD: "INVALID_FIELD";
|
|
36
|
+
readonly FILE_READ_ERROR: "FILE_READ_ERROR";
|
|
37
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
38
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
39
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
40
|
+
};
|
|
22
41
|
export declare abstract class BaseCommand extends Command {
|
|
23
42
|
static baseFlags: {
|
|
24
43
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -32,34 +51,36 @@ export declare abstract class BaseCommand extends Command {
|
|
|
32
51
|
'api-key'?: string;
|
|
33
52
|
'api-url'?: string;
|
|
34
53
|
}): ApiClient;
|
|
35
|
-
/**
|
|
36
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Call the API. Path is passed through as-is — caller provides the full path
|
|
56
|
+
* (e.g. `/v1/mandates`, `/health`, `/federation/v1/register`). No auto-prefixing.
|
|
57
|
+
*/
|
|
58
|
+
protected callApi(flags: {
|
|
37
59
|
'api-key'?: string;
|
|
38
60
|
'api-url'?: string;
|
|
39
61
|
}, method: string, path: string, options?: {
|
|
40
62
|
query?: Record<string, unknown>;
|
|
41
63
|
body?: unknown;
|
|
42
|
-
}): Promise<
|
|
43
|
-
protected output(data:
|
|
44
|
-
protected outputPage(page: {
|
|
45
|
-
data: unknown[];
|
|
46
|
-
hasMore?: boolean;
|
|
47
|
-
cursor?: string;
|
|
48
|
-
}, columns: string[]): void;
|
|
64
|
+
}): Promise<ApiResponse>;
|
|
65
|
+
protected output(data: unknown): void;
|
|
49
66
|
protected outputNdjson(item: unknown): void;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Show a dry-run payload. Suppressed under --quiet. Writes header to stderr, payload to stdout.
|
|
69
|
+
* `label` describes the action concretely so agents can log what would have happened.
|
|
70
|
+
*/
|
|
71
|
+
protected dryRunOutput(payload: unknown, label: string): void;
|
|
72
|
+
/** Parse JSON with structured error on failure. Use for any user-supplied JSON input. */
|
|
73
|
+
protected parseJsonInput(source: string, fieldName: string): unknown;
|
|
74
|
+
/** Read and parse a JSON file with structured errors. `-` reads from stdin. */
|
|
75
|
+
protected readJsonSource(path: string, fieldName: string): unknown;
|
|
58
76
|
protected failWith(code: string, message: string, exitCode: number, suggestion?: string): never;
|
|
59
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Forward the full API error body to stderr verbatim. The API owns error
|
|
79
|
+
* guidance (code, message, suggestion, validationErrors, nextSteps); the CLI
|
|
80
|
+
* does not enrich, translate, or inject fields the API didn't return.
|
|
81
|
+
*/
|
|
60
82
|
protected handleApiError(response: ApiResponse): never;
|
|
61
83
|
protected handleError(err: unknown): never;
|
|
62
|
-
private recoveryHint;
|
|
63
84
|
private statusToExitCode;
|
|
64
85
|
}
|
|
65
86
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,yEAAyE;AACzE,eAAO,MAAM,QAAQ;;;;;;;;;;;;CAYX,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;CAYZ,CAAC;AAEX,8BAAsB,WAAY,SAAQ,OAAO;IAC/C,MAAM,CAAC,SAAS;;;;;MAKd;IAEF,SAAS,KAAK,MAAM,IAAI,OAAO,CAE9B;IAED,SAAS,KAAK,OAAO,IAAI,OAAO,CAE/B;IAED,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAYvF;;;OAGG;cACa,OAAO,CACrB,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACjD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAC5D,OAAO,CAAC,WAAW,CAAC;IAKvB,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IASrC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAK3C;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ7D,yFAAyF;IACzF,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAepE,+EAA+E;IAC/E,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAoBlE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK;IAQ/F;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,KAAK;IAStD,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK;IA0B1C,OAAO,CAAC,gBAAgB;CASzB"}
|