Skip to content

ARCHITECTURE: absorb the CLI into this repo as a published devDependency #8

Description

@Schmandarine

Decided 2026-07-29 (supersedes brmbh/cli#8). The CLI is not retired — its relationship to the theme inverts, and it moves into this repo.

The problem being solved

Everything the CLI does today is copied or frozen at scaffold time, so improvements never reach existing sites. Retiring the CLI into theme-side tools/*.sh does not fix this — copied scripts freeze exactly like copied skills do. The fix is to make the tooling a dependency the theme consumes, rather than files it contains.

Old: CLI (npm) → clones theme (git) → theme is standalone forever after. CLI is upstream and then irrelevant.
New: theme (git, copied/forked) → depends on @brmbh/cli (npm) → stays connected, updatable via npm update.

The rule

Theme = what you own and edit. Package = what you consume and update.

Test for any file: would a client project ever edit this? If no, it belongs in the package.

Stays in the theme Moves into the package
my-acf-blocks/, template-parts/, inc/ tools/deploy.sh, db-*.sh, uploads-*.sh, sync-plugins.sh, version-check.sh
style.css, theme.json, functions.php, SCSS tools/sync-tokens.mjs, tools/sass-with-theme-flags.sh
tools/env/*.env — per-project, gitignored AGENTS/*.md — the 10 in-project skill docs
Client blocks and content doctor, init/create, block + CPT generators
wrapper generation for .claude/ .cursor/ .windsurf/

The deploy scripts already read only exported shell vars (see the 2026-07-13 env-loading fix), so they move cleanly while the env files they consume stay per-project.

Target layout — one repo, two artifacts

brmbh/wordpress/
├── skills.sh.json          ← npx skills add brmbh/wordpress keeps working
├── skills/wordpress/       ← pre-scaffold skill (the marketing entry point)
├── packages/cli/           ← published to npm as @brmbh/cli
│   ├── AGENTS/             ← the 10 in-project skills live HERE now
│   └── tools/              ← deploy, db, doctor, generators
└── (theme at root)         ← style.css, functions.php, my-acf-blocks/, inc/ …

git clone of this repo still yields a working theme. packages/ is stripped from scaffolds by the personalization step (#4).

Why this makes skills updatable

If AGENTS/*.md ships inside the npm package instead of being copied into each site, npm update @brmbh/cli updates the skills. The .claude/ .cursor/ .windsurf/ wrappers become generated artifacts pointing at node_modules/@brmbh/cli/AGENTS/<name>.md — gitignored, regenerated on install.

Three tracked problems dissolve: brmbh/cli#3 (no refresh path), #3 here (committed wrappers already drifted), and the whole "which copy is canonical" question in #2 / brmbh/cli#5 / brmbh/cli#6.

Projects that need a tweaked skill get a local AGENTS/ override that wins over the package copy — so one customized skill does not cost you updates to the other nine.

The flow end to end

  1. npx skills add brmbh/wordpress — marketing entry, unchanged
  2. User: "make a new brmbh theme"
  3. Skill runs npx @brmbh/cli create my-site — no global install; npx fetches latest on demand
  4. create copies the theme, renames it (65 strings — Theme should declare its own scaffold contract so the CLI can personalize it #4 / create: scaffolded theme keeps the starter's identity (name, text domain, package name) cli#1), writes "@brmbh/cli": "^1.0.0" into the new theme's devDependencies, runs npm install, generates wrappers, builds, activates
  5. Forever after: npx brmbh <cmd> hits the pinned local copy; npm update @brmbh/cli pulls new tooling and new skills

The package is used twice — transiently via npx to scaffold, then permanently as a devDependency.

Free bug fix

npx @brmbh/cli currently fails with "could not determine executable to run" because the package declares two bins (brmbh, create-brmbh). Drop the create-brmbh bin — with a single bin npx runs it regardless of name, so npx @brmbh/cli create my-site works. This also retires the npx create-brmbh 404 by deletion instead of by publishing a second package, closing Alignment Plan item 1.

Decided sub-questions

  • Wrapper generation: postinstall plus an explicit npx brmbh skills sync fallback (postinstall can be skipped with --ignore-scripts). The pre-scaffold skill calls the explicit command after scaffolding.
  • Zero-npm-install clone: no longer fully functional — deploy and db sync will require npm install first. Accepted: npm install is already required for the CSS build. Must be stated in the README rather than discovered.

Migration order

Blocks / supersedes

Supersedes brmbh/cli#8. Dissolves brmbh/cli#3, brmbh/cli#5, brmbh/cli#6, #2, #3. Relocates brmbh/cli#1, brmbh/cli#2, brmbh/cli#7 into this repo. #4, #5, #6, #7 stay valid and unaffected.

Vault: Automatic-Brain/Projects/brmbh-agentic-wp-suite/dashboard.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions