@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,638 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batches 1 to 7 of the migration plan (spec §8.3, FR-19, FR-20; §16a
|
|
3
|
+
* A-66, A-67, A-71, A-73, A-81 to A-84; D-19, D-27, D-73, D-81, D-82,
|
|
4
|
+
* D-87, D-91, D-92, D-97, D-103).
|
|
5
|
+
*
|
|
6
|
+
* Pure: it turns a snapshot, its classification, the roadmap rows and the
|
|
7
|
+
* owner's previous answers into review lists and write rows. It proposes
|
|
8
|
+
* only what the scope rules permit, and only what is not already so (A-66):
|
|
9
|
+
* a label that exists, a link that is present, a status row that is there
|
|
10
|
+
* produce no row, so re-planning after a full apply proposes no write.
|
|
11
|
+
*
|
|
12
|
+
* Never: a title edit (D-19), a hierarchy or `level:` write on a standalone
|
|
13
|
+
* issue (D-82), a Status write or any Project write (D-27, D-81), a relink
|
|
14
|
+
* of an issue that already has a parent, or a deleted label (D-91).
|
|
15
|
+
*
|
|
16
|
+
* Row grammar, which `--apply` (S-015) builds argv from. Target is
|
|
17
|
+
* `label:<name>`, `#<number>`, `W-<id>` for an issue this plan creates, or
|
|
18
|
+
* `new issue` on a create row. Detail by Action:
|
|
19
|
+
*
|
|
20
|
+
* | Action | Target | Detail |
|
|
21
|
+
* | ---------------- | ---------------- | ------------------------------------------------------- |
|
|
22
|
+
* | `create-label` | `label:<name>` | `color: <HEX>; description: <text>` |
|
|
23
|
+
* | `edit-label` | `label:<name>` | `description: <text>` |
|
|
24
|
+
* | `create-issue` | `new issue` | `template: prd\|wave; label: <level label>; title: <t>` |
|
|
25
|
+
* | `add-label` | `#N` or `W-<id>` | `<label name>` |
|
|
26
|
+
* | `remove-label` | `#N` | `<label name>` |
|
|
27
|
+
* | `link-sub-issue` | parent | `sub-issue <#N or W-id>` |
|
|
28
|
+
* | `add-blocked-by` | the blocked `#N` | `blocked by #<blocker>` |
|
|
29
|
+
* | `status-comment` | PRD `#N` or `W-` | `create: <rows>` or `add: <rows>`, rows `<wave> = <state>, <#N, W-id or —>` joined by `; ` |
|
|
30
|
+
*
|
|
31
|
+
* Batch 7 is the user's: printed steps, never run (D-81, D-97).
|
|
32
|
+
*/
|
|
33
|
+
import { isYes, informationKey, parseBlockingAnswer, parseTypeAnswer, parseUnmappedAnswer, } from "./answers.js";
|
|
34
|
+
import { findLabel, hasLabel, hasLabelPrefix, isRetiredLabel, sameLabel, LABEL_DESCRIPTION_MAX, LEVEL_DEFINITIONS, LEVEL_LABELS, PRIORITY_CRITICAL, PRIORITY_DEFINITIONS, PRIORITY_HIGH, RETIRED_DESCRIPTION_PREFIX, RETIRED_TYPE_LABELS, TYPE_COLORS, TYPE_DEFINITIONS, TYPE_LABEL_PREFIX, TYPE_SET, } from "./conventions.js";
|
|
35
|
+
import { issueKind, prdTitleForms, } from "./classify.js";
|
|
36
|
+
import { mapStory, titlePrd } from "./map.js";
|
|
37
|
+
import { emptyMigrationPlanBatches, formatWriteId, } from "./planfile.js";
|
|
38
|
+
import { roadmapPrds, stateFileWave, waveId } from "./roadmap.js";
|
|
39
|
+
/** GitHub-ops' title limit (§ Title Format). */
|
|
40
|
+
export const TITLE_MAX = 80;
|
|
41
|
+
const WRITE_TARGET_NEW = "new issue";
|
|
42
|
+
/**
|
|
43
|
+
* The retired form of a label description (D-91, A-82): `Retired (D-91): `
|
|
44
|
+
* in front, the whole cut from its end to GitHub's 100 characters. `null`
|
|
45
|
+
* when it is already marked (any `Retired (` lead), so it is never doubled.
|
|
46
|
+
*/
|
|
47
|
+
export function retiredDescription(description) {
|
|
48
|
+
if (description.startsWith("Retired ("))
|
|
49
|
+
return null;
|
|
50
|
+
return `${RETIRED_DESCRIPTION_PREFIX}${description}`.slice(0, LABEL_DESCRIPTION_MAX).trimEnd();
|
|
51
|
+
}
|
|
52
|
+
/** A wave tracking issue title from its roadmap row, cut at a word to 80 characters (A-84). */
|
|
53
|
+
export function waveTitle(prd, phase, scope) {
|
|
54
|
+
const head = `[PRD-${prd}] Wave ${phase}: `;
|
|
55
|
+
if (head.length + scope.length <= TITLE_MAX)
|
|
56
|
+
return head + scope;
|
|
57
|
+
let cut = scope.slice(0, TITLE_MAX - head.length - 1);
|
|
58
|
+
const space = cut.lastIndexOf(" ");
|
|
59
|
+
if (space > 0)
|
|
60
|
+
cut = cut.slice(0, space);
|
|
61
|
+
return `${head}${cut.replace(/[\s,;:—–-]+$/u, "")}…`;
|
|
62
|
+
}
|
|
63
|
+
/** A PRD tracking issue title: the shortest accepted form of the PRD file's H1 (A-53). */
|
|
64
|
+
export function prdTitle(name, h1) {
|
|
65
|
+
const forms = prdTitleForms(name, h1);
|
|
66
|
+
return `[PRD-${name}] ${forms[forms.length - 1]}`;
|
|
67
|
+
}
|
|
68
|
+
/** The github-ops PRD-table State for a roadmap row (A-67). */
|
|
69
|
+
export function prdState(row, hasWaveIssue) {
|
|
70
|
+
if (row.status === "Done")
|
|
71
|
+
return "shipped";
|
|
72
|
+
if (row.status === "In progress")
|
|
73
|
+
return "in progress";
|
|
74
|
+
return hasWaveIssue ? "published" : "not started";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Batch 7: the Project cleanup the user runs with their own session (D-81,
|
|
78
|
+
* D-96, D-97). The CLI never reads the Project, so the number stays `<n>`.
|
|
79
|
+
* This builder is the only place in the module that names these commands;
|
|
80
|
+
* PT-80 pins that, and nothing in the module runs them.
|
|
81
|
+
*/
|
|
82
|
+
export function projectCleanupSteps(owner) {
|
|
83
|
+
return [
|
|
84
|
+
`List the Project's pull-request items with your own session: gh project item-list <n> --owner ${owner} --limit 500 --format json --jq '.items[] | select(.content.type == "PullRequest") | .id' (<n> is the Project number)`,
|
|
85
|
+
`Delete each listed item: gh project item-delete <n> --owner ${owner} --id <item-id>`,
|
|
86
|
+
"On the Project's Workflows page, set the auto-add workflow's filter to `is:issue`, so pull requests are no longer added (FR-20)",
|
|
87
|
+
"On the Project's Workflows page, turn the default workflows back on (Item closed, Pull request merged), so Status follows issues and pull requests natively (D-27)",
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
// --- drafting -------------------------------------------------------------------
|
|
91
|
+
/** Placeholder for a row's ID inside a Target or Detail, resolved once every row is numbered. */
|
|
92
|
+
const ref = (key) => `\u0000${key}\u0000`;
|
|
93
|
+
class Drafts {
|
|
94
|
+
rows = [];
|
|
95
|
+
keys = new Set();
|
|
96
|
+
add(batch, action, target, detail, deps = [], key) {
|
|
97
|
+
const k = key ?? `${batch}:${this.rows.length}`;
|
|
98
|
+
this.rows.push({
|
|
99
|
+
key: k,
|
|
100
|
+
batch,
|
|
101
|
+
action,
|
|
102
|
+
target,
|
|
103
|
+
detail,
|
|
104
|
+
deps: deps.filter((d) => d !== null && this.keys.has(d)),
|
|
105
|
+
});
|
|
106
|
+
this.keys.add(k);
|
|
107
|
+
return k;
|
|
108
|
+
}
|
|
109
|
+
has(key) {
|
|
110
|
+
return this.keys.has(key);
|
|
111
|
+
}
|
|
112
|
+
/** The key, when that row exists; for dependencies on an optional create. */
|
|
113
|
+
ifAny(key) {
|
|
114
|
+
return this.keys.has(key) ? key : null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const labelKey = (name) => `label:${name}`;
|
|
118
|
+
const prdKey = (prd) => `create:prd:${prd}`;
|
|
119
|
+
const waveKey = (row) => `create:wave:${waveId(row)}`;
|
|
120
|
+
const refText = (r) => ("number" in r ? `#${r.number}` : ref(r.key));
|
|
121
|
+
const refDep = (r) => ("key" in r ? r.key : null);
|
|
122
|
+
export function planMigration(input) {
|
|
123
|
+
const { snapshot, classification, rows, answers } = input;
|
|
124
|
+
const owner = snapshot.repo.split("/")[0];
|
|
125
|
+
const drafts = new Drafts();
|
|
126
|
+
const information = [];
|
|
127
|
+
const roadmapNotes = [];
|
|
128
|
+
const info = (r, note) => {
|
|
129
|
+
information.push({
|
|
130
|
+
ref: r,
|
|
131
|
+
note,
|
|
132
|
+
answer: answers.information.get(informationKey(r, note)) ?? "",
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
for (const n of classification.information)
|
|
136
|
+
info(n.ref, n.note);
|
|
137
|
+
roadmapNotes.push(...classification.roadmap.map((r) => ({ ...r })));
|
|
138
|
+
const prdTitles = new Map(snapshot.prdFiles.filter((p) => p.h1 !== null).map((p) => [p.name, p.h1]));
|
|
139
|
+
const open = [...snapshot.openIssues].sort((a, b) => a.number - b.number);
|
|
140
|
+
const openByNumber = new Map(open.map((i) => [i.number, i]));
|
|
141
|
+
const kindOf = new Map(classification.issues.map((i) => [i.number, i.kind]));
|
|
142
|
+
// Keyed by lower case: GitHub label names are case-insensitive (D-106).
|
|
143
|
+
const labels = new Map(snapshot.labels.map((l) => [l.name.toLowerCase(), l]));
|
|
144
|
+
const prdKeys = roadmapPrds(rows);
|
|
145
|
+
// --- tracking issues (D-87, A-91) ---------------------------------------------
|
|
146
|
+
const openTracking = [];
|
|
147
|
+
for (const issue of open) {
|
|
148
|
+
const kind = kindOf.get(issue.number);
|
|
149
|
+
if (kind?.kind === "tracking")
|
|
150
|
+
openTracking.push({ issue, kind });
|
|
151
|
+
}
|
|
152
|
+
const closedTracking = [...snapshot.closedTrackingIssues]
|
|
153
|
+
.sort((a, b) => a.number - b.number)
|
|
154
|
+
.map((issue) => ({ issue, kind: issueKind(issue, prdTitles) }))
|
|
155
|
+
.filter((t) => t.kind.kind === "tracking");
|
|
156
|
+
const prdIssues = new Map();
|
|
157
|
+
const waveIssues = new Map();
|
|
158
|
+
const closedWave = new Map();
|
|
159
|
+
const push = (m, k, n) => m.set(k, [...(m.get(k) ?? []), n]);
|
|
160
|
+
for (const t of openTracking) {
|
|
161
|
+
if (t.kind.level === "prd")
|
|
162
|
+
push(prdIssues, t.kind.prd, t.issue.number);
|
|
163
|
+
else if (t.kind.wave !== null)
|
|
164
|
+
push(waveIssues, `${t.kind.prd} ${t.kind.wave}`, t.issue.number);
|
|
165
|
+
else
|
|
166
|
+
info(`#${t.issue.number}`, "wave tracking issue without `Wave <id>:` in its title; it matches no roadmap row");
|
|
167
|
+
if (!prdKeys.includes(t.kind.prd)) {
|
|
168
|
+
roadmapNotes.push({
|
|
169
|
+
row: `#${t.issue.number}`,
|
|
170
|
+
note: `tracking issue for PRD ${t.kind.prd}, which no roadmap row has`,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else if (t.kind.level === "wave" &&
|
|
174
|
+
t.kind.wave !== null &&
|
|
175
|
+
!rows.some((r) => r.prd === t.kind.prd && r.phase === t.kind.wave)) {
|
|
176
|
+
roadmapNotes.push({
|
|
177
|
+
row: `#${t.issue.number}`,
|
|
178
|
+
note: `wave tracking issue for ${t.kind.prd} ${t.kind.wave}, which no roadmap row has`,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** Every closed wave issue per wave id (D-108). */
|
|
183
|
+
const closedWaves = new Map();
|
|
184
|
+
for (const t of closedTracking) {
|
|
185
|
+
if (t.kind.level === "wave" && t.kind.wave !== null) {
|
|
186
|
+
const k = `${t.kind.prd} ${t.kind.wave}`;
|
|
187
|
+
closedWaves.set(k, (closedWaves.get(k) ?? new Set()).add(t.issue.number));
|
|
188
|
+
if (!closedWave.has(k))
|
|
189
|
+
closedWave.set(k, t.issue.number);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Two matches stop that PRD (D-87, D-36): listed, every row omitted.
|
|
193
|
+
const omitted = new Set();
|
|
194
|
+
for (const [prd, numbers] of [...prdIssues].sort(([a], [b]) => (a < b ? -1 : 1))) {
|
|
195
|
+
if (numbers.length > 1) {
|
|
196
|
+
omitted.add(prd);
|
|
197
|
+
info(`[PRD-${prd}]`, `two PRD tracking issues match (${numbers.map((n) => `#${n}`).join(", ")}); this PRD's batches are omitted until one remains (D-87)`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
for (const [wave, numbers] of [...waveIssues].sort(([a], [b]) => (a < b ? -1 : 1))) {
|
|
201
|
+
if (numbers.length > 1) {
|
|
202
|
+
const prd = wave.slice(0, wave.lastIndexOf(" "));
|
|
203
|
+
omitted.add(prd);
|
|
204
|
+
info(`[PRD-${prd}]`, `two wave tracking issues match ${wave} (${numbers.map((n) => `#${n}`).join(", ")}); this PRD's batches are omitted until one remains (D-87)`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const openPrdIssue = (prd) => prdIssues.get(prd)?.length === 1 ? prdIssues.get(prd)[0] : null;
|
|
208
|
+
const openWaveIssue = (row) => {
|
|
209
|
+
const n = waveIssues.get(waveId(row));
|
|
210
|
+
return n?.length === 1 ? n[0] : null;
|
|
211
|
+
};
|
|
212
|
+
// --- mapping (FR-18) and the unmapped list ----------------------------------------
|
|
213
|
+
const review = {
|
|
214
|
+
unmapped: [],
|
|
215
|
+
needsType: [],
|
|
216
|
+
needsBlockingLink: [],
|
|
217
|
+
stateFiles: classification.stateFiles.map((s) => ({ ...s })),
|
|
218
|
+
roadmap: roadmapNotes,
|
|
219
|
+
information,
|
|
220
|
+
};
|
|
221
|
+
const mapped = [];
|
|
222
|
+
/** Issues whose PRD is omitted: no row targets them (MU-53). */
|
|
223
|
+
const untouchable = new Set();
|
|
224
|
+
const listed = {
|
|
225
|
+
unmapped: new Set(),
|
|
226
|
+
needsType: new Set(),
|
|
227
|
+
needsBlockingLink: new Set(),
|
|
228
|
+
};
|
|
229
|
+
for (const issue of open) {
|
|
230
|
+
const kind = kindOf.get(issue.number);
|
|
231
|
+
if (kind?.kind === "tracking" && omitted.has(kind.prd))
|
|
232
|
+
untouchable.add(issue.number);
|
|
233
|
+
if (kind?.kind !== "story")
|
|
234
|
+
continue;
|
|
235
|
+
const result = mapStory({
|
|
236
|
+
number: issue.number,
|
|
237
|
+
title: issue.title,
|
|
238
|
+
labels: issue.labels,
|
|
239
|
+
milestone: issue.milestone,
|
|
240
|
+
storyRef: kind.storyRef,
|
|
241
|
+
}, rows);
|
|
242
|
+
const prefix = titlePrd(issue.title);
|
|
243
|
+
if (result.mapped) {
|
|
244
|
+
if (omitted.has(result.row.prd)) {
|
|
245
|
+
untouchable.add(issue.number);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
for (const n of result.notes)
|
|
249
|
+
info(`#${issue.number}`, n);
|
|
250
|
+
mapped.push({ issue, row: result.row });
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
if (prefix !== null && omitted.has(prefix)) {
|
|
254
|
+
untouchable.add(issue.number);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
listed.unmapped.add(issue.number);
|
|
258
|
+
const typed = answers.unmapped.get(issue.number) ?? "";
|
|
259
|
+
const answer = parseUnmappedAnswer(typed, rows);
|
|
260
|
+
if (answer.kind === "wave" && !omitted.has(answer.row.prd)) {
|
|
261
|
+
mapped.push({ issue, row: answer.row });
|
|
262
|
+
review.unmapped.push({
|
|
263
|
+
issue: issue.number,
|
|
264
|
+
title: issue.title,
|
|
265
|
+
why: result.reason,
|
|
266
|
+
answer: typed,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
else if (answer.kind === "standalone") {
|
|
270
|
+
review.unmapped.push({
|
|
271
|
+
issue: issue.number,
|
|
272
|
+
title: issue.title,
|
|
273
|
+
why: result.reason,
|
|
274
|
+
answer: typed,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
else if (answer.kind === "wave") {
|
|
278
|
+
// F-3: a real wave of an omitted PRD; the answer stands for when one issue remains.
|
|
279
|
+
review.unmapped.push({
|
|
280
|
+
issue: issue.number,
|
|
281
|
+
title: issue.title,
|
|
282
|
+
why: `names wave ${waveId(answer.row)} of PRD ${answer.row.prd}, whose batches are omitted (D-87); ${result.reason}`,
|
|
283
|
+
answer: typed,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
else if (answer.kind === "invalid") {
|
|
287
|
+
review.unmapped.push({
|
|
288
|
+
issue: issue.number,
|
|
289
|
+
title: issue.title,
|
|
290
|
+
why: `invalid answer "${typed}": not a roadmap wave id (\`<PRD> <Phase/Wave>\`) or "standalone"; ${result.reason}`,
|
|
291
|
+
answer: "",
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
review.unmapped.push({
|
|
296
|
+
issue: issue.number,
|
|
297
|
+
title: issue.title,
|
|
298
|
+
why: result.reason,
|
|
299
|
+
answer: "",
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
// --- needs a type (D-85) ------------------------------------------------------------
|
|
304
|
+
const typeAnswers = [];
|
|
305
|
+
for (const n of classification.needsType) {
|
|
306
|
+
listed.needsType.add(n.issue);
|
|
307
|
+
const typed = answers.needsType.get(n.issue) ?? "";
|
|
308
|
+
const t = parseTypeAnswer(typed);
|
|
309
|
+
let answer = typed;
|
|
310
|
+
if (t === "invalid") {
|
|
311
|
+
answer = "";
|
|
312
|
+
info(`#${n.issue}`, `invalid answer "${typed}": not one of the eight types (D-85)`);
|
|
313
|
+
}
|
|
314
|
+
else if (t !== null && !untouchable.has(n.issue)) {
|
|
315
|
+
typeAnswers.push({ issue: n.issue, type: t });
|
|
316
|
+
}
|
|
317
|
+
review.needsType.push({
|
|
318
|
+
issue: n.issue,
|
|
319
|
+
title: n.title,
|
|
320
|
+
currentTypeLabels: n.currentTypeLabels,
|
|
321
|
+
suggested: n.suggested,
|
|
322
|
+
answer,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
// --- needs a blocking link (D-84, A-73) -------------------------------------------
|
|
326
|
+
const blockingAnswers = [];
|
|
327
|
+
for (const n of classification.needsBlockingLink) {
|
|
328
|
+
listed.needsBlockingLink.add(n.issue);
|
|
329
|
+
const typed = answers.needsBlockingLink.get(n.issue) ?? "";
|
|
330
|
+
const a = parseBlockingAnswer(typed);
|
|
331
|
+
let answer = typed;
|
|
332
|
+
const invalid = (why) => {
|
|
333
|
+
answer = "";
|
|
334
|
+
info(`#${n.issue}`, `invalid answer "${typed}": ${why}`);
|
|
335
|
+
};
|
|
336
|
+
if (a.kind === "invalid")
|
|
337
|
+
invalid('not "#<issue it blocks>" or "lower priority to high"');
|
|
338
|
+
else if (a.kind === "blocks" && (!openByNumber.has(a.issue) || a.issue === n.issue)) {
|
|
339
|
+
invalid(a.issue === n.issue ? "an issue cannot block itself" : `#${a.issue} is not an open issue`);
|
|
340
|
+
}
|
|
341
|
+
else if (a.kind === "blocks" && !untouchable.has(n.issue))
|
|
342
|
+
blockingAnswers.push({ issue: n.issue, blocks: a.issue });
|
|
343
|
+
else if (a.kind === "lower" && !untouchable.has(n.issue))
|
|
344
|
+
blockingAnswers.push({ issue: n.issue, blocks: null });
|
|
345
|
+
review.needsBlockingLink.push({ issue: n.issue, title: n.title, priority: n.priority, answer });
|
|
346
|
+
}
|
|
347
|
+
// MU-57: an answer whose item is gone is dropped and reported.
|
|
348
|
+
for (const [list, m] of [
|
|
349
|
+
["unmapped", answers.unmapped],
|
|
350
|
+
["needsType", answers.needsType],
|
|
351
|
+
["needsBlockingLink", answers.needsBlockingLink],
|
|
352
|
+
]) {
|
|
353
|
+
for (const [issue, typed] of [...m].sort(([a], [b]) => a - b)) {
|
|
354
|
+
if (!listed[list].has(issue))
|
|
355
|
+
info(`#${issue}`, `answer \`${typed}\` dropped: the issue is no longer open or no longer needs it`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// --- scope: which waves and PRDs get tracking issues (FR-19, A-83) -------------------
|
|
359
|
+
const activeWaves = new Set();
|
|
360
|
+
for (const s of snapshot.stateFiles) {
|
|
361
|
+
const w = stateFileWave(s.path);
|
|
362
|
+
if (w !== null)
|
|
363
|
+
activeWaves.add(waveId({ prd: w.prd, phase: w.phase ?? "All" }));
|
|
364
|
+
}
|
|
365
|
+
const mappedByRow = new Map();
|
|
366
|
+
for (const m of mapped)
|
|
367
|
+
mappedByRow.set(m.row, [...(mappedByRow.get(m.row) ?? []), m.issue]);
|
|
368
|
+
const waveRef = new Map();
|
|
369
|
+
const needsWave = [];
|
|
370
|
+
for (const row of rows) {
|
|
371
|
+
if (omitted.has(row.prd))
|
|
372
|
+
continue;
|
|
373
|
+
const stories = mappedByRow.get(row) ?? [];
|
|
374
|
+
const existing = openWaveIssue(row);
|
|
375
|
+
if (row.status === "Done") {
|
|
376
|
+
for (const s of stories) {
|
|
377
|
+
info(`#${s.number}`, `roadmap row ${waveId(row)} is \`Done\` but this story is open; a shipped wave gets no wave issue and no link (A-83)`);
|
|
378
|
+
}
|
|
379
|
+
if (existing !== null)
|
|
380
|
+
waveRef.set(row, { number: existing });
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
// D-108: a story under a closed wave issue of its own row is never
|
|
384
|
+
// relinked, so it alone never calls for a new wave issue.
|
|
385
|
+
const closedOwn = closedWaves.get(waveId(row)) ?? new Set();
|
|
386
|
+
for (const s of stories) {
|
|
387
|
+
if (s.parent != null && closedOwn.has(s.parent)) {
|
|
388
|
+
info(`#${s.number}`, `parent #${s.parent} is a closed wave issue; never relinked`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (existing !== null) {
|
|
392
|
+
waveRef.set(row, { number: existing });
|
|
393
|
+
}
|
|
394
|
+
else if (stories.some((s) => (s.parent ?? null) === null) || activeWaves.has(waveId(row))) {
|
|
395
|
+
needsWave.push(row);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
const prdNames = [...new Set([...prdKeys, ...snapshot.prdFiles.map((p) => p.name).sort()])];
|
|
399
|
+
const prdRef = new Map();
|
|
400
|
+
const prdNeeded = new Set();
|
|
401
|
+
for (const prd of prdNames) {
|
|
402
|
+
if (omitted.has(prd))
|
|
403
|
+
continue;
|
|
404
|
+
const hasMapped = mapped.some((m) => m.row.prd === prd);
|
|
405
|
+
const hasWave = needsWave.some((r) => r.prd === prd);
|
|
406
|
+
const existing = openPrdIssue(prd);
|
|
407
|
+
if (existing !== null) {
|
|
408
|
+
prdRef.set(prd, { number: existing });
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
const question = "no mapped story and no open PRD tracking issue; answer `yes` to create its PRD tracking issue (A-83)";
|
|
412
|
+
if (hasMapped || hasWave)
|
|
413
|
+
prdNeeded.add(prd);
|
|
414
|
+
else if (snapshot.prdFiles.some((p) => p.name === prd)) {
|
|
415
|
+
if (isYes(answers.information.get(informationKey(`[PRD-${prd}]`, question))))
|
|
416
|
+
prdNeeded.add(prd);
|
|
417
|
+
info(`[PRD-${prd}]`, question);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// --- batch 1: labels (A-71, A-82, D-103) ---------------------------------------------
|
|
421
|
+
const needHigh = blockingAnswers.some((b) => b.blocks === null);
|
|
422
|
+
const createLabel = (name, d) => {
|
|
423
|
+
if (!labels.has(name.toLowerCase()))
|
|
424
|
+
drafts.add("1", "create-label", `label:${name}`, `color: ${d.color}; description: ${d.description}`, [], labelKey(name));
|
|
425
|
+
};
|
|
426
|
+
for (const [name, d] of Object.entries(LEVEL_DEFINITIONS))
|
|
427
|
+
createLabel(name, d);
|
|
428
|
+
for (const t of TYPE_SET)
|
|
429
|
+
createLabel(`${TYPE_LABEL_PREFIX}${t}`, {
|
|
430
|
+
color: TYPE_COLORS[t],
|
|
431
|
+
description: TYPE_DEFINITIONS[t],
|
|
432
|
+
});
|
|
433
|
+
if (needHigh)
|
|
434
|
+
createLabel(PRIORITY_HIGH, PRIORITY_DEFINITIONS[PRIORITY_HIGH]);
|
|
435
|
+
const editDescription = (name, description) => {
|
|
436
|
+
const l = labels.get(name.toLowerCase());
|
|
437
|
+
if (l !== undefined && l.description !== description)
|
|
438
|
+
drafts.add("1", "edit-label", `label:${l.name}`, `description: ${description}`);
|
|
439
|
+
};
|
|
440
|
+
for (const t of TYPE_SET)
|
|
441
|
+
editDescription(`${TYPE_LABEL_PREFIX}${t}`, TYPE_DEFINITIONS[t]);
|
|
442
|
+
for (const [name, d] of Object.entries(PRIORITY_DEFINITIONS))
|
|
443
|
+
editDescription(name, d.description);
|
|
444
|
+
for (const l of [...snapshot.labels].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
445
|
+
if (!isRetiredLabel(l.name))
|
|
446
|
+
continue;
|
|
447
|
+
const d = retiredDescription(l.description);
|
|
448
|
+
if (d !== null)
|
|
449
|
+
drafts.add("1", "edit-label", `label:${l.name}`, `description: ${d}`);
|
|
450
|
+
}
|
|
451
|
+
// --- batch 2: tracking issues (FR-19, A-84) ------------------------------------------
|
|
452
|
+
for (const prd of prdNames) {
|
|
453
|
+
if (!prdNeeded.has(prd))
|
|
454
|
+
continue;
|
|
455
|
+
const h1 = prdTitles.get(prd);
|
|
456
|
+
if (h1 === undefined) {
|
|
457
|
+
info(`[PRD-${prd}]`, `no \`docs/requirements/prd-${prd}.md\` heading to title its PRD tracking issue; none is created`);
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
const title = prdTitle(prd, h1);
|
|
461
|
+
if (title.length > TITLE_MAX) {
|
|
462
|
+
// D-109: never created over github-ops' limit, and never cut: the owner shortens the H1.
|
|
463
|
+
info(`[PRD-${prd}]`, `its PRD tracking issue title would be ${title.length} characters, over github-ops' ${TITLE_MAX}-character limit; shorten the H1 of \`docs/requirements/prd-${prd}.md\` (D-109)`);
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const closed = closedTracking.find((t) => t.kind.level === "prd" && t.kind.prd === prd);
|
|
467
|
+
if (closed !== undefined)
|
|
468
|
+
info(`#${closed.issue.number}`, `closed PRD tracking issue for ${prd}; a closed tracking issue is never a parent, so a new one is created (A-91)`);
|
|
469
|
+
const key = drafts.add("2", "create-issue", WRITE_TARGET_NEW, `template: prd; label: ${LEVEL_LABELS.prd}; title: ${title}`, [drafts.ifAny(labelKey(LEVEL_LABELS.prd))], prdKey(prd));
|
|
470
|
+
prdRef.set(prd, { key });
|
|
471
|
+
}
|
|
472
|
+
for (const row of needsWave) {
|
|
473
|
+
if (!prdRef.has(row.prd)) {
|
|
474
|
+
info(`[PRD-${row.prd}]`, `wave ${waveId(row)} needs a wave issue, but the PRD has no tracking issue to hold it; none is created`);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
if (/[\s:]/.test(row.phase)) {
|
|
478
|
+
info(`[PRD-${row.prd}]`, `wave ${waveId(row)}: a \`Phase/Wave\` cell with a space or colon cannot form a \`Wave <id>:\` title; none is created`);
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
const closed = closedWave.get(waveId(row));
|
|
482
|
+
if (closed !== undefined)
|
|
483
|
+
info(`#${closed}`, `closed wave tracking issue for ${waveId(row)}; a closed tracking issue is never a parent, so a new one is created (A-91)`);
|
|
484
|
+
const key = drafts.add("2", "create-issue", WRITE_TARGET_NEW, `template: wave; label: ${LEVEL_LABELS.wave}; title: ${waveTitle(row.prd, row.phase, row.scope)}`, [drafts.ifAny(labelKey(LEVEL_LABELS.wave))], waveKey(row));
|
|
485
|
+
waveRef.set(row, { key });
|
|
486
|
+
}
|
|
487
|
+
// --- batch 3: hierarchy, skipping links present, never relinking (A-76) ------------
|
|
488
|
+
const trackingNumbers = new Set([...openTracking, ...closedTracking].map((t) => t.issue.number));
|
|
489
|
+
for (const row of rows) {
|
|
490
|
+
const w = waveRef.get(row);
|
|
491
|
+
const p = prdRef.get(row.prd);
|
|
492
|
+
if (w === undefined || p === undefined)
|
|
493
|
+
continue;
|
|
494
|
+
if ("number" in w) {
|
|
495
|
+
const parent = openByNumber.get(w.number)?.parent ?? null;
|
|
496
|
+
if (parent !== null) {
|
|
497
|
+
if (!("number" in p) || parent !== p.number) {
|
|
498
|
+
info(`#${w.number}`, `wave maps to PRD ${row.prd} (${refText(p)}) but its parent is #${parent}; it is never relinked`);
|
|
499
|
+
}
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
drafts.add("3", "link-sub-issue", refText(p), `sub-issue ${refText(w)}`, [
|
|
504
|
+
refDep(p),
|
|
505
|
+
refDep(w),
|
|
506
|
+
]);
|
|
507
|
+
}
|
|
508
|
+
for (const m of mapped) {
|
|
509
|
+
const w = waveRef.get(m.row);
|
|
510
|
+
if (w === undefined || m.row.status === "Done")
|
|
511
|
+
continue;
|
|
512
|
+
const parent = m.issue.parent ?? null;
|
|
513
|
+
if (parent !== null) {
|
|
514
|
+
const same = "number" in w && parent === w.number;
|
|
515
|
+
const closedOwn = closedWaves.get(waveId(m.row))?.has(parent) ?? false;
|
|
516
|
+
if (!same && !closedOwn && trackingNumbers.has(parent)) {
|
|
517
|
+
info(`#${m.issue.number}`, `story maps to ${waveId(m.row)} (${refText(w)}) but its parent is #${parent}; it is never relinked`);
|
|
518
|
+
}
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
drafts.add("3", "link-sub-issue", refText(w), `sub-issue #${m.issue.number}`, [refDep(w)]);
|
|
522
|
+
}
|
|
523
|
+
// --- batch 4: level and type labels (D-87, MU-56) ------------------------------------
|
|
524
|
+
const removed = new Set();
|
|
525
|
+
const remove = (batch, issue, label) => {
|
|
526
|
+
removed.add(`${issue}\u0000${label.toLowerCase()}`);
|
|
527
|
+
drafts.add(batch, "remove-label", `#${issue}`, label);
|
|
528
|
+
};
|
|
529
|
+
for (const t of openTracking) {
|
|
530
|
+
if (omitted.has(t.kind.prd))
|
|
531
|
+
continue;
|
|
532
|
+
const level = t.kind.level === "prd" ? LEVEL_LABELS.prd : LEVEL_LABELS.wave;
|
|
533
|
+
if (!hasLabel(t.issue.labels, level))
|
|
534
|
+
drafts.add("4", "add-label", `#${t.issue.number}`, level, [drafts.ifAny(labelKey(level))]);
|
|
535
|
+
for (const l of [...t.issue.labels].sort()) {
|
|
536
|
+
if (RETIRED_TYPE_LABELS.some((r) => sameLabel(r, l)))
|
|
537
|
+
remove("4", t.issue.number, l);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
for (const m of [...mapped].sort((a, b) => a.issue.number - b.issue.number)) {
|
|
541
|
+
if (!hasLabel(m.issue.labels, LEVEL_LABELS.story)) {
|
|
542
|
+
drafts.add("4", "add-label", `#${m.issue.number}`, LEVEL_LABELS.story, [
|
|
543
|
+
drafts.ifAny(labelKey(LEVEL_LABELS.story)),
|
|
544
|
+
]);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
for (const a of typeAnswers) {
|
|
548
|
+
const issue = openByNumber.get(a.issue);
|
|
549
|
+
const label = `${TYPE_LABEL_PREFIX}${a.type}`;
|
|
550
|
+
if (!hasLabel(issue.labels, label))
|
|
551
|
+
drafts.add("4", "add-label", `#${a.issue}`, label, [drafts.ifAny(labelKey(label))]);
|
|
552
|
+
for (const l of [...issue.labels].sort()) {
|
|
553
|
+
if (hasLabelPrefix(l, TYPE_LABEL_PREFIX) && !sameLabel(l, label))
|
|
554
|
+
remove("4", a.issue, l);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
// --- batch 4b: blocking links and priorities (A-73) ---------------------------------
|
|
558
|
+
for (const b of blockingAnswers) {
|
|
559
|
+
if (b.blocks !== null)
|
|
560
|
+
drafts.add("4b", "add-blocked-by", `#${b.blocks}`, `blocked by #${b.issue}`);
|
|
561
|
+
else {
|
|
562
|
+
const issue = openByNumber.get(b.issue);
|
|
563
|
+
if (!hasLabel(issue.labels, PRIORITY_HIGH))
|
|
564
|
+
drafts.add("4b", "add-label", `#${b.issue}`, PRIORITY_HIGH, [
|
|
565
|
+
drafts.ifAny(labelKey(PRIORITY_HIGH)),
|
|
566
|
+
]);
|
|
567
|
+
remove("4b", b.issue, findLabel(issue.labels, PRIORITY_CRITICAL) ?? PRIORITY_CRITICAL);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
// --- batch 5: retired labels, open issues only, definitions kept (D-91) -------------
|
|
571
|
+
for (const issue of open) {
|
|
572
|
+
if (untouchable.has(issue.number))
|
|
573
|
+
continue;
|
|
574
|
+
for (const l of [...issue.labels].sort()) {
|
|
575
|
+
if (isRetiredLabel(l) && !removed.has(`${issue.number}\u0000${l.toLowerCase()}`))
|
|
576
|
+
drafts.add("5", "remove-label", `#${issue.number}`, l);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
// --- batch 6: PRD status comments, create or add missing rows (D-92, D-73, A-67) ------
|
|
580
|
+
for (const prd of prdNames) {
|
|
581
|
+
const p = prdRef.get(prd);
|
|
582
|
+
if (p === undefined)
|
|
583
|
+
continue;
|
|
584
|
+
const prdRows = rows.filter((r) => r.prd === prd);
|
|
585
|
+
if (prdRows.length === 0)
|
|
586
|
+
continue;
|
|
587
|
+
const comment = "number" in p ? (openByNumber.get(p.number)?.statusComment ?? null) : null;
|
|
588
|
+
if (comment !== null && comment.markers > 1) {
|
|
589
|
+
info(`#${p.number}`, `${comment.markers} comments carry the status marker; batch 6 edits the oldest (${comment.id}); remove the others`);
|
|
590
|
+
}
|
|
591
|
+
const present = new Set((comment?.rows ?? []).map((r) => r.wave));
|
|
592
|
+
const deps = [refDep(p)];
|
|
593
|
+
const cells = [];
|
|
594
|
+
for (const row of prdRows) {
|
|
595
|
+
if (present.has(row.phase))
|
|
596
|
+
continue;
|
|
597
|
+
const w = waveRef.get(row);
|
|
598
|
+
const closed = closedWave.get(waveId(row));
|
|
599
|
+
const issueText = w !== undefined ? refText(w) : closed !== undefined ? `#${closed}` : "—";
|
|
600
|
+
if (w !== undefined)
|
|
601
|
+
deps.push(refDep(w));
|
|
602
|
+
cells.push(`${row.phase} = ${prdState(row, w !== undefined || closed !== undefined)}, ${issueText}`);
|
|
603
|
+
}
|
|
604
|
+
if (cells.length === 0)
|
|
605
|
+
continue;
|
|
606
|
+
drafts.add("6", "status-comment", refText(p), `${comment === null ? "create" : "add"}: ${cells.join("; ")}`, deps);
|
|
607
|
+
}
|
|
608
|
+
// --- numbering ------------------------------------------------------------------------
|
|
609
|
+
const steps = projectCleanupSteps(owner);
|
|
610
|
+
const total = drafts.rows.length + steps.length;
|
|
611
|
+
const ids = new Map();
|
|
612
|
+
const batches = emptyMigrationPlanBatches();
|
|
613
|
+
const order = batches.map((b) => b.key);
|
|
614
|
+
const sorted = [...drafts.rows].sort((a, b) => order.indexOf(a.batch) - order.indexOf(b.batch));
|
|
615
|
+
sorted.forEach((d, i) => ids.set(d.key, formatWriteId(i + 1, total)));
|
|
616
|
+
const resolve = (text) => text.replace(/\u0000([^\u0000]+)\u0000/g, (_, k) => ids.get(k));
|
|
617
|
+
for (const d of sorted) {
|
|
618
|
+
batches
|
|
619
|
+
.find((b) => b.key === d.batch)
|
|
620
|
+
.writes.push({
|
|
621
|
+
id: ids.get(d.key),
|
|
622
|
+
action: d.action,
|
|
623
|
+
target: resolve(d.target),
|
|
624
|
+
detail: resolve(d.detail),
|
|
625
|
+
dependsOn: [...new Set(d.deps)].map((k) => ids.get(k)),
|
|
626
|
+
state: "pending",
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
batches.find((b) => b.runner === "user").steps = steps.map((step, i) => ({
|
|
630
|
+
id: formatWriteId(sorted.length + i + 1, total),
|
|
631
|
+
step,
|
|
632
|
+
state: "pending",
|
|
633
|
+
}));
|
|
634
|
+
for (const n of review.information)
|
|
635
|
+
n.note = resolve(n.note);
|
|
636
|
+
return { review, batches };
|
|
637
|
+
}
|
|
638
|
+
//# sourceMappingURL=plan.js.map
|