Commands
truss:show
Print the database structure as a table in the terminal: one row per table, with its column count and foreign-key count. It is the text counterpart to the visual dashboard, reading the same cached, exclusion-filtered snapshot, and like everything in Truss it shows structure only, never row data.
# Show the default connectionphp artisan truss:show
# Show a specific connectionphp artisan truss:show --connection=mysqltruss:open
Open the Truss dashboard in your default browser. The URL honours your configured route_prefix and app URL. On a headless host the URL is printed regardless, so you can open it by hand or forward the port.
php artisan truss:opentruss:rebuild
Rebuild the cached schema snapshot. Useful in CI, in seeding workflows, or whenever you want to force a refresh.
# Rebuild every managed connectionphp artisan truss:rebuild
# Rebuild a specific connectionphp artisan truss:rebuild --connection=mysqlThe command always runs, regardless of truss.enabled.
It is also the only command that fails when the cache store cannot be written: storing the snapshot is its whole job, so from v1.8.4 an unusable store means the store’s own error message and a non-zero exit. Everywhere else an unreachable cache store degrades quietly to a live read, so this is the command to reach for when you want the cause confirmed.
truss:diff
Show what changed in the database structure since the last migration: the terminal counterpart to the dashboard “Changes” panel. It compares the recorded baseline against the current snapshot and lists added, removed, and changed tables, columns, indexes, and foreign keys. Structure only, so it is safe in CI and commit hooks.
# Diff the default connectionphp artisan truss:diff
# Diff a specific connectionphp artisan truss:diff --connection=mysqlWhen no baseline has been recorded yet, or when diff.enabled is false, the command says so and exits cleanly. See the Schema diff guide for a worked example and how the baseline is captured.
truss:export
Export the database structure to a standard format (DBML, JSON, CSV, a Markdown data dictionary, Mermaid, or a token-tuned llm format) for CI, tooling, and version control. It writes to stdout by default so it pipes cleanly, or to a file with --output. Deterministic and structure only, so it is safe in CI and commit hooks.
# DBML to stdoutphp artisan truss:export
# A format to a filephp artisan truss:export --format=json --output=docs/schema.json
# Fail the build if the committed file is out of datephp artisan truss:export --format=dbml --output=docs/schema.dbml --checkOptions: --format (dbml / json / csv / markdown / mermaid / llm), --connection, --tables and --exclude (config excluded_tables always wins), --output (a file path; stdout otherwise), --check (exit non-zero if --output would change, writing nothing), and --fresh (rebuild the snapshot first). For AI-context output, add --compact (drop defaults and non-unique indexes), --focus=<table> with --depth=<n> (a table and its foreign-key neighbourhood), and --no-annotations (strip configured annotations). Exit codes are 0 (written or up to date), 1 (--check found drift), and 2 (a usage or runtime error). See the Schema export guide for the formats and the CI drift-check recipe, and Truss as AI context for the annotation, compact, and focus flags.
truss:doctor
Review the database structure for problems visible from structure alone (missing primary keys, unindexed foreign keys, duplicate indexes, risky types, and more) and fail the build when one is found. Deterministic and structure only, so it is safe in CI and commit hooks. Aliased truss:check.
# Review the default connectionphp artisan truss:doctor
# JSON output for a specific connectionphp artisan truss:doctor --connection=mysql --format=json
# Stricter run that also fails on warningsphp artisan truss:doctor --preset=strict --fail-on=warningOptions: --connection, --table, --only / --skip (by category), --preset (recommended / strict / none), --format (console / json), and --fail-on (error / warning / info / never). Exit codes are 0 (clean), 1 (a finding at or above the fail level), and 2 (a bad option or a snapshot error). See the Schema doctor guide for presets, confidence, and the dashboard panel.
mcp:start
Start the optional Truss MCP server so a coding agent can query your live schema. The command comes from the optional laravel/mcp package (composer require laravel/mcp); Truss registers the truss server, so there is nothing to add to routes/ai.php.
php artisan mcp:start trussRead-only and structure only. See the MCP server guide for the tools, the resource, and the client configuration.
Automatic rebuilds
You rarely need to run the command by hand. Truss listens for the Illuminate\Database\Events\MigrationsEnded event and rebuilds the snapshot automatically after migrate, migrate:fresh, and migrate:rollback (when Truss is enabled).
The snapshot is derived, disposable data cached via the Cache facade, keyed per connection, and it respects cache.ttl. No database table is used to store it.
The same event captures the schema-diff baseline: before the cache is refreshed, the previously cached snapshot is saved so a diff can show what the migration changed. This is the only thing Truss writes to disk, and only when diff.enabled is true. See the Schema diff guide.
Publishing
# Publish the config file to config/truss.phpphp artisan vendor:publish --tag=truss-configThere is no separate assets publish step. Truss serves its JavaScript, CSS, fonts, and a vendored copy of Mermaid from a route inside the package, so there is nothing to publish and no CDN to reach.