@@ -10,6 +10,8 @@ const path = require('node:path');
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const {
|
||||
resolveRuntimeConfigIntent,
|
||||
resolveInstallPlan,
|
||||
resolveInstallPlanFromRuntimes,
|
||||
ALLOWED_CONFIG_RUNTIMES,
|
||||
INSTALL_SURFACES,
|
||||
} = require(path.join(ROOT, 'gsd-core', 'bin', 'lib', 'runtime-config-adapter-registry.cjs'));
|
||||
@@ -250,3 +252,55 @@ describe('INSTALL_SURFACES export', () => {
|
||||
assert.deepStrictEqual(new Set(INSTALL_SURFACES), EXPECTED_SURFACES);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveInstallPlan — hooksSurface is descriptor-owned', () => {
|
||||
test('real descriptor-owned none surface is preserved for opencode and kilo', () => {
|
||||
assert.strictEqual(resolveInstallPlan('opencode').hooksSurface, 'none');
|
||||
assert.strictEqual(resolveInstallPlan('kilo').hooksSurface, 'none');
|
||||
});
|
||||
|
||||
test('synthetic descriptor resolves hooksSurface without runtime-name fallback', () => {
|
||||
const runtimes = {
|
||||
futurecli: {
|
||||
runtime: {
|
||||
installSurface: 'settings-json',
|
||||
writesSharedSettings: true,
|
||||
permissionWriter: null,
|
||||
hookEvents: 'claude',
|
||||
extendedHookEvents: ['Stop'],
|
||||
hooksSurface: 'settings-json',
|
||||
sandboxTier: 'none',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepStrictEqual(resolveInstallPlanFromRuntimes(runtimes, 'futurecli'), {
|
||||
runtime: 'futurecli',
|
||||
installSurface: 'settings-json',
|
||||
writesSharedSettings: true,
|
||||
finishPermissionWriter: null,
|
||||
hookEvents: 'claude',
|
||||
extendedHookEvents: ['Stop'],
|
||||
hooksSurface: 'settings-json',
|
||||
sandboxTier: 'none',
|
||||
});
|
||||
});
|
||||
|
||||
test('missing hooksSurface fails loudly instead of falling back from runtime name', () => {
|
||||
const runtimes = {
|
||||
opencode: {
|
||||
runtime: {
|
||||
installSurface: 'settings-json',
|
||||
writesSharedSettings: true,
|
||||
permissionWriter: 'opencode',
|
||||
extendedHookEvents: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert.throws(
|
||||
() => resolveInstallPlanFromRuntimes(runtimes, 'opencode'),
|
||||
/runtime\.hooksSurface/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user