Skip to content

pnpm test / pnpm build are not routed, only pnpm run <script> #3675

Open

Description

@dwin-gharibi

Type: Enhancement (coverage gap) · Severity: Low–Medium · Area: src/discover/rules.rs

Summary

pnpm runs a bare script name directly — pnpm test is pnpm run test — and that shorter form is
what people actually type. The rule only matched ^pnpm\s+(exec|i|install|list|ls|outdated|run|run-script),
so pnpm test, pnpm build, pnpm lint fell through while pnpm run build was routed.

A second, smaller problem

The rule had no trailing word boundary, so pnpm installer matched on the install alternative
and was rewritten. Adding (\s|$) fixes that.

Not every script is safe to route

pnpm dev, pnpm start, pnpm serve and pnpm watch do not terminate. rtk captures child
output rather than streaming it, so routing a long-running script would leave the agent with a
blank screen until it gives up. Those are deliberately excluded.

Environment

  • rtk 0.42.4 (develop @ 29f9bb7)

Activity

  1. added
    bug
    good first issue
    on Aug 23, 2026
  2. pszymkowiak commented on Aug 23, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 85%

    Summary

    pnpm's bare script forms (pnpm test/build/lint) aren't routed and the install alternative lacks a word boundary (falsely matches pnpm installer); fix is in src/discover/rules.rs and a PR (#3676) already addresses it.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/discover/rules.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. KennyAtCodin commented on Sep 16, 2026

    @KennyAtCodin

    Still reproduces on rtk 0.48.0 (Windows 11, Claude Code hook). This goes beyond test/build: monorepos run project-specific scripts that the hook never recognises. From rtk discover over 30 days (81 sessions, 4,769 Bash commands) in one TypeScript monorepo:

    Command Count
    pnpm --filter <pkg> run <script> 117
    pnpm test 43
    pnpm type-check 39
    pnpm format:check 39
    pnpm docs:check 36

    rtk hook check 'pnpm type-check 2>&1' gives No rewrite for: pnpm type-check 2>&1, while pnpm lint 2>&1 is rewritten to rtk lint. Script names with - or : and the --filter <pkg> run form both fall through.

    Suggestion: route any terminating script to the generic rtk err filter instead of keeping a per-name allow-list, and keep excluding the long-running ones you already listed (dev, start, serve, watch). Config-driven routing (closed #2358) would also cover this, letting a project map type-check to tsc and test to jest.

  4. HenryQW commented on Sep 24, 2026

    @HenryQW
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

    area:clibuggood first issuepriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions