Skip to content

v0.5.1

Choose a tag to compare

@github-actions github-actions released this 20 Apr 22:24
· 4 commits to main since this release
0a9da5b

Patch Changes

  • 34a11b6: fix: paginate list endpoints so nia project init and nia vault add-source --all respect the API's limit <= 100 cap

    nia project init was calling cliSdk.sources.list({ limit: 200 }) inside its source picker and nia vault add-source --all was calling /vaults/available-sources?limit=500. The Nia API now rejects both with Validation error: query → limit: Input should be less than or equal to 100, which broke the commands outright.

    Adds a shared paginateAll helper in src/services/pagination.ts that walks list endpoints with limit <= 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. pickSources in commands/project.ts and the --all branch of vault add-source now delegate to it.

  • 77e4610: fix: nia project init is now atomic — no partial state if the user cancels midway or the daemon fails

    Previously, runProjectInit could 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 empty local[] array) plus a local_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 CancelledError bubbled up through withErrorHandling and was rendered as a generic "Error: ..." with an ugly message and exit code 1.

    Now nia project init follows a strict two-phase contract:

    1. 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.
    2. Commit phase — if the user opted in, addLocalSource(cwd) is called. On any failure (network, daemon down, missing local_folder_id in response) the whole init aborts with a clear error and nothing is written. Otherwise, nia.json is written in a single atomic step.

    Additionally, CancelledError from @crustjs/prompts is now handled globally in handleError: any command that uses prompts will exit silently with code 130 (POSIX SIGINT convention) on Ctrl+C, instead of rendering a noisy error trace.

    The local_binding_note field has been removed from the runProjectInit result and from the CLI output — it described a partial-success state that can no longer occur.

  • f91ab56: refactor: nia project init no longer bootstraps the project root — removes automatic CLAUDE.md/AGENTS.md wiring and automatic nia local add .

    Previously, nia project init would (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 via addLocalSource(cwd) by default. Both side effects mutated the user's project without explicit consent.

    Now:

    • No agent-instruction files are touched. The global nia skill (installed via nia skill) is the sole delivery channel for nia.json guidance — Step 0 of the skill already teaches agents to detect and use nia.json automatically. The --wire / --wire-into flags are removed.
    • No automatic addLocalSource(cwd). The --local flag is removed. Before the source picker, init now asks Index the current project folder (<cwd>) as a local source? — defaults to No. Only if the user answers yes does it call addLocalSource(cwd) and add a local binding to nia.json.
    • Skill install nudge. After writing nia.json, init best-effort-detects whether the nia skill is installed for any agent (via detectInstalledAgents + skillStatus, wrapped in a 1.5s timeout). If not, next_steps includes "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 instructions block in src/cli.ts (Step 0 — check for nia.json) has been updated to reflect the new init behavior.