@nolto/cli 0.23.0 → 0.24.0

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 +45 -6
  2. package/dist/index.js +544 -426
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -35,6 +35,11 @@ For browser-based authentication without the rest of the repository setup:
35
35
  nolto login
36
36
  ```
37
37
 
38
+ `nolto login` prints a URL and a confirmation code (`XXXX-XXXX`). Open the URL in a
39
+ browser, type the code shown in your terminal, and approve. The URL does not contain
40
+ the code. Approve only a login you started yourself; reject any code or link someone
41
+ else sent you.
42
+
38
43
  ## Commands
39
44
 
40
45
  ### Setup and Authentication
@@ -42,9 +47,29 @@ nolto login
42
47
  ```bash
43
48
  nolto init [--force] # Interactive project and repository setup
44
49
  nolto login [--force] # Authenticate in the browser and save the API token
45
- nolto whoami # Show resolved auth/config state and project count
50
+ nolto logout # Revoke the saved API token and remove it from the config file
51
+ nolto whoami # Show resolved auth/config state, token expiry and project count
46
52
  ```
47
53
 
54
+ A token issued by `nolto login` expires after 90 days and is not extended; when it
55
+ expires (HTTP 401), run `nolto login` again. `nolto whoami` shows the expiry date
56
+ and, within 7 days of it, a reminder. The memory hook (`nolto memory pull --hook`)
57
+ also tells you to run `nolto login` on a 401.
58
+
59
+ `nolto logout` asks the server to revoke the saved token (`POST /api/me/token/revoke`),
60
+ then removes only `token` from the config file (`baseUrl` stays) and clears the
61
+ memory caches. If the server cannot be reached, does not have the route yet (404),
62
+ or answers 401, the local token is still removed, a warning says to confirm the
63
+ revocation under "API トークン" in the web app, and the exit code is 0. A token
64
+ from `NOLTO_TOKEN` cannot be removed by the CLI: unset the variable and revoke the
65
+ token in the web app. Logout revokes at the `baseUrl` saved in the config file
66
+ (`https://nolto.app` when absent), not at `NOLTO_BASE_URL`.
67
+
68
+ `nolto login` saves the token together with the base URL it actually used
69
+ (`--base-url`, `NOLTO_BASE_URL` or the default). That base URL is where the token was
70
+ issued. After `nolto login --base-url <staging>`, a plain `nolto ...` also goes to
71
+ staging.
72
+
48
73
  ### Repository Binding
49
74
 
50
75
  To add a second repository to an existing project, run `nolto init` or
@@ -256,7 +281,7 @@ List output is one line per issue plus `n / total (page p)`. View includes body
256
281
  |---|---|
257
282
  | 0 | Success |
258
283
  | 2 | Invalid input, recognized API 404, HTTP 422 (details shown), secret_detected (possible secret; message shown), internal_references (confirmation required), or roadmap cache/sync failure after creation |
259
- | 3 | HTTP 401/403; token_scope/token_project includes a token settings hint |
284
+ | 3 | HTTP 401/403; token_scope/token_project includes a token settings hint; the config token was issued for another base URL (`token_origin_mismatch`) |
260
285
  | 4 | Plan / quota limit (HTTP 402) or rate limit (HTTP 429); resolve or wait before retrying. Token writes: 60/minute; wait Retry-After seconds before retrying. |
261
286
  | 5 | Network/generic HTTP errors, including a 404 without an API error string |
262
287
 
@@ -294,6 +319,20 @@ Environment variables:
294
319
  | `NOLTO_BASE_URL` | Base URL (default: `https://nolto.app`) |
295
320
  | `NOLTO_PROJECT` | Default project ID fallback |
296
321
 
322
+ A token in the config file is only sent to the base URL saved with it. Pointing
323
+ `NOLTO_BASE_URL` or `--base-url` at another host does not send that token: the command
324
+ exits 3 (JSON error `code`: `token_origin_mismatch`) and says to run
325
+ `nolto login --base-url <that host>` or to use `NOLTO_TOKEN`. A config file without
326
+ `baseUrl` counts as issued by `https://nolto.app`. A token from `NOLTO_TOKEN` or
327
+ `--token` is not checked; you choose where it goes. `nolto memory pull --hook` prints
328
+ the same guidance instead of failing. `login`, `logout`, `update` and `merge-file` skip the check.
329
+
330
+ The base URL must be `https://`; `http://` is accepted only for `localhost`,
331
+ `127.0.0.1` and `[::1]`. Anything else exits 2, whether it comes from a flag, the
332
+ environment or the config file. The Base URL typed into the `nolto init` prompt gets the
333
+ same check, and `nolto init` does not offer to keep the config token for a different
334
+ origin.
335
+
297
336
  Repository binding (`nolto.json`):
298
337
 
299
338
  ```json
@@ -322,10 +361,10 @@ Errors are written to stderr:
322
361
  ```json
323
362
  {
324
363
  "error": {
325
- "message": "Unauthorized",
364
+ "message": "token の期限が切れたか、失効しています。`nolto login` を実行してください",
326
365
  "exitCode": 3,
327
366
  "status": 401,
328
- "hint": "Run `nolto init` to configure a token, or set the NOLTO_TOKEN environment variable."
367
+ "hint": "token を設定していないときは `nolto init`、環境変数 NOLTO_TOKEN の token は新しいものに差し替えてください。"
329
368
  }
330
369
  }
331
370
  ```
@@ -338,8 +377,8 @@ Issue validation and API 404 with an error string exit 2; 422 includes details.
338
377
  |---|---|
339
378
  | 0 | Success |
340
379
  | 1 | Roadmap differences found (`nolto diff`) or unexpected command failure |
341
- | 2 | Local input or file validation error |
342
- | 3 | Authentication or authorization error |
380
+ | 2 | Local input or file validation error (including a base URL that is not `https://` or localhost `http://`) |
381
+ | 3 | Authentication or authorization error (including `token_origin_mismatch`) |
343
382
  | 4 | Action needed before retrying: roadmap sync conflict, expired base revision, unsynced local changes blocking `nolto pull` / `nolto init` / `nolto link` / `nolto roadmap` task updates (resolve with `nolto pull` / `nolto roadmap sync`, then retry), rate limit response (HTTP 429, including the `nolto link --rebind` cooldown), or plan / quota limit (HTTP 402). API token writes: 60/minute; server message and Retry-After are displayed. |
344
383
  | 5 | Network, DNS, or server error |
345
384