Recently Written · git

ai-config

One canonical AI agent config (rules, skills, MCP servers) rendered into Claude Code, Codex, Copilot CLI and Antigravity by acsync

git clone https://github.com/equwal/ai-config

Log | Files | Refs


rules/windows-powershell.md (2236 bytes)

1 ## MANDATORY on the Windows PC: PowerShell 7.6 syntax
2 
3 This section applies on the Windows PC only, not on the Linux desktop `g`.
4 
5 The PC has PowerShell 7.6 (`pwsh.exe`). The Claude Code agent shell runs it. Checked 2026-10-03. The desktop Terminal panel can run Windows PowerShell 5.1 (seen 2026-10-04), so a command for the user must work in both. `powershell.exe` is the old Windows PowerShell 5.1. Most broken commands on this PC came from mixing the two.
6 
7 - Check your own shell once per session: `$PSVersionTable.PSVersion`. On 7.x, `&&`, `||`, `?:`, `??` and `?.` work. On 5.x they fail with "The token '&&' is not a valid statement separator". Then use `A; if ($?) { B }`.
8 - Never wrap a command in `powershell -Command "..."`. That starts 5.1, and your shell expands each `$` inside the double quotes first. For a child shell, write a `.ps1` file and run `pwsh -NoProfile -File <file>.ps1`.
9 - Put a command longer than about 3 lines, or one with nested quotes, in a `.ps1` file. Do not build one long line of escaped quotes.
10 - Unix commands do not exist: `head`, `tail`, `wc`, `sed`, `awk`, `grep`, `readlink`, `base64`, `printf`, `which`, `touch`, `rsync`, `wsl`. A Unix flag on a PowerShell alias (`ls -la`, `rm -rf`, `mkdir -p`) fails with "A positional parameter cannot be found". Use `Select-Object -First N`, `Get-ChildItem -Force`, `Remove-Item -LiteralPath <p> -Recurse -Force`, `New-Item -ItemType Directory -Force <p>`, `(Get-Content f).Count`, `(Get-Command x).Source`, `$env:X = '1'`.
11 - These native programs exist: `ssh`, `scp`, `tar`, `git`, `gh`, `curl.exe`, `py -3`, `node`, `go`.
12 - Single quotes are literal. Double quotes expand `$var` on the PC. Put a remote `ssh` command in single quotes, and write a literal `'` inside it as `''`.
13 - A pipe into a native program adds CRLF: `'a' | prog` sends `a\r\n`. A Linux host then gets a stray `\r`. Copy files with `scp -O` instead of piping text into `ssh`. Hosts without an SFTP server, such as `g`, need `scp -O`.
14 - Do not use `2>&1` on a native program. Check `$LASTEXITCODE`.
15 - The UI language is Russian (`ru-RU`), so many errors are in Russian. "Не удается найти путь" means the path was not found. Check exit codes, not English error text.