fix(settings): make WSL skill commands pasteable (#7795) (#7881)

* fix(settings): make WSL skill commands pasteable (#7795)

* Fix WSL skill commands so PowerShell 7 pastes match PowerShell 5.1 argv

- Encode the WSL login-shell script as base64 and decode/eval it inside
  the sh -c invocation, avoiding raw nested quotes at the paste boundary
- Scope $PSNativeCommandArgumentPassing = 'Legacy' to the invocation so
  PS 5.1 and PS 7 both hand wsl.exe the same escaped argv
- Extract powershell-native-argument.ts as the shared quoting module and
  reuse it from ssh-remote-powershell.ts

* test(runtime): stub getRepo in mobile-tab startup cwd test

Main's #7892 made listMobileSessionTabs validate selectors via
this.store?.getRepo; the mock store here only defined
getWorkspaceSession, so the merged CI build threw 'getRepo is not a
function'. Return null (wt-1 is a worktree id, not a repo).

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Rod Boev
2026-07-12 01:33:08 -07:00
committed by GitHub
co-authored by Orca Jinjing
parent 1d1ec02b14
commit 34f74129d6
9 changed files with 160 additions and 49 deletions
+4 -10
View File
@@ -1,14 +1,8 @@
import { encodePowerShellCommand } from '../../shared/powershell-command-encoding'
export function powerShellLiteral(value: string): string {
return `'${value.replace(/'/g, "''")}'`
}
// Why: Windows PowerShell 5.1 does not preserve embedded double quotes when
// passing args to native executables, so pre-escape them for Win32 argv parsing.
export function powerShellNativeArg(value: string): string {
return powerShellLiteral(value.replace(/(\\*)"/g, '$1$1\\"'))
}
export {
quotePowerShellLiteral as powerShellLiteral,
quotePowerShellNativeArgument as powerShellNativeArg
} from '../../shared/powershell-native-argument'
export function powerShellCommand(script: string): string {
return `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${encodePowerShellCommand(script)}`