@rasensio/aidlc 1.45.1 → 1.46.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/autopilot/driver.d.ts +71 -0
- package/dist/autopilot/driver.d.ts.map +1 -0
- package/dist/autopilot/driver.js +350 -0
- package/dist/autopilot/driver.js.map +1 -0
- package/dist/autopilot/presets.d.ts +51 -0
- package/dist/autopilot/presets.d.ts.map +1 -0
- package/dist/autopilot/presets.js +79 -0
- package/dist/autopilot/presets.js.map +1 -0
- package/dist/autopilot/run.d.ts +55 -0
- package/dist/autopilot/run.d.ts.map +1 -0
- package/dist/autopilot/run.js +174 -0
- package/dist/autopilot/run.js.map +1 -0
- package/dist/autopilot/state.d.ts +86 -0
- package/dist/autopilot/state.d.ts.map +1 -0
- package/dist/autopilot/state.js +96 -0
- package/dist/autopilot/state.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/autopilot.d.ts +47 -0
- package/dist/commands/autopilot.d.ts.map +1 -0
- package/dist/commands/autopilot.js +308 -0
- package/dist/commands/autopilot.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/menu/roster.d.ts.map +1 -1
- package/dist/menu/roster.js +3 -0
- package/dist/menu/roster.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One autopilot pass: move every in-flight backlog item one step along
|
|
3
|
+
* build → PR → CI → merge → release, and start new builds
|
|
4
|
+
* (autopilot-driver/AC-1..AC-18, ported from `scripts/autopilot/driver.mjs` by
|
|
5
|
+
* autopilot-on-demand/AC-16).
|
|
6
|
+
*
|
|
7
|
+
* A sequencer, not an agent: the backlog order is `aidlc roadmap next`, the work
|
|
8
|
+
* is an agent following the unattended rule, the release is the configured
|
|
9
|
+
* release command. It decides nothing a person has not already decided, and
|
|
10
|
+
* stops itself on the rules below.
|
|
11
|
+
*
|
|
12
|
+
* Every effect goes through `ctx` so the whole loop runs in tests with no git
|
|
13
|
+
* remote, no GitHub and no agent.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import type { AutopilotConfig, AutopilotPaths, AutopilotState } from './state.js';
|
|
18
|
+
export interface RunResult {
|
|
19
|
+
status: number;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
dry?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface DriverCtx {
|
|
25
|
+
/** Primary checkout — where merges and releases happen. */
|
|
26
|
+
repo: string;
|
|
27
|
+
/** argv prefix that runs this CLI, e.g. `[node, /path/cli.js]`. */
|
|
28
|
+
cli: string[];
|
|
29
|
+
paths: AutopilotPaths;
|
|
30
|
+
config: AutopilotConfig | null;
|
|
31
|
+
dryRun: boolean;
|
|
32
|
+
now(): number;
|
|
33
|
+
say(line: string): void;
|
|
34
|
+
run(cmd: string, args: string[], opts?: {
|
|
35
|
+
cwd?: string;
|
|
36
|
+
env?: Record<string, string>;
|
|
37
|
+
}): RunResult;
|
|
38
|
+
spawnDetached(argv: string[], opts: {
|
|
39
|
+
cwd: string;
|
|
40
|
+
env: Record<string, string>;
|
|
41
|
+
logFile: string;
|
|
42
|
+
}): number;
|
|
43
|
+
isAlive(pid: number): boolean;
|
|
44
|
+
kill(pid: number): void;
|
|
45
|
+
fs: {
|
|
46
|
+
read(path: string): string | null;
|
|
47
|
+
exists(path: string): boolean;
|
|
48
|
+
write(path: string, text: string): void;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** How many builds a run may still start, and what to tell it (autopilot-on-demand/AC-7). */
|
|
52
|
+
export interface Budget {
|
|
53
|
+
/** null = unlimited (`--all`). */
|
|
54
|
+
remaining: number | null;
|
|
55
|
+
onStart(name: string): void;
|
|
56
|
+
/** An item left the driver: released, or held. */
|
|
57
|
+
onFinish(name: string): void;
|
|
58
|
+
}
|
|
59
|
+
export declare class RateLimited extends Error {
|
|
60
|
+
}
|
|
61
|
+
export declare function agentPrompt(item: {
|
|
62
|
+
name: string;
|
|
63
|
+
}): string;
|
|
64
|
+
export declare function fixPrompt(item: {
|
|
65
|
+
name: string;
|
|
66
|
+
pr: number | null;
|
|
67
|
+
}, failing: string[]): string;
|
|
68
|
+
/** One pass. Returns the new state; the caller saves it (not in a dry run). */
|
|
69
|
+
export declare function tick(ctx: DriverCtx, state: AutopilotState, budget?: Budget): AutopilotState;
|
|
70
|
+
export declare function statusLines(ctx: Pick<DriverCtx, 'fs' | 'paths' | 'now'>, state: AutopilotState): string[];
|
|
71
|
+
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/autopilot/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAiB,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,IAAI,MAAM,CAAC;IACd,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,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,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CA4B3F;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,EAAE,CAczG"}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One autopilot pass: move every in-flight backlog item one step along
|
|
3
|
+
* build → PR → CI → merge → release, and start new builds
|
|
4
|
+
* (autopilot-driver/AC-1..AC-18, ported from `scripts/autopilot/driver.mjs` by
|
|
5
|
+
* autopilot-on-demand/AC-16).
|
|
6
|
+
*
|
|
7
|
+
* A sequencer, not an agent: the backlog order is `aidlc roadmap next`, the work
|
|
8
|
+
* is an agent following the unattended rule, the release is the configured
|
|
9
|
+
* release command. It decides nothing a person has not already decided, and
|
|
10
|
+
* stops itself on the rules below.
|
|
11
|
+
*
|
|
12
|
+
* Every effect goes through `ctx` so the whole loop runs in tests with no git
|
|
13
|
+
* remote, no GitHub and no agent.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
const RATE_LIMIT_RE = /rate limit|\b429\b|secondary rate/i;
|
|
18
|
+
const BACKOFF_FIRST_MS = 5 * 60 * 1000;
|
|
19
|
+
const BACKOFF_MAX_MS = 2 * 60 * 60 * 1000;
|
|
20
|
+
const CI_FAILURE_LIMIT = 2;
|
|
21
|
+
export class RateLimited extends Error {
|
|
22
|
+
}
|
|
23
|
+
/** Commands safe to run in a dry run: they only read. */
|
|
24
|
+
function isReadOnly(cmd, args) {
|
|
25
|
+
const a = args.join(' ');
|
|
26
|
+
if (cmd === 'gh')
|
|
27
|
+
return /^(pr checks|run list|pr view)\b/.test(a);
|
|
28
|
+
if (cmd === 'git')
|
|
29
|
+
return /^(rev-parse|status)\b/.test(a);
|
|
30
|
+
return /\broadmap next\b/.test(a) || (/\bcost\b/.test(a) && /--json/.test(a));
|
|
31
|
+
}
|
|
32
|
+
function makeIO(ctx) {
|
|
33
|
+
const call = (cmd, args, opts = {}) => {
|
|
34
|
+
if (ctx.dryRun && !isReadOnly(cmd, args)) {
|
|
35
|
+
ctx.say(`[dry-run] ${opts.cwd ? `(in ${opts.cwd}) ` : ''}${[cmd, ...args].join(' ')}`);
|
|
36
|
+
return { status: 0, stdout: '', stderr: '', dry: true };
|
|
37
|
+
}
|
|
38
|
+
const r = ctx.run(cmd, args, opts);
|
|
39
|
+
if (RATE_LIMIT_RE.test(`${r.stdout}\n${r.stderr}`)) {
|
|
40
|
+
throw new RateLimited(`${cmd} ${args.slice(0, 2).join(' ')}: ${(r.stderr || r.stdout).trim().split('\n')[0]}`);
|
|
41
|
+
}
|
|
42
|
+
return r;
|
|
43
|
+
};
|
|
44
|
+
const cli = (args) => call(ctx.cli[0], [...ctx.cli.slice(1), ...args], { cwd: ctx.repo });
|
|
45
|
+
return { call, cli };
|
|
46
|
+
}
|
|
47
|
+
const fail = (r) => (r.stderr || r.stdout || `exit ${r.status}`).trim().split('\n').slice(-1)[0];
|
|
48
|
+
export function agentPrompt(item) {
|
|
49
|
+
return (`You are running unattended (AIDLC_UNATTENDED=1). Follow .aidlc/resources/rules/unattended.md. ` +
|
|
50
|
+
`Continue the AIDLC instance "${item.name}" in this worktree with the aidlc-continue skill, through ` +
|
|
51
|
+
`every phase up to the release boundary: complete testing, write the deployment record's release ` +
|
|
52
|
+
`plan, commit on this branch, and stop. Do not push, open a pull request, merge or release.`);
|
|
53
|
+
}
|
|
54
|
+
export function fixPrompt(item, failing) {
|
|
55
|
+
return (`You are running unattended (AIDLC_UNATTENDED=1). Follow .aidlc/resources/rules/unattended.md. ` +
|
|
56
|
+
`CI failed on pull request #${item.pr} for the AIDLC instance "${item.name}": ${failing.join(', ')}. ` +
|
|
57
|
+
`Find the cause, fix it on this branch, run the tests, commit, and stop. Do not push, merge or release.`);
|
|
58
|
+
}
|
|
59
|
+
function launchAgent(ctx, item, prompt) {
|
|
60
|
+
const command = ctx.config?.agent_command ?? [];
|
|
61
|
+
const argv = command.map((a) => (a === '{prompt}' ? prompt : a));
|
|
62
|
+
const env = { AIDLC_UNATTENDED: '1', AIDLC_AGENT: ctx.config?.agent_platform ?? 'claude-code' };
|
|
63
|
+
if (ctx.dryRun) {
|
|
64
|
+
ctx.say(`[dry-run] (in ${item.worktree}) launch agent: ${argv[0]} … (${argv.length} args)`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
item.pid = ctx.spawnDetached(argv, { cwd: item.worktree, env, logFile: `${ctx.paths.logs}/${item.name}.log` });
|
|
68
|
+
ctx.say(`${item.name}: agent started (pid ${item.pid})`);
|
|
69
|
+
}
|
|
70
|
+
function drop(state, item, budget) {
|
|
71
|
+
state.items = state.items.filter((i) => i !== item);
|
|
72
|
+
state.queue = state.queue.filter((n) => n !== item.name);
|
|
73
|
+
budget?.onFinish(item.name);
|
|
74
|
+
}
|
|
75
|
+
function park(ctx, io, state, item, reason, budget) {
|
|
76
|
+
const r = io.cli(['roadmap', 'park', item.name, '--reason', reason]);
|
|
77
|
+
if (r.status !== 0) {
|
|
78
|
+
item.step = 'error';
|
|
79
|
+
item.error = `park failed: ${fail(r)}`;
|
|
80
|
+
ctx.say(`${item.name}: could not park — ${item.error}`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
io.cli(['release', item.name]);
|
|
84
|
+
ctx.say(`${item.name}: parked — ${reason}`);
|
|
85
|
+
drop(state, item, budget);
|
|
86
|
+
}
|
|
87
|
+
function currentPhase(ctx, item) {
|
|
88
|
+
const yaml = ctx.fs.read(`${item.worktree}/.aidlc/state/${item.name}/instance.yaml`) ?? '';
|
|
89
|
+
return /^current_phase:\s*(\S+)/m.exec(yaml)?.[1] ?? null;
|
|
90
|
+
}
|
|
91
|
+
function advanceBuilding(ctx, io, state, item, budget) {
|
|
92
|
+
if (item.pid && ctx.isAlive(item.pid)) {
|
|
93
|
+
const cap = ctx.config?.cost_cap_usd;
|
|
94
|
+
if (typeof cap === 'number') {
|
|
95
|
+
const r = io.cli(['cost', item.name, '--json']);
|
|
96
|
+
let micro = 0;
|
|
97
|
+
try {
|
|
98
|
+
micro = JSON.parse(r.stdout)?.[0]?.microUsd ?? 0;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// no cost data yet — nothing to compare
|
|
102
|
+
}
|
|
103
|
+
if (micro > cap * 1e6) {
|
|
104
|
+
if (!ctx.dryRun)
|
|
105
|
+
ctx.kill(item.pid);
|
|
106
|
+
park(ctx, io, state, item, `cost cap ${cap} USD exceeded`, budget);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (ctx.fs.exists(`${ctx.repo}/.aidlc/roadmap/hold/${item.file}`)) {
|
|
112
|
+
ctx.say(`${item.name}: the agent parked it`);
|
|
113
|
+
drop(state, item, budget);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const phase = currentPhase(ctx, item);
|
|
117
|
+
if (phase !== 'deployment') {
|
|
118
|
+
park(ctx, io, state, item, `agent exited before the release boundary (phase ${phase ?? 'unknown'})`, budget);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const push = io.call('git', ['push', '-u', 'origin', item.branch], { cwd: item.worktree });
|
|
122
|
+
if (push.status !== 0) {
|
|
123
|
+
item.step = 'error';
|
|
124
|
+
item.error = `push failed: ${fail(push)}`;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!item.pr) {
|
|
128
|
+
const pr = io.call('gh', ['pr', 'create', '--base', 'main', '--head', item.branch, '--fill'], { cwd: item.worktree });
|
|
129
|
+
const n = /\/pull\/(\d+)/.exec(pr.stdout)?.[1];
|
|
130
|
+
if (pr.status !== 0 || (!n && !pr.dry)) {
|
|
131
|
+
item.step = 'error';
|
|
132
|
+
item.error = `pr create failed: ${fail(pr)}`;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
item.pr = n ? Number(n) : null;
|
|
136
|
+
}
|
|
137
|
+
item.step = 'pr-open';
|
|
138
|
+
ctx.say(`${item.name}: pull request #${item.pr} open`);
|
|
139
|
+
}
|
|
140
|
+
function advancePr(ctx, io, state, item, budget) {
|
|
141
|
+
const r = io.call('gh', ['pr', 'checks', String(item.pr), '--json', 'name,bucket'], { cwd: ctx.repo });
|
|
142
|
+
let checks = [];
|
|
143
|
+
try {
|
|
144
|
+
checks = JSON.parse(r.stdout || '[]');
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (checks.length === 0 || checks.some((c) => c.bucket === 'pending'))
|
|
150
|
+
return;
|
|
151
|
+
const failing = checks.filter((c) => c.bucket === 'fail' || c.bucket === 'cancel').map((c) => c.name);
|
|
152
|
+
if (failing.length === 0) {
|
|
153
|
+
item.step = 'queued';
|
|
154
|
+
if (!state.queue.includes(item.name))
|
|
155
|
+
state.queue.push(item.name);
|
|
156
|
+
ctx.say(`${item.name}: CI green, queued for merge`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
item.ci_failures = (item.ci_failures ?? 0) + 1;
|
|
160
|
+
if (item.ci_failures >= CI_FAILURE_LIMIT) {
|
|
161
|
+
park(ctx, io, state, item, `CI failed twice: ${failing.join(', ')}`, budget);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
ctx.say(`${item.name}: CI failed (${failing.join(', ')}), relaunching the agent once`);
|
|
165
|
+
item.step = 'building';
|
|
166
|
+
launchAgent(ctx, item, fixPrompt(item, failing));
|
|
167
|
+
}
|
|
168
|
+
/** Mark the deployment artifact complete so `aidlc transition` can close the instance. */
|
|
169
|
+
function markDeploymentComplete(ctx, name) {
|
|
170
|
+
const file = `${ctx.repo}/.aidlc/state/${name}/phase-deployment.yaml`;
|
|
171
|
+
const text = ctx.fs.read(file);
|
|
172
|
+
if (text === null)
|
|
173
|
+
return false;
|
|
174
|
+
const next = text
|
|
175
|
+
.replace(/(- name: deployment-record\.md\n\s+status: )not-started/, '$1complete')
|
|
176
|
+
.replace(/^status: pending$/m, 'status: in-progress');
|
|
177
|
+
if (!ctx.dryRun)
|
|
178
|
+
ctx.fs.write(file, next);
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
function serveQueue(ctx, io, state, budget) {
|
|
182
|
+
const name = state.queue[0];
|
|
183
|
+
if (!name)
|
|
184
|
+
return;
|
|
185
|
+
const item = state.items.find((i) => i.name === name);
|
|
186
|
+
if (!item) {
|
|
187
|
+
state.queue.shift();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (item.step === 'error') {
|
|
191
|
+
ctx.say(`queue halted: ${item.name} — ${item.error}`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const runs = io.call('gh', ['run', 'list', '--workflow=release.yml', '-L', '1', '--json', 'status'], { cwd: ctx.repo });
|
|
195
|
+
try {
|
|
196
|
+
const status = JSON.parse(runs.stdout || '[]')[0]?.status;
|
|
197
|
+
if (status === 'queued' || status === 'in_progress') {
|
|
198
|
+
ctx.say(`${item.name}: waiting — a release is already in flight`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// unreadable — treat as nothing in flight; the release command checks the tree itself
|
|
204
|
+
}
|
|
205
|
+
const branch = io.call('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: ctx.repo });
|
|
206
|
+
if (branch.stdout.trim() !== 'main' && !ctx.dryRun) {
|
|
207
|
+
item.step = 'error';
|
|
208
|
+
item.error = `primary checkout is on ${branch.stdout.trim()}, not main`;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const release = ctx.config?.release_command;
|
|
212
|
+
const steps = [
|
|
213
|
+
['merge', () => io.call('gh', ['pr', 'merge', String(item.pr), '--merge'], { cwd: ctx.repo })],
|
|
214
|
+
['pull', () => io.call('git', ['pull', '--rebase', '--autostash'], { cwd: ctx.repo })],
|
|
215
|
+
];
|
|
216
|
+
// Merge only when no release command is configured (autopilot-on-demand/AC-17, AC-18).
|
|
217
|
+
if (Array.isArray(release) && release.length > 0) {
|
|
218
|
+
steps.push(['release', () => io.call(release[0], release.slice(1), { cwd: ctx.repo })]);
|
|
219
|
+
}
|
|
220
|
+
steps.push([
|
|
221
|
+
'close',
|
|
222
|
+
() => {
|
|
223
|
+
if (!markDeploymentComplete(ctx, item.name))
|
|
224
|
+
return { status: 1, stdout: '', stderr: 'no phase-deployment.yaml on main' };
|
|
225
|
+
return io.cli(['transition', item.name]);
|
|
226
|
+
},
|
|
227
|
+
], ['stage-close', () => io.call('git', ['add', '.aidlc'], { cwd: ctx.repo })], ['commit-close', () => io.call('git', ['commit', '-q', '-m', `chore(aidlc): close out ${item.name} (autopilot)`], { cwd: ctx.repo })], ['push-close', () => io.call('git', ['push', 'origin', 'main'], { cwd: ctx.repo })]);
|
|
228
|
+
for (const [label, step] of steps) {
|
|
229
|
+
const r = step();
|
|
230
|
+
if (r.status !== 0) {
|
|
231
|
+
// Halt, never retry: a half-done release is for a person.
|
|
232
|
+
item.step = 'error';
|
|
233
|
+
item.error = `${label} failed: ${fail(r)}`;
|
|
234
|
+
ctx.say(`${item.name}: ${item.error} — queue halted`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
ctx.say(`${item.name}: merged${release?.length ? ', released' : ''} and closed`);
|
|
239
|
+
drop(state, item, budget);
|
|
240
|
+
}
|
|
241
|
+
function startBuilds(ctx, io, state, budget) {
|
|
242
|
+
const command = ctx.config?.agent_command;
|
|
243
|
+
if (!Array.isArray(command) || command.length === 0) {
|
|
244
|
+
ctx.say('not starting builds: no agent command configured — run `aidlc autopilot setup`');
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const max = Math.min(2, Math.max(1, ctx.config?.max_parallel ?? 2));
|
|
248
|
+
const template = ctx.config?.template ?? 'quick-feature';
|
|
249
|
+
let building = state.items.filter((i) => i.step === 'building').length;
|
|
250
|
+
while (building < max && (budget?.remaining ?? 1) > 0) {
|
|
251
|
+
const r = io.cli(['roadmap', 'next', '--json']);
|
|
252
|
+
let next = null;
|
|
253
|
+
try {
|
|
254
|
+
next = JSON.parse(r.stdout).next;
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
ctx.say(`could not read roadmap next: ${fail(r)}`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (!next) {
|
|
261
|
+
ctx.say('nothing ready in the backlog');
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (state.items.some((i) => i.file === next?.file))
|
|
265
|
+
return;
|
|
266
|
+
const name = next.file.replace(/^\d{8}-/, '').replace(/\.md$/, '');
|
|
267
|
+
const started = io.cli([
|
|
268
|
+
'start', template, '--name', name, '--scope', 'standard', '--worktree', '--non-interactive',
|
|
269
|
+
'--roadmap-item', next.file,
|
|
270
|
+
]);
|
|
271
|
+
const m = /Worktree:\s+(\S+)\s+\(branch\s+([^)]+)\)/.exec(started.stdout);
|
|
272
|
+
if (started.status !== 0 || (!m && !started.dry)) {
|
|
273
|
+
ctx.say(`could not start ${next.file}: ${fail(started)}`);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const item = {
|
|
277
|
+
name,
|
|
278
|
+
file: next.file,
|
|
279
|
+
worktree: m ? m[1] : `<worktree for ${name}>`,
|
|
280
|
+
branch: m ? m[2] : `<branch for ${name}>`,
|
|
281
|
+
step: 'building',
|
|
282
|
+
ci_failures: 0,
|
|
283
|
+
pr: null,
|
|
284
|
+
pid: null,
|
|
285
|
+
started_at: new Date(ctx.now()).toISOString(),
|
|
286
|
+
};
|
|
287
|
+
launchAgent(ctx, item, agentPrompt(item));
|
|
288
|
+
if (ctx.dryRun)
|
|
289
|
+
return;
|
|
290
|
+
state.items.push(item);
|
|
291
|
+
building++;
|
|
292
|
+
if (budget) {
|
|
293
|
+
budget.onStart(name);
|
|
294
|
+
if (budget.remaining !== null)
|
|
295
|
+
budget.remaining--;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/** One pass. Returns the new state; the caller saves it (not in a dry run). */
|
|
300
|
+
export function tick(ctx, state, budget) {
|
|
301
|
+
if (ctx.fs.exists(ctx.paths.stop)) {
|
|
302
|
+
ctx.say(`stopped: ${ctx.paths.stop} exists`);
|
|
303
|
+
return state;
|
|
304
|
+
}
|
|
305
|
+
if (state.backoff_until && ctx.now() < Date.parse(state.backoff_until)) {
|
|
306
|
+
ctx.say(`backing off until ${state.backoff_until}`);
|
|
307
|
+
return state;
|
|
308
|
+
}
|
|
309
|
+
const io = makeIO(ctx);
|
|
310
|
+
try {
|
|
311
|
+
for (const item of [...state.items]) {
|
|
312
|
+
if (item.step === 'building')
|
|
313
|
+
advanceBuilding(ctx, io, state, item, budget);
|
|
314
|
+
else if (item.step === 'pr-open')
|
|
315
|
+
advancePr(ctx, io, state, item, budget);
|
|
316
|
+
}
|
|
317
|
+
serveQueue(ctx, io, state, budget);
|
|
318
|
+
startBuilds(ctx, io, state, budget);
|
|
319
|
+
state.backoff_ms = 0;
|
|
320
|
+
state.backoff_until = null;
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
if (!(err instanceof RateLimited))
|
|
324
|
+
throw err;
|
|
325
|
+
state.backoff_ms = Math.min(BACKOFF_MAX_MS, state.backoff_ms ? state.backoff_ms * 2 : BACKOFF_FIRST_MS);
|
|
326
|
+
state.backoff_until = new Date(ctx.now() + state.backoff_ms).toISOString();
|
|
327
|
+
ctx.say(`rate limited (${err.message}) — backing off until ${state.backoff_until}`);
|
|
328
|
+
}
|
|
329
|
+
state.last_tick = new Date(ctx.now()).toISOString();
|
|
330
|
+
return state;
|
|
331
|
+
}
|
|
332
|
+
export function statusLines(ctx, state) {
|
|
333
|
+
const lines = [];
|
|
334
|
+
if (ctx.fs.exists(ctx.paths.stop))
|
|
335
|
+
lines.push('driver: stopped (STOP file present)');
|
|
336
|
+
else if (state.backoff_until && ctx.now() < Date.parse(state.backoff_until))
|
|
337
|
+
lines.push(`driver: backing off until ${state.backoff_until}`);
|
|
338
|
+
else
|
|
339
|
+
lines.push(`driver: last pass ${state.last_tick ?? 'never'}`);
|
|
340
|
+
if (state.items.length === 0)
|
|
341
|
+
lines.push('no items in flight');
|
|
342
|
+
for (const i of state.items) {
|
|
343
|
+
lines.push(`${i.name}: ${i.step}${i.pr ? ` PR #${i.pr}` : ''} — CI failures ${i.ci_failures ?? 0}` +
|
|
344
|
+
`${i.error ? ` — last error: ${i.error}` : ''}`);
|
|
345
|
+
}
|
|
346
|
+
if (state.queue.length > 0)
|
|
347
|
+
lines.push(`merge queue: ${state.queue.join(' → ')}`);
|
|
348
|
+
return lines;
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/autopilot/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyCH,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAC3D,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,OAAO,WAAY,SAAQ,KAAK;CAAG;AAEzC,yDAAyD;AACzD,SAAS,UAAU,CAAC,GAAW,EAAE,IAAc;IAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,iCAAiC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,uBAAuB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 -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The choices `aidlc autopilot setup` offers (autopilot-on-demand/AC-10..AC-13).
|
|
3
|
+
*
|
|
4
|
+
* The agent preset is the one that matters: it decides what an unattended agent
|
|
5
|
+
* may do on this machine. Every option is visible text the user picks, and the
|
|
6
|
+
* full-access option says so in its label. Nothing is chosen silently.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export interface AgentPreset {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
hint: string;
|
|
14
|
+
platform: string;
|
|
15
|
+
command: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare const AGENT_PRESETS: readonly AgentPreset[];
|
|
18
|
+
export declare const PARALLEL_CHOICES: readonly [{
|
|
19
|
+
readonly value: "2";
|
|
20
|
+
readonly label: "Two items at once (recommended)";
|
|
21
|
+
readonly hint: "still one release at a time";
|
|
22
|
+
}, {
|
|
23
|
+
readonly value: "1";
|
|
24
|
+
readonly label: "One item at a time";
|
|
25
|
+
readonly hint: "slower, simpler to watch";
|
|
26
|
+
}];
|
|
27
|
+
export declare const COST_CAP_CHOICES: readonly [{
|
|
28
|
+
readonly value: "15";
|
|
29
|
+
readonly label: "$15 per item (recommended)";
|
|
30
|
+
}, {
|
|
31
|
+
readonly value: "5";
|
|
32
|
+
readonly label: "$5 per item";
|
|
33
|
+
}, {
|
|
34
|
+
readonly value: "30";
|
|
35
|
+
readonly label: "$30 per item";
|
|
36
|
+
}, {
|
|
37
|
+
readonly value: "none";
|
|
38
|
+
readonly label: "No cap";
|
|
39
|
+
readonly hint: "an item is never stopped for cost";
|
|
40
|
+
}];
|
|
41
|
+
export interface ReleasePreset {
|
|
42
|
+
id: string;
|
|
43
|
+
label: string;
|
|
44
|
+
hint: string;
|
|
45
|
+
command: string[] | null;
|
|
46
|
+
}
|
|
47
|
+
/** This project's own release script, when it has one (autopilot-on-demand/AC-13). */
|
|
48
|
+
export declare const REPO_RELEASE_SCRIPT = "scripts/autopilot-release.sh";
|
|
49
|
+
export declare function releasePresets(projectRoot: string): ReleasePreset[];
|
|
50
|
+
export declare function agentPreset(id: string): AgentPreset | undefined;
|
|
51
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/autopilot/presets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AASD,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EA0B/C,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;EAGnB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;EAKnB,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC1B;AAED,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,EAAE,CAiBnE;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE/D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The choices `aidlc autopilot setup` offers (autopilot-on-demand/AC-10..AC-13).
|
|
3
|
+
*
|
|
4
|
+
* The agent preset is the one that matters: it decides what an unattended agent
|
|
5
|
+
* may do on this machine. Every option is visible text the user picks, and the
|
|
6
|
+
* full-access option says so in its label. Nothing is chosen silently.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
/**
|
|
13
|
+
* The Bash commands the scoped preset allows: what a phase needs to build, test
|
|
14
|
+
* and commit on its branch. Anything else the agent tries is refused, and the
|
|
15
|
+
* refusal shows in its log.
|
|
16
|
+
*/
|
|
17
|
+
const SCOPED_BASH = ['git', 'pnpm', 'npm', 'npx', 'node', 'ls', 'cat', 'grep', 'find', 'mkdir'];
|
|
18
|
+
export const AGENT_PRESETS = [
|
|
19
|
+
{
|
|
20
|
+
id: 'claude-scoped',
|
|
21
|
+
label: 'Claude Code — edit files, run git/pnpm/node and read-only shell tools (recommended)',
|
|
22
|
+
hint: 'other commands are refused; the refusal shows in the agent log',
|
|
23
|
+
platform: 'claude-code',
|
|
24
|
+
command: [
|
|
25
|
+
'claude', '-p', '{prompt}',
|
|
26
|
+
'--permission-mode', 'acceptEdits',
|
|
27
|
+
'--allowedTools', ...SCOPED_BASH.map((c) => `Bash(${c}:*)`),
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'claude-full',
|
|
32
|
+
label: 'Claude Code — FULL ACCESS: every tool and command, no prompts',
|
|
33
|
+
hint: 'the agent can run anything your user account can',
|
|
34
|
+
platform: 'claude-code',
|
|
35
|
+
command: ['claude', '-p', '{prompt}', '--dangerously-skip-permissions'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'codex-full-auto',
|
|
39
|
+
label: 'Codex — full-auto mode (edits and commands in its sandbox)',
|
|
40
|
+
hint: 'Codex decides what its sandbox allows',
|
|
41
|
+
platform: 'codex',
|
|
42
|
+
command: ['codex', 'exec', '--full-auto', '{prompt}'],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
export const PARALLEL_CHOICES = [
|
|
46
|
+
{ value: '2', label: 'Two items at once (recommended)', hint: 'still one release at a time' },
|
|
47
|
+
{ value: '1', label: 'One item at a time', hint: 'slower, simpler to watch' },
|
|
48
|
+
];
|
|
49
|
+
export const COST_CAP_CHOICES = [
|
|
50
|
+
{ value: '15', label: '$15 per item (recommended)' },
|
|
51
|
+
{ value: '5', label: '$5 per item' },
|
|
52
|
+
{ value: '30', label: '$30 per item' },
|
|
53
|
+
{ value: 'none', label: 'No cap', hint: 'an item is never stopped for cost' },
|
|
54
|
+
];
|
|
55
|
+
/** This project's own release script, when it has one (autopilot-on-demand/AC-13). */
|
|
56
|
+
export const REPO_RELEASE_SCRIPT = 'scripts/autopilot-release.sh';
|
|
57
|
+
export function releasePresets(projectRoot) {
|
|
58
|
+
const merge = {
|
|
59
|
+
id: 'merge-only',
|
|
60
|
+
label: 'Merge only — no release',
|
|
61
|
+
hint: 'each item is merged to main and closed; you release when you choose',
|
|
62
|
+
command: null,
|
|
63
|
+
};
|
|
64
|
+
if (!existsSync(join(projectRoot, REPO_RELEASE_SCRIPT)))
|
|
65
|
+
return [{ ...merge, label: `${merge.label} (recommended)` }];
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
id: 'repo-script',
|
|
69
|
+
label: `Run ${REPO_RELEASE_SCRIPT} after each merge (recommended)`,
|
|
70
|
+
hint: 'this project publishes a release per item',
|
|
71
|
+
command: ['bash', REPO_RELEASE_SCRIPT],
|
|
72
|
+
},
|
|
73
|
+
merge,
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
export function agentPreset(id) {
|
|
77
|
+
return AGENT_PRESETS.find((p) => p.id === id);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/autopilot/presets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC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,EAAE;IACpD,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE;IACpC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE;IACtC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,mCAAmC,EAAE;CACrE,CAAC;AASX,sFAAsF;AACtF,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,MAAM,KAAK,GAAkB;QAC3B,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,yBAAyB;QAChC,IAAI,EAAE,qEAAqE;QAC3E,OAAO,EAAE,IAAI;KACd,CAAC;IACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QAAE,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,gBAAgB,EAAE,CAAC,CAAC;IACtH,OAAO;QACL;YACE,EAAE,EAAE,aAAa;YACjB,KAAK,EAAE,OAAO,mBAAmB,iCAAiC;YAClE,IAAI,EAAE,2CAA2C;YACjD,OAAO,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC;SACvC;QACD,KAAK;KACN,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running autopilot on demand: one background process per request, no scheduler
|
|
3
|
+
* (autopilot-on-demand/AC-1..AC-9).
|
|
4
|
+
*
|
|
5
|
+
* `startRun` checks, clears STOP, and spawns `aidlc autopilot run --foreground`
|
|
6
|
+
* detached; that process loops `tick` until its budget is spent, the backlog is
|
|
7
|
+
* empty, or STOP appears, then removes its run record.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type DriverCtx } from './driver.js';
|
|
12
|
+
import { type AutopilotPaths, type RunRecord } from './state.js';
|
|
13
|
+
export declare function isAlive(pid: number): boolean;
|
|
14
|
+
/** The run record, or null when there is none or its process is gone. */
|
|
15
|
+
export declare function activeRun(p: AutopilotPaths): RunRecord | null;
|
|
16
|
+
/** The argv prefix that runs this same CLI. */
|
|
17
|
+
export declare function selfCli(): string[];
|
|
18
|
+
export declare function realCtx(repo: string, p: AutopilotPaths, dryRun: boolean, say: (l: string) => void): DriverCtx;
|
|
19
|
+
export type StartOutcome = {
|
|
20
|
+
ok: true;
|
|
21
|
+
pid: number;
|
|
22
|
+
log: string;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
reason: string;
|
|
26
|
+
};
|
|
27
|
+
export interface StartDeps {
|
|
28
|
+
spawnLoop(args: string[], log: string): number;
|
|
29
|
+
now(): number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check, clear STOP, spawn the loop. Returns at once (AC-3).
|
|
33
|
+
*
|
|
34
|
+
* @param limit - item count, or null for `--all`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function startRun(p: AutopilotPaths, limit: number | null, intervalSec: number, deps: StartDeps): StartOutcome;
|
|
37
|
+
export declare function spawnLoopDetached(args: string[], log: string, cwd: string): number;
|
|
38
|
+
/** Is a run finished? (AC-1, AC-2) */
|
|
39
|
+
export declare function runDone(run: RunRecord, inFlight: number, nothingReady: boolean): boolean;
|
|
40
|
+
export interface LoopDeps {
|
|
41
|
+
ctx(): DriverCtx;
|
|
42
|
+
sleep(ms: number): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The background loop (`aidlc autopilot run --foreground`). Returns when done or
|
|
46
|
+
* stopped; always removes the run record on the way out.
|
|
47
|
+
*/
|
|
48
|
+
export declare function runLoop(p: AutopilotPaths, opts: {
|
|
49
|
+
limit: number | null;
|
|
50
|
+
intervalSec: number;
|
|
51
|
+
log: string;
|
|
52
|
+
pid: number;
|
|
53
|
+
startedAt: string;
|
|
54
|
+
}, deps: LoopDeps): Promise<'done' | 'stopped' | 'already-running'>;
|
|
55
|
+
//# sourceMappingURL=run.d.ts.map
|