fix(qa): ship scenario pack and isolate completion cache

This commit is contained in:
Vincent Koc
2026-04-11 12:42:23 +01:00
parent 8a8fdc971c
commit 636fe1c2db
5 changed files with 182 additions and 7 deletions

View File

@@ -48,6 +48,26 @@ async function writeCompletionCache(params: {
}
}
function writeCompletionRegistrationWarning(message: string): void {
process.stderr.write(`[completion] ${message}\n`);
}
async function registerSubcommandsForCompletion(program: Command): Promise<void> {
const entries = getSubCliEntries();
for (const entry of entries) {
if (entry.name === "completion") {
continue;
}
try {
await registerSubCliByName(program, entry.name);
} catch (error) {
writeCompletionRegistrationWarning(
`skipping subcommand \`${entry.name}\` while building completion cache: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
}
export function registerCompletionCli(program: Command) {
program
.command("completion")
@@ -84,13 +104,7 @@ export function registerCompletionCli(program: Command) {
}
// Eagerly register all subcommands except completion itself to build the full tree.
const entries = getSubCliEntries();
for (const entry of entries) {
if (entry.name === "completion") {
continue;
}
await registerSubCliByName(program, entry.name);
}
await registerSubcommandsForCompletion(program);
const { registerPluginCliCommandsFromValidatedConfig } = await import("../plugins/cli.js");
await registerPluginCliCommandsFromValidatedConfig(program, undefined, undefined, {