nirium-cli 1.1.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +106 -0
  2. package/bin/nirium.js +4 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -57,12 +57,118 @@ Scaffolds a project that connects to a Nirium agent and prints incoming
57
57
  signals, which the autonomous loop produces on testnet. Defaults to `https://nirium-agent.fly.dev` (testnet); set
58
58
  `NIRIUM_API_URL` and `NIRIUM_API_KEY` in `.env` to point somewhere else.
59
59
 
60
+ ## Pay an x402 endpoint from the terminal
61
+
62
+ ```bash
63
+ nirium pay https://your-api.example.com/premium/signals --secret S...
64
+ ```
65
+
66
+ Signs and settles a real x402 payment against any endpoint that returns a
67
+ 402, then prints the response. No scaffolding involved — this hits a live
68
+ server directly, useful for testing a `nirium serve` instance or someone
69
+ else's paid API without writing a client.
70
+
71
+ | Option | Purpose |
72
+ |---|---|
73
+ | `-s, --secret <secret>` | Stellar secret key (`S...`) that pays. Also read from `NIRIUM_SECRET_KEY` or `nirium config set secretKey S...`, in that order. |
74
+ | `-n, --network <network>` | `stellar:testnet` (default) or `stellar:pubnet` |
75
+ | `-a, --amount <amount>` | Override the price the server advertises |
76
+ | `--json` | Machine-readable result: status, duration, payer, tx hash, response body |
77
+
78
+ The secret key never leaves your machine except as a signature — the CLI
79
+ signs locally and sends the signed payment, not the key itself. Missing a
80
+ secret key fails immediately with the three ways to supply one, before any
81
+ network call happens.
82
+
83
+ ## Spin up a local x402 test server
84
+
85
+ ```bash
86
+ nirium serve --pay-to G... --api-key <facilitator-key>
87
+ ```
88
+
89
+ A one-command x402 server for testing `nirium pay` (or any x402 client)
90
+ against, without scaffolding a whole project. Same facilitator requirement
91
+ as `create x402`: get a free key at
92
+ [channels.openzeppelin.com/gen](https://channels.openzeppelin.com/gen).
93
+
94
+ | Option | Values | Default |
95
+ |---|---|---|
96
+ | `-P, --pay-to <address>` | Stellar `G...` address that receives payments | required |
97
+ | `-k, --api-key <key>` | facilitator API key | required |
98
+ | `-p, --price <price>` | e.g. `$0.02` | `$0.02` |
99
+ | `-port, --port <port>` | | `3000` |
100
+ | `-r, --route <route>` | path to protect | `/api/v1/data` |
101
+ | `-n, --network <network>` | `stellar:testnet` or `stellar:pubnet` | `stellar:testnet` |
102
+
103
+ `--pay-to` and `--api-key` can also come from `nirium config set` instead
104
+ of being passed every time.
105
+
60
106
  ## Check an agent
61
107
 
62
108
  ```bash
63
109
  nirium status
64
110
  ```
65
111
 
112
+ ## Diagnose your x402/MPP setup
113
+
114
+ ```bash
115
+ nirium doctor --network testnet
116
+ ```
117
+
118
+ Five checks against your actual environment before you find out the hard
119
+ way in production: `payTo` is a well-formed public key (not a secret key
120
+ pasted in the wrong field — a real mistake this catches), the facilitator
121
+ API key authenticates against `channels.openzeppelin.com`, the Soroban RPC
122
+ endpoint for your target network is reachable, `STELLAR_SECRET_KEY` (if
123
+ set) is validly formatted, and MPP config (if set) is internally
124
+ consistent. Reads from `.env` in the current directory by default.
125
+
126
+ | Option | Purpose |
127
+ |---|---|
128
+ | `-n, --network <network>` | `testnet` (default) or `pubnet` |
129
+ | `-c, --config <path>` | custom `.env`/config path |
130
+ | `--json` | machine-readable report for CI |
131
+
132
+ Exits non-zero if any check fails, so it's usable as a CI gate ahead of a
133
+ deploy.
134
+
135
+ ## Verify an audit record
136
+
137
+ ```bash
138
+ nirium verify <cid>
139
+ ```
140
+
141
+ Independently re-checks a Nirium audit document anchored to IPFS: fetches
142
+ it from a gateway, recomputes its SHA-256 content hash, and — if the
143
+ document carries an agent attestation — verifies the ed25519 signature
144
+ over `nirium-audit-v1:<content_sha256>` against the declared signer's
145
+ Stellar public key. Nothing here trusts the document's own claims about
146
+ itself; both the hash and the signed statement are recomputed from the
147
+ raw content, not read off the document.
148
+
149
+ | Option | Purpose |
150
+ |---|---|
151
+ | `-g, --gateway <url>` | IPFS gateway to fetch from | `https://gateway.pinata.cloud` |
152
+ | `--json` | machine-readable result |
153
+
154
+ Exits non-zero (and prints which check failed) if the hash doesn't match
155
+ or the signature doesn't verify.
156
+
157
+ ## Manage stored credentials
158
+
159
+ ```bash
160
+ nirium config set secretKey S...
161
+ nirium config list
162
+ nirium config get payTo
163
+ nirium config delete facilitatorApiKey
164
+ ```
165
+
166
+ Stores `secretKey`, `payTo`, `network`, and `facilitatorApiKey` in
167
+ `~/.niriumrc.json` (mode `600`) so `pay`, `serve`, and `doctor` don't need
168
+ them repeated on every invocation — command-line flags and environment
169
+ variables still take priority when present. `list` and `get` mask secret
170
+ values in their output; the raw file is never printed.
171
+
66
172
  ## Options
67
173
 
68
174
  | Option | Values | Default |
package/bin/nirium.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // ═══════════════════════════════════════════════════════════════
4
- // Nirium — Autonomous Agent CLI (v1.1.0)
4
+ // Nirium — Autonomous Agent CLI (v1.1.2)
5
5
  // ═══════════════════════════════════════════════════════════════
6
6
  //
7
7
  // Everything below is one flat file on purpose, not a build artifact:
@@ -25,7 +25,7 @@ const program = new Command();
25
25
  program
26
26
  .name('nirium')
27
27
  .description('Nirium protocol development tool')
28
- .version('1.1.0');
28
+ .version('1.1.2');
29
29
 
30
30
  // --- COMMAND: create bot ---
31
31
  program
@@ -186,7 +186,7 @@ function scaffoldX402(dir, name) {
186
186
  type: 'module',
187
187
  scripts: { dev: 'tsx watch src/server.ts', build: 'tsc' },
188
188
  dependencies: {
189
- nirium: '^0.13.0',
189
+ nirium: '^0.14.0',
190
190
  express: '^5.1.0',
191
191
  '@x402/express': '^2.17.0',
192
192
  '@x402/core': '^2.17.0',
@@ -252,7 +252,7 @@ function scaffoldTS(dir, name) {
252
252
  "build": "tsc"
253
253
  },
254
254
  dependencies: {
255
- "nirium": "^0.13.0",
255
+ "nirium": "^0.14.0",
256
256
  "tsx": "^4.19.0",
257
257
  "typescript": "^5.7.0",
258
258
  "dotenv": "^16.4.5"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nirium-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Nirium CLI — scaffold Stellar agent projects and check agent status",
5
5
  "main": "bin/nirium.js",
6
6
  "type": "module",