Skip to content

Rename rtcamp/wp-framework to rtcamp/wp-primitives - #98

Merged
aryanjasala merged 3 commits into
mainfrom
rename/wp-primitives
Oct 1, 2026
Merged

aryanjasala merged 3 commits into
mainfrom
rename/wp-primitives

Conversation

@aryanjasala

@aryanjasala aryanjasala commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Renames the package from rtcamp/wp-framework to rtcamp/wp-primitives, per the decision in the WP Package namings thread.

What changed

  • Package rtcamp/wp-framework to rtcamp/wp-primitives
  • Namespace rtCamp\WPFramework\ to rtCamp\WPPrimitives\ (direct analogue of the old name)
  • ai/framework-php.instructions.md to ai/primitives-php.instructions.md, with bin/sync-ai-instructions.js updated to match and to delete the superseded file on consumers when they upgrade
  • Added extra.branch-alias mapping dev-main to 2.0.x-dev, so ^2.0 resolves before a tag exists for consumers with minimum-stability: dev. Consumers on stable resolve once v2.0.0 is tagged
  • Regenerated composer.lock (changing the name key invalidated the content-hash, which would have failed the composer validate step in CI on every PR)

Three breaking changes that are not string changes

  1. AssetLoader::HANDLE_PREFIX moves from wp-framework- to wp-primitives-. Every default asset handle changes. Consumers that referenced a wp-framework-* handle as a literal string in wp_add_inline_script, wp_localize_script, a dependency array, or a dequeue must update, or override the constant.
  2. Gettext text domain moves from wp-framework to wp-primitives across 22 strings in inc/. No .pot, .po or .mo files ship here, so nothing in-repo breaks.
  3. ComponentLoader::get_context() default moves from wp-framework to wp-primitives. Subclasses that do not override it get renamed hooks, such as wp-primitives/component_before_render, and renamed asset handles, wp-primitives-component-<name>-<type>. Override get_context() to keep the old names.

The first two are documented in CHANGELOG.md, and #100 adds the third. docs/upgrading.md gains a 1.0.x → 2.0.0 migration section.

Versioning

The rename lands on v2.0.0. The existing v1.0.0 and v1.0.1 tags are immutable and still declare rtcamp/wp-framework, so client projects pinning ^1.0 keep resolving and are undisturbed.

wp-devtools tracks dev-main and will break the moment this merges, so it needs updating in the same window.

Do not merge yet

Merge order matters:

  1. Rename the GitHub repo to rtCamp/wp-primitives (GitHub 301-redirects, stars and forks follow)
  2. Merge this PR, then v2 release prep #100, and tag v2.0.0
  3. Then the consumer PRs in plugin-elementary and theme-elementary
  4. Then wp-devtools, same window

Merging before step 1 leaves composer.json pointing at a repository that does not exist.

Verification

63 PHP files pass php -l. bin/sync-ai-instructions.js passes node --check. composer validate passes. Namespace declarations in inc/ and tests/ match the PSR-4 map exactly.

- restore truthful composer.lock where the rename had falsified it
- correct unresolvable ^1.0 constraints in install docs
- document the HANDLE_PREFIX and text-domain breaks
- add the 1.0.x to 2.0.0 migration guide
- prune the superseded instructions file on sync
@Adi-ty

Adi-ty commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

@aryanjasala Looks good to me! The rename seems complete, and CI is passing. I was just wondering if there’s anything else we might want to cover, perhaps documenting the rename in the changelog. Otherwise, do you think we can mark this as ready?

@aryanjasala aryanjasala mentioned this pull request Oct 1, 2026
@aryanjasala
aryanjasala marked this pull request as ready for review October 1, 2026 13:59
@aryanjasala
aryanjasala requested review from Adi-ty and AnuragVasanwala and a balanced review from Copilot October 1, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The migration can delete hand-authored consumer instructions and leaves additional breaking behavior and pre-tag Composer limitations inaccurately documented.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Renames the Composer library to rtcamp/wp-primitives for the planned v2.0.0 release, including namespaces, defaults, tooling, tests, and consumer guidance.

Changes:

  • Renames package, repository, PHP namespaces, text domain, handles, and component context.
  • Updates tests, wp-env, Composer, static-analysis, and instruction-sync tooling.
  • Adds migration and release documentation for consumers.
File Description
tests/​Utils/​TransientsTest.php Updates test namespaces.
tests/​Utils/​TimerTest.php Updates test namespaces.
tests/​Utils/​LoggerTest.php Updates test namespaces.
tests/​Utils/​FeatureSelectorTest.php Updates namespaces and expected notices.
tests/​Utils/​FeatureSelectorSettingsPageTest.php Updates test namespaces.
tests/​Utils/​EncryptorTest.php Updates test namespaces.
tests/​Utils/​CacheTest.php Updates test namespaces.
tests/​TestCase.php Renames the shared test namespace.
tests/​TemplateLoaderTest.php Updates namespace and imports.
tests/​SingletonTest.php Updates namespace and fixture imports.
tests/​LoaderTest.php Updates fixture imports.
tests/​Fixtures/​SingletonExample.php Updates fixture namespace.
tests/​Fixtures/​ReentrantSingleton.php Updates fixture namespace.
tests/​Fixtures/​LoaderFixtures.php Updates fixture contracts and namespace.
tests/​Fixtures/​FlakySingleton.php Updates fixture namespace.
tests/​Fixtures/​BareSingleton.php Updates fixture namespace.
tests/​Contracts/​Interfaces/​InterfaceContractsTest.php Updates contract imports.
tests/​Contracts/​Abstracts/​AbstractUserRoleTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractTaxonomyTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractShortcodeTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractSettingsPageTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractRESTControllerTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractPostTypeTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractModuleTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractFeatureTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractBlockTest.php Updates namespace and block names.
tests/​Contracts/​Abstracts/​AbstractAdminPageTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractAbilityTest.php Updates abstract contract imports.
tests/​Contracts/​Abstracts/​AbstractAbilityRegistrarTest.php Updates registrar imports.
tests/​ContainerTest.php Updates container namespace.
tests/​Components/​ComponentLoaderTest.php Updates component contexts, hooks, and handles.
tests/​bootstrap.php Updates package metadata.
tests/​AssetLoaderTest.php Updates namespace and block fixtures.
tests/​AssetLoaderHandleTest.php Updates default-handle expectations.
README.md Updates installation and usage examples.
phpstan.neon.dist Renames the configuration heading.
phpcs.xml.dist Renames the ruleset metadata.
package.json Renames npm metadata and wp-env paths.
package-lock.json Synchronizes npm package metadata.
inc/​Utils/​Transients.php Renames the utility namespace.
inc/​Utils/​Timer.php Renames namespace and text domain.
inc/​Utils/​Logger.php Renames namespace and package docs.
inc/​Utils/​FeatureSelectorSettingsPage.php Updates namespace, imports, and translations.
inc/​Utils/​FeatureSelector.php Updates namespace and translations.
inc/​Utils/​Encryptor.php Renames the utility namespace.
inc/​Utils/​Cache.php Updates namespace and PHPDoc reference.
inc/​TemplateLoader.php Renames the loader namespace.
inc/​Contracts/​Traits/​Singleton.php Updates namespace and translations.
inc/​Contracts/​Traits/​Loader.php Updates contract namespaces.
inc/​Contracts/​Interfaces/​Shareable.php Renames the interface namespace.
inc/​Contracts/​Interfaces/​Registrable.php Renames the interface namespace.
inc/​Contracts/​Interfaces/​ConditionallyRegistrable.php Renames the interface namespace.
inc/​Contracts/​Interfaces/​CLICommand.php Renames the interface namespace.
inc/​Contracts/​Abstracts/​AbstractUserRole.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractTaxonomy.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractShortcode.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractSettingsPage.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractRESTController.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractPostType.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractModule.php Updates contract namespaces.
inc/​Contracts/​Abstracts/​AbstractFeature.php Updates contract namespaces.
inc/​Contracts/​Abstracts/​AbstractBlock.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractAdminPage.php Updates contract namespace.
inc/​Contracts/​Abstracts/​AbstractAbilityRegistrar.php Updates registrar namespace.
inc/​Contracts/​Abstracts/​AbstractAbility.php Updates ability namespace.
inc/​Container.php Renames the container namespace.
inc/​ComponentLoader.php Renames namespace, context, and text domain.
inc/​AssetLoader.php Renames namespace, handle prefix, and text domain.
docs/​upgrading.md Adds the v2 migration procedure.
docs/​troubleshooting.md Updates handles, commands, and namespace guidance.
docs/​maintainers.md Updates maintainer references.
docs/​index.md Renames package overview.
docs/​getting-started.md Updates installation and examples.
docs/​contracts.md Updates contract examples.
docs/​branding.json Changes documentation branding.
docs/​ai-review-system.md Updates instruction-sync documentation.
CONTRIBUTING.md Updates contributor guidance.
composer.lock Regenerates Composer lock metadata.
composer.json Renames package/autoloading and adds branch alias.
CHANGELOG.md Documents v2 breaking changes.
bin/​sync-ai-instructions.js Migrates generated instruction filenames.
ai/​primitives-php.instructions.md Renames consumer PHP instructions.
AGENTS.md Updates repository agent guidance.
.wp-env.json Renames the wp-env mapping.
.github/​instructions/​php.instructions.md Updates framework-development metadata.
.github/​copilot-instructions.md Updates repository-wide Copilot guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread composer.json Resolved
Comment thread inc/ComponentLoader.php Resolved
Comment thread CHANGELOG.md Resolved

@AnuragVasanwala AnuragVasanwala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Before merging:

  1. Rename the repo to rtCamp/wp-primitives.
  2. Merge this PR, then #100, then tag v2.0.0.

Follow-ups for #100, from the Copilot threads:

  • Add the ComponentLoader::get_context() default change to the 2.0.0 CHANGELOG entry as a breaking change.
  • Change "23 translated strings" to 22.

@aryanjasala
aryanjasala merged commit 931ba9f into main Oct 1, 2026
45 checks passed
@aryanjasala
aryanjasala deleted the rename/wp-primitives branch October 1, 2026 16:16
aryanjasala added a commit that referenced this pull request Oct 1, 2026
#98 aliased dev-main to 2.0.x-dev. That alias stops matching as soon as
main carries 2.1 work: a consumer asking for ^2.1@dev could not resolve
the branch. 2.x-dev covers every 2.y line without a bump after each minor
release, and still satisfies ^2.0@dev before the v2.0.0 tag exists.
Only the lock's content-hash changes.
AnuragVasanwala added a commit to rtCamp/wp-tooling that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* fix(scaffolds): escape the wp/cli command description

An apostrophe or backslash in --description produced a PHP string literal that did not parse. The description now goes through a derived description_php input with the php-escape transform, as the other display-text scaffolds do, and wp/cli joins the quoted display text test.

* fix(scaffolds): accept skill-resolved code: discover sources

The new discover_from allow-list rejected code:*, which docs/ai-orchestration.md documents as resolved by the orchestrating skill, so project and remote manifests using it failed validation.

* fix(scaffolds): drop wiring targets that normalise to exactly ..

path.posix.normalize('a/../..') returns '..' with no trailing slash, which slipped past the startsWith('../') check.

* docs(ai-orchestration): list plugin-header as engine-resolved

The discovery section still said plugin-header:* was the skill's job, while the engine resolves it and the contract above says so.

* test(php-imports): use a pair only the segment-wise sort orders correctly

Acme\Blog against Acme_Blog sorted the same way under a whole-string compare, so the test could not catch a regression. Acme\Blog against AcmeZ only passes segment-wise.

---------

Co-authored-by: AnuragVasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
github-actions Bot pushed a commit to rtCamp/wp-tooling that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* fix(scaffolds): escape the wp/cli command description

An apostrophe or backslash in --description produced a PHP string literal that did not parse. The description now goes through a derived description_php input with the php-escape transform, as the other display-text scaffolds do, and wp/cli joins the quoted display text test.

* fix(scaffolds): accept skill-resolved code: discover sources

The new discover_from allow-list rejected code:*, which docs/ai-orchestration.md documents as resolved by the orchestrating skill, so project and remote manifests using it failed validation.

* fix(scaffolds): drop wiring targets that normalise to exactly ..

path.posix.normalize('a/../..') returns '..' with no trailing slash, which slipped past the startsWith('../') check.

* docs(ai-orchestration): list plugin-header as engine-resolved

The discovery section still said plugin-header:* was the skill's job, while the engine resolves it and the contract above says so.

* test(php-imports): use a pair only the segment-wise sort orders correctly

Acme\Blog against Acme_Blog sorted the same way under a whole-string compare, so the test could not catch a regression. Acme\Blog against AcmeZ only passes segment-wise.

---------

Co-authored-by: AnuragVasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
AnuragVasanwala added a commit to rtCamp/wp-tooling that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* ci: lint and test every pull request and push to main

Nothing ran the suites on a pull request, while every merge to main is
split straight onto the npm/* branches that the skeletons and the shared
workflows install from. A broken merge therefore reached new installs
with no gate in between.

The new workflow runs every workspace lint and Jest suite with coverage
thresholds on Node 22.19 (the engines floor) and 24, and installs and
tests each composer package standalone, the way it ships after the
subtree split, on PHP 8.2, 8.3 and 8.4.

* ci(release): repair diverged mirrors and narrow secret and token scope

Both mirrors already carry a commit the split did not make (an org bot
merged a Copilot review workflow into rtCamp/wp-phpcs and
rtCamp/wp-phpstan on 2026-08-13). The release refuses to fast-forward
over that, so the next tag would fail before reaching Packagist, and the
only way out was a force push that also mints a throwaway tag.

- release-php: add a resync_branch dispatch input that forces just the
  mirror branch back onto the split and pushes no tag, and say exactly
  that in the error when a release does not fast-forward.
- release-php: reference the deploy keys by name instead of
  secrets[matrix.secret_name], which hands the job the whole secrets
  context, and check the secret name before the indirect lookup.
- split-npm-packages: grant contents: write to the split job only.

* chore(composer): add Packagist metadata to wp-phpcs and wp-phpstan

Both packages are about to be submitted to Packagist from their split
mirrors, which are read-only. Point homepage, support.issues and
support.source at the monorepo so the Packagist page sends issues and
contributions to the right place, and name rtCamp as the author.

* fix(detect-changes): add --strict and randomise the GitHub output delimiter

A failed git diff counted as zero changes, which skipped every job gated
on the counts and left the run green. rtCamp/wp-shared-workflows works
around it by grepping stderr. --strict (detectChanges({ strict: true }))
now exits 1 with a DetectChangesError instead; it is off by default so
existing callers see no change, and the stderr keeps the 'git diff
failed' phrase the shared workflow matches.

Multi-line outputs used the fixed heredoc delimiter EOF_WP_TOOLING, but
the file list comes from the pull request: a file named EOF_WP_TOOLING
followed by one named php-count=0 closed the heredoc early and overrode
the real count. Each output now gets a random delimiter that no value
line may equal. coverage-gate shares the formatter and gets the same fix.

New tests run detect-changes against real git repositories (pull request
base, push before-SHA, new-branch fallback, explicit base, soft and
strict failure) and pin the forged-output case.

* fix(scaffolds): install the @rtCamp config packages from git, not npm

lint/eslint, lint/stylelint and setup/tailwind reported
@rtcamp/eslint-config, @rtcamp/stylelint-config and
@rtcamp/tailwind-config at ^0.1.0. None of the three is on the npm
registry (each returns 404, and the packages are at 1.0.0), so the
reported install failed with E404, and features --enable tailwind
--record-deps wrote that spec into package.json, breaking the project's
next npm install.

Use the git specs the theme and plugin skeletons already install from
(github:rtCamp/wp-tooling#npm/<package>). Verified in a scratch project:
the ^0.1.0 spec fails with E404 and the git spec installs.

* test(features): cover the features CLI end to end and fix two report bugs

The features command (also embedded by the theme init through
runFeatures) had 38% line coverage: nothing exercised argument parsing,
status output, the human report, the interactive flow or the JSON error
path. The new suites run it against the bundled Tailwind feature in
throwaway projects (status, enable, --record-deps, --dry-run, disable
with and without --force, unknown ids, prompts, cancellation, a failing
change) and against a mocked npm for the install success and failure
reports.

They found two bugs, fixed here:
- after a failed npm install, the retry commands put runtime
  dependencies under --save-dev;
- a failed interactive change read 'Failed to enabling <id>'.

* test(add): cover the human report sections and the interactive wizard

The add command sat at 58% line coverage: the interactive wizard
(prompting for missing inputs, confirm, spinner, cancel, dry run) and
most human report sections (composer installs, secrets, wiring,
scaffolded tests, skipped files, warnings, the available-scaffolds list
for an unknown id) never ran in tests. The new suite drives them with
the real Wizard and stubbed prompts.

* test(init): cover the FeatureApi helpers skeleton feature hooks rely on

The theme's Tailwind toggle flips a PHP define through readDefine and
setDefine, and its HMR toggle edits .env.local through readEnv and
setEnv; none of those, nor writeFlag or hasDep, had a test. The new suite
pins reading and writing, that every mutation's journal entry restores
exactly what it changed (including directories a write created), that
remove refuses directories, and that paths cannot leave the project.

Fixes what it found: the key and define name were interpolated into a
regular expression, so a name containing a metacharacter such as '.'
matched other lines. Both are now escaped.

* test: cover manage-mode flags, list CLI errors and the Tailwind webpack hooks

- init manage mode driven by flags, the way CI and AI callers run it
  (--features, --enable, --disable, --yes alone refused, undeclared keys
  rejected), plus the read-only status view (drift, unknown state,
  retired keys);
- wp-tooling list: space-separated flag forms, argument errors, the
  empty table, and a registry that fails to load, in plain and --json
  output;
- tailwind-config: GenerateTailwindThemePlugin.apply(), which wires the
  run, watchRun (skip rebuilds that did not touch theme.json) and
  afterEmit hooks. Its functions go from 60% to 100% covered.

* docs(changelog): restore the wp/cli description escaping note

The merge from main kept the older wording and dropped the entry for the wp/cli description fix that #70 shipped.

* docs(examples): install @rtcamp/eslint-config at ^1.0.0

The package publishes to npm as 1.0.0, and ^0.1.0 only matches versions below 0.2.0.

* fix(ci): export DetectChangesError from @rtcamp/wp-tooling/ci

The class was exported from src/ci/detect-changes.js but not from the ci barrel, so consumers of the documented @rtcamp/wp-tooling/ci entry point could not catch it by type. Adds the export and a test next to the existing GateError one.

* docs(changelog): separate the Unreleased sections

---------

Co-authored-by: Aditya Singh <adityasinghboss1234@gmail.com>
Co-authored-by: Anurag Vasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
github-actions Bot pushed a commit to rtCamp/wp-tooling that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* ci: lint and test every pull request and push to main

Nothing ran the suites on a pull request, while every merge to main is
split straight onto the npm/* branches that the skeletons and the shared
workflows install from. A broken merge therefore reached new installs
with no gate in between.

The new workflow runs every workspace lint and Jest suite with coverage
thresholds on Node 22.19 (the engines floor) and 24, and installs and
tests each composer package standalone, the way it ships after the
subtree split, on PHP 8.2, 8.3 and 8.4.

* ci(release): repair diverged mirrors and narrow secret and token scope

Both mirrors already carry a commit the split did not make (an org bot
merged a Copilot review workflow into rtCamp/wp-phpcs and
rtCamp/wp-phpstan on 2026-08-13). The release refuses to fast-forward
over that, so the next tag would fail before reaching Packagist, and the
only way out was a force push that also mints a throwaway tag.

- release-php: add a resync_branch dispatch input that forces just the
  mirror branch back onto the split and pushes no tag, and say exactly
  that in the error when a release does not fast-forward.
- release-php: reference the deploy keys by name instead of
  secrets[matrix.secret_name], which hands the job the whole secrets
  context, and check the secret name before the indirect lookup.
- split-npm-packages: grant contents: write to the split job only.

* chore(composer): add Packagist metadata to wp-phpcs and wp-phpstan

Both packages are about to be submitted to Packagist from their split
mirrors, which are read-only. Point homepage, support.issues and
support.source at the monorepo so the Packagist page sends issues and
contributions to the right place, and name rtCamp as the author.

* fix(detect-changes): add --strict and randomise the GitHub output delimiter

A failed git diff counted as zero changes, which skipped every job gated
on the counts and left the run green. rtCamp/wp-shared-workflows works
around it by grepping stderr. --strict (detectChanges({ strict: true }))
now exits 1 with a DetectChangesError instead; it is off by default so
existing callers see no change, and the stderr keeps the 'git diff
failed' phrase the shared workflow matches.

Multi-line outputs used the fixed heredoc delimiter EOF_WP_TOOLING, but
the file list comes from the pull request: a file named EOF_WP_TOOLING
followed by one named php-count=0 closed the heredoc early and overrode
the real count. Each output now gets a random delimiter that no value
line may equal. coverage-gate shares the formatter and gets the same fix.

New tests run detect-changes against real git repositories (pull request
base, push before-SHA, new-branch fallback, explicit base, soft and
strict failure) and pin the forged-output case.

* fix(scaffolds): install the @rtCamp config packages from git, not npm

lint/eslint, lint/stylelint and setup/tailwind reported
@rtcamp/eslint-config, @rtcamp/stylelint-config and
@rtcamp/tailwind-config at ^0.1.0. None of the three is on the npm
registry (each returns 404, and the packages are at 1.0.0), so the
reported install failed with E404, and features --enable tailwind
--record-deps wrote that spec into package.json, breaking the project's
next npm install.

Use the git specs the theme and plugin skeletons already install from
(github:rtCamp/wp-tooling#npm/<package>). Verified in a scratch project:
the ^0.1.0 spec fails with E404 and the git spec installs.

* test(features): cover the features CLI end to end and fix two report bugs

The features command (also embedded by the theme init through
runFeatures) had 38% line coverage: nothing exercised argument parsing,
status output, the human report, the interactive flow or the JSON error
path. The new suites run it against the bundled Tailwind feature in
throwaway projects (status, enable, --record-deps, --dry-run, disable
with and without --force, unknown ids, prompts, cancellation, a failing
change) and against a mocked npm for the install success and failure
reports.

They found two bugs, fixed here:
- after a failed npm install, the retry commands put runtime
  dependencies under --save-dev;
- a failed interactive change read 'Failed to enabling <id>'.

* test(add): cover the human report sections and the interactive wizard

The add command sat at 58% line coverage: the interactive wizard
(prompting for missing inputs, confirm, spinner, cancel, dry run) and
most human report sections (composer installs, secrets, wiring,
scaffolded tests, skipped files, warnings, the available-scaffolds list
for an unknown id) never ran in tests. The new suite drives them with
the real Wizard and stubbed prompts.

* test(init): cover the FeatureApi helpers skeleton feature hooks rely on

The theme's Tailwind toggle flips a PHP define through readDefine and
setDefine, and its HMR toggle edits .env.local through readEnv and
setEnv; none of those, nor writeFlag or hasDep, had a test. The new suite
pins reading and writing, that every mutation's journal entry restores
exactly what it changed (including directories a write created), that
remove refuses directories, and that paths cannot leave the project.

Fixes what it found: the key and define name were interpolated into a
regular expression, so a name containing a metacharacter such as '.'
matched other lines. Both are now escaped.

* test: cover manage-mode flags, list CLI errors and the Tailwind webpack hooks

- init manage mode driven by flags, the way CI and AI callers run it
  (--features, --enable, --disable, --yes alone refused, undeclared keys
  rejected), plus the read-only status view (drift, unknown state,
  retired keys);
- wp-tooling list: space-separated flag forms, argument errors, the
  empty table, and a registry that fails to load, in plain and --json
  output;
- tailwind-config: GenerateTailwindThemePlugin.apply(), which wires the
  run, watchRun (skip rebuilds that did not touch theme.json) and
  afterEmit hooks. Its functions go from 60% to 100% covered.

* docs(changelog): restore the wp/cli description escaping note

The merge from main kept the older wording and dropped the entry for the wp/cli description fix that #70 shipped.

* docs(examples): install @rtcamp/eslint-config at ^1.0.0

The package publishes to npm as 1.0.0, and ^0.1.0 only matches versions below 0.2.0.

* fix(ci): export DetectChangesError from @rtcamp/wp-tooling/ci

The class was exported from src/ci/detect-changes.js but not from the ci barrel, so consumers of the documented @rtcamp/wp-tooling/ci entry point could not catch it by type. Adds the export and a test next to the existing GateError one.

* docs(changelog): separate the Unreleased sections

---------

Co-authored-by: Aditya Singh <adityasinghboss1234@gmail.com>
Co-authored-by: Anurag Vasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
github-actions Bot pushed a commit to rtCamp/wp-tooling that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* ci: lint and test every pull request and push to main

Nothing ran the suites on a pull request, while every merge to main is
split straight onto the npm/* branches that the skeletons and the shared
workflows install from. A broken merge therefore reached new installs
with no gate in between.

The new workflow runs every workspace lint and Jest suite with coverage
thresholds on Node 22.19 (the engines floor) and 24, and installs and
tests each composer package standalone, the way it ships after the
subtree split, on PHP 8.2, 8.3 and 8.4.

* ci(release): repair diverged mirrors and narrow secret and token scope

Both mirrors already carry a commit the split did not make (an org bot
merged a Copilot review workflow into rtCamp/wp-phpcs and
rtCamp/wp-phpstan on 2026-08-13). The release refuses to fast-forward
over that, so the next tag would fail before reaching Packagist, and the
only way out was a force push that also mints a throwaway tag.

- release-php: add a resync_branch dispatch input that forces just the
  mirror branch back onto the split and pushes no tag, and say exactly
  that in the error when a release does not fast-forward.
- release-php: reference the deploy keys by name instead of
  secrets[matrix.secret_name], which hands the job the whole secrets
  context, and check the secret name before the indirect lookup.
- split-npm-packages: grant contents: write to the split job only.

* chore(composer): add Packagist metadata to wp-phpcs and wp-phpstan

Both packages are about to be submitted to Packagist from their split
mirrors, which are read-only. Point homepage, support.issues and
support.source at the monorepo so the Packagist page sends issues and
contributions to the right place, and name rtCamp as the author.

* fix(detect-changes): add --strict and randomise the GitHub output delimiter

A failed git diff counted as zero changes, which skipped every job gated
on the counts and left the run green. rtCamp/wp-shared-workflows works
around it by grepping stderr. --strict (detectChanges({ strict: true }))
now exits 1 with a DetectChangesError instead; it is off by default so
existing callers see no change, and the stderr keeps the 'git diff
failed' phrase the shared workflow matches.

Multi-line outputs used the fixed heredoc delimiter EOF_WP_TOOLING, but
the file list comes from the pull request: a file named EOF_WP_TOOLING
followed by one named php-count=0 closed the heredoc early and overrode
the real count. Each output now gets a random delimiter that no value
line may equal. coverage-gate shares the formatter and gets the same fix.

New tests run detect-changes against real git repositories (pull request
base, push before-SHA, new-branch fallback, explicit base, soft and
strict failure) and pin the forged-output case.

* fix(scaffolds): install the @rtCamp config packages from git, not npm

lint/eslint, lint/stylelint and setup/tailwind reported
@rtcamp/eslint-config, @rtcamp/stylelint-config and
@rtcamp/tailwind-config at ^0.1.0. None of the three is on the npm
registry (each returns 404, and the packages are at 1.0.0), so the
reported install failed with E404, and features --enable tailwind
--record-deps wrote that spec into package.json, breaking the project's
next npm install.

Use the git specs the theme and plugin skeletons already install from
(github:rtCamp/wp-tooling#npm/<package>). Verified in a scratch project:
the ^0.1.0 spec fails with E404 and the git spec installs.

* test(features): cover the features CLI end to end and fix two report bugs

The features command (also embedded by the theme init through
runFeatures) had 38% line coverage: nothing exercised argument parsing,
status output, the human report, the interactive flow or the JSON error
path. The new suites run it against the bundled Tailwind feature in
throwaway projects (status, enable, --record-deps, --dry-run, disable
with and without --force, unknown ids, prompts, cancellation, a failing
change) and against a mocked npm for the install success and failure
reports.

They found two bugs, fixed here:
- after a failed npm install, the retry commands put runtime
  dependencies under --save-dev;
- a failed interactive change read 'Failed to enabling <id>'.

* test(add): cover the human report sections and the interactive wizard

The add command sat at 58% line coverage: the interactive wizard
(prompting for missing inputs, confirm, spinner, cancel, dry run) and
most human report sections (composer installs, secrets, wiring,
scaffolded tests, skipped files, warnings, the available-scaffolds list
for an unknown id) never ran in tests. The new suite drives them with
the real Wizard and stubbed prompts.

* test(init): cover the FeatureApi helpers skeleton feature hooks rely on

The theme's Tailwind toggle flips a PHP define through readDefine and
setDefine, and its HMR toggle edits .env.local through readEnv and
setEnv; none of those, nor writeFlag or hasDep, had a test. The new suite
pins reading and writing, that every mutation's journal entry restores
exactly what it changed (including directories a write created), that
remove refuses directories, and that paths cannot leave the project.

Fixes what it found: the key and define name were interpolated into a
regular expression, so a name containing a metacharacter such as '.'
matched other lines. Both are now escaped.

* test: cover manage-mode flags, list CLI errors and the Tailwind webpack hooks

- init manage mode driven by flags, the way CI and AI callers run it
  (--features, --enable, --disable, --yes alone refused, undeclared keys
  rejected), plus the read-only status view (drift, unknown state,
  retired keys);
- wp-tooling list: space-separated flag forms, argument errors, the
  empty table, and a registry that fails to load, in plain and --json
  output;
- tailwind-config: GenerateTailwindThemePlugin.apply(), which wires the
  run, watchRun (skip rebuilds that did not touch theme.json) and
  afterEmit hooks. Its functions go from 60% to 100% covered.

* docs(changelog): restore the wp/cli description escaping note

The merge from main kept the older wording and dropped the entry for the wp/cli description fix that #70 shipped.

* docs(examples): install @rtcamp/eslint-config at ^1.0.0

The package publishes to npm as 1.0.0, and ^0.1.0 only matches versions below 0.2.0.

* fix(ci): export DetectChangesError from @rtcamp/wp-tooling/ci

The class was exported from src/ci/detect-changes.js but not from the ci barrel, so consumers of the documented @rtcamp/wp-tooling/ci entry point could not catch it by type. Adds the export and a test next to the existing GateError one.

* docs(changelog): separate the Unreleased sections

---------

Co-authored-by: Aditya Singh <adityasinghboss1234@gmail.com>
Co-authored-by: Anurag Vasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
aryanjasala added a commit to rtCamp/wp-phpstan that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* ci: lint and test every pull request and push to main

Nothing ran the suites on a pull request, while every merge to main is
split straight onto the npm/* branches that the skeletons and the shared
workflows install from. A broken merge therefore reached new installs
with no gate in between.

The new workflow runs every workspace lint and Jest suite with coverage
thresholds on Node 22.19 (the engines floor) and 24, and installs and
tests each composer package standalone, the way it ships after the
subtree split, on PHP 8.2, 8.3 and 8.4.

* ci(release): repair diverged mirrors and narrow secret and token scope

Both mirrors already carry a commit the split did not make (an org bot
merged a Copilot review workflow into rtCamp/wp-phpcs and
rtCamp/wp-phpstan on 2026-08-13). The release refuses to fast-forward
over that, so the next tag would fail before reaching Packagist, and the
only way out was a force push that also mints a throwaway tag.

- release-php: add a resync_branch dispatch input that forces just the
  mirror branch back onto the split and pushes no tag, and say exactly
  that in the error when a release does not fast-forward.
- release-php: reference the deploy keys by name instead of
  secrets[matrix.secret_name], which hands the job the whole secrets
  context, and check the secret name before the indirect lookup.
- split-npm-packages: grant contents: write to the split job only.

* chore(composer): add Packagist metadata to wp-phpcs and wp-phpstan

Both packages are about to be submitted to Packagist from their split
mirrors, which are read-only. Point homepage, support.issues and
support.source at the monorepo so the Packagist page sends issues and
contributions to the right place, and name rtCamp as the author.

* fix(detect-changes): add --strict and randomise the GitHub output delimiter

A failed git diff counted as zero changes, which skipped every job gated
on the counts and left the run green. rtCamp/wp-shared-workflows works
around it by grepping stderr. --strict (detectChanges({ strict: true }))
now exits 1 with a DetectChangesError instead; it is off by default so
existing callers see no change, and the stderr keeps the 'git diff
failed' phrase the shared workflow matches.

Multi-line outputs used the fixed heredoc delimiter EOF_WP_TOOLING, but
the file list comes from the pull request: a file named EOF_WP_TOOLING
followed by one named php-count=0 closed the heredoc early and overrode
the real count. Each output now gets a random delimiter that no value
line may equal. coverage-gate shares the formatter and gets the same fix.

New tests run detect-changes against real git repositories (pull request
base, push before-SHA, new-branch fallback, explicit base, soft and
strict failure) and pin the forged-output case.

* fix(scaffolds): install the @rtCamp config packages from git, not npm

lint/eslint, lint/stylelint and setup/tailwind reported
@rtcamp/eslint-config, @rtcamp/stylelint-config and
@rtcamp/tailwind-config at ^0.1.0. None of the three is on the npm
registry (each returns 404, and the packages are at 1.0.0), so the
reported install failed with E404, and features --enable tailwind
--record-deps wrote that spec into package.json, breaking the project's
next npm install.

Use the git specs the theme and plugin skeletons already install from
(github:rtCamp/wp-tooling#npm/<package>). Verified in a scratch project:
the ^0.1.0 spec fails with E404 and the git spec installs.

* test(features): cover the features CLI end to end and fix two report bugs

The features command (also embedded by the theme init through
runFeatures) had 38% line coverage: nothing exercised argument parsing,
status output, the human report, the interactive flow or the JSON error
path. The new suites run it against the bundled Tailwind feature in
throwaway projects (status, enable, --record-deps, --dry-run, disable
with and without --force, unknown ids, prompts, cancellation, a failing
change) and against a mocked npm for the install success and failure
reports.

They found two bugs, fixed here:
- after a failed npm install, the retry commands put runtime
  dependencies under --save-dev;
- a failed interactive change read 'Failed to enabling <id>'.

* test(add): cover the human report sections and the interactive wizard

The add command sat at 58% line coverage: the interactive wizard
(prompting for missing inputs, confirm, spinner, cancel, dry run) and
most human report sections (composer installs, secrets, wiring,
scaffolded tests, skipped files, warnings, the available-scaffolds list
for an unknown id) never ran in tests. The new suite drives them with
the real Wizard and stubbed prompts.

* test(init): cover the FeatureApi helpers skeleton feature hooks rely on

The theme's Tailwind toggle flips a PHP define through readDefine and
setDefine, and its HMR toggle edits .env.local through readEnv and
setEnv; none of those, nor writeFlag or hasDep, had a test. The new suite
pins reading and writing, that every mutation's journal entry restores
exactly what it changed (including directories a write created), that
remove refuses directories, and that paths cannot leave the project.

Fixes what it found: the key and define name were interpolated into a
regular expression, so a name containing a metacharacter such as '.'
matched other lines. Both are now escaped.

* test: cover manage-mode flags, list CLI errors and the Tailwind webpack hooks

- init manage mode driven by flags, the way CI and AI callers run it
  (--features, --enable, --disable, --yes alone refused, undeclared keys
  rejected), plus the read-only status view (drift, unknown state,
  retired keys);
- wp-tooling list: space-separated flag forms, argument errors, the
  empty table, and a registry that fails to load, in plain and --json
  output;
- tailwind-config: GenerateTailwindThemePlugin.apply(), which wires the
  run, watchRun (skip rebuilds that did not touch theme.json) and
  afterEmit hooks. Its functions go from 60% to 100% covered.

* docs(changelog): restore the wp/cli description escaping note

The merge from main kept the older wording and dropped the entry for the wp/cli description fix that #70 shipped.

* docs(examples): install @rtcamp/eslint-config at ^1.0.0

The package publishes to npm as 1.0.0, and ^0.1.0 only matches versions below 0.2.0.

* fix(ci): export DetectChangesError from @rtcamp/wp-tooling/ci

The class was exported from src/ci/detect-changes.js but not from the ci barrel, so consumers of the documented @rtcamp/wp-tooling/ci entry point could not catch it by type. Adds the export and a test next to the existing GateError one.

* docs(changelog): separate the Unreleased sections

---------

Co-authored-by: Aditya Singh <adityasinghboss1234@gmail.com>
Co-authored-by: Anurag Vasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
aryanjasala added a commit to rtCamp/wp-phpcs that referenced this pull request Oct 1, 2026
* fix(scaffolds): harden generation and tooling

* feat(scaffolds)!: target rtcamp/wp-primitives ^2.0

wp-framework is renamed to wp-primitives in 2.0.0 (rtCamp/wp-primitives#98).
- composer deps and WPPrimitives namespace across templates, tests, snippets
- docs/wp-framework-contract.md renamed to docs/wp-primitives-contract.md
- block JS keeps WordPress spacing; docblock and CHANGELOG follow-ups

* ci: lint and test every pull request and push to main

Nothing ran the suites on a pull request, while every merge to main is
split straight onto the npm/* branches that the skeletons and the shared
workflows install from. A broken merge therefore reached new installs
with no gate in between.

The new workflow runs every workspace lint and Jest suite with coverage
thresholds on Node 22.19 (the engines floor) and 24, and installs and
tests each composer package standalone, the way it ships after the
subtree split, on PHP 8.2, 8.3 and 8.4.

* ci(release): repair diverged mirrors and narrow secret and token scope

Both mirrors already carry a commit the split did not make (an org bot
merged a Copilot review workflow into rtCamp/wp-phpcs and
rtCamp/wp-phpstan on 2026-08-13). The release refuses to fast-forward
over that, so the next tag would fail before reaching Packagist, and the
only way out was a force push that also mints a throwaway tag.

- release-php: add a resync_branch dispatch input that forces just the
  mirror branch back onto the split and pushes no tag, and say exactly
  that in the error when a release does not fast-forward.
- release-php: reference the deploy keys by name instead of
  secrets[matrix.secret_name], which hands the job the whole secrets
  context, and check the secret name before the indirect lookup.
- split-npm-packages: grant contents: write to the split job only.

* chore(composer): add Packagist metadata to wp-phpcs and wp-phpstan

Both packages are about to be submitted to Packagist from their split
mirrors, which are read-only. Point homepage, support.issues and
support.source at the monorepo so the Packagist page sends issues and
contributions to the right place, and name rtCamp as the author.

* fix(detect-changes): add --strict and randomise the GitHub output delimiter

A failed git diff counted as zero changes, which skipped every job gated
on the counts and left the run green. rtCamp/wp-shared-workflows works
around it by grepping stderr. --strict (detectChanges({ strict: true }))
now exits 1 with a DetectChangesError instead; it is off by default so
existing callers see no change, and the stderr keeps the 'git diff
failed' phrase the shared workflow matches.

Multi-line outputs used the fixed heredoc delimiter EOF_WP_TOOLING, but
the file list comes from the pull request: a file named EOF_WP_TOOLING
followed by one named php-count=0 closed the heredoc early and overrode
the real count. Each output now gets a random delimiter that no value
line may equal. coverage-gate shares the formatter and gets the same fix.

New tests run detect-changes against real git repositories (pull request
base, push before-SHA, new-branch fallback, explicit base, soft and
strict failure) and pin the forged-output case.

* fix(scaffolds): install the @rtCamp config packages from git, not npm

lint/eslint, lint/stylelint and setup/tailwind reported
@rtcamp/eslint-config, @rtcamp/stylelint-config and
@rtcamp/tailwind-config at ^0.1.0. None of the three is on the npm
registry (each returns 404, and the packages are at 1.0.0), so the
reported install failed with E404, and features --enable tailwind
--record-deps wrote that spec into package.json, breaking the project's
next npm install.

Use the git specs the theme and plugin skeletons already install from
(github:rtCamp/wp-tooling#npm/<package>). Verified in a scratch project:
the ^0.1.0 spec fails with E404 and the git spec installs.

* test(features): cover the features CLI end to end and fix two report bugs

The features command (also embedded by the theme init through
runFeatures) had 38% line coverage: nothing exercised argument parsing,
status output, the human report, the interactive flow or the JSON error
path. The new suites run it against the bundled Tailwind feature in
throwaway projects (status, enable, --record-deps, --dry-run, disable
with and without --force, unknown ids, prompts, cancellation, a failing
change) and against a mocked npm for the install success and failure
reports.

They found two bugs, fixed here:
- after a failed npm install, the retry commands put runtime
  dependencies under --save-dev;
- a failed interactive change read 'Failed to enabling <id>'.

* test(add): cover the human report sections and the interactive wizard

The add command sat at 58% line coverage: the interactive wizard
(prompting for missing inputs, confirm, spinner, cancel, dry run) and
most human report sections (composer installs, secrets, wiring,
scaffolded tests, skipped files, warnings, the available-scaffolds list
for an unknown id) never ran in tests. The new suite drives them with
the real Wizard and stubbed prompts.

* test(init): cover the FeatureApi helpers skeleton feature hooks rely on

The theme's Tailwind toggle flips a PHP define through readDefine and
setDefine, and its HMR toggle edits .env.local through readEnv and
setEnv; none of those, nor writeFlag or hasDep, had a test. The new suite
pins reading and writing, that every mutation's journal entry restores
exactly what it changed (including directories a write created), that
remove refuses directories, and that paths cannot leave the project.

Fixes what it found: the key and define name were interpolated into a
regular expression, so a name containing a metacharacter such as '.'
matched other lines. Both are now escaped.

* test: cover manage-mode flags, list CLI errors and the Tailwind webpack hooks

- init manage mode driven by flags, the way CI and AI callers run it
  (--features, --enable, --disable, --yes alone refused, undeclared keys
  rejected), plus the read-only status view (drift, unknown state,
  retired keys);
- wp-tooling list: space-separated flag forms, argument errors, the
  empty table, and a registry that fails to load, in plain and --json
  output;
- tailwind-config: GenerateTailwindThemePlugin.apply(), which wires the
  run, watchRun (skip rebuilds that did not touch theme.json) and
  afterEmit hooks. Its functions go from 60% to 100% covered.

* docs(changelog): restore the wp/cli description escaping note

The merge from main kept the older wording and dropped the entry for the wp/cli description fix that #70 shipped.

* docs(examples): install @rtcamp/eslint-config at ^1.0.0

The package publishes to npm as 1.0.0, and ^0.1.0 only matches versions below 0.2.0.

* fix(ci): export DetectChangesError from @rtcamp/wp-tooling/ci

The class was exported from src/ci/detect-changes.js but not from the ci barrel, so consumers of the documented @rtcamp/wp-tooling/ci entry point could not catch it by type. Adds the export and a test next to the existing GateError one.

* docs(changelog): separate the Unreleased sections

---------

Co-authored-by: Aditya Singh <adityasinghboss1234@gmail.com>
Co-authored-by: Anurag Vasanwala <75766877+AnuragVasanwala@users.noreply.github.com>
Adi-ty added a commit that referenced this pull request Nov 3, 2026
Brings in the wp-framework → wp-primitives rename (#98) and the v2.0.0/v2.1.0
releases. composer.json conflict: keep the PR's exclude-from-classmap entries
under main's renamed rtCamp\WPPrimitives\Tests\ autoload-dev namespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants