Skip to content

feat(flutter): add Flutter command filters - #669

Closed
copperspeed wants to merge 15 commits into
rtk-ai:developfrom
copperspeed:feat/flutter/add-flutter-command-filters
Closed

copperspeed wants to merge 15 commits into
rtk-ai:developfrom
copperspeed:feat/flutter/add-flutter-command-filters

Conversation

@copperspeed

@copperspeed copperspeed commented Mar 17, 2026 •

Copy link
Copy Markdown

Summary

  • Adds rtk flutter test -- suppresses passing progress lines, short-circuits to [PASS] All tests passed on clean runs, shows failure blocks with assertion details (~90% token reduction)
  • Adds rtk flutter analyze -- keeps only warning - and error - lines, suppresses info - lines and headers (~80% token reduction)
  • Adds rtk flutter build -- keeps only the final result line or error diagnostics (~85% token reduction)
  • Adds rtk flutter pub -- strips download noise, keeps Got dependencies! summary and compatibility warnings (~70% token reduction)

Before / After

flutter test (passing, 6 lines -> 1 line):

# Before
00:00 +0: loading D:/dev/project/test/file_test.dart
00:01 +1: TsIconSize - constants compact is 20
00:01 +1: TsIconSize - constants standard is 24
00:02 +20: All tests passed!

# After
[PASS] All tests passed

flutter analyze (5 lines -> 2 lines):

# Before
Analyzing tradesmen...
warning - Dead code - lib/features/auth/...:60:50 - dead_code
warning - The left operand can't be null - lib/features/auth/...:60:53 - dead_null_aware_expression
   info - Unnecessary use of multiple underscores - test/...:113:11 - unnecessary_underscores

# After
warning - Dead code - lib/features/auth/...:60:50 - dead_code
warning - The left operand can't be null - lib/features/auth/...:60:53 - dead_null_aware_expression

flutter pub get (8 lines -> 2 lines):

# Before
Resolving dependencies...
Downloading packages...
  _fe_analyzer_shared 85.0.0 (98.0.0 available)
  flutter_riverpod 2.6.1 (3.3.1 available)
  ...
Got dependencies!
36 packages have newer versions incompatible with dependency constraints.

# After
Got dependencies!
36 packages have newer versions incompatible with dependency constraints.

Implementation notes

  • Filter functions follow the same pattern as pytest_cmd.rs (plain text parsing, no JSON)
  • Flutter test uses the compact reporter format (HH:MM +N: / HH:MM +N -M: prefix detection)
  • Flutter analyze uses - separator; summary line comes from stderr
  • Fixtures captured from real Flutter 3.x project output (compact test reporter)
  • Command registered in src/main.rs with FlutterCommands subcommand enum
  • Rewrite rule added to src/discover/rules.rs

Test plan

  • rtk flutter test on passing suite -> single [PASS] All tests passed line
  • rtk flutter test with failing test -> failure block only, no progress lines
  • rtk flutter analyze with warnings and info -> warnings shown, info suppressed
  • rtk flutter analyze clean -> [PASS] No issues found
  • rtk flutter build apk -> final built line only
  • rtk flutter pub get -> summary + compat warning only
  • rtk rewrite "flutter test" -> prints rtk flutter test
  • cargo test flutter -> 22 unit tests pass

Generated with Claude Code

pszymkowiak and others added 15 commits March 16, 2026 14:58
* fix: P1 exit codes, grep regex perf, SQLite concurrency

Exit code propagation (same pattern as existing modules):
- wget_cmd: run() and run_stdout() now exit on failure
- container: docker_logs, kubectl_pods/services/logs now check
  status before parsing JSON (was showing "No pods found" on error)
- pnpm_cmd: replace bail!() with eprint + process::exit in
  run_list and run_install

Performance:
- grep_cmd: compile context regex once before loop instead of
  per-line in clean_line() (was N compilations per grep call)

Data integrity:
- tracking: add PRAGMA journal_mode=WAL and busy_timeout=5000
  to prevent SQLite corruption with concurrent Claude Code instances

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>

* fix: address review findings on P1 fixes

- tracking: WAL pragma non-fatal (NFS/read-only compat)
- wget: forward raw stderr on failure, track raw==raw (no fake savings)
- container: remove stderr shadow in docker_logs, add empty-stderr
  guard on all 4 new exit code paths for consistency with prisma pattern

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>

---------

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>
… (rtk-ai#630)

* fix: raise output caps for grep, git status, and parser fallback (rtk-ai#617, rtk-ai#618, rtk-ai#620)

- grep: per-file match cap 10 → 25, global max 50 → 200
- git status: file list caps 5/5/3 → 15/15/10
- parser fallback: truncate 500 → 2000 chars across all modules

These P0 bugs caused LLM retry loops when RTK returned less signal
than the raw command, making RTK worse than not using it.

Fixes rtk-ai#617, rtk-ai#618, rtk-ai#620

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>

* fix: update README example and add truncation tests for modified/untracked

- parser/README.md: update example from 500 → 2000 to match code
- git.rs: add test_format_status_modified_truncation (cap 15)
- git.rs: add test_format_status_untracked_truncation (cap 10)

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>

* refactor: extract output caps into [limits] config section

Move hardcoded caps into config.toml so users can tune them:

  [limits]
  grep_max_results = 200      # global grep match limit
  grep_max_per_file = 25      # per-file match limit
  status_max_files = 15       # staged/modified file list cap
  status_max_untracked = 10   # untracked file list cap
  passthrough_max_chars = 2000 # parser fallback truncation

All 8 modules now read from config::limits() instead of hardcoded
values. Defaults unchanged from previous commit.

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>

---------

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>
…es (rtk-ai#662)

* feat(.claude): add /rtk-triage skill — orchestrated PR+issue cross-analysis

New skill that runs issue-triage + pr-triage in parallel then produces
a cross-analysis layer that neither skill can do individually:

- Double coverage detection: identifies when 2+ PRs target the same issue
  (via body scan + file overlap), recommends which to keep/close
- Security gap detection: for security review issues, maps each finding
  to a PR (or flags it as uncovered)
- P0/P1 bugs without PR: groups by pattern to suggest sprint batching
- Our dirty PRs: identifies probable cause (conflict with sibling PR,
  needs rebase, missing linked issue)

Output is saved automatically to claudedocs/RTK-YYYY-MM-DD.md.

Usage: /rtk-triage           (French, auto-save)
       /rtk-triage en        (English output)

Signed-off-by: Florian Bruniaux <[email protected]>
Signed-off-by: Florian BRUNIAUX <[email protected]>

* docs(architecture): update module count to 66

Sync ARCHITECTURE.md with current main.rs state.
Previous count (60) was stale since several modules were added
(dotnet_cmd, dotnet_format_report, dotnet_trx, npm_cmd, gt_cmd, etc.).

Signed-off-by: Florian Bruniaux <[email protected]>
Signed-off-by: Florian BRUNIAUX <[email protected]>

---------

Signed-off-by: Florian Bruniaux <[email protected]>
Signed-off-by: Florian BRUNIAUX <[email protected]>
…tk-ai#601)

- git stash: pass unknown subcommands (save, branch, clear) through
  instead of silently falling back to git stash push
- git branch: add --show-current, --set-upstream-to, --format, --sort
  to flag detection so they don't get overridden by -a injection
- pip: replace bail!() with passthrough for unknown subcommands
  (freeze, download, wheel, etc.)

Fixes rtk-ai#600

Signed-off-by: Patrick szymkowiak <[email protected]>
cargo fmt diffs in config.rs, git.rs, playwright_cmd.rs were failing
the fmt CI check, which cascaded to block clippy/test/security on
PRs rtk-ai#632, rtk-ai#635, rtk-ai#638. Also fixes all clippy warnings: dead code
annotations, iterator simplifications, assert patterns, and
unnecessary allocations.

Signed-off-by: Patrick Szymkowiak <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>
…#163) (rtk-ai#518)

* fix: discover classifies absolute paths like /usr/bin/grep (rtk-ai#485)

Normalize absolute binary paths before classification:
/usr/bin/grep → grep, /bin/ls → ls, /usr/local/bin/git → git

Adds strip_absolute_path() helper + 5 tests.

Signed-off-by: Patrick szymkowiak <[email protected]>

* fix: discover and rewrite support git global options -C, --no-pager, etc. (rtk-ai#163)

Strip git global options (-C <path>, -c <key=val>, --git-dir, --work-tree,
--no-pager, --no-optional-locks, --bare, --literal-pathspecs) before
classification so git -C /tmp status is recognized as rtk git.

Rewrite preserves global options: git -C /tmp status → rtk git -C /tmp status

Adds GIT_GLOBAL_OPT lazy_static regex + strip_git_global_opts() helper + 6 tests.

Signed-off-by: Patrick szymkowiak <[email protected]>

---------

Signed-off-by: Patrick szymkowiak <[email protected]>
…-ai#519)

When running `rtk cargo clippy -p my-crate -- -D warnings`, Clap with
`trailing_var_arg = true` preserves the `--` in parsed args when flags
precede it. `restore_double_dash()` then added a second `--`, producing
`cargo clippy -p my-crate -- -- -D warnings`. This caused rustc to
interpret `-D` as a filename instead of a lint flag.

Fix: skip restoration when args already contain `--` (Clap preserved it).

Fixes rtk-ai#496

Signed-off-by: Ousama Ben Younes <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
- PR template reminds contributors to target develop
- CI workflow labels PRs targeting master with 'wrong-base' and posts a comment
- Excludes develop→master PRs (maintainer releases)

Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick szymkowiak <[email protected]>
Add Language::Data variant for data formats (JSON, YAML, TOML, XML, CSV, etc.)
with empty comment patterns to prevent comment stripping. AggressiveFilter
falls back to MinimalFilter for data files.

Fixes rtk-ai#464

Signed-off-by: Ousama Ben Younes <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
…tk-ai#439) (rtk-ai#563)

rtk find outputs a grouped format incompatible with pipe consumers
like xargs, grep, wc, sort. Skip rewrite when find/fd is followed
by a pipe, preserving native one-per-line output.

Signed-off-by: Patrick szymkowiak <[email protected]>
…gh (rtk-ai#427) (rtk-ai#564)

When compact_diff truncates output, append a hint line so Claude knows
how to get the full diff: [full diff: rtk git diff --no-compact]

Also fix --no-compact flag being passed to git (causing usage error)
and remove decorative emoji from compact_diff output.

Signed-off-by: Patrick szymkowiak <[email protected]>
rtk-ai#632)

4 P1 bugs where git exit codes were swallowed:
- git diff: failure silently printed empty stat output
- git status (with args): failure was filtered instead of propagated
- git commit: failure printed "FAILED" but returned Ok(()) breaking pre-commit hooks
- git branch (list mode): failure was silently ignored

All now follow the established pattern: eprint stderr, track raw==raw, process::exit(code).

Signed-off-by: Patrick szymkowiak <[email protected]>
…tk-ai#635)

* feat: add 5 new TOML built-in filters (ollama, nx, gradle, spring-boot, jira)

New filters for commands not covered by Rust modules:
- ollama: strip ANSI spinners, keep final text response (rtk-ai#624)
- nx: strip Nx monorepo noise, keep build results (rtk-ai#444)
- gradle/gradlew: strip UP-TO-DATE tasks, keep build summary (rtk-ai#147)
- spring-boot: strip banner and verbose logs, keep startup/errors (rtk-ai#147)
- jira: strip blanks, truncate wide columns (rtk-ai#524)

All 5 filters pass inline tests via rtk verify (123/123).
Updated builtin filter count: 47 -> 52.

Signed-off-by: Patrick szymkowiak <[email protected]>

* feat: add 5 more TOML filters (turbo, mise, just, task, yadm)

New filters for task runners and git wrapper:
- turbo: strip cache/Tasks/Duration noise, keep task output (rtk-ai#531)
- mise: strip install/download progress, keep task results (rtk-ai#607)
- just: strip blanks and recipe headers, keep output (rtk-ai#607)
- task: strip task headers and up-to-date lines, keep results (rtk-ai#607)
- yadm: strip hint lines, compact git-like output (rtk-ai#567)

All verified with fake binaries through catch-all TOML engine.
137/137 TOML tests pass, 934 Rust tests pass.
Updated builtin filter count: 52 -> 57.

Signed-off-by: Patrick szymkowiak <[email protected]>

---------

Signed-off-by: Patrick szymkowiak <[email protected]>
…rtk-ai#638)

Git status output used emojis (📌, 📝, ❓, ✅, ⚠️) that confuse
non-Claude LLMs (GPT, etc.) causing retry loops. Replace with plain
text labels (branch:, modified:, staged:, untracked:, conflicts:).

Also add "clean — nothing to commit" when working tree is clean,
so LLMs understand the repo state without ambiguity.

Before: 📌 master
After:  branch: master
        clean — nothing to commit

Fixes rtk-ai#603

Signed-off-by: Patrick szymkowiak <[email protected]>
@CLAassistant

CLAassistant commented Mar 20, 2026 •

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 all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ pszymkowiak
✅ ousamabenyounes
✅ FlorianBruniaux
❌ copperspeed
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

Hi @copperspeed! Solid work — the filters are clean, fixtures are real, and savings claims are well-argued. Three things before we can merge:

  1. Sign the CLA — https://cla-assistant.io/rtk-ai/rtk
  2. Rebase on current develop — your branch is pre-feat(refacto-codebase-onboarding): partie 1 - folders and technical docs #826 (the src/ reorg), which is why the diff shows ~50 files of noise. After rebase only the flutter additions should appear.
  3. Module placement — please move src/flutter_cmd.rs to src/cmds/dart/flutter_cmd.rs + create src/cmds/dart/mod.rs with automod::dir!(pub "src/cmds/dart");. Update imports in main.rs, discover/rules.rs, discover/registry.rs accordingly.

Once those are sorted we'll merge. Thanks!

@KuSh

KuSh commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Closing this one in favour of #2456, which covers the same flutter filtering plus dart, applies to the current source layout and has its CLA signed. This branch was written against the old flat src layout and carries 57 unrelated files alongside the flutter work. Review and follow-up on the flutter filters are welcome on #2456.

@KuSh KuSh closed this Sep 6, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants