Skip to content

v1.8.0: Truss as AI context

Latest

Choose a tag to compare

@albertoarena albertoarena released this 10 Aug 12:46
· 2 commits to main since this release

Added

  • Truss as AI context: the export now doubles as grounding context for a coding agent.
    • Annotations: declare business meaning a type cannot express (that status = 1 means paid, that a table is deprecated) under truss.annotations (per-table, per-column, and global notes), or read it from native database comments by keeping 'database' in annotations.source. Annotations render into every text format and are stripped with --no-annotations. Structure only: a comment is part of the CREATE TABLE definition, not row data.
    • --compact: drop column defaults and non-unique indexes to shrink the output without losing any table, column, or foreign key.
    • --focus=<table> / --depth=<n>: reduce the export to a table and its foreign-key neighbourhood.
    • llm format: a dense, token-trimmed plaintext format tuned for feeding a coding agent.
    • truss.export.default_format config for the format used when none is given.
  • A gated GET {prefix}/export/{format} HTTP route that serves the same structural export as the command and facade (behind the viewTruss gate), so the dashboard download and any HTTP client share one pipeline.
  • An optional read-only, structure-only MCP server (Model Context Protocol) that exposes the live schema to a coding agent over local stdio, built on laravel/mcp. It adds the tools list_tables, describe_table, get_schema, focus_table, and get_structural_review, plus a truss://schema resource. Opt in with composer require laravel/mcp and start it with php artisan mcp:start truss; toggle with truss.mcp.enabled. Every tool advertises the MCP readOnlyHint, so a client can present them as read-only instead of prompting for write approval on each call. No row data, ever, and it honours the same exclusion and managed-connection safeguards as the rest of Truss.
  • A fluent, immutable Truss facade for building exports programmatically, for example Truss::snapshot()->focus('orders', depth: 1)->compact()->toDbml(), with only(), except(), focus(), compact(), withoutAnnotations(), fresh(), and connection() filters and a terminal per format.

Changed

  • The dashboard now generates structural downloads (DBML, Markdown, JSON, CSV) server-side through the gated export route instead of duplicating the generators in JavaScript, so the CLI, the facade, and the dashboard produce identical output from one PHP source of truth. PNG and SVG are unchanged (still rendered in the browser).
  • CI now runs the test suite against MySQL and Postgres service containers in addition to SQLite, so native-comment and engine-specific behaviour is exercised.