feat: add rtk cdk diff/synth/deploy filters#402
Open
ThomasHoussin wants to merge 2 commits intortk-ai:developfrom
Open
feat: add rtk cdk diff/synth/deploy filters#402ThomasHoussin wants to merge 2 commits intortk-ai:developfrom
ThomasHoussin wants to merge 2 commits intortk-ai:developfrom
Conversation
ThomasHoussin
added a commit
to ThomasHoussin/rtk
that referenced
this pull request
Mar 7, 2026
Merge fork/feat/yarn-cmd-v2 (PR rtk-ai#317) into local branch based on feat/cdk-cmd (PR rtk-ai#402). Resolved 3 conflicts: - registry.rs: kept both gh and yarn rewrite tests, added CDK rewrite tests - tsc_cmd.rs: kept has_program() from windows-compat branch - utils.rs: kept has_program() + script_cmd with concise doc Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `script_cmd()` and `has_program()` helpers to utils.rs, then
migrate all bare `Command::new` calls for Node.js CLI tools to use
`.cmd` wrappers on Windows, and replace all `Command::new("which")`
probes with a cross-platform `where.exe`/`which` helper.
- Add `script_cmd(program)`: appends `.cmd` on Windows (compile-time cfg)
- Add `has_program(program)`: uses `where.exe` on Windows, `which` on Unix
- Fix `package_manager_exec()` to use both helpers
- Migrate 8 Node.js modules: npm, pnpm, tsc, next, prisma, playwright,
ccusage, main.rs prisma passthrough
- Remove 3 duplicate local `which_command()` fns from pip, mypy, pytest
- Fix `tree.rs` inline `which` probe
- Add platform-specific tests for both helpers
13 files changed, 167 insertions(+), 108 deletions(-)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement rtk cdk command with 3 specialized filters: - diff: whitelist keeps only stack headers, diff markers, IAM tables - synth: dual-path (no-template: stack list, template: resource types) - deploy: progress counting, success/error detection, outputs Whitelist approach auto-filters any new bundler noise (Docker, pip, esbuild, NOTICES) without enumeration. Handles both proper Unicode and Windows/PowerShell mojibake box-drawing characters. 32 tests, 6 snapshot tests, token savings 72-99% on real fixtures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4ebec65 to
a7a4daa
Compare
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.
Context
AWS CDK is an Infrastructure-as-Code framework. Its CLI commands (
cdk diff,cdk synth,cdk deploy) produce extremely verbose output: asset bundling logs (esbuild, Docker, pip), CloudFormation progress lines, NOTICES sections, and full YAML templates. A typicalcdk diffon a project with 13 lambdas generates ~870 tokens of which only ~240 are meaningful.What this PR does
Adds
rtk cdkwith 3 specialized filters:rtk cdk diff— Keeps only stack headers, resource diff markers ([+]/[-]/[~]), IAM change tables, and a summary count. Strips all bundling noise, build logs, and NOTICES.rtk cdk synth— Two modes: when no stack is specified, shows the synthesized path + stack list. When a full YAML template is output, extracts a resource type summary (e.g. "Lambda::Function x7, IAM::Role x10").rtk cdk deploy— Strips per-resource CloudFormation progress lines, keeps success/failure status, outputs section, and timing. Handles both standard and stack-prefixed progress formats.Design: whitelist approach — only keep lines matching known meaningful patterns. Everything else is dropped. This is future-proof: any new bundler or tool CDK adds will be automatically filtered without code changes.
Handles Windows/PowerShell mojibake (box-drawing characters rendered as
Ôö£ÔöÇinstead of├──).Token savings
Depends on
Based on #398 (
fix/windows-cmd-compat) —cdk_cmd.rsusesscript_cmd()required for Windows wherecdkis a.ps1wrapper. Will rebase onto master once #398 is merged.Test plan
cargo fmt && cargo clippy --all-targets && cargo test --all— 745 tests pass🤖 Generated with Claude Code