caveat-cli 0.17.0 → 0.17.2
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/README.md +15 -3
- package/dist/{chunk-7FEOFAMA.js → chunk-TRIQ5WFY.js} +163 -99
- package/dist/chunk-TRIQ5WFY.js.map +1 -0
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/{server-STR2EAWZ.js → server-FUWTRVRZ.js} +513 -232
- package/dist/server-FUWTRVRZ.js.map +1 -0
- package/package.json +20 -17
- package/dist/chunk-7FEOFAMA.js.map +0 -1
- package/dist/server-STR2EAWZ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
userPromptSubmitReminderText,
|
|
73
73
|
writeDigestMarker,
|
|
74
74
|
writeUserConfigPatch
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-TRIQ5WFY.js";
|
|
76
76
|
|
|
77
77
|
// ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js
|
|
78
78
|
var require_code = __commonJS({
|
|
@@ -7118,8 +7118,9 @@ import { parse as parseToml } from "smol-toml";
|
|
|
7118
7118
|
function quote2(p) {
|
|
7119
7119
|
return p.includes(" ") ? `"${p}"` : p;
|
|
7120
7120
|
}
|
|
7121
|
-
function hookCommand2(nodePath, cliScriptPath, event) {
|
|
7122
|
-
|
|
7121
|
+
function hookCommand2(nodePath, cliScriptPath, event, platform = process.platform) {
|
|
7122
|
+
const prefix = platform === "win32" ? "& " : "";
|
|
7123
|
+
return `${prefix}${quote2(nodePath)} ${quote2(cliScriptPath)} codex-hook ${event}`;
|
|
7123
7124
|
}
|
|
7124
7125
|
function eventCommandFragment(event) {
|
|
7125
7126
|
return `codex-hook ${event}`;
|
|
@@ -7153,7 +7154,8 @@ function isCanonicalAsset2(path, expectedPath, mode) {
|
|
|
7153
7154
|
}
|
|
7154
7155
|
}
|
|
7155
7156
|
function isCanonicalCaveatCodexHookCommand(actual, event, nodePath, cliScriptPath) {
|
|
7156
|
-
const
|
|
7157
|
+
const parsed = commandTokens2(actual);
|
|
7158
|
+
const tokens = parsed?.[0] === "&" ? parsed.slice(1) : parsed;
|
|
7157
7159
|
return tokens?.length === 4 && isCanonicalAsset2(tokens[0], nodePath, constants2.X_OK) && isCanonicalAsset2(tokens[1], cliScriptPath, constants2.R_OK) && tokens[2] === "codex-hook" && tokens[3] === event;
|
|
7158
7160
|
}
|
|
7159
7161
|
function hasCaveatHook(hooksJson, event, fragment) {
|
|
@@ -7423,19 +7425,19 @@ function installCodexHooks(opts) {
|
|
|
7423
7425
|
const userPromptSubmit = upsertHook2(
|
|
7424
7426
|
hooksJson,
|
|
7425
7427
|
"UserPromptSubmit",
|
|
7426
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "user-prompt-submit"),
|
|
7428
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "user-prompt-submit", opts.platform),
|
|
7427
7429
|
"user-prompt-submit"
|
|
7428
7430
|
);
|
|
7429
7431
|
const postToolUse = upsertHook2(
|
|
7430
7432
|
hooksJson,
|
|
7431
7433
|
"PostToolUse",
|
|
7432
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "post-tool-use"),
|
|
7434
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "post-tool-use", opts.platform),
|
|
7433
7435
|
"post-tool-use"
|
|
7434
7436
|
);
|
|
7435
7437
|
const stop = upsertHook2(
|
|
7436
7438
|
hooksJson,
|
|
7437
7439
|
"Stop",
|
|
7438
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "stop"),
|
|
7440
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "stop", opts.platform),
|
|
7439
7441
|
"stop"
|
|
7440
7442
|
);
|
|
7441
7443
|
const anyHookAdded = userPromptSubmit === "added" || postToolUse === "added" || stop === "added";
|
|
@@ -7467,19 +7469,19 @@ function uninstallCodexHooks(opts) {
|
|
|
7467
7469
|
const userPromptSubmitRemoved = removeHook2(
|
|
7468
7470
|
hooksJson,
|
|
7469
7471
|
"UserPromptSubmit",
|
|
7470
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "user-prompt-submit"),
|
|
7472
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "user-prompt-submit", opts.platform),
|
|
7471
7473
|
"user-prompt-submit"
|
|
7472
7474
|
);
|
|
7473
7475
|
const postToolUseRemoved = removeHook2(
|
|
7474
7476
|
hooksJson,
|
|
7475
7477
|
"PostToolUse",
|
|
7476
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "post-tool-use"),
|
|
7478
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "post-tool-use", opts.platform),
|
|
7477
7479
|
"post-tool-use"
|
|
7478
7480
|
);
|
|
7479
7481
|
const stopRemoved = removeHook2(
|
|
7480
7482
|
hooksJson,
|
|
7481
7483
|
"Stop",
|
|
7482
|
-
hookCommand2(opts.nodePath, opts.cliScriptPath, "stop"),
|
|
7484
|
+
hookCommand2(opts.nodePath, opts.cliScriptPath, "stop", opts.platform),
|
|
7483
7485
|
"stop"
|
|
7484
7486
|
);
|
|
7485
7487
|
let backupPath;
|
|
@@ -8290,7 +8292,7 @@ function runStats(ctx) {
|
|
|
8290
8292
|
|
|
8291
8293
|
// src/commands/serve.ts
|
|
8292
8294
|
async function runServe(opts) {
|
|
8293
|
-
const { startServer } = await import("./server-
|
|
8295
|
+
const { startServer } = await import("./server-FUWTRVRZ.js");
|
|
8294
8296
|
const { port, host } = startServer({ port: opts.port });
|
|
8295
8297
|
process.stdout.write(`[caveat] web portal: http://${host}:${port}/
|
|
8296
8298
|
`);
|