Skip to content

feat(windows): add native commands and PowerShell routing - #3301

Draft
Luca-it15 wants to merge 7 commits into
rtk-ai:developfrom
Luca-it15:feat/windows-powershell-native-compat
Draft

feat(windows): add native commands and PowerShell routing#3301
Luca-it15 wants to merge 7 commits into
rtk-ai:developfrom
Luca-it15:feat/windows-powershell-native-compat

Conversation

@Luca-it15

Copy link
Copy Markdown

Summary

  • refresh and carry the native Windows work from feat(system): native Windows ls/grep/wc/tree + PowerShell cmdlet rewrites #2547 onto the current develop branch
  • add pure-Rust fallbacks for ls, tree, wc, and file-based grep/rg when Unix binaries are unavailable
  • add powershell and pwsh wrappers plus safe, case-insensitive routing for Get-Content, Get-ChildItem, and Select-String (including aliases)
  • preserve unsupported scripts, pipelines, interpolation, -File, and -EncodedCommand by passing them through unchanged
  • support non-MSVC Windows linkers instead of always emitting the MSVC-only /STACK flag
  • honor -v / --invert-match in the native search fallback so Select-String -NotMatch remains correct

Context and attribution

This branch deliberately preserves the original commits/authorship from @tienthegainz's #2547 and @sresam89's #2875, then adds the PowerShell/pwsh routing and current-develop integration work on top.

Addresses #1248.
Supersedes #2547.
Includes the fallback work from #2875.

Safety model

Only simple, statically tokenizable cmdlet invocations are routed through RTK. Compound PowerShell syntax and dynamic forms are left to the requested PowerShell executable, avoiding semantic changes to pipelines or scripts.

Validation

  • cargo fmt --all --check
  • cargo clippy --all-targets -- -D warnings
  • 77 focused Windows/PowerShell tests passed (powershell, native ls, tree, wc, and search fallback)
  • manual Windows smoke tests for powershell -Command, native listing/count/tree, and search with rg removed from PATH
  • full local gnullvm run: 2505 passed; the remaining 30 failures are outside the modified modules and depend on Unix helper commands or sandboxed user-profile writes (the upstream base does not link with gnullvm before the linker fix in this PR)

GitHub's existing Windows MSVC job provides the authoritative full-suite check for this draft.

AI disclosure

The integration, tests, and PowerShell routing were developed with Codex assistance and manually validated on Windows.

tienthegainz and others added 7 commits July 29, 2026 18:32
…ng on PATH

Plain Windows PowerShell (no Git Bash/WSL, no ripgrep installed) has neither
grep nor rg on PATH, so `rtk grep`/`rtk rg` hard-failed instead of running.
engine_capture now checks tool_exists(engine.bin()) and, only when the
requested binary is absent, walks paths with the already-vendored `ignore`
crate and matches lines with the already-vendored `regex` crate. This never
substitutes one engine for the other — grep still only falls back when grep
itself is missing, same for rg. Output is emitted in the exact
file\0line:content shape parse_match_line already expects, so grouping/
truncation/display code is untouched. Context lines (-A/-B/-C) are not
supported in fallback mode; only -i/--ignore-case is honored from extra_args.

Forward-ports unreleased fork-local work (originally against the pre-refactor
grep_cmd.rs) onto develop's search.rs/Engine design. Not tied to a GitHub
issue; staged for maintainer discussion before submission.
@CLAassistant

CLAassistant commented Jul 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants