@hyperscale0/cli 1.0.329 → 1.0.332

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 +34 -11
  2. package/README.md +45 -12
  3. package/hyperscale.js +101 -95
  4. package/package.json +2 -2
package/AGENTS.md CHANGED
@@ -31,16 +31,24 @@ and product IDs come from the login and the selected product. Lists accept
31
31
  pass `--idempotency-key` to retry safely. Without a TTY a missing required flag
32
32
  exits 2 and names the flag.
33
33
 
34
- Start with `hyperscale auth login --no-open --json`. The URL and code go to
35
- stderr. A person approves them in the browser. Rerun to resume a pending login.
36
- Verify with `hyperscale whoami --json`. To create an account, pipe the
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
37
41
  founder's password on stdin to `auth signup --email <email> --name <name>
38
42
  --company <company> --json`; it mails a six-digit code and exits. Ask the
39
43
  founder for the code, then run `auth signup --code <code> --json`. The account
40
44
  starts in sandbox. `auth verify` confirms an existing account's email the same
41
45
  way. Do not print or persist credentials in project files.
42
46
 
43
- Browser login creates a named agent member with its own CLI grant. Access
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
44
52
  tokens last ten minutes; the CLI rotates the refresh token and keeps both in
45
53
  Keychain or a mode 0600 file. Logout removes them locally. Revoke the member or
46
54
  grant in the browser; `--revoke` only revokes a human PAT. Sandbox work within
@@ -48,18 +56,33 @@ the grant runs directly. A live action exits 3 with `agent_approval_required`
48
56
  and a browser link; a human approves it with their password. The CLI cannot
49
57
  approve its own work.
50
58
 
51
- `agent setup [claude-code|codex|cursor]` writes the Hyperscale MCP server into
52
- that host's project config and prints the file it wrote. The config reads a
53
- sandbox Product key from `HYPERSCALE_API_KEY` (`--key-env` names another
54
- variable) and never contains the key. `--oauth` writes browser sign-in instead.
59
+ `agent setup [claude-code|codex|cursor]` uses the founder's CLI login to mint
60
+ a named, sandbox-only agent credential (`agent_grant.create`). It keeps the
61
+ token in the login's store, writes the host's MCP entry with
62
+ `HYPERSCALE_TOKEN` as the bearer variable, and installs the skill into the
63
+ host's skills folder. `agent token <host>` prints the stored token so the
64
+ shell can export it as `HYPERSCALE_TOKEN`; MCP and the CLI then use the same
65
+ door.
66
+ `--oauth` writes browser sign-in instead and mints nothing.
67
+
68
+ Credential order for product commands: `--api-key`, `HYPERSCALE_API_KEY`,
69
+ `--token`, `HYPERSCALE_TOKEN`, then the stored login. A key never moves a
70
+ command off the selected Product: a key for another Product exits 2 with
71
+ `api_key_product_mismatch`, names both Products and says what to unset.
72
+ `whoami` names the credential in use; `--verbose` adds grant and token ids.
73
+ The Keychain item is keyed by the config folder, so two folders hold two
74
+ logins; `doctor` names the item it reads.
55
75
 
56
76
  Every command accepts `--json`. Ordinary success is one JSON value on stdout;
57
77
  failure is an error object on stderr. Errors retain status, code, message,
58
78
  fix, details and available request, operation, receipt and trace IDs.
59
79
  JSON output has no ANSI codes, banners, spinners or prompts.
60
- Exit codes: 0 success, 1 failure, 2 usage error or HSX check or plan cannot
61
- proceed, 3 live action waiting for human approval, 4 not signed in or missing
62
- scope, 5 not found, 6 conflict such as a reused idempotency key.
80
+ Exit codes: 0 success, 1 server refusal or failure, 2 usage (unknown command
81
+ or option, or an argument, flag or input refused before any request; also an
82
+ HSX check or plan that cannot proceed), 3 live action waiting for human
83
+ approval, 4 not signed in or not allowed (401, 403), 5 not found (404), 6
84
+ conflict with the current state (409). `refusals.js` holds the table;
85
+ `help --json` prints it as `exitCodes`.
63
86
 
64
87
  `hsx watch --json` emits one JSON object per line with `type` set to `check`,
65
88
  `plan` or `error`. Check and plan events contain `data`; errors contain `error`.
package/README.md CHANGED
@@ -24,6 +24,20 @@ 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
25
  when you run the command again.
26
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:
30
+
31
+ ```sh
32
+ printf '%s\n' "$PASSWORD" | hyperscale auth login --email you@example.com --json
33
+ hyperscale auth login --code 123456 --json
34
+ ```
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
+
27
41
  To create an account without a browser, run `hyperscale auth signup`. It asks
28
42
  for your name, work email, company and a password, solves a short proof of work,
29
43
  and mails a six-digit code. Type the code and the CLI is signed in to the new
@@ -93,20 +107,20 @@ step that fails:
93
107
  ```json
94
108
  {
95
109
  "scenario": "A first rental",
96
- "customers": { "maya": { "name": "Maya Brooks", "fund": "100000" } },
110
+ "customers": { "maya": { "name": "Maya Brooks", "fund": "1000" } },
97
111
  "steps": [
98
112
  {
99
113
  "create": "rental",
100
114
  "as": "camera",
101
115
  "by": "maya",
102
- "fields": { "item": "Camera", "renter": "Maya", "price": "75000" }
116
+ "fields": { "item": "Camera", "renter": "Maya", "price": "750" }
103
117
  },
104
118
  { "run": "agree_rental", "on": "camera", "by": "maya" },
105
119
  { "advance": "4d" },
106
- { "fund": "maya", "amount": "5000" },
120
+ { "fund": "maya", "amount": "50" },
107
121
  {
108
122
  "name": "Maya has her change",
109
- "expect": { "balances": { "maya": { "settled": "30000" } } }
123
+ "expect": { "balances": { "maya": { "settled": "300.00" } } }
110
124
  }
111
125
  ]
112
126
  }
@@ -116,9 +130,10 @@ Each customer is created, given a sandbox account and funded first. `create`
116
130
  makes an object, `run` runs an action on it, `fund` adds sandbox money,
117
131
  `advance` moves the sandbox clock (`30m`, `4h`, `2d`, `1w` or an ISO time) and
118
132
  `expect` checks balances. A plain balance compares to `available`; an object
119
- can name `available`, `settled` or `pending`. Amounts are minor-unit strings,
120
- as in the API. Funding and actions need the Product key in
121
- `HYPERSCALE_API_KEY`. `scenario init` writes a working example for the
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
122
137
  Product.
123
138
 
124
139
  ```sh
@@ -137,7 +152,7 @@ with the `whsec_` secret it prints. The secret stays the same for a profile,
137
152
  so your handler keeps verifying across restarts. `log tail` reads the developer
138
153
  log of your API calls with their request ids; `log explain` shows one call's
139
154
  inputs, error, fix and receipt with secrets redacted. `doctor` checks the CLI,
140
- config directory, API, login, Product and sandbox clock and prints a fix for
155
+ config directory, API, login, token store, Product and sandbox clock and prints a fix for
141
156
  each failure. `export records` prints transfers, receipts or one account's
142
157
  statements as CSV.
143
158
 
@@ -180,6 +195,10 @@ hyperscale architect chat --brief "Review this product" --json
180
195
  hyperscale open
181
196
  ```
182
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
+
183
202
  API access covers all published operations. A request that needs browser
184
203
  review prints a URL and a saved reference. Approve it, then use `api resume`.
185
204
  Approval alone does not mean the request completed.
@@ -233,14 +252,28 @@ run `npm install -g @hyperscale0/cli@latest`.
233
252
 
234
253
  `hyperscale help --json` returns the whole command tree with flags, examples,
235
254
  scopes and operations; `help --all` adds the advanced operations.
236
- Use `hyperscale <group> <command> --help` for one command. Exit codes are 0 for
237
- success, 1 for failure, 2 for a usage error or an HSX check or plan that cannot
238
- proceed, 3 for a live action waiting for approval, 4 for a missing login or
239
- scope, 5 for not found and 6 for a conflict.
255
+ Use `hyperscale <group> <command> --help` for one command.
256
+
257
+ | Exit | Meaning |
258
+ | ---- | -------------------------------------------------------------------------------------------------------------------- |
259
+ | 0 | Success. |
260
+ | 1 | The server refused the request or could not finish it. |
261
+ | 2 | Usage: an unknown command or option, an argument, flag or input refused before any request, or an HSX check failure. |
262
+ | 3 | A live action is waiting for a person to approve it. |
263
+ | 4 | Not signed in, or this login or key may not do that (HTTP 401 or 403). |
264
+ | 5 | The thing named does not exist (HTTP 404). |
265
+ | 6 | The request conflicts with the current state (HTTP 409). |
266
+
267
+ `help --json` lists the same table under `exitCodes`. A mistyped command or
268
+ option suggests the nearest one, and every refusal carries a runnable `fix`.
240
269
 
241
270
  Set `HYPERSCALE_BASE_URL` for the API origin and `HYPERSCALE_ENVIRONMENT` for
242
271
  `sandbox` or `live`. `HYPERSCALE_TOKEN` supplies a login token and
243
272
  `HYPERSCALE_API_KEY` supplies a product key. Each has a matching command flag.
273
+ Product commands use the first one set: `--api-key`, `HYPERSCALE_API_KEY`,
274
+ `--token`, `HYPERSCALE_TOKEN`, then the stored login. `whoami` names it.
275
+ `agent setup <host>` gives a coding agent its own sandbox token for both MCP
276
+ and the CLI; see https://hyperscale0.ai/auth.md.
244
277
 
245
278
  The API defaults to `https://hyperscale0.ai`, which maps to the Launch and
246
279
  Build portals. `open` refuses other API origins because they do not identify