From 0f398dae2bb75e54b05f3062feca499dca8dc461 Mon Sep 17 00:00:00 2001 From: Aryan Jasala Date: Fri, 2 Oct 2026 00:22:08 +0530 Subject: [PATCH] fix(scaffolds): install the config packages and wp-phpcs from their registries The config packages are on npm at 1.1.0 and rtcamp/wp-phpcs is on Packagist, so the scaffolds and the setup skill ask for @rtcamp/*-config ^1.1.0 instead of the npm/* git branches, and lint/phpcs/core and lint/phpcs/full no longer add a repositories entry for rtCamp/wp-phpcs. The 2.0.0 CHANGELOG entries that described the old behaviour are corrected, since 2.0.0 is not published yet. --- node-packages/wp-tooling/CHANGELOG.md | 4 +-- node-packages/wp-tooling/docs/examples.md | 2 +- .../scaffolds/lint/eslint/scaffold.json | 2 +- .../scaffolds/lint/phpcs/core/scaffold.json | 6 ----- .../scaffolds/lint/phpcs/full/scaffold.json | 6 ----- .../scaffolds/lint/stylelint/scaffold.json | 2 +- .../claude-skills/templates/setup-SKILL.md | 9 ++----- .../scaffolds/setup/tailwind/scaffold.json | 2 +- .../wp-tooling/skills/setup/SKILL.md | 9 ++----- .../tests/scaffolds/bundled-manifests.test.js | 26 +++++++------------ 10 files changed, 20 insertions(+), 48 deletions(-) diff --git a/node-packages/wp-tooling/CHANGELOG.md b/node-packages/wp-tooling/CHANGELOG.md index 6e074fc..2486894 100644 --- a/node-packages/wp-tooling/CHANGELOG.md +++ b/node-packages/wp-tooling/CHANGELOG.md @@ -28,7 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - fill `testVersion` from the `Requires PHP` header (PHPCompatibility aborts on the first line of every file without it), `minimum_wp_version` from `Requires at least`, the text domain from `Text Domain`, and the prefixes from the text domain and the PSR-4 namespace; - accept PSR-4 class file names, and exempt block `render.php` files from the global-variable prefix and text-domain-mismatch checks, since core includes them inside a function and they translate with `block.json`'s text domain; - lint `tests/`, exempting it from the prefix, VIP file-operation and remote-data, `ini_set` and global-override rules by sniff name. An exclude-pattern on a re-referenced standard such as `WordPress-Docs` has no effect, because its sniffs are already loaded; - - declare `rtcamp/wp-phpcs` as the only dev dependency, with two `composer.json` wiring entries without which `composer require` fails: the `rtCamp/wp-phpcs` VCS repository, so the install works whether or not Packagist serves the package, and `allow-plugins` for the Composer installer that registers the standards. + - declare `rtcamp/wp-phpcs` as the only dev dependency, with one `composer.json` wiring entry without which `composer require` fails: `allow-plugins` for the Composer installer that registers the standards. The package itself resolves from Packagist. Every PHP file the bundled `wp/*`, `wp-api/*` and `setup/phpunit` scaffolds render (classes, tests and the PHPUnit bootstrap), and the five `utility/*` accessor snippets, passes both. - `automattic/vipwpcs` as `lint/phpcs/vip`'s dev dependency, with `allow-plugins` wiring for `dealerdirect/phpcodesniffer-composer-installer`, which WPCS and VIPCS depend on: without it a non-interactive `composer require` exits 1 and no standard is registered. The `setup` skill's install command and `docs/examples.md` use the same package. @@ -49,7 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - PHPCS scaffolds exclude intentionally broken AI evaluation fixtures. The standalone server profiler uses short arrays and documents the specific PHPCS exceptions required by WP-CLI evaluation, privileged CLI query data and STDERR diagnostics. - Feature hooks: `readEnv`/`setEnv` and `readDefine`/`setDefine` treat the key or define name as a literal. They were interpolated into a regular expression, so a name containing `.` or another metacharacter could read or flip a different line. - `wp-tooling features`: when `npm install` fails after enabling a feature, the retry commands it prints no longer put runtime dependencies under `--save-dev`, and a failed interactive change reads "Failed to enable " rather than "Failed to enabling ". -- `lint/eslint`, `lint/stylelint` and `setup/tailwind` asked for `@rtcamp/eslint-config`, `@rtcamp/stylelint-config` and `@rtcamp/tailwind-config` at `^0.1.0` from the npm registry. None of them was on the registry at that version (all three returned 404 when this was fixed), so `npm install` failed, and `features --enable tailwind --record-deps` wrote a spec into package.json that broke the project's next `npm install`. They now use the git specs the skeletons already use (`github:rtCamp/wp-tooling#npm/`). +- `lint/eslint`, `lint/stylelint` and `setup/tailwind` asked for `@rtcamp/eslint-config`, `@rtcamp/stylelint-config` and `@rtcamp/tailwind-config` at `^0.1.0` from the npm registry. None of them was on the registry at that version (all three returned 404 when this was fixed), so `npm install` failed, and `features --enable tailwind --record-deps` wrote a spec into package.json that broke the project's next `npm install`. They now ask for `^1.1.0`, the first release on the registry. - `lint/phpcs/full` now extends `rtCampWP-Basic` from `rtcamp/wp-phpcs` (and reports it plus `dealerdirect/phpcodesniffer-composer-installer` as dev dependencies) instead of `vendor/rtcamp/wp-framework/phpcs.xml.dist`. The framework export-ignores that file, so every dist install, the Composer default, ended up with a ruleset pointing at a file that was not there. The generated ruleset also sets `testVersion` to `8.2-`, which PHPCompatibilityWP needs. - `detect-changes --output github` and `coverage-gate --output github` write multi-line outputs under a random per-output heredoc delimiter instead of the fixed `EOF_WP_TOOLING`. The file lists come from the pull request, so a PR adding a file named `EOF_WP_TOOLING` followed by one named `php-count=0` could close the heredoc early and override the real count, skipping the PHP jobs. - `discover_from: composer.json:autoload.psr-4` now resolves **path** inputs (`base_path`, `*_path`, `*_dir`) from the map entry's directory instead of skipping them, grafted the same way namespaces already were — with a root of `Acme\Blog\` → `inc/`, a `base_path` default of `includes/Services` resolves to `inc/Services`. Previously the namespace was grafted but the directory kept the manifest default, so any project not laid out under `includes/` got a correctly-namespaced class written outside its autoload root, where it never loaded. Affects the 12 bundled scaffolds that declare PSR-4 discovery on `base_path`. Projects already using `includes/`, projects without a `composer.json`, and callers that pass `--base_path` explicitly are unaffected. diff --git a/node-packages/wp-tooling/docs/examples.md b/node-packages/wp-tooling/docs/examples.md index e02da3d..48d0bfc 100644 --- a/node-packages/wp-tooling/docs/examples.md +++ b/node-packages/wp-tooling/docs/examples.md @@ -70,7 +70,7 @@ npx wp-tooling add wp/cli --non-interactive --json --cwd . --name=im **Developer:** yes. -> For `lint/phpcs/full`, `rtcamp/wp-phpcs` is not on Packagist, so I would add its GitHub repository to `repositories` and allow `dealerdirect/phpcodesniffer-composer-installer` under `config.allow-plugins` in `composer.json`. +> For `lint/phpcs/full`, I would allow `dealerdirect/phpcodesniffer-composer-installer` under `config.allow-plugins` in `composer.json`, the Composer plugin that registers the PHPCS standards. > > Apply? [yes / skip] diff --git a/node-packages/wp-tooling/scaffolds/lint/eslint/scaffold.json b/node-packages/wp-tooling/scaffolds/lint/eslint/scaffold.json index 9046df9..9d45cf9 100644 --- a/node-packages/wp-tooling/scaffolds/lint/eslint/scaffold.json +++ b/node-packages/wp-tooling/scaffolds/lint/eslint/scaffold.json @@ -13,7 +13,7 @@ "npm_dev_dependencies": { "eslint": "^10.0.0", "@wordpress/eslint-plugin": "^25.1.0", - "@rtcamp/eslint-config": "github:rtCamp/wp-tooling#npm/eslint-config" + "@rtcamp/eslint-config": "^1.1.0" }, "scripts": { "npm": { diff --git a/node-packages/wp-tooling/scaffolds/lint/phpcs/core/scaffold.json b/node-packages/wp-tooling/scaffolds/lint/phpcs/core/scaffold.json index f914b8d..ef5a343 100644 --- a/node-packages/wp-tooling/scaffolds/lint/phpcs/core/scaffold.json +++ b/node-packages/wp-tooling/scaffolds/lint/phpcs/core/scaffold.json @@ -43,12 +43,6 @@ } ], "wiring": [ - { - "target_file": "composer.json", - "anchor": "\"repositories\"", - "snippet_template": "\"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"https://github.com/rtCamp/wp-phpcs.git\",\n \"no-api\": true\n }\n]", - "description": "rtcamp/wp-phpcs is not on Packagist, so Composer only finds it through this repository. Add the entry to the existing repositories array unless the URL is already there, or create the array. Apply before installing the package." - }, { "target_file": "composer.json", "anchor": "\"allow-plugins\"", diff --git a/node-packages/wp-tooling/scaffolds/lint/phpcs/full/scaffold.json b/node-packages/wp-tooling/scaffolds/lint/phpcs/full/scaffold.json index 80ade4d..ef5d712 100644 --- a/node-packages/wp-tooling/scaffolds/lint/phpcs/full/scaffold.json +++ b/node-packages/wp-tooling/scaffolds/lint/phpcs/full/scaffold.json @@ -43,12 +43,6 @@ } ], "wiring": [ - { - "target_file": "composer.json", - "anchor": "\"repositories\"", - "snippet_template": "\"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"https://github.com/rtCamp/wp-phpcs.git\",\n \"no-api\": true\n }\n]", - "description": "rtcamp/wp-phpcs is not on Packagist, so Composer only finds it through this repository. Add the entry to the existing repositories array unless the URL is already there, or create the array. Apply before installing the package." - }, { "target_file": "composer.json", "anchor": "\"allow-plugins\"", diff --git a/node-packages/wp-tooling/scaffolds/lint/stylelint/scaffold.json b/node-packages/wp-tooling/scaffolds/lint/stylelint/scaffold.json index 1199949..52b7b14 100644 --- a/node-packages/wp-tooling/scaffolds/lint/stylelint/scaffold.json +++ b/node-packages/wp-tooling/scaffolds/lint/stylelint/scaffold.json @@ -14,7 +14,7 @@ "stylelint": "^16.8.2", "@wordpress/stylelint-config": "^23.37.0", "stylelint-scss": "^6.4.0", - "@rtcamp/stylelint-config": "github:rtCamp/wp-tooling#npm/stylelint-config" + "@rtcamp/stylelint-config": "^1.1.0" }, "scripts": { "npm": { diff --git a/node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/setup-SKILL.md b/node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/setup-SKILL.md index 8f8a4e6..2ce5358 100644 --- a/node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/setup-SKILL.md +++ b/node-packages/wp-tooling/scaffolds/setup/claude-skills/templates/setup-SKILL.md @@ -265,12 +265,7 @@ Create it? [yes / skip PSR-4 / give me the values to use] ### Wiring: composer.json for PHPCS -The `lint/phpcs/*` wiring entries must be in `composer.json` before the developer runs `composer require`, or the install fails: - -1. `repositories` (`full` and `core` only) — a `vcs` entry for `https://github.com/rtCamp/wp-phpcs.git`, since `rtcamp/wp-phpcs` is not on Packagist. Append it to an existing array; skip it if that URL is already listed. `vip` needs none: `automattic/vipwpcs` is on Packagist. -2. `config.allow-plugins` (all three) — `dealerdirect/phpcodesniffer-composer-installer: true`, the plugin that registers the standards. Merge it into an existing `config` block. - -Show the changes together, ask once, and merge rather than replace existing keys. +All three `lint/phpcs/*` scaffolds need one wiring entry in `composer.json` before the developer runs `composer require`, or the install fails: `config.allow-plugins` with `dealerdirect/phpcodesniffer-composer-installer: true`, the plugin that registers the standards. Merge it into an existing `config` block rather than replacing it, and ask once. ### Wiring: feature scaffolds @@ -315,7 +310,7 @@ Developer actions (run these yourself): npm install --save-dev \ eslint@^10.0.0 \ @wordpress/eslint-plugin@^25.1.0 \ - @rtcamp/eslint-config@github:rtCamp/wp-tooling#npm/eslint-config + @rtcamp/eslint-config@^1.1.0 Scripts to add to composer.json: diff --git a/node-packages/wp-tooling/scaffolds/setup/tailwind/scaffold.json b/node-packages/wp-tooling/scaffolds/setup/tailwind/scaffold.json index e0a7d3d..3cd18c0 100644 --- a/node-packages/wp-tooling/scaffolds/setup/tailwind/scaffold.json +++ b/node-packages/wp-tooling/scaffolds/setup/tailwind/scaffold.json @@ -29,7 +29,7 @@ "gitignore": [ "{{css_dir}}/_tailwind-theme.css" ] }, "npm_dev_dependencies": { - "@rtcamp/tailwind-config": "github:rtCamp/wp-tooling#npm/tailwind-config", + "@rtcamp/tailwind-config": "^1.1.0", "tailwindcss": "^4.3.0", "@tailwindcss/postcss": "^4.3.0" } diff --git a/node-packages/wp-tooling/skills/setup/SKILL.md b/node-packages/wp-tooling/skills/setup/SKILL.md index 8f8a4e6..2ce5358 100644 --- a/node-packages/wp-tooling/skills/setup/SKILL.md +++ b/node-packages/wp-tooling/skills/setup/SKILL.md @@ -265,12 +265,7 @@ Create it? [yes / skip PSR-4 / give me the values to use] ### Wiring: composer.json for PHPCS -The `lint/phpcs/*` wiring entries must be in `composer.json` before the developer runs `composer require`, or the install fails: - -1. `repositories` (`full` and `core` only) — a `vcs` entry for `https://github.com/rtCamp/wp-phpcs.git`, since `rtcamp/wp-phpcs` is not on Packagist. Append it to an existing array; skip it if that URL is already listed. `vip` needs none: `automattic/vipwpcs` is on Packagist. -2. `config.allow-plugins` (all three) — `dealerdirect/phpcodesniffer-composer-installer: true`, the plugin that registers the standards. Merge it into an existing `config` block. - -Show the changes together, ask once, and merge rather than replace existing keys. +All three `lint/phpcs/*` scaffolds need one wiring entry in `composer.json` before the developer runs `composer require`, or the install fails: `config.allow-plugins` with `dealerdirect/phpcodesniffer-composer-installer: true`, the plugin that registers the standards. Merge it into an existing `config` block rather than replacing it, and ask once. ### Wiring: feature scaffolds @@ -315,7 +310,7 @@ Developer actions (run these yourself): npm install --save-dev \ eslint@^10.0.0 \ @wordpress/eslint-plugin@^25.1.0 \ - @rtcamp/eslint-config@github:rtCamp/wp-tooling#npm/eslint-config + @rtcamp/eslint-config@^1.1.0 Scripts to add to composer.json: diff --git a/node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js b/node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js index f962c12..e075506 100644 --- a/node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js +++ b/node-packages/wp-tooling/tests/scaffolds/bundled-manifests.test.js @@ -949,29 +949,23 @@ describe.each([ }); }); - it('wires the repository and plugin permission Composer needs to install it', async () => { + it('wires only the plugin permission Composer needs to install it', async () => { const result = await registry.execute( id, {}, { dryRun: true, cwd: makeTmpDir() } ); - const [repositories, allowPlugins] = result.ai.wiring; - expect(result.ai.wiring.map((w) => w.targetFile)).toEqual([ - 'composer.json', - 'composer.json', - ]); - // Not on Packagist: without this entry the require cannot resolve. - expect(JSON.parse(`{${repositories.snippet}}`).repositories).toEqual([ - { - type: 'vcs', - url: 'https://github.com/rtCamp/wp-phpcs.git', - 'no-api': true, + // rtcamp/wp-phpcs resolves from Packagist, so no repositories entry. + expect(result.ai.wiring).toHaveLength(1); + expect(result.ai.wiring[0].targetFile).toBe('composer.json'); + expect(JSON.parse(`{${result.ai.wiring[0].snippet}}`)).toEqual({ + config: { + 'allow-plugins': { + 'dealerdirect/phpcodesniffer-composer-installer': true, + }, }, - ]); - expect( - JSON.parse(`{${allowPlugins.snippet}}`).config['allow-plugins'] - ).toEqual({ 'dealerdirect/phpcodesniffer-composer-installer': true }); + }); }); it('falls back to defaults and leaves out the namespace prefix without PSR-4', async () => {