@ambystech/ambykit 1.5.0 → 1.6.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -0
  3. package/dist/cli/dashboard.d.ts +4 -1
  4. package/dist/cli/dashboard.js +45 -15
  5. package/dist/cli/dashboard.js.map +1 -1
  6. package/dist/cli/index.js +2 -0
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/lane.d.ts +0 -2
  9. package/dist/cli/lane.js +9 -104
  10. package/dist/cli/lane.js.map +1 -1
  11. package/dist/cli/run-budget.d.ts +18 -0
  12. package/dist/cli/run-budget.js +75 -0
  13. package/dist/cli/run-budget.js.map +1 -0
  14. package/dist/cli/run-control.d.ts +28 -0
  15. package/dist/cli/run-control.js +139 -0
  16. package/dist/cli/run-control.js.map +1 -0
  17. package/dist/cli/run-files.d.ts +96 -0
  18. package/dist/cli/run-files.js +120 -0
  19. package/dist/cli/run-files.js.map +1 -0
  20. package/dist/cli/run-gates.d.ts +25 -0
  21. package/dist/cli/run-gates.js +45 -0
  22. package/dist/cli/run-gates.js.map +1 -0
  23. package/dist/cli/run-launch.d.ts +17 -0
  24. package/dist/cli/run-launch.js +89 -0
  25. package/dist/cli/run-launch.js.map +1 -0
  26. package/dist/cli/run-loop.d.ts +37 -0
  27. package/dist/cli/run-loop.js +150 -0
  28. package/dist/cli/run-loop.js.map +1 -0
  29. package/dist/cli/run-merger.d.ts +12 -0
  30. package/dist/cli/run-merger.js +88 -0
  31. package/dist/cli/run-merger.js.map +1 -0
  32. package/dist/cli/run-plan.d.ts +28 -0
  33. package/dist/cli/run-plan.js +49 -0
  34. package/dist/cli/run-plan.js.map +1 -0
  35. package/dist/cli/run-process.d.ts +39 -0
  36. package/dist/cli/run-process.js +99 -0
  37. package/dist/cli/run-process.js.map +1 -0
  38. package/dist/cli/run-protocol-prompts.d.ts +7 -0
  39. package/dist/cli/run-protocol-prompts.js +36 -0
  40. package/dist/cli/run-protocol-prompts.js.map +1 -0
  41. package/dist/cli/run-protocol.d.ts +10 -0
  42. package/dist/cli/run-protocol.js +99 -0
  43. package/dist/cli/run-protocol.js.map +1 -0
  44. package/dist/cli/run-script.d.ts +11 -0
  45. package/dist/cli/run-script.js +66 -0
  46. package/dist/cli/run-script.js.map +1 -0
  47. package/dist/cli/run-session.d.ts +60 -0
  48. package/dist/cli/run-session.js +21 -0
  49. package/dist/cli/run-session.js.map +1 -0
  50. package/dist/cli/run-supervisor.d.ts +20 -0
  51. package/dist/cli/run-supervisor.js +144 -0
  52. package/dist/cli/run-supervisor.js.map +1 -0
  53. package/dist/cli/run.d.ts +73 -0
  54. package/dist/cli/run.js +363 -0
  55. package/dist/cli/run.js.map +1 -0
  56. package/dist/cli/ui/dashboard/fleet-tokens.d.ts +404 -0
  57. package/dist/cli/ui/dashboard/fleet-tokens.js +405 -0
  58. package/dist/cli/ui/dashboard/fleet-tokens.js.map +1 -0
  59. package/dist/cli/ui/dashboard/fleet-view.d.ts +50 -0
  60. package/dist/cli/ui/dashboard/fleet-view.js +211 -0
  61. package/dist/cli/ui/dashboard/fleet-view.js.map +1 -0
  62. package/dist/cli/ui/dashboard/help-overlay.d.ts +1 -1
  63. package/dist/cli/ui/dashboard/help-overlay.js +11 -0
  64. package/dist/cli/ui/dashboard/help-overlay.js.map +1 -1
  65. package/dist/cli/ui/icons.d.ts +22 -0
  66. package/dist/cli/ui/icons.js +17 -0
  67. package/dist/cli/ui/icons.js.map +1 -0
  68. package/dist/cli/ui/interactive/fleet-actions.d.ts +24 -0
  69. package/dist/cli/ui/interactive/fleet-actions.js +30 -0
  70. package/dist/cli/ui/interactive/fleet-actions.js.map +1 -0
  71. package/dist/cli/ui/interactive/fleet.d.ts +54 -0
  72. package/dist/cli/ui/interactive/fleet.js +98 -0
  73. package/dist/cli/ui/interactive/fleet.js.map +1 -0
  74. package/dist/cli/ui/interactive/fullscreen.js +26 -8
  75. package/dist/cli/ui/interactive/fullscreen.js.map +1 -1
  76. package/dist/cli/ui/interactive/live.d.ts +8 -0
  77. package/dist/cli/ui/interactive/live.js +13 -0
  78. package/dist/cli/ui/interactive/live.js.map +1 -1
  79. package/dist/cli/ui/interactive/overview.d.ts +15 -1
  80. package/dist/cli/ui/interactive/overview.js +49 -0
  81. package/dist/cli/ui/interactive/overview.js.map +1 -1
  82. package/dist/core/config.d.ts +3 -0
  83. package/dist/core/config.js +6 -0
  84. package/dist/core/config.js.map +1 -1
  85. package/dist/core/fleet-view/derive.d.ts +14 -0
  86. package/dist/core/fleet-view/derive.js +54 -0
  87. package/dist/core/fleet-view/derive.js.map +1 -0
  88. package/dist/core/fleet-view/json.d.ts +37 -0
  89. package/dist/core/fleet-view/json.js +25 -0
  90. package/dist/core/fleet-view/json.js.map +1 -0
  91. package/dist/core/fleet-view/read.d.ts +8 -0
  92. package/dist/core/fleet-view/read.js +44 -0
  93. package/dist/core/fleet-view/read.js.map +1 -0
  94. package/dist/core/fleet-view/types.d.ts +52 -0
  95. package/dist/core/fleet-view/types.js +2 -0
  96. package/dist/core/fleet-view/types.js.map +1 -0
  97. package/dist/core/lane-merge.d.ts +29 -0
  98. package/dist/core/lane-merge.js +105 -0
  99. package/dist/core/lane-merge.js.map +1 -0
  100. package/dist/core/run-gate-actions.d.ts +51 -0
  101. package/dist/core/run-gate-actions.js +105 -0
  102. package/dist/core/run-gate-actions.js.map +1 -0
  103. package/dist/core/run-launch-plan.d.ts +51 -0
  104. package/dist/core/run-launch-plan.js +27 -0
  105. package/dist/core/run-launch-plan.js.map +1 -0
  106. package/dist/core/run-prompt.d.ts +47 -0
  107. package/dist/core/run-prompt.js +37 -0
  108. package/dist/core/run-prompt.js.map +1 -0
  109. package/dist/core/run-review.d.ts +50 -0
  110. package/dist/core/run-review.js +20 -0
  111. package/dist/core/run-review.js.map +1 -0
  112. package/dist/core/run-schedule.d.ts +23 -0
  113. package/dist/core/run-schedule.js +40 -0
  114. package/dist/core/run-schedule.js.map +1 -0
  115. package/dist/core/run-supervise.d.ts +71 -0
  116. package/dist/core/run-supervise.js +61 -0
  117. package/dist/core/run-supervise.js.map +1 -0
  118. package/dist/core/runners.d.ts +59 -0
  119. package/dist/core/runners.js +60 -0
  120. package/dist/core/runners.js.map +1 -0
  121. package/dist/core/types.d.ts +7 -0
  122. package/docs/cli-reference.md +78 -2
  123. package/docs/tool-compatibility.md +17 -0
  124. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ export function fleetJson(view) {
2
+ const r = view.run;
3
+ return {
4
+ run: r.run,
5
+ feature: r.feature,
6
+ status: r.status,
7
+ phase: r.phase,
8
+ stage: r.stage,
9
+ round: r.round,
10
+ limit: r.limit,
11
+ needsDecision: r.needsDecision,
12
+ gates: r.gates.map((g) => ({ id: g.id, after: g.after, state: g.state })),
13
+ lanes: view.lanes.map((l) => ({
14
+ lane: l.lane,
15
+ assistant: l.assistant,
16
+ state: l.state,
17
+ stalled: l.stalled,
18
+ ...(l.lastReportAt !== undefined ? { lastActivity: l.lastReportAt } : {}),
19
+ ...(l.idleMinutes !== undefined ? { idleMinutes: l.idleMinutes } : {}),
20
+ directive: { action: l.directive.action, status: l.directive.status },
21
+ })),
22
+ others: view.others,
23
+ };
24
+ }
25
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/core/fleet-view/json.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;IACnB,OAAO;QACL,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,aAAa,EAAE,CAAC,CAAC,aAAa;QAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACzE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,GAAG,CAAC,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,GAAG,CAAC,CAAC,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE;SACtE,CAAC,CAAC;QACH,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { FleetView } from "./types.js";
2
+ /**
3
+ * The read edge (feature 029, FR-001/FR-003/FR-013): `FleetView | null` from spec 025's readers. It touches
4
+ * nothing when `.amby/fleet` does not exist (no run ⇒ null, zero extra IO for a project that never ran a
5
+ * fleet), shows the most recently created unfinished run, and turns any lane it cannot read into an
6
+ * `unknown` row rather than an error.
7
+ */
8
+ export declare function readFleet(root: string, now?: number): FleetView | null;
@@ -0,0 +1,44 @@
1
+ import { existsSync } from "node:fs";
2
+ import { shortLane } from "../activity.js";
3
+ import { fleetRoot, listRuns } from "../fleet/runs.js";
4
+ import { laneStatus } from "../fleet/lane-status.js";
5
+ import { UNFINISHED } from "../fleet/types.js";
6
+ import { isFailed } from "../query.js";
7
+ import { laneView, runView, sortLanes } from "./derive.js";
8
+ /**
9
+ * The read edge (feature 029, FR-001/FR-003/FR-013): `FleetView | null` from spec 025's readers. It touches
10
+ * nothing when `.amby/fleet` does not exist (no run ⇒ null, zero extra IO for a project that never ran a
11
+ * fleet), shows the most recently created unfinished run, and turns any lane it cannot read into an
12
+ * `unknown` row rather than an error.
13
+ */
14
+ export function readFleet(root, now = Date.now()) {
15
+ try {
16
+ if (!existsSync(fleetRoot(root)))
17
+ return null;
18
+ const open = listRuns(root).filter((r) => UNFINISHED.includes(r.status));
19
+ if (open.length === 0)
20
+ return null;
21
+ const newest = [...open].sort((a, b) => Date.parse(b.createdAt || "0") - Date.parse(a.createdAt || "0") || b.run.localeCompare(a.run))[0];
22
+ const lanes = newest.lanes.map((lane) => {
23
+ let status = null;
24
+ try {
25
+ const s = laneStatus(root, { feature: newest.feature, lane: shortLane(lane.lane), run: newest.run, now });
26
+ status = isFailed(s) ? null : s;
27
+ }
28
+ catch {
29
+ status = null;
30
+ }
31
+ return laneView(lane, status);
32
+ });
33
+ return {
34
+ run: runView(newest),
35
+ lanes: sortLanes(lanes),
36
+ others: open.filter((r) => r.run !== newest.run).map((r) => r.run).sort(),
37
+ now,
38
+ };
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }
44
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/core/fleet-view/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,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E,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC1G,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;YACpB,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;YACzE,GAAG;SACJ,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { LaneState } from "../activity.js";
2
+ import type { DirectiveAction, DirectiveStatus, RunGate, RunStage, RunStatus } from "../fleet/types.js";
3
+ /**
4
+ * View-model for the dashboard's Fleet view (feature 029). Types only: built from spec 025's run record and
5
+ * `laneStatus` result, with no state parsing and no stall rule of its own. Spec 025 owns the state
6
+ * (`src/core/fleet/*`); 029 adds this read-only layer on top.
7
+ */
8
+ /** A lane's state as shown: 025's states plus `unreported` (no report yet) and `unknown` (data unreadable, FR-003). */
9
+ export type LaneViewState = LaneState | "unreported" | "unknown";
10
+ /** The review loop's position (FR-004): working, QA or architect review. */
11
+ export type ReviewStage = RunStage;
12
+ export interface DirectiveView {
13
+ action: DirectiveAction;
14
+ /** 025's derived words; `none` when no directive is waiting. */
15
+ status: DirectiveStatus;
16
+ }
17
+ export interface LaneView {
18
+ /** Short lane name `lane-p-k`, unique in a run, so two lanes of one assistant stay distinct rows. */
19
+ lane: string;
20
+ assistant: string;
21
+ state: LaneViewState;
22
+ /** Spec 025's `laneStatus` decided this; the view never recomputes it (FR-005). */
23
+ stalled: boolean;
24
+ /** Whole minutes since the later of the last report and the last `tasks.md` change. */
25
+ idleMinutes?: number;
26
+ /** The stall limit in force, minutes (for the `STALLED 18m` text). */
27
+ stallMinutes?: number;
28
+ lastReportAt?: string;
29
+ directive: DirectiveView;
30
+ /** Task ids the run assigned to this lane. */
31
+ tasks: string[];
32
+ }
33
+ export type GateView = RunGate;
34
+ export interface RunView {
35
+ run: string;
36
+ feature: string;
37
+ status: RunStatus;
38
+ phase: number;
39
+ stage: ReviewStage;
40
+ round: number;
41
+ limit: number;
42
+ needsDecision: boolean;
43
+ gates: GateView[];
44
+ }
45
+ export interface FleetView {
46
+ run: RunView;
47
+ lanes: LaneView[];
48
+ /** Other unfinished runs (ids), so the view can say there are more than the one shown. */
49
+ others: string[];
50
+ /** The reading time, epoch ms. */
51
+ now: number;
52
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/fleet-view/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The check-off-aware lane merge (feature 015 FR-019), extracted from `ambykit lane merge` so that command
3
+ * and `ambykit run` (feature 028, FR-011) share one implementation. Lanes are merged one at a time in name
4
+ * order. A `tasks.md` conflict that is only about check-offs is resolved; any other conflict aborts that
5
+ * merge, leaves the lane intact and is reported (FR-012). Git side effects only; no output.
6
+ */
7
+ export type LaneMergeKind = "merged" | "nothing" | "dirty" | "conflict";
8
+ export interface LaneMergeResult {
9
+ lane: string;
10
+ result: LaneMergeKind;
11
+ detail?: string;
12
+ }
13
+ export type MergeLanesOutcome = {
14
+ ok: true;
15
+ lanes: LaneMergeResult[]; /** Lanes asked for that exist; empty means the feature has none. */
16
+ found: number;
17
+ } | {
18
+ ok: false;
19
+ kind: "not-checked-out" | "dirty-checkout" | "no-lane";
20
+ error: string; /** The checkout, for `dirty-checkout`. */
21
+ path?: string;
22
+ };
23
+ /** The feature's branch and (when checked out somewhere) the checkout holding it. */
24
+ export declare function featureBranch(root: string, feature: string): {
25
+ branch: string;
26
+ checkout: string | null;
27
+ } | null;
28
+ /** Merge a feature's lanes (all, or the one `laneArg` names) into its checkout. */
29
+ export declare function mergeLanes(root: string, feature: string, laneArg?: string): MergeLanesOutcome;
@@ -0,0 +1,105 @@
1
+ import { existsSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { branchExists, git, gitWithInput, isDirty, isMerged, worktreeList } from "./git.js";
4
+ import { matchLane, mergeCheckoffs } from "./lanes.js";
5
+ import { findWorktree, laneWorktrees } from "./worktree.js";
6
+ /** The feature's branch and (when checked out somewhere) the checkout holding it. */
7
+ export function featureBranch(root, feature) {
8
+ const worktrees = worktreeList(root);
9
+ const wt = findWorktree(root, feature, worktrees);
10
+ if (wt?.branch)
11
+ return { branch: wt.branch, checkout: wt.path };
12
+ if (!branchExists(root, feature))
13
+ return null;
14
+ const holder = worktrees.find((w) => w.branch === feature);
15
+ return { branch: feature, checkout: holder?.path ?? null };
16
+ }
17
+ function hasMergeHead(cwd) {
18
+ try {
19
+ git(cwd, ["rev-parse", "-q", "--verify", "MERGE_HEAD"]);
20
+ return true;
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ }
26
+ function abortMerge(cwd) {
27
+ try {
28
+ git(cwd, ["merge", "--abort"]);
29
+ }
30
+ catch {
31
+ /* nothing to abort */
32
+ }
33
+ }
34
+ /** Auto-resolve a tasks.md conflict that is only about check-offs. False when it is more than that. */
35
+ function resolveCheckoffs(checkout, tasksRel) {
36
+ const stage = (n) => {
37
+ try {
38
+ return gitWithInput(checkout, ["show", `:${n}:${tasksRel}`], "").toString("utf8");
39
+ }
40
+ catch {
41
+ return "";
42
+ }
43
+ };
44
+ const merged = mergeCheckoffs(stage(1), stage(2), stage(3));
45
+ if (merged === null)
46
+ return false;
47
+ writeFileSync(join(checkout, tasksRel), merged, "utf8");
48
+ git(checkout, ["add", tasksRel]);
49
+ return true;
50
+ }
51
+ /** Merge a feature's lanes (all, or the one `laneArg` names) into its checkout. */
52
+ export function mergeLanes(root, feature, laneArg) {
53
+ const worktrees = worktreeList(root);
54
+ const fb = featureBranch(root, feature);
55
+ if (!fb || !fb.checkout) {
56
+ return { ok: false, kind: "not-checked-out", error: `${feature} is not checked out anywhere — check out its branch (or \`ambykit worktree ${feature}\`) first.` };
57
+ }
58
+ const checkout = fb.checkout;
59
+ if (isDirty(checkout)) {
60
+ return { ok: false, kind: "dirty-checkout", path: checkout, error: `${checkout} has uncommitted changes — commit or stash them before merging lanes.` };
61
+ }
62
+ const all = laneWorktrees(root, worktrees)
63
+ .filter((l) => l.feature === feature)
64
+ .sort((a, b) => a.name.localeCompare(b.name));
65
+ let lanes = all;
66
+ if (laneArg) {
67
+ const name = matchLane(feature, all.map((l) => l.name), laneArg);
68
+ if (!name)
69
+ return { ok: false, kind: "no-lane", error: `No lane '${laneArg}' for ${feature}. Lanes: ${all.map((l) => l.name).join(", ") || "(none)"}` };
70
+ lanes = all.filter((l) => l.name === name);
71
+ }
72
+ const tasksRel = `specs/${feature}/tasks.md`;
73
+ const report = [];
74
+ for (const l of lanes) {
75
+ if (existsSync(l.worktree.path) && isDirty(l.worktree.path)) {
76
+ report.push({ lane: l.name, result: "dirty", detail: "has uncommitted changes — commit first" });
77
+ continue;
78
+ }
79
+ if (isMerged(root, l.name, fb.branch)) {
80
+ report.push({ lane: l.name, result: "nothing" });
81
+ continue;
82
+ }
83
+ try {
84
+ git(checkout, ["merge", "--no-ff", "--no-commit", l.name]);
85
+ }
86
+ catch {
87
+ const unmerged = git(checkout, ["diff", "--name-only", "--diff-filter=U"]).split(/\r?\n/).filter(Boolean);
88
+ const resolved = unmerged.length === 1 && unmerged[0] === tasksRel ? resolveCheckoffs(checkout, tasksRel) : false;
89
+ if (!resolved) {
90
+ abortMerge(checkout);
91
+ report.push({
92
+ lane: l.name,
93
+ result: "conflict",
94
+ detail: unmerged.length > 0 ? `conflicts in ${unmerged.join(", ")} — merge it by hand` : "merge failed",
95
+ });
96
+ continue;
97
+ }
98
+ }
99
+ if (hasMergeHead(checkout))
100
+ git(checkout, ["commit", "-q", "-m", `Merge lane ${l.name}`]);
101
+ report.push({ lane: l.name, result: "merged" });
102
+ }
103
+ return { ok: true, lanes: report, found: lanes.length };
104
+ }
105
+ //# sourceMappingURL=lane-merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lane-merge.js","sourceRoot":"","sources":["../../src/core/lane-merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAqB5D,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,OAAe;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAClD,IAAI,EAAE,EAAE,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,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EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { type RunGate, type RunRecord } from "./fleet/index.js";
2
+ import type { TaskLine } from "./dashboard.js";
3
+ /**
4
+ * Story-checkpoint gates (feature 028, FR-015). 028 is the single gate owner: the gate lives in `run.json`
5
+ * `gates[]` (spec 025's schema), and `approveGate` / `rejectGate` are the one pair of functions that change
6
+ * it. `ambykit run approve|reject`, the foreground prompt and the dashboard (spec 029) all call them; a gate is
7
+ * never a directive. Writes go through 025's `updateRun`.
8
+ */
9
+ export declare const phaseGateId: (phase: number) => string;
10
+ /**
11
+ * The stories a phase's tasks belong to that are now complete (every task of the story, in any phase, is
12
+ * checked). A phase that completes no story has no checkpoint (a setup or polish phase).
13
+ */
14
+ export declare function completedStories(tasks: TaskLine[], phase: number): string[];
15
+ export type GateResult = {
16
+ ok: true;
17
+ run: RunRecord;
18
+ gate: RunGate;
19
+ } | {
20
+ ok: false;
21
+ error: string;
22
+ };
23
+ export declare const pendingGates: (rec: RunRecord) => RunGate[];
24
+ /** Record a checkpoint that waits for a person; the run waits (`waiting-person`) until it is approved. */
25
+ export declare function openGate(root: string, run: string, phase: number, stories: string[]): GateResult;
26
+ export interface GateDecision {
27
+ gate?: string;
28
+ reason?: string;
29
+ by?: string;
30
+ now?: Date;
31
+ }
32
+ /** FR-015: a person approves a checkpoint; the run continues with the next prepared set. */
33
+ export declare function approveGate(root: string, run: string, input?: GateDecision): GateResult;
34
+ /** FR-015: a person rejects a checkpoint; the run pauses with the reason recorded and the gate stays pending. */
35
+ export declare function rejectGate(root: string, run: string, input?: GateDecision): GateResult;
36
+ /** The latest decision recorded for a gate, for the loop and the dashboard. */
37
+ export declare function lastDecision(rec: RunRecord, gateId: string): {
38
+ decision: "approved" | "rejected";
39
+ reason?: string;
40
+ at: string;
41
+ } | null;
42
+ /** FR-009: a person approves moving a lane to another assistant. Recorded in `approvals[]`; the loop acts on it. */
43
+ export declare function approveReassign(root: string, run: string, lane: string, to: string, by?: string, now?: Date): GateResult | {
44
+ ok: true;
45
+ run: RunRecord;
46
+ } | {
47
+ ok: false;
48
+ error: string;
49
+ };
50
+ /** Record that a run needs a person (a conflict, a restart limit, a review that never converged). */
51
+ export declare function escalate(root: string, run: string, record: Record<string, unknown>): void;
@@ -0,0 +1,105 @@
1
+ import { readRun, updateRun } from "./fleet/index.js";
2
+ /**
3
+ * Story-checkpoint gates (feature 028, FR-015). 028 is the single gate owner: the gate lives in `run.json`
4
+ * `gates[]` (spec 025's schema), and `approveGate` / `rejectGate` are the one pair of functions that change
5
+ * it. `ambykit run approve|reject`, the foreground prompt and the dashboard (spec 029) all call them; a gate is
6
+ * never a directive. Writes go through 025's `updateRun`.
7
+ */
8
+ export const phaseGateId = (phase) => `phase-${phase}`;
9
+ /**
10
+ * The stories a phase's tasks belong to that are now complete (every task of the story, in any phase, is
11
+ * checked). A phase that completes no story has no checkpoint (a setup or polish phase).
12
+ */
13
+ export function completedStories(tasks, phase) {
14
+ const inPhase = new Set(tasks.filter((t) => t.phase === phase && t.story).map((t) => t.story));
15
+ const done = [...inPhase].filter((story) => tasks.filter((t) => t.story === story).every((t) => t.done)).sort();
16
+ return done.map((id) => id.replace(/^US(\d+)$/, "US-$1")); // the spec form, `US-1`
17
+ }
18
+ export const pendingGates = (rec) => rec.gates.filter((g) => g.state === "pending");
19
+ /** Record a checkpoint that waits for a person; the run waits (`waiting-person`) until it is approved. */
20
+ export function openGate(root, run, phase, stories) {
21
+ const rec = readRun(root, run);
22
+ if (!rec)
23
+ return { ok: false, error: `run '${run}' not found` };
24
+ const id = phaseGateId(phase);
25
+ const existing = rec.gates.find((g) => g.id === id);
26
+ if (existing)
27
+ return { ok: true, run: rec, gate: existing };
28
+ const gate = { id, after: stories.join(", "), state: "pending" };
29
+ const out = updateRun(root, run, { gates: [...rec.gates, gate], status: "waiting-person", needsDecision: true });
30
+ return out.ok ? { ok: true, run: out.run, gate } : { ok: false, error: out.warning };
31
+ }
32
+ function pick(rec, gateId) {
33
+ const pending = pendingGates(rec);
34
+ if (gateId) {
35
+ const g = rec.gates.find((x) => x.id === gateId);
36
+ return g ?? `run ${rec.run} has no gate '${gateId}'; gates: ${rec.gates.map((x) => x.id).join(", ") || "none"}`;
37
+ }
38
+ if (pending.length === 1)
39
+ return pending[0];
40
+ if (pending.length === 0)
41
+ return `run ${rec.run} has no gate waiting for approval`;
42
+ return `run ${rec.run} has several gates waiting (${pending.map((g) => g.id).join(", ")}); name one with --gate=<id>`;
43
+ }
44
+ /** FR-015: a person approves a checkpoint; the run continues with the next prepared set. */
45
+ export function approveGate(root, run, input = {}) {
46
+ const rec = readRun(root, run);
47
+ if (!rec)
48
+ return { ok: false, error: `run '${run}' not found` };
49
+ const g = pick(rec, input.gate);
50
+ if (typeof g === "string")
51
+ return { ok: false, error: g };
52
+ const at = (input.now ?? new Date()).toISOString();
53
+ const gates = rec.gates.map((x) => (x.id === g.id ? { ...x, state: "approved" } : x));
54
+ const approvals = [...rec.approvals, { kind: "gate", gate: g.id, decision: "approved", at, ...(input.by ? { by: input.by } : {}), ...(input.reason ? { reason: input.reason } : {}) }];
55
+ const stillWaiting = gates.some((x) => x.state === "pending");
56
+ const patch = { gates, approvals };
57
+ if (!stillWaiting && (rec.status === "waiting-person" || rec.status === "paused")) {
58
+ patch.status = "active";
59
+ patch.needsDecision = false;
60
+ }
61
+ const out = updateRun(root, run, patch);
62
+ return out.ok ? { ok: true, run: out.run, gate: { ...g, state: "approved" } } : { ok: false, error: out.warning };
63
+ }
64
+ /** FR-015: a person rejects a checkpoint; the run pauses with the reason recorded and the gate stays pending. */
65
+ export function rejectGate(root, run, input = {}) {
66
+ const rec = readRun(root, run);
67
+ if (!rec)
68
+ return { ok: false, error: `run '${run}' not found` };
69
+ const g = pick(rec, input.gate);
70
+ if (typeof g === "string")
71
+ return { ok: false, error: g };
72
+ const at = (input.now ?? new Date()).toISOString();
73
+ const approvals = [...rec.approvals, { kind: "gate", gate: g.id, decision: "rejected", at, ...(input.by ? { by: input.by } : {}), ...(input.reason ? { reason: input.reason } : {}) }];
74
+ const out = updateRun(root, run, { approvals, status: "paused", needsDecision: true });
75
+ return out.ok ? { ok: true, run: out.run, gate: g } : { ok: false, error: out.warning };
76
+ }
77
+ /** The latest decision recorded for a gate, for the loop and the dashboard. */
78
+ export function lastDecision(rec, gateId) {
79
+ for (let i = rec.approvals.length - 1; i >= 0; i--) {
80
+ const a = rec.approvals[i];
81
+ if (a && a.kind === "gate" && a.gate === gateId && a.decision && a.at)
82
+ return { decision: a.decision, ...(a.reason ? { reason: a.reason } : {}), at: a.at };
83
+ }
84
+ return null;
85
+ }
86
+ /** FR-009: a person approves moving a lane to another assistant. Recorded in `approvals[]`; the loop acts on it. */
87
+ export function approveReassign(root, run, lane, to, by = "person", now = new Date()) {
88
+ const rec = readRun(root, run);
89
+ if (!rec)
90
+ return { ok: false, error: `run '${run}' not found` };
91
+ const short = lane.slice(lane.lastIndexOf(".lane-") + 1).replace(/^(\d)/, "lane-$1");
92
+ const known = rec.lanes.find((l) => l.lane.slice(l.lane.lastIndexOf(".lane-") + 1) === short);
93
+ if (!known)
94
+ return { ok: false, error: `run ${run} has no lane '${lane}'; lanes: ${rec.lanes.map((l) => l.lane.slice(l.lane.lastIndexOf(".lane-") + 1)).join(", ") || "none"}` };
95
+ const out = updateRun(root, run, { approvals: [...rec.approvals, { kind: "reassign", lane: short, to, by, at: now.toISOString() }] });
96
+ return out.ok ? { ok: true, run: out.run } : { ok: false, error: out.warning };
97
+ }
98
+ /** Record that a run needs a person (a conflict, a restart limit, a review that never converged). */
99
+ export function escalate(root, run, record) {
100
+ const rec = readRun(root, run);
101
+ if (!rec)
102
+ return;
103
+ updateRun(root, run, { escalations: [...rec.escalations, { ...record, at: new Date().toISOString() }], status: "waiting-person", needsDecision: true });
104
+ }
105
+ //# sourceMappingURL=run-gate-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-gate-actions.js","sourceRoot":"","sources":["../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CAAC;AACjF,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAW,EAAE,MAA+B;IACjF,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1J,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { type RunnerSpec } from "./runners.js";
2
+ /**
3
+ * The launch plan (feature 028, FR-001..FR-004, FR-006): lanes + their assistant + their prompt file → the
4
+ * exact command per lane. Pure: it decides and formats, it starts nothing. A lane whose assistant has no
5
+ * verified runner is `refused` with the reason, and the same plan feeds the preview, `--emit-script` and the
6
+ * launch, so what is printed is exactly what runs.
7
+ */
8
+ export interface LaunchLane {
9
+ /** Short lane name `lane-p-k`. */
10
+ lane: string;
11
+ /** Full lane name `NNN-slug.lane-p-k`. */
12
+ full: string;
13
+ /** The lane's worktree. */
14
+ cwd: string;
15
+ assistant: string;
16
+ /** The prompt text; the plan only names where it is stored. */
17
+ prompt: string;
18
+ }
19
+ export interface LaunchEntry {
20
+ lane: string;
21
+ full: string;
22
+ assistant: string;
23
+ cwd: string;
24
+ promptFile: string;
25
+ prompt: string;
26
+ /** Absent when refused. */
27
+ command?: {
28
+ exe: string;
29
+ args: string[];
30
+ stdin?: string;
31
+ };
32
+ /** The command as a person would type it, redirecting the prompt file where the runner reads stdin. */
33
+ display: string;
34
+ /** Why this lane will not run; set exactly when `command` is absent. */
35
+ refused?: string;
36
+ }
37
+ export interface LaunchPlanOptions {
38
+ /** Where a lane's prompt file lives (relative or absolute path as printed). */
39
+ promptFileFor(lane: string): string;
40
+ registry?: RunnerSpec[];
41
+ model?: string;
42
+ }
43
+ export declare function launchPlan(lanes: LaunchLane[], opts: LaunchPlanOptions): LaunchEntry[];
44
+ /** Lanes the plan refuses, with the reason each. */
45
+ export declare function refusals(plan: LaunchEntry[]): {
46
+ lane: string;
47
+ assistant: string;
48
+ reason: string;
49
+ }[];
50
+ /** Spread lanes over assistants round-robin, so two lanes and two assistants run on two different assistants. */
51
+ export declare function assignAssistants(lanes: string[], assistants: string[]): Map<string, string>;
@@ -0,0 +1,27 @@
1
+ import { RUNNERS, runnable } from "./runners.js";
2
+ const quote = (a) => (/^[A-Za-z0-9_@%+=:,./\\-]+$/.test(a) ? a : `"${a.replace(/"/g, '\\"')}"`);
3
+ export function launchPlan(lanes, opts) {
4
+ const registry = opts.registry ?? RUNNERS;
5
+ return lanes.map((l) => {
6
+ const promptFile = opts.promptFileFor(l.lane);
7
+ const base = { lane: l.lane, full: l.full, assistant: l.assistant, cwd: l.cwd, promptFile, prompt: l.prompt };
8
+ const can = runnable(l.assistant, registry);
9
+ if (!can.ok)
10
+ return { ...base, display: `# ${l.lane} (${l.assistant}): REFUSED — ${can.reason}`, refused: can.reason };
11
+ const command = can.runner.invoke({ prompt: l.prompt, promptFile, ...(opts.model ? { model: opts.model } : {}) });
12
+ const text = [command.exe, ...command.args].map(quote).join(" ");
13
+ const display = `cd ${quote(l.cwd)} && ${text}${command.stdin !== undefined ? ` < ${quote(promptFile)}` : ""}`;
14
+ return { ...base, command, display };
15
+ });
16
+ }
17
+ /** Lanes the plan refuses, with the reason each. */
18
+ export function refusals(plan) {
19
+ return plan.flatMap((e) => (e.refused ? [{ lane: e.lane, assistant: e.assistant, reason: e.refused }] : []));
20
+ }
21
+ /** Spread lanes over assistants round-robin, so two lanes and two assistants run on two different assistants. */
22
+ export function assignAssistants(lanes, assistants) {
23
+ const out = new Map();
24
+ lanes.forEach((lane, i) => out.set(lane, assistants[i % assistants.length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CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC;IAC9E,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Prompts for headless jobs (feature 028, FR-004, Principle 3). A lane's prompt carries only what the
3
+ * assistant cannot get cheaper elsewhere: its task IDs, the artifacts by `@path` reference, and the files it
4
+ * owns. Task text, the spec and the plan are never copied in: the assistant reads them by reference.
5
+ */
6
+ export interface PromptLane {
7
+ feature: string;
8
+ /** Full lane name `NNN-slug.lane-p-k`. */
9
+ lane: string;
10
+ phase: number;
11
+ tasks: {
12
+ id: string;
13
+ paths: string[];
14
+ }[];
15
+ }
16
+ export interface LanePromptOptions {
17
+ /** Run id, so reports and directives name it. */
18
+ run: string;
19
+ /** `@` reference targets that exist, relative to the lane checkout (spec, plan, tasks, tests). */
20
+ artifacts: string[];
21
+ /** Task IDs still unchecked; checked ones are not listed (a restart repeats no completed task). */
22
+ open?: string[];
23
+ /** Review finding IDs returned to the worker; when present the prompt is a fix round, not a build. */
24
+ findings?: string[];
25
+ /** The protocol wording shared with spec 019's worker persona (reporting cadence and directive text). */
26
+ protocol?: string;
27
+ }
28
+ export declare const shortName: (lane: string) => string;
29
+ export declare function buildLanePrompt(lane: PromptLane, opts: LanePromptOptions): string;
30
+ export type ReviewRole = "qa" | "architect";
31
+ export interface RolePromptInput {
32
+ role: ReviewRole;
33
+ feature: string;
34
+ lane: string;
35
+ phase: number;
36
+ round: number;
37
+ run: string;
38
+ /** The role file by reference, e.g. `.amby/roles/qa.md`. */
39
+ roleFile: string;
40
+ /** The phase's `**Verify:**` line, verbatim; absent when the phase has none. */
41
+ verify?: string;
42
+ artifacts: string[];
43
+ /** The verdict file the role writes, relative to the run directory. */
44
+ verdictFile: string;
45
+ }
46
+ /** QA and architect jobs: the role by `@` reference, the phase's Verify line, and where to write the verdict. */
47
+ export declare function buildRolePrompt(input: RolePromptInput): string;