@deskwork/core 0.15.0 → 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/dist/doctor/rules/legacy-stage-artifact-path.d.ts +28 -0
- package/dist/doctor/rules/legacy-stage-artifact-path.d.ts.map +1 -0
- package/dist/doctor/rules/legacy-stage-artifact-path.js +232 -0
- package/dist/doctor/rules/legacy-stage-artifact-path.js.map +1 -0
- package/dist/doctor/rules/legacy-stage-artifact-path.ts +285 -0
- package/dist/doctor/runner.d.ts.map +1 -1
- package/dist/doctor/runner.js +2 -0
- package/dist/doctor/runner.js.map +1 -1
- package/dist/entry/annotations.d.ts +38 -3
- package/dist/entry/annotations.d.ts.map +1 -1
- package/dist/entry/annotations.js +164 -3
- package/dist/entry/annotations.js.map +1 -1
- package/dist/entry/approve.d.ts +21 -4
- package/dist/entry/approve.d.ts.map +1 -1
- package/dist/entry/approve.js +74 -7
- package/dist/entry/approve.js.map +1 -1
- package/dist/entry/snapshot.d.ts +51 -0
- package/dist/entry/snapshot.d.ts.map +1 -0
- package/dist/entry/snapshot.js +95 -0
- package/dist/entry/snapshot.js.map +1 -0
- package/dist/ingest-derive.d.ts +1 -1
- package/dist/ingest-derive.d.ts.map +1 -1
- package/dist/ingest-derive.js +10 -7
- package/dist/ingest-derive.js.map +1 -1
- package/dist/ingest-id.d.ts +33 -0
- package/dist/ingest-id.d.ts.map +1 -0
- package/dist/ingest-id.js +60 -0
- package/dist/ingest-id.js.map +1 -0
- package/dist/ingest.d.ts.map +1 -1
- package/dist/ingest.js +23 -0
- package/dist/ingest.js.map +1 -1
- package/dist/iterate/iterate.d.ts.map +1 -1
- package/dist/iterate/iterate.js +37 -25
- package/dist/iterate/iterate.js.map +1 -1
- package/dist/review/types.d.ts +56 -1
- package/dist/review/types.d.ts.map +1 -1
- package/dist/review/types.js.map +1 -1
- package/dist/schema/draft-annotation.d.ts +108 -24
- package/dist/schema/draft-annotation.d.ts.map +1 -1
- package/dist/schema/draft-annotation.js +23 -0
- package/dist/schema/draft-annotation.js.map +1 -1
- package/dist/schema/journal-events.d.ts +240 -104
- package/dist/schema/journal-events.d.ts.map +1 -1
- package/dist/scrapbook/crud-at-dir.d.ts +47 -0
- package/dist/scrapbook/crud-at-dir.d.ts.map +1 -0
- package/dist/scrapbook/crud-at-dir.js +114 -0
- package/dist/scrapbook/crud-at-dir.js.map +1 -0
- package/dist/scrapbook/crud-slug.d.ts +33 -0
- package/dist/scrapbook/crud-slug.d.ts.map +1 -0
- package/dist/scrapbook/crud-slug.js +99 -0
- package/dist/scrapbook/crud-slug.js.map +1 -0
- package/dist/scrapbook/format.d.ts +10 -0
- package/dist/scrapbook/format.d.ts.map +1 -0
- package/dist/scrapbook/format.js +41 -0
- package/dist/scrapbook/format.js.map +1 -0
- package/dist/scrapbook/listing.d.ts +94 -0
- package/dist/scrapbook/listing.d.ts.map +1 -0
- package/dist/scrapbook/listing.js +167 -0
- package/dist/scrapbook/listing.js.map +1 -0
- package/dist/scrapbook/paths.d.ts +115 -0
- package/dist/scrapbook/paths.d.ts.map +1 -0
- package/dist/scrapbook/paths.js +149 -0
- package/dist/scrapbook/paths.js.map +1 -0
- package/dist/scrapbook/read.d.ts +54 -0
- package/dist/scrapbook/read.d.ts.map +1 -0
- package/dist/scrapbook/read.js +62 -0
- package/dist/scrapbook/read.js.map +1 -0
- package/dist/scrapbook/seed.d.ts +19 -0
- package/dist/scrapbook/seed.d.ts.map +1 -0
- package/dist/scrapbook/seed.js +46 -0
- package/dist/scrapbook/seed.js.map +1 -0
- package/dist/scrapbook/types.d.ts +44 -0
- package/dist/scrapbook/types.d.ts.map +1 -0
- package/dist/scrapbook/types.js +11 -0
- package/dist/scrapbook/types.js.map +1 -0
- package/dist/scrapbook/validation.d.ts +28 -0
- package/dist/scrapbook/validation.d.ts.map +1 -0
- package/dist/scrapbook/validation.js +98 -0
- package/dist/scrapbook/validation.js.map +1 -0
- package/dist/scrapbook.d.ts +43 -277
- package/dist/scrapbook.d.ts.map +1 -1
- package/dist/scrapbook.js +42 -535
- package/dist/scrapbook.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule: legacy-stage-artifact-path.
|
|
3
|
+
*
|
|
4
|
+
* Issue #222 (Option B + hybrid refinement) — `index.md` is always
|
|
5
|
+
* "the document under review". Pre-T1 entries had per-stage
|
|
6
|
+
* `artifactPath` values pointing at `<dir>/scrapbook/<stage>.md`
|
|
7
|
+
* (idea.md / plan.md / outline.md depending on stage). After T1 the
|
|
8
|
+
* convention is `<dir>/index.md` — same `dirname`, but the leaf file
|
|
9
|
+
* is unconditionally `index.md`.
|
|
10
|
+
*
|
|
11
|
+
* Detection: walk every sidecar; flag those whose `artifactPath` ends
|
|
12
|
+
* with `/scrapbook/<stage>.md` for any of the legacy per-stage names.
|
|
13
|
+
*
|
|
14
|
+
* Repair: copy the legacy per-stage file's content into
|
|
15
|
+
* `<dir>/index.md`, then update the sidecar's `artifactPath` to
|
|
16
|
+
* `<dir>/index.md`. Leave the per-stage file in place — it's now the
|
|
17
|
+
* scrapbook snapshot for that stage and must be preserved (the
|
|
18
|
+
* snapshot IS the prior-stage history).
|
|
19
|
+
*
|
|
20
|
+
* Idempotent: subsequent runs detect `artifactPath` already at
|
|
21
|
+
* `index.md` and skip. Safe for `--yes` / `--fix=all` mode.
|
|
22
|
+
*
|
|
23
|
+
* Sibling-relative imports per the project convention.
|
|
24
|
+
*/
|
|
25
|
+
import type { DoctorRule } from '../types.ts';
|
|
26
|
+
declare const rule: DoctorRule;
|
|
27
|
+
export default rule;
|
|
28
|
+
//# sourceMappingURL=legacy-stage-artifact-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-stage-artifact-path.d.ts","sourceRoot":"","sources":["../../../src/doctor/rules/legacy-stage-artifact-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAaH,OAAO,KAAK,EAEV,UAAU,EAIX,MAAM,aAAa,CAAC;AAkHrB,QAAA,MAAM,IAAI,EAAE,UA8HX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule: legacy-stage-artifact-path.
|
|
3
|
+
*
|
|
4
|
+
* Issue #222 (Option B + hybrid refinement) — `index.md` is always
|
|
5
|
+
* "the document under review". Pre-T1 entries had per-stage
|
|
6
|
+
* `artifactPath` values pointing at `<dir>/scrapbook/<stage>.md`
|
|
7
|
+
* (idea.md / plan.md / outline.md depending on stage). After T1 the
|
|
8
|
+
* convention is `<dir>/index.md` — same `dirname`, but the leaf file
|
|
9
|
+
* is unconditionally `index.md`.
|
|
10
|
+
*
|
|
11
|
+
* Detection: walk every sidecar; flag those whose `artifactPath` ends
|
|
12
|
+
* with `/scrapbook/<stage>.md` for any of the legacy per-stage names.
|
|
13
|
+
*
|
|
14
|
+
* Repair: copy the legacy per-stage file's content into
|
|
15
|
+
* `<dir>/index.md`, then update the sidecar's `artifactPath` to
|
|
16
|
+
* `<dir>/index.md`. Leave the per-stage file in place — it's now the
|
|
17
|
+
* scrapbook snapshot for that stage and must be preserved (the
|
|
18
|
+
* snapshot IS the prior-stage history).
|
|
19
|
+
*
|
|
20
|
+
* Idempotent: subsequent runs detect `artifactPath` already at
|
|
21
|
+
* `index.md` and skip. Safe for `--yes` / `--fix=all` mode.
|
|
22
|
+
*
|
|
23
|
+
* Sibling-relative imports per the project convention.
|
|
24
|
+
*/
|
|
25
|
+
import { mkdir, readFile, rename, stat, writeFile, } from 'node:fs/promises';
|
|
26
|
+
import { dirname, join, posix, sep } from 'node:path';
|
|
27
|
+
import { readAllSidecars } from "../../sidecar/read-all.js";
|
|
28
|
+
import { writeSidecar } from "../../sidecar/write.js";
|
|
29
|
+
const RULE_ID = 'legacy-stage-artifact-path';
|
|
30
|
+
const LEGACY_LEAFS = new Set([
|
|
31
|
+
'idea.md',
|
|
32
|
+
'plan.md',
|
|
33
|
+
'outline.md',
|
|
34
|
+
'drafting.md',
|
|
35
|
+
]);
|
|
36
|
+
/** Normalize the project-relative artifactPath to forward-slash form
|
|
37
|
+
* for endsWith / segment checks. Sidecar values may have been written
|
|
38
|
+
* with either separator depending on the OS that ingested them. */
|
|
39
|
+
function toPosix(p) {
|
|
40
|
+
if (sep === posix.sep)
|
|
41
|
+
return p;
|
|
42
|
+
return p.split(sep).join(posix.sep);
|
|
43
|
+
}
|
|
44
|
+
function classify(entry) {
|
|
45
|
+
if (!entry.artifactPath)
|
|
46
|
+
return null;
|
|
47
|
+
const posixPath = toPosix(entry.artifactPath);
|
|
48
|
+
// Must end with `/scrapbook/<legacy-leaf>` to qualify.
|
|
49
|
+
const segments = posixPath.split('/');
|
|
50
|
+
if (segments.length < 3)
|
|
51
|
+
return null;
|
|
52
|
+
const leaf = segments[segments.length - 1];
|
|
53
|
+
const parent = segments[segments.length - 2];
|
|
54
|
+
if (parent !== 'scrapbook')
|
|
55
|
+
return null;
|
|
56
|
+
if (!LEGACY_LEAFS.has(leaf.toLowerCase()))
|
|
57
|
+
return null;
|
|
58
|
+
// <dir> is everything above the `scrapbook/` segment.
|
|
59
|
+
const dirSegments = segments.slice(0, segments.length - 2);
|
|
60
|
+
const nextRelativePath = [...dirSegments, 'index.md'].join('/');
|
|
61
|
+
return {
|
|
62
|
+
entry,
|
|
63
|
+
relativePath: entry.artifactPath,
|
|
64
|
+
nextRelativePath,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function fileExists(absPath) {
|
|
68
|
+
return stat(absPath).then((s) => s.isFile(), () => false);
|
|
69
|
+
}
|
|
70
|
+
async function atomicWrite(absPath, content) {
|
|
71
|
+
await mkdir(dirname(absPath), { recursive: true });
|
|
72
|
+
const tmpPath = `${absPath}.${process.pid}.tmp`;
|
|
73
|
+
await writeFile(tmpPath, content);
|
|
74
|
+
await rename(tmpPath, absPath);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Apply the migration to a single hit:
|
|
78
|
+
*
|
|
79
|
+
* 1. Copy `<dir>/scrapbook/<legacy>.md` → `<dir>/index.md` (atomic
|
|
80
|
+
* write via tmp + rename). Skip the copy when `index.md` already
|
|
81
|
+
* exists with the same bytes (idempotent).
|
|
82
|
+
* 2. Caller then updates the sidecar's `artifactPath` to
|
|
83
|
+
* `<dir>/index.md`.
|
|
84
|
+
*
|
|
85
|
+
* Refuses when `<dir>/index.md` exists with DIFFERENT content from the
|
|
86
|
+
* legacy per-stage file — manual resolution required (operator may
|
|
87
|
+
* have hand-edited one of the two).
|
|
88
|
+
*/
|
|
89
|
+
async function migrate(projectRoot, hit) {
|
|
90
|
+
const fromAbs = join(projectRoot, hit.relativePath);
|
|
91
|
+
const toAbs = join(projectRoot, hit.nextRelativePath);
|
|
92
|
+
if (!(await fileExists(fromAbs))) {
|
|
93
|
+
throw new Error(`legacy artifact file not found at ${fromAbs}; sidecar artifactPath ` +
|
|
94
|
+
`points at a missing file. Repair manually before re-running ` +
|
|
95
|
+
`doctor (the per-stage file may have been moved or deleted).`);
|
|
96
|
+
}
|
|
97
|
+
const legacy = await readFile(fromAbs, 'utf8');
|
|
98
|
+
if (await fileExists(toAbs)) {
|
|
99
|
+
const current = await readFile(toAbs, 'utf8');
|
|
100
|
+
if (legacy !== current) {
|
|
101
|
+
throw new Error(`${toAbs} exists with different content from ${fromAbs}; refusing ` +
|
|
102
|
+
`to overwrite. Resolve manually (decide which copy is canonical ` +
|
|
103
|
+
`for index.md, leave the other under scrapbook/) and re-run.`);
|
|
104
|
+
}
|
|
105
|
+
return { fromAbs, toAbs };
|
|
106
|
+
}
|
|
107
|
+
await atomicWrite(toAbs, legacy);
|
|
108
|
+
return { fromAbs, toAbs };
|
|
109
|
+
}
|
|
110
|
+
const rule = {
|
|
111
|
+
id: RULE_ID,
|
|
112
|
+
label: 'Sidecar artifactPath should point at index.md (Issue #222)',
|
|
113
|
+
async audit(ctx) {
|
|
114
|
+
let entries;
|
|
115
|
+
try {
|
|
116
|
+
entries = await readAllSidecars(ctx.projectRoot);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
const findings = [];
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const hit = classify(entry);
|
|
124
|
+
if (hit === null)
|
|
125
|
+
continue;
|
|
126
|
+
findings.push({
|
|
127
|
+
ruleId: RULE_ID,
|
|
128
|
+
site: ctx.site,
|
|
129
|
+
severity: 'warning',
|
|
130
|
+
message: `Entry ${entry.uuid} (slug=${entry.slug}) has a legacy per-stage ` +
|
|
131
|
+
`artifactPath (${hit.relativePath}); should be ` +
|
|
132
|
+
`${hit.nextRelativePath}.`,
|
|
133
|
+
details: {
|
|
134
|
+
entryId: entry.uuid,
|
|
135
|
+
slug: entry.slug,
|
|
136
|
+
legacyPath: hit.relativePath,
|
|
137
|
+
nextPath: hit.nextRelativePath,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return findings;
|
|
142
|
+
},
|
|
143
|
+
async plan(_ctx, finding) {
|
|
144
|
+
const entryId = String(finding.details.entryId ?? '');
|
|
145
|
+
const legacyPath = String(finding.details.legacyPath ?? '');
|
|
146
|
+
const nextPath = String(finding.details.nextPath ?? '');
|
|
147
|
+
if (!entryId || !legacyPath || !nextPath) {
|
|
148
|
+
return {
|
|
149
|
+
kind: 'report-only',
|
|
150
|
+
finding,
|
|
151
|
+
reason: 'finding missing entryId / legacyPath / nextPath — re-run audit',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
kind: 'apply',
|
|
156
|
+
finding,
|
|
157
|
+
summary: `migrate ${legacyPath} → ${nextPath} and update sidecar ` +
|
|
158
|
+
`${entryId}'s artifactPath`,
|
|
159
|
+
payload: { entryId, legacyPath, nextPath },
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
async apply(ctx, plan) {
|
|
163
|
+
if (plan.kind !== 'apply') {
|
|
164
|
+
return {
|
|
165
|
+
finding: plan.finding,
|
|
166
|
+
applied: false,
|
|
167
|
+
message: 'plan is not directly appliable; runner should resolve prompt first',
|
|
168
|
+
skipReason: 'apply-failed',
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const entryId = String(plan.payload.entryId ?? '');
|
|
172
|
+
const legacyPath = String(plan.payload.legacyPath ?? '');
|
|
173
|
+
const nextPath = String(plan.payload.nextPath ?? '');
|
|
174
|
+
if (!entryId || !legacyPath || !nextPath) {
|
|
175
|
+
return {
|
|
176
|
+
finding: plan.finding,
|
|
177
|
+
applied: false,
|
|
178
|
+
message: 'apply payload missing entryId / legacyPath / nextPath',
|
|
179
|
+
skipReason: 'apply-failed',
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
let entries;
|
|
183
|
+
try {
|
|
184
|
+
entries = await readAllSidecars(ctx.projectRoot);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
188
|
+
return {
|
|
189
|
+
finding: plan.finding,
|
|
190
|
+
applied: false,
|
|
191
|
+
message: `failed to read sidecars: ${reason}`,
|
|
192
|
+
skipReason: 'apply-failed',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const entry = entries.find((e) => e.uuid === entryId);
|
|
196
|
+
if (!entry) {
|
|
197
|
+
return {
|
|
198
|
+
finding: plan.finding,
|
|
199
|
+
applied: false,
|
|
200
|
+
message: `sidecar for ${entryId} disappeared between audit and apply`,
|
|
201
|
+
skipReason: 'apply-failed',
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
await migrate(ctx.projectRoot, {
|
|
206
|
+
entry,
|
|
207
|
+
relativePath: legacyPath,
|
|
208
|
+
nextRelativePath: nextPath,
|
|
209
|
+
});
|
|
210
|
+
const updated = { ...entry, artifactPath: nextPath };
|
|
211
|
+
await writeSidecar(ctx.projectRoot, updated);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
215
|
+
return {
|
|
216
|
+
finding: plan.finding,
|
|
217
|
+
applied: false,
|
|
218
|
+
message: `failed to migrate artifactPath for ${entryId}: ${reason}`,
|
|
219
|
+
skipReason: 'apply-failed',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
finding: plan.finding,
|
|
224
|
+
applied: true,
|
|
225
|
+
message: `migrated ${legacyPath} → ${nextPath} and updated sidecar ` +
|
|
226
|
+
`${entryId}'s artifactPath`,
|
|
227
|
+
details: { entryId, legacyPath, nextPath },
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
export default rule;
|
|
232
|
+
//# sourceMappingURL=legacy-stage-artifact-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-stage-artifact-path.js","sourceRoot":"","sources":["../../../src/doctor/rules/legacy-stage-artifact-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAUtD,MAAM,OAAO,GAAG,4BAA4B,CAAC;AAE7C,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC;IAChD,SAAS;IACT,SAAS;IACT,YAAY;IACZ,aAAa;CACd,CAAC,CAAC;AAUH;;oEAEoE;AACpE,SAAS,OAAO,CAAC,CAAS;IACxB,IAAI,GAAG,KAAK,KAAK,CAAC,GAAG;QAAE,OAA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AAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChE,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,sCAAsC,OAAO,KAAK,MAAM,EAAE;gBACnE,UAAU,EAAE,cAAc;aAC3B,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI;YACb,OAAO,EACL,YAAY,UAAU,MAAM,QAAQ,uBAAuB;gBAC3D,GAAG,OAAO,iBAAiB;YAC7B,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE;SAC3C,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule: legacy-stage-artifact-path.
|
|
3
|
+
*
|
|
4
|
+
* Issue #222 (Option B + hybrid refinement) — `index.md` is always
|
|
5
|
+
* "the document under review". Pre-T1 entries had per-stage
|
|
6
|
+
* `artifactPath` values pointing at `<dir>/scrapbook/<stage>.md`
|
|
7
|
+
* (idea.md / plan.md / outline.md depending on stage). After T1 the
|
|
8
|
+
* convention is `<dir>/index.md` — same `dirname`, but the leaf file
|
|
9
|
+
* is unconditionally `index.md`.
|
|
10
|
+
*
|
|
11
|
+
* Detection: walk every sidecar; flag those whose `artifactPath` ends
|
|
12
|
+
* with `/scrapbook/<stage>.md` for any of the legacy per-stage names.
|
|
13
|
+
*
|
|
14
|
+
* Repair: copy the legacy per-stage file's content into
|
|
15
|
+
* `<dir>/index.md`, then update the sidecar's `artifactPath` to
|
|
16
|
+
* `<dir>/index.md`. Leave the per-stage file in place — it's now the
|
|
17
|
+
* scrapbook snapshot for that stage and must be preserved (the
|
|
18
|
+
* snapshot IS the prior-stage history).
|
|
19
|
+
*
|
|
20
|
+
* Idempotent: subsequent runs detect `artifactPath` already at
|
|
21
|
+
* `index.md` and skip. Safe for `--yes` / `--fix=all` mode.
|
|
22
|
+
*
|
|
23
|
+
* Sibling-relative imports per the project convention.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
mkdir,
|
|
28
|
+
readFile,
|
|
29
|
+
rename,
|
|
30
|
+
stat,
|
|
31
|
+
writeFile,
|
|
32
|
+
} from 'node:fs/promises';
|
|
33
|
+
import { dirname, join, posix, sep } from 'node:path';
|
|
34
|
+
import { readAllSidecars } from '../../sidecar/read-all.ts';
|
|
35
|
+
import { writeSidecar } from '../../sidecar/write.ts';
|
|
36
|
+
import type { Entry } from '../../schema/entry.ts';
|
|
37
|
+
import type {
|
|
38
|
+
DoctorContext,
|
|
39
|
+
DoctorRule,
|
|
40
|
+
Finding,
|
|
41
|
+
RepairPlan,
|
|
42
|
+
RepairResult,
|
|
43
|
+
} from '../types.ts';
|
|
44
|
+
|
|
45
|
+
const RULE_ID = 'legacy-stage-artifact-path';
|
|
46
|
+
|
|
47
|
+
const LEGACY_LEAFS: ReadonlySet<string> = new Set([
|
|
48
|
+
'idea.md',
|
|
49
|
+
'plan.md',
|
|
50
|
+
'outline.md',
|
|
51
|
+
'drafting.md',
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
interface LegacyHit {
|
|
55
|
+
readonly entry: Entry;
|
|
56
|
+
/** The artifactPath as stored on the sidecar (project-relative). */
|
|
57
|
+
readonly relativePath: string;
|
|
58
|
+
/** Project-relative path the new artifactPath will hold. */
|
|
59
|
+
readonly nextRelativePath: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Normalize the project-relative artifactPath to forward-slash form
|
|
63
|
+
* for endsWith / segment checks. Sidecar values may have been written
|
|
64
|
+
* with either separator depending on the OS that ingested them. */
|
|
65
|
+
function toPosix(p: string): string {
|
|
66
|
+
if (sep === posix.sep) return p;
|
|
67
|
+
return p.split(sep).join(posix.sep);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function classify(entry: Entry): LegacyHit | null {
|
|
71
|
+
if (!entry.artifactPath) return null;
|
|
72
|
+
const posixPath = toPosix(entry.artifactPath);
|
|
73
|
+
// Must end with `/scrapbook/<legacy-leaf>` to qualify.
|
|
74
|
+
const segments = posixPath.split('/');
|
|
75
|
+
if (segments.length < 3) return null;
|
|
76
|
+
const leaf = segments[segments.length - 1];
|
|
77
|
+
const parent = segments[segments.length - 2];
|
|
78
|
+
if (parent !== 'scrapbook') return null;
|
|
79
|
+
if (!LEGACY_LEAFS.has(leaf.toLowerCase())) return null;
|
|
80
|
+
// <dir> is everything above the `scrapbook/` segment.
|
|
81
|
+
const dirSegments = segments.slice(0, segments.length - 2);
|
|
82
|
+
const nextRelativePath = [...dirSegments, 'index.md'].join('/');
|
|
83
|
+
return {
|
|
84
|
+
entry,
|
|
85
|
+
relativePath: entry.artifactPath,
|
|
86
|
+
nextRelativePath,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function fileExists(absPath: string): Promise<boolean> {
|
|
91
|
+
return stat(absPath).then(
|
|
92
|
+
(s) => s.isFile(),
|
|
93
|
+
() => false,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function atomicWrite(absPath: string, content: string): Promise<void> {
|
|
98
|
+
await mkdir(dirname(absPath), { recursive: true });
|
|
99
|
+
const tmpPath = `${absPath}.${process.pid}.tmp`;
|
|
100
|
+
await writeFile(tmpPath, content);
|
|
101
|
+
await rename(tmpPath, absPath);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface MigrateResult {
|
|
105
|
+
/** The path the per-stage file was copied FROM (absolute). */
|
|
106
|
+
readonly fromAbs: string;
|
|
107
|
+
/** The path index.md was written TO (absolute). */
|
|
108
|
+
readonly toAbs: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Apply the migration to a single hit:
|
|
113
|
+
*
|
|
114
|
+
* 1. Copy `<dir>/scrapbook/<legacy>.md` → `<dir>/index.md` (atomic
|
|
115
|
+
* write via tmp + rename). Skip the copy when `index.md` already
|
|
116
|
+
* exists with the same bytes (idempotent).
|
|
117
|
+
* 2. Caller then updates the sidecar's `artifactPath` to
|
|
118
|
+
* `<dir>/index.md`.
|
|
119
|
+
*
|
|
120
|
+
* Refuses when `<dir>/index.md` exists with DIFFERENT content from the
|
|
121
|
+
* legacy per-stage file — manual resolution required (operator may
|
|
122
|
+
* have hand-edited one of the two).
|
|
123
|
+
*/
|
|
124
|
+
async function migrate(
|
|
125
|
+
projectRoot: string,
|
|
126
|
+
hit: LegacyHit,
|
|
127
|
+
): Promise<MigrateResult> {
|
|
128
|
+
const fromAbs = join(projectRoot, hit.relativePath);
|
|
129
|
+
const toAbs = join(projectRoot, hit.nextRelativePath);
|
|
130
|
+
|
|
131
|
+
if (!(await fileExists(fromAbs))) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`legacy artifact file not found at ${fromAbs}; sidecar artifactPath ` +
|
|
134
|
+
`points at a missing file. Repair manually before re-running ` +
|
|
135
|
+
`doctor (the per-stage file may have been moved or deleted).`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const legacy = await readFile(fromAbs, 'utf8');
|
|
140
|
+
|
|
141
|
+
if (await fileExists(toAbs)) {
|
|
142
|
+
const current = await readFile(toAbs, 'utf8');
|
|
143
|
+
if (legacy !== current) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`${toAbs} exists with different content from ${fromAbs}; refusing ` +
|
|
146
|
+
`to overwrite. Resolve manually (decide which copy is canonical ` +
|
|
147
|
+
`for index.md, leave the other under scrapbook/) and re-run.`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return { fromAbs, toAbs };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
await atomicWrite(toAbs, legacy);
|
|
154
|
+
return { fromAbs, toAbs };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const rule: DoctorRule = {
|
|
158
|
+
id: RULE_ID,
|
|
159
|
+
label: 'Sidecar artifactPath should point at index.md (Issue #222)',
|
|
160
|
+
|
|
161
|
+
async audit(ctx: DoctorContext): Promise<Finding[]> {
|
|
162
|
+
let entries: Entry[];
|
|
163
|
+
try {
|
|
164
|
+
entries = await readAllSidecars(ctx.projectRoot);
|
|
165
|
+
} catch {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
const findings: Finding[] = [];
|
|
169
|
+
for (const entry of entries) {
|
|
170
|
+
const hit = classify(entry);
|
|
171
|
+
if (hit === null) continue;
|
|
172
|
+
findings.push({
|
|
173
|
+
ruleId: RULE_ID,
|
|
174
|
+
site: ctx.site,
|
|
175
|
+
severity: 'warning',
|
|
176
|
+
message:
|
|
177
|
+
`Entry ${entry.uuid} (slug=${entry.slug}) has a legacy per-stage ` +
|
|
178
|
+
`artifactPath (${hit.relativePath}); should be ` +
|
|
179
|
+
`${hit.nextRelativePath}.`,
|
|
180
|
+
details: {
|
|
181
|
+
entryId: entry.uuid,
|
|
182
|
+
slug: entry.slug,
|
|
183
|
+
legacyPath: hit.relativePath,
|
|
184
|
+
nextPath: hit.nextRelativePath,
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return findings;
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
async plan(_ctx: DoctorContext, finding: Finding): Promise<RepairPlan> {
|
|
192
|
+
const entryId = String(finding.details.entryId ?? '');
|
|
193
|
+
const legacyPath = String(finding.details.legacyPath ?? '');
|
|
194
|
+
const nextPath = String(finding.details.nextPath ?? '');
|
|
195
|
+
if (!entryId || !legacyPath || !nextPath) {
|
|
196
|
+
return {
|
|
197
|
+
kind: 'report-only',
|
|
198
|
+
finding,
|
|
199
|
+
reason: 'finding missing entryId / legacyPath / nextPath — re-run audit',
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
kind: 'apply',
|
|
204
|
+
finding,
|
|
205
|
+
summary:
|
|
206
|
+
`migrate ${legacyPath} → ${nextPath} and update sidecar ` +
|
|
207
|
+
`${entryId}'s artifactPath`,
|
|
208
|
+
payload: { entryId, legacyPath, nextPath },
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
async apply(ctx: DoctorContext, plan: RepairPlan): Promise<RepairResult> {
|
|
213
|
+
if (plan.kind !== 'apply') {
|
|
214
|
+
return {
|
|
215
|
+
finding: plan.finding,
|
|
216
|
+
applied: false,
|
|
217
|
+
message:
|
|
218
|
+
'plan is not directly appliable; runner should resolve prompt first',
|
|
219
|
+
skipReason: 'apply-failed',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
const entryId = String(plan.payload.entryId ?? '');
|
|
223
|
+
const legacyPath = String(plan.payload.legacyPath ?? '');
|
|
224
|
+
const nextPath = String(plan.payload.nextPath ?? '');
|
|
225
|
+
if (!entryId || !legacyPath || !nextPath) {
|
|
226
|
+
return {
|
|
227
|
+
finding: plan.finding,
|
|
228
|
+
applied: false,
|
|
229
|
+
message: 'apply payload missing entryId / legacyPath / nextPath',
|
|
230
|
+
skipReason: 'apply-failed',
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
let entries: Entry[];
|
|
235
|
+
try {
|
|
236
|
+
entries = await readAllSidecars(ctx.projectRoot);
|
|
237
|
+
} catch (err) {
|
|
238
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
239
|
+
return {
|
|
240
|
+
finding: plan.finding,
|
|
241
|
+
applied: false,
|
|
242
|
+
message: `failed to read sidecars: ${reason}`,
|
|
243
|
+
skipReason: 'apply-failed',
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const entry = entries.find((e) => e.uuid === entryId);
|
|
247
|
+
if (!entry) {
|
|
248
|
+
return {
|
|
249
|
+
finding: plan.finding,
|
|
250
|
+
applied: false,
|
|
251
|
+
message: `sidecar for ${entryId} disappeared between audit and apply`,
|
|
252
|
+
skipReason: 'apply-failed',
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
try {
|
|
257
|
+
await migrate(ctx.projectRoot, {
|
|
258
|
+
entry,
|
|
259
|
+
relativePath: legacyPath,
|
|
260
|
+
nextRelativePath: nextPath,
|
|
261
|
+
});
|
|
262
|
+
const updated: Entry = { ...entry, artifactPath: nextPath };
|
|
263
|
+
await writeSidecar(ctx.projectRoot, updated);
|
|
264
|
+
} catch (err) {
|
|
265
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
266
|
+
return {
|
|
267
|
+
finding: plan.finding,
|
|
268
|
+
applied: false,
|
|
269
|
+
message: `failed to migrate artifactPath for ${entryId}: ${reason}`,
|
|
270
|
+
skipReason: 'apply-failed',
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
finding: plan.finding,
|
|
276
|
+
applied: true,
|
|
277
|
+
message:
|
|
278
|
+
`migrated ${legacyPath} → ${nextPath} and updated sidecar ` +
|
|
279
|
+
`${entryId}'s artifactPath`,
|
|
280
|
+
details: { entryId, legacyPath, nextPath },
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export default rule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/doctor/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/doctor/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAWnD,OAAO,KAAK,EAEV,iBAAiB,EACjB,YAAY,EACZ,UAAU,EAIX,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,EAAE,aAAa,CAAC,UAAU,CAU3C,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBtD;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAwED;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,YAAY,CAAC,CAavB;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,YAAY,CAAC,CAoBvB;AAmGD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,iBAU5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBAOhC,CAAC"}
|
package/dist/doctor/runner.js
CHANGED
|
@@ -20,6 +20,7 @@ import schemaRejected from "./rules/schema-rejected.js";
|
|
|
20
20
|
import workflowStale from "./rules/workflow-stale.js";
|
|
21
21
|
import calendarUuidMissing from "./rules/calendar-uuid-missing.js";
|
|
22
22
|
import legacyTopLevelIdMigration from "./rules/legacy-top-level-id-migration.js";
|
|
23
|
+
import legacyStageArtifactPath from "./rules/legacy-stage-artifact-path.js";
|
|
23
24
|
import { loadProjectRules, mergeRules } from "./project-rules.js";
|
|
24
25
|
/**
|
|
25
26
|
* Registry of all rules in the order they run. The order matters: we
|
|
@@ -36,6 +37,7 @@ import { loadProjectRules, mergeRules } from "./project-rules.js";
|
|
|
36
37
|
export const RULES = [
|
|
37
38
|
calendarUuidMissing,
|
|
38
39
|
legacyTopLevelIdMigration,
|
|
40
|
+
legacyStageArtifactPath,
|
|
39
41
|
missingFrontmatterId,
|
|
40
42
|
orphanFrontmatterId,
|
|
41
43
|
duplicateId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/doctor/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AACrE,OAAO,mBAAmB,MAAM,kCAAkC,CAAC;AACnE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,mBAAmB,MAAM,kCAAkC,CAAC;AACnE,OAAO,yBAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWlE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAA8B;IAC9C,mBAAmB;IACnB,yBAAyB;IACzB,oBAAoB;IACpB,mBAAmB;IACnB,WAAW;IACX,aAAa;IACb,aAAa;IACb,cAAc;CACf,CAAC;AAEF,MAAM,UAAU,GAAoC,IAAI,GAAG,CACzD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,OAAO,GAAG,GAAG,CA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