@niroai/niro 0.3.1 → 0.3.2

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
@@ -12,9 +12,27 @@ One package gives you three things:
12
12
 
13
13
  > **Two ways to do everything:** every task below shows the **terminal** command *and* how you'd **ask the agent**. Pick whichever you prefer — they call the same code.
14
14
 
15
- > **Working on a feature branch?** Niro indexes one branch per repo, but it follows *your* branch
16
- > and uncommitted edits through **temporary projects** — see
17
- > **[docs/working-on-branches.md](https://unpkg.com/@niroai/niro/docs/working-on-branches.md)** for how that works in plain words.
15
+ ## Working on branches
16
+
17
+ Niro indexes your team's code from one branch (usually main). When you work on a feature
18
+ branch, Niro notices and refuses to answer from the old code. Your assistant will offer the fix:
19
+
20
+ ```bash
21
+ niro new-temp-project # run once in the repo folder
22
+ ```
23
+
24
+ This creates your own private copy of the project that follows your branch and your
25
+ uncommitted edits, live (keep `niro watch` running). Teammates are not affected and cannot
26
+ see your copy. Switching branches needs nothing: Niro answers from your copy on the feature
27
+ branch and from the shared project on main. When your branch is merged:
28
+
29
+ ```bash
30
+ niro discard-temp-project
31
+ ```
32
+
33
+ If you forget, idle copies are cleaned up automatically after two weeks. Full guide:
34
+ [docs/working-on-branches.md](https://unpkg.com/@niroai/niro/docs/working-on-branches.md)
35
+ (plain-text file, ships inside the package too).
18
36
 
19
37
  ---
20
38
 
@@ -1,135 +1,86 @@
1
- # Working on branches how Niro keeps up with you
1
+ # Working on branches with Niro
2
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.
3
+ Niro indexes your team's code from one branch, usually main.
4
+ When you work on your own branch, your code is different from what Niro indexed.
5
+ This page explains what happens then. Two minutes to read.
6
6
 
7
- This page explains, in plain words, what Niro does about that.
7
+ ## The short version
8
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.
9
+ There is one command to remember:
13
10
 
14
- ---
11
+ niro new-temp-project
15
12
 
16
- ## The one-sentence version
13
+ Run it in your repo folder when Niro asks for it. That is all.
17
14
 
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.
15
+ ## What you will see
21
16
 
22
- ---
17
+ You create a branch and start changing code.
18
+ Then you ask your AI assistant something about the code.
23
19
 
24
- ## What happens on each branch state
20
+ Niro notices your branch is not the one it indexed. Instead of giving you
21
+ a wrong answer based on the old code, it replies with something like:
25
22
 
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:
23
+ I cannot answer this safely. Your branch has diverged
24
+ from the branch Niro indexed.
28
25
 
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). |
26
+ Your assistant will offer to fix this by running:
35
27
 
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.
28
+ niro new-temp-project
39
29
 
40
- ## What a refusal looks like
30
+ Say yes, or run it yourself in the repo folder. It takes a few seconds.
41
31
 
42
- When Niro refuses, your assistant receives a structured message with three options:
32
+ ## What the command does
43
33
 
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.
34
+ It creates your own private copy of the project inside Niro.
49
35
 
50
- Most assistants will simply ask you which way to go, or run the recommended command themselves if
51
- you've allowed that.
36
+ - The copy follows your branch, including changes you have not committed.
37
+ - Every save updates the copy, as long as "niro watch" is running.
38
+ - Teammates are not affected. They keep using the shared project.
39
+ - Nobody can see your copy. Not even teammates on your account.
52
40
 
53
- ## Temporary projects in 60 seconds
41
+ From then on, answers come from YOUR code.
54
42
 
55
- A **temporary project** is your private copy of the team's Niro project:
43
+ ## Switching branches
56
44
 
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.
45
+ Nothing to do. Niro checks which branch you are on for every question.
67
46
 
68
- ### Working across several repositories
47
+ - On your feature branch: answers come from your private copy.
48
+ - Back on main: answers come from the shared project.
69
49
 
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.
50
+ ## When your work is merged
75
51
 
76
- Repos you *haven't* branched come along as read-only snapshots, so the full picture stays intact.
52
+ Run this in the repo folder:
77
53
 
78
- ### When you're done
54
+ niro discard-temp-project
79
55
 
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.
56
+ It deletes your private copy. Your local files are never touched.
57
+ If you forget, Niro deletes unused copies by itself after two weeks.
83
58
 
84
- Two safety nets:
59
+ ## A feature that spans several repos
85
60
 
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.
61
+ Run "niro new-temp-project" in each repo folder you branch.
62
+ All of them join the same private copy, so questions that cross repos
63
+ (for example: what breaks in service B if I change service A?) see all
64
+ of your changes together.
91
65
 
92
- ## The `.niro-project` file
66
+ ## Common questions
93
67
 
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.
68
+ Can teammates see my unfinished code?
69
+ No. Your copy is private to you.
97
70
 
98
- Two things worth knowing:
71
+ Does this work with my AI assistant and my git host?
72
+ Yes. Any assistant that supports MCP (Claude Code, Cursor, Windsurf,
73
+ Codex, and others) and any git server (GitHub, GitLab, Bitbucket,
74
+ self-hosted).
99
75
 
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.
76
+ Is creating a copy slow?
77
+ No. Niro copies the existing index instead of re-reading your code.
78
+ It normally takes seconds.
105
79
 
106
- ## Quick reference
80
+ I just created a branch and have not changed anything. Will Niro nag me?
81
+ No. Your code is still identical to what Niro indexed, so Niro answers
82
+ normally. It only steps in once your code actually differs.
107
83
 
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.
84
+ What if I really want an answer from the shared project while on my branch?
85
+ Tell your assistant so. The answer will be clearly labeled as describing
86
+ the indexed branch, not your code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@niroai/niro",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
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",