abso pipeline runs: list a project's pipeline runs, show one run's jobs (state, why each stopped, exit, time, an npm or deploy job's phase), and print a job's log with --log <pipeline.job> Version 85 of shared· infra-pipeline· Oct 10 (2026-10-10 07:04 UTC) · Not checked
Version 84 · Files at version 85
4 files, 171 lines added, 8 removed.
--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -759,6 +759,11 @@
759 759 return this.json("GET", version === undefined ? "/ci" : `/ci?${query({ version })}`); 762 + /** The project's pipeline runs, newest first; one run with its jobs; or one job's log (`log` is pipeline.job). */ 763 + pipelineRuns(run?: number, log?: string): Promise<unknown> { 764 + return this.json("GET", run === undefined ? "/pipelines" : `/pipelines?${query({ run, log })}`); 762 767 /** Ends every /latest link handed out so far; answers CI's state with the new link. */ 763 768 ciRevoke(): Promise<CiStatus> { 764 769 return this.json("POST", "/ci/revoke", {}); --- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -768,11 +768,11 @@
768 768 run: runCheckIgnore, 771 − flags: { on: "string", space: "string", pipeline: "string", every: "string" },
771 + flags: { on: "string", space: "string", pipeline: "string", every: "string", log: "string" }, 773 − "abso pipeline check [file] [--on publish|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]]",
773 + "abso pipeline check [file] [--on publish|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]] | abso pipeline runs [<run>] [--log <pipeline.job>]", 775 − "Read the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file.",
775 + "Read the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file. abso pipeline runs asks the server what the project's pipelines did: the runs, newest first; with a run's number, its jobs (state, why, exit, time, an npm or deploy job's phase); with --log <pipeline.job>, that job's output.", 776 776 // Loaded only here, so the yaml package it needs can't stop every other command 777 777 // when a checkout lacks it (abso issue 168). 778 778 run: async (args, env) => { --- a/client/src/pipeline-commands.ts
+++ b/client/src/pipeline-commands.ts
@@ -1,13 +1,14 @@
1 − // `abso pipeline check [file]` (abso issue 147, under 138): reads the folder's
2 − // pipeline file and says what's wrong with it, before a publish. Read-only, with
3 − // no server: the reading and checking are src/pipeline/pipeline.ts.
1 + // `abso pipeline check [file]`: reads the folder's pipeline file and says what's 2 + // wrong with it, before a publish. Read-only, with no server: the reading and 3 + // checking are src/pipeline/pipeline.ts. `abso pipeline runs` asks the server 4 + // what the project's pipelines did: the runs, one run's jobs, a job's log. 5 6 import { existsSync, readFileSync } from "node:fs"; 6 7 import { basename, join, resolve } from "node:path"; 7 8 import { readPipelineFile } from "../../src/pipeline/pipeline.ts"; 8 9 import { type PipelineEvent, plan } from "../../src/pipeline/plan.ts"; 9 10 import { type Parsed, str, UsageError } from "./args.ts"; 10 − import { type Env, EXIT, type Output } from "./command-env.ts";
11 + import { type Env, EXIT, type Output, open } from "./command-env.ts"; 11 12 import { findRoot } from "./config.ts"; 13 14 /** The names a pipeline file may have, in the order they're looked for. */ @@ -15,7 +16,9 @@
16 17 export async function runPipeline(args: Parsed, env: Env): Promise<Output> { 17 18 const [sub, file, ...rest] = args.positionals; 18 − if (sub !== "check" || rest.length > 0) throw new UsageError("abso pipeline check [file]");
19 + if (sub === "runs") return runRuns(file, rest, args, env); 20 + if (sub !== "check" || rest.length > 0) 21 + throw new UsageError("abso pipeline check [file] | abso pipeline runs [<run>] [--log <pipeline.job>]"); 19 22 const root = findRoot(env.cwd) ?? env.cwd; 21 24 if (file !== undefined) { @@ -90,3 +93,88 @@
91 94 return { kind: on as "publish" | "draft" | "green" | "land", space }; 97 + /** A run as the server's list gives it. */ 98 + export interface RunSummary { 104 + ended: number | null; 106 + pipelines: { name: string; state: string }[]; 109 + /** A job of one run, as the server keeps it. */ 110 + export interface RunJob { 118 + exit?: number | null; 122 + npm?: { phase: string }; 123 + deploy?: { phase?: string }; 126 + /** A time in ms as HH:MM UTC, with the date when it isn't today. */ 127 + function at(ms: number, now: number): string { 128 + const t = new Date(ms).toISOString(); 129 + return t.slice(0, 10) === new Date(now).toISOString().slice(0, 10) 130 + ? `${t.slice(11, 16)} UTC` 131 + : `${t.slice(0, 16).replace("T", " ")} UTC`; 134 + /** The runs, newest first, one line each. */ 135 + export function runsText(runs: RunSummary[], now = Date.now()): string { 136 + if (runs.length === 0) return "No pipeline runs yet.\n"; 137 + const lines = runs.map( 139 + ` run ${r.id ?? "-"}: version ${r.version} (${r.event}, ${r.file}), ${r.state}, ${at(r.started, now)}${r.ended ? ` to ${at(r.ended, now)}` : ""}: ${r.pipelines.map((p) => `${p.name} ${p.state}`).join(", ")}`, 141 + return `${lines.join("\n")}\nabso pipeline runs <run> shows its jobs.\n`; 144 + /** One run with its jobs: each job's state, why, exit, time and phase, and where its log is. */ 145 + export function runText(run: RunSummary & { jobs: RunJob[] }, now = Date.now()): string { 146 + const lines = run.jobs.map((j) => { 149 + j.npm ? `npm ${j.npm.phase}` : "", 150 + j.deploy?.phase ? `deploy ${j.deploy.phase}` : "", 152 + j.exit !== undefined && j.exit !== null ? `exit ${j.exit}` : "", 153 + j.seconds !== undefined ? `${j.seconds} s` : "", 154 + j.state === "running" && j.since ? `since ${at(j.since, now)}` : "", 156 + const log = j.log ? `\n log: abso pipeline runs ${run.id} --log ${j.pipeline}.${j.job}` : ""; 157 + return ` ${j.pipeline}.${j.job} (${j.uses ? `uses ${j.uses}` : j.run}): ${parts.join(", ")}${log}`; 159 + return `Run ${run.id}: version ${run.version} (${run.event}, ${run.file}), ${run.state}, ${at(run.started, now)}${run.ended ? ` to ${at(run.ended, now)}` : ""}.\n${lines.join("\n")}\n`; 162 + async function runRuns(runArg: string | undefined, rest: string[], args: Parsed, env: Env): Promise<Output> { 163 + const usage = "abso pipeline runs [<run>] [--log <pipeline.job>]"; 164 + if (rest.length > 0) throw new UsageError(usage); 165 + if (runArg !== undefined && !/^\d+$/.test(runArg)) 166 + throw new UsageError(`a run is a number (got ${runArg}): ${usage}`); 167 + const log = str(args, "log"); 168 + if (log !== undefined && runArg === undefined) throw new UsageError(`--log needs a run: ${usage}`); 169 + const { api } = open(env); 170 + if (runArg === undefined) { 171 + const { runs } = (await api.pipelineRuns()) as { runs: RunSummary[] }; 172 + return { text: runsText(runs), json: { runs } }; 174 + if (log !== undefined) { 175 + const got = (await api.pipelineRuns(Number(runArg), log)) as { run: number; job: string; log: string }; 176 + return { text: got.log.endsWith("\n") ? got.log : `${got.log}\n`, json: got }; 178 + const got = (await api.pipelineRuns(Number(runArg))) as RunSummary & { jobs: RunJob[] }; 179 + return { text: runText(got), json: { ...got } }; --- a/client/test/pipeline-commands.test.ts
+++ b/client/test/pipeline-commands.test.ts
@@ -7,6 +7,7 @@
7 7 import { join } from "node:path"; 8 8 import { after, describe, it } from "node:test"; 9 9 import { main } from "../src/main.ts"; 10 + import { runsText, runText } from "../src/pipeline-commands.ts"; 11 12 const base = mkdtempSync(join(tmpdir(), "abso-pipeline-")); 12 13 after(() => rmSync(base, { recursive: true, force: true })); @@ -158,3 +159,72 @@
158 159 assert.match((await run(dir, "check", "--on", "schedule")).stderr, /--on schedule takes --every/); 163 + describe("abso pipeline runs", () => { 164 + const now = Date.parse("2026-10-10T07:00:00Z"); 165 + const t = (hm: string) => Date.parse(`2026-10-10T${hm}:00Z`); 171 + started: t("06:45"), 174 + pipelines: [{ name: "npm", state: "planned" }], 177 + it("lists the runs, newest first, one line each", () => { 179 + runsText([summary], now), 180 + " run 4: version 4 (green, abso.yml), planned, 06:45 UTC to 06:46 UTC: npm planned\nabso pipeline runs <run> shows its jobs.\n", 182 + assert.equal(runsText([], now), "No pipeline runs yet.\n"); 185 + it("shows a run's jobs with why each one stopped, and where a log is", () => { 186 + const text = runText( 190 + { pipeline: "npm", job: "pack", needs: [], run: "npm pack", state: "passed", exit: 0, seconds: 5, log: true }, 195 + uses: "npm-publish", 197 + why: "not bound here", 203 + uses: "npm-publish", 205 + npm: { phase: "wait" }, 215 + "Run 4: version 4 (green, abso.yml), planned, 06:45 UTC to 06:46 UTC.", 216 + " npm.pack (npm pack): passed, exit 0, 5 s", 217 + " log: abso pipeline runs 4 --log npm.pack", 218 + " npm.publish (uses npm-publish): planned, not bound here", 219 + " npm.wait (uses npm-publish): running, npm wait, since 06:50 UTC", 225 + it("takes a run number, and --log only with one", async () => { 226 + const dir = folder({}); 227 + assert.match((await run(dir, "runs", "x")).stderr, /a run is a number/); 228 + assert.match((await run(dir, "runs", "--log", "npm.pack")).stderr, /--log needs a run/);