@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/revert/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAQlE,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,kFAAkF;AAClF,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,IAAU;IACxD,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;QAC3B,CAAC,CAAC,SAAS,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;QAC5C,CAAC,CAAC,aAAa,QAAQ,EAAE,CAAC;IAC9B,OAAO;QACL,UAAU,QAAQ,WAAW,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC9D,EAAE;QACF,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC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IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git reads for `aidlc revert`: is this a branch we may revert on, and which
|
|
3
|
+
* commits has it made since it left `main`.
|
|
4
|
+
*
|
|
5
|
+
* `main` is the base branch the rest of the CLI hard-codes
|
|
6
|
+
* (`concurrency/worktree.ts`, `autopilot/driver.ts`); merged work on `main` is
|
|
7
|
+
* out of scope (revert-by-task/AC-22). Every call is `execFileSync` with an
|
|
8
|
+
* argument array — no shell string ever carries a name from argv.
|
|
9
|
+
*
|
|
10
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6, AC-9, AC-18, AC-21, AC-22
|
|
11
|
+
*/
|
|
12
|
+
import { type TaskRef } from './trailers.js';
|
|
13
|
+
/** One commit in `main..HEAD`. */
|
|
14
|
+
export interface BranchCommit {
|
|
15
|
+
sha: string;
|
|
16
|
+
short: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
/** Parent count; more than one is a merge (AC-9). */
|
|
19
|
+
parents: number;
|
|
20
|
+
/** Tasks named by well-formed `Task:` trailers. */
|
|
21
|
+
tasks: TaskRef[];
|
|
22
|
+
/** Full shas this commit's message says it reverts (AC-6). */
|
|
23
|
+
reverts: string[];
|
|
24
|
+
}
|
|
25
|
+
export type RepoMiss = 'not-a-repo' | 'no-main' | 'on-main' | 'dirty';
|
|
26
|
+
export type RepoCheck = {
|
|
27
|
+
ok: true;
|
|
28
|
+
branch: string;
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: RepoMiss;
|
|
32
|
+
};
|
|
33
|
+
/** Run git in the project root and return stdout; throws on a non-zero exit. */
|
|
34
|
+
export declare function git(projectRoot: string, args: string[], input?: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* The preconditions every revert needs, in the order the command reports
|
|
37
|
+
* them: a work tree, a `main` branch, not standing on it, and no uncommitted
|
|
38
|
+
* change to a tracked file (untracked files cannot be lost by a revert and do
|
|
39
|
+
* not block it).
|
|
40
|
+
*/
|
|
41
|
+
export declare function checkRepo(projectRoot: string): RepoCheck;
|
|
42
|
+
/** Commits reachable from HEAD and not from `main`, newest first. */
|
|
43
|
+
export declare function branchCommits(projectRoot: string): BranchCommit[];
|
|
44
|
+
//# sourceMappingURL=commits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commits.d.ts","sourceRoot":"","sources":["../../src/revert/commits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7E,kCAAkC;AAClC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvF,gFAAgF;AAChF,wBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/E;AAWD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAiBxD;AAWD,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAsBjE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git reads for `aidlc revert`: is this a branch we may revert on, and which
|
|
3
|
+
* commits has it made since it left `main`.
|
|
4
|
+
*
|
|
5
|
+
* `main` is the base branch the rest of the CLI hard-codes
|
|
6
|
+
* (`concurrency/worktree.ts`, `autopilot/driver.ts`); merged work on `main` is
|
|
7
|
+
* out of scope (revert-by-task/AC-22). Every call is `execFileSync` with an
|
|
8
|
+
* argument array — no shell string ever carries a name from argv.
|
|
9
|
+
*
|
|
10
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6, AC-9, AC-18, AC-21, AC-22
|
|
11
|
+
*/
|
|
12
|
+
import { execFileSync } from 'node:child_process';
|
|
13
|
+
import { parseTaskTrailer, revertedShas } from './trailers.js';
|
|
14
|
+
/** Run git in the project root and return stdout; throws on a non-zero exit. */
|
|
15
|
+
export function git(projectRoot, args, input) {
|
|
16
|
+
return execFileSync('git', args, {
|
|
17
|
+
cwd: projectRoot,
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
input,
|
|
20
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function succeeds(projectRoot, args) {
|
|
24
|
+
try {
|
|
25
|
+
git(projectRoot, args);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The preconditions every revert needs, in the order the command reports
|
|
34
|
+
* them: a work tree, a `main` branch, not standing on it, and no uncommitted
|
|
35
|
+
* change to a tracked file (untracked files cannot be lost by a revert and do
|
|
36
|
+
* not block it).
|
|
37
|
+
*/
|
|
38
|
+
export function checkRepo(projectRoot) {
|
|
39
|
+
if (!succeeds(projectRoot, ['rev-parse', '--is-inside-work-tree'])) {
|
|
40
|
+
return { ok: false, reason: 'not-a-repo' };
|
|
41
|
+
}
|
|
42
|
+
if (!succeeds(projectRoot, ['rev-parse', '--verify', '--quiet', 'refs/heads/main'])) {
|
|
43
|
+
return { ok: false, reason: 'no-main' };
|
|
44
|
+
}
|
|
45
|
+
let branch = '';
|
|
46
|
+
try {
|
|
47
|
+
branch = git(projectRoot, ['symbolic-ref', '-q', 'HEAD']).trim();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Detached HEAD: main..HEAD is still well defined, so it is allowed.
|
|
51
|
+
}
|
|
52
|
+
if (branch === 'refs/heads/main')
|
|
53
|
+
return { ok: false, reason: 'on-main' };
|
|
54
|
+
const dirty = git(projectRoot, ['status', '--porcelain', '--untracked-files=no']).trim();
|
|
55
|
+
if (dirty !== '')
|
|
56
|
+
return { ok: false, reason: 'dirty' };
|
|
57
|
+
return { ok: true, branch: branch.replace(/^refs\/heads\//, '') || 'HEAD' };
|
|
58
|
+
}
|
|
59
|
+
// NUL separates every field, and `-z` ends every record with one. It is the
|
|
60
|
+
// only byte no message can carry: `git commit` refuses a NUL, and git cuts a
|
|
61
|
+
// hand-built message's output at one. Other control characters survive in a
|
|
62
|
+
// message — a body carrying the old \x1e/\x1f separators forged a second
|
|
63
|
+
// record naming a commit on main (revert-by-task/AC-2). Trailer values are
|
|
64
|
+
// unfolded, so a newline cannot occur inside one and separates them.
|
|
65
|
+
const FIELDS = ['%H', '%h', '%P', '%s', '%(trailers:key=Task,valueonly,unfold,separator=%x0a)', '%b'];
|
|
66
|
+
const FORMAT = FIELDS.join('%x00');
|
|
67
|
+
/** Commits reachable from HEAD and not from `main`, newest first. */
|
|
68
|
+
export function branchCommits(projectRoot) {
|
|
69
|
+
const out = git(projectRoot, ['log', '-z', `--format=${FORMAT}`, 'main..HEAD']);
|
|
70
|
+
const fields = out.split('\0');
|
|
71
|
+
fields.pop(); // the empty string after the last record's terminator
|
|
72
|
+
const commits = [];
|
|
73
|
+
for (let i = 0; i + FIELDS.length <= fields.length; i += FIELDS.length) {
|
|
74
|
+
const [sha, short, parents, subject, trailers, body] = fields.slice(i, i + FIELDS.length);
|
|
75
|
+
const tasks = [];
|
|
76
|
+
for (const value of trailers.split('\n')) {
|
|
77
|
+
const ref = parseTaskTrailer(value);
|
|
78
|
+
if (ref)
|
|
79
|
+
tasks.push(ref);
|
|
80
|
+
}
|
|
81
|
+
commits.push({
|
|
82
|
+
sha,
|
|
83
|
+
short,
|
|
84
|
+
subject,
|
|
85
|
+
parents: parents.trim() === '' ? 0 : parents.trim().split(' ').length,
|
|
86
|
+
tasks,
|
|
87
|
+
reverts: revertedShas(body),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return commits;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=commits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../src/revert/commits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAC;AAmB7E,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAE,IAAc,EAAE,KAAc;IACrE,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;QAC/B,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,MAAM;QAChB,KAAK;QACL,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KAChC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,WAAmB,EAAE,IAAc;IACnD,IAAI,CAAC;QACH,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAA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AAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM;YACrE,KAAK;YACL,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;SAC5B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choose the commits a revert undoes and say so before anything changes.
|
|
3
|
+
*
|
|
4
|
+
* Pure: takes the branch's commits as `branchCommits()` returns them (newest
|
|
5
|
+
* first) and decides. The plan is the whole safety story the roadmap item
|
|
6
|
+
* asks for — "it must show the plan and ask first" — so every commit that also
|
|
7
|
+
* belongs to another task is marked `shared` in words, never by colour alone
|
|
8
|
+
* (revert-by-task/AC-11).
|
|
9
|
+
*
|
|
10
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6, AC-8, AC-9, AC-10, AC-11
|
|
11
|
+
*/
|
|
12
|
+
import type { BranchCommit } from './commits.js';
|
|
13
|
+
/** `--task T<n>` or `--phase implementation` (every task of the instance). */
|
|
14
|
+
export type Selector = {
|
|
15
|
+
kind: 'task';
|
|
16
|
+
task: number;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'phase';
|
|
19
|
+
};
|
|
20
|
+
export interface PlanCommit {
|
|
21
|
+
sha: string;
|
|
22
|
+
short: string;
|
|
23
|
+
subject: string;
|
|
24
|
+
/** This instance's tasks the commit names, ascending. */
|
|
25
|
+
tasks: number[];
|
|
26
|
+
/** Of those, the ones the selector did not ask for (AC-11). */
|
|
27
|
+
shared: number[];
|
|
28
|
+
}
|
|
29
|
+
export interface Plan {
|
|
30
|
+
selector: Selector;
|
|
31
|
+
/** Newest first — the order they are undone in. */
|
|
32
|
+
commits: PlanCommit[];
|
|
33
|
+
/** Every task of this instance a selected commit names, ascending. */
|
|
34
|
+
resetTasks: number[];
|
|
35
|
+
}
|
|
36
|
+
export type PlanResult = {
|
|
37
|
+
ok: true;
|
|
38
|
+
plan: Plan;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
reason: 'no-commits';
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: 'merge-commit';
|
|
45
|
+
short: string;
|
|
46
|
+
subject: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function buildPlan(instance: string, selector: Selector, commits: BranchCommit[]): PlanResult;
|
|
49
|
+
/** `T3` or `T3, T4`. */
|
|
50
|
+
export declare function taskList(ids: number[]): string;
|
|
51
|
+
/** What the selector names, for the plan heading and the commit subject. */
|
|
52
|
+
export declare function describeSelector(selector: Selector): string;
|
|
53
|
+
/** The plan as printed before the question (AC-10, AC-11). */
|
|
54
|
+
export declare function formatPlan(instance: string, plan: Plan, branch: string): string[];
|
|
55
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/revert/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1E,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,mDAAmD;IACnD,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,sEAAsE;IACtE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACxB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACnC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAI1E,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,YAAY,EAAE,GACtB,UAAU,CAoBZ;AAED,wBAAwB;AACxB,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAE9C;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE3D;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAajF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choose the commits a revert undoes and say so before anything changes.
|
|
3
|
+
*
|
|
4
|
+
* Pure: takes the branch's commits as `branchCommits()` returns them (newest
|
|
5
|
+
* first) and decides. The plan is the whole safety story the roadmap item
|
|
6
|
+
* asks for — "it must show the plan and ask first" — so every commit that also
|
|
7
|
+
* belongs to another task is marked `shared` in words, never by colour alone
|
|
8
|
+
* (revert-by-task/AC-11).
|
|
9
|
+
*
|
|
10
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6, AC-8, AC-9, AC-10, AC-11
|
|
11
|
+
*/
|
|
12
|
+
const ascending = (a, b) => a - b;
|
|
13
|
+
export function buildPlan(instance, selector, commits) {
|
|
14
|
+
// A commit can only revert an older one, so collecting across the whole
|
|
15
|
+
// range is the same as "a later commit reverts it" (AC-6).
|
|
16
|
+
const undone = new Set(commits.flatMap((c) => c.reverts));
|
|
17
|
+
const selected = [];
|
|
18
|
+
for (const c of commits) {
|
|
19
|
+
if (undone.has(c.sha))
|
|
20
|
+
continue;
|
|
21
|
+
const tasks = [...new Set(c.tasks.filter((t) => t.instance === instance).map((t) => t.task))]
|
|
22
|
+
.sort(ascending);
|
|
23
|
+
if (tasks.length === 0)
|
|
24
|
+
continue;
|
|
25
|
+
if (selector.kind === 'task' && !tasks.includes(selector.task))
|
|
26
|
+
continue;
|
|
27
|
+
if (c.parents > 1)
|
|
28
|
+
return { ok: false, reason: 'merge-commit', short: c.short, subject: c.subject };
|
|
29
|
+
const shared = selector.kind === 'task' ? tasks.filter((t) => t !== selector.task) : [];
|
|
30
|
+
selected.push({ sha: c.sha, short: c.short, subject: c.subject, tasks, shared });
|
|
31
|
+
}
|
|
32
|
+
if (selected.length === 0)
|
|
33
|
+
return { ok: false, reason: 'no-commits' };
|
|
34
|
+
const resetTasks = [...new Set(selected.flatMap((c) => c.tasks))].sort(ascending);
|
|
35
|
+
return { ok: true, plan: { selector, commits: selected, resetTasks } };
|
|
36
|
+
}
|
|
37
|
+
/** `T3` or `T3, T4`. */
|
|
38
|
+
export function taskList(ids) {
|
|
39
|
+
return ids.map((n) => `T${n}`).join(', ');
|
|
40
|
+
}
|
|
41
|
+
/** What the selector names, for the plan heading and the commit subject. */
|
|
42
|
+
export function describeSelector(selector) {
|
|
43
|
+
return selector.kind === 'task' ? `T${selector.task}` : 'the implementation phase';
|
|
44
|
+
}
|
|
45
|
+
/** The plan as printed before the question (AC-10, AC-11). */
|
|
46
|
+
export function formatPlan(instance, plan, branch) {
|
|
47
|
+
const n = plan.commits.length;
|
|
48
|
+
const lines = [
|
|
49
|
+
`Plan: undo ${describeSelector(plan.selector)} of ${instance} — ` +
|
|
50
|
+
`${n} commit${n === 1 ? '' : 's'} on ${branch} since main, newest first:`,
|
|
51
|
+
];
|
|
52
|
+
for (const c of plan.commits) {
|
|
53
|
+
const shared = c.shared.length > 0 ? ` — shared: also ${taskList(c.shared)}` : '';
|
|
54
|
+
lines.push(` ${c.short} ${c.subject} [${taskList(c.tasks)}]${shared}`);
|
|
55
|
+
}
|
|
56
|
+
lines.push(`Tasks reset to open in tasks.md (if done): ${taskList(plan.resetTasks)}`);
|
|
57
|
+
lines.push('Nothing under .aidlc/state/ changes except those checkboxes.');
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/revert/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8BH,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AAE1D,MAAM,UAAU,SAAS,CACvB,QAAgB,EAChB,QAAkB,EAClB,OAAuB;IAEvB,wEAAwE;IACxE,2DAA2D;IAC3D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAE1D,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAAE,SAAS;QAChC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;aA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,8DAA8D,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure readers for the two commit-message lines `aidlc revert` trusts: the
|
|
3
|
+
* `Task:` trailer that ties a commit to a task, and git's own
|
|
4
|
+
* `This reverts commit <sha>.` line that marks one as already undone.
|
|
5
|
+
*
|
|
6
|
+
* Nothing here reads subjects. A subject mentioning "T3" for another reason
|
|
7
|
+
* must never select a commit (revert-by-task D1).
|
|
8
|
+
*
|
|
9
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6
|
|
10
|
+
*/
|
|
11
|
+
/** One task a commit's trailer names. */
|
|
12
|
+
export interface TaskRef {
|
|
13
|
+
instance: string;
|
|
14
|
+
/** n in T<n>. */
|
|
15
|
+
task: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse one `Task:` trailer value (`<instance>/T<n>`).
|
|
19
|
+
*
|
|
20
|
+
* @returns null for anything else — an unqualified `T3` or free text names no
|
|
21
|
+
* task, so it selects nothing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseTaskTrailer(value: string): TaskRef | null;
|
|
24
|
+
/** Full shas named by `This reverts commit <sha>.` lines in a commit body. */
|
|
25
|
+
export declare function revertedShas(body: string): string[];
|
|
26
|
+
//# sourceMappingURL=trailers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailers.d.ts","sourceRoot":"","sources":["../../src/revert/trailers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,yCAAyC;AACzC,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAG9D;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure readers for the two commit-message lines `aidlc revert` trusts: the
|
|
3
|
+
* `Task:` trailer that ties a commit to a task, and git's own
|
|
4
|
+
* `This reverts commit <sha>.` line that marks one as already undone.
|
|
5
|
+
*
|
|
6
|
+
* Nothing here reads subjects. A subject mentioning "T3" for another reason
|
|
7
|
+
* must never select a commit (revert-by-task D1).
|
|
8
|
+
*
|
|
9
|
+
* Requirements: revert-by-task/AC-2, AC-3, AC-6
|
|
10
|
+
*/
|
|
11
|
+
// Instance names are lowercase kebab-case single segments; task ids carry no
|
|
12
|
+
// leading zero, matching the tasks.md grammar (tasks/parser.ts).
|
|
13
|
+
const TASK_TRAILER_RE = /^([a-z0-9][a-z0-9-]*)\/T([1-9][0-9]*)$/;
|
|
14
|
+
const REVERTS_RE = /^This reverts commit ([0-9a-f]{40})\.?\s*$/gm;
|
|
15
|
+
/**
|
|
16
|
+
* Parse one `Task:` trailer value (`<instance>/T<n>`).
|
|
17
|
+
*
|
|
18
|
+
* @returns null for anything else — an unqualified `T3` or free text names no
|
|
19
|
+
* task, so it selects nothing.
|
|
20
|
+
*/
|
|
21
|
+
export function parseTaskTrailer(value) {
|
|
22
|
+
const m = TASK_TRAILER_RE.exec(value.trim());
|
|
23
|
+
return m ? { instance: m[1], task: Number(m[2]) } : null;
|
|
24
|
+
}
|
|
25
|
+
/** Full shas named by `This reverts commit <sha>.` lines in a commit body. */
|
|
26
|
+
export function revertedShas(body) {
|
|
27
|
+
return [...body.matchAll(REVERTS_RE)].map((m) => m[1]);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=trailers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailers.js","sourceRoot":"","sources":["../../src/revert/trailers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,6EAA6E;AAC7E,iEAAiE;AACjE,MAAM,eAAe,GAAG,wCAAwC,CAAC;AAEjE,MAAM,UAAU,GAAG,8CAA8C,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reset done tasks back to open in tasks.md — the one state change
|
|
3
|
+
* `aidlc revert` makes (revert-by-task/AC-16, D3).
|
|
4
|
+
*
|
|
5
|
+
* Line positions come from `parseTasks()`, so a line the parser does not read
|
|
6
|
+
* as a task is never rewritten. Open and deferred tasks are left exactly as
|
|
7
|
+
* written: a deferral carries a dated reason that a revert does not cancel.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Turn `- [x] T<n>:` into `- [ ] T<n>:` for each id in `ids` that is done.
|
|
11
|
+
*
|
|
12
|
+
* @returns the new content and the ids actually reset, ascending.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resetDone(content: string, ids: number[]): {
|
|
15
|
+
content: string;
|
|
16
|
+
reset: number[];
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../src/tasks/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAW9F"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reset done tasks back to open in tasks.md — the one state change
|
|
3
|
+
* `aidlc revert` makes (revert-by-task/AC-16, D3).
|
|
4
|
+
*
|
|
5
|
+
* Line positions come from `parseTasks()`, so a line the parser does not read
|
|
6
|
+
* as a task is never rewritten. Open and deferred tasks are left exactly as
|
|
7
|
+
* written: a deferral carries a dated reason that a revert does not cancel.
|
|
8
|
+
*/
|
|
9
|
+
import { parseTasks } from './parser.js';
|
|
10
|
+
/**
|
|
11
|
+
* Turn `- [x] T<n>:` into `- [ ] T<n>:` for each id in `ids` that is done.
|
|
12
|
+
*
|
|
13
|
+
* @returns the new content and the ids actually reset, ascending.
|
|
14
|
+
*/
|
|
15
|
+
export function resetDone(content, ids) {
|
|
16
|
+
const wanted = new Set(ids);
|
|
17
|
+
const lines = content.split('\n');
|
|
18
|
+
const reset = [];
|
|
19
|
+
for (const task of parseTasks(content).tasks) {
|
|
20
|
+
if (!wanted.has(task.id) || task.state !== 'done')
|
|
21
|
+
continue;
|
|
22
|
+
const i = task.line - 1;
|
|
23
|
+
lines[i] = lines[i].replace(/^-(\s+)\[x\]/, '-$1[ ]');
|
|
24
|
+
reset.push(task.id);
|
|
25
|
+
}
|
|
26
|
+
return { content: lines.join('\n'), reset };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=reset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.js","sourceRoot":"","sources":["../../src/tasks/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,GAAa;IACtD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM;YAAE,SAAS;QAC5D,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasensio/aidlc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "AI Development Lifecycle Framework — structured lifecycle guidance for AI coding agents across platforms",
|
|
5
5
|
"homepage": "https://aidlc.rodrigoasensio.com",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"commander": "15.0.0",
|
|
32
32
|
"picomatch": "4.0.5",
|
|
33
33
|
"yaml": "2.9.0",
|
|
34
|
-
"@rasensio/aidlc-content": "1.
|
|
34
|
+
"@rasensio/aidlc-content": "1.58.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.15.32",
|