@hyperscale0/cli 1.0.328 → 1.0.330

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 (4) hide show
  1. package/AGENTS.md +40 -12
  2. package/README.md +145 -9
  3. package/hyperscale.js +1344 -55
  4. package/package.json +2 -2
package/AGENTS.md CHANGED
@@ -2,31 +2,53 @@
2
2
 
3
3
  Hyperscale is the operating system for financial products: providers are the hardware and ADL adapters are the drivers. The CLI is its `kubectl`, a client of the same operation API as portals, MCP and SDK; read [how Hyperscale fits](https://hyperscale0.ai/docs/runtime.md#how-hyperscale-fits).
4
4
 
5
- Use `hyperscale help --json` for the complete tree, flags and examples.
5
+ Use `hyperscale help --json` for the complete tree: usage, flags, examples,
6
+ scopes and the operation behind each command. `help --all --json` adds the
7
+ operations that have no command; call those with `api call`.
6
8
  Use `hyperscale <group> <command> --help --json` for one command.
7
9
 
8
10
  ```text
9
- auth login, signup, logout
11
+ auth login, signup, verify, logout
10
12
  whoami verify login and show the selected product
11
13
  product create, list, show, select
12
14
  hsx pull, check, plan, apply, watch
13
- key create, list, revoke
15
+ pricing price list and the selected product's fees
16
+ key create, list, show, revoke, rotate
14
17
  action list, show, run
15
18
  object kinds, list, show, create, actions, run
16
- activity list, tail
19
+ activity list, show, tail
17
20
  architect chat
21
+ agent setup
18
22
  api list, call, resume
19
23
  open Launch or Build product page
20
24
  help command tree
21
25
  ```
22
26
 
23
- Start with `hyperscale auth login --no-open --json`. The URL and code go to
24
- stderr. A person approves them in the browser. Rerun to resume a pending login.
25
- Verify with `hyperscale whoami --json`. Signup uses `auth signup --email <email>
26
- --name <name> --company <company>`. Do not print or persist credentials in
27
- project files.
27
+ The other groups (customer, account, transfer, webhook, event, report and the
28
+ rest) map one command to one tenant operation. Path IDs are arguments; tenant
29
+ and product IDs come from the login and the selected product. Lists accept
30
+ `--limit <n>`, `--cursor <c>` or `--all`. Mutations send an idempotency key;
31
+ pass `--idempotency-key` to retry safely. Without a TTY a missing required flag
32
+ exits 2 and names the flag.
28
33
 
29
- Browser login creates a named agent member with its own CLI grant. Access
34
+ Check `hyperscale whoami --json` first. To sign in a founder who has an
35
+ account, pipe their password on stdin to `auth login --email <email> --json`;
36
+ it mails a six-digit code and exits. Ask the founder for the code, then run
37
+ `auth login --code <code> --json`. To approve in a browser instead, run
38
+ `auth login --no-open --json`: the first stdout line is `approval_needed` with
39
+ the code and URL, and the last is `signed_in`. Rerun to resume a pending login.
40
+ For CI, pipe a `hyperscale_pat_` token to `auth login --with-token`. To create an account, pipe the
41
+ founder's password on stdin to `auth signup --email <email> --name <name>
42
+ --company <company> --json`; it mails a six-digit code and exits. Ask the
43
+ founder for the code, then run `auth signup --code <code> --json`. The account
44
+ starts in sandbox. `auth verify` confirms an existing account's email the same
45
+ way. Do not print or persist credentials in project files.
46
+
47
+ Either login creates a named agent member with its own CLI grant. In sandbox
48
+ it acts as the founder, `--on-behalf-of` included; `whoami` shows the
49
+ founder's team role. The grant ends after 30 days, or 7 days unused, and so do
50
+ sandbox keys `key create --name <name>` makes from it. `doctor` names where the
51
+ token is stored. Access
30
52
  tokens last ten minutes; the CLI rotates the refresh token and keeps both in
31
53
  Keychain or a mode 0600 file. Logout removes them locally. Revoke the member or
32
54
  grant in the browser; `--revoke` only revokes a human PAT. Sandbox work within
@@ -34,12 +56,18 @@ the grant runs directly. A live action exits 3 with `agent_approval_required`
34
56
  and a browser link; a human approves it with their password. The CLI cannot
35
57
  approve its own work.
36
58
 
59
+ `agent setup [claude-code|codex|cursor]` writes the Hyperscale MCP server into
60
+ that host's project config and prints the file it wrote. The config reads a
61
+ sandbox Product key from `HYPERSCALE_API_KEY` (`--key-env` names another
62
+ variable) and never contains the key. `--oauth` writes browser sign-in instead.
63
+
37
64
  Every command accepts `--json`. Ordinary success is one JSON value on stdout;
38
65
  failure is an error object on stderr. Errors retain status, code, message,
39
66
  fix, details and available request, operation, receipt and trace IDs.
40
67
  JSON output has no ANSI codes, banners, spinners or prompts.
41
- Exit codes: 0 success, 1 failure, 2 HSX check or plan cannot proceed,
42
- 3 live action waiting for human approval.
68
+ Exit codes: 0 success, 1 failure, 2 usage error or HSX check or plan cannot
69
+ proceed, 3 live action waiting for human approval, 4 not signed in or missing
70
+ scope, 5 not found, 6 conflict such as a reused idempotency key.
43
71
 
44
72
  `hsx watch --json` emits one JSON object per line with `type` set to `check`,
45
73
  `plan` or `error`. Check and plan events contain `data`; errors contain `error`.
package/README.md CHANGED
@@ -22,16 +22,41 @@ hyperscale whoami
22
22
 
23
23
  Approve the URL and code in your browser. The CLI saves your login on this
24
24
  device. Use `--no-open` to approve on another device. A pending sign-in resumes
25
- when you run the command again. To create an account:
25
+ when you run the command again.
26
+
27
+ On a machine with no browser, sign in with your password and an emailed code:
28
+ `hyperscale auth login --email you@example.com`. Without a terminal, pipe the
29
+ password and finish in a second call:
26
30
 
27
31
  ```sh
28
- hyperscale auth signup --email you@example.com --name "Your name" --company Acme
32
+ printf '%s\n' "$PASSWORD" | hyperscale auth login --email you@example.com --json
33
+ hyperscale auth login --code 123456 --json
29
34
  ```
30
35
 
36
+ A login ends after 30 days, or 7 days unused. `whoami` shows when.
37
+ `hyperscale doctor` names where the token is stored: the macOS Keychain or a
38
+ private file in the config folder. For CI, pipe a personal access token to
39
+ `hyperscale auth login --with-token`, or set `HYPERSCALE_TOKEN`.
40
+
41
+ To create an account without a browser, run `hyperscale auth signup`. It asks
42
+ for your name, work email, company and a password, solves a short proof of work,
43
+ and mails a six-digit code. Type the code and the CLI is signed in to the new
44
+ sandbox account. An agent without a terminal passes the flags, pipes the
45
+ password on stdin, and finishes with the code in a second call:
46
+
47
+ ```sh
48
+ printf '%s\n' "$PASSWORD" | hyperscale auth signup --email you@example.com --name "Your name" --company Acme --json
49
+ hyperscale auth signup --code 123456 --json
50
+ ```
51
+
52
+ `hyperscale auth verify` confirms the email of an existing account the same
53
+ way. The browser signup and its email link keep working.
54
+
31
55
  `hyperscale auth logout` removes the local login. Add `--revoke` to revoke the
32
56
  token too. Tokens and saved requests use macOS Keychain when available, with
33
57
  an owner-only file fallback (mode 0600). `HYPERSCALE_CREDENTIAL_STORE=file`
34
- selects file storage. `HYPERSCALE_CONFIG_DIR` sets its directory.
58
+ selects file storage. `HYPERSCALE_CONFIG_DIR` or `--config-dir <path>` sets its
59
+ directory.
35
60
 
36
61
  ## Work on a product
37
62
 
@@ -40,6 +65,7 @@ hyperscale product list
40
65
  hyperscale product select <id>
41
66
  hyperscale hsx pull product.hsx
42
67
  hyperscale hsx check product.hsx
68
+ hyperscale pricing
43
69
  hyperscale hsx plan product.hsx --config settings.json --json > plan.json
44
70
  hyperscale hsx apply product.hsx --config settings.json --plan-file plan.json --yes
45
71
  hyperscale hsx watch product.hsx --plan --config settings.json
@@ -53,7 +79,86 @@ contain `partyBindings`, a map of participant names to IDs.
53
79
 
54
80
  Create a new product with `product create --source product.hsx --name Savings
55
81
  --config settings.json`. Use `product show` for the current product, or pass
56
- an ID. `--product <id>` selects a product for one command.
82
+ an ID. `--product <id>` selects a product for one command. `pricing` shows the
83
+ price list and the selected product's own monthly and activation fees; sandbox
84
+ use is free.
85
+
86
+ ## Develop against the sandbox
87
+
88
+ ```sh
89
+ hyperscale init my-store
90
+ cd my-store
91
+ hyperscale hsx plan
92
+ hyperscale hsx apply --confirm
93
+ hyperscale scenario run day.json
94
+ ```
95
+
96
+ `init` pulls the Product's HSX and settings, writes a first scenario and
97
+ links the directory with `hyperscale.json`. Inside a linked directory every
98
+ command uses its Product and environment, and `hsx check`, `plan`, `apply` and
99
+ `watch` need no file arguments: plan saves its review in `.hyperscale/` and
100
+ apply reads it from there. `link` links an existing `.hsx` file instead.
101
+ `--template storefront` also writes a Vite React shop whose server holds the
102
+ Product key; it runs in mock mode until you add one.
103
+
104
+ A scenario is a JSON story that runs in the sandbox and stops at the first
105
+ step that fails:
106
+
107
+ ```json
108
+ {
109
+ "scenario": "A first rental",
110
+ "customers": { "maya": { "name": "Maya Brooks", "fund": "1000" } },
111
+ "steps": [
112
+ {
113
+ "create": "rental",
114
+ "as": "camera",
115
+ "by": "maya",
116
+ "fields": { "item": "Camera", "renter": "Maya", "price": "750" }
117
+ },
118
+ { "run": "agree_rental", "on": "camera", "by": "maya" },
119
+ { "advance": "4d" },
120
+ { "fund": "maya", "amount": "50" },
121
+ {
122
+ "name": "Maya has her change",
123
+ "expect": { "balances": { "maya": { "settled": "300.00" } } }
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ Each customer is created, given a sandbox account and funded first. `create`
130
+ makes an object, `run` runs an action on it, `fund` adds sandbox money,
131
+ `advance` moves the sandbox clock (`30m`, `4h`, `2d`, `1w` or an ISO time) and
132
+ `expect` checks balances. A plain balance compares to `available`; an object
133
+ can name `available`, `settled` or `pending`. Amounts are major units, as
134
+ `fund` takes them (`"750"` or `"750.50"` in SAR), in money fields and action
135
+ input too; the runner sends the API minor units. Funding and actions need the
136
+ Product key in `HYPERSCALE_API_KEY`. `scenario init` writes a working example for the
137
+ Product.
138
+
139
+ ```sh
140
+ hyperscale listen --forward-to http://localhost:3000/webhooks
141
+ hyperscale event resend <event-id> --forward-to http://localhost:3000/webhooks
142
+ hyperscale log tail --status failed --since 1h
143
+ hyperscale log explain <request-id>
144
+ hyperscale doctor
145
+ hyperscale docs operate
146
+ hyperscale export records --type receipts --from 2026-07-01 > receipts.csv
147
+ ```
148
+
149
+ `listen` forwards the Product's sandbox events as Standard Webhooks
150
+ deliveries: `webhook-id`, `webhook-timestamp` and `webhook-signature`, signed
151
+ with the `whsec_` secret it prints. The secret stays the same for a profile,
152
+ so your handler keeps verifying across restarts. `log tail` reads the developer
153
+ log of your API calls with their request ids; `log explain` shows one call's
154
+ inputs, error, fix and receipt with secrets redacted. `doctor` checks the CLI,
155
+ config directory, API, login, token store, Product and sandbox clock and prints a fix for
156
+ each failure. `export records` prints transfers, receipts or one account's
157
+ statements as CSV.
158
+
159
+ Profiles keep separate logins: `hyperscale profile use work`, then
160
+ `hyperscale auth login`. `--profile <name>` or `HYPERSCALE_PROFILE` picks one
161
+ for a single command, and `hyperscale.json` can name one with `profile`.
57
162
 
58
163
  ## Run actions and work with objects
59
164
 
@@ -80,8 +185,8 @@ Use `--on-behalf-of` to act for a customer. Mutations accept
80
185
  ```sh
81
186
  hyperscale key create --name Agent
82
187
  hyperscale key list
83
- hyperscale key revoke <id>
84
- hyperscale activity list
188
+ hyperscale key revoke <api-key-id>
189
+ hyperscale activity list --limit 20
85
190
  hyperscale activity tail --follow
86
191
  hyperscale api list --catalog
87
192
  hyperscale api call <operation> --input-file request.json --json
@@ -90,10 +195,37 @@ hyperscale architect chat --brief "Review this product" --json
90
195
  hyperscale open
91
196
  ```
92
197
 
198
+ `key create --name` names the key, and `key list` shows each name and expiry.
199
+ A key made from a CLI login ends when that login ends; `key create` prints the
200
+ date. A key made in the browser lasts 90 days.
201
+
93
202
  API access covers all published operations. A request that needs browser
94
203
  review prints a URL and a saved reference. Approve it, then use `api resume`.
95
204
  Approval alone does not mean the request completed.
96
205
 
206
+ ## Every operation as a command
207
+
208
+ Customers, accounts, transfers, webhooks, events, reports and the rest of the
209
+ tenant API are commands too: `hyperscale customer list`,
210
+ `hyperscale webhook add --url <url> --events '*'`, `hyperscale transfer show <id>`.
211
+ [`command-map.js`](command-map.js) names each operation's command and writes its
212
+ help by hand. [`operation-commands.js`](operation-commands.js) derives the
213
+ arguments, flags, scopes and paging from the generated OpenAPI documents.
214
+ Operations a founder never runs from a terminal stay reachable through
215
+ `api call` and are listed with a reason by `hyperscale help --all`.
216
+
217
+ Path IDs are arguments. Tenant and product IDs come from the login and the
218
+ selected product. Enum flags list their values in help. Nested input comes
219
+ through `--input`, `--input-file` or `--input -` for stdin, with flags merged
220
+ over it. Lists fetch one page; `--limit <n>` and `--all` follow cursors.
221
+ Mutations send a generated idempotency key, accept `--idempotency-key` and print
222
+ the receipt ID. In a terminal, a missing required value prompts; secrets are
223
+ read hidden. Without a terminal it is a usage error that names the flag.
224
+
225
+ [`docs/cli.md`](../../docs/cli.md) is the full reference, generated from
226
+ `hyperscale help --all --json` by `bun distribution/cli/reference.ts`. A spec
227
+ fails when it drifts.
228
+
97
229
  ## Output and settings
98
230
 
99
231
  Every command supports `--json`. Success goes to stdout and errors go to stderr.
@@ -118,9 +250,12 @@ and times out after 1.5 seconds. The next run can use its result. JSON, pipes,
118
250
  CI and `HYPERSCALE_NO_UPDATE_CHECK=1` suppress checks and notices. To upgrade,
119
251
  run `npm install -g @hyperscale0/cli@latest`.
120
252
 
121
- `hyperscale help --json` returns the whole command tree with flags and examples.
253
+ `hyperscale help --json` returns the whole command tree with flags, examples,
254
+ scopes and operations; `help --all` adds the advanced operations.
122
255
  Use `hyperscale <group> <command> --help` for one command. Exit codes are 0 for
123
- success, 1 for failure and 2 for an HSX check or plan that cannot proceed.
256
+ success, 1 for failure, 2 for a usage error or an HSX check or plan that cannot
257
+ proceed, 3 for a live action waiting for approval, 4 for a missing login or
258
+ scope, 5 for not found and 6 for a conflict.
124
259
 
125
260
  Set `HYPERSCALE_BASE_URL` for the API origin and `HYPERSCALE_ENVIRONMENT` for
126
261
  `sandbox` or `live`. `HYPERSCALE_TOKEN` supplies a login token and
@@ -134,7 +269,8 @@ when the API supplies it; older profiles show "not saved" until then.
134
269
 
135
270
  The terminal covers HSX files and product operations. The portals own the visual
136
271
  editor, full product design, company administration and provider setup.
137
- Infrastructure logs have no public CLI endpoint; activity is the public record.
272
+ Infrastructure logs have no public CLI endpoint; activity and `log tail` are the
273
+ public record.
138
274
 
139
275
  License: Tier 2 Source Available under LicenseRef-Hyperscale-IPCL-1.0. See [LICENSE.md](LICENSE.md) and [NOTICE.md](NOTICE.md).
140
276
  Hyperscale is a trademark of Hyperscale LLC.