Skip to content

hook: pre-commit gate fails under Yarn Plug'n'Play (npx charter can't resolve the PnP binary) #366

Closed

Description

@stackbilt-admin

Found in review of #365.

Since #365, the generated pre-commit gate always runs npx charter doctor --adf-only --ci --staged … first, before <pm> run verify:adf. Under Yarn Plug'n'Play (no node_modules), npx cannot resolve the PnP-installed charter binary. It falls back to PATH and then to the unrelated registry package charter (0.0.2, which has no bin), so the gate fails before yarn run verify:adf is reached. The hook has always invoked npx charter for tidy too, so PnP support was partly missing before #365 as well.

Fix: resolve the CLI through the repo's package manager. Use yarn charter / yarn exec charter under PnP, pnpm exec / npm exec elsewhere, with the same lockfile + PATH detection #365 added for verify:adf, and apply it to every CLI call in the hook. Add an integration test with a Yarn berry PnP fixture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions