# AGENTS.md Drop-in operating instructions for coding agents. Read this file before every task. **Working code only. Finish the job. Plausibility is not correctness.** `SPEC.md` in the repository root is the project contract — read it for what WinUtil is and how it's architected. This file covers how to work on it. ## 0. Non-Negotiables These rules override everything else in this file when in conflict: 1. **Do not edit `winutil.ps1` directly.** It is generated build output (see SPEC.md's Build Model). Change source files and compile. 2. **Do not commit `winutil.ps1`.** It is ignored locally and generated by GitHub Actions for releases. 3. **Never touch `docs/src/content/docs/code-reference/tweaks/` or `docs/src/content/docs/code-reference/features/`.** Both are auto-generated (see SPEC.md's Docs Site). Edit the source JSON (`config/tweaks.json`, `config/feature.json`) or the relevant PowerShell function file instead. Other hand-written pages under `code-reference/` (e.g. `architecture.mdx`) are not touched by the generator and may be edited directly. 4. **Never fabricate.** Do not invent file paths, function names, command output, test results, commit hashes, or API behavior. Read the file or run the command. 5. **Disagree when the premise is wrong.** Say what is wrong before acting on it. 6. **Stop when genuinely ambiguous.** If two interpretations would produce materially different diffs, ask before editing. 7. **Touch only what the task requires.** No drive-by refactors, formatting sweeps, or unrelated cleanup. 8. **Verify before saying done.** A plausible-looking diff is not proof. ## 1. Key Commands - Compile: ```powershell .\Compile.ps1 ``` - Compile and run GUI: ```powershell .\Compile.ps1 -Run ``` - Install the supported Pester version (one-time). `-SkipPublisherCheck` is required because Windows ships an inbox Pester 3.4.0 that is catalog-signed, and PowerShell Gallery's Pester 5.8.0 is Authenticode-signed — `Install-Module` refuses the upgrade without it. This does not skip download integrity (still HTTPS + NuGet package hash verification); `-Repository PSGallery` pins the trusted source explicitly rather than relying on whatever repositories happen to be registered: ```powershell Install-Module -Name Pester -RequiredVersion 5.8.0 -Repository PSGallery -Scope CurrentUser -Force -SkipPublisherCheck ``` - Run tests: ```powershell Import-Module Pester -RequiredVersion 5.8.0 -Force Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed -CI ``` - Run Script Analyzer with project settings when available. If a locally compiled `winutil.ps1` exists, delete it first — `lint/PSScriptAnalyser.ps1` only excludes rules, not files, so `-Recurse` would also lint the generated script and produce noise against line numbers that don't map to any source file: ```powershell Invoke-ScriptAnalyzer -Path . -Settings .\lint\PSScriptAnalyser.ps1 -Recurse ``` - Docs site dev server (run from `docs/`; see Section 2 for why this goes through Docker): ```powershell docker compose up winutil-astro ``` - Docs site production build (run from `docs/`): ```powershell docker compose run --rm winutil-astro npm run build ``` Prefer the narrowest useful verification while iterating. Use the full relevant check before finishing. ## 2. Dependency Installs, Builds, And Dev Servers Given the current wave of npm/pnpm/yarn supply-chain worms (malicious postinstall/preinstall scripts, credential-stealing packages): **never run npm/pnpm/yarn/npx directly on the host, full stop.** The docs site (`docs/`) is the only npm-based project in this repo; always run its tooling inside Docker via `docs/Dockerfile` and `docs/docker-compose.yml` (service `winutil-astro`). - Never run `npm install`, `npm run