A local-first multi-agent app development platform, built on PenguinHarness
Add a project skill for running the app locally (#428)
Yaowei Zheng8f235b31c87c
diff --git a/.agents/skills/penguin-harness-dev/SKILL.md b/.agents/skills/penguin-harness-dev/SKILL.mdindex 1ad9773f..730be0ef 100644--- a/.agents/skills/penguin-harness-dev/SKILL.md+++ b/.agents/skills/penguin-harness-dev/SKILL.md@@ -19,7 +19,7 @@ Editing `AGENTS.md`, `CLAUDE.md` or anything under `specs/` edits **the design rBoth repos take changes through branch + PR against `main`, squash-merged. Do not push to `main`.-One trap: a remote branch literally named `docs` occupies that ref namespace, so `docs/<topic>` **cannot be created** in the implementation repo — git rejects it as a directory/file conflict. Use `docs-<topic>` there. The design repo has no such branch and takes `docs/<topic>` normally.+Branches are `feat/<topic>`, `fix/<topic>`, `docs/<topic>` in both repos. Some older branches here read `docs-<topic>` instead: a remote branch literally named `docs` once held that ref namespace and made the slashed form unpushable. It is gone — if a push is ever rejected as a directory/file conflict again, `git ls-remote --heads origin` names the branch responsible.Independent changes each get their own git worktree under `../penguin-harness-wt/<topic>/` so several can run in parallel.diff --git a/.agents/skills/penguin-harness-manual-test/SKILL.md b/.agents/skills/penguin-harness-manual-test/SKILL.mdnew file mode 100644index 00000000..9f6aff1b--- /dev/null+++ b/.agents/skills/penguin-harness-manual-test/SKILL.md@@ -0,0 +1,71 @@+---+name: penguin-harness-manual-test+description: Use when standing PenguinHarness up to try a change by hand — launching the Web App, the desktop shell, the landing page or the docs site to click through it, screenshot it, or reproduce a report. Covers the four dev entry points and their ports, which data root each writes to, and the four ways a healthy setup looks broken.+---++# Standing PenguinHarness up to test by hand++Node >= 24. `dev:*` runs `dev-prebuild.mjs` first (keeps `pnpm install` current, prebuilds+workspace deps); `pnpm desktop` runs a full `pnpm -r build`, so it is slow to start.++## Entry points++| Command | Open | Data root |+| --- | --- | --- |+| `pnpm dev` | http://localhost:7365 | `~/.penguin/dev-data` |+| `pnpm desktop` | its own window | `~/.penguin/dev-data` |+| `pnpm dev:landing` | http://localhost:7366 | none (static) |+| `pnpm dev:docs` | http://localhost:7367 | none (static) |++Other fixed ports (`packages/core/src/internal/ports.ts`): 7364 installed server, 7368 dev backend,+7369 `pnpm penguin web`. On a shared box, `ss -tln` before assuming one is free; `PORT=` inline+moves it.++The user's installed app, server and CLI all use `~/.penguin/data` — their real Agents, Sessions+and keys. Never point a dev run there. Both surfaces print the root they took (`Data root: …`,+`[shell] dev instance … on data root …`); read it rather than assume.++## Four ways a working setup looks broken++**7368 shows a stale app.** The dev backend also serves `packages/web/dist` — the last+`pnpm -r build`, not what Vite is serving. Screenshot 7365, never 7368.++**`curl` returns 502 but the server is fine.** A shell `http_proxy` routes loopback through the+proxy. Use `curl --noproxy '*'`. Browsers and the server itself are unaffected.++**`/api` on `127.0.0.1` returns 401.** That address is reserved as the Workspace-preview host. Use+`localhost`.++**The server exits 3 saying the data root is in use.** Another instance — usually the user's own+desktop app — holds `<root>/server.lock`. The lock is per root, not per port, so `PORT=` will not+get past it. Use a different root; do not kill their process.++## PENGUIN_HOME++Never export it. `scripts/run-with-env.mjs` applies each `VAR=value` only when unset, so an+exported value silently redirects every dev script — an exported `~/.penguin/data` puts `pnpm dev`+on the user's real data, where the lock is already held. It now names any default the environment+displaced before running, so read that line if it appears.++When you need your own root, prefix the one command:++```sh+PENGUIN_HOME=~/.penguin/dev-data-<topic> pnpm dev+```++Unset it rather than blanking it: `run-with-env` reads empty as unset, but `resolveRoot()` uses+`??` and takes an empty string literally.++## Signing in++A fresh root seeds `admin` with a random `penguin-<4 digits>` password, printed once at startup.+`PENGUIN_SEED_ADMIN_PASSWORD` pins it, which is how the e2e harness logs in.++## Editing while it runs++Changes to `core` or `skills` do not reach a running dev server — web/server consume snapshot+copies that re-sync only when that package's `build` runs. Restart `pnpm dev`.++## When you are done++Stop what you started. Leave anything the user was already running alone.diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 40e61f03..9a80a803 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -48,14 +48,18 @@ rebuild, delete `packages/web/node_modules/.vite` and restart.Dev entry points that touch data (`pnpm dev`, `pnpm dev:server`, `pnpm penguin`,`pnpm desktop`) default to a separate data root, `~/.penguin/dev-data`, kept apart fromthe installed CLI/server's `~/.penguin/data` — hacking on the repo never mixes state with-your real agents. Export `PENGUIN_HOME` to point them anywhere else; an explicit value-always wins. The desktop dev shell isolates one step further: an unpackaged run takes a-dev-suffixed app identity (`PenguinHarness-Dev`) with its own userData directory,-single-instance lock, and sticky port, and defaults to `~/.penguin/dev-data` even when-launched without the env var (`pnpm --dir packages/desktop start`) — so it runs side by-side with an installed release build, with neither instance seeing the other. Every-unpackaged launch prints which pair it picked: `[shell] dev instance '<name>' on data-root <root>`.+your real agents. Need a different root? Pass `PENGUIN_HOME` inline, for the single+command that needs it (`PENGUIN_HOME=~/.penguin/dev-data-<topic> pnpm dev`) — never export+it into your shell: those defaults apply only when the variable is unset or empty+(`scripts/run-with-env.mjs`), so an exported value silently wins over all of them, and an+exported `PENGUIN_HOME=~/.penguin/data` puts `pnpm dev:server` on the release/CLI root+where a running desktop app already holds the lock. The desktop dev shell isolates one+step further: an unpackaged run takes a dev-suffixed app identity (`PenguinHarness-Dev`)+with its own userData directory, single-instance lock, and sticky port, and defaults to+`~/.penguin/dev-data` even when launched without the env var+(`pnpm --dir packages/desktop start`) — so it runs side by side with an installed release+build, with neither instance seeing the other. Every unpackaged launch prints which pair+it picked: `[shell] dev instance '<name>' on data root <root>`.Two one-time moves came with that split. A bare `pnpm --dir packages/desktop start` usedto run on `~/.penguin/data` (the release/CLI root) and now runs on `~/.penguin/dev-data`,diff --git a/changelog/unreleased/2026-08-23-manual-test-skill.md b/changelog/unreleased/2026-08-23-manual-test-skill.mdnew file mode 100644index 00000000..97ea924a--- /dev/null+++ b/changelog/unreleased/2026-08-23-manual-test-skill.md@@ -0,0 +1,54 @@+# A skill for standing the app up to test by hand++- **Date:** 2026-08-23+- **Type:** process+- **Scope:** `skills`, `docs`+- **PR:** [#428](https://github.com/Prism-Shadow/penguin-harness/pull/428)++[中文版](2026-08-23-manual-test-skill.zh.md)++`.agents/skills/penguin-harness-manual-test/SKILL.md` is a new repo-development+skill covering how to bring the app up on a developer machine so a change can be tried by hand: the four dev entry points (`pnpm dev`, `pnpm desktop`,+`pnpm dev:landing`, `pnpm dev:docs`) with their fixed ports, and the environment traps that make a+working setup read as a broken one. Two neighbouring documents were corrected to match it.++## Details++- Data roots are stated per entry point: `resolveRoot()` is `PENGUIN_HOME ?? ~/.penguin/data`, and+ `desktopDataRoot()` sends a packaged build to that same CLI-shared root while only an unpackaged+ run takes `~/.penguin/dev-data`. The skill also names the startup lines that report the root+ actually taken (`Data root: <root>`, `[shell] dev instance '<name>' on data root <root>`).+- `scripts/run-with-env.mjs` applies `VAR=value` with `${VAR:-value}` semantics, so every dev+ default is a default and an inherited `PENGUIN_HOME` silently wins. The rule the skill gives is+ never to export it and to prefix a single command+ (`PENGUIN_HOME=~/.penguin/dev-data-<topic> pnpm dev`) when an isolated root is needed, plus the+ asymmetry an empty value creates between that script and `resolveRoot()`'s `??`.+- `<root>/server.lock` admits one server per data root, refusing with+ `Another PenguinHarness server is already running on this data root (pid N)` and exit 3 regardless+ of `PORT`. The instruction is to move to a distinct root, not to kill what usually is the user's+ own desktop app.+- An environment proxy routes loopback `curl` through itself and answers 502 while the server is+ healthy; browsers and the server's own outbound path are unaffected. The skill gives+ `curl --noproxy '*'` / `NO_PROXY` and says to suspect the proxy before debugging the server.+- Two more surfaces that read as failures: `/api` on `127.0.0.1` is the Workspace-preview host and+ answers 401 by design, and the dev backend on 7368 serves the last-built `packages/web/dist`+ rather than what Vite is serving on 7365.+- Sign-in is covered for scripted runs: the seeded `admin` notice, `<root>/initial-admin-password`,+ `PENGUIN_SEED_ADMIN_PASSWORD`, and the `packages/web/e2e/` harness for chat flows on a root with+ no model credential.+- `CONTRIBUTING.md`'s data-root paragraph now tells contributors to pass `PENGUIN_HOME` inline for+ the one command that needs it rather than exporting it, and names both the unset-or-empty rule+ that makes an exported value win and the collision an exported `~/.penguin/data` produces.+- `penguin-harness-dev` dropped its claim that a remote branch literally named `docs` makes+ `docs/<topic>` branch names impossible in this repo: no such branch is on the remote, and the+ slashed form pushes normally. The `docs-<topic>` names left over from that period are explained+ where the rule is stated, with `git ls-remote --heads origin` as the check if it ever recurs.++## The override says so now++`scripts/run-with-env.mjs` keeps applying its `VAR=value` arguments as defaults — an inherited value+still wins, which is what makes `PENGUIN_HOME=/somewhere pnpm dev` work at all, since a child+process cannot tell an inline assignment from an exported one. What changed is that it no longer+happens in silence: any default the environment displaced is named on stderr before the command+runs, so a shell-wide export cannot quietly redirect a dev script at another data root.+diff --git a/changelog/unreleased/2026-08-23-manual-test-skill.zh.md b/changelog/unreleased/2026-08-23-manual-test-skill.zh.mdnew file mode 100644index 00000000..b4a8e670--- /dev/null+++ b/changelog/unreleased/2026-08-23-manual-test-skill.zh.md@@ -0,0 +1,44 @@+# 一个用于把应用跑起来、供人工验证的 skill++- **Date:** 2026-08-23+- **Type:** process+- **Scope:** `skills`, `docs`+- **PR:** [#428](https://github.com/Prism-Shadow/penguin-harness/pull/428)++[English](2026-08-23-manual-test-skill.md)++`.agents/skills/penguin-harness-manual-test/SKILL.md` 是一个新增的仓库开发 skill,讲述如何在开发机上把应用跑起来、以便动手验证一处改动:四个开发入口+(`pnpm dev`、`pnpm desktop`、`pnpm dev:landing`、`pnpm dev:docs`)及其固定端口,以及那些会让正常环境显得像是坏掉了的+环境陷阱。另有两份相邻文档被一并校正,以与之保持一致。++## 细节++- 逐个入口写明数据根目录:`resolveRoot()` 是 `PENGUIN_HOME ?? ~/.penguin/data`,而 `desktopDataRoot()` 让打包版走向同一个+ 与 CLI 共享的根目录,只有未打包的运行才使用 `~/.penguin/dev-data`。该 skill 同时指出启动时报告实际根目录的那几行+ (`Data root: <root>`、`[shell] dev instance '<name>' on data root <root>`)。+- `scripts/run-with-env.mjs` 以 `${VAR:-value}` 的语义施加 `VAR=value`,因此每一个开发默认值都只是默认值,继承而来的+ `PENGUIN_HOME` 会无声地胜出。该 skill 给出的规则是:永远不要 export 它;需要独立的根目录时,只为单条命令加前缀+ (`PENGUIN_HOME=~/.penguin/dev-data-<topic> pnpm dev`)。此外还写明了空值在该脚本与 `resolveRoot()` 的 `??` 之间造成的不对称。+- `<root>/server.lock` 使一个数据根目录只接纳一个服务端,重复启动会以+ `Another PenguinHarness server is already running on this data root (pid N)` 拒绝并以 3 退出,换 `PORT` 也无济于事。+ 给出的做法是换一个独立的根目录,而不是去杀掉那个通常属于用户自己的桌面端。+- 环境代理会把指向 loopback 的 `curl` 也送进代理并返回 502,而服务端其实完好无损;浏览器与服务端自身的出站链路都不受影响。+ 该 skill 给出了 `curl --noproxy '*'` / `NO_PROXY`,并要求在调试服务端之前先怀疑代理。+- 另有两处同样会被读作故障的表现:`127.0.0.1` 上的 `/api` 是 Workspace 预览主机,按设计返回 401;7368 上的开发后端提供的是+ 上一次构建出的 `packages/web/dist`,而不是 Vite 正在 7365 上提供的内容。+- 为脚本化运行覆盖了登录:种子 `admin` 的提示框、`<root>/initial-admin-password`、`PENGUIN_SEED_ADMIN_PASSWORD`,以及在没有+ 模型凭据的根目录上用 `packages/web/e2e/` 测试设施驱动对话流程。+- `CONTRIBUTING.md` 关于数据根目录的那一段现在要求贡献者只为需要它的那条命令内联传入 `PENGUIN_HOME`,而不是 export+ 它,并写明了「仅在未设置或为空时才生效」这条规则如何让 export 出去的值胜出,以及 export `~/.penguin/data`+ 会造成什么样的冲突。+- `penguin-harness-dev` 删去了「远端存在一个名为 `docs` 的分支,因而本仓库无法创建 `docs/<topic>` 分支名」这一说法:+ 远端并不存在这样的分支,带斜杠的形式可以正常推送。那段时期遗留下来的 `docs-<topic>` 命名在规则所在处一并说明,+ 并给出 `git ls-remote --heads origin` 作为日后复现时的排查手段。++## 被覆盖时会说出来++`scripts/run-with-env.mjs` 仍然把 `VAR=value` 参数当作默认值——继承来的值依旧优先,这正是+`PENGUIN_HOME=/somewhere pnpm dev` 得以生效的前提,因为子进程无法区分命令内联赋值与 shell 导出。+改变的是它不再悄无声息:任何被环境顶掉的默认值,都会在命令运行前打印到 stderr,因此一个全局导出+再也无法在无人察觉的情况下把开发脚本指向另一个数据根。+diff --git a/scripts/run-with-env.mjs b/scripts/run-with-env.mjsindex eeefb691..ac9a119f 100644--- a/scripts/run-with-env.mjs+++ b/scripts/run-with-env.mjs@@ -6,7 +6,10 @@** Each assignment sets VAR **only when it is unset or empty** in the current environment —* the JS equivalent of `VAR="${VAR:-value}" cmd`, which cmd.exe cannot parse (package.json- * scripts run under cmd.exe on Windows). A leading `~/` in the value expands to the user's+ * scripts run under cmd.exe on Windows). An inherited value therefore wins, which is what makes+ * `PENGUIN_HOME=/somewhere pnpm dev` work; a child cannot tell that apart from an exported one.+ * Because it wins, it says so: any default the environment displaced is named on stderr before+ * the command runs, so a shell-wide export cannot quietly redirect a dev script. A leading `~/` in the value expands to the user's* home directory (the `$HOME/...` defaults). Then the command runs with inherited stdio and* its exit code is propagated.*@@ -26,6 +29,8 @@ if (sep === -1 || sep === argv.length - 1) {}const env = { ...process.env };+/** Defaults this script did not get to apply, because the environment already had a value. */+const overridden = [];for (const assignment of argv.slice(0, sep)) {const eq = assignment.indexOf("=");if (eq <= 0) {@@ -37,7 +42,22 @@ for (const assignment of argv.slice(0, sep)) {if (value === "~" || value.startsWith("~/")) {value = path.join(os.homedir(), value.slice(2));}- if (!env[name]) env[name] = value; // unset or empty -> default (the ${VAR:-value} rule)+ if (!env[name]) {+ env[name] = value; // unset or empty -> default (the ${VAR:-value} rule)+ } else if (env[name] !== value) {+ // An inherited value wins, and that is deliberate: `PENGUIN_HOME=/x pnpm dev` is the supported+ // way to aim one command somewhere else, and a child process cannot tell that apart from an+ // exported one — both are just process.env. What is not deliberate is finding out later. An+ // exported PENGUIN_HOME once sent `pnpm dev:server` at the release data root, where the+ // desktop app already held the lock, and nothing said why the default had not applied.+ overridden.push(`${name}=${env[name]} (default: ${value})`);+ }+}++if (overridden.length > 0) {+ console.error("run-with-env: the environment overrides these defaults:");+ for (const line of overridden) console.error(` ${line}`);+ console.error(" unset them in this shell if that is not what you meant.");}const [command, ...args] = argv.slice(sep + 1);