Skip to main content
CLI Reference

travsr init

Install the git hook and run the first full index of the current repository.

Synopsis

travsr init [--semantic] [--force] [--jobs <N>] [--quiet] [--json]
[--no-connect] [--allow-unsandboxed-lsif]

Flags

FlagDefaultDescription
--semanticfalseRun semantic Phase B (call edges) synchronously before returning. By default Phase B runs in the background via the daemon. Use in CI or scripts that query call edges immediately after init.
--jobs <N>CPU coresNumber of parallel parse workers
--quiet, -qfalseSuppress progress output and post-index tips
--jsonfalseEmit machine-readable JSON (summary on stdout, progress on stderr)
--force, --rebuildfalseForce a full rebuild, bypassing the incremental "already up to date" skip. Re-parses every file even when nothing changed on disk. Use it after changing a flag that affects semantic output, which per-file change detection does not pick up on its own
--no-connectfalseSkip auto-detecting AI coding tools and wiring them to Travsr. See travsr connect
--allow-unsandboxed-lsiffalseLet rust-analyzer run without OS sandboxing (bubblewrap on Linux, sandbox-exec on macOS) on hosts that have none. Without it, Rust falls back to structural analysis only on such hosts. Set it only for repositories you fully trust, since Phase B executes the repo's own build configuration

What it does

  1. Creates .travsr/ in the repository root
  2. Installs .git/hooks/post-commit (or appends to an existing hook)
  3. Runs a full Tree-sitter + LSIF index of all files
  4. Writes the graph to .travsr/graph.db
  5. Detects the AI coding tools installed on this machine and wires each one to the repository's MCP server, unless you pass --no-connect. This is the same work travsr connect does on its own

Example

$ cd my-project
$ travsr init

✓ Git hook installed (.git/hooks/post-commit)
✓ Detecting languages... TypeScript, Rust
✓ Indexing 1 247 files...
├─ Tree-sitter pass: 1.2 s
└─ LSIF (tsc): 8.4 s
✓ Built graph: 18 432 nodes, 94 751 edges
✓ Saved to .travsr/graph.db (4.2 MB)

Run `travsr daemon start` to keep the graph fresh.

Notes

  • Running travsr init again is safe: it re-installs the hook and re-indexes the repository over the existing .travsr/ directory.
  • The git hook is a thin shell wrapper; it calls travsr hook-run --from-hook and exits immediately. It does not block the commit.
  • Add .travsr/graph.db to .gitignore if you don't want to commit the graph to the repository.