@wrongstack/tools 0.306.4 → 0.307.1

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.
Files changed (73) hide show
  1. package/dist/audit.js +14 -8
  2. package/dist/auto-proceed-loop-guard.js +8 -2
  3. package/dist/bash.js +57 -22
  4. package/dist/builtin.d.ts +6 -6
  5. package/dist/builtin.js +11469 -9304
  6. package/dist/clarify.d.ts +32 -0
  7. package/dist/codebase-index/ast-invariant-engine.d.ts +102 -0
  8. package/dist/codebase-index/ast-symbol-mutator.d.ts +28 -0
  9. package/dist/codebase-index/background-indexer.d.ts +9 -0
  10. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +31 -0
  11. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +42 -0
  12. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +23 -0
  13. package/dist/codebase-index/codebase-repo-map-tool.d.ts +22 -0
  14. package/dist/codebase-index/codebase-skeleton-tool.d.ts +36 -0
  15. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +30 -0
  16. package/dist/codebase-index/index.d.ts +11 -1
  17. package/dist/codebase-index/index.js +4239 -1492
  18. package/dist/codebase-index/project-server-client-state.d.ts +79 -0
  19. package/dist/codebase-index/project-server-client.d.ts +3 -71
  20. package/dist/codebase-index/project-server-protocol.d.ts +1 -0
  21. package/dist/codebase-index/project-server.js +819 -933
  22. package/dist/codebase-index/repo-map.d.ts +20 -0
  23. package/dist/codebase-index/skeleton-extractor.d.ts +64 -0
  24. package/dist/codebase-index/tree-sitter-parser.d.ts +11 -0
  25. package/dist/codebase-index/worker.js +790 -914
  26. package/dist/codebase-index/writer-graph-helpers.d.ts +1 -1
  27. package/dist/codebase-index/writer-helpers.d.ts +12 -0
  28. package/dist/codebase-index/writer-mutations.d.ts +26 -0
  29. package/dist/codebase-index/writer-refs.d.ts +50 -0
  30. package/dist/codebase-index/writer-search.d.ts +30 -0
  31. package/dist/codebase-index/writer.d.ts +2 -320
  32. package/dist/edit.js +8602 -349
  33. package/dist/exec.js +73 -20
  34. package/dist/fetch.js +11 -9
  35. package/dist/format.js +14 -8
  36. package/dist/glob.js +5 -1
  37. package/dist/grep.js +19 -8
  38. package/dist/index.d.ts +3 -1
  39. package/dist/index.js +6178 -4037
  40. package/dist/install.js +14 -8
  41. package/dist/json.js +88 -15
  42. package/dist/kanban-board-actions.d.ts +4 -0
  43. package/dist/kanban-lifecycle-actions.d.ts +4 -0
  44. package/dist/kanban-serializer.d.ts +21 -0
  45. package/dist/kanban.js +985 -1034
  46. package/dist/languages/index.js +14 -8
  47. package/dist/lint.js +14 -8
  48. package/dist/logs.js +13 -3
  49. package/dist/next-steps.d.ts +8 -0
  50. package/dist/next-steps.js +18 -0
  51. package/dist/outdated.js +14 -8
  52. package/dist/pack.js +11461 -9304
  53. package/dist/patch.js +8345 -78
  54. package/dist/plan.js +1231 -1281
  55. package/dist/process-registry.js +14 -8
  56. package/dist/ps-slash.js +65 -30
  57. package/dist/read.js +822 -937
  58. package/dist/replace.js +8494 -224
  59. package/dist/search.js +21 -15
  60. package/dist/security-ast-scan-tool.d.ts +43 -0
  61. package/dist/session-kanban-graph.d.ts +9 -0
  62. package/dist/session-kanban-sync.d.ts +31 -0
  63. package/dist/session-kanban.d.ts +5 -141
  64. package/dist/session-kanban.js +367 -360
  65. package/dist/task.js +1157 -1207
  66. package/dist/test.js +14 -8
  67. package/dist/todo.js +2187 -2237
  68. package/dist/tool-diff.js +6 -1
  69. package/dist/tool-summary.js +4 -2
  70. package/dist/tool-tier.js +11469 -9304
  71. package/dist/typecheck.js +14 -8
  72. package/dist/write.js +8425 -160
  73. package/package.json +7 -7
package/dist/install.js CHANGED
@@ -429,13 +429,16 @@ function killWin32Tree(pid, opts = {}) {
429
429
  };
430
430
  child.on("error", settle);
431
431
  child.on("close", settle);
432
- timeout = setTimeout(() => {
433
- try {
434
- child.kill();
435
- } catch {
436
- }
437
- settle();
438
- }, Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS));
432
+ timeout = setTimeout(
433
+ () => {
434
+ try {
435
+ child.kill();
436
+ } catch {
437
+ }
438
+ settle();
439
+ },
440
+ Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
441
+ );
439
442
  timeout.unref?.();
440
443
  child.unref();
441
444
  return true;
@@ -609,7 +612,10 @@ var ProcessRegistryImpl = class {
609
612
  getBreakerCountdown() {
610
613
  if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
611
614
  const elapsed = Date.now() - this.autoKillArmedAt;
612
- return { remainingMs: Math.max(0, this.autoKillResetMs - elapsed), totalMs: this.autoKillResetMs };
615
+ return {
616
+ remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
617
+ totalMs: this.autoKillResetMs
618
+ };
613
619
  }
614
620
  /**
615
621
  * Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
package/dist/json.js CHANGED
@@ -227,7 +227,10 @@ var jsonTool = {
227
227
  description: "Operation (default: parse). parse=read/pretty-print, query=JMESPath, validate=schema, transform=chained queries, merge=deep merge."
228
228
  },
229
229
  file: { type: "string", description: "Path to JSON/JSON5/YAML file (parse/query/validate)" },
230
- data: { type: "string", description: "JSON/JSON5/YAML string (parse/query/validate, alternative to file)" },
230
+ data: {
231
+ type: "string",
232
+ description: "JSON/JSON5/YAML string (parse/query/validate, alternative to file)"
233
+ },
231
234
  format: {
232
235
  type: "string",
233
236
  enum: ["json", "json5", "yaml"],
@@ -294,7 +297,13 @@ async function executeParse(input, ctx) {
294
297
  } else if (input.data) {
295
298
  raw = input.data;
296
299
  } else {
297
- return { data: null, formatted: "", type: "unknown", action: "parse", error: "Provide file or data" };
300
+ return {
301
+ data: null,
302
+ formatted: "",
303
+ type: "unknown",
304
+ action: "parse",
305
+ error: "Provide file or data"
306
+ };
298
307
  }
299
308
  try {
300
309
  parsed = JSON.parse(raw);
@@ -340,7 +349,13 @@ async function executeParse(input, ctx) {
340
349
  }
341
350
  async function executeQuery(input, ctx) {
342
351
  if (!input.query) {
343
- return { data: null, formatted: "", type: "unknown", action: "query", error: "query is required for action: query" };
352
+ return {
353
+ data: null,
354
+ formatted: "",
355
+ type: "unknown",
356
+ action: "query",
357
+ error: "query is required for action: query"
358
+ };
344
359
  }
345
360
  let parsed;
346
361
  if (input.file) {
@@ -360,10 +375,22 @@ async function executeQuery(input, ctx) {
360
375
  try {
361
376
  parsed = JSON.parse(input.data);
362
377
  } catch {
363
- return { data: null, formatted: "", type: "unknown", action: "query", error: "Could not parse data string" };
378
+ return {
379
+ data: null,
380
+ formatted: "",
381
+ type: "unknown",
382
+ action: "query",
383
+ error: "Could not parse data string"
384
+ };
364
385
  }
365
386
  } else {
366
- return { data: null, formatted: "", type: "unknown", action: "query", error: "Provide file or data" };
387
+ return {
388
+ data: null,
389
+ formatted: "",
390
+ type: "unknown",
391
+ action: "query",
392
+ error: "Provide file or data"
393
+ };
367
394
  }
368
395
  try {
369
396
  const result = jmespathSearch(parsed, input.query);
@@ -388,7 +415,13 @@ async function executeQuery(input, ctx) {
388
415
  }
389
416
  async function executeValidate(input, ctx) {
390
417
  if (!input.schema) {
391
- return { data: null, formatted: "", type: "unknown", action: "validate", error: "schema is required for action: validate" };
418
+ return {
419
+ data: null,
420
+ formatted: "",
421
+ type: "unknown",
422
+ action: "validate",
423
+ error: "schema is required for action: validate"
424
+ };
392
425
  }
393
426
  let parsed;
394
427
  if (input.file) {
@@ -408,10 +441,22 @@ async function executeValidate(input, ctx) {
408
441
  try {
409
442
  parsed = JSON.parse(input.data);
410
443
  } catch {
411
- return { data: null, formatted: "", type: "unknown", action: "validate", error: "Could not parse data string" };
444
+ return {
445
+ data: null,
446
+ formatted: "",
447
+ type: "unknown",
448
+ action: "validate",
449
+ error: "Could not parse data string"
450
+ };
412
451
  }
413
452
  } else {
414
- return { data: null, formatted: "", type: "unknown", action: "validate", error: "Provide file or data" };
453
+ return {
454
+ data: null,
455
+ formatted: "",
456
+ type: "unknown",
457
+ action: "validate",
458
+ error: "Provide file or data"
459
+ };
415
460
  }
416
461
  try {
417
462
  const { valid, errors } = validateJsonSchema(parsed, input.schema);
@@ -436,7 +481,13 @@ async function executeValidate(input, ctx) {
436
481
  }
437
482
  async function executeTransform(input, ctx) {
438
483
  if (!input.transforms || input.transforms.length === 0) {
439
- return { data: null, formatted: "", type: "unknown", action: "transform", error: "transforms array is required for action: transform" };
484
+ return {
485
+ data: null,
486
+ formatted: "",
487
+ type: "unknown",
488
+ action: "transform",
489
+ error: "transforms array is required for action: transform"
490
+ };
440
491
  }
441
492
  let parsed;
442
493
  if (input.file) {
@@ -456,10 +507,22 @@ async function executeTransform(input, ctx) {
456
507
  try {
457
508
  parsed = JSON.parse(input.data);
458
509
  } catch {
459
- return { data: null, formatted: "", type: "unknown", action: "transform", error: "Could not parse data string" };
510
+ return {
511
+ data: null,
512
+ formatted: "",
513
+ type: "unknown",
514
+ action: "transform",
515
+ error: "Could not parse data string"
516
+ };
460
517
  }
461
518
  } else {
462
- return { data: null, formatted: "", type: "unknown", action: "transform", error: "Provide file or data" };
519
+ return {
520
+ data: null,
521
+ formatted: "",
522
+ type: "unknown",
523
+ action: "transform",
524
+ error: "Provide file or data"
525
+ };
463
526
  }
464
527
  try {
465
528
  let current = parsed;
@@ -490,7 +553,13 @@ async function executeTransform(input, ctx) {
490
553
  }
491
554
  async function executeMerge(input) {
492
555
  if (input.base === void 0 || input.patch === void 0) {
493
- return { data: null, formatted: "", type: "unknown", action: "merge", error: "base and patch are required for action: merge" };
556
+ return {
557
+ data: null,
558
+ formatted: "",
559
+ type: "unknown",
560
+ action: "merge",
561
+ error: "base and patch are required for action: merge"
562
+ };
494
563
  }
495
564
  const conflictResolution = input.conflictResolution ?? "prefer-patch";
496
565
  try {
@@ -549,7 +618,9 @@ function jmespathSearch(data, query) {
549
618
  if (rest === void 0) return arr;
550
619
  return arr.map((item) => jmespathSearch(item, rest));
551
620
  }
552
- const filterMatch = query.match(/^\[\\?([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/);
621
+ const filterMatch = query.match(
622
+ /^\[\\?([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/
623
+ );
553
624
  if (filterMatch) {
554
625
  const field = filterMatch[1];
555
626
  const op = filterMatch[2];
@@ -591,10 +662,12 @@ function jmespathSearch(data, query) {
591
662
  if (typeof data === "object" && data !== null) return Object.keys(data).length;
592
663
  return 0;
593
664
  case "keys":
594
- if (typeof data === "object" && data !== null && !Array.isArray(data)) return Object.keys(data);
665
+ if (typeof data === "object" && data !== null && !Array.isArray(data))
666
+ return Object.keys(data);
595
667
  return [];
596
668
  case "values":
597
- if (typeof data === "object" && data !== null && !Array.isArray(data)) return Object.values(data);
669
+ if (typeof data === "object" && data !== null && !Array.isArray(data))
670
+ return Object.values(data);
598
671
  return [];
599
672
  case "type":
600
673
  if (data === null) return "null";
@@ -0,0 +1,4 @@
1
+ import type { Context } from '@wrongstack/core/agent';
2
+ import type { KanbanToolInput, KanbanToolOutput } from './kanban-tool-types.js';
3
+ export declare function handleKanbanBoardAction(projectRoot: string, input: KanbanToolInput, ctx: Context): Promise<KanbanToolOutput | undefined>;
4
+ //# sourceMappingURL=kanban-board-actions.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { Context } from '@wrongstack/core/agent';
2
+ import type { KanbanToolInput, KanbanToolOutput } from './kanban-tool-types.js';
3
+ export declare function handleKanbanLifecycleAction(projectRoot: string, input: KanbanToolInput, ctx: Context): Promise<KanbanToolOutput | undefined>;
4
+ //# sourceMappingURL=kanban-lifecycle-actions.d.ts.map
@@ -0,0 +1,21 @@
1
+ import type { KanbanToolOutput } from './kanban-tool-types.js';
2
+ /**
3
+ * How many serialized bytes a `board` may occupy in the transcript before a
4
+ * mutation result swaps it for a compact summary. Read actions whose purpose
5
+ * IS the board (`get_board`, exports) always keep the full payload.
6
+ */
7
+ export declare const KANBAN_BOARD_TRANSCRIPT_BYTE_CAP = 16384;
8
+ /** Actions whose whole point is returning the full board — never trimmed. */
9
+ export declare const KANBAN_FULL_BOARD_ACTIONS: Set<string>;
10
+ /**
11
+ * Transcript serializer for kanban results. Every mutation returns the full
12
+ * board so programmatic consumers (todo mirror, gates, tests) can chain off it,
13
+ * but replaying that board into the LLM transcript on EVERY add_note /
14
+ * transition_task turns a busy board into thousands of repeated tokens.
15
+ * When the serialized board exceeds the cap and the action is not a
16
+ * board-reading one, the transcript payload carries a compact summary
17
+ * ({column → task count}, totalTasks) plus the affected `task` and `message`.
18
+ * `execute()`'s return shape is unchanged — this only affects the transcript.
19
+ */
20
+ export declare function serializeKanbanOutput(output: KanbanToolOutput, input: unknown): string;
21
+ //# sourceMappingURL=kanban-serializer.d.ts.map