@niroai/niro 0.17.0 → 1.0.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.
Files changed (177) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +123 -302
  3. package/bin/niro.js +12 -1
  4. package/docs/agent-antigravity.md +37 -0
  5. package/docs/agent-claude-code.md +48 -0
  6. package/docs/agent-claude-desktop.md +47 -0
  7. package/docs/agent-cline.md +42 -0
  8. package/docs/agent-codex.md +45 -0
  9. package/docs/agent-copilot-cli.md +42 -0
  10. package/docs/agent-cursor.md +44 -0
  11. package/docs/agent-factory.md +42 -0
  12. package/docs/agent-gemini-cli.md +42 -0
  13. package/docs/agent-goose.md +42 -0
  14. package/docs/agent-kiro.md +37 -0
  15. package/docs/agent-opencode.md +37 -0
  16. package/docs/agent-vscode.md +45 -0
  17. package/docs/agent-windsurf.md +38 -0
  18. package/docs/answer-shapes.md +69 -0
  19. package/docs/builds-and-updates.md +68 -0
  20. package/docs/cloud-README.md +372 -0
  21. package/docs/configuring-a-folder.md +51 -0
  22. package/docs/connect-ci.md +24 -0
  23. package/docs/connect-overview.md +20 -0
  24. package/docs/connect-review-bots.md +17 -0
  25. package/docs/connect-team-server.md +12 -0
  26. package/docs/connect-terminal.md +49 -0
  27. package/docs/connect-web-agents.md +9 -0
  28. package/docs/connect-your-ai-assistant.md +59 -175
  29. package/docs/coverage-audit-and-consent.md +51 -0
  30. package/docs/evaluate-what-niro-did.md +271 -0
  31. package/docs/faq-assistants-and-mcp.md +122 -0
  32. package/docs/faq-feedback-and-receipts.md +33 -0
  33. package/docs/faq-indexing.md +127 -0
  34. package/docs/faq-install-and-setup.md +103 -0
  35. package/docs/faq-licence-and-plans.md +86 -0
  36. package/docs/faq-login-and-account.md +69 -0
  37. package/docs/faq-offline.md +34 -0
  38. package/docs/faq-performance.md +33 -0
  39. package/docs/faq-privacy-and-security.md +113 -0
  40. package/docs/faq-uninstall.md +47 -0
  41. package/docs/faq-updates.md +59 -0
  42. package/docs/faq-worktrees-and-branches.md +59 -0
  43. package/docs/faq-wrong-or-missing-answers.md +275 -0
  44. package/docs/hosted-only.md +33 -0
  45. package/docs/how-the-graph-works.md +47 -0
  46. package/docs/index.md +157 -0
  47. package/docs/licence-and-plans.md +72 -0
  48. package/docs/lifecycle-debug.md +48 -0
  49. package/docs/lifecycle-onboarding.md +32 -0
  50. package/docs/lifecycle-overview.md +77 -0
  51. package/docs/lifecycle-plan-and-design.md +44 -0
  52. package/docs/lifecycle-review.md +30 -0
  53. package/docs/lifecycle-security-and-privacy.md +35 -0
  54. package/docs/lifecycle-test.md +28 -0
  55. package/docs/lifecycle-write-code.md +35 -0
  56. package/docs/llms-full.txt +8015 -0
  57. package/docs/llms.txt +126 -0
  58. package/docs/playbook-add-a-feature.md +108 -0
  59. package/docs/playbook-change-safely.md +93 -0
  60. package/docs/playbook-data-and-events.md +107 -0
  61. package/docs/playbook-debug-after-a-change.md +96 -0
  62. package/docs/playbook-debug-config.md +95 -0
  63. package/docs/playbook-debug-exception.md +124 -0
  64. package/docs/playbook-debug-failing-service-call.md +119 -0
  65. package/docs/playbook-debug-slow-path.md +80 -0
  66. package/docs/playbook-debug-wrong-value.md +137 -0
  67. package/docs/playbook-onboard.md +95 -0
  68. package/docs/playbook-review-a-change.md +72 -0
  69. package/docs/playbook-test-a-change.md +73 -0
  70. package/docs/reference-cli.md +113 -0
  71. package/docs/reference-config-files.md +42 -0
  72. package/docs/reference-engine-commands.md +56 -0
  73. package/docs/reference-environment-variables.md +89 -0
  74. package/docs/reference-exit-codes.md +67 -0
  75. package/docs/reference-limits.md +75 -0
  76. package/docs/reference-mcp-tools.md +326 -0
  77. package/docs/reference-messages.md +180 -0
  78. package/docs/secrets-and-masking.md +48 -0
  79. package/docs/supported-c.md +130 -0
  80. package/docs/supported-cpp.md +157 -0
  81. package/docs/supported-csharp.md +211 -0
  82. package/docs/supported-go.md +258 -0
  83. package/docs/supported-java.md +226 -0
  84. package/docs/supported-javascript.md +223 -0
  85. package/docs/supported-kotlin.md +124 -0
  86. package/docs/supported-overview.md +89 -0
  87. package/docs/supported-php.md +157 -0
  88. package/docs/supported-python.md +224 -0
  89. package/docs/supported-ruby.md +162 -0
  90. package/docs/supported-rust.md +150 -0
  91. package/docs/supported-swift.md +133 -0
  92. package/docs/supported-typescript.md +220 -0
  93. package/docs/tokens-speed-and-accuracy.md +99 -0
  94. package/docs/troubleshooting.md +42 -0
  95. package/docs/uninstall.md +74 -0
  96. package/docs/what-leaves-your-machine.md +71 -0
  97. package/docs/where-things-are-stored.md +59 -0
  98. package/docs/worktrees-and-branches.md +55 -0
  99. package/package.json +5 -3
  100. package/src/commands/add-repo.js +5 -0
  101. package/src/commands/auditSend.js +67 -0
  102. package/src/commands/build.js +6 -0
  103. package/src/commands/docsSend.js +73 -0
  104. package/src/commands/engine.js +120 -0
  105. package/src/commands/engineRoutes.js +105 -0
  106. package/src/commands/guide.js +254 -0
  107. package/src/commands/init.js +6 -2
  108. package/src/commands/initLocal.js +96 -0
  109. package/src/commands/journalSend.js +47 -0
  110. package/src/commands/login.js +89 -12
  111. package/src/commands/mcp.js +22 -6
  112. package/src/commands/plan.js +99 -0
  113. package/src/commands/repoPush.js +33 -0
  114. package/src/commands/requestIntegration.js +38 -0
  115. package/src/commands/share.js +56 -0
  116. package/src/commands/start.js +451 -371
  117. package/src/commands/status.js +57 -0
  118. package/src/commands/takeover.js +6 -0
  119. package/src/commands/uninstall.js +180 -0
  120. package/src/commands/upgrade.js +38 -8
  121. package/src/commands/watch.js +420 -6
  122. package/src/index.js +174 -3
  123. package/src/lib/agentApi.js +32 -1
  124. package/src/lib/api.js +20 -6
  125. package/src/lib/auditUpload.js +293 -0
  126. package/src/lib/branchDrift.js +149 -0
  127. package/src/lib/choose.js +116 -0
  128. package/src/lib/cloudGuard.js +74 -0
  129. package/src/lib/credentials.js +2 -2
  130. package/src/lib/docsMarked.js +55 -0
  131. package/src/lib/docsState.js +213 -0
  132. package/src/lib/docsUpload.js +481 -0
  133. package/src/lib/engine.js +619 -0
  134. package/src/lib/folderSync.js +2 -1
  135. package/src/lib/graphCheck.js +40 -0
  136. package/src/lib/guide.js +293 -0
  137. package/src/lib/guideSearch.js +252 -0
  138. package/src/lib/integrationRequest.js +89 -0
  139. package/src/lib/journalUpload.js +147 -0
  140. package/src/lib/languages.js +129 -0
  141. package/src/lib/lease.js +375 -0
  142. package/src/lib/localBuild.js +285 -0
  143. package/src/lib/localEngine.js +210 -0
  144. package/src/lib/localOnboard.js +124 -0
  145. package/src/lib/localWorktrees.js +243 -0
  146. package/src/lib/machineCheck.js +58 -0
  147. package/src/lib/mcpClients.js +10 -1
  148. package/src/lib/migrationNotice.js +118 -0
  149. package/src/lib/modelFetch.js +153 -0
  150. package/src/lib/nestedOutput.js +23 -9
  151. package/src/lib/onboardingLog.js +34 -0
  152. package/src/lib/planUsage.js +165 -0
  153. package/src/lib/progressBar.js +46 -0
  154. package/src/lib/prompt.js +1 -1
  155. package/src/lib/redact.js +155 -0
  156. package/src/lib/release.js +33 -0
  157. package/src/lib/repoPush.js +495 -0
  158. package/src/lib/secret.js +1 -1
  159. package/src/lib/service.js +372 -63
  160. package/src/lib/shareCode.js +367 -0
  161. package/src/lib/shareExclusions.js +114 -0
  162. package/src/lib/shareFiles.js +129 -0
  163. package/src/lib/spinner.js +9 -5
  164. package/src/lib/watchDaemon.js +33 -10
  165. package/src/lib/watchState.js +12 -1
  166. package/src/lib/windowsPaths.js +67 -0
  167. package/src/mcp/lineCheck.js +382 -0
  168. package/src/mcp/lineName.js +92 -0
  169. package/src/mcp/localBackend.js +751 -0
  170. package/src/mcp/localMode.js +383 -0
  171. package/src/mcp/localSkill.js +189 -0
  172. package/src/mcp/server.js +610 -79
  173. package/src/mcp/setup.js +519 -131
  174. package/src/mcp/shellSearchHook.js +509 -0
  175. package/src/mcp/teardown.js +173 -91
  176. package/src/mcp/usingNiro.js +39 -0
  177. package/docs/working-on-branches.md +0 -162
package/CHANGELOG.md CHANGED
@@ -4,6 +4,142 @@ Notable changes to `@niroai/niro`. Dates are release dates.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ### Every coding agent learns how to use Niro beyond code questions
8
+
9
+ The instruction text Niro installs for each agent now has a short "Using Niro" part: for a how-to question
10
+ about Niro, the agent lists the pages with `niro guide`, picks the one whose description fits, and answers
11
+ from it; for a Niro error message it runs `niro guide --search` with the message; and it knows the commands
12
+ that manage Niro (`niro init` for another folder, `niro build`, `niro status`, `niro plan`, `niro impact`,
13
+ `niro route-rule`). It reaches every agent: the engine says it when an agent connects, and it is in the
14
+ Claude Code skill and CLAUDE.md section, the files for Codex, Gemini CLI, Copilot CLI, Factory, OpenCode
15
+ and Windsurf, and the Cursor, Cline and Kiro rules. `niro upgrade` puts it in place and keeps your own lines.
16
+
17
+ ### `niro guide --search` understands a question in plain words
18
+
19
+ "how do I uninstall" used to find nothing, because every word had to be on one line. Words such as how,
20
+ do, I, what and the are now left out, and the heading says which words were searched for. When no line
21
+ holds the words but a page does, that page is shown; when no page holds them all, the closest pages come
22
+ first, and the heading says so. Some page descriptions in the `niro guide` list are clearer too.
23
+
24
+ ### `niro guide` reads the documentation in the terminal, offline
25
+
26
+ The documentation pages ship inside the package. `niro guide` lists them, grouped as the start page
27
+ groups them. `niro guide <topic>` shows one page, found by its name, its title or a few words.
28
+ `niro guide --search <words>` searches every page and shows the lines that matched. A pasted error
29
+ message finds the page that explains it, even with your own folder names and numbers in it. Source
30
+ notes are left out, and links show the `niro guide` command to run next. `--json` gives a coding agent
31
+ the same answers, and the skills and rule files Niro installs for agents with a terminal now mention it.
32
+
33
+ ### Refreshing Niro's part of an agent's instruction file no longer deletes your notes below it
34
+
35
+ For Gemini CLI, Copilot CLI, Factory and OpenCode (and the CLAUDE.md, Codex and Windsurf files the same
36
+ way), Niro adds a section to the agent's own instruction file and refreshes it when its text changes, on
37
+ `niro upgrade` and `niro mcp install`. The refresh used to remove everything from Niro's section to the
38
+ next `## ` heading, so anything you had written straight below it, with no heading or under a `#` or `###`
39
+ heading, was deleted. It now removes only Niro's own text, the way uninstalling does, and every line you
40
+ wrote stays as it was.
41
+
42
+ ### Upgrading and uninstalling keep each of your lines on its own line
43
+
44
+ When your own line sat right against Niro's section, with no blank line above and none below, upgrading
45
+ or uninstalling joined it to the next line. When Niro's section was worded by an older release or edited
46
+ by you, your line directly below it was deleted. Now one line break is put back between the two lines,
47
+ and under a section Niro does not know word for word, only lines Niro wrote go. A line Niro cannot tell
48
+ from yours, such as a Niro sentence you edited, is kept, so a little of Niro's old text may stay behind.
49
+
50
+ ### Claude Code gets the "ask Niro first" note on shell searches too
51
+
52
+ The note Claude Code already got before its own Grep, Glob and Read tools now also comes before a
53
+ shell command that searches or reads source code in a folder Niro indexes: `grep`, `rg`, `ag`, `ack`,
54
+ `git grep`, `cat`, `head`, `tail`, `sed -n`, `awk`, `less`, `nl`, `bat`, `find -name '*.py'`, and
55
+ `xargs grep`. Agents mostly search through the shell, so the old note rarely fired. It never blocks a
56
+ command, and it stays quiet for config, docs, logs and build output, for a file changed in the last
57
+ 10 minutes, for a command that reads a pipe (`ps aux | grep node`, `npm test | tail`), and for
58
+ `git grep` over another commit. `niro mcp install` (or `niro upgrade`) adds it; `niro mcp uninstall`
59
+ removes it. It runs no network call and no Niro command: one `awk` and a walk up the folders.
60
+
61
+ ### The coverage audit sends a few lines, not the whole flagged file
62
+
63
+ When a build flags a line it thinks the parser missed, only the method that holds that line (or, when
64
+ no method holds it, at most 10 lines before to 40 after) and one line for each name those lines use
65
+ from the same file are sent, with secrets masked. Every other line of the file goes as an empty line,
66
+ so line numbers stay where they were. `niro status` and `niro plan` say so. niro-cli refuses to post
67
+ a snippet that holds any other line. Removing a copyright holder's name no longer drops a line after a
68
+ `*/` header, which used to move every flag below it one line up on the server.
69
+
70
+ ### The background watcher no longer saves your whole shell environment
71
+
72
+ `niro-watch` runs under PM2, and PM2 saves the environment it was started with in
73
+ `~/.pm2/dump.pm2`. That used to be the whole shell, cloud keys and tokens included, in a file other
74
+ users on the machine could read. The watcher is now started with only what it reads (HOME, PATH,
75
+ locale, temp folders, proxy and certificate settings, and the Niro settings), and `dump.pm2` and its
76
+ backup are made readable by you only. An install made by an earlier version is started again with
77
+ the smaller environment the next time you run `niro start` or `niro service install`, which also
78
+ rewrites the saved files.
79
+
80
+ `niro status` and `niro plan` now say what leaves the machine: your code stays on it, and the files
81
+ the coverage audit flags are sent with secrets masked, on every plan.
82
+
83
+ ### `niro watch` re-checks a locally indexed folder every few minutes
84
+
85
+ A file event that fs.watch dropped, or a file added while one was lost, was not built into the local
86
+ graph until some later edit arrived. The watcher now lists a locally indexed folder every five minutes
87
+ (file names, sizes and modification times; no file is read) and builds it when the listing changed
88
+ since the last build started. A folder with a build running or due is left to that build, so two
89
+ builds never run at once. Set `NIRO_LOCAL_RECHECK_MS` to change the interval.
90
+
91
+ ### The MCP bridge speaks Streamable HTTP
92
+
93
+ `niro mcp serve` now talks to the Niro server over MCP Streamable HTTP (`POST /mcp`) when the server
94
+ offers it: each call is answered in its own HTTP response, so there is no long-lived stream to drop.
95
+ An expired session is renewed and the call resent once; a failed call returns an error instead of
96
+ hanging. A dropped connection is retried only when the call cannot run twice (it never left, or it
97
+ is a read like `tools/list`); a `tools/call` that may have run returns an error instead. Servers without it (404/405 on `/mcp`) get the old SSE transport, unchanged. Force one with
98
+ `NIRO_MCP_TRANSPORT=http` or `sse`. Editor configs do not change.
99
+
100
+ ### `niro audit-push-repo`, for the plans that include it
101
+
102
+ Sends this folder's whole source to Niro, so we can measure what the local engine's parser
103
+ misses on code we never see rather than only on the files it already failed to parse. It lands
104
+ in the account-scoped object store, the same place a repository uploaded through `niro add repo`
105
+ goes, and nothing in that chain creates a project.
106
+
107
+ It is explicit: no watcher runs it and no other command triggers it, and it prints the folder,
108
+ the file count and the size, then asks. With no terminal it refuses unless you pass `--yes`.
109
+
110
+ Permission is a claim in the licence lease, and anything that is not a clear yes is a refusal,
111
+ including a licence service that cannot be reached. The folder goes through the same gate as
112
+ `niro init`, which refuses your home directory, the filesystem root and a folder that holds no
113
+ project of its own. The file set is the manifest the CLI already uses, so `.gitignore` is
114
+ honoured and, when git cannot answer on a work tree, every file whose name could carry a secret
115
+ is dropped rather than uploaded unverified; the service then decides what it will take, as it
116
+ does for every other upload. A folder that has been sent is remembered in
117
+ `~/.niro/audit-repos.json`; a second run says when the first one was, and `--force` sends it
118
+ again into the same workspace.
119
+
120
+ ### The local graph needs no container, and nothing is offered to the cloud
121
+
122
+ The local engine keeps its graph in a single file on your machine (`~/.niro-local/graph.db`), so it
123
+ needs no container runtime and no database server. An earlier draft of this release kept the graph
124
+ in Memgraph, offered Niro's cloud on a machine that could not run it, and read
125
+ `NIRO_APPROVE_CLOUD_INDEXING`; all of that was removed before release, and that variable is not
126
+ read. `niro engine status` shows a `database` line (whether the graph file opens), printed whichever
127
+ way the engine was found, including from `NIRO_LOCAL_BIN`.
128
+
129
+ ### A folder indexed on your own machine is no longer indexed in the cloud as well
130
+
131
+ `niro build`, `niro init` and `niro add repo` now refuse a folder that the local engine
132
+ (`niro-local`) already indexes, and name the two ways out: `niro-local build --path <folder>` to
133
+ update the local index, or `niro-local remove --path <folder>` first if you do want it in the
134
+ cloud. Before this, either command uploaded the folder's source and indexed it a second time,
135
+ which is the one thing the local engine exists to avoid, and the second index was charged for and
136
+ then went stale, because questions in that folder are answered from the local graph.
137
+
138
+ A machine without the engine is unaffected, and so is any folder the engine does not index.
139
+ `niro new-temp-project` is deliberately **not** refused: a temporary project is a cloud project on
140
+ purpose, because it serves pull request review and root cause analysis, which the local graph does
141
+ not answer. It now says so in one line before it uploads.
142
+
7
143
  ## 0.17.0 — 2026-09-23
8
144
 
9
145
  ### `niro init --defaults` still asks which project
package/README.md CHANGED
@@ -1,190 +1,101 @@
1
- # niro: CLI + MCP server (`@niroai/niro`)
1
+ # niro: Niro Local CLI + MCP server (`@niroai/niro`)
2
2
 
3
- Command-line tool and MCP server for [Niro](https://niroai.dev). Niro reads your code and builds
4
- a map of how it fits together, so your AI assistant answers from that map instead of guessing.
3
+ Niro reads your code and builds a map of how it fits together: classes and methods, who calls
4
+ what, HTTP endpoints and calls between services, events, and data access. Your AI assistant
5
+ answers from that map instead of guessing.
5
6
 
6
- One package installs three things: the `niro` command, the MCP server your assistant talks to,
7
- and two agent skills so you can ask for Niro tasks in plain English.
7
+ **Niro Local builds and keeps the map on your machine.** Your code is read here and the graph is
8
+ stored here (`~/.niro-local/graph.db`). What is sent, and when, is listed under
9
+ [What leaves your machine](#what-leaves-your-machine).
8
10
 
9
- Requires Node.js 18 or newer. Niro is in private beta: you need an access code, which you get
10
- from the **Request Access** button at [www.niro.ai](https://www.niro.ai).
11
+ One package installs the `niro` command, the MCP server your assistant talks to, and two agent
12
+ skills so you can ask for Niro tasks in plain English.
13
+
14
+ Requires Node.js 18 or newer. Niro is in private beta: request access at
15
+ [www.niro.ai](https://www.niro.ai).
11
16
 
12
17
  ---
13
18
 
14
19
  ## Get started
15
20
 
21
+ Once per machine, in your first repo:
22
+
16
23
  ```bash
17
24
  cd ~/code/my-service
18
25
  npx @niroai/niro start
19
26
  ```
20
27
 
21
- Signs you in, installs itself, shows you what it is about to index and asks first, builds the
22
- graph, and connects your assistant. Run it again in any other repo; it skips what is done.
23
-
24
- Then restart your assistant and ask it something:
25
-
26
- ```
27
- "What breaks if I change PaymentService.refund?"
28
- ```
29
-
30
- ---
28
+ `niro start` checks the machine, signs you in (one browser screen: choose a plan and approve
29
+ this terminal), installs the local engine, builds this folder's graph, connects your AI
30
+ assistant, and starts a background watcher that keeps the graph current as files change.
31
31
 
32
- ## What you can ask for
33
-
34
- | | |
35
- |---|---|
36
- | Anything about your code | call chains, structure, entry points, API endpoints |
37
- | What breaks if you change something | blast radius across services, including callers a search cannot find |
38
- | A standing review | issues already in the code, by severity, in the browser |
39
- | Root causes from your alerts | connect Sentry, Slack, Jira, Linear or CloudWatch and an alert arrives as a bug with the analysis done |
40
-
41
- ---
42
-
43
- ## Everyday commands
32
+ Then add every other repo with one command. It adds the folder and builds its graph:
44
33
 
45
34
  ```bash
46
- niro status
35
+ cd ~/code/another-service
36
+ niro init
47
37
  ```
48
- Is my index up to date? It answers about the project this folder is synced to **on the branch you
49
- are on**, so once you have run `niro new-temp-project` it reports that copy rather than the shared
50
- project. Name one explicitly to ask about a different project: `niro status <project-id>`.
51
38
 
52
- ```bash
53
- niro start
54
- ```
55
- Index another repo. Cross-service answers need more than one.
39
+ Each folder goes into a project named after it. To put a second service into the same project, so
40
+ the calls between them are linked, name the project:
56
41
 
57
42
  ```bash
58
- niro info
43
+ cd ~/code/llm-gateway
44
+ niro init --project niro
59
45
  ```
60
- What does Niro know about this folder: repo, branch, which project it maps to.
61
46
 
62
- ```bash
63
- niro projects
64
- ```
65
- Every project in your account.
66
-
67
- ```bash
68
- niro build
69
- ```
70
- Rebuild the index by hand and watch it finish. Like `niro status`, it picks the project for the
71
- branch you are on, so on a branch with a temporary project it rebuilds that one. Name a project to
72
- rebuild a different one.
73
-
74
- ```bash
75
- niro upgrade
76
- ```
77
- Get the latest version, and bring your hooks, skills and watcher with it. See
78
- [Upgrading](#upgrading).
47
+ Restart your assistant and ask it something:
79
48
 
80
- ```bash
81
- niro doctor
82
49
  ```
83
- Check this machine against the server and repair what is safe to repair. Today that is
84
- `niro doctor sync-registry`, which fixes folders and `.niro-project` files left pointing at projects
85
- that have gone or been renamed. The background watcher runs it for you every six hours.
86
-
87
- ---
88
-
89
- ## Working on a branch
90
-
91
- Your index covers the branches you chose to build. On a branch nothing covers, Niro says so
92
- rather than answering from stale code.
93
-
94
- ```bash
95
- niro new-temp-project
96
- ```
97
- Run once in the repo folder. Makes a private copy that follows your branch and uncommitted
98
- edits. Your shared project is untouched.
99
-
100
- ```bash
101
- niro discard-temp-project
50
+ "What breaks if I change PaymentService.refund?"
51
+ "Which services call the /orders endpoint?"
102
52
  ```
103
- Run when the branch is merged. Forgotten copies are cleaned up after two weeks.
104
-
105
- If a copy is deleted for you, or a project is renamed, your machine is not told and the folder keeps
106
- pointing at something that is gone. `niro doctor sync-registry` sorts that out, and the background
107
- watcher runs it every six hours — see [When a project is deleted](#when-a-project-is-deleted).
108
-
109
- Full guide: [docs/working-on-branches.md](https://unpkg.com/@niroai/niro/docs/working-on-branches.md)
110
53
 
111
54
  ---
112
55
 
113
- ## When a project is deleted
114
-
115
- Delete a project, or let an unused private copy expire, and your machine is not told. The folder
116
- carries on pointing at something that is no longer there.
117
-
118
- That is not just untidy. It is what makes `niro new-temp-project` in another folder say the slot is
119
- already taken, naming a copy that no longer exists. And a `.niro-project` file left naming a deleted
120
- project keeps answering, because it is read before your git remote.
121
-
122
- The background watcher checks every six hours and sorts this out for you. `niro
123
- doctor sync-registry` does the same thing on demand.
124
-
125
- What it does depends on what went missing:
56
+ ## Everyday commands
126
57
 
127
- | What is gone | What happens to your folder |
58
+ | Command | What it does |
128
59
  |---|---|
129
- | A private copy of a project | Goes back to the original project and carries on syncing |
130
- | The project itself | Left alone if the repo still exists; unregistered only when both are gone |
131
- | Neither, just a stale `.niro-project` | Repaired if your git remote says which project it should name; removed if it names nothing and is not shared; otherwise you are told |
132
-
133
- It never deletes anything on the server, and it never touches a `.niro-project` file. Everything it
134
- acts on has already gone. It only acts on what it can check, too: a folder git cannot read, or a
135
- project it could not reach, is left exactly as it is and reported. A bad connection can never cost
136
- you a working folder.
137
-
138
- **How it decides what to do with a stale `.niro-project`.** That file can hold a project's name
139
- rather than its id, so a renamed project looks exactly like a deleted one. Niro uses a second signal:
140
- your folder's git remote. If the remote points at exactly one project, the pin is rewritten to that
141
- project's id, which cannot be broken by a future rename. If the remote points at nothing either, the
142
- pin identifies nothing and is removed.
143
-
144
- **Unless the file is committed.** A `.niro-project` in git is shared with everyone who clones the
145
- repo, and what looks like a dead project to you may be a colleague's. Niro never changes a committed
146
- one for you. It tells you, and you decide.
147
-
148
- `niro info` also mentions it when you are standing in an affected folder, so you do not have to go
149
- looking.
150
-
151
- ## When you run out of private copies
152
-
153
- You get a limited number of private copies of each project. If you hit that limit, Niro tells you
154
- which branches are holding them, and the CLI adds where each one is checked out:
155
-
156
- ```
157
- You already have 5 working copies of this project, which is the limit (5).
158
- They are for: feature/a, feature/b, feature/c, feature/d, feature/e.
159
-
160
- You have 5 working copies of this project on this machine:
161
- feature/a /home/you/work/service
162
- feature/b /home/you/work/service-wt2
163
- ...
164
- ```
165
-
166
- Run `niro discard-temp-project` in one you have finished with, then try again. Copies nobody has
167
- touched for a while are also cleared automatically.
60
+ | `niro init [path]` | Add a folder and build its graph, in one step (an indexed folder is rebuilt). Needs `niro start` once first. Options: `--project <name>` joins or starts that project, `--force` adds a folder with no build file, `--path <folder>`, `--branch <name>` (a folder outside git), `--base-url <url>`. At or over the line limit a new folder is refused before it is added; a folder already indexed is still rebuilt. |
61
+ | `niro build [path]` | Rebuild the graph of a folder already added. A folder not added yet is refused with a pointer to `niro init`. |
62
+ | `niro status` | This folder: indexed or not, last build, plan, connected assistants, auto-sync. |
63
+ | `niro plan` | Your plan, lines used against its limit, every indexed folder (largest first), and your options. |
64
+ | `niro plan remove <folder>` | Stop indexing a folder and free its lines. Your code is not touched. |
65
+ | `niro request-integration <name>` | Ask Niro's team to support a language, framework or tool Niro does not read yet (`--kind framework` or `--kind tool`, `--reason "<why>"`). Asks before sending; the request is kept with your account. Your assistant can do the same with the `request_integration` tool, which also asks you first. `niro start` names languages in a folder that Niro does not read yet. |
66
+ | `niro mcp install` | Connect another AI assistant (Claude Code, Cursor, Codex, Windsurf and others). |
67
+ | `niro service install` | Restart the background watcher if it stopped. |
68
+ | `niro upgrade` | Update to the latest version. |
69
+ | `niro uninstall` | Remove Niro from this machine. See [docs/uninstall.md](docs/uninstall.md). |
70
+
71
+ Most commands take `--json` for scripts and agents (`niro plan --json`, `niro status --json`,
72
+ `niro whoami --json`).
168
73
 
169
74
  ---
170
75
 
171
- ## Measure what Niro changes
172
-
173
- ```bash
174
- niro ab enable
175
- ```
176
- Runs Niro **off** for half your sessions for 14 days, so you can compare. Applies to your whole
177
- account, and asks before it starts.
178
-
179
- ```bash
180
- niro ab report
181
- ```
182
- The with-Niro and without-Niro comparison.
183
-
184
- ```bash
185
- niro ab disable
186
- ```
187
- Stop early. Every session uses Niro again.
76
+ ## Plans and the line limit
77
+
78
+ **Free** indexes up to 500,000 lines of code in total on your machine. Every line of every indexed
79
+ file counts, blank lines and comments included (the same number `wc -l` gives). Each repository
80
+ counts once, by its largest checkout: two checkouts of one repo are not counted twice.
81
+
82
+ - A build starts while you are under the limit, and the build that takes you over is allowed to
83
+ finish. After that, adding a new repository or project stops until you choose how to continue.
84
+ Folders already indexed keep rebuilding, and so do new branches or worktrees of a repository
85
+ already indexed, and a service folder inside an indexed monorepo.
86
+ - The graph you already have keeps answering your assistant in the meantime.
87
+ - `niro start`, `niro init` and `niro plan` tell you when you are over, and open the console's
88
+ **/limit** page with three ways on:
89
+ 1. **Unlock unlimited lines on Free** by turning on sharing of redacted code.
90
+ 2. **Request a Pro free trial** (30 days, no line limit, no sharing needed). Your code stays on
91
+ this machine, except, for each line the audit flags, the whole method that holds it and one line
92
+ for each name it uses, sent with secrets masked and author and company names removed. A record of which Niro tools your
93
+ assistant used is also sent, to improve Niro and to show you its value. Niro's tools answer
94
+ your assistant from the graph on this machine and never send the contents of your files.
95
+ 3. **Stay under the limit** with `niro plan remove <folder>`.
96
+
97
+ You can turn sharing on or off at any time under Settings, Privacy in the console. Turned off on
98
+ Free, the line limit applies again.
188
99
 
189
100
  ---
190
101
 
@@ -193,179 +104,89 @@ Stop early. Every session uses Niro again.
193
104
  ```bash
194
105
  niro mcp install
195
106
  ```
196
- Pick from the list, or `--client <id>` to skip the prompt. Restart the assistant afterwards.
197
107
 
198
- ```bash
199
- niro mcp install --list
200
- ```
201
- All 14 supported clients and the file each one is configured through.
202
-
203
- ```bash
204
- niro mcp uninstall --all -y
205
- ```
206
- Removes everything install added: MCP config, hooks and skills. Leaves you logged in.
207
-
208
- Per-client details: [docs/connect-your-ai-assistant.md](https://unpkg.com/@niroai/niro/docs/connect-your-ai-assistant.md)
209
-
210
- ---
211
-
212
- ## Managing projects
213
-
214
- ```bash
215
- niro edit --list-env
216
- ```
217
- Environment variables Niro found, with secret values masked.
218
-
219
- ```bash
220
- niro edit --set-env KEY=VALUE
221
- ```
222
- Set one. The value is never printed or logged.
223
-
224
- ```bash
225
- niro edit --alias new-name
226
- ```
227
- Rename a project.
228
-
229
- ```bash
230
- niro remove --unmap-repo <gitId>
231
- ```
232
- Detach a repo from a project. Nothing is deleted.
233
-
234
- ```bash
235
- niro remove --project --confirm-name <name>
236
- ```
237
- Delete a whole project. Destructive, hence the confirmation. It refuses on a temporary project and
238
- sends you to `niro discard-temp-project` instead, because that removes the copy **and** points this
239
- folder back at the shared project; deleting it here would leave the folder aimed at a project that
240
- no longer exists. `niro delete` refuses for the same reason.
108
+ Asks which assistant, writes Niro into its settings, and installs the skills. Restart the
109
+ assistant afterwards; skills load at startup. "Other" prints a config block to paste into any
110
+ assistant that is not listed.
241
111
 
242
112
  ---
243
113
 
244
- ## Keeping in sync
245
-
246
- ```bash
247
- niro service status
248
- ```
249
- Is the background watcher running? It syncs your indexed folders as you edit.
250
-
251
- ```bash
252
- niro service install
253
- ```
254
- Start it and have it come back on login. Needs PM2 (`npm install -g pm2`).
114
+ ## What leaves your machine
255
115
 
256
- ```bash
257
- niro watch
258
- ```
259
- Watch this folder in the foreground instead, for one session.
116
+ - **Your account.** Sign-in, and your plan's licence (which plan, its line limit, whether sharing
117
+ is on), renewed while Niro runs.
118
+ - **Which tools were used**, on every plan, to improve Niro and to show you its value. A record of
119
+ the Niro tools your assistant called: the tool names, how long each took, whether it failed,
120
+ whether Niro helped and how many native calls it saved, a short summary of the task written by
121
+ the assistant, and the names, paths and search text it asked about (each cut to 200 characters).
122
+ No source files.
123
+ - **Coverage findings**, on every plan. For each line the graph missed (a class or a route with
124
+ nothing in the graph for it), the method that holds it (or the 10 lines before and 40 after it)
125
+ and one line for each name it uses are sent, with that file's path inside the repo, so the parser can be fixed. Every other line of the
126
+ file is sent blank; a whole file is never sent. Before sending, Niro removes secrets, author names
127
+ and company names it can recognise (your email domain, the git remote's owner, copyright holders).
128
+ - **Catalogue signals**, on every plan, with the coverage findings and under the same rule (a signed-in
129
+ machine with a readable plan). After a build, for each indexed folder: the file extensions Niro read
130
+ no language in, with a count each (for example `.fs: 12`), and the names of outside libraries your
131
+ code imports, each with its ecosystem, whether Niro already has rules for it, and how many files
132
+ import it. This tells us which languages and libraries to support next. No file names, paths, import
133
+ lines or source are sent, and no name of your own code: a package whose source is in your project or
134
+ its other folders, or that shares your packages' own prefix (your npm scope, your Go organisation, your
135
+ Java packages), is never sent. A library whose source is in none of your project's folders is sent by
136
+ its name, even when that name is your company's (a private package or git host), because the catalogue
137
+ needs every outside library. Sent again only when the list changes.
138
+ - **A request for a language, framework or tool, only when you send one** (`niro request-integration`, or
139
+ your assistant's `request_integration` tool after you say yes): its name and kind, your reason if you
140
+ give one, and your account's email.
141
+ - **The code Niro indexes, only while sharing is on.** With "Share redacted code" on in the console,
142
+ the background watcher sends the files Niro indexes in each folder (source, config and build files;
143
+ never a gitignored file, a real `.env`, a key or `node_modules`), with secrets masked and author and
144
+ company names removed on this machine: the whole set the first time, then only changed files. Keep a
145
+ folder out with `niro share exclude <folder>`. Turning sharing off stops it.
146
+ - **One folder at once, when you choose to.** `niro audit-push-repo` sends one folder's indexed files the
147
+ same way, only when sharing is on and your plan includes it. It asks first.
148
+
149
+ Your graph stays on your machine, and your assistant's questions are answered from it there. A
150
+ record of those tool calls is sent, as described above.
151
+
152
+ Your AI assistant (for example Claude Code, Codex or Cursor) may send what Niro shows it to its own
153
+ model provider, under that assistant's terms. That is the assistant's doing, not Niro's.
260
154
 
261
155
  ---
262
156
 
263
157
  ## Upgrading
264
158
 
265
- **Check which you are on first:**
266
-
267
159
  ```bash
268
160
  niro --version
269
- ```
270
-
271
- **On 0.13.0 or newer**, one command:
272
-
273
- ```bash
274
161
  niro upgrade
275
162
  ```
276
163
 
277
- Replaces the package with the latest published version, then puts back the two things replacing the
278
- package cannot reach: it re-runs the installer for every assistant you have configured, and
279
- restarts the background watcher. Restart your assistant afterwards.
280
-
281
- **On anything older than 0.13.0**, you do not have `niro upgrade` yet, so it is two commands, once:
282
-
283
- ```bash
284
- npm install -g @niroai/niro@latest
285
- niro upgrade --finish
286
- ```
287
-
288
- The first gets the package. The second does the half npm cannot: your hooks, skills and the
289
- watcher. After that, `niro upgrade` on its own is enough. Do not stop after the first command:
290
- that leaves you on the new version running the old version's hooks, skills and instruction files,
291
- which is the problem `niro upgrade` exists to solve.
292
-
293
- **Why it is more than an npm install.** The hooks, skills and instruction files are written into
294
- your home folder as fixed text when you install, not read out of the package as it runs, so a newer
295
- package does not change them. The watcher is a long-running process still holding the code it
296
- started with. The MCP config is the one part that needs nothing done to it: it runs plain `niro`
297
- from your `PATH` with no version pinned in it, so the new server is picked up on its own.
298
-
299
- **Restart your assistant last.** Skills and hooks are read when it starts, so nothing above reaches
300
- a session that is already open.
301
-
302
- Fully by hand, if you would rather:
303
-
304
- ```bash
305
- npm install -g @niroai/niro@latest
306
- niro mcp install # once per assistant you use
307
- niro service install # only if you run the watcher
308
- ```
309
-
310
- `niro start` upgrades nothing. On a machine that has connected an assistant once it skips the
311
- connect step, so the old hooks and skills stay where they are.
312
-
313
- ---
314
-
315
- ## Reference
316
-
317
- Add `--help` to any command for its flags. Add `--json` to `whoami`, `info`, `status`,
318
- `projects`, `build`, `ab report`, `edit --list-env` and `doctor sync-registry` for machine-readable
319
- output.
320
-
321
- | File | What it holds |
322
- |---|---|
323
- | `~/.niro/credentials.json` | Your login, mode `0600` |
324
- | `~/.niro/config.json` | Backend URLs saved during setup |
325
- | `~/.niro/projects.json` | Per-folder sync state |
326
- | `.niro-project` | Pins a repo folder to a Niro project |
327
-
328
- | Variable | What it sets | Default |
329
- |---|---|---|
330
- | `NIRO_API_URL` | Backend the CLI talks to | `https://aiorchestrator.niroai.dev` |
331
- | `NIRO_MCP_SERVER_URL` | Backend the MCP server talks to | `https://aiassistant.niroai.dev` |
332
- | `NIRO_API_KEY` | Read by the MCP server when running headless. For CI, prefer `niro login --api-key` | none |
333
- | `NIRO_UPLOAD_CONCURRENCY` / `_TIMEOUT_MS` / `_MAX_TOTAL_BYTES` / `_MAX_FILES` | Tune the first upload | 4 / 60000 / 1 GiB / 50000 |
334
-
335
- Running your own instance? Set `NIRO_API_URL` before `niro login`, and pass `--url <url>` to
336
- `niro mcp install`.
337
-
338
- ---
339
-
340
- ## What leaves your machine
341
-
342
- Source and config files from the folder you confirmed, and nothing else. `.gitignore` is
343
- honoured, so a gitignored `.env` is never sent. Raw `.env` and `*.properties` files are not in
344
- the upload set; committed files like `application.yml` and `.env.example` are, because they hold
345
- defaults rather than secrets.
346
-
347
- Secret values are never printed: `--set-env` does not echo them, and `--list-env` masks anything
348
- that looks like a secret by name or by content.
164
+ `niro upgrade` replaces the package with the latest version, re-installs Niro into every assistant
165
+ you have configured, and restarts the background watcher. Restart your assistant afterwards.
349
166
 
350
167
  ---
351
168
 
352
169
  ## If something is wrong
353
170
 
354
- **The assistant ignores Niro.** Restart it. Skills load at startup, so a fresh `niro mcp install`
355
- does nothing until you do.
171
+ **The assistant ignores Niro.** Restart it. Skills load at startup.
172
+
173
+ **"This folder is not indexed on this machine".** Run `niro init` in that folder (or `niro start`
174
+ there, on a machine that is not set up yet).
356
175
 
357
- **`niro: command not found`.** Your global npm bin is not on `PATH`. Check with `npm bin -g`.
176
+ **`niro init` says you are not signed in, or the engine is missing.** Run `niro start` once on this
177
+ machine.
358
178
 
359
- **This folder maps to several projects.** Pass `--project <alias|id>`, or pick one when asked.
179
+ **"No room left under the limit".** See [Plans and the line limit](#plans-and-the-line-limit), or
180
+ run `niro plan` for your options.
360
181
 
361
- **Auto-sync is not running.** `npm install -g pm2`, then `niro service install`.
182
+ **`niro: command not found`.** Your global npm bin is not on `PATH`. Find npm's global folder with `npm prefix -g`; its `bin` folder must be on `PATH`.
362
183
 
363
- **A command or feature in the changelog is missing.** You are on an older version. Check with
364
- `niro --version`, then see [Upgrading](#upgrading): before 0.13.0 it takes two commands, after it
365
- one. Plain `npm install -g` on its own always leaves your hooks and skills on the old version.
184
+ **The graph does not update as you edit.** The watcher is not running: `niro service install`
185
+ (it needs PM2: `npm install -g pm2`).
366
186
 
367
- **A folder was refused.** Niro will not index your home folder, or a folder with no build file
368
- in it. Point it at the repo you meant.
187
+ **A folder was refused.** Niro will not index your home folder or the root of the disk. Run it in
188
+ the repo you meant. A git repository inside the folder you index is its own project: run
189
+ `niro init` inside it.
369
190
 
370
191
  ---
371
192