fullcourtdefense-cli 1.1.3 → 1.1.5

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.
@@ -224,23 +224,33 @@ async function hookCommand(args, config) {
224
224
  const apiUrl = (args.apiUrl || process.env.FULLCOURTDEFENSE_API_URL || config.apiUrl || home.apiUrl || DEFAULT_API_URL)
225
225
  .replace(/\/$/, '');
226
226
  let raw = '';
227
+ let stdinErr = '';
228
+ const isTTY = !!process.stdin.isTTY;
227
229
  try {
228
230
  raw = await readStdin();
229
231
  }
230
- catch { /* ignore */ }
232
+ catch (e) {
233
+ stdinErr = e instanceof Error ? e.message : String(e);
234
+ }
235
+ // Windows/Cursor prepends a UTF-8 BOM (\uFEFF) to the piped stdin JSON, which
236
+ // makes JSON.parse throw "Unexpected token". Strip BOM + surrounding whitespace.
237
+ const cleaned = raw.replace(/^\uFEFF/, '').replace(/^[\s\uFEFF\xA0]+/, '').trim();
231
238
  let payload = {};
232
- if (raw.trim()) {
239
+ let parseErr = '';
240
+ if (cleaned) {
233
241
  try {
234
- payload = JSON.parse(raw);
242
+ payload = JSON.parse(cleaned);
235
243
  }
236
- catch {
244
+ catch (e) {
245
+ parseErr = e instanceof Error ? e.message : String(e);
237
246
  payload = {};
238
247
  }
239
248
  }
240
249
  const event = inferEvent(args.event, payload);
241
250
  const text = extractText(event, payload).trim();
242
251
  dbg({ phase: 'invoke', event, argEvent: args.event, pid: process.pid,
243
- payloadKeys: Object.keys(payload), textPreview: text.slice(0, 80) });
252
+ isTTY, rawLen: raw.length, rawPreview: raw.slice(0, 300), stdinErr, parseErr,
253
+ argv: process.argv.slice(2), payloadKeys: Object.keys(payload), textPreview: text.slice(0, 80) });
244
254
  // Emit the verdict in the shape Cursor expects for THIS event, then exit.
245
255
  // beforeSubmitPrompt blocks via { continue: false }; the execution hooks
246
256
  // (shell/mcp/read) block via { permission: "deny" }. Exit 2 reinforces it.
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ const configure_1 = require("./commands/configure");
10
10
  const discover_1 = require("./commands/discover");
11
11
  const hook_1 = require("./commands/hook");
12
12
  const installCursorHook_1 = require("./commands/installCursorHook");
13
- const VERSION = '1.1.3';
13
+ const VERSION = '1.1.5';
14
14
  function parseArgs(argv) {
15
15
  const flags = {};
16
16
  let command = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullcourtdefense-cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Full Court Defense CLI — security scanning for AI agents from your terminal",
5
5
  "main": "dist/index.js",
6
6
  "bin": {