@niroai/niro 0.3.2 → 0.3.4
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 +7 -5
- package/docs/working-on-branches.md +27 -14
- package/package.json +1 -1
- package/src/commands/init.js +2 -2
- package/src/commands/takeover.js +1 -1
- package/src/index.js +1 -1
- package/src/mcp/setup.js +1 -1
package/README.md
CHANGED
|
@@ -14,17 +14,19 @@ One package gives you three things:
|
|
|
14
14
|
|
|
15
15
|
## Working on branches
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
Your projects cover the repos and branches you chose to index. On every question, Niro routes
|
|
18
|
+
to the project matching your repo and current branch. When you are on a branch **no project
|
|
19
|
+
covers** (with real changes), Niro refuses to answer from stale code. Your assistant offers the fix:
|
|
19
20
|
|
|
20
21
|
```bash
|
|
21
22
|
niro new-temp-project # run once in the repo folder
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
This creates your own private copy of the project that follows your branch and your
|
|
25
|
-
uncommitted edits, live (keep `niro watch` running).
|
|
26
|
-
|
|
27
|
-
branch and from the
|
|
26
|
+
uncommitted edits, live (keep `niro watch` running). Your original project is not changed.
|
|
27
|
+
Switching branches needs nothing: Niro answers from your copy on the new
|
|
28
|
+
branch, and from the matching indexed project on branches you already cover. When your branch
|
|
29
|
+
is merged:
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
32
|
niro discard-temp-project
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Working on branches with Niro
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Your team decides what Niro indexes: you create projects, and each project
|
|
4
|
+
covers the repos and branches you choose. One project might index main,
|
|
5
|
+
another might index a develop or release branch. That is up to you.
|
|
6
|
+
|
|
7
|
+
When you ask a question, Niro picks the project that matches your repo and
|
|
8
|
+
the branch you are currently on. This page is about the moment when NO
|
|
9
|
+
project matches: you created a new branch and changed code that no project
|
|
10
|
+
has indexed yet. Two minutes to read.
|
|
6
11
|
|
|
7
12
|
## The short version
|
|
8
13
|
|
|
@@ -14,11 +19,12 @@ Run it in your repo folder when Niro asks for it. That is all.
|
|
|
14
19
|
|
|
15
20
|
## What you will see
|
|
16
21
|
|
|
17
|
-
You create a branch and start changing code.
|
|
22
|
+
You create a branch that no project covers and start changing code.
|
|
18
23
|
Then you ask your AI assistant something about the code.
|
|
19
24
|
|
|
20
|
-
Niro notices
|
|
21
|
-
a wrong answer based on
|
|
25
|
+
Niro notices that no project has indexed this branch. Instead of giving
|
|
26
|
+
you a wrong answer based on some other branch, it replies with something
|
|
27
|
+
like:
|
|
22
28
|
|
|
23
29
|
I cannot answer this safely. Your branch has diverged
|
|
24
30
|
from the branch Niro indexed.
|
|
@@ -35,8 +41,8 @@ It creates your own private copy of the project inside Niro.
|
|
|
35
41
|
|
|
36
42
|
- The copy follows your branch, including changes you have not committed.
|
|
37
43
|
- Every save updates the copy, as long as "niro watch" is running.
|
|
38
|
-
-
|
|
39
|
-
-
|
|
44
|
+
- Your original project is not changed. It keeps its own index.
|
|
45
|
+
- The copy is fully separate and disposable.
|
|
40
46
|
|
|
41
47
|
From then on, answers come from YOUR code.
|
|
42
48
|
|
|
@@ -44,8 +50,9 @@ From then on, answers come from YOUR code.
|
|
|
44
50
|
|
|
45
51
|
Nothing to do. Niro checks which branch you are on for every question.
|
|
46
52
|
|
|
47
|
-
- On your
|
|
48
|
-
-
|
|
53
|
+
- On your new branch: answers come from your private copy.
|
|
54
|
+
- On a branch one of your projects already indexes: answers come
|
|
55
|
+
from that project.
|
|
49
56
|
|
|
50
57
|
## When your work is merged
|
|
51
58
|
|
|
@@ -65,8 +72,9 @@ of your changes together.
|
|
|
65
72
|
|
|
66
73
|
## Common questions
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
No.
|
|
75
|
+
Does this change my original project?
|
|
76
|
+
No. The original project and its index stay exactly as they were.
|
|
77
|
+
The copy is separate; deleting it later loses nothing.
|
|
70
78
|
|
|
71
79
|
Does this work with my AI assistant and my git host?
|
|
72
80
|
Yes. Any assistant that supports MCP (Claude Code, Cursor, Windsurf,
|
|
@@ -78,8 +86,13 @@ No. Niro copies the existing index instead of re-reading your code.
|
|
|
78
86
|
It normally takes seconds.
|
|
79
87
|
|
|
80
88
|
I just created a branch and have not changed anything. Will Niro nag me?
|
|
81
|
-
No. Your code is still identical to
|
|
82
|
-
normally. It only steps in once your code actually differs.
|
|
89
|
+
No. Your code is still identical to the branch you started from, so Niro
|
|
90
|
+
answers normally. It only steps in once your code actually differs.
|
|
91
|
+
|
|
92
|
+
We already have projects for main and develop. Do I need this?
|
|
93
|
+
Not while you are on main or develop: Niro routes to the matching project
|
|
94
|
+
by itself. You only need a temporary project for a branch that none of
|
|
95
|
+
your projects cover.
|
|
83
96
|
|
|
84
97
|
What if I really want an answer from the shared project while on my branch?
|
|
85
98
|
Tell your assistant so. The answer will be clearly labeled as describing
|
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -171,7 +171,7 @@ async function init(pathArg, opts = {}) {
|
|
|
171
171
|
}
|
|
172
172
|
} else if (otherBranchOnly.length) {
|
|
173
173
|
// Known repo, but you're on a branch Niro hasn't indexed → the honest answer is "sandbox it",
|
|
174
|
-
// not "already indexed". A sandbox indexes your branch
|
|
174
|
+
// not "already indexed". A sandbox indexes your branch in a separate copy (original untouched).
|
|
175
175
|
const where = otherBranchOnly
|
|
176
176
|
.map((p) => `"${p.alias || p.project_id}"${p.indexed_branch ? ` (indexed on ${color.cyan(p.indexed_branch)})` : ""}`)
|
|
177
177
|
.join(", ");
|
|
@@ -179,7 +179,7 @@ async function init(pathArg, opts = {}) {
|
|
|
179
179
|
console.log(`\n${color.green("✓")} This repo is part of: ${where}.`);
|
|
180
180
|
console.log(` But ${yourBranch} isn't indexed by Niro — answers would reflect the indexed branch, not your local work.`);
|
|
181
181
|
console.log(` ${color.cyan("Run `niro sandbox` here")} to index your branch privately ` +
|
|
182
|
-
color.dim("(
|
|
182
|
+
color.dim("(original project unchanged; `niro discard` to undo)."));
|
|
183
183
|
if (!opts.addTo) {
|
|
184
184
|
if (prompt.isNonInteractive()) {
|
|
185
185
|
console.log(color.dim(
|
package/src/commands/takeover.js
CHANGED
|
@@ -72,7 +72,7 @@ async function takeover(pathArg, opts = {}) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
console.log(`\n Creating a temporary private project of ${color.bold(source.alias || source.project_id)}...`);
|
|
75
|
-
console.log(color.dim(" Your
|
|
75
|
+
console.log(color.dim(" Your original project is not changed."));
|
|
76
76
|
|
|
77
77
|
// 2. Create-or-extend server-side (ADR-016). If you already have a temporary project of this project,
|
|
78
78
|
// the backend EXTENDS it — adds this repo to the same copy — instead of minting a second one, so
|
package/src/index.js
CHANGED
|
@@ -157,7 +157,7 @@ function main() {
|
|
|
157
157
|
program
|
|
158
158
|
.command("new-temp-project [path]")
|
|
159
159
|
.aliases(["sandbox", "takeover"])
|
|
160
|
-
.description("Create a temporary private project for this folder that reflects your branch + local edits, so Niro's answers match your work (
|
|
160
|
+
.description("Create a temporary private project for this folder that reflects your branch + local edits, so Niro's answers match your work (your original project is unchanged). Remove it with `niro discard-temp-project`.")
|
|
161
161
|
.option("--project <id_or_alias>", "which project to base the temporary project on when the repo maps to several")
|
|
162
162
|
.action((pathArg, opts) => run(async () => {
|
|
163
163
|
const cmd = require("./commands/takeover");
|
package/src/mcp/setup.js
CHANGED
|
@@ -840,7 +840,7 @@ lost"). When the target of the question is a repo other than the current one:
|
|
|
840
840
|
|
|
841
841
|
Niro indexes a repo at ONE branch (the team's tracked branch). Identity is (git url, branch): a graph
|
|
842
842
|
built on \`main\` does NOT reflect your feature branch or uncommitted edits. A **temporary project** is a private,
|
|
843
|
-
temporary index of your branch (\`niro new-temp-project\` to create, \`niro discard-temp-project\` to remove —
|
|
843
|
+
temporary index of your branch (\`niro new-temp-project\` to create, \`niro discard-temp-project\` to remove — the original project is unchanged).
|
|
844
844
|
|
|
845
845
|
- **Obey \`🔔 Niro ACTION\` notices.** When a tool result appends "the coding assistant should run
|
|
846
846
|
\`niro new-temp-project\` / \`niro discard-temp-project\`", run that command with the Bash tool (cwd = that
|