@miroshnik/elves 2026.1106.1 → 2026.1107.0

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/README.md CHANGED
@@ -300,7 +300,7 @@ Project checks — `lint`, `typecheck`, `test`, `test:*` — go through the mach
300
300
 
301
301
  ### [`task-env`](skills/task-env/SKILL.md) — a task's environment: its Compose stack and addresses `*.localhost`
302
302
 
303
- A task's stack is the Docker Compose project `<project>-<N>`: parallel sessions of one project keep their own apps and databases without touching each other. One proxy per machine — Traefik in Docker — gives containers of task stacks the addresses `http://<service>.<N>.<project>.localhost` by their labels: no host port per app, and different hosts keep their own cookies, so parallel sessions and the owner's browser don't log each other out. A container without labels isn't published, a stopped one leaves the routes; `check -g` and the session start name whether the proxy runs, with the command to start it. `task-env up` brings the task's stack up by the number in the branch — the project's compose file plus the proxy's labels for the HTTP services named in `.agents/elves.json` — and prints the addresses; `task-env e2e` brings the e2e stack `<project>-<N>-e2e` up anew with clean volumes and runs the command with its addresses in `TASK_ENV_*` variables; `task-env down` takes both stacks of the task down with their volumes — `github task close` calls it; `task-env prune` finds the stacks of closed tasks left on the machine by the tasks' state on GitHub and takes them down; a stack that didn't come up is named by the failed service, its state and the end of its log. The project's `check` holds the compose file to the isolation rules — no `container_name`, no fixed host port, volumes and networks without `name:` and `external`, code by relative paths — and names each violation with the rule and the service; it reads `docker compose config`, so every form of writing is covered.
303
+ A task's stack is the Docker Compose project `<project>-<N>`: parallel sessions of one project keep their own apps and databases without touching each other. One proxy per machine — Traefik in Docker — gives containers of task stacks the addresses `http://<service>.<N>.<project>.localhost` by their labels: no host port per app, and different hosts keep their own cookies, so parallel sessions and the owner's browser don't log each other out. A container without labels isn't published, a stopped one leaves the routes; `check -g` and the session start name whether the proxy runs, with the command to start it. `task-env up` brings the task's stack up by the number in the branch — the project's compose file plus the proxy's labels for the HTTP services named in `.agents/elves.json` — and prints the addresses; `task-env e2e` brings the e2e stack `<project>-<N>-e2e` up anew with clean volumes and runs the command with its addresses in `TASK_ENV_*` variables; `task-env down` takes both stacks of the task down with their volumes and the images they built — `github task close` calls it; `task-env prune` finds the stacks of closed tasks left on the machine by the tasks' state on GitHub and takes them down; a stack that didn't come up is named by the failed service, its state and the end of its log. The project's `check` holds the compose file to the isolation rules — no `container_name`, no fixed host port, volumes and networks without `name:` and `external`, code by relative paths — and names each violation with the rule and the service; it reads `docker compose config`, so every form of writing is covered.
304
304
 
305
305
  `task-env up | e2e | down | prune` · `task-env proxy up | down | status` · `task-env check [<dir>]`
306
306
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miroshnik/elves",
3
- "version": "2026.1106.1",
3
+ "version": "2026.1107.0",
4
4
  "type": "module",
5
5
  "description": "Elves — a development flow with AI agents: shared rules and skills for any agent; install — bunx @miroshnik/elves install -g; the installer and skill scripts — TypeScript under Bun, tests — bun test in tests/",
6
6
  "repository": {
@@ -72,5 +72,5 @@
72
72
  "eslint-plugin-boundaries": "^7.2.0",
73
73
  "knip": "^6.41.0"
74
74
  },
75
- "gitHead": "e0d37d48c57dfc427770e4bd81d0a0b9caf19ccd"
75
+ "gitHead": "406b4083596328d0ab347c72262d198c7ec45db0"
76
76
  }
@@ -18,7 +18,7 @@ no host port per app, no port search. The scheme and the reasons — epic
18
18
  ```bash
19
19
  bun --no-env-file <skill dir>/scripts/task-env.ts up [<N>] [--profile <p>]... # the task's stack by the branch, its addresses
20
20
  bun --no-env-file <skill dir>/scripts/task-env.ts e2e [--profile <p>]... [-- <command>] # the e2e stack anew, the command with its addresses
21
- bun --no-env-file <skill dir>/scripts/task-env.ts down [<N>] # the task's stacks with their volumes
21
+ bun --no-env-file <skill dir>/scripts/task-env.ts down [<N>] # the task's stacks with their volumes and built images
22
22
  bun --no-env-file <skill dir>/scripts/task-env.ts prune # stacks of the project's closed tasks
23
23
  bun --no-env-file <skill dir>/scripts/task-env.ts proxy up # start it (or bring it to the compose file), wait until healthy
24
24
  bun --no-env-file <skill dir>/scripts/task-env.ts proxy status # 0 — running, 1 — not running (the start command), 2 — no Docker
@@ -98,12 +98,12 @@ with the addresses of the e2e stack:
98
98
  `e2e` only brings the stack up. The stack stays until the next run: a failed run is examined on it
99
99
  (`docker compose -p <project>-<N>-e2e logs`).
100
100
 
101
- **down** — both stacks of the task with their volumes; without a number — the branch's task; other tasks' stacks and
102
- the main checkout's aren't touched; `task close` of the `github` skill calls it — reference.md, "Taking a task's
103
- stacks down". **prune** — the stacks of the project's closed tasks left on the machine go with their volumes, without
104
- a question: a closed task's stack is nobody's; what is left — reference.md, "Stacks of closed tasks". **A stack that
105
- didn't come up** — code 1, each failed service with its state and log — reference.md, "A stack that didn't come up".
106
- Exit codes — reference.md, "Exit codes".
101
+ **down** — both stacks of the task with their volumes and the images they built (pulled ones stay); without a number —
102
+ the branch's task; other tasks' stacks and the main checkout's aren't touched; `task close` of the `github` skill calls
103
+ it — reference.md, "Taking a task's stacks down". **prune** — the stacks of the project's closed tasks left on the
104
+ machine go with their volumes and built images, without a question: a closed task's stack is nobody's; what is left —
105
+ reference.md, "Stacks of closed tasks". **A stack that didn't come up** — code 1, each failed service with its state
106
+ and log — reference.md, "A stack that didn't come up". Exit codes — reference.md, "Exit codes".
107
107
 
108
108
  **Machine queue** — a bring-up is heavy work: `up` and `e2e` hold a place in the `slot` queue until the containers
109
109
  are healthy, the e2e command runs outside it; a package.json script with its own `docker compose up` — `check` names it.
@@ -33,27 +33,39 @@ stacks and the main checkout's aren't touched. `down` without a number — the b
33
33
 
34
34
  ```
35
35
  + stack shop-42: down, with its volumes
36
+ + stack shop-43: down, with its volumes and images app/web:shop-43, shop-43-worker:latest
37
+ ○ image app/api:shop-43 of stack shop-43: left — container shop-44-api-1 uses it
36
38
  ○ stacks shop-42, shop-42-e2e: none on the machine
37
39
  ! stack shop-42: not removed — <Docker's reason>
38
40
  ```
39
41
 
40
- Only the stacks that are on the machine are taken down — found by the label of containers, volumes and networks
41
- (`com.docker.compose.project`), not by `docker compose ls`: a stack left with volumes only (`down` without `-v`,
42
- containers removed by hand) isn't in its list. No compose file in the checkout — `○ no compose file … — the project
43
- has no task stacks`, Docker isn't called: `task close` of a project without Compose doesn't depend on Docker running.
44
- No docker on the machine — an `○` line; Docker doesn't answer — a `!` line with the reason.
42
+ **The images the stack built go with it** (#807): Compose labels a built image with the stack's project
43
+ (`com.docker.compose.project`), a pulled one — a database, a broker, a base — has no such label and stays. A compose
44
+ file may tag a built image by the stack, `image: app/web:${COMPOSE_PROJECT_NAME}`, so that a parallel stack's build
45
+ doesn't move a machine-wide tag to another tree's code; such an image outlives its stack — a shared tag's previous
46
+ build lost its name and went by itself. `docker image rm` of each `repo:tag` (a dangling one — by its ID), without
47
+ `--force`: an image a container still runs on — another stack's, a test's own — stays, an `○` line names it and the
48
+ containers; another failure — a `!` line, code 2. `e2e` re-creates its stack on the same images: `up --build` rebuilds
49
+ them.
50
+
51
+ Only the stacks that are on the machine are taken down — found by the label of containers, volumes, networks and
52
+ built images (`com.docker.compose.project`), not by `docker compose ls`: a stack left with volumes only (`down`
53
+ without `-v`, containers removed by hand) or with its images only isn't in its list. No compose file in the checkout —
54
+ `○ no compose file … — the project has no task stacks`, Docker isn't called: `task close` of a project without Compose
55
+ doesn't depend on Docker running. No docker on the machine — an `○` line; Docker doesn't answer — a `!` line with the
56
+ reason.
45
57
 
46
58
  ## Stacks of closed tasks — prune
47
59
 
48
60
  **prune** — the stacks of the project's closed tasks left on the machine (orphans: a task closed without `task
49
61
  close`, a close that couldn't reach Docker, a task that removed the compose file): every stack `<project>-<N>` and
50
62
  `<project>-<N>-e2e` on the machine, the task's state by GitHub (`gh api repos/<owner>/<repo>/issues/<N>`, the
51
- repository — the checkout's `origin`). Closed — the stacks go with their volumes right away, without a question: a
52
- closed task's stack is nobody's.
63
+ repository — the checkout's `origin`). Closed — the stacks go with their volumes and built images right away, without
64
+ a question: a closed task's stack is nobody's; a stack left with its images only — taken down before #807 — goes too.
53
65
 
54
66
  ```
55
67
  ○ stack shop-7: no task #7 in acme/shop — left
56
- + stack shop-41: down, with its volumes — task #41 is closed
68
+ + stack shop-41: down, with its volumes and image app/web:shop-41 — task #41 is closed
57
69
  ○ stack shop-42: task #42 is open — left
58
70
  ○ stack shop-9: its containers are from /work/shop-9 — another project, left
59
71
  ```
@@ -77,8 +89,8 @@ stack shop-42: not up — container shop-42-api-1 exited (3)
77
89
  ## Exit codes
78
90
 
79
91
  `up` — 0 up, 1 not up, 2 not tried (no compose file, broken settings, Docker unavailable, `docker compose config`
80
- fails); `e2e` — the command's, otherwise as `up`; `down` and `prune` — 0, 2 if a stack isn't removed, Docker is
81
- unavailable or (`prune`) a task's state isn't checked; `proxy status` — 0 running, 1 not running (the start command),
92
+ fails); `e2e` — the command's, otherwise as `up`; `down` and `prune` — 0 (an image a container uses, left, too), 2
93
+ if a stack or an image isn't removed, Docker is unavailable or (`prune`) a task's state isn't checked; `proxy status` — 0 running, 1 not running (the start command),
82
94
  2 no Docker; `check` — 0 the rules hold or no compose file, 1 violations, 2 not checked.
83
95
 
84
96
  ## The proxy — container, routes, API
@@ -9,9 +9,9 @@
9
9
  * proxy's labels and network for the HTTP services of `env.http` in `.agents/elves.json`; their addresses go to Compose's
10
10
  * interpolation in `TASK_ENV_<SERVICE>_URL` (the compose file gives the app its own address); it prints the addresses.
11
11
  * `e2e` brings `<project>-<N>-e2e` up anew with clean volumes and runs the command on the host with the e2e addresses
12
- * in `TASK_ENV_*` variables; `down` takes both stacks of a task down with their volumes — `task close` calls it; `prune`
13
- * takes down the stacks of the project's closed tasks left on the machine — orphans, the task's state by GitHub. A stack
14
- * that didn't come up — each failed service with its state and the end of its log.
12
+ * in `TASK_ENV_*` variables; `down` takes both stacks of a task down with their volumes and the images they built —
13
+ * `task close` calls it; `prune` takes down the stacks of the project's closed tasks left on the machine — orphans, the
14
+ * task's state by GitHub. A stack that didn't come up — each failed service with its state and the end of its log.
15
15
  *
16
16
  * `check` holds the project's compose file to the isolation rules: Compose keeps two stacks of one project apart by the
17
17
  * project name — containers, volumes and networks get its prefix — and four entries bypass the prefix and break
@@ -81,18 +81,19 @@ Examples:
81
81
  task-env e2e --profile worker -- bun test e2e`,
82
82
  down: `task-env down [<N>]
83
83
 
84
- Takes the stacks of task N (default — the branch's) down with their volumes: dev and e2e; a line per stack: + down,
85
- ○ none, ! not removed (code 2); no compose file in the checkout — nothing to take down, Docker isn't called; task close of
86
- the github skill calls it.
84
+ Takes the stacks of task N (default — the branch's) down with their volumes and the images they built (pulled ones
85
+ stay): dev and e2e; a line per stack: + down, ○ none, ! not removed (code 2); an image another container still uses —
86
+ left, named by a ○ line; no compose file in the checkout — nothing to take down, Docker isn't called; task close of the
87
+ github skill calls it.
87
88
 
88
89
  Examples:
89
90
  task-env down
90
91
  task-env down 42`,
91
92
  prune: `task-env prune
92
93
 
93
- Takes down the stacks of the project's closed tasks left on the machine (orphans) with their volumes: the task's state —
94
- by GitHub (gh); stacks of open tasks, of the main checkout, of numbers that aren't tasks and of another repository with
95
- the same name — left.
94
+ Takes down the stacks of the project's closed tasks left on the machine (orphans) with their volumes and built images —
95
+ a stack left with its images only too: the task's state — by GitHub (gh); stacks of open tasks, of the main checkout,
96
+ of numbers that aren't tasks and of another repository with the same name — left.
96
97
 
97
98
  Examples:
98
99
  task-env prune`,
@@ -834,39 +835,94 @@ function upStack(project: Project, stack: Stack, profiles: string[], env: NodeJS
834
835
  * Takes a stack down with its volumes — by the Compose project from `/`, without the compose file: it may be gone
835
836
  * already (`task close` after the worktree), and a compose file found by Compose would hide services of other profiles.
836
837
  * Compose finds the stack's containers, networks and volumes by their labels — a stack left with volumes only too.
838
+ * withImages — the images the stack built go too (`removeImages`): `down` and `prune`; `e2e` brings its stack up anew on
839
+ * the same images, `up --build` rebuilds them.
837
840
  */
838
- function downStack(stack: string, env: NodeJS.ProcessEnv): { ok: boolean; line: string } {
841
+ function downStack(stack: string, env: NodeJS.ProcessEnv, withImages = false): { ok: boolean; lines: string[] } {
839
842
  const r = dc(["-p", stack, "down", "--volumes", "--remove-orphans"], "/");
840
- const ok = !r.error && r.status === 0;
841
- return { ok, line: ok ? `+ stack ${stack}: down, with its volumes` : `! stack ${stack}: not removed — ${why(r)}${hint(why(r), env)}` };
843
+ if (r.error || r.status !== 0) return { ok: false, lines: [`! stack ${stack}: not removed — ${why(r)}${hint(why(r), env)}`] };
844
+ if (!withImages) return { ok: true, lines: [`+ stack ${stack}: down, with its volumes`] };
845
+ const images = removeImages(stack, env);
846
+ const removed = images.removed.length ? ` and ${images.removed.length === 1 ? "image" : "images"} ${images.removed.join(", ")}` : "";
847
+ return { ok: images.ok, lines: [`+ stack ${stack}: down, with its volumes${removed}`, ...images.lines] };
842
848
  }
843
849
 
844
- /** The label Compose marks a stack's containers, volumes and networks with: the Compose project. */
850
+ /** The label Compose marks a stack's containers, volumes and networks with — and the images it built: the Compose project. */
845
851
  const PROJECT_LABEL = "com.docker.compose.project";
852
+
853
+ /**
854
+ * Removes the images a stack built — Compose labels a built image with the stack's project (#807; Compose 5.6), a pulled
855
+ * one (a database, a broker, a base) has no such label and stays. A compose file may tag a built image by the stack
856
+ * (`image: app/web:${COMPOSE_PROJECT_NAME}` — a parallel stack's build doesn't move a machine-wide tag to another
857
+ * tree's code), and such an image outlives its stack: a shared tag's previous build lost its name and went by itself.
858
+ * By reference, `repo:tag` (a dangling one — by its ID), one by one, without `--force`: an image another container still
859
+ * runs on — another stack's, a test's own — stays, named by a `○` line with the containers; another failure — a `!`
860
+ * line. The references are sorted: the lines don't depend on Docker's order.
861
+ */
862
+ function removeImages(stack: string, env: NodeJS.ProcessEnv): { removed: string[]; lines: string[]; ok: boolean } {
863
+ const label = `label=${PROJECT_LABEL}=${stack}`;
864
+ const list = spawnSync("docker", ["image", "ls", "--filter", label, "--format", "{{.ID}}\t{{.Repository}}:{{.Tag}}"], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
865
+ if (list.error || list.status !== 0) return { removed: [], lines: [`! images of stack ${stack}: not listed — ${why(list)}`], ok: false };
866
+ const refs = new Set<string>();
867
+ for (const row of list.stdout.split("\n").filter(Boolean)) {
868
+ const [id, ref] = row.split("\t");
869
+ refs.add(!ref || ref.includes("<none>") ? id! : ref);
870
+ }
871
+ const out = { removed: [] as string[], lines: [] as string[], ok: true };
872
+ for (const ref of [...refs].sort()) {
873
+ const r = spawnSync("docker", ["image", "rm", ref], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
874
+ if (!r.error && r.status === 0) {
875
+ out.removed.push(ref);
876
+ continue;
877
+ }
878
+ const users = spawnSync("docker", ["ps", "--all", "--filter", `ancestor=${ref}`, "--format", "{{.Names}}"], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
879
+ const names = users.status === 0 ? users.stdout.split("\n").filter(Boolean).sort() : [];
880
+ if (names.length) out.lines.push(`○ image ${ref} of stack ${stack}: left — ${names.length === 1 ? "container" : "containers"} ${names.join(", ")} ${names.length === 1 ? "uses" : "use"} it`);
881
+ else {
882
+ out.lines.push(`! image ${ref} of stack ${stack}: not removed — ${why(r)}`);
883
+ out.ok = false;
884
+ }
885
+ }
886
+ return out;
887
+ }
888
+
846
889
  /** Compose projects on the machine → the directories of their containers; no docker — missing, Docker unavailable — the reason. */
847
890
  type Machine = Map<string, Set<string>> | { missing: true } | string;
848
891
 
849
892
  /**
850
- * Stacks on the machine — by the label of containers, volumes and networks, not `docker compose ls`: a stack whose
851
- * containers are gone but volumes stay (`down` without `-v`, containers removed by hand) isn't in its list (#395,
852
- * question 2). A container's directory (`working_dir` — where Compose ran) tells a stack of another repository with the
853
- * same name (`prune`).
893
+ * Stacks on the machine — by the label of containers, volumes, networks and built images, not `docker compose ls`: a
894
+ * stack whose containers are gone but volumes stay (`down` without `-v`, containers removed by hand) isn't in its list
895
+ * (#395, question 2), nor one left with its built images only (taken down before #807). A container's directory
896
+ * (`working_dir` — where Compose ran) tells a stack of another repository with the same name (`prune`).
854
897
  */
855
898
  function machineStacks(env: NodeJS.ProcessEnv): Machine {
856
899
  const stacks = new Map<string, Set<string>>();
900
+ const add = (name: string, dir = "") => {
901
+ if (!name.trim()) return;
902
+ const dirs = stacks.get(name.trim()) ?? new Set<string>();
903
+ if (dir.trim()) dirs.add(dir.trim());
904
+ stacks.set(name.trim(), dirs);
905
+ };
857
906
  for (const list of [["ps", "--all"], ["volume", "ls"], ["network", "ls"]]) {
858
907
  const format = list[0] === "ps" ? `{{.Label "${PROJECT_LABEL}"}}\t{{.Label "${PROJECT_LABEL}.working_dir"}}` : `{{.Label "${PROJECT_LABEL}"}}`;
859
908
  const r = spawnSync("docker", [...list, "--filter", `label=${PROJECT_LABEL}`, "--format", format], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
860
909
  if ((r.error as NodeJS.ErrnoException | undefined)?.code === "ENOENT") return { missing: true };
861
910
  if (r.error || r.status !== 0) return why(r);
862
911
  for (const line of r.stdout.split("\n")) {
863
- const [name, dir] = line.split("\t");
864
- if (!name?.trim()) continue;
865
- const dirs = stacks.get(name.trim()) ?? new Set<string>();
866
- if (dir?.trim()) dirs.add(dir.trim());
867
- stacks.set(name.trim(), dirs);
912
+ const [name = "", dir] = line.split("\t");
913
+ add(name, dir);
868
914
  }
869
915
  }
916
+ // `image ls --format` has no labels: the IDs, then `image inspect`
917
+ const ids = spawnSync("docker", ["image", "ls", "--quiet", "--filter", `label=${PROJECT_LABEL}`], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
918
+ if (ids.error || ids.status !== 0) return why(ids);
919
+ const unique = [...new Set(ids.stdout.split("\n").filter(Boolean))];
920
+ if (unique.length) {
921
+ const r = spawnSync("docker", ["image", "inspect", "--format", `{{index .Config.Labels "${PROJECT_LABEL}"}}`, ...unique], { encoding: "utf8", env, timeout: CONFIG_TIMEOUT });
922
+ // an image removed between the two calls — not a failure: the others are printed
923
+ if (r.error || (r.status !== 0 && !/no such image/i.test(r.stderr))) return why(r);
924
+ for (const name of r.stdout.split("\n")) add(name);
925
+ }
870
926
  return stacks;
871
927
  }
872
928
 
@@ -895,7 +951,7 @@ function stackUp(project: Project, profiles: string[], env: NodeJS.ProcessEnv):
895
951
  function stackE2e(project: Project, profiles: string[], command: string[], env: NodeJS.ProcessEnv): number {
896
952
  const stack = stackOf(project.name, project.task, true);
897
953
  const clean = downStack(stack.name, env);
898
- if (!clean.ok) return console.log(clean.line), stackFailed(env, "e2e", 2, [clean.line]);
954
+ if (!clean.ok) return console.log(clean.lines.join("\n")), stackFailed(env, "e2e", 2, clean.lines);
899
955
  const r = inSlot(`e2e ${stack.name}`, () => upStack(project, stack, profiles, env));
900
956
  if (r.code) return console.log(r.lines.join("\n")), stackFailed(env, "e2e", r.code, r.lines);
901
957
  const addresses = addressesOf(project, stack, env);
@@ -908,9 +964,10 @@ function stackE2e(project: Project, profiles: string[], command: string[], env:
908
964
  }
909
965
 
910
966
  /**
911
- * `down`: the task's stacks — dev and e2e — with their volumes, those that are on the machine; stacks of other tasks
912
- * aren't touched. A checkout without a compose file has no task stacks: Docker isn't called — `task close` of every
913
- * project calls `down`, and with Docker stopped a project without Compose would get a `!` line (#395, question 4).
967
+ * `down`: the task's stacks — dev and e2e — with their volumes and the images they built (`removeImages`), those that
968
+ * are on the machine; stacks of other tasks aren't touched. A checkout without a compose file has no task stacks: Docker
969
+ * isn't called — `task close` of every project calls `down`, and with Docker stopped a project without Compose would get
970
+ * a `!` line (#395, question 4).
914
971
  */
915
972
  function stackDown(root: string, task: number | undefined, env: NodeJS.ProcessEnv): number {
916
973
  if (!COMPOSE_FILES.some((f) => existsSync(path.join(root, f)))) return console.log(`○ no compose file in ${root} — the project has no task stacks`), 0;
@@ -921,8 +978,8 @@ function stackDown(root: string, task: number | undefined, env: NodeJS.ProcessEn
921
978
  if (!(machine instanceof Map)) return console.log("○ no Docker on the machine — no task stacks"), 0;
922
979
  const present = stacks.filter((s) => machine.has(s));
923
980
  if (!present.length) return console.log(`○ stacks ${stacks.join(", ")}: none on the machine`), 0;
924
- const done = present.map((s) => downStack(s, env));
925
- console.log(done.map((d) => d.line).join("\n"));
981
+ const done = present.map((s) => downStack(s, env, true));
982
+ console.log(done.flatMap((d) => d.lines).join("\n"));
926
983
  return done.every((d) => d.ok) ? 0 : 2;
927
984
  }
928
985
 
@@ -955,10 +1012,11 @@ function taskState(repo: string, n: number, env: NodeJS.ProcessEnv): "open" | "c
955
1012
  /**
956
1013
  * `prune`: stacks of the project's closed tasks left on the machine — orphans: a task closed without `task close`, a
957
1014
  * close that couldn't reach Docker, a task that removed the compose file. The stacks `<project>-<N>` and
958
- * `<project>-<N>-e2e` of the machine (containers, volumes and networks, #395, question 2); the task's state — by GitHub:
959
- * closed — the stacks go with their volumes; open, not an issue, not checked — left. A stack whose containers ran in an
960
- * existing directory of another project — another repository with the same name (`shop-2` at the project `shop`) —
961
- * left (#395, question 3). Without confirmation: a closed task's stack is nobody's (#395, question 1).
1015
+ * `<project>-<N>-e2e` of the machine (containers, volumes, networks and built images, #395, question 2); the task's state
1016
+ * — by GitHub: closed — the stacks go with their volumes and built images (#807: a stack taken down before it left its
1017
+ * images); open, not an issue, not checked — left. A stack whose containers ran in an existing directory of another
1018
+ * project — another repository with the same name (`shop-2` at the project `shop`) — left (#395, question 3). Without
1019
+ * confirmation: a closed task's stack is nobody's (#395, question 1).
962
1020
  */
963
1021
  function prune(root: string, env: NodeJS.ProcessEnv): number {
964
1022
  const name = projectName(root);
@@ -985,8 +1043,9 @@ function prune(root: string, env: NodeJS.ProcessEnv): number {
985
1043
  if (!states.has(task)) states.set(task, taskState(repo, task, env));
986
1044
  const state = states.get(task)!;
987
1045
  if (state === "closed") {
988
- const d = downStack(stack, env);
989
- console.log(d.ok ? `${d.line} — task #${task} is closed` : d.line);
1046
+ const d = downStack(stack, env, true);
1047
+ const [first = "", ...rest] = d.lines;
1048
+ console.log([first.startsWith("+") ? `${first} — task #${task} is closed` : first, ...rest].join("\n"));
990
1049
  ok &&= d.ok;
991
1050
  } else if (state === "open") console.log(`○ stack ${stack}: task #${task} is open — left`);
992
1051
  else if (state === "missing") console.log(`○ stack ${stack}: no task #${task} in ${repo} — left`);