Skip to content

feat: add context, watch, dedup output filtering commands#553

Open
bz00qa wants to merge 2 commits intortk-ai:developfrom
bz00qa:feat/new-commands
Open

feat: add context, watch, dedup output filtering commands#553
bz00qa wants to merge 2 commits intortk-ai:developfrom
bz00qa:feat/new-commands

Conversation

@bz00qa
Copy link

@bz00qa bz00qa commented Mar 13, 2026

Summary

  • rtk context: Combined git status + diff + log in a single call with session dedup — prints one-liner if output unchanged since last call, reducing round-trip overhead for LLMs
  • rtk watch <cmd>: Runs command and shows only changed lines since last run (resolved/new), ideal for iterative test-fix workflows
  • rtk dedup [cmd]: Deduplicates noisy output (compile lines, npm warnings, pip satisfied, progress bars) — reads from stdin or runs command directly
  • rtk watch-clear: Resets watch diff history
  • rtk proxy -f: New --filter flag applies auto-filter pipeline to proxy output for generic noise reduction

Infrastructure

  • dedup.rs: 20+ noise pattern regexes covering Cargo, npm/pnpm, pip, Go, Vite/Webpack/Turbo, progress bars/spinners with consecutive-line collapsing and identical-line dedup
  • auto_filter.rs: Multi-stage filter pipeline — ANSI strip → CR overwrite strip → decorative separator strip → noise dedup → identical dedup → smart truncate (head+tail preservation, skip truncation on failure to preserve error context)

Tests

27 new tests across all modules covering edge cases, token savings verification, and diff computation.

Test plan

  • cargo fmt --all passes
  • cargo clippy --all-targets passes (no new warnings)
  • cargo test — 914 passed, 27 new tests all green
  • Manual: rtk context in a git repo shows combined status/diff/log
  • Manual: rtk watch cargo test shows full output first run, diff on subsequent runs
  • Manual: rtk dedup with piped build output collapses noise lines
  • Manual: rtk proxy -f <cmd> applies auto-filter to output

🤖 Generated with Claude Code

New commands:
- `rtk context`: combined git status + diff + log in one call with
  session dedup (prints one-liner if output unchanged since last call)
- `rtk watch <cmd>`: runs command and shows only what changed since
  last run (resolved/new lines), great for iterative test workflows
- `rtk dedup [cmd]`: deduplicate noisy command output (compile lines,
  npm warnings, pip satisfied, progress bars) — reads from stdin or
  runs command
- `rtk watch-clear`: reset watch diff history

Infrastructure:
- dedup.rs: 20+ noise pattern regexes (Cargo, npm, pip, Go, Vite,
  progress bars) with consecutive-line collapsing and identical-line
  dedup
- auto_filter.rs: multi-stage filter pipeline (ANSI strip → CR
  overwrite strip → decorative separator strip → noise dedup →
  identical dedup → smart truncate with head+tail preservation)
- `rtk proxy -f`: new --filter flag applies auto_filter pipeline to
  proxy output for generic noise reduction

27 new tests across all modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: bz00qa <bz00qa.hub@gmail.com>
@bz00qa bz00qa force-pushed the feat/new-commands branch from 70b9a54 to 8539b94 Compare March 13, 2026 16:36
@bz00qa bz00qa changed the base branch from master to develop March 13, 2026 16:36
bz00qa added a commit to bz00qa/rtk_fork that referenced this pull request Mar 13, 2026
…docs and tests

Remove scope creep from PR rtk-ai#550:
- Restore rules.rs/registry.rs to develop baseline, keep only in-scope changes
- Remove strip_verbose_flags(), proxy -f routing, expanded subcommands
- Remove bun/deno/bunx from COMMAND_REGISTRY (unmerged PR rtk-ai#548)
- Remove context/watch/dedup from COMMAND_REGISTRY (non-existent PR rtk-ai#553)
- Remove detect_patterns() and normalize_cmd_base() (deferred)
- Remove PatternOpportunity from report

Add missing tests: consumer_base(), effective_idx
Add docs: CHANGELOG.md, README.md gain section, ARCHITECTURE.md discover module
Fix clippy warnings in new test code (vec![] → array, single_match)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Carve out the proxy --filter enhancement to keep this PR focused on
the new context, watch, and dedup commands. The auto_filter module
was only used by proxy --filter and is removed entirely.

Add CHANGELOG.md and README.md documentation for the new commands.

Signed-off-by: bZ00qa <167500396+bz00qa@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bz00qa bz00qa changed the title feat: add context, watch, dedup commands and auto-filter pipeline feat: add context, watch, dedup output filtering commands Mar 13, 2026
@pszymkowiak
Copy link
Collaborator

This PR has merge conflicts with develop. Please rebase:

git fetch upstream develop
git rebase upstream/develop
git push --force-with-lease

Labeling awaiting-changes until conflicts are resolved.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants