Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 1 --json
JSON
/christopher/abso-core/versions/1?format=json

The tool as of abso 612: https-only token, and the pipeline plan (abso 161)

of shared·infra-split··Not checked

abso-core's version 0 is the tool cut from abso 609. This is the difference to abso 612, reviewed by Agent VCS before the cut, so abso's pin can switch to an exact match.

  • abso 611 (Pinch, Security's fix): off this machine, the client sends the token only over https. localhost, 127.0.0.1 and [::1] are still allowed. That's in client/src/core.ts and the view mod's copy (client/view/hooks/register.tsx), with tests and the README.
  • abso 612 (infra-pipeline): src/pipeline/plan.ts answers which pipelines an event starts, and their jobs in waves. abso pipeline check --on <event> shows the plan. Tests are in src/pipeline/test/plan.test.ts and client/test/pipeline-commands.test.ts.

Checked here: npm ci, npx biome ci . and npm run check all exit 0 (693 pass, 1 skipped).

Version 0 · Files at version 1

9 files, 264 lines added, 5 removed.

--- a/client/README.md
+++ b/client/README.md
@@ -28,6 +28,9 @@
2828
2929`AVCS_TRUSTED_SERVERS` (comma-separated) adds servers for one shell, and
3030`AVCS_ISSUES_SERVER` names the Issues Worker. The mods follow the same rule.
31+Off this machine only `https://` servers count. A server you trust gets your
32+token: the same token goes to every server named, so name only servers you
33+would hand it to.
3134
3235Every path a sync, switch, join or restore answer names is checked before
3336the client touches the disk: nothing is written outside the folder, into
@@ -89,7 +92,7 @@
8992| `abso label <name> [--version n] [--remove]` / `abso labels` | Puts a label on a version of shared (the newest by default) or takes it off, like a git tag; `labels` lists them all. |
9093| `abso follow <label>` / `abso follow --none` | Makes this folder follow a label: every sync takes it to the newest version of shared with that label. `--none` goes back to shared's newest. Saved in `.avcs/config.json`. |
9194| `abso check-ignore <path...>` | Whether abso leaves each path out, and which line of which ignore file decided (see "What is left out"). |
92−| `abso pipeline check [file]` | Reads the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and lists each problem as `<path>: <message>`: a cycle in needs, a job or pipeline that doesn't exist, secrets in a pipeline a draft can start, keys it doesn't know. Exits 1 on problems; otherwise lists each pipeline's jobs in the order they run. Reads only the file. The shape is still a draft (abso issue 138). |
95+| `abso pipeline check [file] [--on <event>]` | Reads the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and lists each problem as `<path>: <message>`: a cycle in needs, a job or pipeline that doesn't exist, secrets in a pipeline a draft can start, keys it doesn't know. Exits 1 on problems; otherwise lists each pipeline's jobs in the order they run. With `--on publish|draft|green|land|hand|schedule` (and `--space`, `--pipeline` or `--every`), says which pipelines that event starts, with their jobs in waves that can run side by side, and why the others don't. Reads only the file. The shape is still a draft (abso issue 138). |
9396| `abso issues [--open] [--status <s>] [--agent <a>] [--parent <N>] [--label <l,l>]` | The project's issues (#54), most recently updated first. Statuses come from the work: `abso start --issue N` puts an issue In progress, an open ask makes it Blocked (In review for a review), and `publish --done` closes it. `--label friction` keeps the issues with every label named: a ready list of work to pick up. `abso issues --labels` lists the labels in use, with how many issues are open under each. |
9497| `abso issue new "<title>" --label <l,l>` / `abso issue <N> --label <l,l> --unlabel <l,l>` | Labels an issue, or changes its labels. A label is 1-40 lower-case letters, digits and `- _ . :` (`friction`, `area:client`); what you type is lower-cased. An edit that only changes labels tells nobody unless `--notify` names people. Tool friction goes in its own issue, labeled `friction`. |
9598| `abso issue draft "<title>"` / `abso issues --drafts` | A draft of an issue: yours alone, with no number and no news. Takes the same fields as `issue new`. `abso issue draft <D> [fields]` changes one, `--open` opens it as an issue (with any fields given over the draft's), `--delete` deletes it. |
--- a/client/src/core.ts
+++ b/client/src/core.ts
@@ -161,6 +161,8 @@
161161 if (o === undefined) return false;
162162 const host = o.replace(/^https?:\/\//, "").replace(/:\d+$/, "");
163163 if (host === "localhost" || host === "127.0.0.1" || host === "[::1]") return true;
164+ // Off this machine only https: a token over plain http goes in clear text (Security, 608).
165+ if (!o.startsWith("https://")) return false;
164166 return [...TOKEN_SERVERS, ...(trusted ?? "").split(",")].some((t) => t.trim() !== "" && origin(t) === o);
165167}
166168
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -649,10 +649,11 @@
649649 run: runCheckIgnore,
650650 },
651651 pipeline: {
652− flags: {},
653− usage: "abso pipeline check [file]",
652+ flags: { on: "string", space: "string", pipeline: "string", every: "string" },
653+ usage:
654+ "abso pipeline check [file] [--on publish|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]]",
654655 about:
655− "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. It reads only the file.",
656+ "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.",
656657 // Loaded only here, so the yaml package it needs can't stop every other command
657658 // when a checkout lacks it (abso issue 168).
658659 run: async (args, env) => {
--- a/client/src/pipeline-commands.ts
+++ b/client/src/pipeline-commands.ts
@@ -5,7 +5,8 @@
55import { existsSync, readFileSync } from "node:fs";
66import { basename, join, resolve } from "node:path";
77import { readPipelineFile } from "../../src/pipeline/pipeline.ts";
8−import { type Parsed, UsageError } from "./args.ts";
8+import { type PipelineEvent, plan } from "../../src/pipeline/plan.ts";
9+import { type Parsed, str, UsageError } from "./args.ts";
910import { type Env, EXIT, type Output } from "./command-env.ts";
1011import { findRoot } from "./config.ts";
1112
@@ -36,6 +37,28 @@
3637 };
3738 }
3839 const { pipelines } = checked.file;
40+ const on = str(args, "on");
41+ if (on !== undefined) {
42+ const event = eventFrom(on, args);
43+ const planned = plan(checked.file, event);
44+ const said =
45+ event.kind === "schedule"
46+ ? `On the schedule "${event.every}"`
47+ : `On ${event.kind}${event.kind === "hand" ? ` of ${event.pipeline}` : ""} in ${event.space}`;
48+ const lines = [
49+ ...planned.start.flatMap((p) => [
50+ ` ${p.name} starts:`,
51+ ...p.waves.map(
52+ (w, i) => ` ${i + 1}. ${w.map((j) => `${j}${p.required.includes(j) ? " (required)" : ""}`).join(", ")}`,
53+ ),
54+ ]),
55+ ...planned.skip.map((s) => ` ${s.name} doesn't start: ${s.why}`),
56+ ];
57+ return {
58+ text: `${said}, ${planned.start.length === 0 ? "nothing in" : `${planned.start.length === 1 ? "1 pipeline" : `${planned.start.length} pipelines`} from`} ${name} starts; jobs on one line can run side by side.\n${lines.join("\n")}\n`,
59+ json: { file: name, event, ...planned },
60+ };
61+ }
3962 const lines = pipelines.flatMap((p) => [
4063 ` ${p.name}, on ${p.on.map((t) => (typeof t === "string" ? t : `every ${t.every}`)).join(", ")}${p.only ? `, only ${p.only.join(", ")}` : ""}:`,
4164 ...p.jobs.map(
@@ -48,3 +71,22 @@
4871 json: { file: name, pipelines },
4972 };
5073}
75+const KINDS = ["publish", "draft", "green", "land", "hand", "schedule"] as const;
77+/** --on, with --space, --pipeline (by hand) and --every (a schedule), as an event. */
78+function eventFrom(on: string, args: Parsed): PipelineEvent {
79+ if (!(KINDS as readonly string[]).includes(on)) throw new UsageError(`--on is one of ${KINDS.join(", ")}`);
80+ const space = str(args, "space") ?? "shared";
81+ if (on === "schedule") {
82+ const every = str(args, "every");
83+ if (!every) throw new UsageError('--on schedule takes --every "<when>", as the file writes it');
84+ return { kind: "schedule", every };
85+ }
86+ if (on === "hand") {
87+ const pipeline = str(args, "pipeline");
88+ if (!pipeline) throw new UsageError("--on hand takes --pipeline <name>");
89+ return { kind: "hand", pipeline, space };
90+ }
91+ return { kind: on as "publish" | "draft" | "green" | "land", space };
92+}
--- a/client/test/client.test.ts
+++ b/client/test/client.test.ts
@@ -1528,6 +1528,10 @@
15281528 assert.equal(tokenGoesTo(bad), false, bad);
15291529 }
15301530 assert.equal(tokenGoesTo("https://mine.example", "https://other.example, https://mine.example"), true);
1531+ // Off this machine only https: plain http would carry the token in clear text, trusted or not.
1532+ assert.equal(tokenGoesTo("http://example.com", "http://example.com"), false);
1533+ assert.equal(tokenGoesTo("http://localhost:8787"), true);
1534+ assert.equal(tokenGoesTo("http://127.0.0.1:8787"), true);
15311535 });
15321536
15331537 it("trusts the servers this machine's servers.json names, and their Issues Workers, and nothing malformed", () => {
--- a/client/test/pipeline-commands.test.ts
+++ b/client/test/pipeline-commands.test.ts
@@ -111,3 +111,50 @@
111111 assert.match(main, /await import\("\.\/pipeline-commands\.ts"\)/);
112112 });
113113});
115+describe("abso pipeline check --on (abso issue 176)", () => {
116+ const FILE = `pipelines:
117+ ci:
118+ on: [publish, draft]
119+ jobs:
120+ setup: { run: npm ci }
121+ lint: { needs: [setup], run: lint }
122+ test: { needs: [setup], run: npm test }
123+ required: [test]
124+ release:
125+ on: [green, hand]
126+ only: shared
127+ jobs:
128+ site: { uses: deploy, worker: w, secrets: [CLOUDFLARE_API_TOKEN] }
129+`;
130+ it("says which pipelines a draft starts, in waves, and why the others don't", async () => {
131+ const r = await run(folder({ "abso.yml": FILE }), "check", "--on", "draft");
132+ assert.equal(r.exit, 0, r.stderr);
133+ assert.equal(
134+ r.stdout,
135+ "On draft in shared, 1 pipeline from abso.yml starts; jobs on one line can run side by side.\n ci starts:\n 1. setup\n 2. lint, test (required)\n release doesn't start: doesn't run on draft\n",
136+ );
137+ });
139+ it("takes the space, the pipeline started by hand, and answers --json", async () => {
140+ const dir = folder({ "abso.yml": FILE });
141+ assert.match(
142+ (await run(dir, "check", "--on", "green", "--space", "rename-59")).stdout,
143+ /^On green in rename-59, nothing in abso\.yml starts/,
144+ );
145+ const j = JSON.parse((await run(dir, "check", "--on", "hand", "--pipeline", "release", "--json")).stdout);
146+ assert.equal(j.ok, true);
147+ assert.deepEqual(j.event, { kind: "hand", pipeline: "release", space: "shared" });
148+ assert.deepEqual(j.start, [{ name: "release", waves: [["site"]], required: [] }]);
149+ });
151+ it("refuses an event it doesn't know, or one missing what it needs", async () => {
152+ const dir = folder({ "abso.yml": FILE });
153+ assert.match(
154+ (await run(dir, "check", "--on", "merge")).stderr,
155+ /--on is one of publish, draft, green, land, hand, schedule/,
156+ );
157+ assert.match((await run(dir, "check", "--on", "hand")).stderr, /--on hand takes --pipeline <name>/);
158+ assert.match((await run(dir, "check", "--on", "schedule")).stderr, /--on schedule takes --every/);
159+ });
160+});
--- a/client/view/hooks/register.tsx
+++ b/client/view/hooks/register.tsx
@@ -100,6 +100,7 @@
100100 if (o === undefined) return false;
101101 const host = o.replace(/^https?:\/\//, "").replace(/:\d+$/, "");
102102 if (host === "localhost" || host === "127.0.0.1" || host === "[::1]") return true;
103+ if (!o.startsWith("https://")) return false;
103104 return [...TOKEN_SERVERS, ...(trusted ?? "").split(",")].some((t) => t.trim() !== "" && origin(t) === o);
104105}
105106
--- /dev/null
+++ b/src/pipeline/plan.ts
@@ -0,0 +1,71 @@
1+// Which pipelines an event starts, and their jobs in waves (abso issue 176,
2+// under 138). A pure function of a checked pipeline file (pipeline.ts) and the
3+// event: nothing runs here. A wave is every job whose needs are all in earlier
4+// waves, so the jobs of one wave can run side by side. `abso pipeline check
5+// --on <event>` shows it, and a runner reads the same plan.
6+
7+import type { Job, Pipeline, PipelineFile } from "./pipeline.ts";
8+
9+/** What happened, and in which space (shared, or a named draft). */
10+export type PipelineEvent =
11+ | { readonly kind: "publish" | "draft" | "green" | "land"; readonly space: string }
12+ /** Someone starts one pipeline by name. */
13+ | { readonly kind: "hand"; readonly pipeline: string; readonly space: string }
14+ /** A schedule's time came: `every` as the file wrote it. Schedules run on shared. */
15+ | { readonly kind: "schedule"; readonly every: string };
17+export interface PlannedPipeline {
18+ readonly name: string;
19+ /** Job names, wave by wave. */
20+ readonly waves: readonly (readonly string[])[];
21+ readonly required: readonly string[];
22+}
24+export interface Plan {
25+ readonly start: readonly PlannedPipeline[];
26+ /** The pipelines that don't start, each with why. */
27+ readonly skip: readonly { readonly name: string; readonly why: string }[];
28+}
30+export function plan(file: PipelineFile, event: PipelineEvent): Plan {
31+ const start: PlannedPipeline[] = [];
32+ const skip: { name: string; why: string }[] = [];
33+ const space = event.kind === "schedule" ? "shared" : event.space;
34+ for (const p of file.pipelines) {
35+ const why = notStarting(p, event, space);
36+ if (why) skip.push({ name: p.name, why });
37+ else start.push({ name: p.name, waves: waves(p.jobs), required: p.required });
38+ }
39+ return { start, skip };
40+}
42+/** Why `p` doesn't start on `event`, or undefined when it does. */
43+function notStarting(p: Pipeline, event: PipelineEvent, space: string): string | undefined {
44+ if (event.kind === "hand" && event.pipeline !== p.name) return "another pipeline was started by hand";
45+ const on =
46+ event.kind === "schedule"
47+ ? p.on.some((t) => typeof t !== "string" && t.every === event.every)
48+ : p.on.includes(event.kind);
49+ if (!on) return event.kind === "schedule" ? `has no schedule "${event.every}"` : `doesn't run on ${event.kind}`;
50+ if (p.only && !p.only.includes(space)) return `runs only for ${p.only.join(", ")}, not ${space}`;
51+ // The file check refuses this already; the plan holds the line too.
52+ if (event.kind === "draft" && p.jobs.some((j) => j.secrets.length > 0))
53+ return "holds secrets, and a draft runs unpublished code";
54+ return undefined;
55+}
57+/** The jobs in waves: each wave holds every job whose needs all came in earlier waves. */
58+export function waves(jobs: readonly Job[]): string[][] {
59+ const done = new Set<string>();
60+ const out: string[][] = [];
61+ let left = [...jobs];
62+ while (left.length > 0) {
63+ const wave = left.filter((j) => j.needs.every((n) => done.has(n)));
64+ // A checked file has no cycles; stop rather than loop if one ever got here.
65+ if (wave.length === 0) throw new Error(`jobs ${left.map((j) => j.name).join(", ")} wait on each other`);
66+ for (const j of wave) done.add(j.name);
67+ out.push(wave.map((j) => j.name));
68+ left = left.filter((j) => !done.has(j.name));
69+ }
70+ return out;
71+}
--- /dev/null
+++ b/src/pipeline/test/plan.test.ts
@@ -0,0 +1,88 @@
1+// Which pipelines an event starts, and their jobs in waves (abso issue 176).
2+
3+import assert from "node:assert/strict";
4+import { describe, it } from "node:test";
5+import { type PipelineFile, readPipelineFile } from "../pipeline.ts";
6+import { plan, waves } from "../plan.ts";
7+
8+const FILE = `pipelines:
9+ ci:
10+ on: [publish, draft]
11+ jobs:
12+ setup: { run: npm ci }
13+ lint: { needs: [setup], run: npx biome ci . }
14+ test: { needs: [setup], run: npm test }
15+ bundle: { needs: [lint, test], run: npm run build, keep: ["dist/**"] }
16+ required: [lint, test]
17+ release:
18+ on: [green, hand]
19+ only: shared
20+ jobs:
21+ site: { uses: deploy, from: ci.bundle, worker: w, secrets: [CLOUDFLARE_API_TOKEN] }
22+ tell: { needs: [site], uses: notify, to: [issue] }
23+ nightly:
24+ on: [{ every: "day 06:00 UTC" }]
25+ jobs:
26+ drill: { run: node ops/restore-drill.ts }
27+`;
28+const read = (text: string): PipelineFile => {
29+ const c = readPipelineFile(text, "abso.yml");
30+ assert.ok(c.ok, c.ok ? "" : JSON.stringify(c.problems));
31+ return c.file;
32+};
33+const file = read(FILE);
34+const started = (p: ReturnType<typeof plan>) => p.start.map((s) => s.name);
36+describe("which pipelines an event starts", () => {
37+ it("a publish to shared starts ci, in waves that can run side by side", () => {
38+ const p = plan(file, { kind: "publish", space: "shared" });
39+ assert.deepEqual(started(p), ["ci"]);
40+ assert.deepEqual(p.start[0]!.waves, [["setup"], ["lint", "test"], ["bundle"]]);
41+ assert.deepEqual(p.start[0]!.required, ["lint", "test"]);
42+ assert.deepEqual(p.skip, [
43+ { name: "release", why: "doesn't run on publish" },
44+ { name: "nightly", why: "doesn't run on publish" },
45+ ]);
46+ });
48+ it("green on shared starts release; green on a named draft doesn't, since release is only shared", () => {
49+ assert.deepEqual(started(plan(file, { kind: "green", space: "shared" })), ["release"]);
50+ const p = plan(file, { kind: "green", space: "rename-59" });
51+ assert.deepEqual(started(p), []);
52+ assert.deepEqual(
53+ p.skip.find((s) => s.name === "release"),
54+ { name: "release", why: "runs only for shared, not rename-59" },
55+ );
56+ });
58+ it("by hand starts only the pipeline named, and only if it runs by hand", () => {
59+ assert.deepEqual(started(plan(file, { kind: "hand", pipeline: "release", space: "shared" })), ["release"]);
60+ const ci = plan(file, { kind: "hand", pipeline: "ci", space: "shared" });
61+ assert.deepEqual(started(ci), []);
62+ assert.deepEqual(
63+ ci.skip.find((s) => s.name === "ci"),
64+ { name: "ci", why: "doesn't run on hand" },
65+ );
66+ });
68+ it("a schedule starts the pipeline with that schedule, on shared", () => {
69+ assert.deepEqual(started(plan(file, { kind: "schedule", every: "day 06:00 UTC" })), ["nightly"]);
70+ assert.deepEqual(started(plan(file, { kind: "schedule", every: "hour" })), []);
71+ });
73+ it("a draft never starts a pipeline holding secrets, even if the file said so", () => {
74+ const unchecked: PipelineFile = {
75+ defaults: {},
76+ pipelines: [{ ...file.pipelines[1]!, on: ["draft"], only: undefined } as never],
77+ };
78+ const p = plan(unchecked, { kind: "draft", space: "shared" });
79+ assert.deepEqual(p.start, []);
80+ assert.match(p.skip[0]!.why, /holds secrets, and a draft runs unpublished code/);
81+ });
83+ it("waves stop on jobs that wait on each other rather than loop", () => {
84+ const job = (name: string, needs: string[]) =>
85+ ({ name, needs, keep: [], cache: [], secrets: [], with: {} }) as never;
86+ assert.throws(() => waves([job("a", ["b"]), job("b", ["a"])]), /jobs a, b wait on each other/);
87+ });
88+});