@threadbase-sh/scanner 0.24.6 → 0.24.8

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 CHANGED
@@ -377,6 +377,31 @@ npm run build # build ESM + CJS + types
377
377
  npm run lint # type check
378
378
  ```
379
379
 
380
+ ### Capturing live Copilot events
381
+
382
+ The Copilot parser was written against a hand-sanitized fixture.
383
+ `scripts/capture-copilot-events.mjs` turns a real session into a safe fixture and reports the shapes the parser still has to confirm.
384
+
385
+ 1. Start one Copilot CLI session and, in it, do all of these:
386
+ - answer an `ask_user` question;
387
+ - approve a shell command;
388
+ - deny a shell command and type feedback;
389
+ - cancel a prompt with Esc, if the CLI allows it.
390
+ 2. Run the script on that session's `events.jsonl` (under the Copilot home's `session-state/<session id>/`; a session directory works too).
391
+ The script never scans for sessions itself, makes no network call, and writes only under `__fixtures__/copilot/live/`.
392
+ ```bash
393
+ node scripts/capture-copilot-events.mjs <path to events.jsonl> --out __fixtures__/copilot/live/<name>.jsonl
394
+ ```
395
+ 3. Read the `REVIEW BEFORE COMMIT` notice it prints, then skim the output file.
396
+ Ids, home paths, usernames, hostnames, emails and token-shaped strings are redacted; free text you typed is kept as is.
397
+ 4. Print the shape report:
398
+ ```bash
399
+ node scripts/capture-copilot-events.mjs __fixtures__/copilot/live/<name>.jsonl --report
400
+ ```
401
+ 5. Paste the report output, not the raw file, back to the maintainer.
402
+
403
+ `npm test` runs every `*.jsonl` in that directory through the real parser (`__tests__/copilot-live-fixtures.test.ts`) and is skipped while there are none.
404
+
380
405
  ## Contributing
381
406
 
382
407
  Small bugfixes and parser improvements are welcome. For design changes, please open an issue first to discuss the shape before opening a PR.
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import pino2 from "pino";
6
6
 
7
7
  // package.json
8
- var version = "0.24.6";
8
+ var version = "0.24.8";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -5362,9 +5362,17 @@ var ConversationScanner = class {
5362
5362
  try {
5363
5363
  const fd = openSync3(filePath, "r");
5364
5364
  try {
5365
- const buf = Buffer.alloc(8192);
5366
- const n = readSync3(fd, buf, 0, buf.length, 0);
5367
- sample = buf.subarray(0, n).toString("utf8");
5365
+ const chunks = [];
5366
+ let pos = 0;
5367
+ while (pos < 1024 * 1024) {
5368
+ const chunk = Buffer.alloc(8192);
5369
+ const n = readSync3(fd, chunk, 0, chunk.length, pos);
5370
+ if (n === 0) break;
5371
+ chunks.push(chunk.subarray(0, n));
5372
+ pos += n;
5373
+ if (chunk.subarray(0, n).includes(10)) break;
5374
+ }
5375
+ sample = Buffer.concat(chunks).toString("utf8");
5368
5376
  } finally {
5369
5377
  closeSync3(fd);
5370
5378
  }