@ambystech/ambykit 1.3.0 → 1.3.1
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/CHANGELOG.md +30 -0
- package/README.md +8 -4
- package/dist/cli/analyze.d.ts +1 -1
- package/dist/cli/analyze.js +18 -5
- package/dist/cli/analyze.js.map +1 -1
- package/dist/cli/base-command.js +6 -0
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/check.js +19 -1
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/io/fsops.d.ts +5 -0
- package/dist/cli/io/fsops.js +8 -1
- package/dist/cli/io/fsops.js.map +1 -1
- package/dist/cli/lane.d.ts +20 -0
- package/dist/cli/lane.js +396 -0
- package/dist/cli/lane.js.map +1 -0
- package/dist/cli/sync.d.ts +7 -1
- package/dist/cli/sync.js +30 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/ui/dashboard/live-tokens.d.ts +221 -0
- package/dist/cli/ui/dashboard/live-tokens.js +221 -0
- package/dist/cli/ui/dashboard/live-tokens.js.map +1 -1
- package/dist/cli/ui/dashboard/worktrees-panel.js +21 -3
- package/dist/cli/ui/dashboard/worktrees-panel.js.map +1 -1
- package/dist/cli/ui/interactive/live.js +3 -0
- package/dist/cli/ui/interactive/live.js.map +1 -1
- package/dist/cli/ui/interactive/prompt.d.ts +17 -2
- package/dist/cli/ui/interactive/prompt.js +39 -9
- package/dist/cli/ui/interactive/prompt.js.map +1 -1
- package/dist/core/activity.d.ts +4 -0
- package/dist/core/activity.js +4 -3
- package/dist/core/activity.js.map +1 -1
- package/dist/core/agents.d.ts +1 -1
- package/dist/core/agents.js +9 -0
- package/dist/core/agents.js.map +1 -1
- package/dist/core/analyze.d.ts +6 -0
- package/dist/core/analyze.js +11 -2
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/checkouts.d.ts +11 -0
- package/dist/core/checkouts.js +82 -10
- package/dist/core/checkouts.js.map +1 -1
- package/dist/core/dashboard.d.ts +13 -0
- package/dist/core/dashboard.js +26 -0
- package/dist/core/dashboard.js.map +1 -1
- package/dist/core/emit.d.ts +5 -0
- package/dist/core/emit.js +46 -1
- package/dist/core/emit.js.map +1 -1
- package/dist/core/lanes.d.ts +116 -0
- package/dist/core/lanes.js +225 -0
- package/dist/core/lanes.js.map +1 -0
- package/dist/core/legacy.d.ts +10 -0
- package/dist/core/legacy.js +35 -0
- package/dist/core/legacy.js.map +1 -0
- package/dist/core/overview-types.d.ts +15 -1
- package/dist/core/overview.js +2 -0
- package/dist/core/overview.js.map +1 -1
- package/dist/core/rules.js +2 -2
- package/dist/core/types.d.ts +5 -0
- package/dist/core/worktree.d.ts +8 -0
- package/dist/core/worktree.js +19 -1
- package/dist/core/worktree.js.map +1 -1
- package/dist/emitters/antigravity-cli.d.ts +3 -2
- package/dist/emitters/antigravity-cli.js +3 -2
- package/dist/emitters/antigravity-cli.js.map +1 -1
- package/dist/emitters/antigravity.d.ts +8 -9
- package/dist/emitters/antigravity.js +9 -11
- package/dist/emitters/antigravity.js.map +1 -1
- package/dist/emitters/augment.d.ts +14 -0
- package/dist/emitters/augment.js +20 -0
- package/dist/emitters/augment.js.map +1 -0
- package/dist/emitters/base-emitter.d.ts +6 -0
- package/dist/emitters/base-emitter.js +9 -2
- package/dist/emitters/base-emitter.js.map +1 -1
- package/dist/emitters/codex.d.ts +2 -9
- package/dist/emitters/codex.js +2 -19
- package/dist/emitters/codex.js.map +1 -1
- package/dist/emitters/copilot-cli.d.ts +0 -2
- package/dist/emitters/copilot-cli.js +4 -9
- package/dist/emitters/copilot-cli.js.map +1 -1
- package/dist/emitters/gemini.d.ts +14 -0
- package/dist/emitters/gemini.js +19 -0
- package/dist/emitters/gemini.js.map +1 -0
- package/dist/emitters/index.d.ts +19 -0
- package/dist/emitters/index.js +51 -0
- package/dist/emitters/index.js.map +1 -1
- package/dist/emitters/kilo.d.ts +14 -0
- package/dist/emitters/kilo.js +17 -0
- package/dist/emitters/kilo.js.map +1 -0
- package/dist/emitters/kiro.d.ts +12 -0
- package/dist/emitters/kiro.js +14 -0
- package/dist/emitters/kiro.js.map +1 -0
- package/dist/emitters/llxprt.d.ts +13 -0
- package/dist/emitters/llxprt.js +18 -0
- package/dist/emitters/llxprt.js.map +1 -0
- package/dist/emitters/qwen.d.ts +15 -0
- package/dist/emitters/qwen.js +23 -0
- package/dist/emitters/qwen.js.map +1 -0
- package/dist/emitters/skills-emitter.d.ts +21 -0
- package/dist/emitters/skills-emitter.js +39 -0
- package/dist/emitters/skills-emitter.js.map +1 -0
- package/dist/emitters/toml-command-emitter.d.ts +29 -0
- package/dist/emitters/toml-command-emitter.js +69 -0
- package/dist/emitters/toml-command-emitter.js.map +1 -0
- package/dist/emitters/windsurf.d.ts +16 -0
- package/dist/emitters/windsurf.js +21 -0
- package/dist/emitters/windsurf.js.map +1 -0
- package/docs/architecture.md +1 -1
- package/docs/cli-reference.md +46 -2
- package/docs/index.md +1 -1
- package/docs/tool-compatibility.md +101 -12
- package/docs/workflow.md +29 -0
- package/package.json +1 -1
- package/src/prompts/implement.md +2 -1
- package/src/prompts/tasks.md +3 -1
- package/src/templates/tasks.md +2 -1
package/dist/core/dashboard.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { normalizePath } from "./lanes.js";
|
|
3
4
|
/** Short, unique reference for a feature dir: its leading number (e.g. "001"), else the full name. */
|
|
4
5
|
export function featureRefOf(feature) {
|
|
5
6
|
const m = /^(\d+)/.exec(feature);
|
|
@@ -13,6 +14,19 @@ export function storyKey(featureRef, localId) {
|
|
|
13
14
|
export function displayKey(s) {
|
|
14
15
|
return `${s.featureRef}:${s.displayId}`;
|
|
15
16
|
}
|
|
17
|
+
const GLOB_CHARS = /[*?[\]{}]/;
|
|
18
|
+
/** Paths from the trailing parenthesized group of a task line (feature 015 FR-001/002/016). */
|
|
19
|
+
export function parseDeclaredPaths(rest) {
|
|
20
|
+
const group = /\(([^()]*)\)\s*$/.exec(rest);
|
|
21
|
+
const items = (group?.[1] ?? "")
|
|
22
|
+
.split(",")
|
|
23
|
+
.map((x) => x.replace(/`/g, "").trim())
|
|
24
|
+
.filter((x) => x.length > 0 && !/\s/.test(x) && /[/.]/.test(x));
|
|
25
|
+
if (items.some((x) => GLOB_CHARS.test(x)))
|
|
26
|
+
return { paths: [], pathIssue: "glob" };
|
|
27
|
+
const paths = Array.from(new Set(items.map(normalizePath).filter((x) => x.length > 0)));
|
|
28
|
+
return paths.length > 0 ? { paths } : { paths: [], pathIssue: "missing" };
|
|
29
|
+
}
|
|
16
30
|
/** Canonicalize a story id like "US-1"/"US1"/"us 1" → "US1". */
|
|
17
31
|
export function canonicalStoryId(raw) {
|
|
18
32
|
return raw.toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
@@ -87,7 +101,16 @@ export function parseTasks(content) {
|
|
|
87
101
|
const lines = content.split(/\r?\n/);
|
|
88
102
|
const tasks = [];
|
|
89
103
|
const taskRe = /^\s*-\s*\[([ xX])\]\s*\[(T\d+)\]\s*(.*)$/;
|
|
104
|
+
let phase = 0;
|
|
105
|
+
let headings = 0;
|
|
90
106
|
for (const line of lines) {
|
|
107
|
+
const h = /^##\s+(.*)$/.exec(line);
|
|
108
|
+
if (h) {
|
|
109
|
+
headings += 1;
|
|
110
|
+
const n = /^Phase\s+(\d+)/i.exec(h[1] ?? "");
|
|
111
|
+
phase = n ? Number(n[1]) : headings;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
91
114
|
const m = taskRe.exec(line);
|
|
92
115
|
if (!m)
|
|
93
116
|
continue;
|
|
@@ -100,6 +123,9 @@ export function parseTasks(content) {
|
|
|
100
123
|
done,
|
|
101
124
|
story: storyTag ? canonicalStoryId(storyTag[1] ?? "") : null,
|
|
102
125
|
description: rest.replace(/^\s*(\[P\]\s*)?(\[US-?\d+\]\s*)?/i, "").trim(),
|
|
126
|
+
phase,
|
|
127
|
+
parallel: /^\s*\[P\]|\]\s*\[P\]/i.test(rest),
|
|
128
|
+
...parseDeclaredPaths(rest),
|
|
103
129
|
});
|
|
104
130
|
}
|
|
105
131
|
return tasks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/core/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/core/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAkB3C,sGAAsG;AACtG,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CAAC,UAAkB,EAAE,OAAe;IAC1D,OAAO,GAAG,UAAU,IAAI,OAAO,EAAE,CAAC;AACpC,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,UAAU,CAAC,CAAgB;IACzC,OAAO,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC;AAkBD,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,+FAA+F;AAC/F,MAAM,UAAU,kBA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U,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAAE,SAAS;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACzC,IAAI,IAAI,KAAK,IAAI;YAAE,SAAS;QAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1F,UAAU,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/core/emit.d.ts
CHANGED
|
@@ -5,3 +5,8 @@ import type { AmbyConfig, EmittedFile } from "./types.js";
|
|
|
5
5
|
* CLAUDE.md bridge). When `manageRules` is false, only command files are produced.
|
|
6
6
|
*/
|
|
7
7
|
export declare function buildEmittedFiles(projectRoot: string, config: AmbyConfig): EmittedFile[];
|
|
8
|
+
/**
|
|
9
|
+
* Which tool's `--agent=<id>` a shared file carries when targets differ only in that id (feature 018,
|
|
10
|
+
* FR-010). Earlier = wins. Codex stays byte-identical, and the Antigravity IDE beats its CLI.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SELF_REPORT_PRIORITY: readonly ["codex", "antigravity", "antigravity-cli"];
|
package/dist/core/emit.js
CHANGED
|
@@ -22,9 +22,54 @@ export function buildEmittedFiles(projectRoot, config) {
|
|
|
22
22
|
merge: "region", // preserve any user-authored AGENTS.md content (feature 008 / FR-001)
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
// Two targets can write one path (FR-007). Identical bytes are written once. Bytes that differ only
|
|
26
|
+
// in the `--agent=<id>` self-report (Antigravity IDE and CLI share `.agents/workflows/`) keep the
|
|
27
|
+
// long-standing behavior, where the later target in config order wins. Any other difference is a
|
|
28
|
+
// real conflict and fails loudly, naming both tools.
|
|
29
|
+
const owners = new Map();
|
|
30
|
+
files.forEach((f, index) => owners.set(f.path, { owner: "rules", index }));
|
|
25
31
|
for (const emitter of emittersForTargets(config.tools)) {
|
|
26
|
-
|
|
32
|
+
for (const file of emitter.emit(specs, ctx)) {
|
|
33
|
+
const seen = owners.get(file.path);
|
|
34
|
+
if (!seen) {
|
|
35
|
+
owners.set(file.path, { owner: emitter.toolId, index: files.length });
|
|
36
|
+
files.push(file);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const earlier = files[seen.index];
|
|
40
|
+
if (sameOutput(earlier, file))
|
|
41
|
+
continue;
|
|
42
|
+
if (sameOutput(earlier, file, [seen.owner, emitter.toolId])) {
|
|
43
|
+
// Only the self-report id differs: keep the higher-ranked tool's file, whatever the config
|
|
44
|
+
// order (feature 018, FR-010). Unranked ids keep the long-standing "later wins".
|
|
45
|
+
if (selfReportRank(emitter.toolId) <= selfReportRank(seen.owner)) {
|
|
46
|
+
files[seen.index] = file;
|
|
47
|
+
owners.set(file.path, { owner: emitter.toolId, index: seen.index });
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Output collision at ${file.path}: '${seen.owner}' and '${emitter.toolId}' emit different contents.`);
|
|
52
|
+
}
|
|
27
53
|
}
|
|
28
54
|
return files;
|
|
29
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Which tool's `--agent=<id>` a shared file carries when targets differ only in that id (feature 018,
|
|
58
|
+
* FR-010). Earlier = wins. Codex stays byte-identical, and the Antigravity IDE beats its CLI.
|
|
59
|
+
*/
|
|
60
|
+
export const SELF_REPORT_PRIORITY = ["codex", "antigravity", "antigravity-cli"];
|
|
61
|
+
function selfReportRank(toolId) {
|
|
62
|
+
const i = SELF_REPORT_PRIORITY.indexOf(toolId);
|
|
63
|
+
return i < 0 ? Number.MAX_SAFE_INTEGER : i;
|
|
64
|
+
}
|
|
65
|
+
/** Same file, byte for byte; with `ids`, ignoring the `--agent=<id>` self-report of those two tools. */
|
|
66
|
+
function sameOutput(a, b, ids) {
|
|
67
|
+
if (a.scope !== b.scope || a.merge !== b.merge || a.requiredPrefix !== b.requiredPrefix)
|
|
68
|
+
return false;
|
|
69
|
+
if (!ids)
|
|
70
|
+
return a.contents === b.contents;
|
|
71
|
+
const longestFirst = [...ids].sort((x, y) => y.length - x.length); // `antigravity-cli` before `antigravity`
|
|
72
|
+
const strip = (text) => longestFirst.reduce((t, id) => t.replaceAll(`--agent=${id}`, "--agent=@"), text);
|
|
73
|
+
return strip(a.contents) === strip(b.contents);
|
|
74
|
+
}
|
|
30
75
|
//# sourceMappingURL=emit.js.map
|
package/dist/core/emit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/core/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,MAAkB;IACvE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,KAAK,KAAK,CAAC;IACjD,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC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,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC;IAC3C,MAAM,YAAY,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,yCAAyC;IAC5G,MAAM,KAAK,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;IACzH,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { TaskLine } from "./dashboard.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lane analysis (feature 015) — decisions as pure functions over parsed `tasks.md`. No git, no
|
|
4
|
+
* model tokens (FR-013); worktree side effects live in `cli/lane.ts`. Only the manifest helpers at
|
|
5
|
+
* the bottom touch the filesystem.
|
|
6
|
+
*/
|
|
7
|
+
/** Normalize a declared path: `\` → `/`, collapse `//`, drop leading `./` and trailing `/`, lower-case. */
|
|
8
|
+
export declare function normalizePath(raw: string): string;
|
|
9
|
+
/** Two normalized paths overlap when equal or one is a `/`-prefix of the other (FR-005). */
|
|
10
|
+
export declare function overlaps(a: string, b: string): boolean;
|
|
11
|
+
/** Lane `k` of phase `p` for feature `NNN-slug` → `NNN-slug.lane-p-k` (directory and branch). */
|
|
12
|
+
export declare function laneName(feature: string, phase: number, index: number): string;
|
|
13
|
+
/** Inverse of `laneName`; null when `name` is not a lane name. */
|
|
14
|
+
export declare function parseLaneName(name: string): {
|
|
15
|
+
feature: string;
|
|
16
|
+
phase: number;
|
|
17
|
+
index: number;
|
|
18
|
+
} | null;
|
|
19
|
+
export interface Declaration {
|
|
20
|
+
feature: string;
|
|
21
|
+
task: string;
|
|
22
|
+
issue: "missing" | "glob";
|
|
23
|
+
}
|
|
24
|
+
export interface LaneConflict {
|
|
25
|
+
feature: string;
|
|
26
|
+
phase: number;
|
|
27
|
+
/** The shortest overlapping path. */
|
|
28
|
+
path: string;
|
|
29
|
+
/** Sorted task ids (≥ 2, at least one `[P]`). */
|
|
30
|
+
tasks: string[];
|
|
31
|
+
}
|
|
32
|
+
/** Open tasks that declare no usable path, or declare a glob (FR-002/015/016). A warning, never an error. */
|
|
33
|
+
export declare function declarations(feature: string, tasks: TaskLine[]): Declaration[];
|
|
34
|
+
/**
|
|
35
|
+
* Conflicts among open tasks of the same phase where at least one of the pair is `[P]`
|
|
36
|
+
* (FR-004/005/006/015). Findings are grouped per overlapping path: a path claimed by N tasks is one
|
|
37
|
+
* finding listing all N ids.
|
|
38
|
+
*/
|
|
39
|
+
export declare function laneConflicts(feature: string, tasks: TaskLine[]): LaneConflict[];
|
|
40
|
+
/** One-line human message for a conflict, ending with the fix. */
|
|
41
|
+
export declare function describeConflict(c: LaneConflict): string;
|
|
42
|
+
export interface PlannedLane {
|
|
43
|
+
name: string;
|
|
44
|
+
index: number;
|
|
45
|
+
tasks: {
|
|
46
|
+
id: string;
|
|
47
|
+
paths: string[];
|
|
48
|
+
}[];
|
|
49
|
+
}
|
|
50
|
+
export interface LanePlan {
|
|
51
|
+
feature: string;
|
|
52
|
+
phase: number;
|
|
53
|
+
status: "planned" | "complete" | "conflict" | "no-parallel";
|
|
54
|
+
lanes: PlannedLane[];
|
|
55
|
+
/** Open non-`[P]` task ids of the phase — they stay in the feature checkout. */
|
|
56
|
+
stays: string[];
|
|
57
|
+
conflicts: LaneConflict[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Deal a phase's open `[P]` tasks round-robin into `min(lanes, count)` lanes (FR-008/017). Refuses
|
|
61
|
+
* (`conflict`) when the phase has path conflicts (FR-009). `phase` defaults to the first phase with
|
|
62
|
+
* open `[P]` tasks; `lanes` defaults to 2.
|
|
63
|
+
*/
|
|
64
|
+
export declare function planLanes(feature: string, tasks: TaskLine[], opts?: {
|
|
65
|
+
phase?: number;
|
|
66
|
+
lanes?: number;
|
|
67
|
+
}): LanePlan;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve a `tasks.md` conflict that is only about check-offs (FR-019): returns `ours` with every
|
|
70
|
+
* task ticked that either side ticked, preserving ours' line endings. Returns null when `ours` and
|
|
71
|
+
* `theirs` differ in anything but checkbox state (the caller then aborts the merge). `base` is
|
|
72
|
+
* accepted for the 3-way call shape; the union rule does not need it.
|
|
73
|
+
*/
|
|
74
|
+
export declare function mergeCheckoffs(_base: string, ours: string, theirs: string): string | null;
|
|
75
|
+
export interface LaneManifest {
|
|
76
|
+
version: 1;
|
|
77
|
+
feature: string;
|
|
78
|
+
phase: number;
|
|
79
|
+
lane: string;
|
|
80
|
+
/** The feature branch the lane was created from. */
|
|
81
|
+
base: string;
|
|
82
|
+
/** Feature-branch commit the lane started at; a lane still at this commit has no work to merge. */
|
|
83
|
+
baseHead?: string;
|
|
84
|
+
tasks: {
|
|
85
|
+
id: string;
|
|
86
|
+
paths: string[];
|
|
87
|
+
}[];
|
|
88
|
+
}
|
|
89
|
+
/** `<lane checkout>/.amby/lane/lane.json` — in a self-ignoring directory. */
|
|
90
|
+
export declare function manifestPath(laneRoot: string): string;
|
|
91
|
+
export declare function writeManifest(laneRoot: string, manifest: LaneManifest): void;
|
|
92
|
+
/** Read a lane's manifest; null when absent or malformed. */
|
|
93
|
+
export declare function readManifest(laneRoot: string): LaneManifest | null;
|
|
94
|
+
/** Manifest ids that are missing from the feature's current tasks, or whose paths changed (FR-020). */
|
|
95
|
+
export declare function manifestDrift(manifest: LaneManifest, current: TaskLine[]): string[];
|
|
96
|
+
/**
|
|
97
|
+
* clean / dirty / merged for a lane (FR-010). `merged` needs the lane to have moved past where it
|
|
98
|
+
* started — a fresh lane is trivially an ancestor of its feature branch but has nothing to merge.
|
|
99
|
+
*/
|
|
100
|
+
export declare function laneState(input: {
|
|
101
|
+
dirty: boolean;
|
|
102
|
+
tip: string;
|
|
103
|
+
baseHead?: string;
|
|
104
|
+
mergedIntoFeature: boolean;
|
|
105
|
+
}): "clean" | "dirty" | "merged";
|
|
106
|
+
/** Resolve `p-k`, `lane-p-k` or a full lane name against a feature's lane names; null when ambiguous/unknown. */
|
|
107
|
+
export declare function matchLane(feature: string, names: string[], arg: string): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Feature progress with lane work folded in (decision D5): a task counts done when it is checked in
|
|
110
|
+
* the feature's `tasks.md` or in the lane that owns it, so progress moves before lanes are merged.
|
|
111
|
+
* Returns new task objects; the input is untouched.
|
|
112
|
+
*/
|
|
113
|
+
export declare function unionLaneDone(tasks: TaskLine[], lanes: {
|
|
114
|
+
ids: string[];
|
|
115
|
+
tasks: TaskLine[];
|
|
116
|
+
}[]): TaskLine[];
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Lane analysis (feature 015) — decisions as pure functions over parsed `tasks.md`. No git, no
|
|
5
|
+
* model tokens (FR-013); worktree side effects live in `cli/lane.ts`. Only the manifest helpers at
|
|
6
|
+
* the bottom touch the filesystem.
|
|
7
|
+
*/
|
|
8
|
+
/** Normalize a declared path: `\` → `/`, collapse `//`, drop leading `./` and trailing `/`, lower-case. */
|
|
9
|
+
export function normalizePath(raw) {
|
|
10
|
+
return raw
|
|
11
|
+
.trim()
|
|
12
|
+
.replace(/[\\]/g, "/")
|
|
13
|
+
.replace(/\/{2,}/g, "/")
|
|
14
|
+
.replace(/^(\.\/)+/, "")
|
|
15
|
+
.replace(/\/+$/, "")
|
|
16
|
+
.toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
/** Two normalized paths overlap when equal or one is a `/`-prefix of the other (FR-005). */
|
|
19
|
+
export function overlaps(a, b) {
|
|
20
|
+
return a === b || b.startsWith(`${a}/`) || a.startsWith(`${b}/`);
|
|
21
|
+
}
|
|
22
|
+
/** Lane `k` of phase `p` for feature `NNN-slug` → `NNN-slug.lane-p-k` (directory and branch). */
|
|
23
|
+
export function laneName(feature, phase, index) {
|
|
24
|
+
return `${feature}.lane-${phase}-${index}`;
|
|
25
|
+
}
|
|
26
|
+
const LANE_NAME = /^(\d{3}-[a-z0-9][a-z0-9-]*)\.lane-(\d+)-(\d+)$/;
|
|
27
|
+
/** Inverse of `laneName`; null when `name` is not a lane name. */
|
|
28
|
+
export function parseLaneName(name) {
|
|
29
|
+
const m = LANE_NAME.exec(name);
|
|
30
|
+
if (!m)
|
|
31
|
+
return null;
|
|
32
|
+
return { feature: m[1] ?? "", phase: Number(m[2]), index: Number(m[3]) };
|
|
33
|
+
}
|
|
34
|
+
/** Open tasks that declare no usable path, or declare a glob (FR-002/015/016). A warning, never an error. */
|
|
35
|
+
export function declarations(feature, tasks) {
|
|
36
|
+
return tasks
|
|
37
|
+
.filter((t) => !t.done && t.pathIssue !== undefined)
|
|
38
|
+
.map((t) => ({ feature, task: t.id, issue: t.pathIssue }));
|
|
39
|
+
}
|
|
40
|
+
/** The shortest overlapping path between two tasks' declarations, or null when they are disjoint. */
|
|
41
|
+
function sharedPath(a, b) {
|
|
42
|
+
let best = null;
|
|
43
|
+
for (const pa of a.paths) {
|
|
44
|
+
for (const pb of b.paths) {
|
|
45
|
+
if (!overlaps(pa, pb))
|
|
46
|
+
continue;
|
|
47
|
+
const shorter = pa.length <= pb.length ? pa : pb;
|
|
48
|
+
if (best === null || shorter.length < best.length || (shorter.length === best.length && shorter < best)) {
|
|
49
|
+
best = shorter;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return best;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Conflicts among open tasks of the same phase where at least one of the pair is `[P]`
|
|
57
|
+
* (FR-004/005/006/015). Findings are grouped per overlapping path: a path claimed by N tasks is one
|
|
58
|
+
* finding listing all N ids.
|
|
59
|
+
*/
|
|
60
|
+
export function laneConflicts(feature, tasks) {
|
|
61
|
+
const byPhase = new Map();
|
|
62
|
+
for (const t of tasks) {
|
|
63
|
+
if (t.done || t.paths.length === 0)
|
|
64
|
+
continue;
|
|
65
|
+
const list = byPhase.get(t.phase);
|
|
66
|
+
if (list)
|
|
67
|
+
list.push(t);
|
|
68
|
+
else
|
|
69
|
+
byPhase.set(t.phase, [t]);
|
|
70
|
+
}
|
|
71
|
+
const out = [];
|
|
72
|
+
for (const [phase, list] of [...byPhase].sort((x, y) => x[0] - y[0])) {
|
|
73
|
+
const byPath = new Map();
|
|
74
|
+
for (let i = 0; i < list.length; i++) {
|
|
75
|
+
const a = list[i];
|
|
76
|
+
for (let j = i + 1; j < list.length; j++) {
|
|
77
|
+
const b = list[j];
|
|
78
|
+
if (!a.parallel && !b.parallel)
|
|
79
|
+
continue;
|
|
80
|
+
const path = sharedPath(a, b);
|
|
81
|
+
if (path === null)
|
|
82
|
+
continue;
|
|
83
|
+
const ids = byPath.get(path) ?? new Set();
|
|
84
|
+
ids.add(a.id).add(b.id);
|
|
85
|
+
byPath.set(path, ids);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const [path, ids] of [...byPath].sort((x, y) => (x[0] < y[0] ? -1 : 1))) {
|
|
89
|
+
out.push({ feature, phase, path, tasks: [...ids].sort() });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/** One-line human message for a conflict, ending with the fix. */
|
|
95
|
+
export function describeConflict(c) {
|
|
96
|
+
return (`${c.feature} phase ${c.phase}: ${c.tasks.join(", ")} both touch \`${c.path}\` — ` +
|
|
97
|
+
"sequence them (drop `[P]` or move one to a later phase)");
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Deal a phase's open `[P]` tasks round-robin into `min(lanes, count)` lanes (FR-008/017). Refuses
|
|
101
|
+
* (`conflict`) when the phase has path conflicts (FR-009). `phase` defaults to the first phase with
|
|
102
|
+
* open `[P]` tasks; `lanes` defaults to 2.
|
|
103
|
+
*/
|
|
104
|
+
export function planLanes(feature, tasks, opts = {}) {
|
|
105
|
+
const wanted = Math.max(1, Math.floor(opts.lanes ?? 2));
|
|
106
|
+
const openParallel = tasks.filter((t) => !t.done && t.parallel);
|
|
107
|
+
const anyParallel = tasks.filter((t) => t.parallel);
|
|
108
|
+
let phase;
|
|
109
|
+
if (opts.phase !== undefined)
|
|
110
|
+
phase = opts.phase;
|
|
111
|
+
else if (openParallel.length > 0)
|
|
112
|
+
phase = Math.min(...openParallel.map((t) => t.phase));
|
|
113
|
+
else
|
|
114
|
+
phase = anyParallel.length > 0 ? Math.max(...anyParallel.map((t) => t.phase)) : 0;
|
|
115
|
+
const base = { feature, phase, lanes: [], stays: [], conflicts: [] };
|
|
116
|
+
const inPhase = tasks.filter((t) => t.phase === phase);
|
|
117
|
+
const open = inPhase.filter((t) => !t.done && t.parallel);
|
|
118
|
+
if (open.length === 0) {
|
|
119
|
+
return { ...base, status: inPhase.some((t) => t.parallel) ? "complete" : "no-parallel" };
|
|
120
|
+
}
|
|
121
|
+
const conflicts = laneConflicts(feature, tasks).filter((c) => c.phase === phase);
|
|
122
|
+
if (conflicts.length > 0)
|
|
123
|
+
return { ...base, status: "conflict", conflicts };
|
|
124
|
+
const n = Math.min(wanted, open.length);
|
|
125
|
+
const lanes = Array.from({ length: n }, (_, i) => ({
|
|
126
|
+
name: laneName(feature, phase, i + 1),
|
|
127
|
+
index: i + 1,
|
|
128
|
+
tasks: [],
|
|
129
|
+
}));
|
|
130
|
+
open.forEach((t, i) => lanes[i % n].tasks.push({ id: t.id, paths: t.paths }));
|
|
131
|
+
const stays = inPhase.filter((t) => !t.done && !t.parallel).map((t) => t.id);
|
|
132
|
+
return { ...base, status: "planned", lanes, stays };
|
|
133
|
+
}
|
|
134
|
+
// ── Check-off merge ─────────────────────────────────────────────────────────────────────────────
|
|
135
|
+
const CHECKBOX = /^(\s*-\s*)\[[ xX]\]/;
|
|
136
|
+
const stripBox = (line) => line.replace(/\r$/, "").replace(CHECKBOX, "$1[ ]");
|
|
137
|
+
const isTicked = (line) => /^\s*-\s*\[[xX]\]/.test(line);
|
|
138
|
+
/**
|
|
139
|
+
* Resolve a `tasks.md` conflict that is only about check-offs (FR-019): returns `ours` with every
|
|
140
|
+
* task ticked that either side ticked, preserving ours' line endings. Returns null when `ours` and
|
|
141
|
+
* `theirs` differ in anything but checkbox state (the caller then aborts the merge). `base` is
|
|
142
|
+
* accepted for the 3-way call shape; the union rule does not need it.
|
|
143
|
+
*/
|
|
144
|
+
export function mergeCheckoffs(_base, ours, theirs) {
|
|
145
|
+
const o = ours.split("\n");
|
|
146
|
+
const t = theirs.split("\n");
|
|
147
|
+
if (o.length !== t.length)
|
|
148
|
+
return null;
|
|
149
|
+
for (let i = 0; i < o.length; i++) {
|
|
150
|
+
if (stripBox(o[i]) !== stripBox(t[i]))
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return o
|
|
154
|
+
.map((line, i) => (isTicked(t[i]) && !isTicked(line) ? line.replace(CHECKBOX, "$1[x]") : line))
|
|
155
|
+
.join("\n");
|
|
156
|
+
}
|
|
157
|
+
/** `<lane checkout>/.amby/lane/lane.json` — in a self-ignoring directory. */
|
|
158
|
+
export function manifestPath(laneRoot) {
|
|
159
|
+
return join(laneRoot, ".amby", "lane", "lane.json");
|
|
160
|
+
}
|
|
161
|
+
export function writeManifest(laneRoot, manifest) {
|
|
162
|
+
const file = manifestPath(laneRoot);
|
|
163
|
+
const dir = join(laneRoot, ".amby", "lane");
|
|
164
|
+
mkdirSync(dir, { recursive: true });
|
|
165
|
+
writeFileSync(join(dir, ".gitignore"), "*\n", "utf8");
|
|
166
|
+
writeFileSync(file, JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
167
|
+
}
|
|
168
|
+
/** Read a lane's manifest; null when absent or malformed. */
|
|
169
|
+
export function readManifest(laneRoot) {
|
|
170
|
+
const file = manifestPath(laneRoot);
|
|
171
|
+
if (!existsSync(file))
|
|
172
|
+
return null;
|
|
173
|
+
try {
|
|
174
|
+
const m = JSON.parse(readFileSync(file, "utf8"));
|
|
175
|
+
if (m.version !== 1 || !m.feature || !m.lane || !Array.isArray(m.tasks))
|
|
176
|
+
return null;
|
|
177
|
+
return m;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Manifest ids that are missing from the feature's current tasks, or whose paths changed (FR-020). */
|
|
184
|
+
export function manifestDrift(manifest, current) {
|
|
185
|
+
const byId = new Map(current.map((t) => [t.id, t]));
|
|
186
|
+
const key = (paths) => [...paths].sort().join("|");
|
|
187
|
+
return manifest.tasks
|
|
188
|
+
.filter((m) => {
|
|
189
|
+
const t = byId.get(m.id);
|
|
190
|
+
return !t || key(t.paths) !== key(m.paths);
|
|
191
|
+
})
|
|
192
|
+
.map((m) => m.id);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* clean / dirty / merged for a lane (FR-010). `merged` needs the lane to have moved past where it
|
|
196
|
+
* started — a fresh lane is trivially an ancestor of its feature branch but has nothing to merge.
|
|
197
|
+
*/
|
|
198
|
+
export function laneState(input) {
|
|
199
|
+
if (input.dirty)
|
|
200
|
+
return "dirty";
|
|
201
|
+
if (input.mergedIntoFeature && input.baseHead !== undefined && input.tip !== input.baseHead)
|
|
202
|
+
return "merged";
|
|
203
|
+
return "clean";
|
|
204
|
+
}
|
|
205
|
+
/** Resolve `p-k`, `lane-p-k` or a full lane name against a feature's lane names; null when ambiguous/unknown. */
|
|
206
|
+
export function matchLane(feature, names, arg) {
|
|
207
|
+
const wanted = arg.startsWith(`${feature}.`) ? arg : `${feature}.${arg.startsWith("lane-") ? arg : `lane-${arg}`}`;
|
|
208
|
+
return names.includes(wanted) ? wanted : null;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Feature progress with lane work folded in (decision D5): a task counts done when it is checked in
|
|
212
|
+
* the feature's `tasks.md` or in the lane that owns it, so progress moves before lanes are merged.
|
|
213
|
+
* Returns new task objects; the input is untouched.
|
|
214
|
+
*/
|
|
215
|
+
export function unionLaneDone(tasks, lanes) {
|
|
216
|
+
const doneInLane = new Set();
|
|
217
|
+
for (const lane of lanes) {
|
|
218
|
+
const owned = new Set(lane.ids);
|
|
219
|
+
for (const t of lane.tasks)
|
|
220
|
+
if (t.done && owned.has(t.id))
|
|
221
|
+
doneInLane.add(t.id);
|
|
222
|
+
}
|
|
223
|
+
return tasks.map((t) => (!t.done && doneInLane.has(t.id) ? { ...t, done: true } : t));
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=lanes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lanes.js","sourceRoot":"","sources":["../../src/core/lanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;;GAIG;AAEH,2GAA2G;AAC3G,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG;SACP,IAAI,EAAE;SACN,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,QAAQ,CAAC,CAAS,EAAE,CAAS;IAC3C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CA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IAClF,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AmbyConfig } from "./types.js";
|
|
2
|
+
/** Where the Antigravity targets wrote phase commands before feature 018 (workflows, retired 2026-10-19). */
|
|
3
|
+
export declare const LEGACY_WORKFLOW_DIR: string;
|
|
4
|
+
/**
|
|
5
|
+
* Stale, AmbyKit-generated Antigravity workflow files (feature 018, FR-005/FR-006): project-relative
|
|
6
|
+
* paths of `.agents/workflows/amby.<phase>.md` that exist **and** carry the generated notice. Empty
|
|
7
|
+
* unless an Antigravity target is selected, so other projects never see a message. A user's own
|
|
8
|
+
* workflow, a `.bak` left by Antigravity's migration, or a file with a non-phase name never matches.
|
|
9
|
+
*/
|
|
10
|
+
export declare function legacyWorkflowFiles(root: string, config: AmbyConfig): string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join as nativeJoin } from "node:path";
|
|
3
|
+
import { join } from "node:path/posix";
|
|
4
|
+
import { loadCommandSpecs } from "./command-spec.js";
|
|
5
|
+
import { getTarget } from "../emitters/index.js";
|
|
6
|
+
/** Where the Antigravity targets wrote phase commands before feature 018 (workflows, retired 2026-10-19). */
|
|
7
|
+
export const LEGACY_WORKFLOW_DIR = join(".agents", "workflows");
|
|
8
|
+
const GENERATED = "GENERATED by AmbyKit";
|
|
9
|
+
/**
|
|
10
|
+
* Stale, AmbyKit-generated Antigravity workflow files (feature 018, FR-005/FR-006): project-relative
|
|
11
|
+
* paths of `.agents/workflows/amby.<phase>.md` that exist **and** carry the generated notice. Empty
|
|
12
|
+
* unless an Antigravity target is selected, so other projects never see a message. A user's own
|
|
13
|
+
* workflow, a `.bak` left by Antigravity's migration, or a file with a non-phase name never matches.
|
|
14
|
+
*/
|
|
15
|
+
export function legacyWorkflowFiles(root, config) {
|
|
16
|
+
const antigravity = config.tools.some((id) => getTarget(id)?.emitter.toolId === "antigravity" || getTarget(id)?.emitter.toolId === "antigravity-cli");
|
|
17
|
+
if (!antigravity)
|
|
18
|
+
return [];
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const spec of loadCommandSpecs()) {
|
|
21
|
+
const rel = join(LEGACY_WORKFLOW_DIR, `${spec.name}.md`);
|
|
22
|
+
const abs = nativeJoin(root, rel);
|
|
23
|
+
if (!existsSync(abs))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
if (readFileSync(abs, "utf8").includes(GENERATED))
|
|
27
|
+
out.push(rel);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// unreadable: leave it alone
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../src/core/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,6GAA6G;AAC7G,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEhE,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAkB;IAClE,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,aAAa,IAAI,SAAS,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,iBAAiB,CAAC,CAAC;IACtJ,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,IAAI,CAAC;YACH,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -24,11 +24,21 @@ export interface Clarification {
|
|
|
24
24
|
*/
|
|
25
25
|
export interface Checkout {
|
|
26
26
|
root: string;
|
|
27
|
-
kind: "main" | "worktree";
|
|
27
|
+
kind: "main" | "worktree" | "lane";
|
|
28
28
|
branch?: string;
|
|
29
29
|
dirty?: boolean;
|
|
30
30
|
stale?: boolean;
|
|
31
31
|
}
|
|
32
|
+
/** One parallel lane of a feature (feature 015): its task progress, git state and manifest drift. */
|
|
33
|
+
export interface LaneView {
|
|
34
|
+
name: string;
|
|
35
|
+
phase: number;
|
|
36
|
+
index: number;
|
|
37
|
+
done: number;
|
|
38
|
+
total: number;
|
|
39
|
+
state: "clean" | "dirty" | "merged";
|
|
40
|
+
drift: string[];
|
|
41
|
+
}
|
|
32
42
|
/** Everything the dashboard knows about one `specs/NNN-slug/` directory. */
|
|
33
43
|
export interface FeatureSnapshot {
|
|
34
44
|
/** Source checkout (feature 017); absent ≡ the primary checkout. */
|
|
@@ -46,6 +56,8 @@ export interface FeatureSnapshot {
|
|
|
46
56
|
tasks: boolean;
|
|
47
57
|
};
|
|
48
58
|
clarifications: Clarification[];
|
|
59
|
+
/** Feature 015: parallel lanes of this feature; absent when it has none. */
|
|
60
|
+
lanes?: LaneView[];
|
|
49
61
|
}
|
|
50
62
|
export interface Filters {
|
|
51
63
|
feature?: string;
|
|
@@ -75,6 +87,8 @@ export interface FeatureRow {
|
|
|
75
87
|
clarifications: number;
|
|
76
88
|
/** Source worktree (feature 017); absent for the primary checkout. */
|
|
77
89
|
checkout?: Checkout;
|
|
90
|
+
/** Feature 015: lanes, only when the feature has some. */
|
|
91
|
+
lanes?: LaneView[];
|
|
78
92
|
}
|
|
79
93
|
export interface AttentionItem {
|
|
80
94
|
key: string;
|
package/dist/core/overview.js
CHANGED
|
@@ -106,6 +106,8 @@ export function featureRow(f) {
|
|
|
106
106
|
// Only worktree rows carry their source, so output without worktrees is unchanged (017 FR-007/FR-008).
|
|
107
107
|
if (f.checkout?.kind === "worktree")
|
|
108
108
|
row.checkout = f.checkout;
|
|
109
|
+
if (f.lanes && f.lanes.length > 0)
|
|
110
|
+
row.lanes = f.lanes;
|
|
109
111
|
return row;
|
|
110
112
|
}
|
|
111
113
|
/** Feature-qualified, unambiguous story key for display, e.g. `014:US-3` or `008-alpha:US-1`. */
|