@ghl-ai/aw 0.1.37-beta.70 → 0.1.37-beta.71
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/integrate.mjs +11 -15
- package/package.json +1 -1
package/integrate.mjs
CHANGED
|
@@ -680,28 +680,24 @@ export function installIdeHooks() {
|
|
|
680
680
|
mkdirSync(codexDir, { recursive: true });
|
|
681
681
|
const codexHooksPath = join(codexDir, 'hooks.json');
|
|
682
682
|
|
|
683
|
-
let
|
|
683
|
+
let codexHooksFile = {};
|
|
684
684
|
if (existsSync(codexHooksPath)) {
|
|
685
|
-
try {
|
|
685
|
+
try { codexHooksFile = JSON.parse(readFileSync(codexHooksPath, 'utf8')); } catch { codexHooksFile = {}; }
|
|
686
686
|
}
|
|
687
|
+
if (!codexHooksFile.hooks) codexHooksFile.hooks = {};
|
|
687
688
|
|
|
688
689
|
// Codex supports: SessionStart, Stop, PreToolUse, PostToolUse, UserPromptSubmit
|
|
689
690
|
const codexEvents = { SessionStart: dispatchers.SessionStart, Stop: dispatchers.Stop };
|
|
690
691
|
for (const [event, { cmd, timeout }] of Object.entries(codexEvents)) {
|
|
691
|
-
if (!
|
|
692
|
+
if (!codexHooksFile.hooks[event]) codexHooksFile.hooks[event] = [];
|
|
692
693
|
|
|
693
|
-
//
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
g.hooks?.some(h => h.command?.includes('.aw/hooks/'))
|
|
694
|
+
// Remove old aw entries
|
|
695
|
+
codexHooksFile.hooks[event] = codexHooksFile.hooks[event].filter(h =>
|
|
696
|
+
!h.command?.includes('.aw/hooks/')
|
|
697
697
|
);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
-
// Replace aw hooks in the group
|
|
703
|
-
awGroup.hooks = awGroup.hooks.filter(h => !h.command?.includes('.aw/hooks/'));
|
|
704
|
-
awGroup.hooks.push({
|
|
698
|
+
|
|
699
|
+
// Codex hooks are flat objects: { command, type, timeoutSec, statusMessage }
|
|
700
|
+
codexHooksFile.hooks[event].push({
|
|
705
701
|
type: 'command',
|
|
706
702
|
command: cmd,
|
|
707
703
|
timeoutSec: timeout,
|
|
@@ -709,7 +705,7 @@ export function installIdeHooks() {
|
|
|
709
705
|
});
|
|
710
706
|
}
|
|
711
707
|
|
|
712
|
-
writeFileSync(codexHooksPath, JSON.stringify(
|
|
708
|
+
writeFileSync(codexHooksPath, JSON.stringify(codexHooksFile, null, 2) + '\n');
|
|
713
709
|
|
|
714
710
|
// Enable codex_hooks feature if not already set
|
|
715
711
|
const codexConfigPath = join(codexDir, 'config.toml');
|