patchcord 0.5.21 → 0.5.23
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/bin/patchcord.mjs
CHANGED
|
@@ -299,7 +299,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
299
299
|
copyFileSync(hookScriptSrc, hookScriptDest);
|
|
300
300
|
chmodSync(hookScriptDest, 0o755);
|
|
301
301
|
|
|
302
|
-
// Enable codex_hooks feature flag if not already set
|
|
302
|
+
// Enable codex_hooks feature flag in config.toml if not already set
|
|
303
303
|
if (!globalCodexContent.includes("codex_hooks")) {
|
|
304
304
|
if (globalCodexContent.includes("[features]")) {
|
|
305
305
|
globalCodexContent = globalCodexContent.replace(/(\[features\])/, "$1\ncodex_hooks = true");
|
|
@@ -308,11 +308,19 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
// Remove old patchcord stop hook entry
|
|
312
|
-
globalCodexContent = globalCodexContent.replace(/\[\[hooks\.Stop\]\]\nhooks = \[.*patchcord-stop-hook.*\]\n?/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
313
|
-
|
|
314
|
-
//
|
|
315
|
-
|
|
311
|
+
// Remove any old patchcord stop hook entry from config.toml (moved to hooks.json)
|
|
312
|
+
globalCodexContent = globalCodexContent.replace(/\[\[hooks\.Stop\]\]\nhooks = \[.*patchcord-stop-hook.*\]\n?/g, "").replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
313
|
+
|
|
314
|
+
// Write Stop hook to hooks.json (avoid dual-source warning when both config.toml and hooks.json exist)
|
|
315
|
+
const hooksJsonPath = join(HOME, ".codex", "hooks.json");
|
|
316
|
+
let hooksJson = existsSync(hooksJsonPath) ? JSON.parse(readFileSync(hooksJsonPath, "utf-8")) : {};
|
|
317
|
+
if (!hooksJson.hooks) hooksJson.hooks = {};
|
|
318
|
+
const stopHooks = (hooksJson.hooks.Stop || []).filter(e =>
|
|
319
|
+
!JSON.stringify(e).includes("patchcord-stop-hook")
|
|
320
|
+
);
|
|
321
|
+
stopHooks.push({ hooks: [{ type: "command", command: hookScriptDest, timeout: 10 }] });
|
|
322
|
+
hooksJson.hooks.Stop = stopHooks;
|
|
323
|
+
writeFileSync(hooksJsonPath, JSON.stringify(hooksJson, null, 2) + "\n");
|
|
316
324
|
|
|
317
325
|
globalChanges.push(`Codex stop hook ${hookAlreadyExisted ? "updated" : "installed"}`);
|
|
318
326
|
}
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ If you can't do it right now: use `reply(message_id, "reason", defer=true)` to k
|
|
|
39
39
|
|
|
40
40
|
## Startup
|
|
41
41
|
|
|
42
|
-
Call `inbox()` once at session start.
|
|
42
|
+
Call `inbox()` once at session start. **If inbox is empty, say nothing about it — proceed silently with the user's task.**
|
|
43
43
|
|
|
44
44
|
If there are pending actionable messages:
|
|
45
45
|
|