# One-click installers

These put the live harness (OpenCode 1.18.35 with this repository's kit: rules, plugin, skills, web search and the screenshot critic) on a laptop, wired to the model the Spark serves. The model stays on the Spark; the agent runs on the laptop, so it edits and tests the laptop's files.

| File | Runs on | What it does |
|---|---|---|
| `install-windows.cmd` | Windows 10 and 11 | Downloads the kit bundle with `curl.exe`, unpacks it with `tar.exe`, runs `install.ps1` from disk |
| `install.ps1` | Windows PowerShell 5.1 | Installs Git for Windows, Node.js and uv with winget if missing, then OpenCode, the kit, Chromium, the `spark-code` launcher, and the VS Code extension with its terminal settings |
| `install-linux.sh` | Linux, macOS | The same, user-local and without sudo: Node.js and uv only if missing, then runs `install.sh` |
| `install.sh` | Linux, macOS | The kit itself: OpenCode config, rules, plugin, skills, web search, `spark-code`, VS Code settings |
| `make_kit_bundle.sh` | the server | Builds the bundle and the page the installers download from |
| `index.html` | the server | The download page |

Every installer ends by asking the agent for one word, and rerunning one updates everything; files it replaces are kept as `*.bak-<timestamp>`.

## Hosting them

1. On the server, keep the kit in the layout these scripts expect: `kit/AGENTS.md`, `kit/opencode.json.template`, `kit/model.env`, `kit/plugins/`, `kit/skills/`, `tools/look`, `tools/pick`, `tools/anchors/`, `install.sh`, `install.ps1` and `installers/`. This repository's [`harness/`](..) holds the rules, plugin, tools, the skills written for this project and the rendered `opencode.json`; the third-party skills are not redistributed here.
2. Replace the `your-server` addresses: the model endpoint (`:8000/v1`), the SearXNG instance for web search (`:8080`) and the folder the bundle is served from (`/kit`). The shell scripts also read `KIT_BASE`, `ENDPOINT` and `SEARXNG_URL` from the environment.
3. Run `make_kit_bundle.sh` (`KIT_OUT` sets the output folder) and serve that folder over HTTP on a private network only: the model endpoint has no authentication.

## Windows traps these avoid

- **No download-and-run from memory.** `iex` of a downloaded script string is a malware pattern, and Windows' antivirus scan (AMSI) blocks it as `ScriptContainedMaliciousContent`. The installer is downloaded as a file and run with `powershell -File`.
- **OpenCode logs to stderr.** In Windows PowerShell 5.1 with `$ErrorActionPreference = 'Stop'`, a redirected stderr line from a program is a fatal error, so the final check keeps stdout only.
- **The execution policy.** The VS Code extension types `opencode` into a PowerShell terminal, which picks npm's `opencode.ps1` shim, and Windows' default policy (Restricted) blocks it. The installer sets RemoteSigned for the current user, which runs local scripts and still refuses unsigned downloaded ones.
- **A process that outlives the command.** OpenCode waits until its command's output pipe closes. A dev server or browser daemon the command starts inherits that pipe, so on Windows the tool never returned: sessions sat 36 to 60 minutes on finished commands. The kit's plugin now runs every PowerShell command through a small runner that starts it without inherited handles, with its output in a file, and returns once the command itself ends (or near the tool's timeout, with the output so far). `install.ps1` checks this on the machine before it finishes.

## Tested

- `install-linux.sh`: end to end in an empty home folder on the Spark (Linux, aarch64): Node.js, uv, OpenCode, the kit, web search, Chromium, the VS Code extension and settings; the agent answered, and the screenshot critic reviewed a test page with the Spark's model.
- `install-windows.cmd` and `install.ps1`: run on a Windows laptop, which installed everything and works from VS Code. The command runner above passes 30 Node tests, among them its PowerShell code run in PowerShell 7 on Linux, and a PowerShell 5.1 compatibility analysis; its first run on Windows is pending.
