schemorph 0.2.0
Schemorph 0.2.0 — the agent-native release: everything an AI coding agent (or a script) needs to drive a schema change end-to-end, safely, without parsing human-oriented output.
Agent-native surface
- Versioned machine-readable plan format (docs/plan-format.md) —
changes[]with per-change action lists (1.0), a stableplanHashfingerprint (1.1), andexplanationon every change +sqlwhere it is certain (1.2): redefines carry their exact idempotent script verbatim; declarative changes carry the slice of the update script attributed from DacFx's own per-object markers (conservative — unattributable isnull, never a wrong attachment). Table rebuilds are called out with a cost note. - Gated apply —
apply --expect-plan <hash>(CLI) /expectedPlanHash(MCP): the plan computed in the same comparison session that would execute is checked against the reviewed fingerprint first; a mismatch aborts withplan_mismatchand nothing applied. Review-then-apply can no longer race a drifting database. - MCP server (
schemorph mcp, stdio) — read-only tools (schemorph_diff,schemorph_inspect,schemorph_status) plus fingerprint-gatedschemorph_apply; the connection string stays in the server environment, never in the conversation. Schema-as-context resources:schemorph://schema(live database as desired-state SQL),schemorph://schema/{kind}/{name},schemorph://plan(current plan incl.planHash). - Agent-first CLI conventions — JSON by default on non-TTY stdout; a self-describing
schemasubcommand (verbs, flags, output formats, exit codes as a JSON manifest); unified help semantics (requested help → stdout + exit 0). - Agent Skill packaging —
skills/schemorph/SKILL.md: the safe change loop, machine-contract branching, migration immutability, MCP mode, brownfield adoption. - CI recipe — post the plan as a PR comment: base-branch schema rebuilt in a service container, PR diffed against it, marker-based comment upsert, optional lint-code policy gate.
New verbs & safety
status— drift (the plan a diff would produce now), history-ledger summary, pending migrations; exit 2 when work is pending.- Safety-lint band
SCHEMORPH1xx(docs/errors.md) — plan rules (NOT NULL addition without default / table-rebuild cost / destructive change included) and migration static checks on pending files (TRUNCATE, unfiltered UPDATE/DELETE, GRANT/REVOKE/DENY). AST-proven findings only; warnings never change the exit code.
Brownfield adoption
- Existing databases and SSDT trees are consumed as-is: non-model files (SQLCMD deploy scripts, seed DML) are classified out with per-file warnings instead of poisoning the model; history-less programmable objects whose live definitions already match their files reconcile (recorded, nothing executed) instead of phantom-redefining.
GOinside strings/comments no longer splits batches (parser-based splitting, original text preserved).
Consistency & internals
- Desired state is loaded and parsed once per operation, and everything — checksums, brownfield live-matching, lint, execution — judges that one snapshot: the checksum the ledger records always covers exactly the script that ran.
- Unified error contract: desired-state load errors fail every verb the same way (
invalid_desired_stateondiff/status/applyalike).
Install
dotnet tool install -g Schemorph # or update: dotnet tool update -g Schemorph
Self-contained binaries for win-x64 / linux-x64 / osx-arm64 are attached below.
Full Changelog: v0.1.0...v0.2.0