Builds and updates
Niro keeps the graph in step with your files by rebuilding it in the background. You rarely need to run a build yourself.
The first build
niro start builds the folder you are in. niro init <folder> adds and builds another folder.
The measured time for a full build of a repository of about 9,000 files is about 103 seconds.
Keeping it current
- Who does it.
niro startinstalls a background watcher calledniro-watch. It is run by PM2, a tool that keeps programs running in the background. - When it starts. Where it can, the watcher starts again every time you log in.
- When it rebuilds. About 3 seconds after a folder stops changing. Only one build runs at a time. If files change during a build, one more build is queued.
- Missed changes. Every 5 minutes it also checks for changes it may have missed.
- On start. When the watcher starts, it builds every folder once.
- Folders that go away. A folder deleted from disk stops being watched.
niro status shows whether the watcher is running. If it is not, run niro service install.
A rebuild does only what is needed
A rebuild processes the files that changed, and everything connected to them. The result is the same graph a full build would give. To parse every file again anyway, run:
niro build --full
How Niro notices changes
Niro reads your files to see what changed. It never runs git, and never reads your history. It reads three small git files:
.git/HEAD, to know your branch;.git/index, to know which files git tracks, so that it applies.gitignorethe way git does;.git/config, to tell two copies of one repository apart.
While a build runs
During a full build, the graph is being rewritten. Most tools then say so instead of answering, and suggest searching files for that request. get_index_status, code_grep and get_source_code keep answering. During a smaller rebuild, answers carry a note listing the files being updated.
Files left out
| Left out | Default limit | Change it with |
|---|---|---|
| A source file larger than | 2 MB | NIRO_LOCAL_MAX_FILE_BYTES |
| A file over 256 KB that takes longer to read than | 20 seconds | NIRO_LOCAL_PARSE_TIMEOUT_SECONDS |
Answers name the files left out (the first 5), with a line starting "SKIPPED". Files that git ignores, editor scratch files and links to other places on disk (symlinks) are not read either.
Using several processor cores
A build with 200 or more files to read uses several worker processes: by default one per processor core, up to 8. Change the number with NIRO_LOCAL_PARSE_WORKERS.