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
@@ -8,6 +8,12 @@ const path = require('path');
const README = path.join(__dirname, '..', '..', 'README.md');
const HOOKS_README = path.join(__dirname, '..', '..', 'hooks', 'README.md');
const HOOK_REGISTRATION_PHRASE =
'registers the resolved hook entries in `~/.claude/settings.json`';
function normalizeWhitespace(text) {
return text.replace(/\s+/g, ' ');
}
function test(name, fn) {
try {
@@ -44,11 +50,11 @@ function runTests() {
'README should document the supported PowerShell hook install path'
);
assert.ok(
readme.includes('%USERPROFILE%\\\\.claude'),
readme.includes('%USERPROFILE%\\.claude'),
'README should call out the correct Windows Claude config root'
);
assert.ok(
readme.includes('registers the resolved\nhook entries in `~/.claude/settings.json`'),
normalizeWhitespace(readme).includes(HOOK_REGISTRATION_PHRASE),
'README should explain that manual installs register hooks in Claude settings'
);
})) passed++; else failed++;
@@ -67,7 +73,7 @@ function runTests() {
'hooks/README should document the supported PowerShell hook install path'
);
assert.ok(
hooksReadme.includes('registers the resolved\nhook entries in `~/.claude/settings.json`'),
normalizeWhitespace(hooksReadme).includes(HOOK_REGISTRATION_PHRASE),
'hooks/README should explain that manual installs register hooks in Claude settings'
);
})) passed++; else failed++;