@llipe.com/dev-tasks 0.16.2 → 0.17.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/.claude/agents/developer.md +8 -3
- package/.claude/agents/github-ops.md +187 -59
- package/.claude/agents/technical-writer.md +1 -1
- package/.claude/agents/verifier.md +10 -5
- package/.claude/commands/planner.md +110 -15
- package/.claude/commands/product-engineer.md +27 -3
- package/.claude/hooks/git-guard.sh +2 -2
- package/.claude/skills/activity-init/SKILL.md +4 -0
- package/.claude/skills/activity-publish-github/SKILL.md +84 -15
- package/.claude/skills/git-ops/SKILL.md +6 -6
- package/.claude/skills/implement/SKILL.md +29 -13
- package/.claude/skills/memo-cli-usage/REFERENCE.md +1 -0
- package/.claude/skills/memo-cli-usage/SKILL.md +3 -1
- package/.claude/skills/plan/SKILL.md +6 -0
- package/.github/agents/developer.agent.md +8 -3
- package/.github/agents/github-ops.agent.md +182 -64
- package/.github/agents/planner.agent.md +123 -28
- package/.github/agents/product-engineer.agent.md +27 -3
- package/.github/agents/technical-writer.agent.md +1 -1
- package/.github/agents/verifier.agent.md +10 -5
- package/.github/instructions/implement.instructions.md +29 -13
- package/.github/instructions/plan.instructions.md +6 -0
- package/.github/skills/activity-init/SKILL.md +4 -0
- package/.github/skills/activity-publish-github/SKILL.md +84 -15
- package/.github/skills/git-ops/SKILL.md +6 -6
- package/.github/skills/memo-cli-usage/REFERENCE.md +1 -0
- package/.github/skills/memo-cli-usage/SKILL.md +3 -1
- package/.kiro/agents/developer.md +8 -3
- package/.kiro/agents/github-ops.md +182 -64
- package/.kiro/agents/planner.md +123 -28
- package/.kiro/agents/product-engineer.md +27 -3
- package/.kiro/agents/technical-writer.md +1 -1
- package/.kiro/agents/verifier.md +10 -5
- package/.kiro/skills/activity-init/SKILL.md +4 -0
- package/.kiro/skills/activity-publish-github/SKILL.md +84 -15
- package/.kiro/skills/git-ops/SKILL.md +6 -6
- package/.kiro/skills/memo-cli-usage/REFERENCE.md +1 -0
- package/.kiro/skills/memo-cli-usage/SKILL.md +3 -1
- package/.kiro/steering/implement.md +29 -13
- package/.kiro/steering/plan.md +6 -0
- package/CHANGELOG.md +42 -0
- package/README.md +79 -7
- package/TESTING.md +108 -30
- package/dist/bin/dev-tasks.d.ts +1 -1
- package/dist/bin/dev-tasks.js +126 -4
- package/dist/bin/dev-tasks.js.map +1 -1
- package/dist/bin/parse-args.d.ts +49 -1
- package/dist/bin/parse-args.d.ts.map +1 -1
- package/dist/bin/parse-args.js +132 -11
- package/dist/bin/parse-args.js.map +1 -1
- package/dist/core/checks/decision-log-format.d.ts +24 -3
- package/dist/core/checks/decision-log-format.d.ts.map +1 -1
- package/dist/core/checks/decision-log-format.js +43 -3
- package/dist/core/checks/decision-log-format.js.map +1 -1
- package/dist/core/checks/index.d.ts +2 -0
- package/dist/core/checks/index.d.ts.map +1 -1
- package/dist/core/checks/index.js +1 -0
- package/dist/core/checks/index.js.map +1 -1
- package/dist/core/checks/roadmap.d.ts +40 -0
- package/dist/core/checks/roadmap.d.ts.map +1 -0
- package/dist/core/checks/roadmap.js +78 -0
- package/dist/core/checks/roadmap.js.map +1 -0
- package/dist/core/migrate-projects/answers.d.ts +63 -0
- package/dist/core/migrate-projects/answers.d.ts.map +1 -0
- package/dist/core/migrate-projects/answers.js +79 -0
- package/dist/core/migrate-projects/answers.js.map +1 -0
- package/dist/core/migrate-projects/apply.d.ts +51 -0
- package/dist/core/migrate-projects/apply.d.ts.map +1 -0
- package/dist/core/migrate-projects/apply.js +828 -0
- package/dist/core/migrate-projects/apply.js.map +1 -0
- package/dist/core/migrate-projects/classify.d.ts +93 -0
- package/dist/core/migrate-projects/classify.d.ts.map +1 -0
- package/dist/core/migrate-projects/classify.js +170 -0
- package/dist/core/migrate-projects/classify.js.map +1 -0
- package/dist/core/migrate-projects/conventions.d.ts +118 -0
- package/dist/core/migrate-projects/conventions.d.ts.map +1 -0
- package/dist/core/migrate-projects/conventions.js +213 -0
- package/dist/core/migrate-projects/conventions.js.map +1 -0
- package/dist/core/migrate-projects/gh.d.ts +40 -0
- package/dist/core/migrate-projects/gh.d.ts.map +1 -0
- package/dist/core/migrate-projects/gh.js +115 -0
- package/dist/core/migrate-projects/gh.js.map +1 -0
- package/dist/core/migrate-projects/index.d.ts +61 -0
- package/dist/core/migrate-projects/index.d.ts.map +1 -0
- package/dist/core/migrate-projects/index.js +183 -0
- package/dist/core/migrate-projects/index.js.map +1 -0
- package/dist/core/migrate-projects/local-reader.d.ts +8 -0
- package/dist/core/migrate-projects/local-reader.d.ts.map +1 -0
- package/dist/core/migrate-projects/local-reader.js +30 -0
- package/dist/core/migrate-projects/local-reader.js.map +1 -0
- package/dist/core/migrate-projects/map.d.ts +36 -0
- package/dist/core/migrate-projects/map.d.ts.map +1 -0
- package/dist/core/migrate-projects/map.js +75 -0
- package/dist/core/migrate-projects/map.js.map +1 -0
- package/dist/core/migrate-projects/plan.d.ts +71 -0
- package/dist/core/migrate-projects/plan.d.ts.map +1 -0
- package/dist/core/migrate-projects/plan.js +638 -0
- package/dist/core/migrate-projects/plan.js.map +1 -0
- package/dist/core/migrate-projects/planfile.d.ts +149 -0
- package/dist/core/migrate-projects/planfile.d.ts.map +1 -0
- package/dist/core/migrate-projects/planfile.js +608 -0
- package/dist/core/migrate-projects/planfile.js.map +1 -0
- package/dist/core/migrate-projects/roadmap.d.ts +43 -0
- package/dist/core/migrate-projects/roadmap.d.ts.map +1 -0
- package/dist/core/migrate-projects/roadmap.js +54 -0
- package/dist/core/migrate-projects/roadmap.js.map +1 -0
- package/dist/core/migrate-projects/snapshot.d.ts +91 -0
- package/dist/core/migrate-projects/snapshot.d.ts.map +1 -0
- package/dist/core/migrate-projects/snapshot.js +285 -0
- package/dist/core/migrate-projects/snapshot.js.map +1 -0
- package/dist/core/migrate-projects/summary.d.ts +27 -0
- package/dist/core/migrate-projects/summary.d.ts.map +1 -0
- package/dist/core/migrate-projects/summary.js +35 -0
- package/dist/core/migrate-projects/summary.js.map +1 -0
- package/package.json +8 -6
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The projects-tracking label conventions `migrate projects` enforces,
|
|
3
|
+
* defined once (spec §16a A-87). github-ops' Labels section states the same
|
|
4
|
+
* set in prose; PT-81 pins the two together.
|
|
5
|
+
*
|
|
6
|
+
* - Types (D-85): exactly one `type:` per issue from `TYPE_SET`, listed in
|
|
7
|
+
* tie-break order: when work fits several types, the first wins.
|
|
8
|
+
* - Retired labels (D-91): removed from open issues, definitions kept.
|
|
9
|
+
* - Default labels (D-100): GitHub's unprefixed `bug`, `documentation`,
|
|
10
|
+
* `enhancement`, plus `chore` and `story`, are neither retired nor a
|
|
11
|
+
* type; they only feed a suggestion.
|
|
12
|
+
*/
|
|
13
|
+
/** The eight types, in tie-break order: `security > bug > … > tech-debt`. */
|
|
14
|
+
export const TYPE_SET = [
|
|
15
|
+
"security",
|
|
16
|
+
"bug",
|
|
17
|
+
"enhancement",
|
|
18
|
+
"refactor",
|
|
19
|
+
"test",
|
|
20
|
+
"docs",
|
|
21
|
+
"chore",
|
|
22
|
+
"tech-debt",
|
|
23
|
+
];
|
|
24
|
+
/** Each type's definition, as github-ops' Labels table states it (S-019). */
|
|
25
|
+
export const TYPE_DEFINITIONS = {
|
|
26
|
+
security: "Security vulnerability, hardening, or compliance work",
|
|
27
|
+
bug: "Behavior that differs from the spec or intent",
|
|
28
|
+
enhancement: "New or changed behavior",
|
|
29
|
+
refactor: "Code restructure, no behavior change",
|
|
30
|
+
test: "Test-only work",
|
|
31
|
+
docs: "Documentation changes",
|
|
32
|
+
chore: "Maintenance, dependencies, tooling, or CI",
|
|
33
|
+
"tech-debt": "Deferred engineering work that fits no other type",
|
|
34
|
+
};
|
|
35
|
+
/** Each type's colour, as github-ops' Labels table states it (S-019); PT-81 pins it. */
|
|
36
|
+
export const TYPE_COLORS = {
|
|
37
|
+
security: "B60205",
|
|
38
|
+
bug: "D93F0B",
|
|
39
|
+
enhancement: "0E8A16",
|
|
40
|
+
refactor: "D4C5F9",
|
|
41
|
+
test: "BFDADC",
|
|
42
|
+
docs: "0075CA",
|
|
43
|
+
chore: "FEF2C0",
|
|
44
|
+
"tech-debt": "5319E7",
|
|
45
|
+
};
|
|
46
|
+
/** The `level:` labels batch 1 creates when missing (A-71), as github-ops' table states them. */
|
|
47
|
+
export const LEVEL_DEFINITIONS = {
|
|
48
|
+
"level: prd": {
|
|
49
|
+
color: "3F51B5",
|
|
50
|
+
description: "PRD tracking issue; a container for waves, not work",
|
|
51
|
+
},
|
|
52
|
+
"level: wave": {
|
|
53
|
+
color: "5C6BC0",
|
|
54
|
+
description: "Wave tracking issue; a container for stories, not work",
|
|
55
|
+
},
|
|
56
|
+
"level: story": { color: "7986CB", description: "Story issue; the unit of work" },
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The four priorities, with the D-84 and D-102 meanings batch 1 writes into
|
|
60
|
+
* their descriptions (D-103): `critical` blocks a ship, `high` blocks none.
|
|
61
|
+
*/
|
|
62
|
+
export const PRIORITY_DEFINITIONS = {
|
|
63
|
+
"priority: critical": {
|
|
64
|
+
color: "B60205",
|
|
65
|
+
description: "Blocks a wave, PRD, or release from shipping",
|
|
66
|
+
},
|
|
67
|
+
"priority: high": {
|
|
68
|
+
color: "D93F0B",
|
|
69
|
+
description: "Lands in the current wave or cycle; blocks no ship",
|
|
70
|
+
},
|
|
71
|
+
"priority: medium": { color: "FBCA04", description: "Lands in the next wave or cycle" },
|
|
72
|
+
"priority: low": { color: "C5DEF5", description: "Backlog" },
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The PRD status comment's State vocabulary, as github-ops' § Status
|
|
76
|
+
* comment states it (D-107); PT-81 pins the two together. Batch 6 writes
|
|
77
|
+
* only `not started`, `published`, `in progress` and `shipped`; the planner
|
|
78
|
+
* writes `consolidated PR #n open`.
|
|
79
|
+
*/
|
|
80
|
+
export const PRD_STATES = [
|
|
81
|
+
"not started",
|
|
82
|
+
"published",
|
|
83
|
+
"in progress",
|
|
84
|
+
"consolidated PR #n open",
|
|
85
|
+
"shipped",
|
|
86
|
+
];
|
|
87
|
+
/** GitHub refuses a label description longer than this. */
|
|
88
|
+
export const LABEL_DESCRIPTION_MAX = 100;
|
|
89
|
+
/** Prefixed to a retired label's description, once (D-91, A-82). */
|
|
90
|
+
export const RETIRED_DESCRIPTION_PREFIX = "Retired (D-91): ";
|
|
91
|
+
export const TYPE_LABEL_PREFIX = "type: ";
|
|
92
|
+
/** Retired `type:` labels: they count as no type (D-85, A-70). */
|
|
93
|
+
export const RETIRED_TYPE_LABELS = [
|
|
94
|
+
"type: other",
|
|
95
|
+
"type: prd",
|
|
96
|
+
"type: wave",
|
|
97
|
+
"type: story",
|
|
98
|
+
];
|
|
99
|
+
/** Every retired label by exact name (D-91, D-07, D-15); `wave:` labels are matched by prefix. S-014 batch 5 removes them; PT-81 pins the list. */
|
|
100
|
+
export const RETIRED_LABELS = [
|
|
101
|
+
...RETIRED_TYPE_LABELS,
|
|
102
|
+
"status: ready",
|
|
103
|
+
"status: in-progress",
|
|
104
|
+
"needs: decision",
|
|
105
|
+
"needs: approval",
|
|
106
|
+
"needs: merge",
|
|
107
|
+
];
|
|
108
|
+
export const RETIRED_LABEL_PREFIXES = ["wave:"];
|
|
109
|
+
export const LEVEL_LABELS = {
|
|
110
|
+
prd: "level: prd",
|
|
111
|
+
wave: "level: wave",
|
|
112
|
+
story: "level: story",
|
|
113
|
+
};
|
|
114
|
+
export const PRIORITY_LABEL_PREFIX = "priority: ";
|
|
115
|
+
export const PRIORITY_CRITICAL = "priority: critical";
|
|
116
|
+
export const PRIORITY_HIGH = "priority: high";
|
|
117
|
+
/**
|
|
118
|
+
* Label names compare case-insensitively, as GitHub compares them: a
|
|
119
|
+
* repository cannot hold both `type: bug` and `Type: Bug`, so the one it
|
|
120
|
+
* has is the one to reuse (EC-117, D-106).
|
|
121
|
+
*/
|
|
122
|
+
export function sameLabel(a, b) {
|
|
123
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
124
|
+
}
|
|
125
|
+
/** The issue's own spelling of `name`, or `undefined` when it does not carry it. */
|
|
126
|
+
export function findLabel(labels, name) {
|
|
127
|
+
return labels.find((l) => sameLabel(l, name));
|
|
128
|
+
}
|
|
129
|
+
export function hasLabel(labels, name) {
|
|
130
|
+
return findLabel(labels, name) !== undefined;
|
|
131
|
+
}
|
|
132
|
+
/** `label` starts with `prefix`, ignoring case (`Type: ` is a `type: ` label). */
|
|
133
|
+
export function hasLabelPrefix(label, prefix) {
|
|
134
|
+
return label.toLowerCase().startsWith(prefix.toLowerCase());
|
|
135
|
+
}
|
|
136
|
+
/** True for a retired label (D-91): an exact name, or a `wave:` label, in any case. */
|
|
137
|
+
export function isRetiredLabel(name) {
|
|
138
|
+
return (RETIRED_LABELS.some((r) => sameLabel(r, name)) ||
|
|
139
|
+
RETIRED_LABEL_PREFIXES.some((p) => hasLabelPrefix(name, p)));
|
|
140
|
+
}
|
|
141
|
+
/** Conventional Commits title prefix to type (D-85). `perf`, `style`, `revert` give none. */
|
|
142
|
+
export const CONVENTIONAL_COMMIT_SUGGESTIONS = {
|
|
143
|
+
fix: "bug",
|
|
144
|
+
feat: "enhancement",
|
|
145
|
+
test: "test",
|
|
146
|
+
docs: "docs",
|
|
147
|
+
refactor: "refactor",
|
|
148
|
+
chore: "chore",
|
|
149
|
+
ci: "chore",
|
|
150
|
+
build: "chore",
|
|
151
|
+
};
|
|
152
|
+
/** Default and unprefixed labels to type (D-100); `null` means no suggestion. */
|
|
153
|
+
export const DEFAULT_LABEL_SUGGESTIONS = {
|
|
154
|
+
bug: "bug",
|
|
155
|
+
documentation: "docs",
|
|
156
|
+
enhancement: "enhancement",
|
|
157
|
+
chore: "chore",
|
|
158
|
+
story: null,
|
|
159
|
+
};
|
|
160
|
+
/** The issue's labels that are members of the type set, as type names. */
|
|
161
|
+
export function validTypes(labels) {
|
|
162
|
+
return TYPE_SET.filter((t) => hasLabel(labels, `${TYPE_LABEL_PREFIX}${t}`));
|
|
163
|
+
}
|
|
164
|
+
/** The first of `types` in tie-break order, or `null` for none. */
|
|
165
|
+
export function tieBreakWinner(types) {
|
|
166
|
+
return TYPE_SET.find((t) => types.includes(t)) ?? null;
|
|
167
|
+
}
|
|
168
|
+
/** Leading `[PRD-<name>] ` prefix, which carries no type information. */
|
|
169
|
+
const PRD_PREFIX = /^\[PRD-[^\]]+\]\s*/;
|
|
170
|
+
/** `fix:`, `fix(scope):`, `fix!:`, matched case-insensitively as Conventional Commits allows. */
|
|
171
|
+
const CC_PREFIX = /^([A-Za-z]+)(?:\([^)]*\))?!?:/;
|
|
172
|
+
/** `[chore] …`, the bracket form seen in the wild (A-69). */
|
|
173
|
+
const BRACKET_PREFIX = /^\[([A-Za-z-]+)\]/;
|
|
174
|
+
function fromWord(word) {
|
|
175
|
+
const w = word.toLowerCase();
|
|
176
|
+
if (Object.hasOwn(CONVENTIONAL_COMMIT_SUGGESTIONS, w))
|
|
177
|
+
return CONVENTIONAL_COMMIT_SUGGESTIONS[w];
|
|
178
|
+
return TYPE_SET.includes(w) ? w : null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The suggested type for an issue on "needs a type" (D-85, D-100, A-69).
|
|
182
|
+
* Several valid types: the tie-break winner among them. Otherwise, in order:
|
|
183
|
+
* the Conventional Commits title prefix (scoped and breaking forms), a
|
|
184
|
+
* `[type]` bracket prefix, then a default unprefixed label; a prefix with
|
|
185
|
+
* no type (`perf:`) falls through to the next rule. `null` when
|
|
186
|
+
* nothing applies: a type is never guessed beyond these rules.
|
|
187
|
+
*/
|
|
188
|
+
export function suggestType(title, labels) {
|
|
189
|
+
const present = validTypes(labels);
|
|
190
|
+
if (present.length > 1)
|
|
191
|
+
return tieBreakWinner(present);
|
|
192
|
+
const rest = title.replace(PRD_PREFIX, "");
|
|
193
|
+
const cc = rest.match(CC_PREFIX);
|
|
194
|
+
if (cc && Object.hasOwn(CONVENTIONAL_COMMIT_SUGGESTIONS, cc[1].toLowerCase())) {
|
|
195
|
+
return CONVENTIONAL_COMMIT_SUGGESTIONS[cc[1].toLowerCase()];
|
|
196
|
+
}
|
|
197
|
+
const bracket = rest.match(BRACKET_PREFIX);
|
|
198
|
+
if (bracket) {
|
|
199
|
+
const t = fromWord(bracket[1]);
|
|
200
|
+
if (t !== null)
|
|
201
|
+
return t;
|
|
202
|
+
}
|
|
203
|
+
for (const label of labels) {
|
|
204
|
+
const key = label.toLowerCase();
|
|
205
|
+
if (Object.hasOwn(DEFAULT_LABEL_SUGGESTIONS, key)) {
|
|
206
|
+
const t = DEFAULT_LABEL_SUGGESTIONS[key];
|
|
207
|
+
if (t !== null)
|
|
208
|
+
return t;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=conventions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conventions.js","sourceRoot":"","sources":["../../../core/migrate-projects/conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,UAAU;IACV,KAAK;IACL,aAAa;IACb,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;CACH,CAAC;AAIX,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAwC;IACnE,QAAQ,EAAE,uDAAuD;IACjE,GAAG,EAAE,+CAA+C;IACpD,WAAW,EAAE,yBAAyB;IACtC,QAAQ,EAAE,sCAAsC;IAChD,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,2CAA2C;IAClD,WAAW,EAAE,mDAAmD;CACjE,CAAC;AAEF,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAwC;IAC9D,QAAQ,EAAE,QAAQ;IAClB,GAAG,EAAE,QAAQ;IACb,WAAW,EAAE,QAAQ;IACrB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D,MAAM,CAAC,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,KAAK,IAAI;gBAAE,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface GhResult {
|
|
2
|
+
stdout: string;
|
|
3
|
+
stderr: string;
|
|
4
|
+
exitCode: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Runs `gh` with `args` and resolves with its output and exit code. A
|
|
8
|
+
* non-zero exit resolves, it does not reject: the caller decides what a
|
|
9
|
+
* failure means. It rejects only when `gh` could not be run at all
|
|
10
|
+
* (`GhNotFoundError` when it is not on `PATH`).
|
|
11
|
+
*/
|
|
12
|
+
export type GhRunner = (args: readonly string[]) => Promise<GhResult>;
|
|
13
|
+
/** `gh` is not installed or not on `PATH` (spawn `ENOENT`). */
|
|
14
|
+
export declare class GhNotFoundError extends Error {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export interface GhRunnerOptions {
|
|
18
|
+
/** Working directory for `gh` (its repository context). Defaults to the process cwd. */
|
|
19
|
+
cwd?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Kill every `gh` call still in flight (D-111). `--apply`'s signal handler
|
|
23
|
+
* calls it before releasing the lock, so no write can land after the lock
|
|
24
|
+
* is gone and its state is never recorded.
|
|
25
|
+
*/
|
|
26
|
+
export declare function killRunningGh(): number;
|
|
27
|
+
/** The real runner: `execFile("gh", args)`, no shell. */
|
|
28
|
+
export declare function createGhRunner(options?: GhRunnerOptions): GhRunner;
|
|
29
|
+
/** The first non-empty line of `gh`'s stderr, for error messages and `failed(<reason>)`. */
|
|
30
|
+
export declare function firstLine(text: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse `gh api --paginate` output: one or more JSON values printed back to
|
|
33
|
+
* back. Current `gh` merges array pages into one array and prints object
|
|
34
|
+
* pages one after another (`}{`); older versions print arrays as `][`.
|
|
35
|
+
* Both are split here into the list of top-level values.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseJsonStream(text: string): unknown[];
|
|
38
|
+
/** Flatten paginated list output into its items (array pages, merged or not). */
|
|
39
|
+
export declare function paginatedItems(text: string): unknown[];
|
|
40
|
+
//# sourceMappingURL=gh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh.d.ts","sourceRoot":"","sources":["../../../core/migrate-projects/gh.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEtE,+DAA+D;AAC/D,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAKD,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAED,yDAAyD;AACzD,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CA2BtE;AAED,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CA8BvD;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAEtD"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one door between `migrate projects` and GitHub (D-90, spec §4).
|
|
3
|
+
*
|
|
4
|
+
* `snapshot.ts` (and later `apply.ts`) call `gh` only through a `GhRunner`,
|
|
5
|
+
* so tests inject a fake and the real one is a thin wrapper over
|
|
6
|
+
* `execFile("gh", args)`: an argument vector, never a shell string, so no
|
|
7
|
+
* title or label value can be read as shell syntax (D-79).
|
|
8
|
+
*/
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
|
+
/** `gh` is not installed or not on `PATH` (spawn `ENOENT`). */
|
|
11
|
+
export class GhNotFoundError extends Error {
|
|
12
|
+
constructor() {
|
|
13
|
+
super("gh is not installed or not on PATH");
|
|
14
|
+
this.name = "GhNotFoundError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Large enough for a paginated issue list of a big repository. */
|
|
18
|
+
const MAX_BUFFER = 512 * 1024 * 1024;
|
|
19
|
+
/** `gh` processes the real runner started that have not exited yet. */
|
|
20
|
+
const running = new Set();
|
|
21
|
+
/**
|
|
22
|
+
* Kill every `gh` call still in flight (D-111). `--apply`'s signal handler
|
|
23
|
+
* calls it before releasing the lock, so no write can land after the lock
|
|
24
|
+
* is gone and its state is never recorded.
|
|
25
|
+
*/
|
|
26
|
+
export function killRunningGh() {
|
|
27
|
+
const n = running.size;
|
|
28
|
+
for (const child of running)
|
|
29
|
+
child.kill("SIGKILL");
|
|
30
|
+
running.clear();
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
/** The real runner: `execFile("gh", args)`, no shell. */
|
|
34
|
+
export function createGhRunner(options = {}) {
|
|
35
|
+
return (args) => new Promise((resolvePromise, reject) => {
|
|
36
|
+
const child = execFile("gh", [...args], { cwd: options.cwd, encoding: "utf-8", maxBuffer: MAX_BUFFER, windowsHide: true }, (error, stdout, stderr) => {
|
|
37
|
+
running.delete(child);
|
|
38
|
+
if (error === null) {
|
|
39
|
+
resolvePromise({ stdout, stderr, exitCode: 0 });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const code = error.code;
|
|
43
|
+
if (code === "ENOENT") {
|
|
44
|
+
reject(new GhNotFoundError());
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (typeof code === "number") {
|
|
48
|
+
resolvePromise({ stdout, stderr, exitCode: code });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
reject(error);
|
|
52
|
+
});
|
|
53
|
+
running.add(child);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** The first non-empty line of `gh`'s stderr, for error messages and `failed(<reason>)`. */
|
|
57
|
+
export function firstLine(text) {
|
|
58
|
+
return (text
|
|
59
|
+
.split(/\r?\n/)
|
|
60
|
+
.map((l) => l.trim())
|
|
61
|
+
.find((l) => l.length > 0) ?? "");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse `gh api --paginate` output: one or more JSON values printed back to
|
|
65
|
+
* back. Current `gh` merges array pages into one array and prints object
|
|
66
|
+
* pages one after another (`}{`); older versions print arrays as `][`.
|
|
67
|
+
* Both are split here into the list of top-level values.
|
|
68
|
+
*/
|
|
69
|
+
export function parseJsonStream(text) {
|
|
70
|
+
const values = [];
|
|
71
|
+
let depth = 0;
|
|
72
|
+
let inString = false;
|
|
73
|
+
let escaped = false;
|
|
74
|
+
let start = -1;
|
|
75
|
+
for (let i = 0; i < text.length; i++) {
|
|
76
|
+
const ch = text[i];
|
|
77
|
+
if (inString) {
|
|
78
|
+
if (escaped)
|
|
79
|
+
escaped = false;
|
|
80
|
+
else if (ch === "\\")
|
|
81
|
+
escaped = true;
|
|
82
|
+
else if (ch === '"')
|
|
83
|
+
inString = false;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (ch === '"') {
|
|
87
|
+
inString = true;
|
|
88
|
+
if (depth === 0)
|
|
89
|
+
throw new SyntaxError(`unexpected string at offset ${i}`);
|
|
90
|
+
}
|
|
91
|
+
else if (ch === "[" || ch === "{") {
|
|
92
|
+
if (depth === 0)
|
|
93
|
+
start = i;
|
|
94
|
+
depth++;
|
|
95
|
+
}
|
|
96
|
+
else if (ch === "]" || ch === "}") {
|
|
97
|
+
depth--;
|
|
98
|
+
if (depth < 0)
|
|
99
|
+
throw new SyntaxError(`unbalanced JSON at offset ${i}`);
|
|
100
|
+
if (depth === 0)
|
|
101
|
+
values.push(JSON.parse(text.slice(start, i + 1)));
|
|
102
|
+
}
|
|
103
|
+
else if (depth === 0 && !/\s/.test(ch)) {
|
|
104
|
+
throw new SyntaxError(`unexpected character at offset ${i}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (depth !== 0 || inString)
|
|
108
|
+
throw new SyntaxError("truncated JSON");
|
|
109
|
+
return values;
|
|
110
|
+
}
|
|
111
|
+
/** Flatten paginated list output into its items (array pages, merged or not). */
|
|
112
|
+
export function paginatedItems(text) {
|
|
113
|
+
return parseJsonStream(text).flatMap((page) => (Array.isArray(page) ? page : [page]));
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=gh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh.js","sourceRoot":"","sources":["../../../core/migrate-projects/gh.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAqB,MAAM,oBAAoB,CAAC;AAgBjE,+DAA+D;AAC/D,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAOrC,uEAAuE;AACvE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAgB,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,OAAO,C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AK,EAAE,CAAC;YACR,IAAI,KAAK,GAAG,CAAC;gBAAE,MAAM,IAAI,WAAW,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;YACvE,IAAI,KAAK,KAAK,CAAC;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;aAAM,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,WAAW,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,IAAI,QAAQ;QAAE,MAAM,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type MigrationPlanClassification } from "./classify.js";
|
|
2
|
+
import { type PreviousAnswers } from "./answers.js";
|
|
3
|
+
import { type MigrationPlan } from "./planfile.js";
|
|
4
|
+
import { type MigrationSnapshot } from "./snapshot.js";
|
|
5
|
+
import { type MigrationPlanSummary } from "./summary.js";
|
|
6
|
+
import type { GhRunner } from "./gh.js";
|
|
7
|
+
import type { LocalReader } from "./local-reader.js";
|
|
8
|
+
export * from "./gh.js";
|
|
9
|
+
export * from "./local-reader.js";
|
|
10
|
+
export * from "./conventions.js";
|
|
11
|
+
export * from "./classify.js";
|
|
12
|
+
export * from "./snapshot.js";
|
|
13
|
+
export * from "./planfile.js";
|
|
14
|
+
export * from "./roadmap.js";
|
|
15
|
+
export * from "./map.js";
|
|
16
|
+
export * from "./answers.js";
|
|
17
|
+
export * from "./plan.js";
|
|
18
|
+
export * from "./summary.js";
|
|
19
|
+
export * from "./apply.js";
|
|
20
|
+
export declare const DEFAULT_PLAN_FILE = "workstream/migration-projects.md";
|
|
21
|
+
/** Where the plan file is read and written; injectable so tests stay in memory. */
|
|
22
|
+
export interface PlanFileStore {
|
|
23
|
+
read(path: string): string | undefined;
|
|
24
|
+
write(path: string, content: string): void;
|
|
25
|
+
}
|
|
26
|
+
/** The real store: paths resolve against `root`; writes go through a temp file and a rename. */
|
|
27
|
+
export declare function createPlanFileStore(resolvePath: (p: string) => string): PlanFileStore;
|
|
28
|
+
export interface MigrationPlanRunOptions {
|
|
29
|
+
runner: GhRunner;
|
|
30
|
+
reader: LocalReader;
|
|
31
|
+
/** `--repo`, checked against the working tree (A-52). */
|
|
32
|
+
repo?: string;
|
|
33
|
+
/** `--out`, as the user typed it. */
|
|
34
|
+
out: string;
|
|
35
|
+
/** The clock; `Generated:` is second precision. */
|
|
36
|
+
now: () => Date;
|
|
37
|
+
store: PlanFileStore;
|
|
38
|
+
}
|
|
39
|
+
export interface MigrationPlanRunResult {
|
|
40
|
+
exitCode: number;
|
|
41
|
+
repo: string | null;
|
|
42
|
+
planFile: string;
|
|
43
|
+
summary: MigrationPlanSummary | null;
|
|
44
|
+
/** Set on a non-zero exit: what went wrong and what to do. */
|
|
45
|
+
error?: string;
|
|
46
|
+
}
|
|
47
|
+
/** ISO-8601 UTC at second precision, the `Generated:` form. */
|
|
48
|
+
export declare function formatGenerated(d: Date): string;
|
|
49
|
+
/**
|
|
50
|
+
* The plan `--plan` writes for a snapshot: the review lists and batches 1
|
|
51
|
+
* to 7 (S-014), with the previous plan's answers applied before batching
|
|
52
|
+
* (A-50). Always `Approved: no`: the owner approves the plan as rebuilt.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildMigrationPlan(snapshot: MigrationSnapshot, classification: MigrationPlanClassification, now: Date, answers?: PreviousAnswers): MigrationPlan;
|
|
55
|
+
/** `migrate projects --plan`. Returns an exit code from `core/exit-codes.ts`; never throws for an expected failure. */
|
|
56
|
+
export declare function runMigrationPlan(options: MigrationPlanRunOptions): Promise<MigrationPlanRunResult>;
|
|
57
|
+
/** The one-screen plain-text summary (spec §10). */
|
|
58
|
+
export declare function formatMigrationPlanSummary(result: MigrationPlanRunResult): string;
|
|
59
|
+
/** The `--json` shape (A-64). */
|
|
60
|
+
export declare function migrationPlanJson(result: MigrationPlanRunResult): Record<string, unknown>;
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/migrate-projects/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAoB,KAAK,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAA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CA0DjC;AAED,oDAAoD;AACpD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAcjF;AAED,iCAAiC;AACjC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzF"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dev-tasks migrate projects` (D-79): the module entry.
|
|
3
|
+
*
|
|
4
|
+
* `--plan` reads a snapshot, classifies it, and writes the migration plan
|
|
5
|
+
* file. It never writes to GitHub (FR-17, AC-6), and the file never holds an
|
|
6
|
+
* issue body (spec §12). It maps stories to waves (FR-18), batches the
|
|
7
|
+
* writes the scope rules permit (FR-19, FR-20), and carries the owner's
|
|
8
|
+
* answers from the previous plan file into the next (S-014). `--apply`
|
|
9
|
+
* (S-015, `apply.ts`) is the only writer: it runs an approved plan's
|
|
10
|
+
* batches 1 to 6 and records each write's state in the plan file.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { dirname } from "node:path";
|
|
14
|
+
import { ExitCode } from "../exit-codes.js";
|
|
15
|
+
import { classifySnapshot } from "./classify.js";
|
|
16
|
+
import { emptyAnswers, readAnswers } from "./answers.js";
|
|
17
|
+
import { planMigration } from "./plan.js";
|
|
18
|
+
import { loadRoadmap } from "./roadmap.js";
|
|
19
|
+
import { MigrationPlanParseError, parseMigrationPlan, planHasNonPendingRows, renderMigrationPlan, } from "./planfile.js";
|
|
20
|
+
import { readSnapshot, snapshotHash, SnapshotError, SNAPSHOT_ERROR_EXIT, } from "./snapshot.js";
|
|
21
|
+
import { REVIEW_LABELS, summarizeMigrationPlan } from "./summary.js";
|
|
22
|
+
export * from "./gh.js";
|
|
23
|
+
export * from "./local-reader.js";
|
|
24
|
+
export * from "./conventions.js";
|
|
25
|
+
export * from "./classify.js";
|
|
26
|
+
export * from "./snapshot.js";
|
|
27
|
+
export * from "./planfile.js";
|
|
28
|
+
export * from "./roadmap.js";
|
|
29
|
+
export * from "./map.js";
|
|
30
|
+
export * from "./answers.js";
|
|
31
|
+
export * from "./plan.js";
|
|
32
|
+
export * from "./summary.js";
|
|
33
|
+
export * from "./apply.js";
|
|
34
|
+
export const DEFAULT_PLAN_FILE = "workstream/migration-projects.md";
|
|
35
|
+
/** The real store: paths resolve against `root`; writes go through a temp file and a rename. */
|
|
36
|
+
export function createPlanFileStore(resolvePath) {
|
|
37
|
+
return {
|
|
38
|
+
read(path) {
|
|
39
|
+
const full = resolvePath(path);
|
|
40
|
+
return existsSync(full) ? readFileSync(full, "utf-8") : undefined;
|
|
41
|
+
},
|
|
42
|
+
write(path, content) {
|
|
43
|
+
const full = resolvePath(path);
|
|
44
|
+
mkdirSync(dirname(full), { recursive: true });
|
|
45
|
+
const tmp = `${full}.tmp-${process.pid}`;
|
|
46
|
+
// Old or new content, never a truncated file (EC-140); a failed attempt leaves no temp file.
|
|
47
|
+
try {
|
|
48
|
+
writeFileSync(tmp, content);
|
|
49
|
+
renameSync(tmp, full);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
rmSync(tmp, { force: true });
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** ISO-8601 UTC at second precision, the `Generated:` form. */
|
|
59
|
+
export function formatGenerated(d) {
|
|
60
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The plan `--plan` writes for a snapshot: the review lists and batches 1
|
|
64
|
+
* to 7 (S-014), with the previous plan's answers applied before batching
|
|
65
|
+
* (A-50). Always `Approved: no`: the owner approves the plan as rebuilt.
|
|
66
|
+
*/
|
|
67
|
+
export function buildMigrationPlan(snapshot, classification, now, answers = emptyAnswers()) {
|
|
68
|
+
const roadmap = loadRoadmap(snapshot.roadmap);
|
|
69
|
+
const { review, batches } = planMigration({
|
|
70
|
+
snapshot,
|
|
71
|
+
classification,
|
|
72
|
+
rows: roadmap.ok ? roadmap.rows : [],
|
|
73
|
+
answers,
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
repo: snapshot.repo,
|
|
77
|
+
generated: formatGenerated(now),
|
|
78
|
+
snapshot: snapshotHash(snapshot),
|
|
79
|
+
approved: false,
|
|
80
|
+
extraHeaders: [],
|
|
81
|
+
review,
|
|
82
|
+
batches,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** `migrate projects --plan`. Returns an exit code from `core/exit-codes.ts`; never throws for an expected failure. */
|
|
86
|
+
export async function runMigrationPlan(options) {
|
|
87
|
+
const planFile = options.out;
|
|
88
|
+
let snapshot;
|
|
89
|
+
try {
|
|
90
|
+
snapshot = await readSnapshot({
|
|
91
|
+
runner: options.runner,
|
|
92
|
+
reader: options.reader,
|
|
93
|
+
repo: options.repo,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof SnapshotError) {
|
|
98
|
+
return {
|
|
99
|
+
exitCode: SNAPSHOT_ERROR_EXIT[err.kind],
|
|
100
|
+
repo: options.repo ?? null,
|
|
101
|
+
planFile,
|
|
102
|
+
summary: null,
|
|
103
|
+
error: err.message,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
// A-65: an applied record, or a file that is not a plan, is never overwritten.
|
|
109
|
+
// A draft's answers are read and applied before batching (A-50, task 4.7).
|
|
110
|
+
const existing = options.store.read(planFile);
|
|
111
|
+
let answers = emptyAnswers();
|
|
112
|
+
if (existing !== undefined) {
|
|
113
|
+
let refuse = null;
|
|
114
|
+
try {
|
|
115
|
+
const previous = parseMigrationPlan(existing).plan;
|
|
116
|
+
if (planHasNonPendingRows(previous)) {
|
|
117
|
+
refuse = `${planFile} records applied writes (a row is not pending); choose another --out`;
|
|
118
|
+
}
|
|
119
|
+
else if (previous.repo.toLowerCase() === snapshot.repo.toLowerCase()) {
|
|
120
|
+
answers = readAnswers(previous);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
if (!(err instanceof MigrationPlanParseError))
|
|
125
|
+
throw err;
|
|
126
|
+
refuse = `${planFile} exists and is not a migration plan (${err.message}); choose another --out`;
|
|
127
|
+
}
|
|
128
|
+
if (refuse !== null) {
|
|
129
|
+
return {
|
|
130
|
+
exitCode: ExitCode.ReconciliationConflict,
|
|
131
|
+
repo: snapshot.repo,
|
|
132
|
+
planFile,
|
|
133
|
+
summary: null,
|
|
134
|
+
error: refuse,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const plan = buildMigrationPlan(snapshot, classifySnapshot(snapshot), options.now(), answers);
|
|
139
|
+
options.store.write(planFile, renderMigrationPlan(plan));
|
|
140
|
+
return {
|
|
141
|
+
exitCode: ExitCode.Success,
|
|
142
|
+
repo: snapshot.repo,
|
|
143
|
+
planFile,
|
|
144
|
+
summary: summarizeMigrationPlan(plan),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/** The one-screen plain-text summary (spec §10). */
|
|
148
|
+
export function formatMigrationPlanSummary(result) {
|
|
149
|
+
if (result.summary === null)
|
|
150
|
+
return `migrate projects --plan: ${result.error ?? "failed"}`;
|
|
151
|
+
const s = result.summary;
|
|
152
|
+
const lines = [`Migration plan for ${result.repo}`, "", "Batches:"];
|
|
153
|
+
for (const b of s.batches) {
|
|
154
|
+
const rows = b.pending + b.done + b.failed + b.skipped;
|
|
155
|
+
lines.push(` ${b.key}. ${b.name} (${b.runner}): ${rows} ${rows === 1 ? "row" : "rows"}`);
|
|
156
|
+
}
|
|
157
|
+
lines.push("", "Needs your answer:");
|
|
158
|
+
for (const [k, label] of Object.entries(REVIEW_LABELS)) {
|
|
159
|
+
lines.push(` ${label}: ${s.review[k]}`);
|
|
160
|
+
}
|
|
161
|
+
lines.push("", `Plan file: ${result.planFile}`, `Next: ${s.next}`);
|
|
162
|
+
return lines.join("\n");
|
|
163
|
+
}
|
|
164
|
+
/** The `--json` shape (A-64). */
|
|
165
|
+
export function migrationPlanJson(result) {
|
|
166
|
+
return {
|
|
167
|
+
command: "migrate projects",
|
|
168
|
+
mode: "plan",
|
|
169
|
+
repo: result.repo,
|
|
170
|
+
planFile: result.planFile,
|
|
171
|
+
batches: (result.summary?.batches ?? []).map((b) => ({
|
|
172
|
+
name: b.name,
|
|
173
|
+
pending: b.pending,
|
|
174
|
+
done: b.done,
|
|
175
|
+
failed: b.failed,
|
|
176
|
+
skipped: b.skipped,
|
|
177
|
+
})),
|
|
178
|
+
review: result.summary?.review ?? null,
|
|
179
|
+
exitCode: result.exitCode,
|
|
180
|
+
...(result.error !== undefined ? { error: result.error } : {}),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/migrate-projects/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAoC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GAGpB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AC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface LocalReader {
|
|
2
|
+
/** The file's UTF-8 text, or `undefined` when it does not exist. Repository-relative path. */
|
|
3
|
+
readText(path: string): string | undefined;
|
|
4
|
+
/** Names of the regular files directly inside `dir` (not recursive), sorted; `[]` when absent. */
|
|
5
|
+
listFiles(dir: string): string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function createLocalReader(root: string): LocalReader;
|
|
8
|
+
//# sourceMappingURL=local-reader.d.ts.map
|