@agledger/cli 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/SKILL.md +18 -18
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +12 -3
- package/dist/commands/auth.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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://agledger.ai) API: accountability infrastructure for AI agents. The Layer 3 accountability layer of the agent stack.
|
|
4
4
|
|
|
5
|
-
A **thin cover** over the API. The CLI passes your request straight through to the API and forwards the response
|
|
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
|
**Learn more**
|
|
8
8
|
|
|
9
|
-
- [agledger.ai](https://agledger.ai)
|
|
10
|
-
- [How it works](https://agledger.ai/how-it-works)
|
|
11
|
-
- [Glossary](https://agledger.ai/glossary)
|
|
12
|
-
- [API reference](https://agledger.ai/api)
|
|
13
|
-
- [Documentation](https://agledger.ai/docs)
|
|
9
|
+
- [agledger.ai](https://agledger.ai): what AGLedger is and why Layer 3 accountability matters
|
|
10
|
+
- [How it works](https://agledger.ai/how-it-works): the four-endpoint lifecycle (record, completion, verdict, fulfill)
|
|
11
|
+
- [Glossary](https://agledger.ai/glossary): canonical definitions of Record, Completion, SCITT Receipt, Verdict, Settlement Signal
|
|
12
|
+
- [API reference](https://agledger.ai/api): every endpoint the CLI covers
|
|
13
|
+
- [Documentation](https://agledger.ai/docs): installation and integration guides
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -44,7 +44,7 @@ agledger api POST /v1/records \
|
|
|
44
44
|
-F criteria.task_description='summarize Q3 filings'
|
|
45
45
|
|
|
46
46
|
# Submit a completion. On a gated record the principal then renders a Verdict
|
|
47
|
-
# (accept / reject) on the Completion
|
|
47
|
+
# (accept / reject) on the Completion; use the route documented in the API
|
|
48
48
|
# (see `agledger api GET /openapi.json`).
|
|
49
49
|
agledger api POST /v1/records/<record-id>/completions \
|
|
50
50
|
--data '{"evidence":{"summary":"delivered 500x copper wire","evidenceUrl":"https://orders.example.com/CW-500"}}'
|
|
@@ -52,7 +52,7 @@ agledger api POST /v1/records/<record-id>/completions \
|
|
|
52
52
|
|
|
53
53
|
## Why a thin cover?
|
|
54
54
|
|
|
55
|
-
- **Zero drift.** When the API adds, renames, or removes a route, the CLI keeps working
|
|
55
|
+
- **Zero drift.** When the API adds, renames, or removes a route, the CLI keeps working, no code change required.
|
|
56
56
|
- **One mental model.** The API docs are the CLI docs. What you read in the OpenAPI spec is what you type.
|
|
57
57
|
- **All 250+ routes on day one.** You get full parity, not a hand-picked subset.
|
|
58
58
|
|
|
@@ -73,7 +73,7 @@ Merging order (low → high): `--data` → `--input` → `-F` → `--query`. Lat
|
|
|
73
73
|
- `--quiet` suppresses output (exit code only)
|
|
74
74
|
- `--dry-run` on `agledger api` shows the request without sending
|
|
75
75
|
- `--paginate` on GET follows cursor pagination and streams NDJSON
|
|
76
|
-
- Structured errors on stderr: `{error: true, code, message, suggestion, ...}
|
|
76
|
+
- Structured errors on stderr: `{error: true, code, message, suggestion, ...}`; API errors pass through verbatim
|
|
77
77
|
- 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)
|
|
78
78
|
- `NO_COLOR` supported per [no-color.org](https://no-color.org)
|
|
79
79
|
|
|
@@ -107,7 +107,7 @@ agledger api GET /openapi.json # Full API route catalog
|
|
|
107
107
|
# Verifies the key against the API, then stores it under ~/.agledger/config.json (0600)
|
|
108
108
|
agledger login --api-key agl_adm_... --profile prod
|
|
109
109
|
|
|
110
|
-
# Switch the active profile
|
|
110
|
+
# Switch the active profile; subsequent commands use its key automatically
|
|
111
111
|
agledger config use prod
|
|
112
112
|
|
|
113
113
|
# Run a one-off against a specific stored profile
|
|
@@ -117,14 +117,14 @@ agledger api GET /v1/records --profile prod
|
|
|
117
117
|
AGLEDGER_API_KEY=... AGLEDGER_API_URL=... agledger api GET /v1/records
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
**Credential precedence** (highest first)
|
|
120
|
+
**Credential precedence** (highest first), applied per command:
|
|
121
121
|
|
|
122
122
|
- **API key:** `--api-key` flag → `AGLEDGER_API_KEY` env → stored profile (`--profile <name>`, else the active profile).
|
|
123
123
|
- **API URL:** `--api-url` flag → `AGLEDGER_API_URL` env → stored profile URL → default.
|
|
124
124
|
|
|
125
125
|
So once you `agledger login`, plain `agledger api ...` calls authenticate from the stored profile with no flags or env. `--dry-run` echoes the resolved auth (URL, source, masked key) so you can confirm which credentials a call would use without sending it.
|
|
126
126
|
|
|
127
|
-
Agent keys (`agl_agt_*`) and admin keys (`agl_adm_*`) are both accepted
|
|
127
|
+
Agent keys (`agl_agt_*`) and admin keys (`agl_adm_*`) are both accepted; the API routes them appropriately.
|
|
128
128
|
|
|
129
129
|
## Requirements
|
|
130
130
|
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGLedger CLI
|
|
2
2
|
|
|
3
|
-
Thin cover over the AGLedger API. The CLI passes your call through to the API and forwards the response
|
|
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
6
|
Credentials resolve per command with this precedence: `--api-key` flag > `AGLEDGER_API_KEY` env > stored profile (after `agledger login`). API URL: `--api-url` flag > `AGLEDGER_API_URL` env > stored profile URL > default. Optional: `AGLEDGER_API_URL`.
|
|
@@ -13,26 +13,26 @@ agledger api <METHOD> <PATH> [--data JSON | --input FILE | -F key=value ...]
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Workflow (start here)
|
|
16
|
-
1. `agledger discover
|
|
17
|
-
2. `agledger api GET /v1/schemas
|
|
18
|
-
3. `agledger api GET /v1/schemas/{type}
|
|
19
|
-
4. `agledger api POST /v1/records --data '{"type":"...","criteria":{...}}'
|
|
20
|
-
5. `agledger api POST /v1/records/{id}/completions --data '{"evidence":{...}}'
|
|
21
|
-
6. Every API response includes `nextSteps
|
|
16
|
+
1. `agledger discover`: health, identity, scopes, quickstart steps.
|
|
17
|
+
2. `agledger api GET /v1/schemas`: list Record types.
|
|
18
|
+
3. `agledger api GET /v1/schemas/{type}`: required fields + examples.
|
|
19
|
+
4. `agledger api POST /v1/records --data '{"type":"...","criteria":{...}}'`: create a record.
|
|
20
|
+
5. `agledger api POST /v1/records/{id}/completions --data '{"evidence":{...}}'`: submit completion when done.
|
|
21
|
+
6. Every API response includes `nextSteps`. Follow them.
|
|
22
22
|
|
|
23
23
|
## Ways to pass a body
|
|
24
|
-
- `--data '{"k":"v"}'
|
|
25
|
-
- `--input file.json
|
|
26
|
-
- `--input
|
|
27
|
-
- `-F key=value
|
|
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
28
|
|
|
29
29
|
## Discovery commands
|
|
30
|
-
- `agledger list-commands --json
|
|
31
|
-
- `agledger help-json <command> --json
|
|
32
|
-
- `agledger api GET /openapi.json
|
|
30
|
+
- `agledger list-commands --json`: full CLI inventory (10 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
33
|
|
|
34
34
|
## Offline audit verification
|
|
35
|
-
- `agledger verify <audit-export.json
|
|
35
|
+
- `agledger verify <audit-export.json>`: verify a record audit export offline (COSE_Sign1 envelopes per RFC 9052, hash chain + Ed25519 signatures). No network, no API key. Exit 0 if valid, 1 if broken; `--json` for structured output; `--keys <file>` supplies keys out of band (merged over any embedded in the export); `--require-key-id <id>` rejects exports signed by an unexpected key; `--require-out-of-band-keys` refuses the export's own embedded keys for an independent audit.
|
|
36
36
|
|
|
37
37
|
**What verification proves:**
|
|
38
38
|
- Every entry was signed by a key listed in the export (or supplied via `--keys`) at the moment the vault wrote it.
|
|
@@ -54,8 +54,8 @@ agledger api <METHOD> <PATH> [--data JSON | --input FILE | -F key=value ...]
|
|
|
54
54
|
- Semantic exit codes (0-10)
|
|
55
55
|
|
|
56
56
|
## Credentials
|
|
57
|
-
- `agledger login --api-key <key> [--profile NAME]
|
|
58
|
-
- `agledger config use <profile
|
|
57
|
+
- `agledger login --api-key <key> [--profile NAME]`: verifies key, stores in `~/.agledger/config.json` (0600). After login, plain `agledger api ...` calls authenticate from the stored profile (no flag/env needed).
|
|
58
|
+
- `agledger config use <profile>`: set the active profile; `agledger api ... --profile NAME` uses a specific one per-invocation.
|
|
59
59
|
- `agledger logout [--profile NAME | --all]`
|
|
60
60
|
- `agledger config list | get | use <profile> | path`
|
|
61
|
-
- `agledger auth
|
|
61
|
+
- `agledger auth`: check login state (exit 0 whether logged in or not)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW;IAC3C,OAAgB,WAAW,SACiF;IAE5G,OAAgB,KAAK;;;;;;MAAgC;IAE/C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW;IAC3C,OAAgB,WAAW,SACiF;IAE5G,OAAgB,KAAK;;;;;;MAAgC;IAE/C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B3B"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -9,8 +9,12 @@ export default class Auth extends BaseCommand {
|
|
|
9
9
|
static flags = { ...BaseCommand.baseFlags };
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = await this.parse(Auth);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// Resolve the key the same way an actual call does: --api-key flag > env >
|
|
13
|
+
// stored profile in ~/.agledger/config.json. The previous check looked only
|
|
14
|
+
// at the flag/env, so `agledger auth` reported not-authenticated right after
|
|
15
|
+
// a successful `login` wrote the key to a profile (cross-repo #94).
|
|
16
|
+
const auth = this.resolvedAuth(flags);
|
|
17
|
+
if (auth.source === 'none') {
|
|
14
18
|
this.output({ authenticated: false, message: 'No API key configured. Run `agledger login --api-key <key>`.' });
|
|
15
19
|
return;
|
|
16
20
|
}
|
|
@@ -19,7 +23,12 @@ export default class Auth extends BaseCommand {
|
|
|
19
23
|
if (!response.ok) {
|
|
20
24
|
this.handleApiError(response);
|
|
21
25
|
}
|
|
22
|
-
this.output({
|
|
26
|
+
this.output({
|
|
27
|
+
authenticated: true,
|
|
28
|
+
source: auth.source,
|
|
29
|
+
...(auth.profile ? { profile: auth.profile } : {}),
|
|
30
|
+
account: response.body,
|
|
31
|
+
});
|
|
23
32
|
}
|
|
24
33
|
catch (err) {
|
|
25
34
|
this.handleError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,Y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AAC,CAAC;YAChC,CAAC;YACD,IAAI,CAAC,MAAM,CAAC;gBACV,aAAa,EAAE,IAAI;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClD,OAAO,EAAE,QAAQ,CAAC,IAAI;aACvB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agledger/cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "AGLedger CLI
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "AGLedger CLI: developer and agent interface for AGLedger",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|