Skip to content

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

Closed
bz00qa wants to merge 2 commits into
rtk-ai:developfrom
bz00qa:feat/new-commands
Closed

bz00qa wants to merge 2 commits into
rtk-ai:developfrom
bz00qa:feat/new-commands

Conversation

@bz00qa

@bz00qa bz00qa commented Mar 13, 2026

Copy link
Copy Markdown

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 <[email protected]>
Signed-off-by: bz00qa <[email protected]>
@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 <[email protected]>
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 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
@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
Copy Markdown
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.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@aeppling

Copy link
Copy Markdown
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Closing this PR for inactivity — the CLA was never signed and there's been no activity since March. This isn't a judgment on the change itself.

If you'd still like to land it, just sign the CLA (https://cla-assistant.io/rtk-ai/rtk) and ping a maintainer to reopen — happy to pick it back up. Thanks for the contribution!

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.

4 participants