@ordewell/core 0.7.0 → 0.7.2
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/dist/{IFileSystem-DgpX0BU7.d.mts → IFileSystem-B5asBRDa.d.mts} +1 -1
- package/dist/{IFileSystem-D4ADfTrX.d.ts → IFileSystem-CbCmUDBn.d.ts} +1 -1
- package/dist/{ModeResolver-Cv01ZDd9.d.mts → ModeResolver-DcqAho4y.d.mts} +1 -1
- package/dist/{ModeResolver-BEcRAz1c.d.ts → ModeResolver-DtfhWeVL.d.ts} +1 -1
- package/dist/{Task-CoKhvBa1.d.mts → Task-BpzIbunq.d.mts} +146 -22
- package/dist/{Task-CoKhvBa1.d.ts → Task-BpzIbunq.d.ts} +146 -22
- package/dist/{chunk-LSGY7AIZ.mjs → chunk-AJ5KDO6V.mjs} +219 -77
- package/dist/chunk-AJ5KDO6V.mjs.map +1 -0
- package/dist/chunk-H5O74L77.mjs +185 -0
- package/dist/chunk-H5O74L77.mjs.map +1 -0
- package/dist/{chunk-YU4UKKKI.mjs → chunk-MZYZS7B3.mjs} +14 -186
- package/dist/chunk-MZYZS7B3.mjs.map +1 -0
- package/dist/{chunk-J3YSTPCE.mjs → chunk-OUIQWNS3.mjs} +8 -5
- package/dist/chunk-OUIQWNS3.mjs.map +1 -0
- package/dist/{chunk-N66ZHFGN.mjs → chunk-OYUSADFM.mjs} +11 -1
- package/dist/chunk-OYUSADFM.mjs.map +1 -0
- package/dist/{chunk-HPNUFBIT.mjs → chunk-V3JHS7AX.mjs} +9 -1
- package/dist/chunk-V3JHS7AX.mjs.map +1 -0
- package/dist/index.d.mts +909 -459
- package/dist/index.d.ts +909 -459
- package/dist/index.js +5671 -3776
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5548 -3795
- package/dist/index.mjs.map +1 -1
- package/dist/order-labels.d.mts +15 -2
- package/dist/order-labels.d.ts +15 -2
- package/dist/order-labels.js +12 -2
- package/dist/order-labels.js.map +1 -1
- package/dist/order-labels.mjs +7 -3
- package/dist/{parsing-DMdOq-BV.d.ts → parsing-COFGUEWx.d.ts} +2 -2
- package/dist/{parsing-B4OCHH1_.d.mts → parsing-D0uo-Icd.d.mts} +2 -2
- package/dist/parsing.d.mts +3 -3
- package/dist/parsing.d.ts +3 -3
- package/dist/parsing.js +6 -3
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +4 -3
- package/dist/{plan-utils-CD1Xu65s.d.mts → plan-utils-CdW3mxt5.d.mts} +226 -9
- package/dist/{plan-utils-BdYPRBno.d.ts → plan-utils-D4Z8UyLL.d.ts} +226 -9
- package/dist/plan-utils.d.mts +4 -3
- package/dist/plan-utils.d.ts +4 -3
- package/dist/plan-utils.js +210 -3
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +44 -3
- package/dist/testing.d.mts +17 -5
- package/dist/testing.d.ts +17 -5
- package/dist/testing.js +50 -3
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +50 -5
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HPNUFBIT.mjs.map +0 -1
- package/dist/chunk-J3YSTPCE.mjs.map +0 -1
- package/dist/chunk-LSGY7AIZ.mjs.map +0 -1
- package/dist/chunk-N66ZHFGN.mjs.map +0 -1
- package/dist/chunk-YU4UKKKI.mjs.map +0 -1
|
@@ -7,6 +7,14 @@ function integrationBranchFor(runId) {
|
|
|
7
7
|
function repoRootOf(workspaceRoot, repoPath) {
|
|
8
8
|
return path.join(workspaceRoot, repoPath);
|
|
9
9
|
}
|
|
10
|
+
function noRemoval() {
|
|
11
|
+
return { preserved: [], refused: [] };
|
|
12
|
+
}
|
|
13
|
+
function absorbRemoval(into, from) {
|
|
14
|
+
into.preserved.push(...from.preserved);
|
|
15
|
+
into.refused.push(...from.refused);
|
|
16
|
+
return into;
|
|
17
|
+
}
|
|
10
18
|
function layoutOf(run) {
|
|
11
19
|
return { repos: run.repos.map((r) => r.path), shared: [...run.shared] };
|
|
12
20
|
}
|
|
@@ -92,6 +100,8 @@ export {
|
|
|
92
100
|
SELF_REPO,
|
|
93
101
|
integrationBranchFor,
|
|
94
102
|
repoRootOf,
|
|
103
|
+
noRemoval,
|
|
104
|
+
absorbRemoval,
|
|
95
105
|
layoutOf,
|
|
96
106
|
integrationBranchNameOf,
|
|
97
107
|
changedReposOf,
|
|
@@ -100,4 +110,4 @@ export {
|
|
|
100
110
|
migratePlanIsolation,
|
|
101
111
|
migratePlanStateIsolation
|
|
102
112
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-OYUSADFM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/isolationRecord.ts"],"sourcesContent":["import * as path from 'path';\nimport type {\n IsolationHandoff,\n IsolationLandedTask,\n IsolationRemoval,\n IsolationRepo,\n IsolationRun,\n IsolationTaskRecord,\n IsolationTaskStatus,\n PlanIsolation,\n RepoGroupLayout,\n TaskIsolation,\n} from '../interfaces/IWorktreeIsolation';\n\n/** The path of the repo in a workspace that is itself the repository. */\nexport const SELF_REPO = '.';\n\nexport function integrationBranchFor(runId: string): string {\n return `ordewell/${runId}/integration`;\n}\n\nexport function repoRootOf(workspaceRoot: string, repoPath: string): string {\n return path.join(workspaceRoot, repoPath);\n}\n\n/** A removal that kept nothing back. */\nexport function noRemoval(): IsolationRemoval {\n return { preserved: [], refused: [] };\n}\n\n/** Add what `from` kept back to `into`. */\nexport function absorbRemoval(into: IsolationRemoval, from: IsolationRemoval): IsolationRemoval {\n into.preserved.push(...from.preserved);\n into.refused.push(...from.refused);\n return into;\n}\n\n/** The group a run isolates, as the planner is told it. */\nexport function layoutOf(run: IsolationRun): RepoGroupLayout {\n return { repos: run.repos.map((r) => r.path), shared: [...run.shared] };\n}\n\n/** The run's integration branch for a one-line notice: every repo's has the same name. */\nexport function integrationBranchNameOf(run: IsolationRun): string {\n return [...new Set(run.repos.map((r) => r.integrationBranch))].join(', ');\n}\n\nconst ISOLATION_STATE: Record<IsolationTaskStatus, Exclude<TaskIsolation['state'], 'none'>> = {\n active: 'active',\n merged: 'integrated',\n conflict: 'conflict',\n repairing: 'repairing',\n kept: 'kept',\n failed: 'kept',\n};\n\n/** Paths of the repos a task brought commits to. */\nexport function changedReposOf(record: IsolationTaskRecord): string[] {\n return Object.entries(record.repos).filter(([, r]) => r.changed).map(([repoPath]) => repoPath);\n}\n\n/** `repairLimit` is `conflictRepairAttempts` as it stands now, which is what the next repair will be held to. */\nexport function taskIsolationOf(record: IsolationTaskRecord, repairLimit: number): TaskIsolation {\n return {\n state: ISOLATION_STATE[record.status],\n branch: record.branch,\n worktree: record.workspace,\n repos: changedReposOf(record),\n ...(record.conflictRepo ? { conflictRepo: record.conflictRepo } : {}),\n ...(record.conflictFiles?.length ? { conflictFiles: record.conflictFiles } : {}),\n ...(record.repairs ? { repair: { attempt: record.repairs, limit: repairLimit } } : {}),\n ...(record.repairedFiles?.length ? { repairedFiles: record.repairedFiles } : {}),\n };\n}\n\n/**\n * What a run hands over: each repo's integration branch and base, and what\n * landed, in plan order. Work the user has merged already, at a merge gate\n * (ADR-0020), is not handed over again.\n */\nexport function handoffOf(run: IsolationRun): IsolationHandoff {\n const merged = Object.values(run.tasks)\n .filter((r) => r.status === 'merged' && !r.inHead)\n .sort((a, b) => a.order - b.order);\n const entry = (r: IsolationTaskRecord): IsolationLandedTask => ({\n taskId: r.taskId, order: r.order, title: r.title,\n ...(r.repairedFiles?.length ? { repairedFiles: r.repairedFiles } : {}),\n });\n return {\n repos: run.repos.map((repo) => ({\n path: repo.path,\n integrationBranch: repo.integrationBranch,\n baseRef: repo.baseRef,\n landed: merged.filter((r) => r.repos[repo.path]?.changed).map(entry),\n })),\n landed: merged.map(entry),\n };\n}\n\n/** A task record as ADR-0013 persisted it, for one repository. */\nexport interface Adr0013TaskRecord {\n taskId: string;\n order: number;\n title: string;\n branch: string;\n worktree: string;\n status: IsolationTaskStatus;\n linked: string[];\n}\n\n/** A run as ADR-0013 persisted it (0.4.23): one repository, its refs on the run itself. */\nexport interface Adr0013IsolationRun {\n id: string;\n workspaceRoot: string;\n baseRef: string;\n baseBranch?: string;\n integrationBranch: string;\n tasks: Record<string, Adr0013TaskRecord>;\n}\n\nexport interface Adr0013PlanIsolation {\n run: Adr0013IsolationRun;\n resolvers: Record<string, string>;\n}\n\nfunction isAdr0013(run: IsolationRun | Adr0013IsolationRun): run is Adr0013IsolationRun {\n return 'integrationBranch' in run && typeof run.integrationBranch === 'string';\n}\n\nfunction fromAdr0013Task(r: Adr0013TaskRecord): IsolationTaskRecord {\n return {\n taskId: r.taskId,\n order: r.order,\n title: r.title,\n branch: r.branch,\n workspace: r.worktree,\n status: r.status,\n // A merged task's branch was merged into the one repo there was; what it\n // changed was never recorded, and landing is what `changed` stands for.\n repos: { [SELF_REPO]: { worktree: r.worktree, linked: r.linked ?? [], ...(r.status === 'merged' ? { changed: true } : {}) } },\n ...(r.status === 'conflict' ? { conflictRepo: SELF_REPO } : {}),\n };\n}\n\n/**\n * A persisted plan isolation in today's shape. A run saved in the ADR-0013\n * format — recognised by its own `integrationBranch` — becomes a group of one\n * at `.`, keeping its branches, so a session saved by 0.4.23 resumes and hands\n * off exactly as it would have.\n */\nexport function migratePlanIsolation(state: PlanIsolation | Adr0013PlanIsolation): PlanIsolation {\n const { run, resolvers } = state;\n if (!isAdr0013(run)) return { run, resolvers: resolvers ?? {} };\n const repo: IsolationRepo = {\n path: SELF_REPO,\n root: repoRootOf(run.workspaceRoot, SELF_REPO),\n baseRef: run.baseRef,\n ...(run.baseBranch ? { baseBranch: run.baseBranch } : {}),\n integrationBranch: run.integrationBranch,\n };\n const tasks = Object.fromEntries(Object.entries(run.tasks ?? {}).map(([id, r]) => [id, fromAdr0013Task(r)]));\n return { run: { id: run.id, workspaceRoot: run.workspaceRoot, repos: [repo], shared: [], sharedRepos: [], tasks }, resolvers: resolvers ?? {} };\n}\n\n/** Bring a loaded plan's isolation record, if any, to today's shape in place. */\nexport function migratePlanStateIsolation(plan: { isolation?: PlanIsolation | Adr0013PlanIsolation }): void {\n if (plan.isolation?.run) plan.isolation = migratePlanIsolation(plan.isolation);\n}\n"],"mappings":";AAAA,YAAY,UAAU;AAef,IAAM,YAAY;AAElB,SAAS,qBAAqB,OAAuB;AAC1D,SAAO,YAAY,KAAK;AAC1B;AAEO,SAAS,WAAW,eAAuB,UAA0B;AAC1E,SAAY,UAAK,eAAe,QAAQ;AAC1C;AAGO,SAAS,YAA8B;AAC5C,SAAO,EAAE,WAAW,CAAC,GAAG,SAAS,CAAC,EAAE;AACtC;AAGO,SAAS,cAAc,MAAwB,MAA0C;AAC9F,OAAK,UAAU,KAAK,GAAG,KAAK,SAAS;AACrC,OAAK,QAAQ,KAAK,GAAG,KAAK,OAAO;AACjC,SAAO;AACT;AAGO,SAAS,SAAS,KAAoC;AAC3D,SAAO,EAAE,OAAO,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;AACxE;AAGO,SAAS,wBAAwB,KAA2B;AACjE,SAAO,CAAC,GAAG,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAAE,KAAK,IAAI;AAC1E;AAEA,IAAM,kBAAwF;AAAA,EAC5F,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AACV;AAGO,SAAS,eAAe,QAAuC;AACpE,SAAO,OAAO,QAAQ,OAAO,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ,MAAM,QAAQ;AAC/F;AAGO,SAAS,gBAAgB,QAA6B,aAAoC;AAC/F,SAAO;AAAA,IACL,OAAO,gBAAgB,OAAO,MAAM;AAAA,IACpC,QAAQ,OAAO;AAAA,I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
|
4
4
|
}
|
|
5
|
+
function taskRef(task, parent) {
|
|
6
|
+
return `#${taskOrderLabel(task, parent)}`;
|
|
7
|
+
}
|
|
8
|
+
function titledTaskRef(task, parent) {
|
|
9
|
+
return `${taskRef(task, parent)} ${task.title}`;
|
|
10
|
+
}
|
|
5
11
|
function resolveOrderLabel(tasks, label) {
|
|
6
12
|
const parts = label.split(".");
|
|
7
13
|
if (parts.length > 2 || parts.some((p) => !/^\d+$/.test(p))) return void 0;
|
|
@@ -14,6 +20,8 @@ function resolveOrderLabel(tasks, label) {
|
|
|
14
20
|
|
|
15
21
|
export {
|
|
16
22
|
taskOrderLabel,
|
|
23
|
+
taskRef,
|
|
24
|
+
titledTaskRef,
|
|
17
25
|
resolveOrderLabel
|
|
18
26
|
};
|
|
19
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-V3JHS7AX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/order-labels.ts"],"sourcesContent":["import type { Task } from './models/Task';\n\n/**\n * Parent-scoped dotted order label for a task, e.g. \"2.1\" for the first subtask\n * of task 2. Kept in its own module (no Node imports) so a browser-bundled\n * surface — the VS Code webview — can import it via `@ordewell/core/order-labels`\n * without dragging the rest of core in.\n */\nexport function taskOrderLabel(task: { order: number }, parent?: { order: number }): string {\n return parent ? `${parent.order}.${task.order}` : String(task.order);\n}\n\n/** How a surface refers to a task in prose: \"#2\", or \"#2.1\" for a subtask. */\nexport function taskRef(task: { order: number }, parent?: { order: number }): string {\n return `#${taskOrderLabel(task, parent)}`;\n}\n\n/** A task named in full, as a confirmation or a picker title does: \"#2 Deploy\". */\nexport function titledTaskRef(task: { order: number; title: string }, parent?: { order: number }): string {\n return `${taskRef(task, parent)} ${task.title}`;\n}\n\n/** Resolve a dotted label to a task in a plan's top-level task list. */\nexport function resolveOrderLabel(tasks: Task[], label: string): Task | undefined {\n const parts = label.split('.');\n if (parts.length > 2 || parts.some((p) => !/^\\d+$/.test(p))) return undefined;\n const [topOrder, childOrder] = parts.map(Number);\n const top = tasks.find((t) => t.order === topOrder);\n if (!top) return undefined;\n if (childOrder === undefined) return top;\n return top.subtasks.find((s) => s.order === childOrder);\n}"],"mappings":";AAQO,SAAS,eAAe,MAAyB,QAAoC;AAC1F,SAAO,SAAS,GAAG,OAAO,KAAK,IAAI,KAAK,KAAK,KAAK,OAAO,KAAK,KAAK;AACrE;AAGO,SAAS,QAAQ,MAAyB,QAAoC;AACnF,SAAO,IAAI,eAAe,MAAM,MAAM,CAAC;AACzC;AAGO,SAAS,cAAc,MAAwC,QAAoC;AACxG,SAAO,GAAG,QAAQ,MAAM,MAAM,CAAC,IAAI,KAAK,KAAK;AAC/C;AAGO,SAAS,kBAAkB,OAAe,OAAiC;AAChF,QAAM,QAAQ,MAAM,MAAM,GAAG;AAC7B,MAAI,MAAM,SAAS,KAAK,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAG,QAAO;AACpE,QAAM,CAAC,UAAU,UAAU,IAAI,MAAM,IAAI,MAAM;AAC/C,QAAM,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,UAAU,QAAQ;AAClD,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,eAAe,OAAW,QAAO;AACrC,SAAO,IAAI,SAAS,KAAK,CAAC,MAAM,EAAE,UAAU,UAAU;AACxD;","names":[]}
|