werkmeister-core 0.93.5 → 0.93.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/agent_state.js +3 -2
- package/dist/archetypes.js +1 -1
- package/dist/fixture_workspace.d.ts +5 -1
- package/dist/fixture_workspace.js +37 -8
- package/dist/harness/claude/claude_md.d.ts +2 -2
- package/dist/harness/claude/claude_md.js +19 -4
- package/dist/issue_tracker.d.ts +2 -0
- package/dist/issue_tracker.js +7 -3
- package/dist/lifecycle.js +21 -6
- package/dist/pr_lifecycle.d.ts +4 -1
- package/dist/pr_lifecycle.js +49 -4
- package/dist/pr_rules.d.ts +1 -0
- package/dist/pr_rules.js +2 -0
- package/dist/sandbox.d.ts +8 -1
- package/dist/sandbox.js +11 -3
- package/dist/strategies/icm.js +4 -1
- package/dist/strategies/icm_templates.d.ts +2 -2
- package/dist/strategies/icm_templates.js +32 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# sandbox-core
|
|
2
2
|
|
|
3
|
+
## 0.93.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9acbfa4: ICM implement and fix contracts: `exercise.md` and `fix.md` record the `pr gate --tests` result for each service it tested, not only its exit code (SW-126).
|
|
8
|
+
- c021238: ICM exercise steps and `werkmeister-context.md` § How to validate: a check only the person can run on the host goes in a script that logs beside itself, run with one `! sh <absolute path>` line; never commands copied out of the transcript (SW-746).
|
|
9
|
+
- a4dca52: ICM contracts: the review subagent runs in the foreground when nothing else is pending; a background review, test or gate job quiet for 10 minutes is stopped and relaunched once, then the person is told (SW-764).
|
|
10
|
+
- 7e12dc2: ICM research contract: tool-behaviour probes run in the service's container (a host scratch probe is marked and re-checked there). `werkmeister-context.md` § Test commands names each registry cache as a volume every workspace shares, never to delete from (SW-765).
|
|
11
|
+
- c5fc023: ICM propose and spike findings contracts: before filing 3 or more follow-up tickets, ask the person which epic or label they go under, then file each with it (SW-793).
|
|
12
|
+
- a513328: ICM research contract: markdown a change adds or moves into a repo goes through the repo's lint command (its docs checks) before the spec fixes its text, and the spec promises a byte-for-byte copy only when that run passed (SW-810).
|
|
13
|
+
- 8a42a42: ICM bugfix reproduce contract: loads the active `testing`, `engineering` and `comments` standards rows and names any rule that already prescribes the proposed fix (SW-837). A stage's `standards` can now name rows.
|
|
14
|
+
|
|
15
|
+
## 0.93.6
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 4db8b7b: SW-665: `pr gate` tests every service again when a branch changes an `infrastructure:` or `caches:` entry in the repo's own `.werkmeister/services.yaml` (`every service: … infrastructure: <name>`); since SW-573 such a change touched no service and ran no tests.
|
|
20
|
+
- cccc0ce: SW-721: the container test line in `werkmeister-context.md` and its allow rule escape a `'` in the test or lint command (`'\''`), so both run the registered command instead of a different word split.
|
|
21
|
+
- 44c12ab: SW-809: `with-fixture-workspace --queue <feature>:<waitedMin>[:<service>,...]` (and `withFixtureWorkspace({ queue })`) seeds a waiter's workspace, compose.yml, lease and `waiting.json`, not only its name, so a starved, whole-feature or service queue head runs through the built CLI. `--queue` now repeats; a bare name still seeds only the name.
|
|
22
|
+
- df3c3d0: SW-825: the generated propose-stage contract says to start the release check's container with `werkmeister feature up --service <name>` first, since an earlier `pr gate --tests` stopped the containers it started.
|
|
23
|
+
- 5f85455: SW-829: `pr gate` (and so `pr open`) adds a `group` row to a grouped workspace's gate. It warns about each `group:` member whose key is in no commit subject in `origin/<base>..HEAD`, since that member would ship as Done with the PR, and prints the fix: remove it from `group:` and move it back to To Do with `werkmeister issue update <KEY> --status "To Do" --comment …`.
|
|
24
|
+
- 166fb6d: SW-831: when preemption fails to stop a victim and some of its containers still run, the victim is no longer queued, so its agent's container and test commands are not held over live containers. The start that asked still waits at the head of the queue. A victim with nothing left running is queued to come back, as before.
|
|
25
|
+
- 855cb69: SW-832: while a workspace waits for capacity, the hook now also holds the MCP `test` tool and `workspace-pr` with `gate` or `open`, as it holds their Bash forms. `workspace-pr` `status` still runs.
|
|
26
|
+
- 6ff3082: SW-833: `runWorkspaceAction` takes an optional `{ byPerson }` that says a person, not an agent, asked for an `up`. The workspaces pane's Up passes `byPerson: true`, so a person's Up on a full machine can stop agents' features instead of queueing behind them, in a workspace that is not autonomous. An autonomous workspace's Up still queues as an agent's. Before this, the pane ran inside Claude Code and inherited `CLAUDECODE=1`, so its Up always counted as an agent's start.
|
|
27
|
+
- b6108f6: SW-840: when a workspace is started from the waiting queue and some of its containers are still stopped, the message that resumes its session now names each one and the command that starts it (`werkmeister feature up --service <name>`). Before this, it said the containers were up. Preemption stops on-demand containers too, and the grant's `up` starts only the default set.
|
|
28
|
+
|
|
3
29
|
## 0.93.5
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/agent_state.js
CHANGED
|
@@ -642,7 +642,8 @@ function leftOver(root) {
|
|
|
642
642
|
// Starts containers or runs tests. A list of what is held, not of what passes: the ticket names the held
|
|
643
643
|
// set, and an allowlist would hold `werkmeister feature stop`, the command that frees room (SW-768).
|
|
644
644
|
const NEEDS_CAPACITY = /(^|[\s;&|(`/'"])(docker|pnpm|npm|npx|node|turbo|vitest|with-temp-home|with-fixture-workspace)(\s|$)|\b(werkmeister|w9r)\s+(feature\s+(up|restart)|pr\s+(gate|open))\b/;
|
|
645
|
-
|
|
645
|
+
// The MCP forms of the held commands (SW-832); `workspace-pr` `status` passes like `pr status`.
|
|
646
|
+
const NEEDS_CAPACITY_TOOL = /^mcp__.*werkmeister.*__(up|restart|test|workspace-pr)$/;
|
|
646
647
|
function needsCapacity(input) {
|
|
647
648
|
if (input["hook_event_name"] !== "PreToolUse")
|
|
648
649
|
return false;
|
|
@@ -652,7 +653,7 @@ function needsCapacity(input) {
|
|
|
652
653
|
const command = String(input["tool_input"]?.["command"] ?? "").replace(/(\s(?:-m|--message)[= ]?\s*)('[^']*'|"[^"]*")/g, "$1''");
|
|
653
654
|
if (tool === "Bash")
|
|
654
655
|
return NEEDS_CAPACITY.test(command);
|
|
655
|
-
return NEEDS_CAPACITY_TOOL.test(tool);
|
|
656
|
+
return NEEDS_CAPACITY_TOOL.test(tool) && input["tool_input"]?.["action"] !== "status";
|
|
656
657
|
}
|
|
657
658
|
/**
|
|
658
659
|
* The hook's stdout while the workspace is paused or waiting for capacity, or null. `continue: false` ends
|
package/dist/archetypes.js
CHANGED
|
@@ -81,7 +81,7 @@ export function serviceNoTests(svcDef) {
|
|
|
81
81
|
* `permissions.allow` rule both use it, so the rule matches what the agent runs.
|
|
82
82
|
*/
|
|
83
83
|
export function containerTestCommand(feature, svc, cmd) {
|
|
84
|
-
return `docker exec ${feature}-${svc} sh -c '${cmd}'`;
|
|
84
|
+
return `docker exec ${feature}-${svc} sh -c '${cmd.split("'").join(`'\\''`)}'`;
|
|
85
85
|
}
|
|
86
86
|
/** True when *cmd* is simple commands joined only by `&&`: no group, pipe, `||`, `;`, `&`, newline or substitution. */
|
|
87
87
|
export function isPlainChain(cmd) {
|
|
@@ -51,7 +51,11 @@ export interface FixtureOptions {
|
|
|
51
51
|
config?: Record<string, unknown>;
|
|
52
52
|
/** Containers the fake docker shows the scheduler as running, so a start can wait for capacity (SW-685). */
|
|
53
53
|
containers?: FixtureContainer[];
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* The waiting queue, `scheduler/queue.json` (SW-685), one `<feature>[:<waitedMin>[:<service>,...]]` each.
|
|
56
|
+
* With a wait, the waiter also gets a workspace with a compose.yml, a lease and a waiting.json whose
|
|
57
|
+
* `since` is that many minutes back (and `services`, a service start), so admission prices and ages it (SW-809).
|
|
58
|
+
*/
|
|
55
59
|
queue?: string[];
|
|
56
60
|
}
|
|
57
61
|
/** One running container as `docker inspect` reports it to the scheduler. */
|
|
@@ -8,6 +8,8 @@ import { execFileSync } from "node:child_process";
|
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import YAML from "yaml";
|
|
11
|
+
import { waitingPath } from "./agent_state.js";
|
|
12
|
+
import { COMPOSE_FILE } from "./compose_file.js";
|
|
11
13
|
import { containerOf } from "./config.js";
|
|
12
14
|
import { dotDir } from "./dot_dir.js";
|
|
13
15
|
import { writeFakes } from "./fixture_fakes.js";
|
|
@@ -15,6 +17,7 @@ import { gitEnv } from "./proc.js";
|
|
|
15
17
|
import { prDir, stageDirs, templateFor } from "./strategies/icm_templates.js";
|
|
16
18
|
// Names become folders under the fixture and lines in the fakes, from a pre-approved wrapper's input.
|
|
17
19
|
const NAME = /^[a-z0-9][a-z0-9-]*$/;
|
|
20
|
+
const QUEUE_ENTRY = /^([a-z0-9][a-z0-9-]*)(?::(\d+)(?::([a-z0-9][a-z0-9-]*(?:,[a-z0-9][a-z0-9-]*)*))?)?$/;
|
|
18
21
|
// The only config.yaml keys --config may add: others (jira, github_ingest, paths…) reach real services or repos from a pre-approved run.
|
|
19
22
|
const CONFIG_KEYS = ["budget"];
|
|
20
23
|
export const FIXTURE_FEATURE = "demo";
|
|
@@ -89,9 +92,9 @@ export function fixturePreset({ gate, bare, change, ...opts }) {
|
|
|
89
92
|
if (bad !== undefined)
|
|
90
93
|
throw new Error(`--running: bad value ${JSON.stringify(bad)}: feature and workspace are lowercase names, startedAt a date, memory and nanoCpus whole numbers`);
|
|
91
94
|
}
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
throw new Error(`--queue: bad
|
|
95
|
+
const badEntry = opts.queue?.find((q) => !QUEUE_ENTRY.test(q));
|
|
96
|
+
if (badEntry !== undefined)
|
|
97
|
+
throw new Error(`--queue: bad entry ${JSON.stringify(badEntry)}: <feature>[:<waitedMin>[:<service>,...]], lowercase names and whole minutes`);
|
|
95
98
|
const libChange = "packages/lib/index.js";
|
|
96
99
|
const gateChange = change ?? (opts.fragmentChange === undefined ? libChange : undefined);
|
|
97
100
|
if (gate && opts.services && gateChange === libChange) {
|
|
@@ -213,18 +216,44 @@ ${githubProject(repos.map((r) => r.name))}${opts.config ? YAML.stringify(opts.co
|
|
|
213
216
|
git(workspace, "commit", "-q", "-m", "record");
|
|
214
217
|
git(workspace, "remote", "add", "origin", record);
|
|
215
218
|
git(workspace, "push", "-q", "-u", "origin", FIXTURE_BRANCH);
|
|
219
|
+
const leases = {};
|
|
216
220
|
if (opts.slotsFull) {
|
|
217
|
-
const leases = {};
|
|
218
221
|
for (let slot = 1; slot <= YAML.parse(PORTS).feature_slots.count; slot++) {
|
|
219
222
|
const other = path.join(root, "ws", `other-${slot}`);
|
|
220
223
|
fs.mkdirSync(other, { recursive: true });
|
|
221
224
|
leases[`other-${slot}`] = { slot, workspace: other };
|
|
222
225
|
}
|
|
223
|
-
// leasesPath() beside configFile: the env that points it here isn't set yet in this process.
|
|
224
|
-
write(path.join(path.dirname(configFile), "scheduler", "leases.json"), JSON.stringify(leases));
|
|
225
226
|
}
|
|
227
|
+
const now = Date.now();
|
|
228
|
+
const queue = (opts.queue ?? []).map((entry, i) => {
|
|
229
|
+
const [feature = entry, waitedMin, services] = QUEUE_ENTRY.exec(entry)?.slice(1) ?? [];
|
|
230
|
+
if (waitedMin === undefined)
|
|
231
|
+
return feature;
|
|
232
|
+
const ws = path.join(root, "ws", feature);
|
|
233
|
+
const names = services?.split(",");
|
|
234
|
+
// 1 CPU and 1 GiB each, so `budget status` and admission have a cost to show and price.
|
|
235
|
+
const compose = Object.fromEntries((names ?? ["app"]).map((s) => [
|
|
236
|
+
s,
|
|
237
|
+
{
|
|
238
|
+
image: "fixture",
|
|
239
|
+
deploy: { resources: { limits: { cpus: "1" }, reservations: { memory: "1g" } } },
|
|
240
|
+
},
|
|
241
|
+
]));
|
|
242
|
+
write(path.join(ws, COMPOSE_FILE), YAML.stringify({ services: compose }));
|
|
243
|
+
leases[feature] = { slot: Object.keys(leases).length + 1, workspace: ws };
|
|
244
|
+
write(waitingPath(ws), JSON.stringify({
|
|
245
|
+
position: i + 1,
|
|
246
|
+
reason: "waiting for capacity",
|
|
247
|
+
...(names && { services: names }),
|
|
248
|
+
since: new Date(now - Number(waitedMin) * 60_000).toISOString(),
|
|
249
|
+
}));
|
|
250
|
+
return feature;
|
|
251
|
+
});
|
|
252
|
+
// leasesPath() beside configFile: the env that points it here isn't set yet in this process.
|
|
253
|
+
if (Object.keys(leases).length)
|
|
254
|
+
write(path.join(path.dirname(configFile), "scheduler", "leases.json"), JSON.stringify(leases));
|
|
226
255
|
if (opts.queue)
|
|
227
|
-
write(path.join(path.dirname(configFile), "scheduler", "queue.json"), JSON.stringify(
|
|
256
|
+
write(path.join(path.dirname(configFile), "scheduler", "queue.json"), JSON.stringify(queue));
|
|
228
257
|
const containers = (opts.containers ?? []).map((c) => {
|
|
229
258
|
const ws = path.join(root, "ws", c.workspace);
|
|
230
259
|
fs.mkdirSync(ws, { recursive: true });
|
|
@@ -291,7 +320,7 @@ const SCRIPT = `#!/bin/sh
|
|
|
291
320
|
# Generated by \`werkmeister workspace init\` (SW-292); rerun it to regenerate.
|
|
292
321
|
# Runs this workspace's own built werkmeister CLI against a seeded fixture workspace, removed on exit:
|
|
293
322
|
# temp HOME and registry, a local bare origin, logging fakes for gh and docker, dead Docker and daemon.
|
|
294
|
-
# usage: with-fixture-workspace [--no-wait] [--gate] [--bare] [--daemon] [--exec-runs] [--merged] [--behind] [--slots-full] [--running <file>] [--queue <feature>[,<feature>]...] [--issue <ref>] [--pr-field <key>=<value>]... [--workspace <file>] [--config <file>] [--services <file>] [--fragment <file>] [--change <path>] [--change-base <file>] [--change-branch <file>] [--fragment-change <file>] [--print <file>]... <werkmeister args> [--then <werkmeister args>]...
|
|
323
|
+
# usage: with-fixture-workspace [--no-wait] [--gate] [--bare] [--daemon] [--exec-runs] [--merged] [--behind] [--slots-full] [--running <file>] [--queue <feature>[,<feature>]... | --queue <feature>:<waitedMin>[:<service>,...]]... [--issue <ref>] [--pr-field <key>=<value>]... [--workspace <file>] [--config <file>] [--services <file>] [--fragment <file>] [--change <path>] [--change-base <file>] [--change-branch <file>] [--fragment-change <file>] [--print <file>]... <werkmeister args> [--then <werkmeister args>]...
|
|
295
324
|
# It only ever runs that CLI, never another command, so one allow rule can cover it (SW-172, SW-231);
|
|
296
325
|
# --exec-runs, given first, also runs the registry's rows on the host, so the workspace asks before it (SW-473).
|
|
297
326
|
ws=$(cd "$(dirname "$0")/../.." && pwd -P) || exit 1
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* markdown artifacts: the workspace `CLAUDE.md`, its routing table, and
|
|
10
10
|
* `.werkmeister/werkmeister-context.md`.
|
|
11
11
|
*/
|
|
12
|
-
import { type ArchetypeRegistry, type ReposConfig, type ServicesConfig } from "../../config.js";
|
|
12
|
+
import { type ArchetypeRegistry, type CacheRegistry, type ReposConfig, type ServicesConfig } from "../../config.js";
|
|
13
13
|
import type { IssueRef } from "../../strategies/types.js";
|
|
14
14
|
/**
|
|
15
15
|
* The public hostname to point the reader at, and the cookie's domain scope.
|
|
@@ -55,4 +55,4 @@ export declare function buildClaudeMd(workspaceName: string, workspaceRoot: stri
|
|
|
55
55
|
* `candidates` is the workspace's services (selected, else its repos'); routing
|
|
56
56
|
* and Caddy sections appear only for those with a URL.
|
|
57
57
|
*/
|
|
58
|
-
export declare function buildSandboxContextMd(feature: string, slot: number, portStart: number, portEnd: number, localServices: string[], servicesConfig: ServicesConfig, testPath?: string, archetypes?: ArchetypeRegistry | null, candidates?: string[], autoStop?: boolean, tempHome?: string, reposConfig?: ReposConfig): string;
|
|
58
|
+
export declare function buildSandboxContextMd(feature: string, slot: number, portStart: number, portEnd: number, localServices: string[], servicesConfig: ServicesConfig, testPath?: string, archetypes?: ArchetypeRegistry | null, candidates?: string[], autoStop?: boolean, tempHome?: string, reposConfig?: ReposConfig, caches?: CacheRegistry): string;
|
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
import * as fs from "node:fs";
|
|
13
13
|
import * as path from "node:path";
|
|
14
14
|
import { containerTestCommand, serviceNoTests, serviceTestCommand, validationRows, wrappedTestCommand, } from "../../archetypes.js";
|
|
15
|
-
import {
|
|
15
|
+
import { cacheSource } from "../../build_caches.js";
|
|
16
|
+
import { baselineUpstream, loadArchetypes, loadCaches, } from "../../config.js";
|
|
16
17
|
import { ingressHostnames, loadFeatureRouters } from "../../feature_routing.js";
|
|
17
18
|
import { loadIngress } from "../../global_config.js";
|
|
18
19
|
import { issueLink } from "../../issue_tracker.js";
|
|
20
|
+
import { HOST_SCRIPT_RULE } from "../../pr_rules.js";
|
|
19
21
|
import { standardsSource, standardsUrl } from "../../skill_gen.js";
|
|
20
22
|
import { getServicePort } from "../../slots.js";
|
|
21
23
|
import { universalStandards } from "../../standards.js";
|
|
@@ -264,6 +266,19 @@ function testCommandLine(feature, svc, servicesConfig, archetypes, lint) {
|
|
|
264
266
|
}
|
|
265
267
|
/** SW-720: in sw-700 host `node`, a compound line and `docker exec … node <script>` were each denied before this form ran. */
|
|
266
268
|
const PROBE_FORM = (tempHome) => `A one-off probe is a \`node --test\` file, run as \`${tempHome} --no-wait node --test <file>\` (in the service's container, after its \`docker exec -w <dir> <container>\`, when the host has no node_modules); never host \`node <script>\`, a compound shell line or \`docker exec … node <script>\`. That form asks each time and is never pre-approved, since it runs any file (SW-510).`;
|
|
269
|
+
// SW-765: sw-753's spec planned to delete turbo cache entries, not knowing the cache is one volume every workspace shares.
|
|
270
|
+
function sharedCachesLine(caches) {
|
|
271
|
+
const entries = Object.entries(caches);
|
|
272
|
+
if (!entries.length)
|
|
273
|
+
return "";
|
|
274
|
+
const list = entries.map(([key, cache]) => {
|
|
275
|
+
const src = cacheSource(key, cache);
|
|
276
|
+
const where = src.kind === "volume" ? `volume \`${src.name}\`` : `host dir \`${src.name}\``;
|
|
277
|
+
const env = Object.entries(cache.env ?? {}).map(([k, v]) => `\`${k}=${v}\``);
|
|
278
|
+
return `\`${key}\` at \`${cache.path}\` (${[...env, where].join(", ")})`;
|
|
279
|
+
});
|
|
280
|
+
return `\nShared caches, mounted by every workspace on this machine: never delete from them (\`werkmeister cache prune\` evicts for every workspace, so it is the person's call). ${list.join("; ")}.\n`;
|
|
281
|
+
}
|
|
267
282
|
/**
|
|
268
283
|
* Render .werkmeister/werkmeister-context.md — how to validate, then (when they apply)
|
|
269
284
|
* ports, service topology, lifecycle commands, health checks.
|
|
@@ -271,7 +286,7 @@ const PROBE_FORM = (tempHome) => `A one-off probe is a \`node --test\` file, run
|
|
|
271
286
|
* `candidates` is the workspace's services (selected, else its repos'); routing
|
|
272
287
|
* and Caddy sections appear only for those with a URL.
|
|
273
288
|
*/
|
|
274
|
-
export function buildSandboxContextMd(feature, slot, portStart, portEnd, localServices, servicesConfig, testPath = "", archetypes = null, candidates = localServices, autoStop = false, tempHome = "", reposConfig = {}) {
|
|
289
|
+
export function buildSandboxContextMd(feature, slot, portStart, portEnd, localServices, servicesConfig, testPath = "", archetypes = null, candidates = localServices, autoStop = false, tempHome = "", reposConfig = {}, caches = loadCaches()) {
|
|
275
290
|
// Routed hosts come from the ingress config + `feature_router:` blocks — the
|
|
276
291
|
// same source Caddy's site blocks are generated from — so this file can never
|
|
277
292
|
// name a host the proxy doesn't actually terminate.
|
|
@@ -449,7 +464,7 @@ The registry's \`test:\` for each service (or its archetype's), run in its conta
|
|
|
449
464
|
: ""}
|
|
450
465
|
|
|
451
466
|
${svcs.map((s, i) => testCommandLine(feature, s, servicesConfig, archetypes ?? loadArchetypes(), svcLint[i])).join("\n")}
|
|
452
|
-
|
|
467
|
+
${sharedCachesLine(caches)}
|
|
453
468
|
`;
|
|
454
469
|
}
|
|
455
470
|
else {
|
|
@@ -518,7 +533,7 @@ How to exercise a change to each service in this workspace.${extraRows
|
|
|
518
533
|
? ` Each test command runs through \`.werkmeister/bin/with-temp-home\`, which gives it a fresh temporary HOME and deletes it on exit: never hand-roll \`HOME=…\`. Start every exercise command with the script itself, never with env assignments or a \`cd\`, so one permission rule matches it: \`${tempHome} <test command>\`. A command that needs an env var takes it after the script (\`${tempHome} env WERKMEISTER_ROOT=… <cmd>\`); no rule pre-approves that form, so it asks. Put \`--no-wait\` first (\`${tempHome} --no-wait <cmd>\`) to skip its host-load and free-memory wait; the allow rules below cover that form too. That wait lasts up to 90 s; if load or memory is still over its limit then, the script exits 75 without running the command (retry later). It prints only on stderr, so a foreground call shows nothing until it ends and its only child is \`werkmeister internal wait-load\`: that is the wait, not a hang. The allow rule that covers them is \`Bash(${tempHome} <test command>:*)\` for each test command below: run those for a test without a prompt. A test command of more than one command (an \`&&\` chain, a \`{ …; }\` group, \`||\`, \`;\` or a pipe) is shown as \`${tempHome} sh -c '…'\`, so every part runs under the temp HOME, and its rule allows that exact line: run it as shown, with no extra arguments. ${PROBE_FORM(tempHome)} The script alone is never allowed either, since it runs any command. The temp HOME only keeps a run from writing to the real one by accident; it is not an isolation boundary. A pre-approved test command or built CLI still runs whatever the worktree holds, a test written in this run included, and that code can reach absolute paths, the caller's env, the network, docker and gh (SW-522).`
|
|
519
534
|
: ""}${linted
|
|
520
535
|
? " A test command starting with `<lint> &&` first runs the repo's lint, the same command the PR gate's lint row runs, so a format error fails here, before the tests, and not first at `werkmeister pr open`."
|
|
521
|
-
: ""}
|
|
536
|
+
: ""} ${HOST_SCRIPT_RULE}
|
|
522
537
|
|
|
523
538
|
${validationTable}${repoCommands}
|
|
524
539
|
|
package/dist/issue_tracker.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ export declare function projectForIssue(issueId: string, named?: string): Projec
|
|
|
95
95
|
export declare function projectOf(data: Record<string, unknown> | null | undefined): string;
|
|
96
96
|
/** A workspace.yml's issue ref: `issue_id`, else the pre-rename `jira_id` / `github_issue`; "" when none. */
|
|
97
97
|
export declare function issueIdOf(data: Record<string, unknown> | null | undefined): string;
|
|
98
|
+
/** A workspace.yml's `group:` members, from a list or a comma-separated string (SW-500). */
|
|
99
|
+
export declare function groupOf(data: Record<string, unknown> | null | undefined): string[];
|
|
98
100
|
/** The issue refs a workspace's status moves cover: its issue, then each `group:` member (SW-500). */
|
|
99
101
|
export declare function issueRefsOf(data: Record<string, unknown> | null | undefined): string[];
|
|
100
102
|
/** A workspace .env's issue ref: `ISSUE_ID`, else the pre-rename `JIRA_ID` / `GITHUB_ISSUE`; "" when none. */
|
package/dist/issue_tracker.js
CHANGED
|
@@ -146,14 +146,18 @@ export function projectOf(data) {
|
|
|
146
146
|
export function issueIdOf(data) {
|
|
147
147
|
return str(data?.issue_id) || str(data?.jira_id) || str(data?.github_issue);
|
|
148
148
|
}
|
|
149
|
+
/** A workspace.yml's `group:` members, from a list or a comma-separated string (SW-500). */
|
|
150
|
+
export function groupOf(data) {
|
|
151
|
+
const group = data?.group;
|
|
152
|
+
const members = Array.isArray(group) ? group : String(group ?? "").split(",");
|
|
153
|
+
return members.map((m) => String(m).trim()).filter(Boolean);
|
|
154
|
+
}
|
|
149
155
|
/** The issue refs a workspace's status moves cover: its issue, then each `group:` member (SW-500). */
|
|
150
156
|
export function issueRefsOf(data) {
|
|
151
157
|
const lead = issueIdOf(data);
|
|
152
158
|
if (!lead)
|
|
153
159
|
return [];
|
|
154
|
-
|
|
155
|
-
const members = Array.isArray(group) ? group : String(group ?? "").split(",");
|
|
156
|
-
return [...new Set([lead, ...members.map((m) => String(m).trim()).filter(Boolean)])];
|
|
160
|
+
return [...new Set([lead, ...groupOf(data)])];
|
|
157
161
|
}
|
|
158
162
|
/** A workspace .env's issue ref: `ISSUE_ID`, else the pre-rename `JIRA_ID` / `GITHUB_ISSUE`; "" when none. */
|
|
159
163
|
export function issueIdOfMeta(meta) {
|
package/dist/lifecycle.js
CHANGED
|
@@ -32,7 +32,7 @@ import { Colors } from "./colors.js";
|
|
|
32
32
|
import {
|
|
33
33
|
// Both spellings: `up`/`down` take an AbortSignal and use the async pair;
|
|
34
34
|
// `remove`/`clean` are not signal verbs (spec D4) and keep the sync ones.
|
|
35
|
-
composeDown, composeDownAsync, composeRestart, composeStop, composeUp, composeUpAsync, composeUpServiceAsync, dependencyOrder, getContainerStatus, liveProject, workspaceForFeature, } from "./compose.js";
|
|
35
|
+
composeDown, composeDownAsync, composeRestart, composeStop, composeUp, composeUpAsync, composeUpServiceAsync, dependencyOrder, getContainerStatus, isOneShotService, liveProject, workspaceForFeature, } from "./compose.js";
|
|
36
36
|
import { COMPOSE_FILE, migrateWorkspaceCompose } from "./compose_file.js";
|
|
37
37
|
import { getVolumeBaseNames, loadPorts, loadServices, needsCluster, sharedProxySkipReason, } from "./config.js";
|
|
38
38
|
import { docker, listVolumeNames, projectContainers, removeVolume } from "./docker.js";
|
|
@@ -729,6 +729,18 @@ export function idleStopFeature(input) {
|
|
|
729
729
|
return feature;
|
|
730
730
|
}
|
|
731
731
|
const GRANTED_NUDGE = "Capacity freed: this workspace's containers are up. Continue where you left off.";
|
|
732
|
+
/**
|
|
733
|
+
* The granted session's nudge. Preemption stops on-demand containers too, and the grant's `up` starts
|
|
734
|
+
* only the default set, so name each one left stopped and how to start it (SW-840).
|
|
735
|
+
*/
|
|
736
|
+
async function grantedNudge(feature) {
|
|
737
|
+
const stopped = (await getContainerStatus(feature)).filter((c) => c.status !== "running" && !isOneShotService(c.service, c.role));
|
|
738
|
+
if (!stopped.length)
|
|
739
|
+
return GRANTED_NUDGE;
|
|
740
|
+
return (`Capacity freed: this workspace started, but these containers are still stopped: ${stopped.map((c) => c.name).join(", ")}. ` +
|
|
741
|
+
`Start them with ${stopped.map((c) => `\`werkmeister feature up --service ${c.service}\``).join(", ")}, ` +
|
|
742
|
+
"then continue where you left off.");
|
|
743
|
+
}
|
|
732
744
|
/**
|
|
733
745
|
* Every running feature as the scheduler sees it, read from Docker now (never a
|
|
734
746
|
* pid: `up` exits once containers start). Longest-inactive first, so ties in
|
|
@@ -809,10 +821,13 @@ async function admitOrQueueHere(feature, workspace, byPerson, starting) {
|
|
|
809
821
|
}
|
|
810
822
|
catch (e) {
|
|
811
823
|
// A failed stop can still have killed it (SW-738): queue it to come back, and wait rather than
|
|
812
|
-
// start over budget; this start had the head's turn, so it keeps it.
|
|
813
|
-
|
|
824
|
+
// start over budget; this start had the head's turn, so it keeps it. A victim that still runs
|
|
825
|
+
// stays out of the queue, or the hook holds its agent over live containers (SW-831).
|
|
826
|
+
const stillRuns = (await getContainerStatus(victim)).some((c) => c.status === "running");
|
|
827
|
+
if (victimWs && !stillRuns)
|
|
814
828
|
await enqueue(victim, victimWs);
|
|
815
|
-
warn(`Could not stop '${victim}' to make room (${e.message}); waiting instead`
|
|
829
|
+
warn(`Could not stop '${victim}' to make room (${e.message}); waiting instead` +
|
|
830
|
+
(stillRuns ? `, and '${victim}' keeps running` : ""));
|
|
816
831
|
return requeueFirst(feature, workspace, starting);
|
|
817
832
|
}
|
|
818
833
|
if (victimWs)
|
|
@@ -859,7 +874,7 @@ async function grantWaitersNow() {
|
|
|
859
874
|
if (await startParked(feature, workspace, waiting.parked.service)) {
|
|
860
875
|
started.push(feature);
|
|
861
876
|
if (liveSessions(workspace).length)
|
|
862
|
-
writeNudge(workspace,
|
|
877
|
+
writeNudge(workspace, await grantedNudge(feature));
|
|
863
878
|
}
|
|
864
879
|
continue;
|
|
865
880
|
}
|
|
@@ -883,7 +898,7 @@ async function grantWaitersNow() {
|
|
|
883
898
|
continue;
|
|
884
899
|
started.push(feature);
|
|
885
900
|
if (liveSessions(workspace).length)
|
|
886
|
-
writeNudge(workspace,
|
|
901
|
+
writeNudge(workspace, await grantedNudge(feature));
|
|
887
902
|
}
|
|
888
903
|
return started;
|
|
889
904
|
}
|
package/dist/pr_lifecycle.d.ts
CHANGED
|
@@ -168,11 +168,14 @@ type Rendered = {
|
|
|
168
168
|
services: ServicesConfig;
|
|
169
169
|
repos: Record<string, RepoEntry>;
|
|
170
170
|
setup_services: ServicesConfig;
|
|
171
|
+
infrastructure?: Record<string, unknown>;
|
|
172
|
+
caches?: Record<string, unknown>;
|
|
171
173
|
};
|
|
172
174
|
/**
|
|
173
175
|
* What the repo's own fragment changes for its gate (SW-573): its services whose rendered
|
|
174
176
|
* entries differ from the base's (*before*), or `all` naming the change that reaches every
|
|
175
|
-
* service (a `repo:` key, its own `setup_services
|
|
177
|
+
* service (a `repo:` key, its own `setup_services`, an `infrastructure:` or `caches:` entry,
|
|
178
|
+
* SW-665). A mapping change counts only when it
|
|
176
179
|
* moves a file of this diff: otherwise it changes no test.
|
|
177
180
|
*/
|
|
178
181
|
export declare function fragmentTouched(dir: string, files: string[], branch: Rendered, before: Rendered): {
|
package/dist/pr_lifecycle.js
CHANGED
|
@@ -18,7 +18,7 @@ import { containerOf, dotDir, IDLE_SERVICE_TYPES, isFixture, loadArchetypes, loa
|
|
|
18
18
|
import { GATE_COMPOSE_FILE, renderGateCompose } from "./generate.js";
|
|
19
19
|
import { updateNoteStatus } from "./graduate.js";
|
|
20
20
|
import { eachIssue, issueStatuses, moveIssue } from "./issue_status.js";
|
|
21
|
-
import { issueRefsOf, issueTracker, projectOf } from "./issue_tracker.js";
|
|
21
|
+
import { groupOf, issueIdOf, issueRefsOf, issueTracker, projectOf } from "./issue_tracker.js";
|
|
22
22
|
import { grantWaiters, idleStopMinutes, lastExecMarker, liveSessions, readServicesFromWorkspace, runningFeatures, startService, stop as stopFeature, stopIdle, } from "./lifecycle.js";
|
|
23
23
|
import { originSlug, prWatchScheduleState, } from "./machine_setup.js";
|
|
24
24
|
import { openDecisions } from "./notes.js";
|
|
@@ -409,7 +409,8 @@ export function unmappedFiles(files, repo) {
|
|
|
409
409
|
/**
|
|
410
410
|
* What the repo's own fragment changes for its gate (SW-573): its services whose rendered
|
|
411
411
|
* entries differ from the base's (*before*), or `all` naming the change that reaches every
|
|
412
|
-
* service (a `repo:` key, its own `setup_services
|
|
412
|
+
* service (a `repo:` key, its own `setup_services`, an `infrastructure:` or `caches:` entry,
|
|
413
|
+
* SW-665). A mapping change counts only when it
|
|
413
414
|
* moves a file of this diff: otherwise it changes no test.
|
|
414
415
|
*/
|
|
415
416
|
export function fragmentTouched(dir, files, branch, before) {
|
|
@@ -429,6 +430,14 @@ export function fragmentTouched(dir, files, branch, before) {
|
|
|
429
430
|
for (const n of setup.sort())
|
|
430
431
|
if (!isDeepStrictEqual(branch.setup_services[n], before.setup_services[n]))
|
|
431
432
|
reasons.push(`setup_services: ${n}`);
|
|
433
|
+
// Entries carry no repo:, but both sides hold the same other fragments, so a difference is this repo's (SW-665).
|
|
434
|
+
for (const section of ["infrastructure", "caches"]) {
|
|
435
|
+
const b = branch[section] ?? {};
|
|
436
|
+
const m = before[section] ?? {};
|
|
437
|
+
for (const n of [...new Set([...Object.keys(b), ...Object.keys(m)])].sort())
|
|
438
|
+
if (!isDeepStrictEqual(b[n], m[n]))
|
|
439
|
+
reasons.push(`${section}: ${n}`);
|
|
440
|
+
}
|
|
432
441
|
const services = (br["services"] ?? [])
|
|
433
442
|
.filter((s) => !isDeepStrictEqual(branch.services[s], before.services[s]))
|
|
434
443
|
.sort();
|
|
@@ -594,6 +603,40 @@ async function mergeCheck(dir, file, deps) {
|
|
|
594
603
|
}
|
|
595
604
|
return `rebase allowed on ${base}`;
|
|
596
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* SW-829: `pr open` and the ship move every `group:` member with the lead, so a member no commit
|
|
608
|
+
* subject on the branch names would ship as Done. A warning like SW-457's: dropping it is the
|
|
609
|
+
* person's call. Reads every PR file's worktree, since a member's commit may sit in another repo.
|
|
610
|
+
*/
|
|
611
|
+
async function groupCheck(ws, cfg, file, deps) {
|
|
612
|
+
const lead = issueIdOf(cfg);
|
|
613
|
+
const members = groupOf(cfg).filter((m) => m !== lead);
|
|
614
|
+
const ranges = new Map();
|
|
615
|
+
for (const f of readPrFiles(ws))
|
|
616
|
+
ranges.set(f.dir, `origin/${String(f.fm["base"] ?? "main")}..HEAD`);
|
|
617
|
+
const subjects = [];
|
|
618
|
+
for (const [d, range] of ranges) {
|
|
619
|
+
const r = await deps.run("git", ["-C", path.join(ws, d), "log", "--format=%s", range]);
|
|
620
|
+
if (r.code !== 0)
|
|
621
|
+
return `warning: could not read ${d}'s commits in ${range} — ${(r.stderr || r.stdout).trim() || `exit ${r.code}`}`;
|
|
622
|
+
subjects.push(...r.stdout.split("\n"));
|
|
623
|
+
}
|
|
624
|
+
// A whole key, any case: SW-3 is not named by SW-30 or XSW-3; sw-3 is.
|
|
625
|
+
const named = (key) => {
|
|
626
|
+
const re = new RegExp(`(^|[^A-Za-z0-9-])${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![0-9])`, "i");
|
|
627
|
+
return subjects.some((s) => re.test(s));
|
|
628
|
+
};
|
|
629
|
+
const missing = members.filter((m) => !named(m));
|
|
630
|
+
if (!missing.length)
|
|
631
|
+
return `every group: member has a commit: ${members.join(", ")}`;
|
|
632
|
+
const where = [...ranges].map(([d, range]) => `${range} (${d})`).join(", ");
|
|
633
|
+
const branch = String(file.fm["branch"] ?? "");
|
|
634
|
+
const comment = `Dropped from ${lead ? `${lead}'s` : "the"} grouped PR${branch ? ` (branch ${branch})` : ""}: no commit for it`;
|
|
635
|
+
// shortcut: "To Do" is Jira's default; a GitHub tracker or a renamed status needs its own name, add a todo point if that bites.
|
|
636
|
+
return missing
|
|
637
|
+
.map((m) => `warning: ${m} has no commit in ${where}, so it would ship as Done with this PR — remove it from group: in .werkmeister/workspace.yml, then put it back: werkmeister issue update ${m} --status "To Do" --comment ${JSON.stringify(comment)}`)
|
|
638
|
+
.join("\n");
|
|
639
|
+
}
|
|
597
640
|
// Moved beside hostLoadLimit so lifecycle's container starts can use it without an import cycle (SW-630).
|
|
598
641
|
export { waitForHostLoadNow };
|
|
599
642
|
function filterSplit(cmd) {
|
|
@@ -749,9 +792,11 @@ testsOnly = false) {
|
|
|
749
792
|
: `all PASS${manual.length ? `; MANUAL, for the reviewer: ${manual.map((r) => cellsOf(r.row)[0]).join("; ")}` : ""}`);
|
|
750
793
|
add("approved", statusOf(file) === "approved", `status: ${statusOf(file)}`);
|
|
751
794
|
add("repo", ...(await repoCheck(path.join(ws, file.dir), file, deps)));
|
|
752
|
-
const
|
|
753
|
-
if (
|
|
795
|
+
const wsCfg = loadConfigFile(ws, null);
|
|
796
|
+
if (groupOf(wsCfg).length) {
|
|
754
797
|
add("merge", true, await mergeCheck(dir, file, deps));
|
|
798
|
+
add("group", true, await groupCheck(ws, wsCfg, file, deps));
|
|
799
|
+
}
|
|
755
800
|
// exercise.md is a file read too, so a malformed table fails before the tests (SW-286).
|
|
756
801
|
const skipExercise = reason(file.fm["skip_exercise"]);
|
|
757
802
|
if (skipExercise)
|
package/dist/pr_rules.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export declare const APPROVAL_NOTE: {
|
|
|
4
4
|
readonly chatPr: "status: approved # approved in chat YYYY-MM-DD";
|
|
5
5
|
readonly checkInPr: "status: approved # approved via check-in YYYY-MM-DD";
|
|
6
6
|
};
|
|
7
|
+
export declare const HOST_SCRIPT_RULE = "A check only the person can run on the host goes in a script in the workspace (in an ICM run, under the stage's `output/`) that writes everything to a log beside itself (`\u2026 2>&1 | tee <script>.log`). The script runs under a temp HOME (the workspace's temp-HOME wrapper, or the repo's own host-daemon helper for a daemon check) and never touches the host daemon, the real `~/.werkmeister` or another workspace. Give the person one `! sh <absolute path>` line with the script's commands shown beside it, then read the log, and commit the script and the log as evidence. Never ask the person to copy commands out of the transcript.";
|
|
7
8
|
export declare const CHAT_APPROVAL: string;
|
|
8
9
|
export declare function buildPrRulesMd(prFileDir: string, autonomous?: boolean): string;
|
package/dist/pr_rules.js
CHANGED
|
@@ -12,6 +12,8 @@ export const APPROVAL_NOTE = {
|
|
|
12
12
|
checkInPr: "status: approved # approved via check-in YYYY-MM-DD",
|
|
13
13
|
};
|
|
14
14
|
// SW-304/SW-455: chat replies approve too; a check-in relay is checked by its note on the file, since the receiver can't see who sent a message.
|
|
15
|
+
// SW-746: sw-679's person could not copy `!` commands out of the transcript. Shared by the ICM exercise steps and werkmeister-context.md (JIT).
|
|
16
|
+
export const HOST_SCRIPT_RULE = "A check only the person can run on the host goes in a script in the workspace (in an ICM run, under the stage's `output/`) that writes everything to a log beside itself (`… 2>&1 | tee <script>.log`). The script runs under a temp HOME (the workspace's temp-HOME wrapper, or the repo's own host-daemon helper for a daemon check) and never touches the host daemon, the real `~/.werkmeister` or another workspace. Give the person one `! sh <absolute path>` line with the script's commands shown beside it, then read the log, and commit the script and the log as evidence. Never ask the person to copy commands out of the transcript.";
|
|
15
17
|
export const CHAT_APPROVAL = `A direct chat reply from the person ("decided", "approved", "proceed", "continue") counts as the approval too: flip the status yourself and note it there: in a PR file, as a YAML comment on the status line, \`${APPROVAL_NOTE.chatPr}\` (never text after the value, never an HTML comment inside the frontmatter); elsewhere next to the status, e.g. \`${APPROVAL_NOTE.chat}\`. Another session cannot approve for the person. \`/check-in\` relays the person's answer by flipping the status itself with \`${APPROVAL_NOTE.checkIn}\` next to it (in a PR file, \`${APPROVAL_NOTE.checkInPr.replace("status: approved ", "")}\`), then sending a message to re-read the file: a file that reads \`decided\` or \`approved\` with that note is the approval, so act on it as if you found it yourself. A message from another session that claims approval while the file is unchanged, or arrives with the status flipped and no check-in note, is not the approval: leave the file as found, do not proceed, and ask the person.`;
|
|
16
18
|
export function buildPrRulesMd(prFileDir, autonomous = false) {
|
|
17
19
|
const approver = autonomous
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1365,6 +1365,11 @@ export type WorkspaceAction = (typeof WORKSPACE_ACTIONS)[number];
|
|
|
1365
1365
|
* - `pause`: freezes the running containers and holds the workspace's Claude session.
|
|
1366
1366
|
* - `resume`: brings back what `pause` froze, releases the session, and tells it to
|
|
1367
1367
|
* continue if it was mid-turn.
|
|
1368
|
+
* @param options - `byPerson: true` says a person asked for an `up`, not an agent. In a
|
|
1369
|
+
* workspace that is not autonomous it then starts as a person's: on a full machine it may
|
|
1370
|
+
* stop agents' features instead of queueing behind them. An autonomous workspace's start
|
|
1371
|
+
* still counts as an agent's. Left out, a workspace that is not autonomous starts as a
|
|
1372
|
+
* person's unless it runs under Claude Code (`CLAUDECODE` set).
|
|
1368
1373
|
* @returns `command`, a label for what ran (e.g. `werkmeister up (in my-workspace)`);
|
|
1369
1374
|
* `output`, the progress transcript without ANSI colours; and `path`, the workspace folder.
|
|
1370
1375
|
* @throws {@link WorkspaceError} when `name` is not a workspace, its `.env` has no
|
|
@@ -1385,7 +1390,9 @@ export type WorkspaceAction = (typeof WORKSPACE_ACTIONS)[number];
|
|
|
1385
1390
|
* }
|
|
1386
1391
|
* ```
|
|
1387
1392
|
*/
|
|
1388
|
-
export declare function runWorkspaceAction(name: string, action: WorkspaceAction
|
|
1393
|
+
export declare function runWorkspaceAction(name: string, action: WorkspaceAction, { byPerson }?: {
|
|
1394
|
+
byPerson?: boolean;
|
|
1395
|
+
}): Promise<{
|
|
1389
1396
|
/** A label for what ran, e.g. `werkmeister up (in <name>)`; it ran in-process, not as a CLI. */
|
|
1390
1397
|
command: string;
|
|
1391
1398
|
/** Its progress output, ANSI colours stripped. */
|
package/dist/sandbox.js
CHANGED
|
@@ -66,7 +66,7 @@ import { abandonWorkspace, commitsAhead, lifecycleOf, originBase, removalBlocker
|
|
|
66
66
|
import { collectingReporter, info, warn, withReporter } from "./reporter.js";
|
|
67
67
|
import { DASHBOARD, status as webStatus } from "./web_servers.js";
|
|
68
68
|
import { provisionWorkspace, WorkspaceInitError } from "./workspace_init.js";
|
|
69
|
-
import { computePromptSpec, isTrue, loadConfigFile, resolveInputs } from "./workspace_prompts.js";
|
|
69
|
+
import { computePromptSpec, isTrue, loadConfigFile, readAutonomous, resolveInputs, } from "./workspace_prompts.js";
|
|
70
70
|
import { legacyAgent, prNeeds, workspaceState, } from "./workspace_state.js";
|
|
71
71
|
import { revokeWorkspaceToken } from "./workspace_token.js";
|
|
72
72
|
import { hasGit, listRepoWorktrees } from "./worktrees.js";
|
|
@@ -2730,6 +2730,11 @@ export const WORKSPACE_ACTIONS = ["up", "stop", "restart", "down", "pause", "res
|
|
|
2730
2730
|
* - `pause`: freezes the running containers and holds the workspace's Claude session.
|
|
2731
2731
|
* - `resume`: brings back what `pause` froze, releases the session, and tells it to
|
|
2732
2732
|
* continue if it was mid-turn.
|
|
2733
|
+
* @param options - `byPerson: true` says a person asked for an `up`, not an agent. In a
|
|
2734
|
+
* workspace that is not autonomous it then starts as a person's: on a full machine it may
|
|
2735
|
+
* stop agents' features instead of queueing behind them. An autonomous workspace's start
|
|
2736
|
+
* still counts as an agent's. Left out, a workspace that is not autonomous starts as a
|
|
2737
|
+
* person's unless it runs under Claude Code (`CLAUDECODE` set).
|
|
2733
2738
|
* @returns `command`, a label for what ran (e.g. `werkmeister up (in my-workspace)`);
|
|
2734
2739
|
* `output`, the progress transcript without ANSI colours; and `path`, the workspace folder.
|
|
2735
2740
|
* @throws {@link WorkspaceError} when `name` is not a workspace, its `.env` has no
|
|
@@ -2750,7 +2755,7 @@ export const WORKSPACE_ACTIONS = ["up", "stop", "restart", "down", "pause", "res
|
|
|
2750
2755
|
* }
|
|
2751
2756
|
* ```
|
|
2752
2757
|
*/
|
|
2753
|
-
export async function runWorkspaceAction(name, action) {
|
|
2758
|
+
export async function runWorkspaceAction(name, action, { byPerson } = {}) {
|
|
2754
2759
|
if (!WORKSPACE_ACTIONS.includes(action)) {
|
|
2755
2760
|
throw new WorkspaceError(`Invalid action: ${JSON.stringify(action)}`);
|
|
2756
2761
|
}
|
|
@@ -2770,7 +2775,10 @@ export async function runWorkspaceAction(name, action) {
|
|
|
2770
2775
|
await withReporter(collector, async () => {
|
|
2771
2776
|
switch (action) {
|
|
2772
2777
|
case "up": {
|
|
2773
|
-
|
|
2778
|
+
// A person's press in an agent's (autonomous) workspace must not stop other agents (SW-833).
|
|
2779
|
+
const result = await up(feature, target, {
|
|
2780
|
+
byPerson: byPerson && !readAutonomous(target),
|
|
2781
|
+
});
|
|
2774
2782
|
// The only fact the CLI's summary block carried that the transcript
|
|
2775
2783
|
// does not: `up()` reports the slot and ports, never the hostnames.
|
|
2776
2784
|
if (result.urls.length) {
|
package/dist/strategies/icm.js
CHANGED
|
@@ -138,7 +138,10 @@ function renderStandards(r) {
|
|
|
138
138
|
function standardsRef(tier, r) {
|
|
139
139
|
if (tier === "none")
|
|
140
140
|
return "";
|
|
141
|
-
|
|
141
|
+
const rows = tier === "all" ? [...r.active, "ponytail"] : tier.filter((d) => r.active.includes(d));
|
|
142
|
+
if (!rows.length)
|
|
143
|
+
return "";
|
|
144
|
+
return `- Reference (every run): \`../../_shared/standards.md\` — rows ${rows.map((d) => `\`${d}\``).join(", ")}`;
|
|
142
145
|
}
|
|
143
146
|
// The first stage's start is the one point no code observes, so its contract runs the move (SW-27).
|
|
144
147
|
// SW-500: its allow rule matches only the bare command; a chained call went to auto mode, which denied it.
|
|
@@ -44,8 +44,8 @@ export interface Stage {
|
|
|
44
44
|
enter?: string;
|
|
45
45
|
/** The `output/` file whose `status: proposed` line the human check flips, when the stage has no other gate. */
|
|
46
46
|
gate?: string;
|
|
47
|
-
/** Which _shared/standards.md rows the contract names. */
|
|
48
|
-
standards: "none" | "all";
|
|
47
|
+
/** Which _shared/standards.md rows the contract names; a list names rows, kept only when active. */
|
|
48
|
+
standards: "none" | "all" | string[];
|
|
49
49
|
/** SW-807: `werkmeister` subcommands this stage runs, pre-approved for the whole run; init reads them from here, never from the rendered CONTEXT.md, which the agent can edit. */
|
|
50
50
|
grants?: string[];
|
|
51
51
|
contract(v: IcmVars): Contract;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* restated.
|
|
8
8
|
*/
|
|
9
9
|
import { COMPOSE_FILE } from "../compose_file.js";
|
|
10
|
-
import { APPROVAL_NOTE, CHAT_APPROVAL } from "../pr_rules.js";
|
|
10
|
+
import { APPROVAL_NOTE, CHAT_APPROVAL, HOST_SCRIPT_RULE } from "../pr_rules.js";
|
|
11
11
|
// SW-135: a container that never started has no `pnpm` in /opt/werkmeister-tools until `werkmeister feature up`
|
|
12
12
|
// bootstraps it, so `docker restart` on it loops on "pnpm: not found".
|
|
13
13
|
const RELOAD_RULE = "If the container is not running, run `werkmeister feature up` once first; `docker restart` only reloads one that is already running. " +
|
|
@@ -43,7 +43,9 @@ const TEST_TAIL = "A subagent you brief to run tests or the CLI gets that wrappe
|
|
|
43
43
|
"A skipped test is not a pass: name each one with its skip reason, and run it where it can run (the workspace container) or say where it will (the gate, CI). " +
|
|
44
44
|
// SW-334: `cmd1 && cmd2 > log` redirects only cmd2; the group sends the whole chain to the log.
|
|
45
45
|
// SW-526: a background job's notice carries the exit code; a trailing echo would make it always read 0.
|
|
46
|
-
'Redirect output to a file as one group, so every command in an `&&` chain lands there. For a background job (`run_in_background`) write background: `{ <test command>; } > <log> 2>&1` and read the exit code from the job\'s completion notice; for a foreground call write foreground: `{ <test command>; } > <log> 2>&1; echo "exit $?"`. Read back only the failing slice.'
|
|
46
|
+
'Redirect output to a file as one group, so every command in an `&&` chain lands there. For a background job (`run_in_background`) write background: `{ <test command>; } > <log> 2>&1` and read the exit code from the job\'s completion notice; for a foreground call write foreground: `{ <test command>; } > <log> 2>&1; echo "exit $?"`. Read back only the failing slice. ' +
|
|
47
|
+
// SW-764: a stalled background job sends no notice, so waiting on one never ends by itself.
|
|
48
|
+
"For a background test or gate job you wait on, check its log's last-write time: after 10 minutes with no write, stop it and rerun it once, then tell the person if it stalls again.";
|
|
47
49
|
const TEST_STEP = HOST_TESTS +
|
|
48
50
|
"Once it passes, run `werkmeister pr gate --tests` (from the workspace, as a background job with its log, as rule 3 of `_shared/pr-rules.md` shows) and fix what it fails; record both exit codes. " +
|
|
49
51
|
TEST_TAIL;
|
|
@@ -57,8 +59,11 @@ const REVIEW_DELTA = "If the exercise below changes code, rerun the review on th
|
|
|
57
59
|
const diffCheck = (doc) => `Before running tests, read \`git diff\` in each repo you touched and tick off each edit \`${doc}\` settled against it: an edit reported as applied can be missing.`;
|
|
58
60
|
// SW-562: sw-499's two MANUAL rows (a real VS Code window) were approved unrun and shipped as MANUAL, never recorded.
|
|
59
61
|
// SW-613: sw-594's browser row listed pages only ("what am I looking for?"); sw-601 saw another workspace's copy with no cookie set.
|
|
60
|
-
const MANUAL_STEP = "Before asking for approval, list the exercise rows only a person can run (a real VS Code window, a device, a browser). Ask the person for each one's result, one question per row (pass / fail / not run). Each question states the URL to open, how to reach this workspace's copy (the `X-Feature` cookie or selector for a routed hostname, which serves another workspace's copy when none is set, or the container's direct published port, `localhost:<port>`, from `werkmeister-context.md`), and the visible before → after that means PASS; a question that only lists pages to open is not asked. Write the answer into `exercise.md`: PASS or FAIL in the table, and for a row not run a `MANUAL: not run (person's reason)` line under it (the table's result cell stays PASS or FAIL). An approval that skips this keeps those rows MANUAL, and the PR file says why."
|
|
62
|
+
const MANUAL_STEP = "Before asking for approval, list the exercise rows only a person can run (a real VS Code window, a device, a browser). Ask the person for each one's result, one question per row (pass / fail / not run). Each question states the URL to open, how to reach this workspace's copy (the `X-Feature` cookie or selector for a routed hostname, which serves another workspace's copy when none is set, or the container's direct published port, `localhost:<port>`, from `werkmeister-context.md`), and the visible before → after that means PASS; a question that only lists pages to open is not asked. Write the answer into `exercise.md`: PASS or FAIL in the table, and for a row not run a `MANUAL: not run (person's reason)` line under it (the table's result cell stays PASS or FAIL). An approval that skips this keeps those rows MANUAL, and the PR file says why. " +
|
|
63
|
+
HOST_SCRIPT_RULE;
|
|
61
64
|
const SKIPPED = "every skipped test by name with its skip reason and where it ran instead";
|
|
65
|
+
// SW-126: the stages already ran each service's tests in its container before propose (SW-316, SW-430, SW-506); record them per service.
|
|
66
|
+
const PER_SERVICE = "the `pr gate --tests` result for each service it tested (one line per service row)";
|
|
62
67
|
// SW-438: a grouped PR commits per ticket as it goes; the uncommitted-diff contracts contradicted it (sw-323).
|
|
63
68
|
const keys = (group) => group.map((k) => `\`${k}\``).join(", ");
|
|
64
69
|
// The merge-base keeps the fold in place; `origin/main` would also move every commit onto an untested base.
|
|
@@ -85,6 +90,8 @@ const reviewStep = (rerun, group) => "Review the diff: for each code worktree yo
|
|
|
85
90
|
`"run the \`ponytail:ponytail-review\` skill over this worktree's ${group.length
|
|
86
91
|
? "commits in `origin/main...HEAD` (the PR's base in place of `main` when it differs), plus any uncommitted changes and untracked files"
|
|
87
92
|
: "uncommitted changes, untracked files included"}" — not how you built it, so the review is not anchored on your reasoning. ` +
|
|
93
|
+
// SW-764: sw-753's background review wrote its transcript once and never reported; the session waited 3.5 h.
|
|
94
|
+
"Run that subagent in the foreground when nothing else is pending. When it runs in the background, check its transcript's last-write time; after 10 minutes with no write, stop it and relaunch it once, and tell the person if the relaunch stalls too. " +
|
|
88
95
|
// SW-431: a diff-scoped review missed two trust-boundary holes in a newly pre-approved wrapper (sw-292).
|
|
89
96
|
'If the change adds or widens an allow rule or another pre-approved command, add to the brief: "this change pre-approves a command: list every file, env var, network address or process it can reach from its arguments, and treat each that leaves the workspace or its temp HOME as Must fix". ' +
|
|
90
97
|
// SW-479: an exercise script that could restart the host daemon was rated Should fix and left open (sw-439).
|
|
@@ -103,6 +110,8 @@ const CPU_PROFILE = "When the ticket is about gate, test or build speed, sample
|
|
|
103
110
|
"Task start and end times alone do not show whether a path matters. If the run holds all its CPUs, only a CPU cut shortens it, and the decision says so.";
|
|
104
111
|
// SW-796: sw-752 decided on one "−40% CPU-s" run under host load 4–7; a paired, alternating A/B under the load wait showed it 30% slower.
|
|
105
112
|
const TIMING_CLAIM = "A CPU or wall-time number that a decision or acceptance criterion rests on comes from paired, alternating A/B runs (A1 B1 A2 B2 A3 B3, at least 3 each) through `.werkmeister/bin/with-temp-home` with its load wait on, in a Linux container (on macOS the wrapper waits on free memory only, never on load), never from a single run or `--no-wait`; record every run's numbers and the host load beside them.";
|
|
113
|
+
// SW-810: sw-800's spec promised a byte-for-byte skill copy; the docs checks failed it only at the gate.
|
|
114
|
+
const COPIED_MARKDOWN = "When the change adds or moves markdown into a repo (a copied skill, doc or reference), copy it into the worktree, run the repo's lint command on it (the `<lint> &&` head of its test command in `werkmeister-context.md`, in the service's container, where the repo's docs checks run) and record each failure in `inventory.md`; then remove the copy. `decisions.md` names the edits the text needs, or that the copy passed unchanged.";
|
|
106
115
|
// SW-106 decision 7 renamed a legacy alias that `git log -S` would have shown was meant to be removed.
|
|
107
116
|
const NAME_HISTORY_STEP = "For each decision that renames, keeps or removes a name, a fallback or an alias, record its definition site (file and line) and the commit that introduced it (`git log -S <name>`, in the repo that defines it). " +
|
|
108
117
|
'When that commit marks it as a transition or legacy alias, list "remove" as an option beside rename and keep.';
|
|
@@ -126,8 +135,11 @@ export const SELF_CHECK = "Review `output/` once against `../../BRIEF.md` and th
|
|
|
126
135
|
// The gate reads every `result` column and rejects any other cell text (SW-247, SW-286).
|
|
127
136
|
const exerciseFormat = (col) => `a \`| check | result | ${col} |\` table whose result cell is exactly \`PASS\` or \`FAIL\` — nothing else in the cell — with the captured output in the ${col} column. The rule holds for every table in \`exercise.md\`; describe a superseded run in prose, not as a \`FAIL\` row`;
|
|
128
137
|
// SW-736: `changeset status --since` reads git history, so before the commit it failed on an entry just written (sw-699, sw-755).
|
|
129
|
-
|
|
138
|
+
// SW-825: the gate stops what it started (SW-34), so sw-798's check hit "container … is not running".
|
|
139
|
+
const RELEASE_AFTER_COMMIT = "Run the repo's release check (the `Release check:` command in `werkmeister-context.md`) after the commit, not before: a check that compares the branch with its base in git history does not see an uncommitted release entry. When it runs in a service's container, an earlier `werkmeister pr gate --tests` stopped the containers it started: start the one it runs in with `werkmeister feature up --service <name>` first.";
|
|
130
140
|
const LINT = "the repo's lint command (the `<lint> &&` head of the test command in `werkmeister-context.md`, when it has one, which the PR gate's lint row runs) and fix what it fails, release entry included.";
|
|
141
|
+
// SW-793: sw-772 filed ten follow-ups with no epic; grouping them after the PR meant editing 12 tickets again.
|
|
142
|
+
const followUpGroup = (tool) => `Before filing 3 or more follow-up tickets, ask the person where they go${tool ? ` (through \`${tool}\`)` : ""}: an existing epic (by name), a new epic (with a proposed title), a label, or none. File each with that parent or label, and record the choice in this stage's output.`;
|
|
131
143
|
// SW-807: exact, this workspace's own issue only. The feature, gate and status commands keep asking:
|
|
132
144
|
// each can reach shared infra, another workspace or the real ~/.werkmeister from agent-editable input.
|
|
133
145
|
const START_GRANTS = ["issue start", "issue view"];
|
|
@@ -156,7 +168,8 @@ const propose = {
|
|
|
156
168
|
// SW-399: a changeset written after the last lint run failed the gate only at `pr open`.
|
|
157
169
|
`Before committing, run ${LINT} ${RELEASE_AFTER_COMMIT}${REBASE}`,
|
|
158
170
|
// SW-535: sw-385 promised a follow-up in decisions.md; nothing said to file it, so the first `pr open` stopped at the gate.
|
|
159
|
-
"Before the PR file: for each follow-up a decided question in `decisions.md` promises, file it through `../../_shared/issues-report.md` and write its issue key beside that decision. The gate's follow-ups check stays as the backstop."
|
|
171
|
+
"Before the PR file: for each follow-up a decided question in `decisions.md` promises, file it through `../../_shared/issues-report.md` and write its issue key beside that decision. The gate's follow-ups check stays as the backstop. " +
|
|
172
|
+
followUpGroup(v.questionTool),
|
|
160
173
|
"Write `output/pr-<worktree>.md` per repo touched, in the format of `_shared/pr-rules.md`, at `status: draft`, with `repo:` taken from `git -C <worktree> remote get-url origin` (as `owner/repo`; the gate rejects any other value). Title: `<type>(<scope>): <ISSUE-ID> <summary>`. Body: summary, the test and exercise results from prior outputs (every table with a `result` column — the gate reads them all — has a result cell of exactly `PASS` and the output in its own column: a FAIL cell anywhere in the PR file stops the PR, so describe a pre-fix reproduction in prose, not as a FAIL row), the acceptance table from step 1, and `Fixes <issue>` when the tracker is GitHub." +
|
|
161
174
|
(v.group.length
|
|
162
175
|
? " Start the body with `Rebase and merge, not squash: one commit per ticket, each revertable alone.` and list each member under the summary."
|
|
@@ -207,11 +220,15 @@ const feature = [
|
|
|
207
220
|
"When a decision rests on how an external tool behaves (a CLI command or flag, a plugin API, an event name), check it against the installed tool, not only its docs: record `<bin> --version`, and confirm each fact with `<bin> <cmd> --help` or a real run or plugin load. `decisions.md` names the version and, beside each fact, the command that confirmed it; a fact only the docs support is marked `unverified: docs only`, and no decision rests on it. If the tool cannot be installed, say so and mark every such fact `unverified`. " +
|
|
208
221
|
// SW-605: sw-583 recommended a GitHub API call as `unverified` only in the file; the person approved it and a read-only call later returned 403.
|
|
209
222
|
"A recommended answer that rests on an external API, permission or platform behaviour (a token scope, a hosted API's response, a cloud permission) is checked live, read-only (a list, get, `--help` or dry run, never a write), before it goes into `decisions.md`, with the command and its result beside it. When it cannot be checked read-only, write `unverified` in the option text itself, so the question the person is asked carries the word, not only the file. " +
|
|
223
|
+
// SW-765: sw-753's host scratch probe got npm's .gitignore handling and the turbo cache dir wrong for the real repo.
|
|
224
|
+
"A probe of tool behaviour runs in the service's container, with the repo's own layout; starting it with `werkmeister feature up --service <svc>` is allowed for that. A probe in a host scratch project is marked `host scratch` beside the fact, and re-checked in the container before a decision rests on it. " +
|
|
210
225
|
PREAPPROVED_INPUT +
|
|
211
226
|
" " +
|
|
212
227
|
CPU_PROFILE +
|
|
213
228
|
" " +
|
|
214
|
-
TIMING_CLAIM
|
|
229
|
+
TIMING_CLAIM +
|
|
230
|
+
" " +
|
|
231
|
+
COPIED_MARKDOWN,
|
|
215
232
|
"Write `output/inventory.md`: steps 1–3.",
|
|
216
233
|
NAME_HISTORY_STEP,
|
|
217
234
|
`Write \`output/decisions.md\`: every open question in \`BRIEF.md\`, each as a heading with \`status: proposed\`, your recommended answer, and the evidence from steps 1–3 and 5. Leave the answer blank when only a person can give it (a ticket key, a preference). ${CRITERION_REACH}`,
|
|
@@ -238,7 +255,7 @@ const feature = [
|
|
|
238
255
|
],
|
|
239
256
|
doNotLoad: "source files already summarised in `inventory.md` (if it looks wrong, fix `inventory.md` and tell the person), `.werkmeister/*.yml`, other stages.",
|
|
240
257
|
process: [
|
|
241
|
-
`Write \`output/spec.md\`: what changes, file by file; the interfaces or schemas added; the tests that will prove it; what is explicitly out of scope.${v.group.length ? " This is a grouped PR: list one commit per ticket (`<KEY> …`) and what each holds, but do not fix their order." : ""}${noCommitPlan(v.group)}`,
|
|
258
|
+
`Write \`output/spec.md\`: what changes, file by file; the interfaces or schemas added; the tests that will prove it; what is explicitly out of scope. Promise an unchanged (byte-for-byte) copy of markdown only when \`inventory.md\` records the repo's lint passing on it; otherwise list the edits.${v.group.length ? " This is a grouped PR: list one commit per ticket (`<KEY> …`) and what each holds, but do not fix their order." : ""}${noCommitPlan(v.group)}`,
|
|
242
259
|
"If the change has a machine-checkable artifact (a schema, an API document, a migration), write it in the repo and validate it with a command that needs no new dependency. Record the exact command in `spec.md`.",
|
|
243
260
|
"Map each acceptance criterion in `BRIEF.md` to the step or test in `spec.md` that satisfies it. A criterion with no mapping is a defect in this stage.",
|
|
244
261
|
// SW-288: a ticket-vs-standard conflict surfaced only in implement, after the code was written.
|
|
@@ -277,7 +294,7 @@ const feature = [
|
|
|
277
294
|
GATE_STEP,
|
|
278
295
|
REVIEW_DELTA,
|
|
279
296
|
`Reload the running code: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} Then exercise the change as the How-to-validate section of \`werkmeister-context.md\` describes for each service touched, and capture the output. ${NO_SERVICE_RULE} ${PROBE_RULE} ${EXERCISE_WORKAROUND} ${TIMING_CLAIM}`,
|
|
280
|
-
`Write \`output/exercise.md\`: \`git diff --stat\` for each repo you touched, the host and \`pr gate --tests\` exit codes and summary lines, ${SKIPPED}, any deviation from \`spec.md\` with its reason, and the exercise checks as ${exerciseFormat("evidence")}.`,
|
|
297
|
+
`Write \`output/exercise.md\`: \`git diff --stat\` for each repo you touched, the host and \`pr gate --tests\` exit codes and summary lines, ${PER_SERVICE}, ${SKIPPED}, any deviation from \`spec.md\` with its reason, and the exercise checks as ${exerciseFormat("evidence")}.`,
|
|
281
298
|
MANUAL_STEP,
|
|
282
299
|
],
|
|
283
300
|
outputs: [
|
|
@@ -301,7 +318,8 @@ const bugfix = [
|
|
|
301
318
|
job: "reproduce and locate the root cause",
|
|
302
319
|
writes: "`output/repro.md`",
|
|
303
320
|
check: "agree the root cause",
|
|
304
|
-
|
|
321
|
+
// SW-837: sw-744's reproduce decided "retry only"; the testing standard already named the fix.
|
|
322
|
+
standards: ["testing", "engineering", "comments"],
|
|
305
323
|
contract: (v) => ({
|
|
306
324
|
oneJob: "One job: make the failure happen on demand and name its root cause. No fix is written in this stage.",
|
|
307
325
|
inputs: [
|
|
@@ -309,7 +327,7 @@ const bugfix = [
|
|
|
309
327
|
`Working (this run): the files in ${v.repos} on the failing path — follow the call chain, don't read whole trees`,
|
|
310
328
|
"Reference (every run): `../../.werkmeister/werkmeister-context.md` — container names, published ports, logs, test command",
|
|
311
329
|
],
|
|
312
|
-
doNotLoad: "
|
|
330
|
+
doNotLoad: "other stages' contracts, `.werkmeister/*.yml`.",
|
|
313
331
|
process: [
|
|
314
332
|
// SW-392: a grep for a line the reporter never prints read "0/25 failures" for a flake nobody reproduced.
|
|
315
333
|
`Reproduce the failure against the running service or with a test. Record the exact command and its output. Judge each run by its exit code, or by a check you have shown fails on a known-bad run — never by grepping the output for a line that may not be printed. ${PROBE_RULE}`,
|
|
@@ -323,7 +341,7 @@ const bugfix = [
|
|
|
323
341
|
NAME_HISTORY_STEP,
|
|
324
342
|
// SW-564: sw-521's root cause was a permission rule; step 4 listed the callers of one builder and missed two other sources of a matching rule.
|
|
325
343
|
"When the root cause is a permission rule (allow, deny, ask), step 4 lists every source of a matching rule: each builder, each rule derived from a registered command (its `&&` segments included), rules recorded in existing workspaces and how a refresh or migrate removes them, and the list a headless wake passes (`--allowedTools` / `--disallowedTools`). The failing test probes each source.",
|
|
326
|
-
`Write \`output/repro.md\`: steps 1–7, and a proposed fix in one paragraph under a \`status: proposed\` line.${noCommitPlan(v.group)} ${CRITERION_REACH}`,
|
|
344
|
+
`Write \`output/repro.md\`: steps 1–7, and a proposed fix in one paragraph under a \`status: proposed\` line.${noCommitPlan(v.group)} Check the proposed fix against the standards rows above and name any rule that already prescribes it. ${CRITERION_REACH}`,
|
|
327
345
|
],
|
|
328
346
|
outputs: ["`output/repro.md`", "One failing test, uncommitted"],
|
|
329
347
|
humanCheck: `Read \`output/repro.md\`. Correct the root cause or the proposed fix if needed, then change \`status: proposed\` to \`status: decided\`. That is the approval — the next session starts the fix without asking again. ${CHAT_APPROVAL}`,
|
|
@@ -352,7 +370,7 @@ const bugfix = [
|
|
|
352
370
|
"Apply the fix `repro.md` settled, at the root cause. Every caller `repro.md` lists gets the fix through the shared function — do not patch callers one by one.",
|
|
353
371
|
diffCheck("repro.md"),
|
|
354
372
|
TEST_STEP,
|
|
355
|
-
`Write \`output/fix.md\`: \`git diff --stat\` per repo, the failing test's name, the test exit code and summary line, and ${SKIPPED}.`,
|
|
373
|
+
`Write \`output/fix.md\`: \`git diff --stat\` per repo, the failing test's name, the test exit code and summary line, ${PER_SERVICE}, and ${SKIPPED}.`,
|
|
356
374
|
],
|
|
357
375
|
outputs: [
|
|
358
376
|
v.group.length
|
|
@@ -453,7 +471,7 @@ const refactor = [
|
|
|
453
471
|
GATE_STEP,
|
|
454
472
|
REVIEW_DELTA,
|
|
455
473
|
`After the last step, reload and exercise the service: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} ${NO_SERVICE_RULE} ${PROBE_RULE} ${EXERCISE_WORKAROUND} ${TIMING_CLAIM}`,
|
|
456
|
-
`Write \`output/exercise.md\`: \`git diff --stat\` per repo, the test result after each step, the \`pr gate --tests\` exit code, ${SKIPPED}, and the final exercise checks as ${exerciseFormat("evidence")}.`,
|
|
474
|
+
`Write \`output/exercise.md\`: \`git diff --stat\` per repo, the test result after each step, the \`pr gate --tests\` exit code, ${PER_SERVICE}, ${SKIPPED}, and the final exercise checks as ${exerciseFormat("evidence")}.`,
|
|
457
475
|
MANUAL_STEP,
|
|
458
476
|
],
|
|
459
477
|
outputs: [
|
|
@@ -508,7 +526,7 @@ const spike = [
|
|
|
508
526
|
process: [
|
|
509
527
|
"Answer each question by its method. Prototype code lives in `output/` or on a scratch branch, never on the workspace branch.",
|
|
510
528
|
"Write `output/findings.md`: per question, the answer, the evidence (commands and output), and confidence.",
|
|
511
|
-
|
|
529
|
+
`End \`findings.md\` with a recommendation: the next work item and its work type. ${followUpGroup(v.questionTool)}`,
|
|
512
530
|
"If the brief asks for a deliverable in a code repo (e.g. a doc opened as a PR): commit it on that worktree's branch, and write `output/pr-<worktree>.md` in the format of `_shared/pr-rules.md` at `status: draft`, with `repo:` taken from `git -C <worktree> remote get-url origin` (as `owner/repo`; the gate rejects any other value), an acceptance table and `skip_exercise: <reason>` when there is nothing to exercise.",
|
|
513
531
|
],
|
|
514
532
|
outputs: [
|
package/package.json
CHANGED