Removes kilo, kimi, kimi-code, copilot, windsurf, augment, trae, qwen, hermes, cline, codebuddy and pi end to end: capability descriptors, installer branches and converters (bin/install.js 14.9k -> 11.2k lines), TypeScript converters, hook surfaces and runtime homes, review lanes qwen/kimi-code, the two pi migrations, Kimi payload normalization in the hook guards, dead hostBehaviors vocabulary, launcher home probes, fixtures, runtime-specific tests and the prose that presented them as supported. Installer output for the six kept runtimes is byte-identical to before the prune. The Kimi tool-vocabulary tests in workflow-guard, read-guard and read-injection-scanner are left in place pending a decision.
177 lines
7.0 KiB
JavaScript
177 lines
7.0 KiB
JavaScript
/**
|
|
* Tests for multi-runtime selection in the interactive installer prompt.
|
|
* Verifies that promptRuntime accepts comma-separated, space-separated,
|
|
* and single-choice inputs, deduplicates, and falls back to claude.
|
|
* See issue #1281.
|
|
*
|
|
* Per CONTRIBUTING.md "no-source-grep" testing standard, prompt + parser
|
|
* behavior is asserted via the install module's exported pure functions
|
|
* (`runtimeMap`, `allRuntimes`, `parseRuntimeInput`, `buildRuntimePromptText`)
|
|
* instead of regexing bin/install.js source text.
|
|
*
|
|
* The supported runtimes are claude, antigravity, codex, cursor, opencode and
|
|
* zcode (options 1-6); the "All" shortcut is option 7. (#1928 removed gemini;
|
|
* a later prune removed the other unsupported runtimes.)
|
|
*/
|
|
|
|
process.env.MSD_TEST_MODE = '1';
|
|
|
|
const { test, describe } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
const {
|
|
runtimeMap,
|
|
allRuntimes,
|
|
selectRuntimesFromArgs,
|
|
parseRuntimeInput,
|
|
buildRuntimePromptText,
|
|
} = require('../bin/install.js');
|
|
|
|
// Strip ANSI color codes for human-readable assertions on prompt text.
|
|
function stripAnsi(s) {
|
|
// eslint-disable-next-line no-control-regex
|
|
return s.replace(/\x1b\[[0-9;]*m/g, '');
|
|
}
|
|
|
|
describe('multi-runtime selection parsing', () => {
|
|
test('single choice returns single runtime', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1'), ['claude']);
|
|
assert.deepStrictEqual(parseRuntimeInput('2'), ['antigravity']);
|
|
assert.deepStrictEqual(parseRuntimeInput('3'), ['codex']);
|
|
assert.deepStrictEqual(parseRuntimeInput('4'), ['cursor']);
|
|
assert.deepStrictEqual(parseRuntimeInput('5'), ['opencode']);
|
|
assert.deepStrictEqual(parseRuntimeInput('6'), ['zcode']);
|
|
});
|
|
|
|
test('comma-separated choices return multiple runtimes', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1,3,5'), ['claude', 'codex', 'opencode']);
|
|
assert.deepStrictEqual(parseRuntimeInput('2,3'), ['antigravity', 'codex']);
|
|
assert.deepStrictEqual(parseRuntimeInput('3,6'), ['codex', 'zcode']);
|
|
});
|
|
|
|
test('space-separated choices return multiple runtimes', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1 3 5'), ['claude', 'codex', 'opencode']);
|
|
assert.deepStrictEqual(parseRuntimeInput('4 6'), ['cursor', 'zcode']);
|
|
});
|
|
|
|
test('mixed comma and space separators work', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1, 3, 5'), ['claude', 'codex', 'opencode']);
|
|
assert.deepStrictEqual(parseRuntimeInput('2 , 4'), ['antigravity', 'cursor']);
|
|
});
|
|
|
|
test('choice 7 returns all runtimes', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('7'), allRuntimes);
|
|
});
|
|
|
|
test('choice 7 returns all runtimes when mixed with separators or other tokens', () => {
|
|
// CR feedback: tokenized inputs that include the "All" option (e.g. trailing
|
|
// comma, or alongside other choices) must still expand to all-runtimes —
|
|
// previously only the bare all-runtimes option matched, so "7," or "7 1"
|
|
// silently installed a subset.
|
|
assert.deepStrictEqual(parseRuntimeInput('7,'), allRuntimes);
|
|
assert.deepStrictEqual(parseRuntimeInput('7 1'), allRuntimes);
|
|
assert.deepStrictEqual(parseRuntimeInput('1,7'), allRuntimes);
|
|
assert.deepStrictEqual(parseRuntimeInput(' 7 '), allRuntimes);
|
|
});
|
|
|
|
test('empty input defaults to claude', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput(''), ['claude']);
|
|
assert.deepStrictEqual(parseRuntimeInput(' '), ['claude']);
|
|
});
|
|
|
|
test('invalid choices are ignored, falls back to claude if all invalid', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('20'), ['claude']);
|
|
assert.deepStrictEqual(parseRuntimeInput('0'), ['claude']);
|
|
assert.deepStrictEqual(parseRuntimeInput('abc'), ['claude']);
|
|
});
|
|
|
|
test('invalid choices mixed with valid are filtered out', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1,20,3'), ['claude', 'codex']);
|
|
assert.deepStrictEqual(parseRuntimeInput('abc 3 xyz'), ['codex']);
|
|
});
|
|
|
|
test('duplicate choices are deduplicated', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('1,1,1'), ['claude']);
|
|
assert.deepStrictEqual(parseRuntimeInput('3,3,5,5'), ['codex', 'opencode']);
|
|
});
|
|
|
|
test('preserves selection order', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('5,1,3'), ['opencode', 'claude', 'codex']);
|
|
assert.deepStrictEqual(parseRuntimeInput('6,2,4'), ['zcode', 'antigravity', 'cursor']);
|
|
});
|
|
});
|
|
|
|
describe('install.js exports multi-select runtime metadata', () => {
|
|
const expectedRuntimeMap = {
|
|
'1': 'claude',
|
|
'2': 'antigravity',
|
|
'3': 'codex',
|
|
'4': 'cursor',
|
|
'5': 'opencode',
|
|
'6': 'zcode',
|
|
};
|
|
const expectedRuntimes = [
|
|
'claude', 'antigravity', 'codex', 'cursor', 'opencode', 'zcode',
|
|
];
|
|
|
|
test('runtimeMap exports every option key bound to the right runtime', () => {
|
|
assert.deepStrictEqual(runtimeMap, expectedRuntimeMap,
|
|
'exported runtimeMap matches the canonical option list');
|
|
});
|
|
|
|
test('allRuntimes contains every runtime exactly once', () => {
|
|
assert.strictEqual(allRuntimes.length, expectedRuntimes.length);
|
|
for (const rt of expectedRuntimes) {
|
|
assert.ok(allRuntimes.includes(rt), `allRuntimes contains ${rt}`);
|
|
}
|
|
assert.strictEqual(new Set(allRuntimes).size, allRuntimes.length,
|
|
'allRuntimes has no duplicates');
|
|
});
|
|
|
|
test('"All" shortcut (option 7) selects every runtime', () => {
|
|
assert.deepStrictEqual(parseRuntimeInput('7'), allRuntimes);
|
|
});
|
|
|
|
test('--zcode flag selects ZCode without interactive prompt', () => {
|
|
assert.deepStrictEqual(selectRuntimesFromArgs(['--zcode']), ['zcode']);
|
|
});
|
|
|
|
test('--all flag includes ZCode exactly once', () => {
|
|
const selected = selectRuntimesFromArgs(['--all']);
|
|
assert.ok(selected.includes('zcode'), '--all includes zcode');
|
|
assert.strictEqual(selected.filter((runtime) => runtime === 'zcode').length, 1,
|
|
'--all includes zcode exactly once');
|
|
});
|
|
|
|
test('prompt lists ZCode (6) and All (7)', () => {
|
|
const prompt = stripAnsi(buildRuntimePromptText());
|
|
assert.ok(/\b6\)\s*ZCode\b/.test(prompt),
|
|
'prompt lists ZCode as option 6');
|
|
assert.ok(/\b7\)\s*All\b/.test(prompt),
|
|
'prompt lists All as option 7');
|
|
});
|
|
|
|
test('prompt does not list Gemini (removed #1928)', () => {
|
|
const prompt = stripAnsi(buildRuntimePromptText());
|
|
assert.ok(!/Gemini/.test(prompt), 'prompt must not mention Gemini');
|
|
});
|
|
|
|
test('prompt text shows multi-select hint', () => {
|
|
const prompt = stripAnsi(buildRuntimePromptText());
|
|
assert.ok(/Select multiple/i.test(prompt),
|
|
'prompt includes multi-select instructions');
|
|
});
|
|
|
|
test('parser splits on commas and whitespace and deduplicates', () => {
|
|
// Behavioral assertion: same set of choices in different separators
|
|
// produces the same selection, and duplicates collapse.
|
|
assert.deepStrictEqual(
|
|
parseRuntimeInput('1,3,5'),
|
|
parseRuntimeInput('1 3 5'),
|
|
'comma- and space-separated input yield identical selections'
|
|
);
|
|
assert.deepStrictEqual(parseRuntimeInput('1,1,3,3'), ['claude', 'codex'],
|
|
'duplicates collapsed in order');
|
|
});
|
|
});
|