@niroai/niro 0.3.0 → 0.3.1

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
@@ -5,7 +5,7 @@ The command-line tool **and** MCP server for [Niro](https://niroai.dev) — the
5
5
  One package gives you three things:
6
6
 
7
7
  1. **`niro` CLI** — onboard repos, build the code graph, and manage projects from the terminal.
8
- 2. **A Niro MCP server** — lets an AI assistant answer questions about *your* codebase using Niro's graph. 14 clients supported (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, GitHub Copilot CLI, Factory, Goose, OpenCode, Cline, Kiro, Antigravity, Claude Desktop) — see **[docs/connect-your-ai-assistant.md](docs/connect-your-ai-assistant.md)** for the exact command per client.
8
+ 2. **A Niro MCP server** — lets an AI assistant answer questions about *your* codebase using Niro's graph. 14 clients supported (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, GitHub Copilot CLI, Factory, Goose, OpenCode, Cline, Kiro, Antigravity, Claude Desktop) — see **[docs/connect-your-ai-assistant.md](https://unpkg.com/@niroai/niro/docs/connect-your-ai-assistant.md)** for the exact command per client.
9
9
  3. **Two agent skills** (installed by `niro mcp install`) so you can drive Niro from chat in plain English instead of typing CLI commands:
10
10
  - **`niro-skill`** — answers questions about your code (structure, call chains, blast radius) using the Niro MCP tools.
11
11
  - **`niro-cli`** — runs the CLI for you (onboard, status, rebuild, edit env vars, remove) from a conversation.
@@ -14,7 +14,7 @@ One package gives you three things:
14
14
 
15
15
  > **Working on a feature branch?** Niro indexes one branch per repo, but it follows *your* branch
16
16
  > and uncommitted edits through **temporary projects** — see
17
- > **[docs/working-on-branches.md](docs/working-on-branches.md)** for how that works in plain words.
17
+ > **[docs/working-on-branches.md](https://unpkg.com/@niroai/niro/docs/working-on-branches.md)** for how that works in plain words.
18
18
 
19
19
  ---
20
20
 
@@ -40,7 +40,7 @@ niro init # onboard this folder: create project, upload, build the g
40
40
  niro mcp install # connect one AI assistant — pick it at the prompt, or pass --client
41
41
  ```
42
42
 
43
- `niro mcp install` configures **one** assistant per run — pick it at the prompt, or pass `--client <id>`. 14 clients supported; see **[docs/connect-your-ai-assistant.md](docs/connect-your-ai-assistant.md)** for the full list and the exact command for each. Run it once for each assistant you use. The MCP server URL is picked automatically (own instance? pass `--url <url>`). Restart your AI assistant once after, and you're done — ask it about your code, or ask it to run Niro tasks for you.
43
+ `niro mcp install` configures **one** assistant per run — pick it at the prompt, or pass `--client <id>`. 14 clients supported; see **[docs/connect-your-ai-assistant.md](https://unpkg.com/@niroai/niro/docs/connect-your-ai-assistant.md)** for the full list and the exact command for each. Run it once for each assistant you use. The MCP server URL is picked automatically (own instance? pass `--url <url>`). Restart your AI assistant once after, and you're done — ask it about your code, or ask it to run Niro tasks for you.
44
44
 
45
45
  ---
46
46
 
@@ -0,0 +1,202 @@
1
+ # Connect your AI assistant to Niro
2
+
3
+ `niro mcp install` configures one AI client at a time to use Niro's MCP server. This page
4
+ lists every supported client, the exact command for each, and what it does. If you'd rather
5
+ drive setup from chat instead of a terminal, see [Scenario 2](../README.md#scenario-2--onboard-a-folder-youre-working-in)
6
+ in the main README — the `niro-cli` skill can run these commands for you.
7
+
8
+ ## Before you start
9
+
10
+ ```bash
11
+ npm install -g @niroai/niro
12
+ niro login # browser device flow — no API key to copy
13
+ ```
14
+
15
+ After `niro login`, none of the commands below need an API key — the MCP server authenticates
16
+ with your device token. If you'd rather use an API key instead (e.g. a headless CI box), get
17
+ one from **console.niroai.dev > Settings > Account**; the wizard will ask for it when no
18
+ `niro login` session is found.
19
+
20
+ **Pointing at a different backend?** Every command below defaults to Niro's cloud
21
+ (`https://aiassistant.niroai.dev`). Add `--url <your-backend-url>` to any `niro mcp install`
22
+ command to use a self-hosted or dedicated instance instead (or set `NIRO_MCP_SERVER_URL`).
23
+
24
+ ## All Niro tools are read-only
25
+
26
+ Every tool Niro exposes over MCP only *reads* your code graph — none can modify your code,
27
+ your projects, or anything else. That's why several of the installers below turn on
28
+ auto-approve for Niro's tools: there's nothing for a read-only tool call to break.
29
+
30
+ ---
31
+
32
+ ## Claude Code
33
+
34
+ ```bash
35
+ niro mcp install --client claude-code
36
+ ```
37
+
38
+ Registers the server (`claude mcp add --scope user`), adds a `PostCompact` + `UserPromptSubmit`
39
+ hook so Claude stays aware of Niro after context compaction, appends a short reminder to
40
+ `~/.claude/CLAUDE.md`, and installs the **`niro-skill`** (routes code questions through the
41
+ graph) and **`niro-cli`** skill (drives the CLI from chat) to `~/.claude/skills/`.
42
+
43
+ Verify: type `/mcp` inside Claude Code — `niro` should be listed as connected.
44
+
45
+ ## Codex
46
+
47
+ ```bash
48
+ niro mcp install --client codex
49
+ ```
50
+
51
+ Registers the server in `~/.codex/config.toml`, sets `default_tools_approval_mode = "auto"`
52
+ (safe — every niro tool is read-only), appends a reminder to `~/.codex/AGENTS.md`, and installs
53
+ the shared `niro-skill` + `niro-cli` skill to `~/.agents/skills/` (also read by Windsurf).
54
+
55
+ Verify: `/mcp` inside the Codex TUI.
56
+
57
+ ## Cursor
58
+
59
+ ```bash
60
+ niro mcp install --client cursor
61
+ ```
62
+
63
+ Writes `~/.cursor/mcp.json`, adds `"niro:*"` to `~/.cursor/permissions.json`'s `mcpAllowlist`
64
+ (so Agent doesn't ask before every tool call), and writes a project rule to
65
+ `.cursor/rules/niro.mdc` in the current repo.
66
+
67
+ Requires Cursor's Agent **Auto-run** mode enabled (Settings) for the allowlist to take effect —
68
+ "Ask every time" ignores it.
69
+
70
+ ## VS Code (GitHub Copilot)
71
+
72
+ ```bash
73
+ niro mcp install --client vscode
74
+ ```
75
+
76
+ Writes the user-profile `mcp.json` (`servers.niro`) — the same file VS Code's
77
+ **MCP: Open User Configuration** command opens.
78
+
79
+ Verify: run **MCP: List Servers** from the Command Palette, or check the Chat view's tools icon.
80
+ First use of a new server needs a one-time trust confirmation.
81
+
82
+ ## Windsurf
83
+
84
+ ```bash
85
+ niro mcp install --client windsurf
86
+ ```
87
+
88
+ Writes `~/.codeium/windsurf/mcp_config.json`, appends a reminder to
89
+ `~/.codeium/windsurf/memories/global_rules.md`, and installs the shared `niro-skill` +
90
+ `niro-cli` skill to `~/.agents/skills/` (also read by Codex).
91
+
92
+ ## Claude Desktop
93
+
94
+ ```bash
95
+ niro mcp install --client claude-desktop
96
+ ```
97
+
98
+ Writes `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows:
99
+ `%APPDATA%\Claude\`, Linux: `~/.config/claude/`). Restart Claude Desktop after.
100
+
101
+ ## Gemini CLI
102
+
103
+ ```bash
104
+ niro mcp install --client gemini-cli
105
+ ```
106
+
107
+ Runs `gemini mcp add -s user` to register the server (`~/.gemini/settings.json`) and appends a
108
+ reminder to `~/.gemini/GEMINI.md`.
109
+
110
+ Verify / reload: run `/mcp reload` inside Gemini CLI.
111
+
112
+ ## GitHub Copilot CLI
113
+
114
+ ```bash
115
+ niro mcp install --client copilot-cli
116
+ ```
117
+
118
+ Runs `copilot mcp add` (writes `~/.copilot/mcp-config.json`) and appends a reminder to
119
+ `~/.copilot/copilot-instructions.md`.
120
+
121
+ Verify: run `/mcp` inside the Copilot CLI — servers are available immediately, no restart needed.
122
+
123
+ ## Factory (droid)
124
+
125
+ ```bash
126
+ niro mcp install --client factory
127
+ ```
128
+
129
+ Runs `droid mcp add` (writes `~/.factory/mcp.json`) and appends a reminder to
130
+ `~/.factory/AGENTS.md`. droid reloads automatically when the config file changes.
131
+
132
+ ## Goose
133
+
134
+ ```bash
135
+ niro mcp install --client goose
136
+ ```
137
+
138
+ Writes an `extensions.niro` entry into `~/.config/goose/config.yaml` (Windows:
139
+ `%APPDATA%\Block\goose\config\config.yaml`). Restart Goose (or start a new session) after.
140
+
141
+ If your `config.yaml` already has an unusual `extensions:` layout, the installer prints the
142
+ YAML block to paste in by hand instead of guessing at a risky merge.
143
+
144
+ ## OpenCode
145
+
146
+ ```bash
147
+ niro mcp install --client opencode
148
+ ```
149
+
150
+ Writes `~/.config/opencode/opencode.json` (`mcp.niro`) and appends a reminder to
151
+ `~/.config/opencode/AGENTS.md`. Restart OpenCode after.
152
+
153
+ ## Cline
154
+
155
+ ```bash
156
+ niro mcp install --client cline
157
+ ```
158
+
159
+ Writes Cline's `cline_mcp_settings.json` (under VS Code's `globalStorage` for Cline's
160
+ publisher id) and adds a global rule file to Cline's Rules directory.
161
+
162
+ ## Kiro
163
+
164
+ ```bash
165
+ niro mcp install --client kiro
166
+ ```
167
+
168
+ Writes `~/.kiro/settings/mcp.json` with `autoApprove: ["*"]` (safe — niro's tools are
169
+ read-only) and adds a global steering file at `~/.kiro/steering/niro.md`. Kiro reconnects MCP
170
+ servers automatically when you save the config.
171
+
172
+ ## Antigravity
173
+
174
+ ```bash
175
+ niro mcp install --client antigravity
176
+ ```
177
+
178
+ Writes `~/.gemini/config/mcp_config.json`. Reload via **Agent Settings → Customizations →
179
+ Installed MCP Servers → Refresh** (or `/mcp` in the Antigravity CLI).
180
+
181
+ ---
182
+
183
+ ## Test it
184
+
185
+ After connecting any client, restart it (where noted above) and ask:
186
+
187
+ > "What calls `chargeCard()`? Use Niro tools."
188
+ > "What breaks if I change the `Invoice` schema?"
189
+ > "Is there existing code that parses webhooks, before I write a new one?"
190
+
191
+ If the assistant answers from the graph instead of grepping files, you're connected.
192
+
193
+ ## Disconnect
194
+
195
+ ```bash
196
+ niro mcp uninstall --client <id> # one client
197
+ niro mcp uninstall --all -y # every client, no confirm
198
+ ```
199
+
200
+ `mcp uninstall` is the exact inverse of `mcp install` for each client — it only removes what
201
+ install added, leaving your own config, rules, and other MCP servers untouched. See the main
202
+ [README](../README.md#scenario-11--disconnect-an-ai-assistant-uninstall-the-mcp) for details.
@@ -0,0 +1,135 @@
1
+ # Working on branches — how Niro keeps up with you
2
+
3
+ Niro indexes your team's code once, on one branch per repository — usually `main`. That shared
4
+ index is what everyone's AI assistant queries. But you don't work on `main`. You work on feature
5
+ branches, with uncommitted edits, sometimes across several repositories at once.
6
+
7
+ This page explains, in plain words, what Niro does about that.
8
+
9
+ Everything here works the same whichever AI assistant you use (Claude Code, Cursor, Windsurf,
10
+ Codex, or anything else that speaks MCP) and wherever your git repositories live (GitHub, GitLab,
11
+ Bitbucket, or a self-hosted git server). Niro only needs two things: your repository's git URL and
12
+ the branch you're on.
13
+
14
+ ---
15
+
16
+ ## The one-sentence version
17
+
18
+ > When you're on a branch Niro hasn't indexed, Niro **refuses to guess**. It asks you to create a
19
+ > **temporary project** — a private copy that follows your branch and your edits live — and from
20
+ > then on, answers come from *your* code, not the team's.
21
+
22
+ ---
23
+
24
+ ## What happens on each branch state
25
+
26
+ Niro checks your repository's URL, current branch, latest commit, and whether you have uncommitted
27
+ edits — on every question your assistant asks. Then it picks one of four answers:
28
+
29
+ | Your local state | What Niro does |
30
+ |---|---|
31
+ | On the indexed branch (e.g. `main`), no edits | Answers from the shared team index. Business as usual. |
32
+ | Just created a new branch, no changes yet | Still answers from the team index — your code is *identical* to what's indexed, so the answers are provably correct. No friction for a fresh branch. |
33
+ | On a branch with real changes, **with** a temporary project | Answers from **your temporary project** — your branch, your uncommitted edits, live. |
34
+ | On a branch with real changes, **no** temporary project | **Refuses to answer** and tells your assistant what to do about it (see below). |
35
+
36
+ The last row is the important one. An answer computed from `main` while you're deep in a feature
37
+ branch *looks* right and is quietly wrong — wrong line numbers, missing methods, dead code that
38
+ you already deleted. Niro treats that as worse than no answer.
39
+
40
+ ## What a refusal looks like
41
+
42
+ When Niro refuses, your assistant receives a structured message with three options:
43
+
44
+ 1. **Create a temporary project** *(recommended)* — run `niro new-temp-project` in the repo's
45
+ folder. One command; takes seconds.
46
+ 2. **Answer from the team index anyway** — only if *you* explicitly say so. The answer will carry
47
+ a visible label saying it describes the indexed branch, not your code.
48
+ 3. **Skip Niro for this question** — the assistant falls back to reading files directly.
49
+
50
+ Most assistants will simply ask you which way to go, or run the recommended command themselves if
51
+ you've allowed that.
52
+
53
+ ## Temporary projects in 60 seconds
54
+
55
+ A **temporary project** is your private copy of the team's Niro project:
56
+
57
+ - **Private.** Teammates keep seeing the shared project. Nobody sees your copy — not even
58
+ teammates on the same account. Your half-finished code stays yours.
59
+ - **Live.** Your working tree — including uncommitted edits — is uploaded once, and every save
60
+ after that streams in automatically (while `niro watch` is running). Ask a question seconds
61
+ after saving; the answer reflects the save.
62
+ - **Cheap.** Creating one copies the already-computed index. No re-parsing of the whole project,
63
+ no waiting for a full rebuild.
64
+ - **Branch-aware, automatically.** Once your temporary project exists, you never point anything at
65
+ it. Niro routes each question by the branch you're on: feature branch → your copy; switch back
66
+ to `main` → the team index. Switch back and forth all day; it just follows.
67
+
68
+ ### Working across several repositories
69
+
70
+ Features often span more than one repository — a backend change plus a client change, say. Run
71
+ `niro new-temp-project` in each repo's folder as you branch it. All of them join **one**
72
+ temporary project, so cross-repository answers ("what breaks in service B if I change this in
73
+ service A?") reflect *all* of your local work at once. Each repo can even be on a different
74
+ branch — Niro mirrors whatever your working folders actually look like.
75
+
76
+ Repos you *haven't* branched come along as read-only snapshots, so the full picture stays intact.
77
+
78
+ ### When you're done
79
+
80
+ Merge your branch as usual, switch back to the indexed branch, and Niro will nudge your assistant:
81
+ the temporary project has served its purpose — discard it with `niro discard-temp-project`. The
82
+ shared index picks up your merged commits through its normal syncing; nothing else to do.
83
+
84
+ Two safety nets:
85
+
86
+ - **Discard won't ambush your other work.** If the temporary project still covers another repo
87
+ that's mid-feature, both Niro and the CLI warn before deleting it and ask you to confirm.
88
+ - **Forgot to discard?** Idle temporary projects (no edits for N days — 14 by default, and your
89
+ admin can change it per account or per project) are cleaned up automatically. Only the copy is
90
+ deleted; your local code is never touched, and a fresh copy is one command away.
91
+
92
+ ## The `.niro-project` file
93
+
94
+ Some repos carry a small `.niro-project` file at their root. It holds one line: the name of the
95
+ Niro project this folder belongs to. It's useful when one repository is part of several Niro
96
+ projects, or when you start your assistant from a parent folder that isn't itself a repository.
97
+
98
+ Two things worth knowing:
99
+
100
+ - **Niro never rewrites it.** It always names the shared team project, so it's safe to commit and
101
+ share with the team. Temporary projects don't touch it — routing to your copy happens on the
102
+ server, per question, from your branch.
103
+ - **You don't need it** for the common case: a repo whose URL maps to exactly one Niro project
104
+ resolves by itself.
105
+
106
+ ## Quick reference
107
+
108
+ ```bash
109
+ niro new-temp-project # run in a repo folder: make Niro follow this branch + edits
110
+ niro watch # keep running: streams every save into your temporary project
111
+ niro discard-temp-project # after merging: delete the copy; routing falls back by itself
112
+ niro discard-temp-project --project <id> # discard from another machine / lost local state
113
+ ```
114
+
115
+ And the tool your assistant uses on its own:
116
+
117
+ - `should_create_temp_project` — a read-only check the assistant calls when it notices you're on a
118
+ new branch: "does this repo, on this branch, need a temporary project?" You'll rarely call it
119
+ yourself, but it's why a good assistant offers to run `niro new-temp-project` right when you
120
+ branch, without you asking.
121
+
122
+ ## Requirements and honest limits
123
+
124
+ - **Git is required** for branch detection. Folders that aren't git repositories can still be
125
+ indexed and queried (uploaded as plain folders), but there are no branches to follow — the
126
+ branch logic on this page doesn't apply to them.
127
+ - **Any git host works.** Matching uses the repository URL and branch name only — nothing
128
+ GitHub-specific. HTTPS and SSH remotes both work.
129
+ - **Your backend must support routing.** If the server is older than this feature, the CLI warns
130
+ you loudly at `new-temp-project` time instead of letting answers silently come from the wrong
131
+ place.
132
+ - **Detached HEAD** (bisecting, checking out a tag): there's no branch to follow, so Niro answers
133
+ from the team index with an advisory note rather than refusing.
134
+ - **A brand-new repo** created mid-feature (not yet in any Niro project) can't join a temporary
135
+ project yet — Niro will say so honestly instead of pretending to know it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@niroai/niro",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Niro — one package: the niro CLI plus the Niro MCP server (code intelligence for AI coding assistants).",
5
5
  "keywords": [
6
6
  "niro",
@@ -26,6 +26,7 @@
26
26
  "files": [
27
27
  "bin",
28
28
  "src",
29
+ "docs/*.md",
29
30
  "README.md"
30
31
  ],
31
32
  "engines": {