@wrongstack/tools 0.298.3 → 0.300.0

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 (42) hide show
  1. package/dist/audit.js +6 -2
  2. package/dist/bash.js +20 -2
  3. package/dist/builtin.js +1901 -327
  4. package/dist/codebase-index/background-indexer.d.ts +6 -1
  5. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +34 -0
  6. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +34 -0
  7. package/dist/codebase-index/import-extractor.d.ts +39 -0
  8. package/dist/codebase-index/index-service.d.ts +24 -2
  9. package/dist/codebase-index/index.d.ts +4 -2
  10. package/dist/codebase-index/index.js +1779 -256
  11. package/dist/codebase-index/languages.d.ts +24 -0
  12. package/dist/codebase-index/module-resolver.d.ts +78 -0
  13. package/dist/codebase-index/module-roots.d.ts +81 -0
  14. package/dist/codebase-index/parser-output.d.ts +29 -0
  15. package/dist/codebase-index/project-server.js +1556 -237
  16. package/dist/codebase-index/rs-parser.d.ts +22 -0
  17. package/dist/codebase-index/schema.d.ts +47 -1
  18. package/dist/codebase-index/worker-protocol.d.ts +14 -0
  19. package/dist/codebase-index/worker.js +1545 -238
  20. package/dist/codebase-index/writer-graph-helpers.d.ts +17 -5
  21. package/dist/codebase-index/writer-graph-reader.d.ts +24 -1
  22. package/dist/codebase-index/writer-ref-mapper.d.ts +3 -0
  23. package/dist/codebase-index/writer-schema.d.ts +15 -3
  24. package/dist/codebase-index/writer.d.ts +97 -4
  25. package/dist/exec.js +39 -2
  26. package/dist/format.js +6 -2
  27. package/dist/index.js +1901 -327
  28. package/dist/install.js +6 -2
  29. package/dist/json.js +51 -2
  30. package/dist/languages/index.js +6 -2
  31. package/dist/lint.js +6 -2
  32. package/dist/outdated.js +6 -2
  33. package/dist/pack.js +1899 -327
  34. package/dist/process-registry.d.ts +6 -0
  35. package/dist/process-registry.js +6 -2
  36. package/dist/ps-slash.js +10 -2
  37. package/dist/read.js +1551 -244
  38. package/dist/test.js +6 -2
  39. package/dist/tool-tier.js +1901 -327
  40. package/dist/typecheck.js +6 -2
  41. package/package.json +3 -3
  42. package/dist/codebase-index/refs-extractor.d.ts +0 -11
@@ -37,6 +37,12 @@ interface KillOpts {
37
37
  graceMs?: number | undefined;
38
38
  /** Leave explicitly backgrounded jobs alive. Default false. */
39
39
  preserveBackground?: boolean | undefined;
40
+ /**
41
+ * Also kill processes marked `protected` (browser open, etc.).
42
+ * Default false. Host-process shutdown should pass true so protected
43
+ * children cannot strand the parent event loop (issue #322).
44
+ */
45
+ includeProtected?: boolean | undefined;
40
46
  }
41
47
  /**
42
48
  * Snapshot of the armed auto kill/reset countdown, or null when nothing is
@@ -503,7 +503,7 @@ var ProcessRegistryImpl = class {
503
503
  const p = this.processes.get(pid);
504
504
  if (!p) return false;
505
505
  if (p.killed) return true;
506
- if (p.protected) return false;
506
+ if (p.protected && opts.includeProtected !== true) return false;
507
507
  if (opts.preserveBackground && p.background) return false;
508
508
  const { force = false, graceMs = DEFAULT_GRACE_MS } = opts;
509
509
  const isWin = os.platform() === "win32";
@@ -554,9 +554,13 @@ var ProcessRegistryImpl = class {
554
554
  killAll(opts = {}) {
555
555
  const pids = Array.from(this.processes.keys());
556
556
  const killed = [];
557
+ const includeProtected = opts.includeProtected === true;
557
558
  for (const pid of pids) {
558
559
  const p = this.processes.get(pid);
559
- if (p && !p.protected && this.kill(pid, opts)) killed.push(pid);
560
+ if (!p) continue;
561
+ if (p.protected && !includeProtected) continue;
562
+ if (opts.preserveBackground && p.background) continue;
563
+ if (this.kill(pid, opts)) killed.push(pid);
560
564
  }
561
565
  return killed;
562
566
  }
package/dist/ps-slash.js CHANGED
@@ -473,7 +473,7 @@ var ProcessRegistryImpl = class {
473
473
  const p = this.processes.get(pid);
474
474
  if (!p) return false;
475
475
  if (p.killed) return true;
476
- if (p.protected) return false;
476
+ if (p.protected && opts.includeProtected !== true) return false;
477
477
  if (opts.preserveBackground && p.background) return false;
478
478
  const { force = false, graceMs = DEFAULT_GRACE_MS } = opts;
479
479
  const isWin = os.platform() === "win32";
@@ -524,9 +524,13 @@ var ProcessRegistryImpl = class {
524
524
  killAll(opts = {}) {
525
525
  const pids = Array.from(this.processes.keys());
526
526
  const killed = [];
527
+ const includeProtected = opts.includeProtected === true;
527
528
  for (const pid of pids) {
528
529
  const p = this.processes.get(pid);
529
- if (p && !p.protected && this.kill(pid, opts)) killed.push(pid);
530
+ if (!p) continue;
531
+ if (p.protected && !includeProtected) continue;
532
+ if (opts.preserveBackground && p.background) continue;
533
+ if (this.kill(pid, opts)) killed.push(pid);
530
534
  }
531
535
  return killed;
532
536
  }
@@ -626,6 +630,10 @@ async function acquireLock(lockfilePath, timeoutMs = 5e3) {
626
630
  const start = Date.now();
627
631
  const pidStr = String(process.pid);
628
632
  const hostStr = os2.hostname();
633
+ try {
634
+ await fs.mkdir(path.dirname(lockfilePath), { recursive: true });
635
+ } catch {
636
+ }
629
637
  while (Date.now() - start < timeoutMs) {
630
638
  try {
631
639
  await fs.writeFile(lockfilePath, `${pidStr}:${hostStr}:${Date.now()}`, { flag: "wx" });