@nolto/cli 0.13.2 → 0.14.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 CHANGED
@@ -20,7 +20,8 @@ nolto init
20
20
 
21
21
  `nolto init` configures authentication, selects or creates a project, writes the
22
22
  repo-local `nolto.json` binding, installs the bundled `roadmap-progress` skill,
23
- and creates `.nolto/roadmaps/<slug>.json` when needed.
23
+ and pulls roadmaps into the project cache. If the server has none, it creates a
24
+ schema v3 roadmap on the server. `nolto link` also pulls or creates roadmaps.
24
25
  Re-running it inside a repository keeps the saved token and only sets up that
25
26
  repository; use `--force` to reconfigure the global settings.
26
27
 
@@ -67,44 +68,102 @@ CLI versions older than 0.8.0 do not send a repository identity and receive
67
68
  ```bash
68
69
  nolto sync # Push roadmap JSON files and linked plan Markdown
69
70
  nolto diff [slug] # Compare local and server roadmaps without changing them
70
- nolto pull [slug] # Overwrite local roadmap files from the server
71
- nolto pull --merge [slug] # Structurally merge server and local roadmaps
71
+ nolto pull [slug] [--all] # Pull server roadmaps into the cache
72
+ nolto pull [slug] --force # Overwrite unsynced local changes
72
73
  nolto watch [--debounce <ms>] # Watch registered repositories and auto-sync
73
74
  nolto watch --install-service # Install the Linux systemd user service
74
75
  ```
75
76
 
76
- `sync` reads every `.nolto/roadmaps/*.json` file in filename order, uses each
77
- filename stem as its slug, validates schema v2, follows any linked plan Markdown
78
- paths, and sends an idempotent full upsert to the bound project. A legacy
79
- `.roadmap/roadmap.json` is migrated by `nolto sync` when no canonical roadmap
80
- exists; `nolto watch` only warns and never migrates.
77
+ Roadmaps live outside the repository at `<config dir>/projects/<projectId>/roadmaps/<slug>.json`,
78
+ with revision and content-hash metadata in `<slug>.meta.json`. The config directory is
79
+ `NOLTO_HOME`, then `$XDG_CONFIG_HOME/nolto`, then `~/.config/nolto`.
80
+ Cache writes use fixed key order, two-space indentation, and a trailing newline.
81
+
82
+ `sync` reads cached roadmaps in slug order, validates schema v1/v2/v3, and sends
83
+ `baseRevision` with each PUT. Linked plan Markdown is still read relative to the
84
+ repository root. Successful responses update the cached revision and any merged
85
+ roadmap. Conflicts (`task_conflict`) and expired base revisions exit 4; conflicts
86
+ show the server-provided fields and values. Manual sync always sends a PUT,
87
+ including when only a plan document changed.
88
+
89
+ Automatic migration of repo-local roadmaps is removed. If only legacy repo files
90
+ exist, sync asks you to run `nolto roadmap migrate`.
81
91
 
82
92
  Optional task-only `issues` is an array of unique uppercase keys matching `^[A-Z][A-Z0-9]{1,9}-[1-9][0-9]{0,8}$` (for example `NOLTO-12`); empty arrays are allowed.
83
93
 
94
+ Schema v3 may omit `updatedAt` and `currentTaskId`; v1/v2 still require `updatedAt`.
84
95
  Timestamp fields (`updatedAt`, `startedAt`, and `completedAt`) must be RFC 3339 with a timezone offset (`2026-09-02T10:00:00+09:00` or `2026-09-02T01:00:00Z`); offset-less and date-only values are rejected. `dependsOn` items must be unique strings matching `^[a-z0-9][a-z0-9._-]*$`, and names, titles, and IDs must be actual strings.
85
96
 
86
97
  The shared proxy rejects a sync request body over 10 MB with HTTP `413`. Free
87
98
  plan documents are already limited to 2 MB per roadmap before that shared cap.
88
99
 
89
- `watch` uses the repository registry maintained by `nolto init`. Missing registered
90
- repositories are skipped with a warning.
100
+ `watch` uses `{ root, projectId }` entries in the registry maintained by init, link,
101
+ and sync. Older entries resolve their project from `nolto.json`; missing repositories
102
+ or bindings are skipped with a warning. It watches the project cache (excluding
103
+ `.meta.json`) and linked plan documents. Cache events skip clean roadmaps to avoid
104
+ sync loops; plan events send a PUT even when the roadmap is clean.
91
105
  The CLI warns when an installed `roadmap-progress` skill version differs from the
92
106
  CLI version; run `nolto init` in that repository to refresh it.
93
107
 
94
108
  Use `nolto diff [slug]` before pushing to compare task status changes, added or
95
109
  removed tasks and phases, and roadmap `updatedAt`, `currentTaskId`, and `summary`.
96
110
  It does not compare `title`, `note`, `plan`, `dependsOn`, `issues`, project metadata, or
97
- ordering; use `git diff` for those. It exits with code 1 when differences are
98
- found and does not change either side. `nolto pull [slug]` downloads all server
99
- roadmaps, or one named roadmap, and intentionally overwrites the corresponding
100
- local files after validation. It never deletes local-only roadmaps. Add `--merge`
101
- to preserve valid local changes using a deterministic structural merge, and review
102
- the result with `git diff` before committing.
111
+ ordering. It exits with code 1 when differences are found and does not change
112
+ either side. `nolto pull [slug]` downloads all server roadmaps, or one named
113
+ roadmap, after validation. `--all` is equivalent to omitting the slug. Unsynced
114
+ local changes are preserved with a warning and exit 4; other slugs are still
115
+ processed. Use `--force` to overwrite those changes. Local-only roadmaps are kept.
103
116
 
104
117
  After roadmap sync, the CLI reads the latest 300 commits, extracts uppercase issue keys (for example `NOLTO-50`), and sends commit links. Subjects ending in `(#123)` or starting with `Merge pull request #123` also produce PR links. No issue key means no upload. Requests contain at most 500 links and 20 keys per link; longer sets are split without dropping associations. Titles and authors are capped at 500 characters. Repeated syncs are deduplicated on the server.
105
118
 
106
119
  This requires `roadmap:sync` token permission and the project's `git_links` scope. Ingestion errors are warnings and do not fail roadmap sync. Disable with `nolto sync --no-git-links` or `NOLTO_GIT_LINKS=0` (also applies to watch). Watch collects at startup and on roadmap/plan changes, not on Git-only changes. Missing Git or a non-worktree is skipped. Counts distinguish newly linked rows, existing links, and unresolved keys (skipped). The log reads `git links: linked N (existing M, skipped K)`. JSON output includes `gitLinks: { linked, existing, skipped } | null`.
107
120
 
121
+ ### Roadmap Commands
122
+
123
+ The server is the roadmap source of truth. Task updates use PATCH and save the
124
+ response to the cache. `currentTaskId` is user-specific cache metadata; timestamps
125
+ and phase status are managed by the server. Sync retains current-task metadata
126
+ when its PUT response omits it.
127
+
128
+ | Command | Options / behavior |
129
+ |---|---|
130
+ | `roadmap path [slug]` | Print the absolute cache JSON path; pull if missing |
131
+ | `roadmap pull [slug]` | `--force`; omit slug to pull all |
132
+ | `roadmap sync [slug]` | `--no-git-links`; omit slug to push all |
133
+ | `roadmap status [slug]` | `--fresh`; progress, current task, revision and cache age warning |
134
+ | `roadmap validate [slug]` | Validate cached JSON; errors exit 1 |
135
+ | `roadmap summary [slug] --text <text>` | Replace summary and PUT |
136
+ | `roadmap start <task>` | `--slug <slug>`, `--note <text>`; PATCH in-progress and current task |
137
+ | `roadmap done <task>` | `--slug <slug>`, `--note <text>`; PATCH done |
138
+ | `roadmap block <task> --note <text>` | `--slug <slug>`; PATCH blocked |
139
+ | `roadmap todo <task>` | `--slug <slug>`, `--note <text>`; PATCH todo and clear task timestamps |
140
+ | `roadmap plan <task> --path <path>` | `--slug <slug>`; PATCH plan link, then PUT its document |
141
+ | `roadmap events [slug]` | `--since <revision>`, `--limit <number>`; task history |
142
+ | `roadmap migrate` | `--yes`; migrate legacy repository JSON to the server/cache |
143
+
144
+ Except for pull/sync (which process all roadmaps), omitting a slug selects the only
145
+ cached roadmap. Multiple caches require a slug; zero caches triggers pull and the
146
+ same selection rule. Task commands select with `--slug`. Global `--json` produces
147
+ machine-readable output. The top-level pull/sync commands remain available.
148
+
149
+ For structural edits, obtain the cache path, edit phases/tasks/dependencies/issue
150
+ links, validate, then sync. A dirty cache blocks task PATCH with exit 4; sync those
151
+ edits first. `status --fresh` pulls before reporting; status warns for caches older
152
+ than ten minutes.
153
+
154
+ ### Migrate Repository Roadmaps
155
+
156
+ Run `nolto roadmap migrate` in the bound repository. It validates all legacy
157
+ `.nolto/roadmaps/*.json`, converts them to schema v3, and sends linked plan documents.
158
+ New roadmaps are created at revision 1. Identical server roadmaps are pulled without
159
+ a PUT. Replacing different server data requires a TTY confirmation, or `--yes` for
160
+ noninteractive use. Migration adds the repository to the watch registry.
161
+
162
+ Source files remain intact. After checking the server and cache, follow the printed
163
+ instructions to remove tracked roadmap files, remove the legacy `.gitattributes`
164
+ entry if present, and unset the local merge driver. Migration does not run these
165
+ Git commands.
166
+
108
167
  ### Issues
109
168
 
110
169
  All commands accept global `--project <id>`, `--json`, `--token <value>` and `--base-url <url>`.
@@ -124,7 +183,7 @@ Status/type/category accept case-insensitive exact names or UUIDs from the proje
124
183
 
125
184
  List output is one line per issue plus `n / total (page p)`. View includes body and comments with API-token provenance. Writes print the issue key and URL. `--json` preserves API responses: list `{ issues, total, page, pageSize }`, view the full bundle, create `{ issue }`, update/close `{ issue, comment }`, comment `{ comment }`. Successful create with phase additionally returns `roadmap: { file, taskId }`. Human template creation adds `body: from template`. `whoami` adds scopes (null displayed as full) and project binding; JSON uses tokenScopes/tokenProject when introspection succeeds. Introspection failure is non-fatal and retains the old output.
126
185
 
127
- `--phase` refers to a **task ID**, not a phase ID. It adds the issue key to task.issues in the selected local roadmap, avoids duplicates, upgrades legacy schema v1 to v2 on change and refreshes updatedAt with a local timezone offset. Run `nolto sync` afterward. If multiple roadmaps exist, use --roadmap (without .json). A local failure occurs after issue creation: the error includes the created key; repair the link instead of repeating create.
186
+ `--phase` is a legacy repository-file workflow and refers to a **task ID**, not a phase ID. For the external cache, create without `--phase`, add the returned key to task.issues in `nolto roadmap path`, then validate and sync. The legacy option adds the issue key to task.issues in the selected repository roadmap, avoids duplicates, upgrades legacy schema v1 to v2 on change and refreshes updatedAt with a local timezone offset. Run `nolto sync` afterward. If multiple roadmaps exist, use --roadmap (without .json). A local failure occurs after issue creation: the error includes the created key; repair the link instead of repeating create.
128
187
 
129
188
  | Exit | Meaning |
130
189
  |---|---|
@@ -135,57 +194,22 @@ List output is one line per issue plus `n / total (page p)`. View includes body
135
194
  | 5 | Network/generic HTTP errors, including a 404 without an API error string |
136
195
 
137
196
 
138
- ## Merging roadmap conflicts
139
-
140
- Roadmap files use Nolto's structural Git merge driver. The repository attribute
141
- and local Git configuration are:
142
-
143
- ```text
144
- .nolto/roadmaps/*.json merge=nolto-roadmap
145
- git config --local merge.nolto-roadmap.driver "nolto merge-file %A %B --base %O"
146
- ```
147
-
148
- `nolto init` sets up both entries for the current repository and is safe to run
149
- again for an existing repository. Git invokes the underlying command as:
150
-
151
- ```bash
152
- nolto merge-file <ours> <theirs> --base <ancestor>
153
- ```
154
-
155
- ### Silent resolution rules
156
-
157
- The merge driver emits no conflict markers and exits `0` unless the merged
158
- output fails validation, in which case it exits `1`. Resolution is deterministic:
159
-
160
- - For fields changed on both sides, the side with the newer `updatedAt` wins.
161
- - `currentTaskId` comes from the newer side while it still points to an
162
- `in-progress` task; otherwise the older side's value is used if it still
163
- points to an `in-progress` task, and it is omitted when neither does.
164
- - Task status priority is `done` (with `completedAt`) > `blocked` >
165
- `in-progress` > `todo`.
166
- - `startedAt` keeps the earliest value, `completedAt` keeps the latest value,
167
- and `dependsOn` and `issues` are deduplicated unions (ours order, then new theirs entries).
168
- - A deletion is honored only when both sides deleted the item.
169
- - Phase order is ours first, followed by phases found only in theirs; phase
170
- status is re-derived from the merged tasks.
171
-
172
- Full diff coverage and interactive conflict display are tracked in
173
- [#475](https://github.com/uruca-kk/nolto/issues/475).
174
-
175
- ### Legacy roadmap schema v1
197
+ ## Roadmap conflicts
176
198
 
177
- Schema v1 remains accepted with a warning and has no sunset date. The next
178
- `roadmap-progress` mutation upgrades it to v2 automatically. This compatibility
179
- policy remains in place through CLI 1.0 and will be reconsidered then.
199
+ The server merges revision-based changes and reports conflicting fields. Save your
200
+ local edits before using `nolto pull --force`, resolve the differences, and sync again.
201
+ If the base revision has expired, pull the current roadmap and reapply your edits.
180
202
 
181
- The result is written to `<ours>` as required by Git. Use
182
- `nolto pull --merge [slug]` when the server has changes that should be combined
183
- with a valid local roadmap before syncing.
203
+ `nolto merge-file <ours> <theirs> --base <ancestor>` remains available for legacy
204
+ Git files, with a deprecation warning. `nolto init` no longer configures Git
205
+ attributes or the merge driver. The bundled roadmap-progress skill invokes
206
+ `nolto roadmap` and uses the external cache.
184
207
 
185
208
  ## Configuration
186
209
 
187
- The config file is `~/.config/nolto/config.json` (or
188
- `$XDG_CONFIG_HOME/nolto/config.json`) and is written with mode 0600.
210
+ The config file is `<config dir>/config.json` and is written with mode 0600.
211
+ A non-empty `NOLTO_HOME` selects the directory as-is; otherwise use
212
+ `$XDG_CONFIG_HOME/nolto`, falling back to `~/.config/nolto`.
189
213
 
190
214
  ```json
191
215
  {
@@ -199,6 +223,7 @@ Environment variables:
199
223
 
200
224
  | Variable | Description |
201
225
  |---|---|
226
+ | `NOLTO_HOME` | Config and roadmap cache directory (highest priority) |
202
227
  | `NOLTO_TOKEN` | API token |
203
228
  | `NOLTO_BASE_URL` | Base URL (default: `https://nolto.app`) |
204
229
  | `NOLTO_PROJECT` | Default project ID fallback |
@@ -211,8 +236,7 @@ Repository binding (`nolto.json`):
211
236
  }
212
237
  ```
213
238
 
214
- The optional legacy `roadmapSlug` field is read only when naming an automatically
215
- migrated `.roadmap/roadmap.json`; canonical roadmap slugs come from filenames.
239
+ The optional legacy `roadmapSlug` binding field is preserved; cache slugs come from filenames.
216
240
 
217
241
  Precedence: CLI flags > environment variables > `nolto.json` > config file > defaults.
218
242
 
@@ -250,7 +274,7 @@ Issue validation and API 404 with an error string exit 2; 422 includes details.
250
274
  | 1 | Roadmap differences found (`nolto diff`) or unexpected command failure |
251
275
  | 2 | Local input or file validation error |
252
276
  | 3 | Authentication or authorization error |
253
- | 4 | Rate limit response, or plan / quota limit (HTTP 402). API token writes: 60/minute; server message and Retry-After are displayed. |
277
+ | 4 | Roadmap conflict, expired base revision, unsynced changes blocking pull, rate limit response, or plan / quota limit (HTTP 402). API token writes: 60/minute; server message and Retry-After are displayed. |
254
278
  | 5 | Network, DNS, or server error |
255
279
 
256
280
  ## License