fullcourtdefense-cli 1.18.10 → 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/selfUpdate.js +12 -3
- 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/selfUpdate.js
CHANGED
|
@@ -170,7 +170,11 @@ function startMsiSelfUpdate(targetVersion, log) {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
let updateInFlightSince = 0;
|
|
173
|
-
|
|
173
|
+
let updateInFlightTarget;
|
|
174
|
+
// A normal MSI finishes in ~5 minutes. Ten minutes avoids duplicate kicks
|
|
175
|
+
// during a healthy install without stranding a machine for an hour after a
|
|
176
|
+
// failed/stalled task.
|
|
177
|
+
const UPDATE_RETRY_COOLDOWN_MS = 10 * 60_000;
|
|
174
178
|
/**
|
|
175
179
|
* Upgrade this machine to targetVersion if it is newer than currentVersion.
|
|
176
180
|
* Cheap no-op when already current, when a kick is still pending, or when the
|
|
@@ -184,9 +188,14 @@ function maybeSelfUpdate(input) {
|
|
|
184
188
|
return undefined;
|
|
185
189
|
if (compareCliVersions(input.targetVersion, input.currentVersion) <= 0)
|
|
186
190
|
return undefined;
|
|
187
|
-
|
|
191
|
+
// A NEW target always gets an immediate attempt. The old global cooldown
|
|
192
|
+
// incorrectly suppressed 1.18.10 after a failed 1.18.9 task.
|
|
193
|
+
if (!input.force
|
|
194
|
+
&& input.targetVersion === updateInFlightTarget
|
|
195
|
+
&& Date.now() - updateInFlightSince < UPDATE_RETRY_COOLDOWN_MS)
|
|
188
196
|
return undefined;
|
|
189
197
|
updateInFlightSince = Date.now();
|
|
198
|
+
updateInFlightTarget = input.targetVersion;
|
|
190
199
|
log(`Self-update: CLI ${input.currentVersion || 'unknown'} -> ${input.targetVersion} (org auto-update).`);
|
|
191
200
|
const kind = detectInstallKind();
|
|
192
201
|
const result = kind === 'msi'
|
|
@@ -195,7 +204,7 @@ function maybeSelfUpdate(input) {
|
|
|
195
204
|
if (!result.started) {
|
|
196
205
|
// Allow another attempt on the next tick after a shorter cooldown when we
|
|
197
206
|
// never managed to start anything.
|
|
198
|
-
updateInFlightSince = Date.now() - UPDATE_RETRY_COOLDOWN_MS +
|
|
207
|
+
updateInFlightSince = Date.now() - UPDATE_RETRY_COOLDOWN_MS + 60_000;
|
|
199
208
|
}
|
|
200
209
|
return result;
|
|
201
210
|
}
|
package/dist/version.json
CHANGED