@rasensio/aidlc 1.56.0 → 1.58.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.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/revert.d.ts +35 -0
- package/dist/commands/revert.d.ts.map +1 -0
- package/dist/commands/revert.js +184 -0
- package/dist/commands/revert.js.map +1 -0
- package/dist/commands/update.js +2 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/compile/loaders.d.ts.map +1 -1
- package/dist/compile/loaders.js +25 -2
- package/dist/compile/loaders.js.map +1 -1
- package/dist/compile/question-rendering.d.ts.map +1 -1
- package/dist/compile/question-rendering.js +14 -3
- package/dist/compile/question-rendering.js.map +1 -1
- package/dist/compile/roadmap-skill.d.ts +6 -0
- package/dist/compile/roadmap-skill.d.ts.map +1 -1
- package/dist/compile/roadmap-skill.js +22 -4
- package/dist/compile/roadmap-skill.js.map +1 -1
- package/dist/compile/skill-format.d.ts +34 -8
- package/dist/compile/skill-format.d.ts.map +1 -1
- package/dist/compile/skill-format.js +49 -11
- package/dist/compile/skill-format.js.map +1 -1
- package/dist/doctor/migrations/artifact-source-drift.d.ts +14 -5
- package/dist/doctor/migrations/artifact-source-drift.d.ts.map +1 -1
- package/dist/doctor/migrations/artifact-source-drift.js +29 -18
- package/dist/doctor/migrations/artifact-source-drift.js.map +1 -1
- package/dist/menu/roster.d.ts.map +1 -1
- package/dist/menu/roster.js +2 -0
- package/dist/menu/roster.js.map +1 -1
- package/dist/revert/apply.d.ts +40 -0
- package/dist/revert/apply.d.ts.map +1 -0
- package/dist/revert/apply.js +144 -0
- package/dist/revert/apply.js.map +1 -0
- package/dist/revert/commits.d.ts +44 -0
- package/dist/revert/commits.d.ts.map +1 -0
- package/dist/revert/commits.js +92 -0
- package/dist/revert/commits.js.map +1 -0
- package/dist/revert/plan.d.ts +55 -0
- package/dist/revert/plan.d.ts.map +1 -0
- package/dist/revert/plan.js +60 -0
- package/dist/revert/plan.js.map +1 -0
- package/dist/revert/trailers.d.ts +26 -0
- package/dist/revert/trailers.d.ts.map +1 -0
- package/dist/revert/trailers.js +29 -0
- package/dist/revert/trailers.js.map +1 -0
- package/dist/tasks/reset.d.ts +18 -0
- package/dist/tasks/reset.d.ts.map +1 -0
- package/dist/tasks/reset.js +28 -0
- package/dist/tasks/reset.js.map +1 -0
- package/package.json +2 -2
|
@@ -28,6 +28,12 @@
|
|
|
28
28
|
* stale version stamp is the exact failure this feature exists to prevent, so
|
|
29
29
|
* the framework keeps ownership of the file.
|
|
30
30
|
*
|
|
31
|
+
* The stamp names the version at which the emitted text last changed, not the
|
|
32
|
+
* installed version as roadmap-revamp/AC-16 first had it: re-stamping identical
|
|
33
|
+
* text on every release put this file in every branch's `aidlc update` diff
|
|
34
|
+
* (update-restamps-unchanged-skills/AC-6). Two copies with one version still hold
|
|
35
|
+
* the same text, which is what a contributor comparing them needs.
|
|
36
|
+
*
|
|
31
37
|
* No path here is derived from user data: every segment is a module constant, so
|
|
32
38
|
* unlike the guidance installer there is no YAML-supplied filename to bound-check
|
|
33
39
|
* before touching disk.
|
|
@@ -48,6 +54,8 @@ const TARGET_SEGMENTS = ['.aidlc', 'resources', 'skills', SKILL_DIR, 'SKILL.md']
|
|
|
48
54
|
export const ROADMAP_SKILL_PATH = TARGET_SEGMENTS.join('/');
|
|
49
55
|
/** The token the source carries in place of a version literal. */
|
|
50
56
|
const VERSION_PLACEHOLDER = '{{version}}';
|
|
57
|
+
/** The version an emitted file names, from its frontmatter `version:` line. */
|
|
58
|
+
const FRONTMATTER_VERSION_RE = /^version: (\S+)$/m;
|
|
51
59
|
/**
|
|
52
60
|
* The two project-field placeholders, each occupying a **whole line** of the source.
|
|
53
61
|
*
|
|
@@ -176,13 +184,23 @@ export function installRoadmapSkill(projectRoot, contentRoot, version, opts = {}
|
|
|
176
184
|
? { fields: opts.fields, warning: null }
|
|
177
185
|
: itemFieldsOrEmpty(primaryCheckout(projectRoot));
|
|
178
186
|
const warnings = declared.warning === null ? [] : [declared.warning];
|
|
179
|
-
const
|
|
187
|
+
const sourceText = readFileSync(source, 'utf8');
|
|
188
|
+
const rendered = renderRoadmapSkill(sourceText, version, declared.fields);
|
|
180
189
|
const target = join(projectRoot, ...TARGET_SEGMENTS);
|
|
181
190
|
const existed = existsSync(target);
|
|
182
191
|
// Skipping an identical write keeps output deterministic and stops `update`
|
|
183
|
-
// from producing a diff on every run
|
|
184
|
-
|
|
185
|
-
|
|
192
|
+
// from producing a diff on every run — and "identical" ignores the version: a
|
|
193
|
+
// file that differs from this render only in its `version:` is left alone, so
|
|
194
|
+
// the version records the last content change (update-restamps-unchanged-skills/AC-6,
|
|
195
|
+
// DD-3).
|
|
196
|
+
if (existed) {
|
|
197
|
+
const onDisk = readFileSync(target, 'utf8');
|
|
198
|
+
const priorVersion = FRONTMATTER_VERSION_RE.exec(onDisk)?.[1];
|
|
199
|
+
if (onDisk === rendered ||
|
|
200
|
+
(priorVersion !== undefined &&
|
|
201
|
+
onDisk === renderRoadmapSkill(sourceText, priorVersion, declared.fields))) {
|
|
202
|
+
return { path: null, status: 'already-current', warnings };
|
|
203
|
+
}
|
|
186
204
|
}
|
|
187
205
|
if (!opts.dryRun) {
|
|
188
206
|
mkdirSync(join(projectRoot, ...TARGET_SEGMENTS.slice(0, -1)), { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadmap-skill.js","sourceRoot":"","sources":["../../src/compile/roadmap-skill.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"roadmap-skill.js","sourceRoot":"","sources":["../../src/compile/roadmap-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAA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E,KAAK,SAAS;YACZ,OAAO,uCAAuC,kBAAkB,EAAE,CAAC;QACrE;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import type { Skill } from '../core/types.js';
|
|
31
31
|
/** What a generated file says about itself, or `null` when it says nothing. */
|
|
32
32
|
export interface GeneratedMarker {
|
|
33
|
-
/** The CLI version that
|
|
33
|
+
/** The CLI version at which the body last changed — not the one that last wrote the file. */
|
|
34
34
|
version: string;
|
|
35
35
|
/** The recorded hash of everything below the marker line. */
|
|
36
36
|
sha256: string;
|
|
@@ -47,8 +47,15 @@ export declare function markerFor(version: string, body: string): string;
|
|
|
47
47
|
*
|
|
48
48
|
* Idempotent: re-stamping an already-stamped body yields the same result rather
|
|
49
49
|
* than nesting markers, so it is safe on a body that has been round-tripped.
|
|
50
|
+
*
|
|
51
|
+
* `prior` is the marker the file on disk already carries. When it vouches for
|
|
52
|
+
* exactly this body its version is kept, and since the hash is equal by
|
|
53
|
+
* construction the machine line comes out byte for byte the same — so an
|
|
54
|
+
* unchanged body is an unchanged file whatever CLI version emits it
|
|
55
|
+
* (update-restamps-unchanged-skills/AC-1). Any other body takes `version`
|
|
56
|
+
* (AC-2, AC-3).
|
|
50
57
|
*/
|
|
51
|
-
export declare function stampBody(body: string, version: string): string;
|
|
58
|
+
export declare function stampBody(body: string, version: string, prior?: GeneratedMarker | null): string;
|
|
52
59
|
/**
|
|
53
60
|
* Read what a generated file claims about itself.
|
|
54
61
|
*
|
|
@@ -70,19 +77,28 @@ export declare function stripMarker(content: string): string;
|
|
|
70
77
|
/**
|
|
71
78
|
* Is this generated file still exactly what the emitter wrote?
|
|
72
79
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
80
|
+
* Distinguishable answers, which is what makes the doctor report useful rather
|
|
81
|
+
* than merely red (update-overwrites-authored-context/AC-16):
|
|
75
82
|
*
|
|
76
83
|
* - `unmarked` — emitted before markers existed, or hand-created. Not evidence of
|
|
77
84
|
* an edit.
|
|
78
|
-
* - `
|
|
79
|
-
*
|
|
80
|
-
* - `
|
|
85
|
+
* - `edited` — the content no longer hashes to what its marker recorded, at any
|
|
86
|
+
* version. Somebody changed the artifact.
|
|
87
|
+
* - `newer-cli` — intact, but its body last changed at a version newer than the
|
|
88
|
+
* running CLI. This CLI is behind, and its `aidlc update` would roll the prose
|
|
89
|
+
* back, so the remedy is upgrading the CLI.
|
|
90
|
+
* - `clean` — intact, at the running version or an older one. An older version is
|
|
91
|
+
* normal: it is when the body last changed (update-restamps-unchanged-skills/AC-9).
|
|
92
|
+
*
|
|
93
|
+
* `newer-cli` was `version-skew`, raised on *any* mismatch. Once an unchanged body
|
|
94
|
+
* keeps its version, that fired on every file after every release with a remedy
|
|
95
|
+
* that could not clear it — so it was narrowed and renamed on purpose, the rename
|
|
96
|
+
* so nobody reads the old meaning into it (AC-11).
|
|
81
97
|
*/
|
|
82
98
|
export type MarkerVerdict = {
|
|
83
99
|
state: 'unmarked';
|
|
84
100
|
} | {
|
|
85
|
-
state: '
|
|
101
|
+
state: 'newer-cli';
|
|
86
102
|
emittedBy: string;
|
|
87
103
|
} | {
|
|
88
104
|
state: 'edited';
|
|
@@ -92,6 +108,16 @@ export type MarkerVerdict = {
|
|
|
92
108
|
emittedBy: string;
|
|
93
109
|
};
|
|
94
110
|
export declare function verifyMarker(content: string, runningVersion: string): MarkerVerdict;
|
|
111
|
+
/**
|
|
112
|
+
* Is `candidate` a strictly later `major.minor.patch` than `than`?
|
|
113
|
+
*
|
|
114
|
+
* Anything that is not three dot-separated whole numbers — a prerelease such as
|
|
115
|
+
* `1.54.0-rc.1`, a hand-typed string — is never newer, so the hash alone decides
|
|
116
|
+
* (update-restamps-unchanged-skills/AC-12). `update.ts` has its own `isOlderThan`,
|
|
117
|
+
* but it lets a non-numeric part become `NaN` and compare as neither, which is a
|
|
118
|
+
* silent answer this check should not give.
|
|
119
|
+
*/
|
|
120
|
+
export declare function isNewerVersion(candidate: string, than: string): boolean;
|
|
95
121
|
/**
|
|
96
122
|
* Format a skill as its canonical file content: frontmatter, then body.
|
|
97
123
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-format.d.ts","sourceRoot":"","sources":["../../src/compile/skill-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-format.d.ts","sourceRoot":"","sources":["../../src/compile/skill-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA+C9C,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,6FAA6F;IAC7F,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,GAC7B,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAIlE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBjE;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,GACrB;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,aAAa,CAcnF;AAID;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CASvE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAUzD"}
|
|
@@ -40,6 +40,13 @@ import { createHash } from 'node:crypto';
|
|
|
40
40
|
* the whole divergence check: version plus a hash of the body beneath it, so drift
|
|
41
41
|
* is detectable from the artifact alone.
|
|
42
42
|
*
|
|
43
|
+
* **The version is the CLI version at which the body last changed, not the
|
|
44
|
+
* version that last wrote the file.** A re-emit whose body hashes to the recorded
|
|
45
|
+
* `sha256` keeps the existing marker line (`stampBody`'s `prior`). Stamping the
|
|
46
|
+
* running version instead restamped 42–44 byte-identical bodies on every release,
|
|
47
|
+
* and every branch that ran `aidlc update` then conflicted with every other one on
|
|
48
|
+
* files nobody edited (update-restamps-unchanged-skills/AC-1, AC-13).
|
|
49
|
+
*
|
|
43
50
|
* **Why a body comment and not a frontmatter key.** `formatCanonicalSkill` below
|
|
44
51
|
* emits a fixed five-field whitelist, so an unknown frontmatter key is silently
|
|
45
52
|
* dropped — the same fact `compile/roadmap-skill.ts` already works around. And no
|
|
@@ -93,10 +100,18 @@ export function markerFor(version, body) {
|
|
|
93
100
|
*
|
|
94
101
|
* Idempotent: re-stamping an already-stamped body yields the same result rather
|
|
95
102
|
* than nesting markers, so it is safe on a body that has been round-tripped.
|
|
103
|
+
*
|
|
104
|
+
* `prior` is the marker the file on disk already carries. When it vouches for
|
|
105
|
+
* exactly this body its version is kept, and since the hash is equal by
|
|
106
|
+
* construction the machine line comes out byte for byte the same — so an
|
|
107
|
+
* unchanged body is an unchanged file whatever CLI version emits it
|
|
108
|
+
* (update-restamps-unchanged-skills/AC-1). Any other body takes `version`
|
|
109
|
+
* (AC-2, AC-3).
|
|
96
110
|
*/
|
|
97
|
-
export function stampBody(body, version) {
|
|
111
|
+
export function stampBody(body, version, prior) {
|
|
98
112
|
const bare = stripMarker(body);
|
|
99
|
-
|
|
113
|
+
const kept = prior && prior.sha256 === hashBelowMarker(bare) ? prior.version : version;
|
|
114
|
+
return `${markerFor(kept, bare)}${bare}`;
|
|
100
115
|
}
|
|
101
116
|
/**
|
|
102
117
|
* Read what a generated file claims about itself.
|
|
@@ -149,16 +164,39 @@ export function verifyMarker(content, runningVersion) {
|
|
|
149
164
|
const marker = readMarker(content);
|
|
150
165
|
if (!marker)
|
|
151
166
|
return { state: 'unmarked' };
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return { state: 'version-skew', emittedBy: marker.version };
|
|
157
|
-
}
|
|
167
|
+
// Hash first, at every version. The recorded hash is over the body that version
|
|
168
|
+
// emitted, so a mismatch means an edit whichever version wrote it; the marker
|
|
169
|
+
// format has not changed since it shipped, so an older marker hashes the same way
|
|
170
|
+
// (update-restamps-unchanged-skills/AC-10).
|
|
158
171
|
const below = contentBelowMarker(content) ?? '';
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
if (hashBelowMarker(below) !== marker.sha256) {
|
|
173
|
+
return { state: 'edited', emittedBy: marker.version };
|
|
174
|
+
}
|
|
175
|
+
return isNewerVersion(marker.version, runningVersion)
|
|
176
|
+
? { state: 'newer-cli', emittedBy: marker.version }
|
|
177
|
+
: { state: 'clean', emittedBy: marker.version };
|
|
178
|
+
}
|
|
179
|
+
const PLAIN_VERSION_RE = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
180
|
+
/**
|
|
181
|
+
* Is `candidate` a strictly later `major.minor.patch` than `than`?
|
|
182
|
+
*
|
|
183
|
+
* Anything that is not three dot-separated whole numbers — a prerelease such as
|
|
184
|
+
* `1.54.0-rc.1`, a hand-typed string — is never newer, so the hash alone decides
|
|
185
|
+
* (update-restamps-unchanged-skills/AC-12). `update.ts` has its own `isOlderThan`,
|
|
186
|
+
* but it lets a non-numeric part become `NaN` and compare as neither, which is a
|
|
187
|
+
* silent answer this check should not give.
|
|
188
|
+
*/
|
|
189
|
+
export function isNewerVersion(candidate, than) {
|
|
190
|
+
const a = PLAIN_VERSION_RE.exec(candidate);
|
|
191
|
+
const b = PLAIN_VERSION_RE.exec(than);
|
|
192
|
+
if (!a || !b)
|
|
193
|
+
return false;
|
|
194
|
+
for (let i = 1; i <= 3; i++) {
|
|
195
|
+
const diff = Number(a[i]) - Number(b[i]);
|
|
196
|
+
if (diff !== 0)
|
|
197
|
+
return diff > 0;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
162
200
|
}
|
|
163
201
|
/**
|
|
164
202
|
* Format a skill as its canonical file content: frontmatter, then body.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-format.js","sourceRoot":"","sources":["../../src/compile/skill-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E
|
|
1
|
+
{"version":3,"file":"skill-format.js","sourceRoot":"","sources":["../../src/compile/skill-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;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AAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAY;IAC/C,MAAM,KAAK,GAAa,CAAC,KAAK,CAAC,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACrD,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -23,13 +23,22 @@
|
|
|
23
23
|
* wanted upgrade from an unwanted overwrite. Nothing here writes anything under any
|
|
24
24
|
* tier or flag, and it never gates doctor's exit code (AC-14, NFR-4).
|
|
25
25
|
*
|
|
26
|
-
* **
|
|
26
|
+
* **Causes, told apart.** A missing marker means the file predates markers —
|
|
27
27
|
* every repo in the world reads that way until its first post-upgrade `update`, so
|
|
28
|
-
* it is reported as expected churn rather than as damage. A
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* it is reported as expected churn rather than as damage. A hash mismatch means
|
|
29
|
+
* somebody edited the artifact, at whatever version (AC-16). A marker newer than the
|
|
30
|
+
* running CLI means this CLI is behind the one that wrote the checkout.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* **An older marker is not reported.** It used to be, as skew remedied by `aidlc
|
|
33
|
+
* update`. Since a body that did not change now keeps its version, an older marker
|
|
34
|
+
* is the normal state of an up-to-date checkout, and `update` would not change it —
|
|
35
|
+
* so that report fired on every file after every release and could not be cleared
|
|
36
|
+
* (update-restamps-unchanged-skills/AC-9). What it stood in for, a CLI upgraded
|
|
37
|
+
* without `update` being run, is not detectable from the marker alone; detecting it
|
|
38
|
+
* means rebuilding the bodies, which the paragraph above rules out.
|
|
39
|
+
*
|
|
40
|
+
* Requirements: update-overwrites-authored-context/AC-14 … AC-17, AC-19;
|
|
41
|
+
* update-restamps-unchanged-skills/AC-9 … AC-11
|
|
33
42
|
*/
|
|
34
43
|
import type { CheckResult, DoctorContext, Migration } from '../types.js';
|
|
35
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-source-drift.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/artifact-source-drift.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"artifact-source-drift.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/artifact-source-drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiDzE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CA6BlE;AAwDD,eAAO,MAAM,mBAAmB,EAAE,SAIjC,CAAC"}
|
|
@@ -23,17 +23,26 @@
|
|
|
23
23
|
* wanted upgrade from an unwanted overwrite. Nothing here writes anything under any
|
|
24
24
|
* tier or flag, and it never gates doctor's exit code (AC-14, NFR-4).
|
|
25
25
|
*
|
|
26
|
-
* **
|
|
26
|
+
* **Causes, told apart.** A missing marker means the file predates markers —
|
|
27
27
|
* every repo in the world reads that way until its first post-upgrade `update`, so
|
|
28
|
-
* it is reported as expected churn rather than as damage. A
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* it is reported as expected churn rather than as damage. A hash mismatch means
|
|
29
|
+
* somebody edited the artifact, at whatever version (AC-16). A marker newer than the
|
|
30
|
+
* running CLI means this CLI is behind the one that wrote the checkout.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* **An older marker is not reported.** It used to be, as skew remedied by `aidlc
|
|
33
|
+
* update`. Since a body that did not change now keeps its version, an older marker
|
|
34
|
+
* is the normal state of an up-to-date checkout, and `update` would not change it —
|
|
35
|
+
* so that report fired on every file after every release and could not be cleared
|
|
36
|
+
* (update-restamps-unchanged-skills/AC-9). What it stood in for, a CLI upgraded
|
|
37
|
+
* without `update` being run, is not detectable from the marker alone; detecting it
|
|
38
|
+
* means rebuilding the bodies, which the paragraph above rules out.
|
|
39
|
+
*
|
|
40
|
+
* Requirements: update-overwrites-authored-context/AC-14 … AC-17, AC-19;
|
|
41
|
+
* update-restamps-unchanged-skills/AC-9 … AC-11
|
|
33
42
|
*/
|
|
34
43
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
35
44
|
import { join } from 'node:path';
|
|
36
|
-
import { verifyMarker } from '../../compile/skill-format.js';
|
|
45
|
+
import { isNewerVersion, verifyMarker } from '../../compile/skill-format.js';
|
|
37
46
|
import { VERSION } from '../../core/version.js';
|
|
38
47
|
/**
|
|
39
48
|
* Where generated skill bodies live, relative to the project root.
|
|
@@ -110,27 +119,29 @@ export function artifactDriftCheck(ctx) {
|
|
|
110
119
|
* One sentence per cause, each naming its own files.
|
|
111
120
|
*
|
|
112
121
|
* Grouped by cause rather than listing files flatly, because the remedy differs:
|
|
113
|
-
*
|
|
114
|
-
* whether the edit or the source is right.
|
|
122
|
+
* unmarked ends with `aidlc update`, a newer marker with upgrading the CLI, and an
|
|
123
|
+
* edit needs somebody to decide whether the edit or the source is right.
|
|
115
124
|
*/
|
|
116
125
|
function describe(diverged) {
|
|
117
126
|
const unmarked = diverged.filter((d) => d.verdict.state === 'unmarked');
|
|
118
|
-
const
|
|
127
|
+
const newer = diverged.filter((d) => d.verdict.state === 'newer-cli');
|
|
119
128
|
const edited = diverged.filter((d) => d.verdict.state === 'edited');
|
|
120
129
|
const parts = [];
|
|
121
130
|
if (edited.length > 0) {
|
|
122
|
-
parts.push(`${edited.length} generated file(s)
|
|
123
|
-
`
|
|
131
|
+
parts.push(`${edited.length} generated file(s) no longer match the hash their marker recorded ` +
|
|
132
|
+
`when they were emitted — so the difference is a hand edit, not framework skew: ` +
|
|
124
133
|
`${list(edited)}. \`aidlc update\` will overwrite it; save anything worth keeping ` +
|
|
125
134
|
`to .aidlc/context/*.md first, which regeneration preserves.`);
|
|
126
135
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
if (newer.length > 0) {
|
|
137
|
+
// The newest only: it is the version to upgrade to, and a list would need a
|
|
138
|
+
// version-aware sort that a plain `.sort()` gets wrong at 1.10 vs 1.9.
|
|
139
|
+
const newest = newer
|
|
140
|
+
.map((d) => (d.verdict.state === 'newer-cli' ? d.verdict.emittedBy : VERSION))
|
|
141
|
+
.reduce((a, b) => (isNewerVersion(b, a) ? b : a));
|
|
142
|
+
parts.push(`${newer.length} generated file(s) were written by a newer CLI (${newest}) than this ` +
|
|
143
|
+
`one (${VERSION}): ${list(newer)}. Upgrade the CLI before running \`aidlc update\` — ` +
|
|
144
|
+
`an update from ${VERSION} can roll their prose back to this version's.`);
|
|
134
145
|
}
|
|
135
146
|
if (unmarked.length > 0) {
|
|
136
147
|
parts.push(`${unmarked.length} generated file(s) carry no provenance marker, meaning they predate ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-source-drift.js","sourceRoot":"","sources":["../../../src/doctor/migrations/artifact-source-drift.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"artifact-source-drift.js","sourceRoot":"","sources":["../../../src/doctor/migrations/artifact-source-drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAsB,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAO/D,iFAAiF;AACjF,SAAS,SAAS,CAAC,WAAmB;IACpC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,6EAA6E;YAC7E,4BAA4B;YAC5B,SAAS;QACX,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACnC,4EAA4E;YAC5E,oDAAoD;YACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;gBAC9B,SAAS;YACX,CAAC;YACD,MAAM,MAAM,GAA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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roster.d.ts","sourceRoot":"","sources":["../../src/menu/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,SAAS,EAqBtC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"roster.d.ts","sourceRoot":"","sources":["../../src/menu/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,SAAS,EAqBtC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyCvD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAM7C,CAAC"}
|
package/dist/menu/roster.js
CHANGED
|
@@ -82,6 +82,8 @@ export const EXCLUSIONS = {
|
|
|
82
82
|
'cross-check': 'needs an instance at the start of its implementation phase, and the menu reads no project ' +
|
|
83
83
|
'state so it cannot tell which one that is; the implementation skill offers it at that ' +
|
|
84
84
|
'moment (cross-artifact-check/AC-17, AC-18).',
|
|
85
|
+
revert: 'needs an instance in its implementation phase and a task id, and the menu reads no project ' +
|
|
86
|
+
'state so it cannot tell which; the implementation skill names it (revert-by-task/AC-1, AC-23).',
|
|
85
87
|
};
|
|
86
88
|
/** Bucket order for grouping; matches the order entries appear in `ROSTER`. */
|
|
87
89
|
export const BUCKET_ORDER = [
|
package/dist/menu/roster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roster.js","sourceRoot":"","sources":["../../src/menu/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkBH;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAyB;IAC1C,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,8BAA8B,EAAE;IAC1E,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE;IACjE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE;IAC5D,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,IAAI,EAAE;IAClF,EAAE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,IAAI,EAAE,QAAQ;IACd,UAAU,EACR,8EAA8E;QAC9E,gFAAgF;QAChF,yEAAyE;QACzE,qEAAqE;IACvE,YAAY,EACV,kGAAkG;IACpG,OAAO,EACL,mFAAmF;QACnF,uFAAuF;QACvF,uFAAuF;QACvF,8FAA8F;IAChG,KAAK,EACH,2FAA2F;QAC3F,4FAA4F;QAC5F,8EAA8E;QAC9E,4BAA4B;IAC9B,SAAS,EACP,oFAAoF;QACpF,0FAA0F;QAC1F,uCAAuC;IACzC,IAAI,EACF,2FAA2F;QAC3F,gGAAgG;IAClG,aAAa,EACX,4FAA4F;QAC5F,wFAAwF;QACxF,6CAA6C;IAC/C,MAAM,EACJ,6FAA6F;QAC7F,gGAAgG;CACnG,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,OAAO;IACP,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;CACX,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Undo a plan's commits as one new commit (revert-by-task D2).
|
|
3
|
+
*
|
|
4
|
+
* The working tree was clean when this starts (`checkRepo`, AC-18), so every
|
|
5
|
+
* failure path can return to the recorded `HEAD` with `reset --hard` and lose
|
|
6
|
+
* nothing but what this run wrote (AC-17).
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle state is never reverted by git: a task commit may carry its own
|
|
9
|
+
* `[x]`, phase YAML or cost records, and undoing those would rewind state by
|
|
10
|
+
* accident. `.aidlc/state/` is restored from `HEAD` after the revert, and the
|
|
11
|
+
* only state change is the checkbox reset this module writes (D3, AC-16).
|
|
12
|
+
*
|
|
13
|
+
* The new commit carries no `Task:` trailer — it would otherwise be selected
|
|
14
|
+
* by the next `--task` run and undone, re-applying the work.
|
|
15
|
+
*
|
|
16
|
+
* Requirements: revert-by-task/AC-15, AC-16, AC-17
|
|
17
|
+
*/
|
|
18
|
+
import { type Plan } from './plan.js';
|
|
19
|
+
export type ApplyResult = {
|
|
20
|
+
ok: true;
|
|
21
|
+
sha: string;
|
|
22
|
+
short: string;
|
|
23
|
+
reset: number[];
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
reason: 'conflict';
|
|
27
|
+
short: string;
|
|
28
|
+
subject: string;
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: 'empty';
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
reason: 'commit-failed';
|
|
35
|
+
detail: string;
|
|
36
|
+
};
|
|
37
|
+
/** The commit message: subject, one summary line, then git's own revert lines. */
|
|
38
|
+
export declare function revertMessage(instance: string, plan: Plan): string;
|
|
39
|
+
export declare function applyRevert(projectRoot: string, instance: string, plan: Plan): ApplyResult;
|
|
40
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/revert/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAElE,MAAM,MAAM,WAAW,GACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GACzD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAI3D,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAelE;AAgDD,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CA0D1F"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Undo a plan's commits as one new commit (revert-by-task D2).
|
|
3
|
+
*
|
|
4
|
+
* The working tree was clean when this starts (`checkRepo`, AC-18), so every
|
|
5
|
+
* failure path can return to the recorded `HEAD` with `reset --hard` and lose
|
|
6
|
+
* nothing but what this run wrote (AC-17).
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle state is never reverted by git: a task commit may carry its own
|
|
9
|
+
* `[x]`, phase YAML or cost records, and undoing those would rewind state by
|
|
10
|
+
* accident. `.aidlc/state/` is restored from `HEAD` after the revert, and the
|
|
11
|
+
* only state change is the checkbox reset this module writes (D3, AC-16).
|
|
12
|
+
*
|
|
13
|
+
* The new commit carries no `Task:` trailer — it would otherwise be selected
|
|
14
|
+
* by the next `--task` run and undone, re-applying the work.
|
|
15
|
+
*
|
|
16
|
+
* Requirements: revert-by-task/AC-15, AC-16, AC-17
|
|
17
|
+
*/
|
|
18
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { instancePath } from '../state/snapshot-store.js';
|
|
21
|
+
import { resetDone } from '../tasks/reset.js';
|
|
22
|
+
import { git } from './commits.js';
|
|
23
|
+
import { describeSelector, taskList } from './plan.js';
|
|
24
|
+
const STATE_DIR = '.aidlc/state';
|
|
25
|
+
/** The commit message: subject, one summary line, then git's own revert lines. */
|
|
26
|
+
export function revertMessage(instance, plan) {
|
|
27
|
+
const n = plan.commits.length;
|
|
28
|
+
const tagged = plan.selector.kind === 'task'
|
|
29
|
+
? `Task: ${instance}/T${plan.selector.task}`
|
|
30
|
+
: `a task of ${instance}`;
|
|
31
|
+
return [
|
|
32
|
+
`revert(${instance}): undo ${describeSelector(plan.selector)}`,
|
|
33
|
+
'',
|
|
34
|
+
`Undoes ${n} commit${n === 1 ? '' : 's'} tagged with ${tagged}. ` +
|
|
35
|
+
`Resets ${taskList(plan.resetTasks)} in tasks.md.`,
|
|
36
|
+
'',
|
|
37
|
+
...plan.commits.map((c) => `This reverts commit ${c.sha}.`),
|
|
38
|
+
'',
|
|
39
|
+
].join('\n');
|
|
40
|
+
}
|
|
41
|
+
function abandon(projectRoot, head) {
|
|
42
|
+
// `--quit` clears any sequencer state a failed revert left; it fails
|
|
43
|
+
// harmlessly when there is none.
|
|
44
|
+
try {
|
|
45
|
+
git(projectRoot, ['revert', '--quit']);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
/* nothing in progress */
|
|
49
|
+
}
|
|
50
|
+
git(projectRoot, ['reset', '-q', '--hard', head]);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* After git stopped a revert, resolve it when every conflict is under
|
|
54
|
+
* `.aidlc/state/`, and say whether it did. A task commit usually ticks its own
|
|
55
|
+
* box, so undoing it collides with the next task's tick on the adjacent line;
|
|
56
|
+
* state is restored from `HEAD` regardless (D3), so taking `HEAD`'s state now
|
|
57
|
+
* loses nothing. No unmerged path at all means git failed for another reason.
|
|
58
|
+
*/
|
|
59
|
+
function resolvedInState(projectRoot) {
|
|
60
|
+
try {
|
|
61
|
+
const paths = git(projectRoot, ['diff', '--name-only', '-z', '--diff-filter=U']).split('\0').filter(Boolean);
|
|
62
|
+
if (paths.length === 0 || !paths.every((p) => p.startsWith(`${STATE_DIR}/`)))
|
|
63
|
+
return false;
|
|
64
|
+
git(projectRoot, ['restore', '--source=HEAD', '--staged', '--worktree', '--', STATE_DIR]);
|
|
65
|
+
// Clears the stopped revert so the next commit can be undone.
|
|
66
|
+
git(projectRoot, ['revert', '--quit']);
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function isTracked(projectRoot, path) {
|
|
74
|
+
try {
|
|
75
|
+
git(projectRoot, ['ls-files', '--error-unmatch', '--', path]);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function firstLine(err) {
|
|
83
|
+
const e = err;
|
|
84
|
+
const text = (e.stderr || e.message || String(err)).trim();
|
|
85
|
+
return text.split('\n')[0] ?? '';
|
|
86
|
+
}
|
|
87
|
+
export function applyRevert(projectRoot, instance, plan) {
|
|
88
|
+
const head = git(projectRoot, ['rev-parse', 'HEAD']).trim();
|
|
89
|
+
// Validates the instance name as a single path segment before it reaches git.
|
|
90
|
+
const tasksAbs = join(instancePath(join(projectRoot, STATE_DIR), instance), 'tasks.md');
|
|
91
|
+
const tasksRel = `${STATE_DIR}/${instance}/tasks.md`;
|
|
92
|
+
// Newest first, so each inverse applies over the tree its successor left.
|
|
93
|
+
for (const c of plan.commits) {
|
|
94
|
+
try {
|
|
95
|
+
git(projectRoot, ['revert', '--no-commit', c.sha]);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
if (!resolvedInState(projectRoot)) {
|
|
99
|
+
abandon(projectRoot, head);
|
|
100
|
+
return { ok: false, reason: 'conflict', short: c.short, subject: c.subject };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const stateTracked = git(projectRoot, ['ls-tree', '-d', '--name-only', 'HEAD', '--', STATE_DIR]).trim() !== '';
|
|
105
|
+
const stateStaged = git(projectRoot, ['diff', '--cached', '--name-only', '--', STATE_DIR]).trim() !== '';
|
|
106
|
+
if (stateTracked || stateStaged) {
|
|
107
|
+
git(projectRoot, ['restore', '--source=HEAD', '--staged', '--worktree', '--', STATE_DIR]);
|
|
108
|
+
}
|
|
109
|
+
let tasksContent = null;
|
|
110
|
+
try {
|
|
111
|
+
tasksContent = readFileSync(tasksAbs, 'utf8');
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
/* no tasks.md: nothing to reset */
|
|
115
|
+
}
|
|
116
|
+
const reset = tasksContent === null ? { content: '', reset: [] } : resetDone(tasksContent, plan.resetTasks);
|
|
117
|
+
const tasksTracked = reset.reset.length > 0 && isTracked(projectRoot, tasksRel);
|
|
118
|
+
if (tasksTracked) {
|
|
119
|
+
writeFileSync(tasksAbs, reset.content);
|
|
120
|
+
git(projectRoot, ['add', '--', tasksRel]);
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
git(projectRoot, ['diff', '--cached', '--quiet']);
|
|
124
|
+
abandon(projectRoot, head);
|
|
125
|
+
return { ok: false, reason: 'empty' };
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
/* staged changes exist — the normal case */
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
git(projectRoot, ['commit', '-q', '-F', '-'], revertMessage(instance, plan));
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
abandon(projectRoot, head);
|
|
135
|
+
return { ok: false, reason: 'commit-failed', detail: firstLine(err) };
|
|
136
|
+
}
|
|
137
|
+
// An untracked (ignored) tasks.md cannot ride in the commit; write it only
|
|
138
|
+
// once the commit exists, so a failure above leaves it untouched.
|
|
139
|
+
if (reset.reset.length > 0 && !tasksTracked)
|
|
140
|
+
writeFileSync(tasksAbs, reset.content);
|
|
141
|
+
const sha = git(projectRoot, ['rev-parse', 'HEAD']).trim();
|
|
142
|
+
return { ok: true, sha, short: sha.slice(0, 7), reset: reset.reset };
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=apply.js.map
|