Repository navigation
feat: block-plugin-scaffold - preservation-safe merge (BPS-12 phase 3) - #68
Merged
Merged
Conversation
Phase 3 of BPS-12 (T4). scripts/mcp/merge.js applies an approved, current preview: - writes only planned create and overwrite paths, folders first; - never deletes, never writes Git paths or unrelated files, and creates only the destination folder itself when it is new; - re-checks each path, and every folder above it, just before writing, so edits or links that appear after approval stop the write; - writes each file to a temporary name beside it and renames it into place, keeping the generated file's permissions; - backs up every file before overwriting it, and records each step in a JSON Lines journal next to the preview's log; - on failure returns PARTIAL_WRITE with where it stopped, what was and was not written, the backup folder and the journal; previewing and generating again completes the rest. The contract documents backups, the journal, recovery and file modes. Verified by generating plugins only: 34 scripted checks (exact match with the generator for a new folder, no-op regeneration, a real Git repository with nested .git and unrelated files, links, a read-only folder, a simulated crash, a file edited mid-write), and the merged plugin's own npm ci, build, lint:js, test:unit and composer test pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Feature Pull Request
Phase 3 of 4 for BPS-12. It stacks on #67, which stacks on #66; this PR's diff is only phase 3.
Linked issues
Part of #65
What this adds
scripts/mcp/merge.jswrites an approved, current preview into its destination, following the contract's merge rules:logs/mcp-<slug>-<timestamp>-backup/.logs/mcp-<slug>-<timestamp>.journal.jsonl.PARTIAL_WRITE, listing where writing stopped, what was and wasn't written, the backup folder and the journal. Previewing and generating again finishes the rest.docs/MCP-PLUGIN-GENERATION.mdnow documents backups, the journal, recovery and file modes.Verification
All checks were done by generating plugins; the scaffold's own test suite was not run. 34 scripted checks pass:
unchanged, nothing is written, and file modification times stay the same..git, a nestedsub/.git,.gitmodulesand unrelated files keep the same content, mode and modification time. Overwritten files are backed up with their old content.git statusshows no deletions and no temporary files are left behind.CONFLICT. Nothing is written in the destination or through the link.PARTIAL_WRITE(405 written, 159 not), with backups and a journal. After fixing the permission, previewing and generating again completes the plugin exactly.STALE_PREVIEW.The merged plugin's own
npm ci,build,lint:js,test:unitandcomposer testalso pass.Changelog
Added
scripts/mcp/merge.js).Checklist (Global DoD / PR)
🤖 Generated with Claude Code