{"version":85,"agent":"infra-pipeline","message":"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>","time":1791615856832,"timeIso":"2026-10-10T07:04:16.832Z","changes":4,"change":1006,"files":["client/src/api.ts","client/src/main.ts","client/src/pipeline-commands.ts","client/test/pipeline-commands.test.ts"],"draft":null,"diff":[{"path":"client/src/api.ts","added":5,"removed":0,"diff":"--- a/client/src/api.ts\n+++ b/client/src/api.ts\n@@ -759,6 +759,11 @@\n \t\treturn this.json(\"GET\", version === undefined ? \"/ci\" : `/ci?${query({ version })}`);\n \t}\n \n+\t/** The project's pipeline runs, newest first; one run with its jobs; or one job's log (`log` is pipeline.job). */\n+\tpipelineRuns(run?: number, log?: string): Promise<unknown> {\n+\t\treturn this.json(\"GET\", run === undefined ? \"/pipelines\" : `/pipelines?${query({ run, log })}`);\n+\t}\n+\n \t/** Ends every /latest link handed out so far; answers CI's state with the new link. */\n \tciRevoke(): Promise<CiStatus> {\n \t\treturn this.json(\"POST\", \"/ci/revoke\", {});"},{"path":"client/src/main.ts","added":3,"removed":3,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -768,11 +768,11 @@\n \t\trun: runCheckIgnore,\n \t},\n \tpipeline: {\n-\t\tflags: { on: \"string\", space: \"string\", pipeline: \"string\", every: \"string\" },\n+\t\tflags: { on: \"string\", space: \"string\", pipeline: \"string\", every: \"string\", log: \"string\" },\n \t\tusage:\n-\t\t\t\"abso pipeline check [file] [--on publish|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]]\",\n+\t\t\t\"abso pipeline check [file] [--on publish|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]] | abso pipeline runs [<run>] [--log <pipeline.job>]\",\n \t\tabout:\n-\t\t\t\"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.\",\n+\t\t\t\"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.\",\n \t\t// Loaded only here, so the yaml package it needs can't stop every other command\n \t\t// when a checkout lacks it (abso issue 168).\n \t\trun: async (args, env) => {"},{"path":"client/src/pipeline-commands.ts","added":93,"removed":5,"diff":"--- a/client/src/pipeline-commands.ts\n+++ b/client/src/pipeline-commands.ts\n@@ -1,13 +1,14 @@\n-// `abso pipeline check [file]` (abso issue 147, under 138): reads the folder's\n-// pipeline file and says what's wrong with it, before a publish. Read-only, with\n-// no server: the reading and checking are src/pipeline/pipeline.ts.\n+// `abso pipeline check [file]`: reads the folder's pipeline file and says what's\n+// wrong with it, before a publish. Read-only, with no server: the reading and\n+// checking are src/pipeline/pipeline.ts. `abso pipeline runs` asks the server\n+// what the project's pipelines did: the runs, one run's jobs, a job's log.\n \n import { existsSync, readFileSync } from \"node:fs\";\n import { basename, join, resolve } from \"node:path\";\n import { readPipelineFile } from \"../../src/pipeline/pipeline.ts\";\n import { type PipelineEvent, plan } from \"../../src/pipeline/plan.ts\";\n import { type Parsed, str, UsageError } from \"./args.ts\";\n-import { type Env, EXIT, type Output } from \"./command-env.ts\";\n+import { type Env, EXIT, type Output, open } from \"./command-env.ts\";\n import { findRoot } from \"./config.ts\";\n \n /** The names a pipeline file may have, in the order they're looked for. */\n@@ -15,7 +16,9 @@\n \n export async function runPipeline(args: Parsed, env: Env): Promise<Output> {\n \tconst [sub, file, ...rest] = args.positionals;\n-\tif (sub !== \"check\" || rest.length > 0) throw new UsageError(\"abso pipeline check [file]\");\n+\tif (sub === \"runs\") return runRuns(file, rest, args, env);\n+\tif (sub !== \"check\" || rest.length > 0)\n+\t\tthrow new UsageError(\"abso pipeline check [file] | abso pipeline runs [<run>] [--log <pipeline.job>]\");\n \tconst root = findRoot(env.cwd) ?? env.cwd;\n \tlet path: string;\n \tif (file !== undefined) {\n@@ -90,3 +93,88 @@\n \t}\n \treturn { kind: on as \"publish\" | \"draft\" | \"green\" | \"land\", space };\n }\n+\n+/** A run as the server's list gives it. */\n+export interface RunSummary {\n+\tid: number | null;\n+\tversion: number;\n+\tevent: string;\n+\tfile: string;\n+\tstarted: number;\n+\tended: number | null;\n+\tstate: string;\n+\tpipelines: { name: string; state: string }[];\n+}\n+\n+/** A job of one run, as the server keeps it. */\n+export interface RunJob {\n+\tpipeline: string;\n+\tjob: string;\n+\tneeds: string[];\n+\trun?: string;\n+\tuses?: string;\n+\tstate: string;\n+\twhy?: string;\n+\texit?: number | null;\n+\tseconds?: number;\n+\tsince?: number;\n+\tlog?: boolean;\n+\tnpm?: { phase: string };\n+\tdeploy?: { phase?: string };\n+}\n+\n+/** A time in ms as HH:MM UTC, with the date when it isn't today. */\n+function at(ms: number, now: number): string {\n+\tconst t = new Date(ms).toISOString();\n+\treturn t.slice(0, 10) === new Date(now).toISOString().slice(0, 10)\n+\t\t? `${t.slice(11, 16)} UTC`\n+\t\t: `${t.slice(0, 16).replace(\"T\", \" \")} UTC`;\n+}\n+\n+/** The runs, newest first, one line each. */\n+export function runsText(runs: RunSummary[], now = Date.now()): string {\n+\tif (runs.length === 0) return \"No pipeline runs yet.\\n\";\n+\tconst lines = runs.map(\n+\t\t(r) =>\n+\t\t\t`  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(\", \")}`,\n+\t);\n+\treturn `${lines.join(\"\\n\")}\\nabso pipeline runs <run> shows its jobs.\\n`;\n+}\n+\n+/** One run with its jobs: each job's state, why, exit, time and phase, and where its log is. */\n+export function runText(run: RunSummary & { jobs: RunJob[] }, now = Date.now()): string {\n+\tconst lines = run.jobs.map((j) => {\n+\t\tconst parts = [\n+\t\t\tj.state,\n+\t\t\tj.npm ? `npm ${j.npm.phase}` : \"\",\n+\t\t\tj.deploy?.phase ? `deploy ${j.deploy.phase}` : \"\",\n+\t\t\tj.why ?? \"\",\n+\t\t\tj.exit !== undefined && j.exit !== null ? `exit ${j.exit}` : \"\",\n+\t\t\tj.seconds !== undefined ? `${j.seconds} s` : \"\",\n+\t\t\tj.state === \"running\" && j.since ? `since ${at(j.since, now)}` : \"\",\n+\t\t].filter(Boolean);\n+\t\tconst log = j.log ? `\\n      log: abso pipeline runs ${run.id} --log ${j.pipeline}.${j.job}` : \"\";\n+\t\treturn `  ${j.pipeline}.${j.job} (${j.uses ? `uses ${j.uses}` : j.run}): ${parts.join(\", \")}${log}`;\n+\t});\n+\treturn `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`;\n+}\n+\n+async function runRuns(runArg: string | undefined, rest: string[], args: Parsed, env: Env): Promise<Output> {\n+\tconst usage = \"abso pipeline runs [<run>] [--log <pipeline.job>]\";\n+\tif (rest.length > 0) throw new UsageError(usage);\n+\tif (runArg !== undefined && !/^\\d+$/.test(runArg))\n+\t\tthrow new UsageError(`a run is a number (got ${runArg}): ${usage}`);\n+\tconst log = str(args, \"log\");\n+\tif (log !== undefined && runArg === undefined) throw new UsageError(`--log needs a run: ${usage}`);\n+\tconst { api } = open(env);\n+\tif (runArg === undefined) {\n+\t\tconst { runs } = (await api.pipelineRuns()) as { runs: RunSummary[] };\n+\t\treturn { text: runsText(runs), json: { runs } };\n+\t}\n+\tif (log !== undefined) {\n+\t\tconst got = (await api.pipelineRuns(Number(runArg), log)) as { run: number; job: string; log: string };\n+\t\treturn { text: got.log.endsWith(\"\\n\") ? got.log : `${got.log}\\n`, json: got };\n+\t}\n+\tconst got = (await api.pipelineRuns(Number(runArg))) as RunSummary & { jobs: RunJob[] };\n+\treturn { text: runText(got), json: { ...got } };\n+}"},{"path":"client/test/pipeline-commands.test.ts","added":70,"removed":0,"diff":"--- a/client/test/pipeline-commands.test.ts\n+++ b/client/test/pipeline-commands.test.ts\n@@ -7,6 +7,7 @@\n import { join } from \"node:path\";\n import { after, describe, it } from \"node:test\";\n import { main } from \"../src/main.ts\";\n+import { runsText, runText } from \"../src/pipeline-commands.ts\";\n \n const base = mkdtempSync(join(tmpdir(), \"abso-pipeline-\"));\n after(() => rmSync(base, { recursive: true, force: true }));\n@@ -158,3 +159,72 @@\n \t\tassert.match((await run(dir, \"check\", \"--on\", \"schedule\")).stderr, /--on schedule takes --every/);\n \t});\n });\n+\n+describe(\"abso pipeline runs\", () => {\n+\tconst now = Date.parse(\"2026-10-10T07:00:00Z\");\n+\tconst t = (hm: string) => Date.parse(`2026-10-10T${hm}:00Z`);\n+\tconst summary = {\n+\t\tid: 4,\n+\t\tversion: 4,\n+\t\tevent: \"green\",\n+\t\tfile: \"abso.yml\",\n+\t\tstarted: t(\"06:45\"),\n+\t\tended: t(\"06:46\"),\n+\t\tstate: \"planned\",\n+\t\tpipelines: [{ name: \"npm\", state: \"planned\" }],\n+\t};\n+\n+\tit(\"lists the runs, newest first, one line each\", () => {\n+\t\tassert.equal(\n+\t\t\trunsText([summary], now),\n+\t\t\t\"  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\",\n+\t\t);\n+\t\tassert.equal(runsText([], now), \"No pipeline runs yet.\\n\");\n+\t});\n+\n+\tit(\"shows a run's jobs with why each one stopped, and where a log is\", () => {\n+\t\tconst text = runText(\n+\t\t\t{\n+\t\t\t\t...summary,\n+\t\t\t\tjobs: [\n+\t\t\t\t\t{ pipeline: \"npm\", job: \"pack\", needs: [], run: \"npm pack\", state: \"passed\", exit: 0, seconds: 5, log: true },\n+\t\t\t\t\t{\n+\t\t\t\t\t\tpipeline: \"npm\",\n+\t\t\t\t\t\tjob: \"publish\",\n+\t\t\t\t\t\tneeds: [\"pack\"],\n+\t\t\t\t\t\tuses: \"npm-publish\",\n+\t\t\t\t\t\tstate: \"planned\",\n+\t\t\t\t\t\twhy: \"not bound here\",\n+\t\t\t\t\t},\n+\t\t\t\t\t{\n+\t\t\t\t\t\tpipeline: \"npm\",\n+\t\t\t\t\t\tjob: \"wait\",\n+\t\t\t\t\t\tneeds: [],\n+\t\t\t\t\t\tuses: \"npm-publish\",\n+\t\t\t\t\t\tstate: \"running\",\n+\t\t\t\t\t\tnpm: { phase: \"wait\" },\n+\t\t\t\t\t\tsince: t(\"06:50\"),\n+\t\t\t\t\t},\n+\t\t\t\t],\n+\t\t\t},\n+\t\t\tnow,\n+\t\t);\n+\t\tassert.equal(\n+\t\t\ttext,\n+\t\t\t[\n+\t\t\t\t\"Run 4: version 4 (green, abso.yml), planned, 06:45 UTC to 06:46 UTC.\",\n+\t\t\t\t\"  npm.pack (npm pack): passed, exit 0, 5 s\",\n+\t\t\t\t\"      log: abso pipeline runs 4 --log npm.pack\",\n+\t\t\t\t\"  npm.publish (uses npm-publish): planned, not bound here\",\n+\t\t\t\t\"  npm.wait (uses npm-publish): running, npm wait, since 06:50 UTC\",\n+\t\t\t\t\"\",\n+\t\t\t].join(\"\\n\"),\n+\t\t);\n+\t});\n+\n+\tit(\"takes a run number, and --log only with one\", async () => {\n+\t\tconst dir = folder({});\n+\t\tassert.match((await run(dir, \"runs\", \"x\")).stderr, /a run is a number/);\n+\t\tassert.match((await run(dir, \"runs\", \"--log\", \"npm.pack\")).stderr, /--log needs a run/);\n+\t});\n+});"}],"ci":null}