@scheduler-systems/gal-run 0.0.406 → 0.0.407
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/index.cjs +424 -37
- package/dist/postinstall.cjs +202 -5
- package/dist/preuninstall.cjs +24 -17
- package/package.json +1 -1
- package/scripts/postinstall.cjs +202 -5
- package/scripts/preuninstall.cjs +24 -17
package/scripts/preuninstall.cjs
CHANGED
|
@@ -45,7 +45,7 @@ const os = require('os');
|
|
|
45
45
|
* This function surgically removes only GAL-specific hook entries while
|
|
46
46
|
* preserving the user's other hooks and settings. It handles:
|
|
47
47
|
* - Filtering GAL hooks from UserPromptSubmit array
|
|
48
|
-
* - Filtering GAL hooks from SessionStart
|
|
48
|
+
* - Filtering GAL hooks from SessionStart and Stop arrays
|
|
49
49
|
* - Removing empty hook arrays after filtering
|
|
50
50
|
* - Preserving the settings.json file structure
|
|
51
51
|
*
|
|
@@ -60,24 +60,31 @@ function removeGalHookEntries(settingsPath) {
|
|
|
60
60
|
|
|
61
61
|
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
62
62
|
|
|
63
|
-
if (!settings.hooks
|
|
63
|
+
if (!settings.hooks) {
|
|
64
64
|
return false;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
let removedAny = false;
|
|
68
|
+
|
|
69
|
+
for (const event of ['UserPromptSubmit', 'SessionStart', 'Stop']) {
|
|
70
|
+
if (!settings.hooks[event]) continue;
|
|
71
|
+
|
|
72
|
+
const originalLength = settings.hooks[event].length;
|
|
73
|
+
settings.hooks[event] = settings.hooks[event].filter((entry) => {
|
|
74
|
+
if (!entry.hooks) return true;
|
|
75
|
+
entry.hooks = entry.hooks.filter((hook) =>
|
|
76
|
+
!hook.command?.includes('gal-') && !hook.command?.includes('/gal/')
|
|
77
|
+
);
|
|
78
|
+
return entry.hooks.length > 0;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (settings.hooks[event].length === 0) {
|
|
82
|
+
delete settings.hooks[event];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ((settings.hooks[event]?.length || 0) !== originalLength) {
|
|
86
|
+
removedAny = true;
|
|
87
|
+
}
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
// Remove empty hooks object
|
|
@@ -85,7 +92,7 @@ function removeGalHookEntries(settingsPath) {
|
|
|
85
92
|
delete settings.hooks;
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
if (
|
|
95
|
+
if (removedAny) {
|
|
89
96
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
90
97
|
return true;
|
|
91
98
|
}
|