Skip to content

Commit fd5f7d6

Browse files
marcusgollclaude
andcommitted
fix: remove hook backup on update
Hooks are now overwritten directly without creating .backup-* files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent c6e37f2 commit fd5f7d6

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

bin/install-hooks.js

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ async function cleanSettings(targetDir, options = {}) {
342342

343343
/**
344344
* Update hooks if already installed (for use during update)
345-
* Backs up existing hooks before overwriting
345+
* Overwrites existing hooks without backup
346346
* @param {string} targetDir - Target directory
347347
* @param {object} options - Options
348348
* @param {boolean} options.force - Force update even if installed
@@ -359,39 +359,13 @@ async function updateHooksIfInstalled(targetDir, options = {}) {
359359
return { updated: false, reason: 'not_installed' };
360360
}
361361

362-
// Backup existing hooks
363-
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
364-
const hookFiles = [
365-
'design-token-validator.sh',
366-
'design-token-validator.ps1',
367-
'design-system-context.sh',
368-
'design-system-context.ps1'
369-
];
370-
371-
let backedUp = 0;
372-
for (const file of hookFiles) {
373-
const hookPath = path.join(hooksDir, file);
374-
if (fs.existsSync(hookPath)) {
375-
const backupPath = `${hookPath}.backup-${timestamp}`;
376-
try {
377-
fs.copyFileSync(hookPath, backupPath);
378-
backedUp++;
379-
log(` Backed up ${file}`);
380-
} catch (e) {
381-
// Continue if backup fails
382-
}
383-
}
384-
}
385-
386-
// Install updated hooks
362+
// Install updated hooks (no backup - just overwrite)
387363
const result = await installHooks(targetDir, { silent, force: true });
388364

389365
if (result.success) {
390-
log(` ${backedUp} hook(s) backed up`);
391366
return {
392367
updated: true,
393-
installed: result.installed,
394-
backedUp
368+
installed: result.installed
395369
};
396370
} else {
397371
return {

0 commit comments

Comments
 (0)