Skip to content

fix(hook): rewrite find before wc line counts - #4079

Open
css521 wants to merge 1 commit into
rtk-ai:developfrom
css521:css521-fix-command-rewriting
Open

css521 wants to merge 1 commit into
rtk-ai:developfrom
css521:css521-fix-command-rewriting

Conversation

@css521

@css521 css521 commented Sep 15, 2026

Copy link
Copy Markdown

Closes #4072

Rewrite find ... | wc -l when the count consumer is exactly wc -l, preserving the existing conservative behavior for other pipeline consumers. Keep standalone head -n <file> rewriting covered by the existing line-range path and regression tests.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: 优胜 <[email protected]>
@CLAassistant

CLAassistant commented Sep 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working hook rewrite labels Sep 15, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

This PR modifies the pipeline command rewriting logic in the command discovery hook to safely rewrite find ... | wc -l pipelines when the consumer is exactly wc -l, instead of leaving such pipelines unrewritten. It adds a new helper function is_find_line_count_consumer and updates/adds tests to cover the new behavior.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4072


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

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

Labels

bug Something isn't working hook rewrite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PreToolUse rewrite misses find ... | wc -l and never maps standalone head -n <file> to rtk read

2 participants