Add config-health monitor and install wiring

- Add the config-health skill: a read-only monitor for hook wiring, rule references, and rule staleness; every mode exits 0.
- Ship its own SessionStart hook asset so installing the module registers the monitor; keep PreToolUse opt-in.
- Keep one install-state record per hook source, so hooks-runtime and config-health can share settings.json and uninstall removes both.
- Split the monitor into a CLI entry plus constants, paths, and scan modules; split scan_command and the hook contract suite. All files are under 800 lines and no function body reaches 50 lines.
This commit is contained in:
YuhaoLin2005 committed 2026-11-02 22:53:30 +08:00
1 parent e83576fe7d
commit 95bf86c348
20 files changed
+1752 -1249

No files matched your search

+15 -5
View File
@@ -550,12 +550,22 @@ function runTests() {
const settingsOperations = parsed.plan.operations.filter(operation => (
operation.kind === 'update-claude-settings'
));
assert.strictEqual(settingsOperations.length, 1);
assert.strictEqual(
settingsOperations[0].destinationPath,
path.join(homeDir, '.claude', 'settings.json')
// Two modules ship hooks: the runtime, and config-health's own
// SessionStart registration. Both merge into the same settings file.
assert.strictEqual(settingsOperations.length, 2);
for (const operation of settingsOperations) {
assert.strictEqual(
operation.destinationPath,
path.join(homeDir, '.claude', 'settings.json')
);
assert.ok(operation.managedHooks.SessionStart);
}
assert.deepStrictEqual(
settingsOperations
.map(operation => String(operation.sourceRelativePath).replace(/\\/g, '/'))
.sort(),
['hooks/hooks.json', 'manifests/install-assets/config-health-hooks.json']
);
assert.ok(settingsOperations[0].managedHooks.SessionStart);
assert.ok(!parsed.plan.operations.some(operation => (
operation.kind === 'copy-file'
&& String(operation.sourceRelativePath || '').replace(/\\/g, '/') === 'hooks/hooks.json'