@rasensio/aidlc 1.78.0 → 1.80.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/README.md +7 -3
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/compliance.d.ts.map +1 -1
- package/dist/commands/compliance.js +1 -0
- package/dist/commands/compliance.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/menu.d.ts +5 -8
- package/dist/commands/menu.d.ts.map +1 -1
- package/dist/commands/menu.js +12 -13
- package/dist/commands/menu.js.map +1 -1
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +24 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/compliance/install.d.ts +2 -0
- package/dist/compliance/install.d.ts.map +1 -1
- package/dist/compliance/install.js +2 -0
- package/dist/compliance/install.js.map +1 -1
- package/dist/compliance/schema.d.ts +5 -0
- package/dist/compliance/schema.d.ts.map +1 -1
- package/dist/compliance/schema.js +37 -0
- package/dist/compliance/schema.js.map +1 -1
- package/dist/compliance/types.d.ts +9 -0
- package/dist/compliance/types.d.ts.map +1 -1
- package/dist/console/autopilot-view.d.ts +50 -0
- package/dist/console/autopilot-view.d.ts.map +1 -0
- package/dist/console/autopilot-view.js +99 -0
- package/dist/console/autopilot-view.js.map +1 -0
- package/dist/console/harness.d.ts +84 -0
- package/dist/console/harness.d.ts.map +1 -0
- package/dist/console/harness.js +191 -0
- package/dist/console/harness.js.map +1 -0
- package/dist/console/index.d.ts +28 -0
- package/dist/console/index.d.ts.map +1 -0
- package/dist/console/index.js +154 -0
- package/dist/console/index.js.map +1 -0
- package/dist/console/route.d.ts +45 -0
- package/dist/console/route.d.ts.map +1 -0
- package/dist/console/route.js +118 -0
- package/dist/console/route.js.map +1 -0
- package/dist/console/session.d.ts +92 -0
- package/dist/console/session.d.ts.map +1 -0
- package/dist/console/session.js +337 -0
- package/dist/console/session.js.map +1 -0
- package/dist/console/standing.d.ts +44 -0
- package/dist/console/standing.d.ts.map +1 -0
- package/dist/console/standing.js +96 -0
- package/dist/console/standing.js.map +1 -0
- package/dist/console/terminal.d.ts +31 -0
- package/dist/console/terminal.d.ts.map +1 -0
- package/dist/console/terminal.js +216 -0
- package/dist/console/terminal.js.map +1 -0
- package/dist/menu/index.d.ts +7 -24
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +6 -86
- package/dist/menu/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real terminal behind `ConsoleIO` and the console's processes
|
|
3
|
+
* (aidlc-console/AC-18, aidlc-console/AC-19, aidlc-console/AC-28,
|
|
4
|
+
* aidlc-console/AC-29, aidlc-console/AC-32, aidlc-console/AC-33,
|
|
5
|
+
* aidlc-console/AC-34).
|
|
6
|
+
*
|
|
7
|
+
* One reader owns stdin at a time. `read` opens a readline for one input and
|
|
8
|
+
* closes it before returning, so a command's clack prompt, a shell line or an
|
|
9
|
+
* agent turn never shares stdin with the console (design: raw-mode risk).
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { spawn } from 'node:child_process';
|
|
14
|
+
import { createInterface, emitKeypressEvents } from 'node:readline';
|
|
15
|
+
export const TICK_MS = 2000;
|
|
16
|
+
const ANSI = /\x1b\[[0-9;?]*[ -/]*[@-~]/g;
|
|
17
|
+
/** Text without terminal escapes, for what the agent is shown. */
|
|
18
|
+
export function plain(text) {
|
|
19
|
+
return text.replace(ANSI, '').replace(/\r(?!\n)/g, '\n');
|
|
20
|
+
}
|
|
21
|
+
export function terminalIO() {
|
|
22
|
+
const out = process.stdout;
|
|
23
|
+
let history = [];
|
|
24
|
+
let frameHeight = 0;
|
|
25
|
+
// Typed text that survives a Ctrl-T, which ends one read and starts the next.
|
|
26
|
+
let carry = '';
|
|
27
|
+
return {
|
|
28
|
+
read(prompt, tick, complete) {
|
|
29
|
+
frameHeight = 0;
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
let done = false;
|
|
32
|
+
const rl = createInterface({
|
|
33
|
+
input: process.stdin,
|
|
34
|
+
output: out,
|
|
35
|
+
prompt,
|
|
36
|
+
terminal: true,
|
|
37
|
+
history,
|
|
38
|
+
historySize: 500,
|
|
39
|
+
removeHistoryDuplicates: true,
|
|
40
|
+
completer: (line) => {
|
|
41
|
+
// Tab on an empty prompt focuses the autopilot section (aidlc-console/AC-34).
|
|
42
|
+
if (line === '') {
|
|
43
|
+
setImmediate(() => {
|
|
44
|
+
out.write('\n');
|
|
45
|
+
finish({ kind: 'focus' });
|
|
46
|
+
});
|
|
47
|
+
return [[], line];
|
|
48
|
+
}
|
|
49
|
+
return complete(line);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
rl.on('history', (h) => {
|
|
53
|
+
history = h;
|
|
54
|
+
});
|
|
55
|
+
const onKey = (_s, key) => {
|
|
56
|
+
if (key?.ctrl && key.name === 't') {
|
|
57
|
+
carry = rl.line;
|
|
58
|
+
// End the prompt's line, so what the toggle prints starts on its own.
|
|
59
|
+
out.write('\n');
|
|
60
|
+
finish({ kind: 'toggle' });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const timer = setInterval(() => {
|
|
64
|
+
const lines = tick();
|
|
65
|
+
if (lines.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
// Print over the prompt line, then redraw the prompt with what was typed (aidlc-console/AC-32).
|
|
68
|
+
out.write(`\r\x1b[K${lines.join('\n')}\n`);
|
|
69
|
+
rl.prompt(true);
|
|
70
|
+
}, TICK_MS);
|
|
71
|
+
const finish = (input) => {
|
|
72
|
+
if (done)
|
|
73
|
+
return;
|
|
74
|
+
done = true;
|
|
75
|
+
clearInterval(timer);
|
|
76
|
+
process.stdin.off('keypress', onKey);
|
|
77
|
+
rl.close();
|
|
78
|
+
resolve(input);
|
|
79
|
+
};
|
|
80
|
+
// A paste arrives as one chunk of several lines, all emitted before the next
|
|
81
|
+
// turn of the event loop; collect them into one input rather than sending the
|
|
82
|
+
// first and dropping the rest when the interface closes.
|
|
83
|
+
const lines = [];
|
|
84
|
+
rl.on('line', (text) => {
|
|
85
|
+
lines.push(text);
|
|
86
|
+
if (lines.length === 1)
|
|
87
|
+
setImmediate(() => finish({ kind: 'line', text: lines.join('\n') }));
|
|
88
|
+
});
|
|
89
|
+
// Ctrl-D on an empty line closes the interface (aidlc-console/AC-8).
|
|
90
|
+
rl.on('close', () => finish({ kind: 'eof' }));
|
|
91
|
+
rl.on('SIGINT', () => {
|
|
92
|
+
if (rl.line !== '') {
|
|
93
|
+
rl.write(null, { ctrl: true, name: 'u' });
|
|
94
|
+
rl.write(null, { ctrl: true, name: 'k' });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
out.write('\n(/exit or Ctrl-D leaves)\n');
|
|
98
|
+
rl.prompt();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
process.stdin.on('keypress', onKey);
|
|
102
|
+
rl.prompt();
|
|
103
|
+
if (carry !== '') {
|
|
104
|
+
rl.write(carry);
|
|
105
|
+
carry = '';
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
write(text) {
|
|
110
|
+
frameHeight = 0;
|
|
111
|
+
out.write(text);
|
|
112
|
+
},
|
|
113
|
+
frame(lines) {
|
|
114
|
+
if (frameHeight > 0)
|
|
115
|
+
out.write(`\x1b[${frameHeight}A\r\x1b[J`);
|
|
116
|
+
out.write(`${lines.join('\n')}\n`);
|
|
117
|
+
frameHeight = lines.length;
|
|
118
|
+
},
|
|
119
|
+
key() {
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
emitKeypressEvents(process.stdin);
|
|
122
|
+
const raw = process.stdin.isTTY === true;
|
|
123
|
+
if (raw)
|
|
124
|
+
process.stdin.setRawMode(true);
|
|
125
|
+
process.stdin.resume();
|
|
126
|
+
process.stdin.once('keypress', (s, key) => {
|
|
127
|
+
if (raw)
|
|
128
|
+
process.stdin.setRawMode(false);
|
|
129
|
+
process.stdin.pause();
|
|
130
|
+
if (key?.ctrl && (key.name === 'c' || key.name === 'd'))
|
|
131
|
+
resolve('escape');
|
|
132
|
+
else
|
|
133
|
+
resolve(key?.name ?? s ?? '');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
columns: () => out.columns,
|
|
138
|
+
async capture(run) {
|
|
139
|
+
frameHeight = 0;
|
|
140
|
+
const chunks = [];
|
|
141
|
+
const outWrite = process.stdout.write.bind(process.stdout);
|
|
142
|
+
const errWrite = process.stderr.write.bind(process.stderr);
|
|
143
|
+
const tee = (orig) => ((chunk, ...rest) => {
|
|
144
|
+
chunks.push(typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf8'));
|
|
145
|
+
return orig(chunk, ...rest);
|
|
146
|
+
});
|
|
147
|
+
process.stdout.write = tee(outWrite);
|
|
148
|
+
process.stderr.write = tee(errWrite);
|
|
149
|
+
try {
|
|
150
|
+
const value = await run();
|
|
151
|
+
return { value, output: plain(chunks.join('')) };
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
process.stdout.write = outWrite;
|
|
155
|
+
process.stderr.write = errWrite;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* One agent turn as a child process. The message goes on stdin (design D3).
|
|
162
|
+
* Ctrl-C stops the turn and nothing else (aidlc-console/AC-29); a program that
|
|
163
|
+
* cannot start reports `missing` (aidlc-console/AC-28).
|
|
164
|
+
*/
|
|
165
|
+
export function spawnTurn(cwd, argv, stdin, onLine) {
|
|
166
|
+
return {
|
|
167
|
+
done: new Promise((resolve) => {
|
|
168
|
+
let interrupted = false;
|
|
169
|
+
let settled = false;
|
|
170
|
+
const child = spawn(argv[0], argv.slice(1), { cwd, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
171
|
+
const onSigint = () => {
|
|
172
|
+
interrupted = true;
|
|
173
|
+
child.kill('SIGINT');
|
|
174
|
+
};
|
|
175
|
+
process.on('SIGINT', onSigint);
|
|
176
|
+
const settle = (code, missing) => {
|
|
177
|
+
if (settled)
|
|
178
|
+
return;
|
|
179
|
+
settled = true;
|
|
180
|
+
process.off('SIGINT', onSigint);
|
|
181
|
+
resolve({ code, missing, interrupted });
|
|
182
|
+
};
|
|
183
|
+
child.on('error', (err) => settle(null, err.code === 'ENOENT'));
|
|
184
|
+
child.stdin.on('error', () => { });
|
|
185
|
+
child.stdin.end(stdin);
|
|
186
|
+
createInterface({ input: child.stdout }).on('line', onLine);
|
|
187
|
+
// The harness's own warnings, shown as they come.
|
|
188
|
+
createInterface({ input: child.stderr }).on('line', (l) => process.stderr.write(`${l}\n`));
|
|
189
|
+
child.on('close', (code) => settle(code, false));
|
|
190
|
+
}),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/** A `!` line in the user's shell, its output shown and collected (aidlc-console/AC-19). */
|
|
194
|
+
export function runShell(cwd, cmd) {
|
|
195
|
+
return new Promise((resolve) => {
|
|
196
|
+
const chunks = [];
|
|
197
|
+
const child = spawn(process.env.SHELL || '/bin/sh', ['-c', cmd], { cwd, stdio: ['inherit', 'pipe', 'pipe'] });
|
|
198
|
+
const tee = (to) => (b) => {
|
|
199
|
+
chunks.push(b.toString('utf8'));
|
|
200
|
+
to.write(b);
|
|
201
|
+
};
|
|
202
|
+
child.stdout.on('data', tee(process.stdout));
|
|
203
|
+
child.stderr.on('data', tee(process.stderr));
|
|
204
|
+
child.on('error', (err) => resolve({ code: 127, output: err.message }));
|
|
205
|
+
child.on('close', (code) => resolve({ code, output: plain(chunks.join('')) }));
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/** An interactive shell in `cwd`; resolves when the user exits it. */
|
|
209
|
+
export function openShell(cwd) {
|
|
210
|
+
return new Promise((resolve) => {
|
|
211
|
+
const child = spawn(process.env.SHELL || '/bin/sh', [], { cwd, stdio: 'inherit' });
|
|
212
|
+
child.on('error', () => resolve());
|
|
213
|
+
child.on('close', () => resolve());
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/console/terminal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAY,MAAM,eAAe,CAAC;AAI9E,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAE5B,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C,kEAAkE;AAClE,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3B,IAAI,OAAO,GAAa,EAAE,CAAC;IAC3B,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,8EAA8E;IAC9E,IAAI,KAAK,GAAG,EAAE,CAAC;IAEf,OAAO;QACL,IAAI,CAAC,MAAc,EAAE,IAAoB,EAAE,QAA8C;YACvF,WAAW,GAAG,CAAC,CAAC;YAChB,OAAO,IAAI,OAAO,CAAQ,CAAC,OAAO,EAAE,EAAE;gBACpC,IAAI,IAAI,GAAG,KAAK,CAAC;gBACjB,MAAM,EAAE,GAAG,eAAe,CAAC;oBACzB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,MAAM,EAAE,GAAG;oBACX,MAAM;oBACN,QAAQ,EAAE,IAAI;oBACd,OAAO;oBACP,W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EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/menu/index.d.ts
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* interactive-cli-menu/AC-
|
|
4
|
-
* interactive-cli-menu/AC-18, interactive-cli-menu/AC-19,
|
|
5
|
-
* interactive-cli-menu/AC-20, interactive-cli-menu/AC-26,
|
|
6
|
-
* interactive-cli-menu/AC-29, interactive-cli-menu/AC-31,
|
|
7
|
-
* interactive-cli-menu/AC-35).
|
|
2
|
+
* What remains of the one-shot menu (interactive-cli-menu/AC-10,
|
|
3
|
+
* interactive-cli-menu/AC-14, interactive-cli-menu/AC-31).
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* from it permanently.
|
|
5
|
+
* The select itself was retired by aidlc-console: bare `aidlc` and `aidlc menu`
|
|
6
|
+
* now open the console (`console/index.ts`). Its off-terminal fallbacks and the
|
|
7
|
+
* command-form teaching string stay here, and the console reuses the roster,
|
|
8
|
+
* `resolve.ts` and `dispatch.ts` beside them.
|
|
14
9
|
*
|
|
15
10
|
* @module
|
|
16
11
|
*/
|
|
17
12
|
import type { Command } from 'commander';
|
|
18
|
-
import {
|
|
19
|
-
import { type MenuEntry } from './roster.js';
|
|
13
|
+
import type { MenuEntry } from './roster.js';
|
|
20
14
|
/** Which entry point asked for the menu; selects the non-interactive fallback. */
|
|
21
15
|
export type MenuMode = 'bare' | 'menu';
|
|
22
16
|
/**
|
|
@@ -40,15 +34,4 @@ export declare function commandForm(entry: MenuEntry, values?: readonly string[]
|
|
|
40
34
|
* diagnostic is about the terminal, not the command surface.
|
|
41
35
|
*/
|
|
42
36
|
export declare function writeNonInteractiveFallback(program: Command, mode: MenuMode): void;
|
|
43
|
-
/**
|
|
44
|
-
* Open the interactive menu.
|
|
45
|
-
*
|
|
46
|
-
* @param makeProgram Factory for a fully-registered program. A factory rather
|
|
47
|
-
* than an instance because `runEntry` dispatches on a throwaway copy, leaving
|
|
48
|
-
* the caller's program free of an `exitOverride` it could not undo.
|
|
49
|
-
* @param deps The prompt seam. Was a menu-local `MenuDeps`; it is now
|
|
50
|
-
* `core/prompt.ts`'s `Prompter`, shared with every other prompt-bearing
|
|
51
|
-
* command (single-clack-prompt-seam/AC-4).
|
|
52
|
-
*/
|
|
53
|
-
export declare function openMenu(makeProgram: () => Command, mode?: MenuMode, deps?: Prompter): Promise<void>;
|
|
54
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/menu/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAEpF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CASlF"}
|
package/dist/menu/index.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* interactive-cli-menu/AC-
|
|
4
|
-
* interactive-cli-menu/AC-18, interactive-cli-menu/AC-19,
|
|
5
|
-
* interactive-cli-menu/AC-20, interactive-cli-menu/AC-26,
|
|
6
|
-
* interactive-cli-menu/AC-29, interactive-cli-menu/AC-31,
|
|
7
|
-
* interactive-cli-menu/AC-35).
|
|
2
|
+
* What remains of the one-shot menu (interactive-cli-menu/AC-10,
|
|
3
|
+
* interactive-cli-menu/AC-14, interactive-cli-menu/AC-31).
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* from it permanently.
|
|
5
|
+
* The select itself was retired by aidlc-console: bare `aidlc` and `aidlc menu`
|
|
6
|
+
* now open the console (`console/index.ts`). Its off-terminal fallbacks and the
|
|
7
|
+
* command-form teaching string stay here, and the console reuses the roster,
|
|
8
|
+
* `resolve.ts` and `dispatch.ts` beside them.
|
|
14
9
|
*
|
|
15
10
|
* @module
|
|
16
11
|
*/
|
|
17
|
-
import { defaultPrompter, requireNonEmpty, } from '../core/prompt.js';
|
|
18
|
-
import { buildArgv, runEntry } from './dispatch.js';
|
|
19
|
-
import { hintFor, requiredArgs, resolveEntry } from './resolve.js';
|
|
20
|
-
import { ROSTER } from './roster.js';
|
|
21
12
|
/**
|
|
22
13
|
* The equivalent command form for an entry (interactive-cli-menu/AC-14).
|
|
23
14
|
*
|
|
@@ -49,75 +40,4 @@ export function writeNonInteractiveFallback(program, mode) {
|
|
|
49
40
|
}
|
|
50
41
|
process.exitCode = 1;
|
|
51
42
|
}
|
|
52
|
-
/** Build the select options: curated label + command form, description as hint. */
|
|
53
|
-
function optionsFor(program) {
|
|
54
|
-
return ROSTER.map((entry, index) => {
|
|
55
|
-
const cmd = resolveEntry(program, entry);
|
|
56
|
-
return {
|
|
57
|
-
value: String(index),
|
|
58
|
-
// AC-14: every entry carries its equivalent command form, not just the
|
|
59
|
-
// one the user ends up picking.
|
|
60
|
-
label: `${entry.label} · ${commandForm(entry)}`,
|
|
61
|
-
hint: cmd ? hintFor(cmd) : undefined,
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Open the interactive menu.
|
|
67
|
-
*
|
|
68
|
-
* @param makeProgram Factory for a fully-registered program. A factory rather
|
|
69
|
-
* than an instance because `runEntry` dispatches on a throwaway copy, leaving
|
|
70
|
-
* the caller's program free of an `exitOverride` it could not undo.
|
|
71
|
-
* @param deps The prompt seam. Was a menu-local `MenuDeps`; it is now
|
|
72
|
-
* `core/prompt.ts`'s `Prompter`, shared with every other prompt-bearing
|
|
73
|
-
* command (single-clack-prompt-seam/AC-4).
|
|
74
|
-
*/
|
|
75
|
-
export async function openMenu(makeProgram, mode = 'bare', deps = defaultPrompter) {
|
|
76
|
-
const program = makeProgram();
|
|
77
|
-
if (!deps.interactive()) {
|
|
78
|
-
writeNonInteractiveFallback(program, mode);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
deps.intro(`aidlc v${program.version() ?? ''}`);
|
|
82
|
-
const choice = await deps.select({
|
|
83
|
-
message: 'What do you want to do?',
|
|
84
|
-
options: optionsFor(program),
|
|
85
|
-
});
|
|
86
|
-
if (!choice.ok) {
|
|
87
|
-
deps.outro('cancelled');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const entry = ROSTER[Number(choice.value)];
|
|
91
|
-
if (!entry) {
|
|
92
|
-
deps.outro('cancelled');
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const values = [];
|
|
96
|
-
// `start` runs its own template picker and offers the isolation choice via
|
|
97
|
-
// the concurrency gate, so prompting here would duplicate it (AC-35).
|
|
98
|
-
if (!entry.delegatesArgs) {
|
|
99
|
-
const leaf = resolveEntry(program, entry);
|
|
100
|
-
for (const arg of leaf ? requiredArgs(leaf) : []) {
|
|
101
|
-
const value = await deps.text({
|
|
102
|
-
message: `${entry.label} — ${arg.name()}`,
|
|
103
|
-
validate: requireNonEmpty(arg.name()),
|
|
104
|
-
});
|
|
105
|
-
// Cancel at any depth returns before dispatch, so there is no partial
|
|
106
|
-
// side effect to unwind: nothing has run yet (AC-26). `no-tty` cannot
|
|
107
|
-
// reach here — `deps.interactive()` already returned above — but it is
|
|
108
|
-
// handled by the same branch, so a future reordering degrades to a clean
|
|
109
|
-
// exit rather than a hang.
|
|
110
|
-
if (!value.ok) {
|
|
111
|
-
deps.outro('cancelled');
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
values.push(value.value);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Close this clack session BEFORE dispatching: `aidlc init` opens its own
|
|
118
|
-
// intro, and nesting them stacks two session headers while leaving the
|
|
119
|
-
// menu's unclosed. The outro doubles as the AC-14 teaching line.
|
|
120
|
-
deps.outro(commandForm(entry, values));
|
|
121
|
-
await runEntry(makeProgram, buildArgv(entry, values));
|
|
122
|
-
}
|
|
123
43
|
//# sourceMappingURL=index.js.map
|
package/dist/menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAE,SAA4B,EAAE;IAC1E,OAAO,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAgB,EAAE,IAAc;IAC1E,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasensio/aidlc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.80.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.80.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "22.15.32",
|