Repository navigation
feat: block-plugin-scaffold - reusable engine, preview and approval (BPS-12 phase 2) - #67
Merged
Merged
Conversation
Phase 2 of BPS-12 (T2 and T3). Engine boundary (scripts/generate-plugin.js): - generatePlugin(config, options) takes outputDir, outputBaseDir, force, now, logFile and output; the boolean form still means template mode. - It no longer reads process.argv, never exits the process, writes diagnostics to standard error, and keeps one log run per call, written when the call ends, so repeated calls never share log state. - Importing the module creates nothing and registers no process handlers; the CLI sets console output, exit and Ctrl+C handling, reads --output-dir, --force and --in-place, and prints the next steps. - The .pot creation date and log timestamps come from the injected clock. - generate-plugin.agent.js passes --force through explicitly. Preview and approval (scripts/mcp/): - preview.js resolves and checks the destination, generates into a private staging folder, classifies every staged path as create, overwrite, unchanged or conflict (Git paths, links in the path, type clashes), summarises preserved files, and binds a SHA-256 approval hash to the configuration, destination and staged files. Approvals are refused when they do not match, the preview expired or was replaced, or the destination changed since. - config.js validates with the generator's own rules and reports each value's source; errors.js holds the contract's error codes. Verified by generating plugins only: CLI output matches the previous generator apart from the .pot date, two library runs with a fixed clock are identical, standard output stays empty, and check:generation passes for both fixtures. 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 was referenced Nov 6, 2026
krugazul
marked this pull request as ready for review
November 6, 2026 09:36
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 2 of 4 for BPS-12, stacked on #66 (
feat/bps-12-contract). Review #66 first; this PR's diff is only phase 2.Linked issues
Part of #65
What this changes
Reusable generator engine (T2),
scripts/generate-plugin.jsgeneratePlugin(config, options)takesoutputDir(the exact folder),outputBaseDir,force,now,logFileandoutput.generatePlugin(config, true)still means template mode.process.argvand never exits the process.logs/or registers exit and Ctrl+C handlers.--output-dir,--force,--in-place, exit handling and the "next steps" text..potcreation date and log timestamps come from the injected clock, so output can be compared exactly.generate-plugin.agent.jspasses--forcethrough, because the generator no longer reads it from the command line.Preview and approval (T3),
scripts/mcp/preview.js:create,overwrite,unchangedorconflict. Git paths, symbolic links in the path and type clashes are conflicts;An approval is refused when it doesn't match, the preview expired (30 minutes) or was replaced, or the destination changed since the preview.
config.jsvalidates with the generator's own rules and reports whether each value was supplied, derived or defaulted.errors.jsholds the contract's error codes.The contract's destination rules and status are updated to match.
Verification
Following the agreed approach, everything was checked by generating plugins. The scaffold's own test suite was not run.
.potcreation date.check:generationpasses for both fixtures (default,functional-only): npm ci, build, all lints, unit tests, composer validate/install/lint/PHPStan/PHPUnit..gitdetection, with the destination untouched by preview;approved: falseor"yes", an unknown preview, a replaced preview and an expired preview;~/Studio/.../wp-content/plugins/tsp.ESLint ignores
scripts/in this repository, so the new files are checked by Prettier only.generate-plugin.jswas not Prettier-formatted before this change either; I left its formatting alone so the diff stays readable.Changelog
Added
scripts/mcp/).Changed
generatePlugin()can be called repeatedly from one process. It takes options, reads nothing fromprocess.argv, writes diagnostics to standard error and keeps a separate log per call. The CLI's output and generated files are unchanged.Checklist (Global DoD / PR)
.., no system or home folders, no links); approval bound by hash🤖 Generated with Claude Code