feat(C++): add C++/CMake/MSBuild/PowerShell command handlers#1615
feat(C++): add C++/CMake/MSBuild/PowerShell command handlers#1615isink17 wants to merge 16 commits into
Conversation
📊 Automated PR Analysis
SummaryAdds comprehensive C++/CMake/MSBuild/PowerShell command handlers to RTK, including token-filtering for build toolchain output (cmake, make, ninja, msbuild, ctest, codegraph) and automatic rewriting of PowerShell commands (Select-String, Get-Content, Remove-Item) into RTK equivalents. Includes UTF-16 LE support for MSBuild logs, stderr merging for link.exe, and MSBuild log auto-detection. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
googletest would be great, too - but this is already really helpful - thanks a lot |
3a62e05 to
30d569f
Compare
Added a narrow ctest/GoogleTest-style output filter. It keeps failure blocks + failed summaries, drops passing-test noise, handles ctest -V prefixes, and filters combined stdout/stderr. |
17099b1 to
9ba8a4d
Compare
d646909 to
db93cc0
Compare
New module src/cmds/cpp/ with handlers for: - cmake --build / cmake -B (GCC/Clang error filter) - ctest (failed tests only) - make / ninja (build errors only) - msbuild (MSVC cl.exe + link.exe errors) - codegraph (index/update summary, search truncation) PowerShell rewrites in registry.rs: - Select-String → rtk grep - Get-Content / GC → rtk read - Remove-Item → rtk remove-item - msbuild *> file.log → redirect hint with log path rtk read: detect and filter MSBuild UTF-16 LE log files Benchmarks on real MSBuild log (308 KB, UTF-16 LE, Windows): rtk grep on log: 97.39% reduction (308 KB → 8 KB) rtk read on log: 97.16% reduction (308 KB → 8.7 KB) Implementation notes: - msbuild handler merges stdout+stderr (link.exe writes to stderr) - UTF-16 LE BOM detection + transcode before filter pipeline - MSBuild log auto-detection in rtk read (samples first 200 lines) - make install/clean excluded procedurally (regex crate lacks negative lookahead) - codegraph serve never rewritten (long-running MCP server process) Tests: 1643 pass, 0 fail. cargo fmt clean. 11 fixtures in tests/fixtures/cpp/.
… blocks + failed summaries, drops passing-test noise, handles ctest -V prefixes, and filters combined stdout/stderr.
- grep fixed-mode logic clarified and commented - GNU grep fallback now honors fixed mode with -F - rg extra args are inserted before pattern/path - patch wording changed from byte-preserving to encoding-aware best-effort roundtrip - auto encoding no longer guesses cp949; cp949 is explicit via --encoding cp949 - README updated with grep/read/patch usage, safety notes, and encoding behavior
* Add Windows C++ MSBuild and PowerShell diagnostics
Add agent-focused grep ergonomics: - parse RTK grep flags before or after the search path - add files-only, count-by-file, top-files, and JSON output modes - add agent-safe preset via CLI, RTK_AGENT_SAFE, and agent.safe_mode - support explicit caps for total matches, per-file matches, and line length - keep legacy default grep behavior unless safe mode or new modes are used - improve summaries with concrete rtk read hints - document agent-safe grep usage in README Also harden: - UTF-8 clipping and tiny max-line handling - no-match behavior - unknown rg-arg forwarding - capped JSON output using a running current_count counter - JSON mode stability across grep modes Add Windows-focused diagnostics for C++/MSBuild and PowerShell workflows. Address review feedback: - avoid double HashSet lookup in MSBuild diagnostic deduplication - use Unicode character counts for log truncation thresholds - allow UTF-16 no-BOM detection to ignore one trailing odd byte Includes tests for Unicode-safe log truncation and odd-length UTF-16 no-BOM samples.
New module src/cmds/cpp/ with handlers for: - cmake --build / cmake -B (GCC/Clang error filter) - ctest (failed tests only) - make / ninja (build errors only) - msbuild (MSVC cl.exe + link.exe errors) - codegraph (index/update summary, search truncation) PowerShell rewrites in registry.rs: - Select-String → rtk grep - Get-Content / GC → rtk read - Remove-Item → rtk remove-item - msbuild *> file.log → redirect hint with log path rtk read: detect and filter MSBuild UTF-16 LE log files Benchmarks on real MSBuild log (308 KB, UTF-16 LE, Windows): rtk grep on log: 97.39% reduction (308 KB → 8 KB) rtk read on log: 97.16% reduction (308 KB → 8.7 KB) Implementation notes: - msbuild handler merges stdout+stderr (link.exe writes to stderr) - UTF-16 LE BOM detection + transcode before filter pipeline - MSBuild log auto-detection in rtk read (samples first 200 lines) - make install/clean excluded procedurally (regex crate lacks negative lookahead) - codegraph serve never rewritten (long-running MCP server process) Tests: 1643 pass, 0 fail. cargo fmt clean. 11 fixtures in tests/fixtures/cpp/.
… blocks + failed summaries, drops passing-test noise, handles ctest -V prefixes, and filters combined stdout/stderr.
- grep fixed-mode logic clarified and commented - GNU grep fallback now honors fixed mode with -F - rg extra args are inserted before pattern/path - patch wording changed from byte-preserving to encoding-aware best-effort roundtrip - auto encoding no longer guesses cp949; cp949 is explicit via --encoding cp949 - README updated with grep/read/patch usage, safety notes, and encoding behavior
* Add Windows C++ MSBuild and PowerShell diagnostics
Add agent-focused grep ergonomics: - parse RTK grep flags before or after the search path - add files-only, count-by-file, top-files, and JSON output modes - add agent-safe preset via CLI, RTK_AGENT_SAFE, and agent.safe_mode - support explicit caps for total matches, per-file matches, and line length - keep legacy default grep behavior unless safe mode or new modes are used - improve summaries with concrete rtk read hints - document agent-safe grep usage in README Also harden: - UTF-8 clipping and tiny max-line handling - no-match behavior - unknown rg-arg forwarding - capped JSON output using a running current_count counter - JSON mode stability across grep modes Add Windows-focused diagnostics for C++/MSBuild and PowerShell workflows. Address review feedback: - avoid double HashSet lookup in MSBuild diagnostic deduplication - use Unicode character counts for log truncation thresholds - allow UTF-16 no-BOM detection to ignore one trailing odd byte Includes tests for Unicode-safe log truncation and odd-length UTF-16 no-BOM samples.
1b96164 to
d01d17f
Compare

C++ / MSBuild / PowerShell handler support
Adds token filtering for C++ build toolchains and PowerShell commands
used in Windows-native MSVC development workflows.
New handlers
cmake --buildcmake -Bctestmake/ninjamsbuildcodegraph indexrtk grepon MSBuild logrtk readon MSBuild logBenchmarks measured on a real 308 KB UTF-16 LE MSBuild solution log.
PowerShell auto-rewrites
Select-String -Path f -Pattern prtk grep p fGet-Content <file>rtk read <file>GC <file>rtk read <file>Remove-Item <path> -Forceok <basename>msbuild ... *> file.logKey implementation notes
link.exewrites to stderr; handlermerges both streams so LNK errors are never silently dropped
rtk readnow detects BOM, transcodes, then applies MSBuild filterrtk readsamples first 200 linesto detect MSBuild format and route through the msbuild filter pipeline
regexcrate has no negative lookaheadcontext_for_task,find_callersetc.)bypass the bash hook entirely; only CLI commands are filtered
Known limitation
*>PowerShell redirect is detected at rewrite time and emits a logpath hint, but RTK cannot intercept the build output in transit — the
shell consumes
*>before the hook runs. Workflow: build with*>,then
rtk read <logfile>.Tests
1643 pass, 0 fail.
cargo fmt --checkclean.11 fixtures in
tests/fixtures/cpp/.