@goodfoot/claude-code-hooks 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +11 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -842,6 +842,17 @@ async function main() {
|
|
|
842
842
|
// Generate hooks.json for newly compiled hooks
|
|
843
843
|
const executable = args.executable !== undefined && args.executable !== '' ? args.executable : 'node';
|
|
844
844
|
const newHooksJson = generateHooksJson(compiledHooks, buildDir, hookContext, executable);
|
|
845
|
+
// Preserve timestamp if generated files haven't changed
|
|
846
|
+
if (existingHooksJson !== undefined) {
|
|
847
|
+
const existingFiles = [...(existingHooksJson.__generated?.files ?? [])].sort();
|
|
848
|
+
const newFiles = [...newHooksJson.__generated.files].sort();
|
|
849
|
+
const filesUnchanged =
|
|
850
|
+
existingFiles.length === newFiles.length && existingFiles.every((f, i) => f === newFiles[i]);
|
|
851
|
+
if (filesUnchanged && existingHooksJson.__generated?.timestamp) {
|
|
852
|
+
newHooksJson.__generated.timestamp = existingHooksJson.__generated.timestamp;
|
|
853
|
+
log('info', 'Files unchanged, preserving existing timestamp');
|
|
854
|
+
}
|
|
855
|
+
}
|
|
845
856
|
// Merge with preserved hooks
|
|
846
857
|
const finalHooksJson = mergeHooksJson(newHooksJson, preservedHooks);
|
|
847
858
|
writeHooksJson(finalHooksJson, outputPath);
|