@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/audit.js
CHANGED
|
@@ -422,13 +422,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
422
422
|
};
|
|
423
423
|
child.on("error", settle);
|
|
424
424
|
child.on("close", settle);
|
|
425
|
-
timeout = setTimeout(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
425
|
+
timeout = setTimeout(
|
|
426
|
+
() => {
|
|
427
|
+
try {
|
|
428
|
+
child.kill();
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
settle();
|
|
432
|
+
},
|
|
433
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
434
|
+
);
|
|
432
435
|
timeout.unref?.();
|
|
433
436
|
child.unref();
|
|
434
437
|
return true;
|
|
@@ -602,7 +605,10 @@ var ProcessRegistryImpl = class {
|
|
|
602
605
|
getBreakerCountdown() {
|
|
603
606
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
604
607
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
605
|
-
return {
|
|
608
|
+
return {
|
|
609
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
610
|
+
totalMs: this.autoKillResetMs
|
|
611
|
+
};
|
|
606
612
|
}
|
|
607
613
|
/**
|
|
608
614
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -54,7 +54,10 @@ var ADVANCE_PREAMBLES = [
|
|
|
54
54
|
];
|
|
55
55
|
function generateAdvancementPrompt(stalledTodo, nextTodo, attemptCount, todos) {
|
|
56
56
|
const idx = Math.max(0, Math.min(attemptCount - 1, ADVANCE_PREAMBLES.length - 1));
|
|
57
|
-
const preamble = ADVANCE_PREAMBLES[idx].replace(
|
|
57
|
+
const preamble = ADVANCE_PREAMBLES[idx].replace(
|
|
58
|
+
/\{attempts\}/g,
|
|
59
|
+
() => String(attemptCount)
|
|
60
|
+
).replace(/\{label\}/g, () => stalledTodo.content.slice(0, 72));
|
|
58
61
|
if (!nextTodo) {
|
|
59
62
|
return [
|
|
60
63
|
preamble,
|
|
@@ -76,7 +79,10 @@ function generateAdvancementPrompt(stalledTodo, nextTodo, attemptCount, todos) {
|
|
|
76
79
|
})
|
|
77
80
|
);
|
|
78
81
|
}
|
|
79
|
-
lines.push(
|
|
82
|
+
lines.push(
|
|
83
|
+
"",
|
|
84
|
+
"If this item is already done, mark it complete and move to the next open todo. Keep the board honest as you work."
|
|
85
|
+
);
|
|
80
86
|
return lines.join("\n");
|
|
81
87
|
}
|
|
82
88
|
function matchTodoIdFromPrompt(todos, prompt) {
|
package/dist/bash.js
CHANGED
|
@@ -453,13 +453,16 @@ function killWin32Tree(pid, opts = {}) {
|
|
|
453
453
|
};
|
|
454
454
|
child.on("error", settle);
|
|
455
455
|
child.on("close", settle);
|
|
456
|
-
timeout = setTimeout(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
456
|
+
timeout = setTimeout(
|
|
457
|
+
() => {
|
|
458
|
+
try {
|
|
459
|
+
child.kill();
|
|
460
|
+
} catch {
|
|
461
|
+
}
|
|
462
|
+
settle();
|
|
463
|
+
},
|
|
464
|
+
Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
|
|
465
|
+
);
|
|
463
466
|
timeout.unref?.();
|
|
464
467
|
child.unref();
|
|
465
468
|
return true;
|
|
@@ -633,7 +636,10 @@ var ProcessRegistryImpl = class {
|
|
|
633
636
|
getBreakerCountdown() {
|
|
634
637
|
if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
|
|
635
638
|
const elapsed = Date.now() - this.autoKillArmedAt;
|
|
636
|
-
return {
|
|
639
|
+
return {
|
|
640
|
+
remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
|
|
641
|
+
totalMs: this.autoKillResetMs
|
|
642
|
+
};
|
|
637
643
|
}
|
|
638
644
|
/**
|
|
639
645
|
* Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
|
|
@@ -955,12 +961,16 @@ async function readRegistryFile(filePath) {
|
|
|
955
961
|
}
|
|
956
962
|
async function writeRegistryFile(filePath, data) {
|
|
957
963
|
const tmpPath = `${filePath}.tmp.${process.pid}`;
|
|
958
|
-
const content = JSON.stringify(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
+
const content = JSON.stringify(
|
|
965
|
+
data,
|
|
966
|
+
(_k, v) => {
|
|
967
|
+
if (v instanceof Map) {
|
|
968
|
+
return Array.from(v.entries());
|
|
969
|
+
}
|
|
970
|
+
return v;
|
|
971
|
+
},
|
|
972
|
+
2
|
|
973
|
+
);
|
|
964
974
|
await fs.writeFile(tmpPath, content, "utf-8");
|
|
965
975
|
await fs.rename(tmpPath, filePath);
|
|
966
976
|
}
|
|
@@ -988,7 +998,12 @@ var PersistentProcessRegistry = class {
|
|
|
988
998
|
this.lockPath = path2.join(globalRoot, LOCKFILE);
|
|
989
999
|
this.baseRegistry = baseRegistry ?? getProcessRegistry();
|
|
990
1000
|
this.ensureDirectory().catch((err) => {
|
|
991
|
-
emitStructuredLog(
|
|
1001
|
+
emitStructuredLog(
|
|
1002
|
+
"warn",
|
|
1003
|
+
"process_registry.dir_create_failed",
|
|
1004
|
+
"PersistentProcessRegistry: failed to create .wrongstack directory",
|
|
1005
|
+
err
|
|
1006
|
+
);
|
|
992
1007
|
});
|
|
993
1008
|
}
|
|
994
1009
|
async ensureDirectory() {
|
|
@@ -1179,7 +1194,12 @@ var PersistentProcessRegistry = class {
|
|
|
1179
1194
|
data.lastCleanup = now;
|
|
1180
1195
|
await writeRegistryFile(this.registryPath, data);
|
|
1181
1196
|
} catch (err) {
|
|
1182
|
-
emitStructuredLog(
|
|
1197
|
+
emitStructuredLog(
|
|
1198
|
+
"warn",
|
|
1199
|
+
"process_registry.sync_failed",
|
|
1200
|
+
"PersistentProcessRegistry: sync failed",
|
|
1201
|
+
err
|
|
1202
|
+
);
|
|
1183
1203
|
} finally {
|
|
1184
1204
|
await release();
|
|
1185
1205
|
}
|
|
@@ -1218,7 +1238,12 @@ var PersistentProcessRegistry = class {
|
|
|
1218
1238
|
await writeRegistryFile(this.registryPath, data);
|
|
1219
1239
|
}
|
|
1220
1240
|
} catch (err) {
|
|
1221
|
-
emitStructuredLog(
|
|
1241
|
+
emitStructuredLog(
|
|
1242
|
+
"warn",
|
|
1243
|
+
"process_registry.cleanup_failed",
|
|
1244
|
+
"PersistentProcessRegistry: cleanup failed",
|
|
1245
|
+
err
|
|
1246
|
+
);
|
|
1222
1247
|
} finally {
|
|
1223
1248
|
await release();
|
|
1224
1249
|
}
|
|
@@ -1663,7 +1688,9 @@ function looksLikePowerShell(command) {
|
|
|
1663
1688
|
if (/&\s+\$/.test(trimmed)) return true;
|
|
1664
1689
|
if (/(^|\s)@\s*\(/.test(trimmed)) return true;
|
|
1665
1690
|
if (/(^|\s)@\{/.test(trimmed)) return true;
|
|
1666
|
-
if (/(?:^|[\s[({,;])(?:-eq|-ne|-lt|-gt|-le|-ge|-like|-notlike|-match|-notmatch|-contains|-notcontains|-in|-notin|-and|-or|-not|-band|-bor|-bxor|-replace|-isplit|-csplit|-osplit|-join|-is|-as|-f)(?:$|[\s\])},;])/i.test(
|
|
1691
|
+
if (/(?:^|[\s[({,;])(?:-eq|-ne|-lt|-gt|-le|-ge|-like|-notlike|-match|-notmatch|-contains|-notcontains|-in|-notin|-and|-or|-not|-band|-bor|-bxor|-replace|-isplit|-csplit|-osplit|-join|-is|-as|-f)(?:$|[\s\])},;])/i.test(
|
|
1692
|
+
trimmed
|
|
1693
|
+
)) {
|
|
1667
1694
|
return true;
|
|
1668
1695
|
}
|
|
1669
1696
|
if (PS_VERB_RE.test(trimmed)) return true;
|
|
@@ -1679,7 +1706,9 @@ function looksLikePowerShellExtended(command) {
|
|
|
1679
1706
|
if (/(?:^|\s)[-/](?:WhatIf|Confirm|ErrorAction)(?::[^\s]+|\s|=|$)/i.test(trimmed)) {
|
|
1680
1707
|
return true;
|
|
1681
1708
|
}
|
|
1682
|
-
if (/(?:^|[\s;&|])(Where-Object|ForEach-Object|Select-Object|Sort-Object|Group-Object|Measure-Object|Compare-Object|Tee-Object)(?:\s|$)/i.test(
|
|
1709
|
+
if (/(?:^|[\s;&|])(Where-Object|ForEach-Object|Select-Object|Sort-Object|Group-Object|Measure-Object|Compare-Object|Tee-Object)(?:\s|$)/i.test(
|
|
1710
|
+
trimmed
|
|
1711
|
+
)) {
|
|
1683
1712
|
return true;
|
|
1684
1713
|
}
|
|
1685
1714
|
if (/\bWrite-(?:Host|Output|Error|Warning|Verbose|Debug|Information)(?:\s|$)/i.test(trimmed)) {
|
|
@@ -1690,7 +1719,9 @@ function looksLikePowerShellExtended(command) {
|
|
|
1690
1719
|
return true;
|
|
1691
1720
|
}
|
|
1692
1721
|
if (/^\s*<#|#>\s*$/m.test(trimmed)) return true;
|
|
1693
|
-
if (/(?:^|\s)[-//](?:AsPlainText|PipelineVariable|pv|FilterHashtable|OutVariable|ov)(?:\s|=|$)/i.test(
|
|
1722
|
+
if (/(?:^|\s)[-//](?:AsPlainText|PipelineVariable|pv|FilterHashtable|OutVariable|ov)(?:\s|=|$)/i.test(
|
|
1723
|
+
trimmed
|
|
1724
|
+
)) {
|
|
1694
1725
|
return true;
|
|
1695
1726
|
}
|
|
1696
1727
|
return false;
|
|
@@ -1733,7 +1764,9 @@ function diagnoseBashism(command, shell) {
|
|
|
1733
1764
|
);
|
|
1734
1765
|
}
|
|
1735
1766
|
if (shell === "powershell" && /(&&|\|\|)/.test(command)) {
|
|
1736
|
-
add(
|
|
1767
|
+
add(
|
|
1768
|
+
"Windows PowerShell 5.1 has no `&&`/`||` \u2014 separate commands with `;` (check `$LASTEXITCODE`)"
|
|
1769
|
+
);
|
|
1737
1770
|
}
|
|
1738
1771
|
if (/\brm\s+-[A-Za-z]*[rf]/.test(command)) {
|
|
1739
1772
|
add(
|
|
@@ -1741,7 +1774,9 @@ function diagnoseBashism(command, shell) {
|
|
|
1741
1774
|
);
|
|
1742
1775
|
}
|
|
1743
1776
|
if (/\bwhich\s+\S/.test(command)) {
|
|
1744
|
-
add(
|
|
1777
|
+
add(
|
|
1778
|
+
isCmd ? "use `where <cmd>` instead of `which`" : "use `Get-Command <cmd>` instead of `which`"
|
|
1779
|
+
);
|
|
1745
1780
|
}
|
|
1746
1781
|
if (hints.length === 0) return void 0;
|
|
1747
1782
|
const label = isCmd ? "cmd.exe" : shell === "pwsh" ? "PowerShell 7" : "Windows PowerShell";
|
package/dist/builtin.d.ts
CHANGED
|
@@ -43,13 +43,13 @@ export declare const TIER1_TOOLS: Tool[];
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const TIER2_TOOLS: Tool[];
|
|
45
45
|
/**
|
|
46
|
-
* Tier 3 tool set — specialized
|
|
47
|
-
* Adds
|
|
48
|
-
*
|
|
46
|
+
* Tier 3 tool set — specialized, administrative, and exploratory tools.
|
|
47
|
+
* Adds 12 tools: outdated, logs, document, scaffold, dead-code-scan,
|
|
48
|
+
* tool-search, tool-use, batch-tool-use, tool-help, set-working-dir.
|
|
49
49
|
*
|
|
50
|
-
* These tools are
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* These tools are situational (e.g. documentation generation, scaffolding,
|
|
51
|
+
* log tailing, dependency audits). Omitting them in standard tier saves
|
|
52
|
+
* tokens while keeping all core capabilities available.
|
|
53
53
|
*/
|
|
54
54
|
export declare const TIER3_TOOLS: Tool[];
|
|
55
55
|
export declare const builtinTools: Tool[];
|