Skip to content

fix(gh): rewrite gh search commands#1518

Open
season179 wants to merge 1 commit intortk-ai:developfrom
season179:fix/gh-search-rewrite
Open

fix(gh): rewrite gh search commands#1518
season179 wants to merge 1 commit intortk-ai:developfrom
season179:fix/gh-search-rewrite

Conversation

@season179
Copy link
Copy Markdown

Summary

  • Rewrite gh search ... commands through rtk gh so hook-based integrations no longer leave GitHub search output raw.
  • Require a real gh subcommand boundary so lookalikes like gh searching or gh repository do not get rewritten.
  • Add regression coverage for gh search repos/issues/prs/code/commits, structured-output passthrough flags, and false-positive subcommand prefixes.

Fixes #1484

Test plan

  • rtk cargo +1.92.0 test test_rewrite_gh_search -- --nocapture
  • rtk cargo +1.92.0 test test_rewrite_gh_search_structured_output_skipped -- --nocapture
  • rtk cargo +1.92.0 test test_rewrite_gh_subcommands_require_word_boundary -- --nocapture
  • rtk cargo +1.92.0 test test_classify_gh_search -- --nocapture
  • rtk cargo +1.92.0 test test_all_patterns_are_valid_regex -- --nocapture
  • rtk cargo +1.92.0 fmt --all -- --check
  • rtk cargo +1.92.0 clippy --all-targets (passes with existing warnings)
  • rtk git diff --check
  • Manual: rtk cargo +1.92.0 run --quiet -- rewrite 'gh search repos foo --limit 5' rewrites to rtk gh search repos foo --limit 5
  • Manual: gh search structured output flags (--json) do not rewrite
  • Manual: false positives like gh searching foo do not rewrite

@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal labels Apr 25, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Adds support for rewriting gh search subcommands (repos, issues, prs, code, commits) through rtk gh by extending the existing regex pattern. Introduces a word boundary check ((?:\s|$)) to prevent false positives on similar-looking subcommands like gh searching. Structured output flags (--json, --template) are correctly skipped from rewriting.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1484


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 effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants