fix(install): harden Claude settings lifecycle

This commit is contained in:
wellkilo
2026-09-07 01:57:04 +08:00
parent 26d3e0038b
commit f59cfd57c2
19 changed files with 540 additions and 350 deletions
+11 -21
View File
@@ -169,28 +169,18 @@ function runTests() {
},
}],
}),
/managedHooks.*non-empty unique id/
);
assert.throws(
() => createInstallState({
...baseOptions,
operations: [{
...operation,
managedHooks: {
SessionStart: [{
id: 'duplicate',
matcher: '.*',
hooks: [{ type: 'command', command: 'node start.js' }],
}],
Stop: [{
id: 'duplicate',
hooks: [{ type: 'command', command: 'node stop.js' }],
}],
},
}],
}),
/managedHooks.*globally unique id/
/managedHooks.*Invalid hook entry/
);
assert.doesNotThrow(() => createInstallState({
...baseOptions,
operations: [{
...operation,
managedHooks: {
SessionStart: [{ id: 'shared', hooks: [] }],
LegacyEvent: [{ id: 'shared', hooks: [{ type: 'legacy' }] }],
},
}],
}));
})) passed++; else failed++;
if (test('writes and reads install-state from disk', () => {