@refrakt-md/plan 0.26.0 → 0.29.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/dist/cli-plugin.d.ts.map +1 -1
- package/dist/cli-plugin.js +75 -4
- package/dist/cli-plugin.js.map +1 -1
- package/dist/commands/enums.d.ts +48 -0
- package/dist/commands/enums.d.ts.map +1 -1
- package/dist/commands/enums.js +99 -9
- package/dist/commands/enums.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +18 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +65 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +246 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +15 -33
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/render-pipeline.d.ts +7 -0
- package/dist/commands/render-pipeline.d.ts.map +1 -1
- package/dist/commands/render-pipeline.js +24 -30
- package/dist/commands/render-pipeline.js.map +1 -1
- package/dist/commands/status.d.ts +15 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +48 -8
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +105 -13
- package/dist/commands/validate.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -7
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-bindings.d.ts.map +1 -1
- package/dist/mcp-bindings.js +27 -14
- package/dist/mcp-bindings.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +94 -19
- package/dist/pipeline.js.map +1 -1
- package/dist/relationships.d.ts +2 -2
- package/dist/relationships.d.ts.map +1 -1
- package/dist/relationships.js +27 -2
- package/dist/relationships.js.map +1 -1
- package/dist/scanner-core.d.ts +13 -0
- package/dist/scanner-core.d.ts.map +1 -1
- package/dist/scanner-core.js +64 -2
- package/dist/scanner-core.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +14 -4
- package/dist/scanner.js.map +1 -1
- package/dist/tags/bug.d.ts.map +1 -1
- package/dist/tags/bug.js +13 -5
- package/dist/tags/bug.js.map +1 -1
- package/dist/tags/decision.d.ts.map +1 -1
- package/dist/tags/decision.js +2 -2
- package/dist/tags/decision.js.map +1 -1
- package/dist/tags/milestone.d.ts.map +1 -1
- package/dist/tags/milestone.js +2 -2
- package/dist/tags/milestone.js.map +1 -1
- package/dist/tags/spec.d.ts.map +1 -1
- package/dist/tags/spec.js +6 -3
- package/dist/tags/spec.js.map +1 -1
- package/dist/tags/work.d.ts.map +1 -1
- package/dist/tags/work.js +16 -9
- package/dist/tags/work.js.map +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +6 -1
- package/dist/util.js.map +1 -1
- package/package.json +8 -8
|
@@ -37,4 +37,69 @@ export interface MigrateFilenamesResult {
|
|
|
37
37
|
* counted as `alreadyCorrect` and not touched.
|
|
38
38
|
*/
|
|
39
39
|
export declare function runMigrateFilenames(options: MigrateFilenamesOptions): MigrateFilenamesResult;
|
|
40
|
+
export interface MigratePrAttrsOptions {
|
|
41
|
+
dir: string;
|
|
42
|
+
apply?: boolean;
|
|
43
|
+
useGit?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface PrResolution {
|
|
46
|
+
id: string;
|
|
47
|
+
file: string;
|
|
48
|
+
pr: string;
|
|
49
|
+
}
|
|
50
|
+
export interface PrUnresolved {
|
|
51
|
+
id: string;
|
|
52
|
+
file: string;
|
|
53
|
+
reason: string;
|
|
54
|
+
}
|
|
55
|
+
export interface MigratePrAttrsResult {
|
|
56
|
+
mode: 'dry-run' | 'apply';
|
|
57
|
+
scanned: number;
|
|
58
|
+
repoSlug: string | null;
|
|
59
|
+
resolved: PrResolution[];
|
|
60
|
+
applied: PrResolution[];
|
|
61
|
+
/** Ambiguous — status flip maps to more than one plausible PR merge. */
|
|
62
|
+
skipped: PrUnresolved[];
|
|
63
|
+
/** Direct-to-main / squash / lost history — no PR merge found. */
|
|
64
|
+
unresolved: PrUnresolved[];
|
|
65
|
+
exitCode: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Backfill the `pr` attribute on legacy `done` work / `fixed` bug items by
|
|
69
|
+
* mining git merge-commit history. Dry-run by default; `--apply` writes files,
|
|
70
|
+
* `--git` uses `git add` after writing so the change is staged.
|
|
71
|
+
*/
|
|
72
|
+
export declare function runMigratePrAttrs(options: MigratePrAttrsOptions): MigratePrAttrsResult;
|
|
73
|
+
export interface MigrateDependenciesOptions {
|
|
74
|
+
dir: string;
|
|
75
|
+
apply?: boolean;
|
|
76
|
+
useGit?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface DependencyRename {
|
|
79
|
+
file: string;
|
|
80
|
+
line: number;
|
|
81
|
+
}
|
|
82
|
+
export interface DependencyReverseFlag {
|
|
83
|
+
file: string;
|
|
84
|
+
line: number;
|
|
85
|
+
text: string;
|
|
86
|
+
reason: string;
|
|
87
|
+
}
|
|
88
|
+
export interface MigrateDependenciesResult {
|
|
89
|
+
mode: 'dry-run' | 'apply';
|
|
90
|
+
scanned: number;
|
|
91
|
+
/** `## Dependencies` headings renamed (or that would be) to `## Blocked by`. */
|
|
92
|
+
renamed: DependencyRename[];
|
|
93
|
+
/** Entries whose prose suggests the *reverse* (`Blocks`) direction — reported
|
|
94
|
+
* for manual review, never auto-flipped. */
|
|
95
|
+
reverseFlags: DependencyReverseFlag[];
|
|
96
|
+
exitCode: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Rename legacy `## Dependencies` headings to the canonical `## Blocked by`
|
|
100
|
+
* (SPEC-114), and flag entries whose prose suggests the reverse direction for a
|
|
101
|
+
* human to move to `## Blocks`. Dry-run by default; `--apply` writes files and
|
|
102
|
+
* `--git` stages them.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runMigrateDependencies(options: MigrateDependenciesOptions): MigrateDependenciesResult;
|
|
40
105
|
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAKnC,MAAM,WAAW,uBAAuB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CACjB;AAuBD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBA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AAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B;iDAC6C;IAC7C,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;CACjB;AAcD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,0BAA0B,GAAG,yBAAyB,CAoDrG"}
|
package/dist/commands/migrate.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { execFileSync } from 'child_process';
|
|
2
|
-
import { existsSync, renameSync } from 'fs';
|
|
2
|
+
import { existsSync, renameSync, readFileSync, writeFileSync } from 'fs';
|
|
3
3
|
import { basename, dirname, join, resolve } from 'path';
|
|
4
4
|
import { scanPlanFiles } from '../scanner.js';
|
|
5
|
+
import { PR_REF_RE } from './enums.js';
|
|
5
6
|
export const EXIT_SUCCESS = 0;
|
|
6
7
|
export const EXIT_ERRORS = 1;
|
|
7
8
|
export const EXIT_INVALID_ARGS = 2;
|
|
@@ -107,4 +108,248 @@ export function runMigrateFilenames(options) {
|
|
|
107
108
|
exitCode,
|
|
108
109
|
};
|
|
109
110
|
}
|
|
111
|
+
/** Run a git command in `cwd`, returning trimmed stdout or null on failure. */
|
|
112
|
+
function git(cwd, args) {
|
|
113
|
+
try {
|
|
114
|
+
return execFileSync('git', args, { cwd, stdio: ['pipe', 'pipe', 'pipe'], encoding: 'utf8' }).trim();
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** Parse `<org>/<repo>` from an origin remote URL (SSH or HTTPS). A GitHub slug
|
|
121
|
+
* is always the final two path segments, so we take those — robust against
|
|
122
|
+
* proxy/mirror URLs that prepend extra path segments. */
|
|
123
|
+
function parseRepoSlug(cwd) {
|
|
124
|
+
const url = git(cwd, ['remote', 'get-url', 'origin']);
|
|
125
|
+
if (!url)
|
|
126
|
+
return null;
|
|
127
|
+
// Strip protocol/host (and any user@host:), keep the path.
|
|
128
|
+
let path = url
|
|
129
|
+
.replace(/^git@[^:]+:/, '')
|
|
130
|
+
.replace(/^[a-z]+:\/\/[^/]+\//, '')
|
|
131
|
+
.replace(/\.git$/, '');
|
|
132
|
+
const segments = path.split('/').filter(Boolean);
|
|
133
|
+
if (segments.length < 2)
|
|
134
|
+
return null;
|
|
135
|
+
return segments.slice(-2).join('/');
|
|
136
|
+
}
|
|
137
|
+
/** True when `a` is an ancestor of `b` (exit-code check on merge-base). */
|
|
138
|
+
function isAncestor(cwd, a, b) {
|
|
139
|
+
try {
|
|
140
|
+
execFileSync('git', ['merge-base', '--is-ancestor', a, b], { cwd, stdio: 'pipe' });
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const MERGE_PR_RE = /Merge pull request #(\d+)/;
|
|
148
|
+
/**
|
|
149
|
+
* Resolve the PR number that landed a status flip for one file.
|
|
150
|
+
* - Finds the commits that added a `status="done"` / `status="fixed"` line.
|
|
151
|
+
* - Walks forward (ancestry-path) from the newest such commit to the first
|
|
152
|
+
* reachable merge commit; if its subject is `Merge pull request #N`, that's
|
|
153
|
+
* the PR.
|
|
154
|
+
* Returns `{ pr }` on success, `{ ambiguous }` when two distinct status flips
|
|
155
|
+
* map to different PRs, or `{ reason }` when nothing resolves.
|
|
156
|
+
*/
|
|
157
|
+
function resolvePrForFile(cwd, relFile, statusRe) {
|
|
158
|
+
// Commits (newest-first) whose diff touched a done/fixed status line.
|
|
159
|
+
const log = git(cwd, ['log', '--format=%H', `-G${statusRe}`, '--', relFile]);
|
|
160
|
+
if (log === null)
|
|
161
|
+
return { reason: 'git log failed (not a repo or file untracked)' };
|
|
162
|
+
const commits = log.split('\n').map(s => s.trim()).filter(Boolean);
|
|
163
|
+
if (commits.length === 0)
|
|
164
|
+
return { reason: 'no status-flip commit in history (direct edit / lost history)' };
|
|
165
|
+
const prForCommit = (commit) => {
|
|
166
|
+
// Walk the merges that descend from `commit`, earliest first. The PR that
|
|
167
|
+
// actually landed the work is the one whose *topic branch* (second parent)
|
|
168
|
+
// contains the commit — this skips unrelated release/main merges that
|
|
169
|
+
// merely happen to come after it on the first-parent line.
|
|
170
|
+
const merges = git(cwd, ['log', '--merges', '--ancestry-path', '--reverse', '--format=%H%x09%P%x09%s', `${commit}..HEAD`]);
|
|
171
|
+
if (!merges)
|
|
172
|
+
return null;
|
|
173
|
+
for (const line of merges.split('\n').filter(Boolean)) {
|
|
174
|
+
const [, parentStr = '', subject = ''] = line.split('\t');
|
|
175
|
+
const m = subject.match(MERGE_PR_RE);
|
|
176
|
+
if (!m)
|
|
177
|
+
continue;
|
|
178
|
+
const parents = parentStr.trim().split(/\s+/);
|
|
179
|
+
const firstParent = parents[0];
|
|
180
|
+
const secondParent = parents[1];
|
|
181
|
+
if (!firstParent || !secondParent)
|
|
182
|
+
continue;
|
|
183
|
+
// The merge that *introduced* `commit`: it's on the merged-in topic
|
|
184
|
+
// branch (second parent) but was NOT already on mainline before the
|
|
185
|
+
// merge (first parent). This skips release/main merges that merely
|
|
186
|
+
// come after the commit on the first-parent line.
|
|
187
|
+
if (isAncestor(cwd, commit, secondParent) && !isAncestor(cwd, commit, firstParent)) {
|
|
188
|
+
return Number(m[1]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
};
|
|
193
|
+
// Resolve every status-flip commit to its introducing PR. If they disagree
|
|
194
|
+
// (the item was flipped to done via more than one PR over its history), the
|
|
195
|
+
// mapping is ambiguous and we skip rather than guess (SPEC-049: accept
|
|
196
|
+
// manual cleanup over silent misattribution).
|
|
197
|
+
const prs = new Set();
|
|
198
|
+
for (const c of commits) {
|
|
199
|
+
const pr = prForCommit(c);
|
|
200
|
+
if (pr !== null)
|
|
201
|
+
prs.add(pr);
|
|
202
|
+
}
|
|
203
|
+
if (prs.size === 0)
|
|
204
|
+
return { reason: 'no PR merge commit reachable (direct-to-main or squash-merge)' };
|
|
205
|
+
if (prs.size > 1)
|
|
206
|
+
return { ambiguous: true };
|
|
207
|
+
return { pr: [...prs][0] };
|
|
208
|
+
}
|
|
209
|
+
/** Insert a `pr="…"` attribute into the rune opening tag of a file, after the
|
|
210
|
+
* `id="…"` attribute. Returns the new content, or null if no tag was found. */
|
|
211
|
+
function insertPrAttr(content, pr) {
|
|
212
|
+
const lines = content.split('\n');
|
|
213
|
+
const idx = lines.findIndex(l => /^\{%\s+(work|bug)\s/.test(l) && /\sid=("|')/.test(l));
|
|
214
|
+
if (idx === -1)
|
|
215
|
+
return null;
|
|
216
|
+
if (/\spr=("|')/.test(lines[idx]))
|
|
217
|
+
return null; // already has one
|
|
218
|
+
lines[idx] = lines[idx].replace(/(\sid=(["'])[^"']*\2)/, `$1 pr="${pr}"`);
|
|
219
|
+
return lines.join('\n');
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Backfill the `pr` attribute on legacy `done` work / `fixed` bug items by
|
|
223
|
+
* mining git merge-commit history. Dry-run by default; `--apply` writes files,
|
|
224
|
+
* `--git` uses `git add` after writing so the change is staged.
|
|
225
|
+
*/
|
|
226
|
+
export function runMigratePrAttrs(options) {
|
|
227
|
+
const { dir, apply = false, useGit = false } = options;
|
|
228
|
+
const cwd = resolve(dir);
|
|
229
|
+
const entities = scanPlanFiles(dir, { cache: false });
|
|
230
|
+
const repoSlug = parseRepoSlug(cwd);
|
|
231
|
+
const resolved = [];
|
|
232
|
+
const applied = [];
|
|
233
|
+
const skipped = [];
|
|
234
|
+
const unresolved = [];
|
|
235
|
+
// Candidates: done work / fixed bug items with no `pr` attribute yet.
|
|
236
|
+
const candidates = entities.filter(e => ((e.type === 'work' && e.attributes.status === 'done') ||
|
|
237
|
+
(e.type === 'bug' && e.attributes.status === 'fixed')) &&
|
|
238
|
+
!(e.attributes.pr && e.attributes.pr.trim()));
|
|
239
|
+
for (const e of candidates) {
|
|
240
|
+
const id = e.attributes.id || e.file;
|
|
241
|
+
if (!repoSlug) {
|
|
242
|
+
unresolved.push({ id, file: e.file, reason: 'no origin remote — cannot form <org>/<repo> slug' });
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
const statusRe = e.type === 'work' ? 'status\\s*=\\s*"done"' : 'status\\s*=\\s*"fixed"';
|
|
246
|
+
const res = resolvePrForFile(cwd, e.file, statusRe);
|
|
247
|
+
if (res.ambiguous) {
|
|
248
|
+
skipped.push({ id, file: e.file, reason: 'multiple status flips map to different PRs' });
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (res.pr === undefined) {
|
|
252
|
+
unresolved.push({ id, file: e.file, reason: res.reason ?? 'unresolved' });
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
const pr = `${repoSlug}#${res.pr}`;
|
|
256
|
+
if (!PR_REF_RE.test(pr)) {
|
|
257
|
+
unresolved.push({ id, file: e.file, reason: `resolved PR ref "${pr}" is malformed` });
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const rec = { id, file: e.file, pr };
|
|
261
|
+
resolved.push(rec);
|
|
262
|
+
if (apply) {
|
|
263
|
+
const absPath = resolve(dir, e.file);
|
|
264
|
+
const content = readFileSync(absPath, 'utf8');
|
|
265
|
+
const updated = insertPrAttr(content, pr);
|
|
266
|
+
if (updated === null) {
|
|
267
|
+
unresolved.push({ id, file: e.file, reason: 'could not locate rune tag / already has pr' });
|
|
268
|
+
resolved.pop();
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
writeFileSync(absPath, updated);
|
|
272
|
+
if (useGit)
|
|
273
|
+
git(cwd, ['add', e.file]);
|
|
274
|
+
applied.push(rec);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
mode: apply ? 'apply' : 'dry-run',
|
|
279
|
+
scanned: entities.length,
|
|
280
|
+
repoSlug,
|
|
281
|
+
resolved,
|
|
282
|
+
applied,
|
|
283
|
+
skipped,
|
|
284
|
+
unresolved,
|
|
285
|
+
exitCode: EXIT_SUCCESS,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/** Phrases in a `## Dependencies` section that hint the edge actually runs the
|
|
289
|
+
* other way (this item unblocks / is required by the ref) and should probably
|
|
290
|
+
* move to a `## Blocks` section. Inference is advisory only. */
|
|
291
|
+
const REVERSE_HINTS = [
|
|
292
|
+
{ re: /collects?\s+from\s+me\b/i, reason: 'reads as "collects from me" — incoming, consider ## Blocks' },
|
|
293
|
+
{ re: /\bunblock(s|ed)?\b/i, reason: 'mentions "unblocks" — outgoing, consider ## Blocks' },
|
|
294
|
+
{ re: /\benables?\b/i, reason: 'mentions "enables" — outgoing, consider ## Blocks' },
|
|
295
|
+
{ re: /\brequired by\b/i, reason: 'reads as "required by" — incoming, consider ## Blocks' },
|
|
296
|
+
];
|
|
297
|
+
const DEPENDENCIES_HEADING_RE = /^(##\s+)Dependencies(\s*)$/i;
|
|
298
|
+
/**
|
|
299
|
+
* Rename legacy `## Dependencies` headings to the canonical `## Blocked by`
|
|
300
|
+
* (SPEC-114), and flag entries whose prose suggests the reverse direction for a
|
|
301
|
+
* human to move to `## Blocks`. Dry-run by default; `--apply` writes files and
|
|
302
|
+
* `--git` stages them.
|
|
303
|
+
*/
|
|
304
|
+
export function runMigrateDependencies(options) {
|
|
305
|
+
const { dir, apply = false, useGit = false } = options;
|
|
306
|
+
const cwd = resolve(dir);
|
|
307
|
+
const entities = scanPlanFiles(dir, { cache: false });
|
|
308
|
+
const renamed = [];
|
|
309
|
+
const reverseFlags = [];
|
|
310
|
+
for (const entity of entities) {
|
|
311
|
+
if (entity.type !== 'work' && entity.type !== 'bug')
|
|
312
|
+
continue;
|
|
313
|
+
const absPath = resolve(dir, entity.file);
|
|
314
|
+
let content;
|
|
315
|
+
try {
|
|
316
|
+
content = readFileSync(absPath, 'utf8');
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const lines = content.split('\n');
|
|
322
|
+
let changed = false;
|
|
323
|
+
for (let i = 0; i < lines.length; i++) {
|
|
324
|
+
const m = lines[i].match(DEPENDENCIES_HEADING_RE);
|
|
325
|
+
if (!m)
|
|
326
|
+
continue;
|
|
327
|
+
renamed.push({ file: entity.file, line: i + 1 });
|
|
328
|
+
lines[i] = `${m[1]}Blocked by${m[2]}`;
|
|
329
|
+
changed = true;
|
|
330
|
+
// Scan the section body (until the next H2 or the closing tag) for
|
|
331
|
+
// reverse-direction prose, flagging lines that reference an entity ID.
|
|
332
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
333
|
+
if (/^##\s+/.test(lines[j]) || /^\{%\s+\//.test(lines[j]))
|
|
334
|
+
break;
|
|
335
|
+
const hint = REVERSE_HINTS.find(h => h.re.test(lines[j]));
|
|
336
|
+
if (hint && /\b(WORK|BUG|SPEC|ADR)-\d+\b/.test(lines[j])) {
|
|
337
|
+
reverseFlags.push({ file: entity.file, line: j + 1, text: lines[j].trim(), reason: hint.reason });
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (changed && apply) {
|
|
342
|
+
writeFileSync(absPath, lines.join('\n'));
|
|
343
|
+
if (useGit)
|
|
344
|
+
git(cwd, ['add', entity.file]);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
mode: apply ? 'apply' : 'dry-run',
|
|
349
|
+
scanned: entities.length,
|
|
350
|
+
renamed,
|
|
351
|
+
reverseFlags,
|
|
352
|
+
exitCode: EXIT_SUCCESS,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
110
355
|
//# sourceMappingURL=migrate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe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K,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1D,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;gBACnG,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACtB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACzC,IAAI,MAAM;gBAAE,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;IAED,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QACjC,OAAO,EAAE,QAAQ,CAAC,MAAM;QACxB,OAAO;QACP,YAAY;QACZ,QAAQ,EAAE,YAAY;KACtB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/commands/next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/commands/next.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC/C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CA2ExD"}
|
package/dist/commands/next.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { scanPlanFiles } from '../scanner.js';
|
|
2
|
+
import { DONE_STATUS_SET, isActionable } from './enums.js';
|
|
2
3
|
// --- Priority and complexity sort orders ---
|
|
3
4
|
const PRIORITY_ORDER = {
|
|
4
5
|
critical: 0,
|
|
@@ -13,13 +14,10 @@ const COMPLEXITY_ORDER = {
|
|
|
13
14
|
complex: 3,
|
|
14
15
|
unknown: 4,
|
|
15
16
|
};
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
work: ['ready'],
|
|
21
|
-
bug: ['confirmed'],
|
|
22
|
-
};
|
|
17
|
+
/** A dependency is satisfied once its work is complete (work→done, bug→fixed).
|
|
18
|
+
* The status map doesn't carry entity type, so the shared work/bug completion
|
|
19
|
+
* set is the right lens. */
|
|
20
|
+
const DONE_STATUSES = DONE_STATUS_SET;
|
|
23
21
|
// --- Exit codes ---
|
|
24
22
|
export const EXIT_FOUND = 0;
|
|
25
23
|
export const EXIT_NO_MATCHES = 1;
|
|
@@ -42,35 +40,19 @@ export function runNext(options) {
|
|
|
42
40
|
let candidates = entities.filter(e => {
|
|
43
41
|
if (!typeFilter.includes(e.type))
|
|
44
42
|
return false;
|
|
45
|
-
const readyStatuses = READY_STATUSES[e.type];
|
|
46
|
-
if (!readyStatuses)
|
|
47
|
-
return false;
|
|
48
43
|
const status = e.attributes.status ?? '';
|
|
49
|
-
return
|
|
44
|
+
return isActionable(e.type, status);
|
|
50
45
|
});
|
|
51
|
-
// Exclude items with unfinished dependencies.
|
|
52
|
-
//
|
|
53
|
-
//
|
|
46
|
+
// Exclude items with unfinished dependencies. Only the typed `blocked-by`
|
|
47
|
+
// edges (from a `## Blocked by` section) block an item — prose refs no longer
|
|
48
|
+
// count (SPEC-114). `Blocks` edges point the other way and never block self.
|
|
54
49
|
candidates = candidates.filter(e => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const refStatus = statusMap.get(ref.id);
|
|
62
|
-
if (refStatus !== undefined && !DONE_STATUSES.has(refStatus)) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// Fallback: all refs treated as potential blockers (same as before)
|
|
69
|
-
for (const refId of e.refs) {
|
|
70
|
-
const refStatus = statusMap.get(refId);
|
|
71
|
-
if (refStatus !== undefined && !DONE_STATUSES.has(refStatus)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
50
|
+
for (const dep of e.dependencies ?? []) {
|
|
51
|
+
if (dep.direction !== 'blocked-by')
|
|
52
|
+
continue;
|
|
53
|
+
const refStatus = statusMap.get(dep.id);
|
|
54
|
+
if (refStatus !== undefined && !DONE_STATUSES.has(refStatus)) {
|
|
55
|
+
return false;
|
|
74
56
|
}
|
|
75
57
|
}
|
|
76
58
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../src/commands/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../src/commands/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D,8CAA8C;AAE9C,MAAM,cAAc,GAA2B;IAC9C,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;CACN,CAAC;AAEF,MAAM,gBAAgB,GAA2B;IAChD,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;CACV,CAAC;AAEF;;6BAE6B;AAC7B,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC,qBAAqB;AAErB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AA4BnC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,OAAoB;IAC3C,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAE3E,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,mCAAmC;IACnC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,QAA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IAAI,CAAC,CAAC;QACvE,OAAO,EAAE,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE5C,OAAO;QACN,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACzB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE;YAC9C,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,IAAI,QAAQ;YAC3C,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,IAAI,SAAS;YAChD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,UAAU,EAAE,CAAC,CAAC,UAAU;SACxB,CAAC,CAAC;KACH,CAAC;AACH,CAAC"}
|
|
@@ -52,6 +52,13 @@ export interface PipelineOptions {
|
|
|
52
52
|
theme: string;
|
|
53
53
|
baseUrl: string;
|
|
54
54
|
}
|
|
55
|
+
/** Status ordering — active statuses first, terminal last */
|
|
56
|
+
export declare const STATUS_ORDER: Record<string, number>;
|
|
57
|
+
/** Human-readable status labels for group headers */
|
|
58
|
+
export declare const STATUS_LABELS_DISPLAY: Record<string, string>;
|
|
59
|
+
/** Status ordering per entity type (for nav display). Terminal states sink to
|
|
60
|
+
* the tail — `cancelled` / `superseded` join `done` there for work. */
|
|
61
|
+
export declare const STATUS_ORDER_BY_TYPE: Record<string, string[]>;
|
|
55
62
|
export declare function runPipeline(options: PipelineOptions): Promise<PipelineResult>;
|
|
56
63
|
/**
|
|
57
64
|
* Render a processed page to a full HTML document using the HTML adapter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../src/commands/render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAAE,YAAY,EAAuF,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../src/commands/render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAAE,YAAY,EAAuF,MAAM,mBAAmB,CAAC;AAuB3I,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,YAAY,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,YAAY,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,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C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5F,MAAM,CAgCR;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -10,7 +10,9 @@ import { createHighlightTransform } from '@refrakt-md/highlight';
|
|
|
10
10
|
import { plan } from '../index.js';
|
|
11
11
|
import { planPipelineHooks, setScannerDependencies, setPlanDir } from '../pipeline.js';
|
|
12
12
|
import { scanPlanFiles } from '../scanner.js';
|
|
13
|
+
import { buildBlockedByAdjacency } from '../scanner-core.js';
|
|
13
14
|
import { getGitTimestamps, getStatTimestamps } from '@refrakt-md/content';
|
|
15
|
+
import { TERMINAL_STATUS_UNION, WORK_STATUS_DISPLAY_ORDER, BUG_STATUS_DISPLAY_ORDER } from './enums.js';
|
|
14
16
|
// --- Markdoc tag registry (built once) ---
|
|
15
17
|
const pluginRunes = {};
|
|
16
18
|
for (const [name, entry] of Object.entries(plan.runes)) {
|
|
@@ -233,32 +235,35 @@ const NAV_TITLES = {
|
|
|
233
235
|
spec: 'Specs',
|
|
234
236
|
decision: 'Decisions',
|
|
235
237
|
};
|
|
236
|
-
/** Terminal statuses — collapsed by default in sidebar
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
/** Terminal statuses — collapsed by default in sidebar. Derived from the
|
|
239
|
+
* canonical per-type terminal sets (SPEC-117) so a new terminal status
|
|
240
|
+
* collapses correctly without a second hand-maintained list. */
|
|
241
|
+
const TERMINAL_STATUSES = TERMINAL_STATUS_UNION;
|
|
240
242
|
/** Status ordering — active statuses first, terminal last */
|
|
241
|
-
const STATUS_ORDER = {
|
|
243
|
+
export const STATUS_ORDER = {
|
|
242
244
|
'in-progress': 0, confirmed: 1, review: 2, ready: 3, reported: 4,
|
|
243
245
|
active: 5, proposed: 6, planning: 7, draft: 8, pending: 9, blocked: 10,
|
|
244
|
-
done: 20, fixed: 21, accepted: 22, complete: 23,
|
|
245
|
-
superseded: 30, deprecated: 31, wontfix: 32, duplicate: 33,
|
|
246
|
+
done: 20, fixed: 21, accepted: 22, complete: 23, implemented: 24, shipped: 25,
|
|
247
|
+
superseded: 30, deprecated: 31, wontfix: 32, duplicate: 33, cancelled: 34, rejected: 35,
|
|
246
248
|
};
|
|
247
249
|
/** Human-readable status labels for group headers */
|
|
248
|
-
const STATUS_LABELS_DISPLAY = {
|
|
250
|
+
export const STATUS_LABELS_DISPLAY = {
|
|
249
251
|
'in-progress': 'In Progress',
|
|
250
252
|
confirmed: 'Confirmed', review: 'Review', ready: 'Ready', reported: 'Reported',
|
|
251
253
|
active: 'Active', proposed: 'Proposed', planning: 'Planning', draft: 'Draft',
|
|
252
254
|
pending: 'Pending', blocked: 'Blocked',
|
|
253
255
|
done: 'Done', fixed: 'Fixed', accepted: 'Accepted', complete: 'Complete',
|
|
256
|
+
implemented: 'Implemented', shipped: 'Shipped',
|
|
254
257
|
superseded: 'Superseded', deprecated: 'Deprecated', wontfix: "Won't Fix", duplicate: 'Duplicate',
|
|
258
|
+
cancelled: 'Cancelled', rejected: 'Rejected',
|
|
255
259
|
};
|
|
256
|
-
/** Status ordering per entity type (for nav display)
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
/** Status ordering per entity type (for nav display). Terminal states sink to
|
|
261
|
+
* the tail — `cancelled` / `superseded` join `done` there for work. */
|
|
262
|
+
export const STATUS_ORDER_BY_TYPE = {
|
|
263
|
+
work: ['in-progress', 'review', 'ready', 'blocked', 'draft', 'pending', 'done', 'cancelled', 'superseded'],
|
|
259
264
|
bug: ['in-progress', 'confirmed', 'reported', 'fixed', 'wontfix', 'duplicate'],
|
|
260
|
-
spec: ['review', 'draft', 'accepted', 'superseded', 'deprecated'],
|
|
261
|
-
decision: ['proposed', 'accepted', 'superseded', 'deprecated'],
|
|
265
|
+
spec: ['review', 'draft', 'accepted', 'implemented', 'shipped', 'superseded', 'deprecated'],
|
|
266
|
+
decision: ['proposed', 'accepted', 'rejected', 'superseded', 'deprecated'],
|
|
262
267
|
milestone: ['active', 'planning', 'complete'],
|
|
263
268
|
};
|
|
264
269
|
function buildNavigation(entities, baseUrl) {
|
|
@@ -1032,20 +1037,9 @@ export async function runPipeline(options) {
|
|
|
1032
1037
|
transformedPages.push(viewPage);
|
|
1033
1038
|
}
|
|
1034
1039
|
// 4. Run pipeline hooks: register → aggregate → postProcess
|
|
1035
|
-
// Pass scanner dependency data (
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
const entityId = entity.attributes.id || entity.attributes.name;
|
|
1039
|
-
if (!entityId)
|
|
1040
|
-
continue;
|
|
1041
|
-
// Guard: scopedRefs may be absent on entities loaded from stale cache
|
|
1042
|
-
const scopedRefs = entity.scopedRefs ?? [];
|
|
1043
|
-
const depRefs = scopedRefs
|
|
1044
|
-
.filter(r => r.section === 'Dependencies')
|
|
1045
|
-
.map(r => r.id);
|
|
1046
|
-
if (depRefs.length > 0)
|
|
1047
|
-
depMap.set(entityId, depRefs);
|
|
1048
|
-
}
|
|
1040
|
+
// Pass scanner dependency data (typed `Blocked by` / `Blocks` edges,
|
|
1041
|
+
// normalised to "A blocked by B") to the pipeline (SPEC-114).
|
|
1042
|
+
const depMap = buildBlockedByAdjacency(allEntities);
|
|
1049
1043
|
setScannerDependencies(depMap);
|
|
1050
1044
|
setPlanDir(dir);
|
|
1051
1045
|
const { registry } = createRegistry();
|
|
@@ -1083,8 +1077,8 @@ export async function runPipeline(options) {
|
|
|
1083
1077
|
tags: tags,
|
|
1084
1078
|
nodes: nodes,
|
|
1085
1079
|
orderings: {
|
|
1086
|
-
work: { status: [
|
|
1087
|
-
bug: { status: [
|
|
1080
|
+
work: { status: [...WORK_STATUS_DISPLAY_ORDER] },
|
|
1081
|
+
bug: { status: [...BUG_STATUS_DISPLAY_ORDER] },
|
|
1088
1082
|
},
|
|
1089
1083
|
};
|
|
1090
1084
|
const collectionResolvedPages = postProcessedPages.map(p => {
|
|
@@ -1113,7 +1107,7 @@ export async function runPipeline(options) {
|
|
|
1113
1107
|
const typedPlanData = planAggregated;
|
|
1114
1108
|
const planRels = typedPlanData.relationships;
|
|
1115
1109
|
if (planRels) {
|
|
1116
|
-
const RESOLVED_STATUSES =
|
|
1110
|
+
const RESOLVED_STATUSES = TERMINAL_STATUS_UNION;
|
|
1117
1111
|
for (const group of nav) {
|
|
1118
1112
|
for (const sg of group.statusGroups) {
|
|
1119
1113
|
for (const item of sg.items) {
|