fullcourtdefense-cli 1.18.11 → 1.18.12
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/commands/hook.d.ts +15 -0
- package/dist/commands/hook.js +7 -0
- package/dist/version.json +1 -1
- package/package.json +1 -1
package/dist/commands/hook.d.ts
CHANGED
|
@@ -33,4 +33,19 @@ export interface HookArgs {
|
|
|
33
33
|
approvalTimeoutMs?: string;
|
|
34
34
|
approvalPollMs?: string;
|
|
35
35
|
}
|
|
36
|
+
type HookEvent = 'prompt' | 'shell' | 'mcp' | 'file' | 'read' | 'unknown';
|
|
37
|
+
/**
|
|
38
|
+
* Claude-format hooks (Claude Code, VS Code Copilot agent mode, GitHub Copilot
|
|
39
|
+
* CLI — all share the same schema) send `hook_event_name` + `tool_name` +
|
|
40
|
+
* `tool_input` on stdin. Normalize that payload into the field shapes the rest
|
|
41
|
+
* of this file already understands (command/file_path/tool_name/tool_input),
|
|
42
|
+
* and map the tool onto our event taxonomy.
|
|
43
|
+
*
|
|
44
|
+
* Returns null when the payload is not Claude-format.
|
|
45
|
+
*/
|
|
46
|
+
export declare function normalizeClaudePayload(payload: Record<string, unknown>): {
|
|
47
|
+
event: HookEvent | 'ignore';
|
|
48
|
+
payload: Record<string, unknown>;
|
|
49
|
+
} | null;
|
|
36
50
|
export declare function hookCommand(args: HookArgs, config: BotGuardConfig): Promise<void>;
|
|
51
|
+
export {};
|
package/dist/commands/hook.js
CHANGED
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.normalizeClaudePayload = normalizeClaudePayload;
|
|
36
37
|
exports.hookCommand = hookCommand;
|
|
37
38
|
const fs = __importStar(require("fs"));
|
|
38
39
|
const os = __importStar(require("os"));
|
|
@@ -122,6 +123,12 @@ function normalizeClaudePayload(payload) {
|
|
|
122
123
|
const hookEventName = str(payload.hook_event_name);
|
|
123
124
|
if (!hookEventName)
|
|
124
125
|
return null;
|
|
126
|
+
// Cursor now also includes `hook_event_name`, using lower-camel names such
|
|
127
|
+
// as beforeSubmitPrompt/beforeShellExecution. Treating presence alone as a
|
|
128
|
+
// Claude discriminator turned every Cursor event into "unknown" and allowed
|
|
129
|
+
// it. Claude-family lifecycle names are PascalCase.
|
|
130
|
+
if (/^[a-z]/.test(hookEventName))
|
|
131
|
+
return null;
|
|
125
132
|
if (hookEventName === 'UserPromptSubmit') {
|
|
126
133
|
return { event: 'prompt', payload };
|
|
127
134
|
}
|
package/dist/version.json
CHANGED