v0.5.1
Patch Changes
-
34a11b6: fix: paginate list endpoints so
nia project initandnia vault add-source --allrespect the API'slimit <= 100capnia project initwas callingcliSdk.sources.list({ limit: 200 })inside its source picker andnia vault add-source --allwas calling/vaults/available-sources?limit=500. The Nia API now rejects both withValidation error: query → limit: Input should be less than or equal to 100, which broke the commands outright.Adds a shared
paginateAllhelper insrc/services/pagination.tsthat walks list endpoints withlimit <= 100, normalizes the response shapes Nia returns (T[],{ items },{ sources }), stops on a short page, and caps total items at 500 as a safety ceiling.pickSourcesincommands/project.tsand the--allbranch ofvault add-sourcenow delegate to it. -
77e4610: fix:
nia project initis now atomic — no partial state if the user cancels midway or the daemon failsPreviously,
runProjectInitcould leave the user in awkward half-states:- If the user opted in to registering the cwd as a local source but the daemon call failed, the command would still write
nia.json(with an emptylocal[]array) plus alocal_binding_note: "Skipped..."field. The manifest silently failed to match what the user asked for. - If the user hit Ctrl+C during a prompt, the
CancelledErrorbubbled up throughwithErrorHandlingand was rendered as a generic "Error: ..." with an ugly message and exit code 1.
Now
nia project initfollows a strict two-phase contract:- Gather phase — all prompts (cwd opt-in confirm, fuzzy filter picker, optional "continue with empty?" confirm) run first. Zero filesystem or daemon side effects. Fully cancellable.
- Commit phase — if the user opted in,
addLocalSource(cwd)is called. On any failure (network, daemon down, missinglocal_folder_idin response) the whole init aborts with a clear error and nothing is written. Otherwise,nia.jsonis written in a single atomic step.
Additionally,
CancelledErrorfrom@crustjs/promptsis now handled globally inhandleError: any command that uses prompts will exit silently with code130(POSIX SIGINT convention) on Ctrl+C, instead of rendering a noisy error trace.The
local_binding_notefield has been removed from therunProjectInitresult and from the CLI output — it described a partial-success state that can no longer occur. - If the user opted in to registering the cwd as a local source but the daemon call failed, the command would still write
-
f91ab56: refactor:
nia project initno longer bootstraps the project root — removes automatic CLAUDE.md/AGENTS.md wiring and automaticnia local add .Previously,
nia project initwould (1) append a## Nia (project-scoped)block to CLAUDE.md / AGENTS.md / GEMINI.md / CURSOR.md in the cwd (creating CLAUDE.md if none existed), and (2) register the cwd as a local folder source viaaddLocalSource(cwd)by default. Both side effects mutated the user's project without explicit consent.Now:
- No agent-instruction files are touched. The global
niaskill (installed viania skill) is the sole delivery channel fornia.jsonguidance — Step 0 of the skill already teaches agents to detect and usenia.jsonautomatically. The--wire/--wire-intoflags are removed. - No automatic
addLocalSource(cwd). The--localflag is removed. Before the source picker,initnow asksIndex the current project folder (<cwd>) as a local source?— defaults to No. Only if the user answers yes does it calladdLocalSource(cwd)and add alocalbinding tonia.json. - Skill install nudge. After writing
nia.json,initbest-effort-detects whether theniaskill is installed for any agent (viadetectInstalledAgents+skillStatus, wrapped in a 1.5s timeout). If not,next_stepsincludes"Install the nia skill: nia skill". - Core logic is factored into an exported
runProjectInit()with dependency-injected picker /addLocalSource/ skill-check callbacks, so the file-writing behavior can be tested without spinning up a real interactive prompt or hitting the daemon.
The skill's
instructionsblock insrc/cli.ts(Step 0 — check fornia.json) has been updated to reflect the newinitbehavior. - No agent-instruction files are touched. The global