runward 0.13.3 → 0.14.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
@@ -6,7 +6,7 @@
6
6
 
7
7
  **After the spec, the hard part starts. Runward ships it and runs it.**
8
8
 
9
- *Run-grade engineering for agentic systems from business need to a system that holds in production.*
9
+ *The floor that keeps an agentic system alive. Run-grade engineering, from business need to production.*
10
10
 
11
11
  Your agent builds fast. Runward frames what it builds — six gated phases your agent executes and one human signs off — so what ships actually holds.
12
12
 
package/dist/cli.js CHANGED
@@ -13,7 +13,8 @@ import { doctorCommand } from "./commands/doctor.js";
13
13
  import { updateCommand } from "./commands/update.js";
14
14
  import { characterizeCommand } from "./commands/characterize.js";
15
15
  import { complianceCommand } from "./commands/compliance.js";
16
- // Exit codes: 0 = success · 1 = gaps/warnings · 2 = missing prerequisite
16
+ import { TOOL_IDS } from "./lib/tools.js";
17
+ // Exit codes: 0 = success · 1 = gaps/warnings · 2 = missing prerequisite or CLI misuse (typo, unknown flag)
17
18
  process.on("uncaughtException", (err) => {
18
19
  if (err.name === "ExitPromptError")
19
20
  process.exit(130); // Ctrl+C in a prompt
@@ -52,7 +53,7 @@ program
52
53
  .command("init")
53
54
  .description("scaffold the mission structure (interactive wizard, or --yes)")
54
55
  .option("-p, --path <path>", "project directory (default: prompt, or . with --yes)")
55
- .option("-t, --tools <list>", "comma-separated tool profiles: claude,cursor,copilot,gemini,windsurf")
56
+ .option("-t, --tools <list>", `comma-separated tool profiles: ${TOOL_IDS.join(",")}`)
56
57
  .option("--force", "overwrite existing files")
57
58
  .option("--example", "scaffold a filled reference mission (request-triage) — the whole chain is green out of the box")
58
59
  .action(initCommand);
@@ -91,4 +92,27 @@ program
91
92
  .argument("[regime]", "iso-42001 | nist-ai-rmf | eu-ai-act")
92
93
  .option("-p, --path <path>", "project directory")
93
94
  .action(complianceCommand);
94
- program.parseAsync();
95
+ // exitOverride lets us map Commander's own errors onto runward's exit-code contract:
96
+ // a parse error (unknown command/option, missing/excess argument) is operator misuse → 2,
97
+ // so CI can tell a typo from a legitimate gate failure (exit 1). Help/version exit 0.
98
+ // Applied to the root AND every subcommand — it does not propagate on its own.
99
+ const MISUSE = new Set([
100
+ "commander.unknownCommand", "commander.unknownOption", "commander.invalidArgument",
101
+ "commander.missingArgument", "commander.excessArguments",
102
+ "commander.missingMandatoryOptionValue", "commander.optionMissingArgument",
103
+ ]);
104
+ const onCommanderExit = (err) => {
105
+ const code = err?.code ?? "";
106
+ if (code === "commander.helpDisplayed" || code === "commander.version" || code === "commander.help")
107
+ process.exit(0);
108
+ process.exit(MISUSE.has(code) ? 2 : (err?.exitCode ?? 1)); // Commander already wrote the message
109
+ };
110
+ program.exitOverride(onCommanderExit);
111
+ program.commands.forEach((cmd) => cmd.exitOverride(onCommanderExit));
112
+ program.parseAsync().catch((err) => {
113
+ // An error escaping an async action — Commander's own exits are handled above.
114
+ console.error("\n " + c.error("✗") + " " + (err?.message ?? String(err)));
115
+ if (process.env.VERBOSE && err?.stack)
116
+ console.error(err.stack);
117
+ process.exit(1);
118
+ });
@@ -68,7 +68,10 @@ export async function checkCommand(opts) {
68
68
  for (const d of driftReport(mission, deliverable))
69
69
  drift.push(`${label} · ${d.rule} — ${d.problem}`);
70
70
  const { expected, violations } = conformance(mission, phase, deliverable);
71
- if (expected.length === 0)
71
+ // Non-vacuity (ADR-0002): when no rules are currently mapped to a phase, conformance()
72
+ // still raises a `(mapping)` violation if the mapping was stripped below its pinned
73
+ // floor. Only skip when there is genuinely nothing to report — never discard that signal.
74
+ if (expected.length === 0 && violations.length === 0)
72
75
  continue;
73
76
  checked++;
74
77
  if (violations.length === 0) {
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { analyze, findMissionRoot } from "../lib/mission.js";
3
+ import { analyze, findMissionRoot, isRealAdr } from "../lib/mission.js";
4
4
  import { c, createHeader, section } from "../lib/styles.js";
5
5
  import { VERSION, WORKFLOWS } from "../lib/paths.js";
6
6
  /** Mission snapshot: phase progress, decision journal, activity, workflows —
@@ -44,7 +44,7 @@ export async function statusCommand(opts) {
44
44
  console.log(section("Decision journal"));
45
45
  const adrDir = join(mission, "adr");
46
46
  const adrs = existsSync(adrDir)
47
- ? readdirSync(adrDir).filter((f) => /^ADR-\d+/.test(f) && !f.includes("0000")).sort()
47
+ ? readdirSync(adrDir).filter(isRealAdr).sort()
48
48
  : [];
49
49
  if (adrs.length === 0) {
50
50
  console.log(c.darkGray(" no ADR yet — every structural decision must be locked"));
@@ -59,7 +59,9 @@ export function parseManifest(content) {
59
59
  const cols = line.split("|").slice(1, -1).map((c) => c.replace(/`/g, "").trim());
60
60
  if (cols.length < 3)
61
61
  continue;
62
- const [rule, status, evidence] = cols;
62
+ // Evidence may itself contain a pipe (a TS union `a | b`, a table hint) — rejoin the
63
+ // tail so it is not truncated, which would wrongly fail an n/a row on a trivial reason.
64
+ const rule = cols[0], status = cols[1], evidence = cols.slice(2).join(" | ");
63
65
  if (/^rule$/i.test(rule) || /^:?-+:?$/.test(rule))
64
66
  continue; // header / separator
65
67
  rows.push({ rule, status: status.toLowerCase(), evidence });
@@ -71,7 +73,12 @@ function adrExists(missionDir, evidence) {
71
73
  if (!id)
72
74
  return false;
73
75
  const dir = join(missionDir, "adr");
74
- return existsSync(dir) && readdirSync(dir).some((f) => f.toUpperCase().startsWith(id));
76
+ // Anchor on a digit boundary so a `deviated` row citing ADR-1 is not satisfied by
77
+ // ADR-10 / ADR-12 when filenames are unpadded.
78
+ return existsSync(dir) && readdirSync(dir).some((f) => {
79
+ const u = f.toUpperCase();
80
+ return u.startsWith(id) && !/[0-9]/.test(u.charAt(id.length));
81
+ });
75
82
  }
76
83
  /**
77
84
  * The reconstruction lifecycle (ADR-0013/0014). A retroactively reconstructed decision is a
@@ -54,13 +54,19 @@ export function findMissionRoot(cwd) {
54
54
  // which distinguishes it from cross-references like [ADR-0001] or [framing.md].
55
55
  // A closing bracket followed by "(" is a markdown link ([floor note](floor.md)) — never a placeholder.
56
56
  const PLACEHOLDER = /\[[^\]\n]*\s[^\]\n]{1,80}\](?!\()/g;
57
+ /** A real ADR file: ADR-<n>-*.md, excluding the scaffolded template. Single source of
58
+ * truth so the mission, status, and conformance paths agree (they used to diverge:
59
+ * a `!f.includes("0000")` filter wrongly dropped e.g. ADR-0021-…-10000-ms.md). */
60
+ export function isRealAdr(f) {
61
+ return /^ADR-\d+/.test(f) && f.endsWith(".md") && f !== "ADR-0000-template.md";
62
+ }
57
63
  export function artifactState(missionDir, a) {
58
64
  const path = join(missionDir, a.relPath);
59
65
  if (!existsSync(path))
60
66
  return "missing";
61
67
  // Special case: ADR directory — count real ADRs beyond the template.
62
68
  if (a.relPath === "adr") {
63
- const adrs = readdirSync(path).filter((f) => /^ADR-\d+/.test(f) && !f.includes("0000"));
69
+ const adrs = readdirSync(path).filter(isRealAdr);
64
70
  return adrs.length > 0 ? "filled" : "untouched";
65
71
  }
66
72
  // Special case: contracts directory — filled as soon as one .md is not the raw port-contract template.
@@ -77,9 +83,22 @@ export function artifactState(missionDir, a) {
77
83
  const template = readFileSync(join(TEMPLATES, "mission", a.templateKey), "utf8");
78
84
  if (content.trim() === template.trim())
79
85
  return "untouched";
86
+ if ((content.match(PLACEHOLDER) || []).length >= 3)
87
+ return "in-progress";
88
+ // Divergence guard: a deliverable is "filled" only when it departs meaningfully from
89
+ // the scaffold. Templates with few placeholders (decision-matrix, execution-topology)
90
+ // cannot lean on the placeholder floor, so a one-byte interior edit would otherwise
91
+ // pass. Require several lines of genuinely new content beyond the template. Calibrated
92
+ // against the reference mission (its lightest fill adds 5 lines / 215 words).
93
+ const lines = (s) => s.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
94
+ const templateLines = new Set(lines(template));
95
+ const added = lines(content).filter((l) => !templateLines.has(l));
96
+ const addedWords = added.reduce((n, l) => n + l.split(/\s+/).filter(Boolean).length, 0);
97
+ if (added.length < 3 || addedWords < 20)
98
+ return "in-progress";
99
+ return "filled";
80
100
  }
81
- const placeholders = (content.match(PLACEHOLDER) || []).length;
82
- if (placeholders >= 3)
101
+ if ((content.match(PLACEHOLDER) || []).length >= 3)
83
102
  return "in-progress";
84
103
  return "filled";
85
104
  }
@@ -90,7 +109,7 @@ export function analyze(missionDir) {
90
109
  });
91
110
  const adrDir = join(missionDir, "adr");
92
111
  const adrCount = existsSync(adrDir)
93
- ? readdirSync(adrDir).filter((f) => /^ADR-\d+/.test(f) && !f.includes("0000")).length
112
+ ? readdirSync(adrDir).filter(isRealAdr).length
94
113
  : 0;
95
114
  const firstIncomplete = phases.find((p) => !p.complete);
96
115
  return { phases, adrCount, currentPhase: firstIncomplete ? firstIncomplete.spec.label : "all gates passed" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runward",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "description": "After the spec: ship and run. A delivery framework for agentic systems — floor first, evolution on evidence, governance from day zero, handover with proof.",
5
5
  "keywords": [
6
6
  "agentic",
@@ -8,12 +8,14 @@ Use this workflow once framing is decided and structure must follow: "how do we
8
8
 
9
9
  - The framing note: floor/target split, success criterion, hard constraints, presumed boundaries.
10
10
  - The `mission/architecture.md`, `mission/port-contract.md`, and `mission/adr/ADR-0000-template.md` templates.
11
+ - The `mission/decision-matrix.md` template (the structuring defaults and the trigger that switches each).
11
12
  - The `mission/shared-bricks.md` and `mission/execution-topology.md` templates (the infrastructure vision).
12
13
 
13
14
  ## Outputs
14
15
 
15
16
  - A light architecture note.
16
17
  - The port list with contracts and the integration protocol.
18
+ - The decision matrix adopted for the mission: each structuring choice with its sober default and the objective trigger that switches it (`mission/decision-matrix.md`).
17
19
  - The execution-topology note: each port placed behind its location family, with data class and sovereignty.
18
20
  - One ADR per structuring decision, including each non-in-app placement.
19
21
 
@@ -41,6 +43,7 @@ Use this workflow once framing is decided and structure must follow: "how do we
41
43
  ## Definition of Done
42
44
 
43
45
  - Architecture note produced, boundaries first, stack open.
46
+ - Decision matrix adopted for the mission: every structuring choice carries a sober default and an objective trigger; the positions taken so far are recorded (`mission/decision-matrix.md`).
44
47
  - Every port named with contract and initial version; integration protocol stated.
45
48
  - Execution-topology note produced: every port placed behind a location family, with its data class(es) and sovereignty; non-in-app placements carry an ADR; the usage registry is seeded.
46
49
  - One ADR per structuring choice, locked before the note mentions it.
@@ -13,6 +13,7 @@ Use this workflow at the start of any agentic-system mission, or whenever the pe
13
13
  ## Outputs
14
14
 
15
15
  - A framing note (use the `mission/framing.md` template).
16
+ - A steering contract (use the `mission/mission-contract.md` template): what is delivered, on what condition it is accepted, and along which roadmap — filled with the sponsor, tying the success criterion to the deliverables and the milestones.
16
17
  - The floor/target split with named deferrals.
17
18
  - Presumed architecture boundaries — ports and integration protocol, stack left open.
18
19
 
@@ -55,6 +56,7 @@ Lock any truly structuring decision through `decision-loop` before committing it
55
56
  ## Definition of Done
56
57
 
57
58
  - Framing note produced: problem, value, observable success criterion, hard constraints — one page.
59
+ - Steering contract filled with the sponsor: the success criterion tied to the deliverables and to what closes each engagement (`mission/mission-contract.md`).
58
60
  - Floor perimeter listed, every deferral named with its trigger.
59
61
  - Presumed boundaries stated; language and topology explicitly left open.
60
62
  - Note reviewed via `review` before circulation.