feat: add push, pull, and fetch commands#164
Merged
angeloashmore merged 13 commits intomainfrom Apr 30, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Splits the previous sync command into two commands: pull (mirror remote to local) and fetch (refresh snapshot only). Push now auto-establishes a snapshot on first run and uses snapshot-based drift detection in both directions, removing the destructive-change confirmation in favor of clearer per-direction guidance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Restores src/commands/sync.ts, test/sync.test.ts, and src/lib/segment.ts to their state on main. Re-registers sync in src/index.ts. Brings the writeLocalCustomType test helper from the modeling refactor branch since push/pull/fetch tests need it.
Previously, when no snapshot existed, pull treated remote as the baseline, which flagged drift in either direction. This incorrectly refused pulls when remote had new changes that the user was trying to fetch. Now, without a snapshot, only flag drift if local has changes not present on remote. Also extract drift comparisons into named variables in push for readability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment out push, pull, and fetch from the command router to keep them unlisted while preserving the implementations. Init points back to sync until the new workflow is surfaced. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove the syncModels/syncSlices/syncCustomTypes adapter methods now that pull handles one-time syncing. The sync command is watch-only (requires --watch) and inlines the loop logic; init inlines the same merge logic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0265df2. Configure here.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 30, 2026
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.

Resolves:
Description
Adds three new commands for a local-first modeling workflow:
prismic push— push local types and slices to the remote.prismic pull— pull remote types and slices to local files.prismic fetch— refresh the local snapshot of the remote (no file writes).A snapshot of the remote is persisted under the user's config dir so push and pull can detect drift and require
--forcefor destructive changes.syncis simplified to only support--watchfor compatibility. In a future PR,syncwill be deprecated and/or removed. The Type Builder instructions and docs will be updated forpush/pullbefore that change.Pairs with #163 (modeling commands operate on local files only). Either can land first.
Checklist
Preview
How to QA 1
Need help on this PR? Tag
@codesmithwith what you need.Note
Medium Risk
Adds new commands that can create/update/delete local or remote models and introduces snapshot-based drift detection; incorrect diffing or snapshot handling could lead to unintended overwrites or deletions despite
--forcesafeguards.Overview
Introduces a local-first modeling workflow with three new CLI commands:
prismic pull(remote → local),prismic push(local → remote), andprismic fetch(refresh remote snapshot only), all using a persisted snapshot to detect drift and require--forcebefore overwriting changes.Moves one-time sync logic out of the adapter by deleting
Adapter.syncModels/syncSlices/syncCustomTypes, adds a shareddiffArrayshelper for insert/update/delete planning, and updatesinitto perform an initial pull + type generation and then write the snapshot.syncis simplified to watch-only polling that applies remote diffs to local files, writes snapshots on change, and has adjusted error handling/limits.Adds snapshot persistence under the user config directory keyed by project+repo, exports
CONFIG_DIRfor reuse, wires new commands into the CLI router, and expands E2E tests to cover fetch/pull/push behavior and drift/--forcesafeguards.Reviewed by Cursor Bugbot for commit 369a68e. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩