@nolto/cli 0.23.1 → 0.25.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.
- package/README.md +64 -7
- package/dist/index.js +481 -114
- package/package.json +5 -5
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
|
|
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,10 +281,28 @@ 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
|
|
|
288
|
+
### Wiki
|
|
289
|
+
|
|
290
|
+
Same global options and project priority as Issues. `<page>` is a UUID, a 6-character shortId, a page URL (`…/projects/<id>/wiki/<page-id>`) or a short URL (`https://nol.to/w/<shortId>`). A page of another project exits 2. Delete, revision history/restore and attachments are not available in the CLI; use the web app. Token scopes: `wiki:read` for list, view and search; `wiki:write` for create, update and move.
|
|
291
|
+
|
|
292
|
+
| Command | Options |
|
|
293
|
+
|---|---|
|
|
294
|
+
| `wiki list` | Pages as an indented tree with shortId (and share markers in internal mode) |
|
|
295
|
+
| `wiki view <page>` | `--body-only` prints only the body for reading; `--output <path>` writes the body to a file exactly as stored (not combinable with `--body-only`) |
|
|
296
|
+
| `wiki search <query>` | Query of 1 to 100 characters |
|
|
297
|
+
| `wiki create` | Required `--title`; `--body` or `--body-file` (`-` for stdin); `--parent <page>` (default: top level) |
|
|
298
|
+
| `wiki update <page>` | `--title`, `--body` or `--body-file` (at least one); `--base-revision <n>` |
|
|
299
|
+
| `wiki move <page>` | Required `--parent <page-or-none>` and `--position <n>` (from 0); `--confirm-share` |
|
|
300
|
+
|
|
301
|
+
- Edit round trip: `nolto wiki view X` (note `revision`), `nolto wiki view X --output page.md`, edit, `nolto wiki update X --body-file page.md --base-revision <revision>`. With `--base-revision`, a page saved by someone else in between fails with exit 2 (409 `wiki_revision_conflict`) and the message shows the latest revision; view again and retry. The field is sent only when the option is given; without it the last save wins. `--body-only` is for reading in a terminal: it replaces control characters, so do not use it for the round trip.
|
|
302
|
+
- Secrets: view shows a ```` ```secret id=… ```` line instead of the value. Keep that line when you send the body back. A new ```` ```secret <name> ```` fence is encrypted when saved. If the API detects what looks like a password in the text, it saves the page and returns warnings, shown as `注意: <message>` lines.
|
|
303
|
+
- `move --confirm-share`: a move that changes which pages customers can see fails with exit 2 (409 `share_visibility_change`, showing the number of pages and the direction). Re-run with `--confirm-share` only after checking, and with the user's go-ahead. Writes are in internal mode; to write under a shared page, give a parent below the share root.
|
|
304
|
+
- `--json` returns the API response unchanged (list: `{ pages }` as a flat array; view: `{ page, latestRevision, … }`; create, update, move: `{ page, warnings? }`; search: `{ results }`).
|
|
305
|
+
- Exit codes are the same as Issues. 404 `見つかりません。` adds a hint that the project may have the Wiki turned off, or the member may not have the Wiki feature.
|
|
263
306
|
|
|
264
307
|
## Roadmap conflicts
|
|
265
308
|
|
|
@@ -294,6 +337,20 @@ Environment variables:
|
|
|
294
337
|
| `NOLTO_BASE_URL` | Base URL (default: `https://nolto.app`) |
|
|
295
338
|
| `NOLTO_PROJECT` | Default project ID fallback |
|
|
296
339
|
|
|
340
|
+
A token in the config file is only sent to the base URL saved with it. Pointing
|
|
341
|
+
`NOLTO_BASE_URL` or `--base-url` at another host does not send that token: the command
|
|
342
|
+
exits 3 (JSON error `code`: `token_origin_mismatch`) and says to run
|
|
343
|
+
`nolto login --base-url <that host>` or to use `NOLTO_TOKEN`. A config file without
|
|
344
|
+
`baseUrl` counts as issued by `https://nolto.app`. A token from `NOLTO_TOKEN` or
|
|
345
|
+
`--token` is not checked; you choose where it goes. `nolto memory pull --hook` prints
|
|
346
|
+
the same guidance instead of failing. `login`, `logout`, `update` and `merge-file` skip the check.
|
|
347
|
+
|
|
348
|
+
The base URL must be `https://`; `http://` is accepted only for `localhost`,
|
|
349
|
+
`127.0.0.1` and `[::1]`. Anything else exits 2, whether it comes from a flag, the
|
|
350
|
+
environment or the config file. The Base URL typed into the `nolto init` prompt gets the
|
|
351
|
+
same check, and `nolto init` does not offer to keep the config token for a different
|
|
352
|
+
origin.
|
|
353
|
+
|
|
297
354
|
Repository binding (`nolto.json`):
|
|
298
355
|
|
|
299
356
|
```json
|
|
@@ -308,7 +365,7 @@ Precedence: CLI flags > environment variables > `nolto.json` > config file > def
|
|
|
308
365
|
|
|
309
366
|
## JSON Output
|
|
310
367
|
|
|
311
|
-
`nolto issue … --json`
|
|
368
|
+
`nolto issue … --json` and `nolto wiki … --json` return the original API response; `create --phase` adds `roadmap: { file, taskId }` metadata (file is the cache path). `whoami` includes `tokenScopes` / `tokenProject` when token introspection succeeds.
|
|
312
369
|
|
|
313
370
|
Use the global `--json` option for machine-readable command output:
|
|
314
371
|
|
|
@@ -322,10 +379,10 @@ Errors are written to stderr:
|
|
|
322
379
|
```json
|
|
323
380
|
{
|
|
324
381
|
"error": {
|
|
325
|
-
"message": "
|
|
382
|
+
"message": "token の期限が切れたか、失効しています。`nolto login` を実行してください",
|
|
326
383
|
"exitCode": 3,
|
|
327
384
|
"status": 401,
|
|
328
|
-
"hint": "
|
|
385
|
+
"hint": "token を設定していないときは `nolto init`、環境変数 NOLTO_TOKEN の token は新しいものに差し替えてください。"
|
|
329
386
|
}
|
|
330
387
|
}
|
|
331
388
|
```
|
|
@@ -338,8 +395,8 @@ Issue validation and API 404 with an error string exit 2; 422 includes details.
|
|
|
338
395
|
|---|---|
|
|
339
396
|
| 0 | Success |
|
|
340
397
|
| 1 | Roadmap differences found (`nolto diff`) or unexpected command failure |
|
|
341
|
-
| 2 | Local input or file validation error |
|
|
342
|
-
| 3 | Authentication or authorization error |
|
|
398
|
+
| 2 | Local input or file validation error (including a base URL that is not `https://` or localhost `http://`) |
|
|
399
|
+
| 3 | Authentication or authorization error (including `token_origin_mismatch`) |
|
|
343
400
|
| 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
401
|
| 5 | Network, DNS, or server error |
|
|
345
402
|
|