Skip to main content
← CLI Reference

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​

FlagDefaultDescription
--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
--no-connectfalseSkip auto-detecting AI coding tools and wiring them to Travsr. See travsr connect
--guard[=<MODE>]not installedInstall 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.

  1. Creates .travsr/ in the repository root and registers the repository.
  2. Installs hooks for post-commit, post-merge, and post-checkout.
  3. 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, init says so and finishes the setup the next time you run it.
  4. Builds the structural index and writes the graph to .travsr/graph.db.
  5. Traces calls (semantic Phase B) before returning, so call edges are queryable as soon as the command ends.
  6. 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 through travsr connect --rules.
  7. 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 init without one. The one opt-out is the CI environment variable: when it is set, init leaves 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 init again is safe: it re-installs the hook and re-indexes the repository over the existing .travsr/ directory. After upgrading the travsr binary it also restarts a daemon that is still running the old version.
  • --semantic is still accepted so existing scripts and the VS Code extension keep working, but it does nothing: init always traces calls before returning. --allow-unsandboxed-lsif (alias --allow-unsandboxed) is also still accepted, hidden from --help. It lets rust-analyzer run without OS sandboxing on a host that has none, is remembered in ~/.travsr/lang.toml so 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.db to .gitignore if you don't want to commit the graph to the repository.