feat(scaffolds): add utility/* package scaffolds for framework Utils - #50
feat(scaffolds): add utility/* package scaffolds for framework Utils#50Adi-ty wants to merge 2 commits into
Conversation
Ship utility/{cache,transients,logger,timer,feature-selector} as
source: "package" — zero files written, rtcamp/wp-framework: ^1.0 reported
under developer.install.composer, and one accessor snippet for
<base_path>/Helpers/Util.php under anchor // scaffold:utility/<slug>.
context_slug is discovered from composer.json:name and snake-cased.
Wiring targets the consumer's static helper rather than a module or
Main::CLASSES: these utilities implement neither Registrable nor Shareable,
and the framework Loader instantiates with no constructor argument, so
Transients would fatal and Cache would lose its namespace.
Refs rtCamp/wp-devtools#26
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds utility/* package scaffolds that wire rtcamp/wp-framework Utils\* classes via a single accessor snippet (no file generation), and documents/tests the new behavior.
Changes:
- Added five
source: "package"utility scaffolds (cache,transients,logger,timer,feature-selector) that report a Composer dep plus oneHelpers/Util.phpwiring snippet. - Expanded Jest coverage to assert package-scaffold behavior (zero writes, dep reporting, wiring render, input discovery/overrides).
- Updated skills + docs to describe package scaffolds and the
Helpers/Util.phpanchor convention.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js | Adds assertions covering the new utility/* package scaffolds and input discovery behavior. |
| node-packages/wp-tooling/skills/setup/SKILL.md | Updates feature→scaffold mapping and adds guidance for applying utility/* wiring safely. |
| node-packages/wp-tooling/skills/scaffold/SKILL.md | Documents the utility/* anchor convention and cautions against wiring Utils\* via modules/Main::CLASSES. |
| node-packages/wp-tooling/scaffolds/utility/cache/scaffold.json | New package scaffold manifest for framework Cache accessor wiring. |
| node-packages/wp-tooling/scaffolds/utility/transients/scaffold.json | New package scaffold manifest for framework Transients accessor wiring. |
| node-packages/wp-tooling/scaffolds/utility/logger/scaffold.json | New package scaffold manifest for framework Logger accessor wiring. |
| node-packages/wp-tooling/scaffolds/utility/timer/scaffold.json | New package scaffold manifest for framework Timer accessor wiring (no ctor args). |
| node-packages/wp-tooling/scaffolds/utility/feature-selector/scaffold.json | New package scaffold manifest for framework FeatureSelector accessor wiring. |
| node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/setup-SKILL.md | Mirrors skills/setup/SKILL.md changes in the template. |
| node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/scaffold-SKILL.md | Mirrors skills/scaffold/SKILL.md changes in the template. |
| node-packages/wp-tooling/docs/wp-framework-contract.md | Documents Utils\* classes and why utility/* wires via Helpers/Util.php. |
| node-packages/wp-tooling/docs/authoring-scaffolds.md | Documents source: "package" behavior and constraints. |
| node-packages/wp-tooling/docs/ai-orchestration.md | Clarifies scaffold.kind: "package" semantics with utility/* as examples. |
| node-packages/wp-tooling/CHANGELOG.md | Adds an Unreleased entry for the new utility/* package scaffolds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Suppressed comments (2)
node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js:145
- The PR description says the suite asserts there are “no leftover {{” after rendering, but the parameterized utility test currently checks that only for
w.description, not forw.snippet. Add an assertion likeexpect(w.snippet).not.toContain('{{');(and/or check for'}}') to ensure rendered snippets never leak unresolved placeholders.
expect(w.snippet).toContain(
`\\rtCamp\\WPFramework\\Utils\\${className}`
);
// The engine passes `description` through verbatim, so it must not
// carry a placeholder that would reach the caller unresolved.
expect(w.description).not.toContain('{{');
}
node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js:113
- These tests create multiple temporary directories via
makeTmpDir()and never remove them, which can accumulate over repeated local runs/CI retries. Consider tracking created temp dirs and cleaning them inafterEach/afterAll, or wrapping each usage in a try/finally that removes the directory (recursive) once the test completes.
function targetWithComposerName(name = 'rtcamp/project-name-features') {
const target = makeTmpDir();
fs.writeFileSync(
path.join(target, 'composer.json'),
JSON.stringify({ name }),
'utf8'
);
return target;
}
What this PR does
Ships the five
source: "package"utility scaffolds —utility/cache,utility/transients,utility/logger,utility/timer,utility/feature-selector— that wire the existingrtcamp/wp-frameworkUtils\*classes with a Composer dependency and one boot snippet, writing zero files.Closes
Closes rtCamp/wp-devtools#26
Changes
scaffolds/utility/<slug>/scaffold.json:source: "package",files: [],module_classset to the framework FQCN,composer_dependencies: {"rtcamp/wp-framework": "^1.0"}, and onewiring[]entry (anchor// scaffold:utility/<slug>,target_file: {{base_path}}/Helpers/Util.php, a static memoised accessor assnippet_template).context_sluginput:discover_from: composer.json:name,transform: snake-case,default: my_plugin(e.g.rtcamp/acme-blog→rtcamp_acme_blog). base_path input defaults to includes.tests/scaffolds/bundled-manifests.test.js: it.each over all five ids asserting kind, zero writes/skips/tests/secrets, the composer dependency, and the rendered wiring (anchor, targetFile, snippet contents, no leftover {{); plus discovery, supplied-wins-over-discovered, no-composer.json-fallback, base_path override, and Timer-no-arg cases.docs/wp-framework-contract.mdgains a## Utility classestable (constructor + key methods per class) and extends the anchor-convention section;docs/authoring-scaffolds.mdgains a## Package scaffoldssection;skills/setup/SKILL.mdandskills/scaffold/SKILL.md(+ their byte-identical template mirrors) updated to route feature requests to the five scaffolds and flag theHelpers/Util.phpanchor convention.How I verified
Acceptance criteria
Runtime behavior
Code quality
Housekeeping
CHANGELOG.mdentry under## UnreleasedReviewer notes