Repository navigation
feat(mcp): diff and sync, as the CLI calls them - #157
Merged
Merged
Conversation
scan_drift and apply_fixes become diff and sync. A single tool with a "really write" argument has to be marked destructive, so a client asked before every plan, or read-only while it could write. Two tools let each annotation be true. - diff writes nothing and returns the plan: the statements sync would run, in order, and what it holds back. apply_fixes previewed by default but called its preview "applied". - sync takes the same arguments, so the plan shown is the plan run, and adds prove: a rehearsal on a throwaway copy that refuses to write if the copy would not match the source. The proof is shared with diff --apply --prove, moved out of the command into prove-gate. - list_environments names the environments without their credentials, for clients that show tools but not resources. - create_migration writes what migrate create writes, grants included; it diffed two snapshots of one environment. The file's construction is shared, in migration-file. - Schema and data findings say what differs and what the fix does, in words, where they said "difference detected by @dbdiff/cli". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MCP tools now use the CLI's vocabulary, and each tool's annotations tell the truth about it.
scan_driftdiff: every difference, plus the plansyncwould runapply_fixessync: runs that plan;prove: truerehearses it firstlist_environments: environment names, never credentialscreate_migrationmigrate createwritesWhy two tools rather than one with a flag: clients decide what to run unattended from
readOnlyHintanddestructiveHint, which apply to a whole tool. A tool that both plans and writes has to be marked destructive, so a client asks before every plan. Otherwise it's marked read-only while able to write.diff: writes nothing. Returns the findings, the drift score andplan: the statementssyncwould run, in order, and what it holds back and why.apply_fixespreviewed by default but listed its preview underapplied.sync: takes the same arguments asdiff, so the plan an agent shows is the plan that runs. Fixes that drop tables or columns are still held back unlessallowDestructiveis set.proverehearses on a throwaway copy of the target and refuses to write if the copy wouldn't match the source.diffcommand intoprove-gate, sodiff --apply --proveandsyncdecide the same way. The CLI's output is unchanged.list_environments: for clients that show tools but not resources, which had no way to learn environment names short of reading the config file.create_migration: used to diff two snapshots of one environment. It now writes the source-to-target migrationmigrate createwrites, with the grants on what it creates and a DOWN. Building the file moves intomigration-file, shared by both.Breaking: the tool names change. This is pre-1.0, so there are no aliases; two names for each action would only confuse agents.
Tested:
diffandsyncshare arguments and thatsyncdefaults hold back drops and don't prove.list_environmentsreturns no connection strings.diffreturns a 4-statement plan.syncwithprove: trueconverges and applies all 4; a seconddiffcomes back clean.create_migrationreports nothing left to write.pg_dumptoo old for the server,syncwithproverefuses and writes nothing.🤖 Generated with Claude Code