Add a dependency-free service for the first run

npm ci wants a lockfile, so an agent starting from an empty directory cannot use
the example configuration until it has written a whole npm project. This one
runs a server.js on node's own http module with no install step at all, which
makes the shortest loop that exercises all three servers: write a file, start it,
open it in the browser.

It reads the port from PORT as well as from the argument. An agent writing a
server from scratch reaches for process.env.PORT far more readily than for argv,
and a preview listening on the wrong port fails its health check with nothing in
the log to explain why.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucio Lelii 2026-09-22 12:56:14 +02:00
parent 7f1d06ba7e
commit 1ca30a0ccf
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
{
"_comment": [
"A first end-to-end configuration, deliberately dependency-free.",
"",
"'node-app' runs whatever server.js the execution wrote, with node alone and no install step.",
"That is the point: npm ci needs a lockfile, so the shortest honest loop for an agent starting",
"from an empty directory is a server built on node's own http module. Once that works, move to",
"services.example.json, where execution-web installs a real dependency tree.",
"",
"The service reads its port from PORT as well as from the argument, because an agent writing a",
"server from scratch is more likely to reach for process.env.PORT than to parse argv."
],
"services": {
"node-app": {
"command": "node",
"args": ["server.js", "${port}"],
"cwd": ".",
"workspaceMode": "execution",
"publicUrl": "http://dev-server-worker:${port}",
"healthUrl": "http://127.0.0.1:${port}/",
"startupTimeoutMs": 20000,
"shutdownTimeoutMs": 5000,
"env": {
"PORT": "${port}"
}
}
}
}