travsr init
Install Git hooks and build the initial graph of the current repository.
Synopsis
travsr init [--force] [--jobs <N>] [--quiet] [--json]
[--no-connect] [--guard[=<MODE>]]
Flags
| Flag | Default | Description |
|---|---|---|
--jobs <N> | CPU cores | Number of parallel parse workers |
--quiet, -q | false | Suppress progress output and post-index tips |
--json | false | Emit machine-readable JSON (summary on stdout, progress on stderr) |
--force, --rebuild | false | Force a full rebuild, bypassing the incremental "already up to date" skip. Re-parses every file even when nothing changed on disk |
--no-connect | false | Skip auto-detecting AI coding tools and wiring them to Travsr. See travsr connect |
--guard[=<MODE>] | not installed | Install the Claude Code PreToolUse guard. MODE is off, advisory or strict; a bare --guard means advisory. The = is required (--guard=strict). Conflicts with --no-connect. See travsr guard |
What it does
travsr init is the one command that gets a repository ready. It does not stop at the structural index.
- Creates
.travsr/in the repository root and registers the repository. - Installs hooks for
post-commit,post-merge, andpost-checkout. - Detects the repository's languages and installs the language tools they need. This is gated on readiness, so a re-run with everything in place makes no network call. If the machine is offline,
initsays so and finishes the setup the next time you run it. - Builds the structural index and writes the graph to
.travsr/graph.db. - Traces calls (semantic Phase B) before returning, so call edges are queryable as soon as the command ends.
- Detects installed coding tools, configures project MCP settings where supported, and prints any remaining setup, unless you pass
--no-connect. Agent rules are opt-in throughtravsr connect --rules. - Starts the daemon in the background, which watches saves, runs the git hooks' reindex and traces calls for later commits. A terminal is not required, because agents and editors run
initwithout one. The one opt-out is theCIenvironment variable: when it is set,initleaves nothing running.
If you interrupt init (Ctrl-C, or a timeout from an editor or agent) after indexing is done, the daemon is started to finish tracing calls, and travsr status shows the progress.
The summary at the end lists each language with one concrete next step when it is not ready. The states are the same ones travsr status and travsr lang list report: ready, needs_toolchain (install the named toolchain, then rerun travsr init), unsupported_os, setting_up and failed. With --json, the summary on stdout also carries each language's state, the search-ranking state and whether the index is being kept fresh in the background.
Check progress
cd my-project
travsr init
travsr status
If the daemon is not running (for example in CI, or after a reboot), start it with travsr daemon start from the repository.
Notes
- Running
travsr initagain is safe: it re-installs the hook and re-indexes the repository over the existing.travsr/directory. After upgrading thetravsrbinary it also restarts a daemon that is still running the old version. --semanticis still accepted so existing scripts and the VS Code extension keep working, but it does nothing:initalways traces calls before returning.--allow-unsandboxed-lsif(alias--allow-unsandboxed) is also still accepted, hidden from--help. It letsrust-analyzerrun without OS sandboxing on a host that has none, is remembered in~/.travsr/lang.tomlso later runs and background updates keep Rust's full analysis, and should be set only for repositories you fully trust.- The git hook is a thin shell wrapper; it calls
travsr hook-run --from-hook --event <hook>and exits immediately. It does not block the commit. - Add
.travsr/graph.dbto.gitignoreif you don't want to commit the graph to the repository.