Skip to content

feat: bug: hook rewrite of pnpm lint discards package.json script - #2776

Closed
wilmerdooley wants to merge 1 commit into
rtk-ai:developfrom
wilmerdooley:oss/issue-2094
Closed

wilmerdooley wants to merge 1 commit into
rtk-ai:developfrom
wilmerdooley:oss/issue-2094

Conversation

@wilmerdooley

Copy link
Copy Markdown

Resolves #2094.

The PreToolUse hook rewrites pnpm lint → rtk lint, discarding the body of the project's package.json lint script. For projects whose script enforces flags eslint doesn't default to (e.g. --max-warnings 0) or chains commands (e.g. pnpm check:foo && eslint ...), the rewritten rtk lint invokes eslint with defaults and exits 0 even when the original pnpm lint would have exited 1.

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@aeppling

aeppling commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hey @wilmerdooley

This is related to issues #2663 and #2094

Two related PR that both address a temporary fix :

The issue is at a higher level, and maintaining those hard coded lists is not a correct solution.

Proposed fix :

  • npm: forward the args untouched. npm build then fails exactly as it would without RTK, that's the agent's own command, and it self-corrects to npm run build. npm query, npm add, npm sbom, and anything npm adds in future just work. NPM_SUBCOMMANDS gets deleted.
  • lint: run the real pnpm lint (the actual script, with its real flags, chain, and exit code) and route its output through the lint filter, don't rebuild an eslint invocation. The invocation allowlist gets deleted.

This fixes both issues at the root, removes both lists (no more chasing npm versions or package-manager forms), and keeps every exit code faithful.

#2776 currently drops pnpm lint to raw with no filter (0% savings), running it verbatim and filtering the output preserves the gain.

@KuSh

KuSh commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Closing this in favour of #2860, which fixes #2094 by dropping lint from the lint rule while still wrapping pnpm lint as rtk pnpm lint, so the script keeps its own flags and exit code, and it has tests and green CI. If you think pnpm run eslint style script names should also leave rtk lint, please raise it on #2860 or reply here.

@KuSh KuSh closed this Sep 26, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: hook rewrite of pnpm lint discards package.json script body — same false-green as #185 at the hook layer

3 participants