@wrongstack/tools 0.306.4 → 0.307.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.
- package/dist/audit.js +14 -8
- package/dist/auto-proceed-loop-guard.js +8 -2
- package/dist/bash.js +57 -22
- package/dist/builtin.d.ts +6 -6
- package/dist/builtin.js +11302 -9305
- package/dist/clarify.d.ts +32 -0
- package/dist/codebase-index/ast-invariant-engine.d.ts +102 -0
- package/dist/codebase-index/ast-symbol-mutator.d.ts +28 -0
- package/dist/codebase-index/background-indexer.d.ts +9 -0
- package/dist/codebase-index/codebase-ast-replace-tool.d.ts +31 -0
- package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +40 -0
- package/dist/codebase-index/codebase-invariant-check-tool.d.ts +23 -0
- package/dist/codebase-index/codebase-repo-map-tool.d.ts +22 -0
- package/dist/codebase-index/codebase-skeleton-tool.d.ts +36 -0
- package/dist/codebase-index/codebase-targeted-test-tool.d.ts +30 -0
- package/dist/codebase-index/index.d.ts +11 -1
- package/dist/codebase-index/index.js +4141 -1479
- package/dist/codebase-index/project-server-client-state.d.ts +79 -0
- package/dist/codebase-index/project-server-client.d.ts +3 -71
- package/dist/codebase-index/project-server-protocol.d.ts +1 -0
- package/dist/codebase-index/project-server.js +751 -909
- package/dist/codebase-index/repo-map.d.ts +20 -0
- package/dist/codebase-index/skeleton-extractor.d.ts +64 -0
- package/dist/codebase-index/tree-sitter-parser.d.ts +11 -0
- package/dist/codebase-index/worker.js +723 -891
- package/dist/codebase-index/writer-mutations.d.ts +26 -0
- package/dist/codebase-index/writer-refs.d.ts +50 -0
- package/dist/codebase-index/writer-search.d.ts +30 -0
- package/dist/codebase-index/writer.d.ts +2 -320
- package/dist/edit.js +8558 -349
- package/dist/exec.js +73 -20
- package/dist/fetch.js +11 -9
- package/dist/format.js +14 -8
- package/dist/glob.js +5 -1
- package/dist/grep.js +19 -8
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11386 -9416
- package/dist/install.js +14 -8
- package/dist/json.js +88 -15
- package/dist/kanban-board-actions.d.ts +4 -0
- package/dist/kanban-lifecycle-actions.d.ts +4 -0
- package/dist/kanban-serializer.d.ts +21 -0
- package/dist/kanban.js +985 -1034
- package/dist/languages/index.js +14 -8
- package/dist/lint.js +14 -8
- package/dist/logs.js +13 -3
- package/dist/next-steps.d.ts +8 -0
- package/dist/next-steps.js +18 -0
- package/dist/outdated.js +14 -8
- package/dist/pack.js +11295 -9305
- package/dist/patch.js +8301 -78
- package/dist/plan.js +1231 -1281
- package/dist/process-registry.js +14 -8
- package/dist/ps-slash.js +65 -30
- package/dist/read.js +751 -910
- package/dist/replace.js +8450 -224
- package/dist/search.js +21 -15
- package/dist/security-ast-scan-tool.d.ts +43 -0
- package/dist/session-kanban-graph.d.ts +9 -0
- package/dist/session-kanban-sync.d.ts +31 -0
- package/dist/session-kanban.d.ts +5 -141
- package/dist/session-kanban.js +367 -360
- package/dist/task.js +1157 -1207
- package/dist/test.js +14 -8
- package/dist/todo.js +2187 -2237
- package/dist/tool-diff.js +6 -1
- package/dist/tool-summary.js +4 -2
- package/dist/tool-tier.js +11302 -9305
- package/dist/typecheck.js +14 -8
- package/dist/write.js +8374 -153
- package/package.json +7 -7
package/dist/process-registry.js
CHANGED
|
@@ -259,13 +259,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
259
259
|
};
|
|
260
260
|
child.on("error", settle);
|
|
261
261
|
child.on("close", settle);
|
|
262
|
-
timeout = setTimeout(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
timeout = setTimeout(
|
|
263
|
+
() => {
|
|
264
|
+
try {
|
|
265
|
+
child.kill();
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
settle();
|
|
269
|
+
},
|
|
270
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
271
|
+
);
|
|
269
272
|
timeout.unref?.();
|
|
270
273
|
child.unref();
|
|
271
274
|
return true;
|
|
@@ -439,7 +442,10 @@ var ProcessRegistryImpl = class {
|
|
|
439
442
|
getBreakerCountdown() {
|
|
440
443
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
441
444
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
442
|
-
return {
|
|
445
|
+
return {
|
|
446
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
447
|
+
totalMs: this.autoKillResetMs
|
|
448
|
+
};
|
|
443
449
|
}
|
|
444
450
|
/**
|
|
445
451
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
package/dist/ps-slash.js
CHANGED
|
@@ -225,13 +225,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
225
225
|
};
|
|
226
226
|
child.on("error", settle);
|
|
227
227
|
child.on("close", settle);
|
|
228
|
-
timeout = setTimeout(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
timeout = setTimeout(
|
|
229
|
+
() => {
|
|
230
|
+
try {
|
|
231
|
+
child.kill();
|
|
232
|
+
} catch {
|
|
233
|
+
}
|
|
234
|
+
settle();
|
|
235
|
+
},
|
|
236
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
237
|
+
);
|
|
235
238
|
timeout.unref?.();
|
|
236
239
|
child.unref();
|
|
237
240
|
return true;
|
|
@@ -405,7 +408,10 @@ var ProcessRegistryImpl = class {
|
|
|
405
408
|
getBreakerCountdown() {
|
|
406
409
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
407
410
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
408
|
-
return {
|
|
411
|
+
return {
|
|
412
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
413
|
+
totalMs: this.autoKillResetMs
|
|
414
|
+
};
|
|
409
415
|
}
|
|
410
416
|
/**
|
|
411
417
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -720,12 +726,16 @@ async function readRegistryFile(filePath) {
|
|
|
720
726
|
}
|
|
721
727
|
async function writeRegistryFile(filePath, data) {
|
|
722
728
|
const tmpPath = `${filePath}.tmp.${process.pid}`;
|
|
723
|
-
const content = JSON.stringify(
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
+
const content = JSON.stringify(
|
|
730
|
+
data,
|
|
731
|
+
(_k, v) => {
|
|
732
|
+
if (v instanceof Map) {
|
|
733
|
+
return Array.from(v.entries());
|
|
734
|
+
}
|
|
735
|
+
return v;
|
|
736
|
+
},
|
|
737
|
+
2
|
|
738
|
+
);
|
|
729
739
|
await fs.writeFile(tmpPath, content, "utf-8");
|
|
730
740
|
await fs.rename(tmpPath, filePath);
|
|
731
741
|
}
|
|
@@ -753,7 +763,12 @@ var PersistentProcessRegistry = class {
|
|
|
753
763
|
this.lockPath = path.join(globalRoot, LOCKFILE);
|
|
754
764
|
this.baseRegistry = baseRegistry ?? getProcessRegistry();
|
|
755
765
|
this.ensureDirectory().catch((err) => {
|
|
756
|
-
emitStructuredLog(
|
|
766
|
+
emitStructuredLog(
|
|
767
|
+
"warn",
|
|
768
|
+
"process_registry.dir_create_failed",
|
|
769
|
+
"PersistentProcessRegistry: failed to create .wrongstack directory",
|
|
770
|
+
err
|
|
771
|
+
);
|
|
757
772
|
});
|
|
758
773
|
}
|
|
759
774
|
async ensureDirectory() {
|
|
@@ -944,7 +959,12 @@ var PersistentProcessRegistry = class {
|
|
|
944
959
|
data.lastCleanup = now2;
|
|
945
960
|
await writeRegistryFile(this.registryPath, data);
|
|
946
961
|
} catch (err) {
|
|
947
|
-
emitStructuredLog(
|
|
962
|
+
emitStructuredLog(
|
|
963
|
+
"warn",
|
|
964
|
+
"process_registry.sync_failed",
|
|
965
|
+
"PersistentProcessRegistry: sync failed",
|
|
966
|
+
err
|
|
967
|
+
);
|
|
948
968
|
} finally {
|
|
949
969
|
await release();
|
|
950
970
|
}
|
|
@@ -983,7 +1003,12 @@ var PersistentProcessRegistry = class {
|
|
|
983
1003
|
await writeRegistryFile(this.registryPath, data);
|
|
984
1004
|
}
|
|
985
1005
|
} catch (err) {
|
|
986
|
-
emitStructuredLog(
|
|
1006
|
+
emitStructuredLog(
|
|
1007
|
+
"warn",
|
|
1008
|
+
"process_registry.cleanup_failed",
|
|
1009
|
+
"PersistentProcessRegistry: cleanup failed",
|
|
1010
|
+
err
|
|
1011
|
+
);
|
|
987
1012
|
} finally {
|
|
988
1013
|
await release();
|
|
989
1014
|
}
|
|
@@ -1251,7 +1276,9 @@ async function formatGlobalStatus() {
|
|
|
1251
1276
|
lines.push(` Total processes: ${status.summary.totalProcesses}`);
|
|
1252
1277
|
lines.push(` Protected: ${status.summary.protectedCount}`);
|
|
1253
1278
|
lines.push(` Stale entries: ${status.summary.staleCount}`);
|
|
1254
|
-
lines.push(
|
|
1279
|
+
lines.push(
|
|
1280
|
+
` Instances: ${status.summary.instanceCount} (${status.summary.activeInstanceCount} active)`
|
|
1281
|
+
);
|
|
1255
1282
|
lines.push("");
|
|
1256
1283
|
lines.push(`This instance (${status.localInstance.instanceId}):`);
|
|
1257
1284
|
lines.push(` Main PID: ${status.localInstance.mainPid}`);
|
|
@@ -1286,7 +1313,9 @@ async function formatInstanceList(options = {}) {
|
|
|
1286
1313
|
const count = await getInstanceCount();
|
|
1287
1314
|
const lines = [];
|
|
1288
1315
|
lines.push("=== WrongStack Instances ===");
|
|
1289
|
-
lines.push(
|
|
1316
|
+
lines.push(
|
|
1317
|
+
`Total: ${count.total} instances (${count.active} active, ${count.idle} idle, ${count.stale} stale)`
|
|
1318
|
+
);
|
|
1290
1319
|
lines.push("");
|
|
1291
1320
|
if (count.byHostname.size > 1) {
|
|
1292
1321
|
lines.push("By hostname:");
|
|
@@ -1300,15 +1329,17 @@ async function formatInstanceList(options = {}) {
|
|
|
1300
1329
|
return lines.join("\n");
|
|
1301
1330
|
}
|
|
1302
1331
|
lines.push("INSTANCES:");
|
|
1303
|
-
lines.push(
|
|
1304
|
-
"
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1332
|
+
lines.push(
|
|
1333
|
+
" " + [
|
|
1334
|
+
"STATUS".padEnd(7),
|
|
1335
|
+
"HOSTNAME".padEnd(16),
|
|
1336
|
+
"MAIN PID".padEnd(9),
|
|
1337
|
+
"PROCS".padEnd(6),
|
|
1338
|
+
"SESSIONS".padEnd(8),
|
|
1339
|
+
"UPTIME".padEnd(8),
|
|
1340
|
+
"LAST ACTIVITY"
|
|
1341
|
+
].join(" ")
|
|
1342
|
+
);
|
|
1312
1343
|
lines.push(" " + "-".repeat(80));
|
|
1313
1344
|
for (const inst of instances) {
|
|
1314
1345
|
const uptime = formatAge(Date.now() - inst.startedAt);
|
|
@@ -1391,10 +1422,14 @@ function createGlobalPsSlashCommand() {
|
|
|
1391
1422
|
if (!["active", "idle", "stale", "all"].includes(filterStatus ?? "")) {
|
|
1392
1423
|
return { message: "Usage: /ps status <active|idle|stale|all>" };
|
|
1393
1424
|
}
|
|
1394
|
-
const output = await formatInstanceList({
|
|
1425
|
+
const output = await formatInstanceList({
|
|
1426
|
+
status: filterStatus
|
|
1427
|
+
});
|
|
1395
1428
|
return { message: output };
|
|
1396
1429
|
}
|
|
1397
|
-
return {
|
|
1430
|
+
return {
|
|
1431
|
+
message: "Usage: /ps [list|summary|count|full|hostname <pattern>|status <state>]"
|
|
1432
|
+
};
|
|
1398
1433
|
} catch (err) {
|
|
1399
1434
|
const message = err instanceof Error ? err.message : String(err);
|
|
1400
1435
|
return { message: `Error getting process status: ${message}` };
|