Skip to content

Explore PSReadLine rewrite for PowerShell integration #88

Closed

Description

@caomengxuan666

Summary

Explore a PowerShell integration mode that borrows the PSReadLine rewrite + .cmd wrapper idea used by microsoft/coreutils, while keeping WinuxCmd's command-internal glob expansion as the single place where wildcard expansion happens.

Motivation

PowerShell aliases such as ls, cat, and rm can shadow WinuxCmd commands. Today WinuxCmd supports explicit activation/deactivation, but PowerShell's native argument passing can still make quoted glob patterns hard to preserve correctly.

microsoft/coreutils avoids PowerShell function wrappers and instead rewrites interactive input through PSReadLine, then invokes .cmd entry points so PowerShell uses legacy native argument passing. This is worth studying for WinuxCmd.

Design direction

  • Use PSReadLine only for interactive PowerShell rewriting.
  • Avoid PowerShell function wrappers for command execution, especially for commands that need byte-preserving pipelines.
  • Consider .cmd entry points for PowerShell to preserve quote/glob boundaries better.
  • Keep WinuxCmd's internal glob_expand logic. Windows shells do not provide POSIX-style glob expansion, so direct winuxcmd rm *.txt, CMD usage, and AI sandbox usage still need command-side glob handling.
  • Ensure wildcard expansion happens only once: the shell hook should preserve or mark quote state, not expand globs itself.

Non-goals

  • Do not remove command-internal glob expansion.
  • Do not make PowerShell integration mandatory.
  • Do not replace the existing explicit winux activate / winux deactivate model without a migration path.

Open questions

  • Can the PSReadLine hook preserve enough quote metadata for WinuxCmd to distinguish quoted "*.txt" from unquoted *.txt?
  • Should this be an opt-in mode separate from current activation?
  • Should .cmd wrappers call individual hardlinks or dispatch through winuxcmd.exe <command>?
  • How should this interact with Windows PowerShell 5.1, where PSReadLine and native argument passing differ from PowerShell 7?

Activity

  1. added
    enhancement
    on Jun 4, 2026
  2. arookieofc commented on Jun 18, 2026

    @arookieofc
    Member

    I think we need discuss about this and AI sandbox, maybe we need a tool using winuxsh rather than pwsh?
    based on microsoft/coreutils#138
    perhaps we can only use a small REPL? and when use winuxsh we deactivate it and in cmd/pwsh activate it
    winuxcmd is a coreutils not a shell some conditions not the responsibility of it. A little patch can we accept,but not huge

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

Metadata

Metadata

Labels

E-needs-discussionenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions