feat: wire manifest resolution into install execution (#509)

This commit is contained in:
Affaan Mustafa
2026-03-15 21:47:22 -07:00
committed by GitHub
parent 8878c6d6b0
commit 1e0238de96
9 changed files with 417 additions and 68 deletions

View File

@@ -10,9 +10,12 @@ const path = require('path');
const {
loadInstallManifests,
listInstallComponents,
listLegacyCompatibilityLanguages,
listInstallModules,
listInstallProfiles,
resolveInstallPlan,
resolveLegacyCompatibilitySelection,
validateInstallModuleIds,
} = require('../../scripts/lib/install-manifests');
function test(name, fn) {
@@ -75,6 +78,15 @@ function runTests() {
'Should include capability:security');
})) passed++; else failed++;
if (test('lists supported legacy compatibility languages', () => {
const languages = listLegacyCompatibilityLanguages();
assert.ok(languages.includes('typescript'));
assert.ok(languages.includes('python'));
assert.ok(languages.includes('go'));
assert.ok(languages.includes('golang'));
assert.ok(languages.includes('kotlin'));
})) passed++; else failed++;
if (test('resolves a real project profile with target-specific skips', () => {
const projectRoot = '/workspace/app';
const plan = resolveInstallPlan({ profileId: 'developer', target: 'cursor', projectRoot });
@@ -97,6 +109,18 @@ function runTests() {
);
})) passed++; else failed++;
if (test('resolves antigravity profiles by skipping incompatible dependency trees', () => {
const projectRoot = '/workspace/app';
const plan = resolveInstallPlan({ profileId: 'core', target: 'antigravity', projectRoot });
assert.deepStrictEqual(plan.selectedModuleIds, ['rules-core', 'agents-core', 'commands-core']);
assert.ok(plan.skippedModuleIds.includes('hooks-runtime'));
assert.ok(plan.skippedModuleIds.includes('platform-configs'));
assert.ok(plan.skippedModuleIds.includes('workflow-quality'));
assert.strictEqual(plan.targetAdapterId, 'antigravity-project');
assert.strictEqual(plan.targetRoot, path.join(projectRoot, '.agent'));
})) passed++; else failed++;
if (test('resolves explicit modules with dependency expansion', () => {
const plan = resolveInstallPlan({ moduleIds: ['security'] });
assert.ok(plan.selectedModuleIds.includes('security'), 'Should include requested module');
@@ -106,6 +130,50 @@ function runTests() {
'Should include nested dependency');
})) passed++; else failed++;
if (test('validates explicit module IDs against the real manifest catalog', () => {
const moduleIds = validateInstallModuleIds(['security', 'security', 'platform-configs']);
assert.deepStrictEqual(moduleIds, ['security', 'platform-configs']);
assert.throws(
() => validateInstallModuleIds(['ghost-module']),
/Unknown install module: ghost-module/
);
})) passed++; else failed++;
if (test('resolves legacy compatibility selections into manifest module IDs', () => {
const selection = resolveLegacyCompatibilitySelection({
target: 'cursor',
legacyLanguages: ['typescript', 'go', 'golang'],
});
assert.deepStrictEqual(selection.legacyLanguages, ['typescript', 'go', 'golang']);
assert.ok(selection.moduleIds.includes('rules-core'));
assert.ok(selection.moduleIds.includes('agents-core'));
assert.ok(selection.moduleIds.includes('commands-core'));
assert.ok(selection.moduleIds.includes('hooks-runtime'));
assert.ok(selection.moduleIds.includes('platform-configs'));
assert.ok(selection.moduleIds.includes('workflow-quality'));
assert.ok(selection.moduleIds.includes('framework-language'));
})) passed++; else failed++;
if (test('keeps antigravity legacy compatibility selections target-safe', () => {
const selection = resolveLegacyCompatibilitySelection({
target: 'antigravity',
legacyLanguages: ['typescript'],
});
assert.deepStrictEqual(selection.moduleIds, ['rules-core', 'agents-core', 'commands-core']);
})) passed++; else failed++;
if (test('rejects unknown legacy compatibility languages', () => {
assert.throws(
() => resolveLegacyCompatibilitySelection({
target: 'cursor',
legacyLanguages: ['brainfuck'],
}),
/Unknown legacy language: brainfuck/
);
})) passed++; else failed++;
if (test('resolves included and excluded user-facing components', () => {
const plan = resolveInstallPlan({
profileId: 'core',
@@ -146,7 +214,7 @@ function runTests() {
);
})) passed++; else failed++;
if (test('throws when a dependency does not support the requested target', () => {
if (test('skips a requested module when its dependency chain does not support the target', () => {
const repoRoot = createTestRepo();
writeJson(path.join(repoRoot, 'manifests', 'install-modules.json'), {
version: 1,
@@ -182,10 +250,9 @@ function runTests() {
}
});
assert.throws(
() => resolveInstallPlan({ repoRoot, profileId: 'core', target: 'claude' }),
/does not support target claude/
);
const plan = resolveInstallPlan({ repoRoot, profileId: 'core', target: 'claude' });
assert.deepStrictEqual(plan.selectedModuleIds, []);
assert.deepStrictEqual(plan.skippedModuleIds, ['parent']);
cleanupTestRepo(repoRoot);
})) passed++; else failed++;