Skip to content

feat(wbfy): unify generated command forms by target kind - #1217

Merged
exKAZUu merged 6 commits into
mainfrom
exKAZUu/unify-command-prefix-rules
Aug 10, 2026
Merged

feat(wbfy): unify generated command forms by target kind#1217
exKAZUu merged 6 commits into
mainfrom
exKAZUu/unify-command-prefix-rules

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Aug 10, 2026

Copy link
Copy Markdown
Member

Customer Summary

  • Commands that wbfy writes into managed repositories (package.json scripts, git hooks, CI workflows, and agent instructions) now follow one predictable form per kind of tool, so the same command works whether it runs in a hook, in CI, or typed in a terminal.
  • No behavior changes for end users: every command still runs the same tool the same way; only the spelling is unified. Repositories pick up the new forms automatically on their next wbfy run.

Technical Summary

  • Documented the canonical rule in docs/expected-repository-rules.md: package scripts are invoked as bun run <script>, node_modules bins as bun <bin>, and tools outside node_modules (mise-managed) bare — plus the operational constraint that no package script may share a bin's name (bun <name> prefers the script).
  • Canonicalized every generator to the rule:
    • selfContainedWorkflow.ts: bun run playwright install…bun playwright install…; node node_modules/semantic-release/bin/…bun semantic-release (Bun respects the bin's Node shebang, so it still runs under real Node).
    • packageJson.ts: generated prepare uses bun lefthook install || true; the managed postinstall segment is now bun wb gen-code instead of bare wb gen-code.
    • lefthook.ts: post-merge hooks use bun wb prisma deploy/generate; the cleanup fallback uses bun sort-package-json (dropping a -- terminator Bun strips when it is the first argument); deleted the provably unreachable oxfmt/prettier/oxlint blocks in that fallback (reached only when the repo has no JS/TS/Java, so those blocks could never be emitted).
    • agents.ts: generated agent instructions invoke the verify/verify-full package scripts as bun run verify/bun run verify-full; the checked-in generated files (AGENTS.md, CLAUDE.md, GEMINI.md, .cursor/rules/general.mdc) were regenerated to match.
  • This repo's own package.json prepare was updated to the canonical output.

Why

  • Generated commands previously mixed four spellings for the same kind of target (bun wb, bun run playwright, bare lefthook, node node_modules/.bin/*), so correctness depended on which context a command ran in and hand-fixed forms were reverted on the next wbfy run. One form per target kind keeps every generated command copy-pasteable and context-independent, and matches wbfy's one-canonical-format philosophy.
  • Runtime safety was verified empirically: bun <bin> resolves the bin regardless of PATH, respects #!/usr/bin/env node shebangs (semantic-release still sees real Node), and fails cleanly when the bin is absent (|| true still covers production installs).

Testing

  • bun verify-full passed (exit 0) after each change set.
  • bun test packages/wbfy/test/unit — 363 tests, 0 failures.
  • Scratch-package experiments confirmed: shebang handling under bun <bin>, first-argument -- stripping, script-over-bin shadowing, and clean failure for missing bins.
  • Three rounds of multi-agent review (Codex, Claude Code, Antigravity) converged with no remaining concerns.

🤖 Generated with Claude Code

Canonicalize every generated command to one form per target kind:
package scripts as `bun run <script>`, node_modules bins as
`bun <bin>`, and tools outside node_modules bare. This removes the
remaining deviations: `bun run playwright install…` in self-contained
workflows and the bare `lefthook install` in the generated `prepare`
script. Document the rule (including the no-script-shadowing-a-bin
constraint) in docs/expected-repository-rules.md.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a unified command execution strategy for the wbfy generator. By canonicalizing how commands are invoked across package scripts, CI workflows, and build hooks, it ensures predictable behavior and avoids conflicts between package scripts and installed binaries. The changes improve consistency across the repository's tooling infrastructure.

Highlights

  • Command Canonicalization: Standardized generated command forms across all contexts: 'bun run <script>' for package scripts, 'bun ' for node_modules binaries, and bare commands for external tools.
  • Playwright Workflow Update: Updated Playwright installation steps in CI workflows to use 'bun playwright' instead of 'bun run playwright' to correctly invoke the binary.
  • Lefthook Integration: Updated 'prepare' scripts in package.json and the wbfy generator to use 'bun lefthook' for consistency.
  • Documentation: Added a new rule to 'docs/expected-repository-rules.md' regarding the preference of package scripts over binaries when naming conflicts occur.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


Commands aligned in a row, From scripts to bins they flow. With Bun as the guide, No conflicts inside, And tools now have room to grow.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request standardizes command execution formats across package scripts, workflows, and documentation. It updates docs/expected-repository-rules.md to specify that package scripts should be run via bun run <script> and node_modules binaries via bun <bin>. Accordingly, the prepare script now uses bun lefthook install, and Playwright commands in workflows are simplified from bun run playwright to bun playwright. Unit tests have been updated to match these changes. There are no review comments, and I have no feedback to provide.

exKAZUu and others added 5 commits August 10, 2026 17:03
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Review found three generator sites still violating the newly documented
command-form rule: the bare `wb gen-code` postinstall segment, lefthook's
`node node_modules/.bin/*` invocations (oxfmt, prettier, oxlint,
sort-package-json, and the post-merge `wb prisma` hooks), and the release
workflow's direct `node node_modules/semantic-release/bin/…` call. All now
use the canonical `bun <bin>` form; `bun <bin>` respects the bins' Node
shebang, so semantic-release still runs under real Node.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Bun strips a `--` appearing as the first argument after the bin name, so
the terminator never reached sort-package-json after the `bun <bin>`
migration; remove it instead of shipping a token that reads as a guard
but does nothing.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The lefthook cleanup fallback is reached only when the repository has no
JS/TS and no Java, so its hasJsOrTs/hasJava blocks (oxfmt, prettier,
oxlint) could never be emitted; delete them instead of carrying inert
template code. Generated agent instructions invoked the wbfy-generated
`verify`/`verify-full` package scripts as bare `bun verify`, violating
the documented `bun run <script>` form; switch the generator and the
checked-in generated files to `bun run verify`/`bun run verify-full`.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Aug 10, 2026
@exKAZUu
exKAZUu merged commit b0e01e2 into main Aug 10, 2026
5 checks passed
@exKAZUu
exKAZUu deleted the exKAZUu/unify-command-prefix-rules branch August 10, 2026 09:30
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.

1 participant