feat: add yarn workspace command with smart filter routing#226
Open
denneulin wants to merge 7 commits intortk-ai:masterfrom
Open
feat: add yarn workspace command with smart filter routing#226denneulin wants to merge 7 commits intortk-ai:masterfrom
denneulin wants to merge 7 commits intortk-ai:masterfrom
Conversation
…plate filtering - Add yarn_cmd.rs with run() for workspace command execution - Implement filter_yarn_output() stripping YN-prefixed, resolution/fetch/link, classic boilerplate - Add 7 unit tests covering clean output, YN prefix, resolution steps, empty, classic, mixed, and token savings - Add mod yarn_cmd declaration in main.rs for compilation - Follow npm_cmd pattern: capture output, filter stdout, pass stderr, track tokens, tee on failure, preserve exit codes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… parsing tests - Add mod yarn_cmd declaration (alphabetical after wget_cmd) - Add Commands::Yarn variant with trailing_var_arg and allow_hyphen_values - Add match arm routing to yarn_cmd::run() with verbose and skip_env - Add 5 Clap parsing tests: basic, scoped package with slash, without run, extra args, simple package Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ross-module access - Make filter_tsc_output pub(crate) in tsc_cmd.rs - Make filter_generic_lint pub(crate) in lint_cmd.rs - Make extract_test_summary pub(crate) in runner.rs - Add FilterRoute enum, PREFIX_EXCLUSIONS, route_script(), apply_filter() to yarn_cmd.rs - apply_filter includes panic catch_unwind and empty-output guard for graceful degradation
…with tracking labels and tests - Replace passthrough-only filtering with capture+strip+route+filter pattern - Add "ok checkmark" guard to skip routing when all output is boilerplate - Routing-aware tracking labels: "vitest (via yarn workspace)" for routed, "yarn workspace (passthrough)" for unrouted - Add 11 comprehensive tests: 4 routing, 5 apply_filter integration, 1 guard, 1 end-to-end - Fix clippy suggestion: use PREFIX_EXCLUSIONS.contains() instead of iter().any()
- Check exit code after command execution, before filter routing - Failed yarn commands now print raw stdout/stderr without filter processing - Tee raw output and track with "(failed)" label on failure path - Move exit_code extraction before routing to share variable with safety net - Prevents misleading "TypeScript compilation completed" on yarn errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test_failed_command_should_not_route_to_filter: proves tsc filter masks yarn errors without early-exit - test_successful_command_still_routes_through_filters: verifies happy path (strip/route/filter) is unchanged - 20 yarn_cmd tests total (18 existing + 2 new), full suite 437 pass Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
rtk yarn workspace <pkg> [run] <script>command that strips yarn boilerplate and routes script outputthrough existing specialized filters for maximum token savings.
headers (
yarn run v1.x,Done in Xs,infolines). Returnsok ✓when output is pure boilerplate.vitest→ vitest parser,tsc/typecheck→ tsc filter,lint/lint:*→ generic lint filter,prettier/format→ prettier filter,test/test:*→ test runner summarytest:e2e,test:playwright,test:cypress,lint:fix→passthrough)
catch_unwindon filter panics, empty-output guard, fallback to stripped outputwith stderr warning
without routing through filters (prevents error masking)
Changes
src/yarn_cmd.rsfilter_yarn_output(),route_script(),apply_filter(),run()+ 25 testssrc/main.rsCommands::Yarnwithtrailing_var_arg+ 5 Clap parsing testssrc/lint_cmd.rsfilter_generic_lint: fn →pub(crate)src/runner.rsextract_test_summary: fn →pub(crate)src/tsc_cmd.rsfilter_tsc_output: fn →pub(crate)Test plan
cargo fmt --all --checkpassescargo clippy --all-targetspassescargo test --allpasses (30+ new tests)rtk yarn workspace <pkg> run viteston a real yarn workspace projectrtk yarn workspace <pkg> run typecheckwith typecheck not existing