@wrongstack/tools 0.1.10 → 0.3.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.
- package/README.md +1 -1
- package/dist/audit.js +1 -0
- package/dist/audit.js.map +1 -1
- package/dist/bash.js +1 -0
- package/dist/bash.js.map +1 -1
- package/dist/batch-tool-use.js +2 -1
- package/dist/batch-tool-use.js.map +1 -1
- package/dist/builtin.js +161 -10
- package/dist/builtin.js.map +1 -1
- package/dist/diff.js +1 -0
- package/dist/diff.js.map +1 -1
- package/dist/document.js +1 -0
- package/dist/document.js.map +1 -1
- package/dist/edit.js +1 -0
- package/dist/edit.js.map +1 -1
- package/dist/exec.js +2 -1
- package/dist/exec.js.map +1 -1
- package/dist/fetch.js +1 -0
- package/dist/fetch.js.map +1 -1
- package/dist/format.js +1 -0
- package/dist/format.js.map +1 -1
- package/dist/git.js +1 -0
- package/dist/git.js.map +1 -1
- package/dist/glob.js +1 -0
- package/dist/glob.js.map +1 -1
- package/dist/grep.js +18 -1
- package/dist/grep.js.map +1 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +172 -11
- package/dist/index.js.map +1 -1
- package/dist/install.js +1 -0
- package/dist/install.js.map +1 -1
- package/dist/json.js +1 -0
- package/dist/json.js.map +1 -1
- package/dist/lint.js +1 -0
- package/dist/lint.js.map +1 -1
- package/dist/logs.js +1 -0
- package/dist/logs.js.map +1 -1
- package/dist/memory.js +2 -0
- package/dist/memory.js.map +1 -1
- package/dist/mode.js +1 -0
- package/dist/mode.js.map +1 -1
- package/dist/outdated.js +1 -0
- package/dist/outdated.js.map +1 -1
- package/dist/pack.d.ts +9 -0
- package/dist/pack.js +4216 -0
- package/dist/pack.js.map +1 -0
- package/dist/patch.js +1 -0
- package/dist/patch.js.map +1 -1
- package/dist/read.js +1 -0
- package/dist/read.js.map +1 -1
- package/dist/replace.js +12 -5
- package/dist/replace.js.map +1 -1
- package/dist/scaffold.js +1 -0
- package/dist/scaffold.js.map +1 -1
- package/dist/search.js +1 -0
- package/dist/search.js.map +1 -1
- package/dist/test.js +1 -0
- package/dist/test.js.map +1 -1
- package/dist/todo.js +1 -0
- package/dist/todo.js.map +1 -1
- package/dist/tool-help.js +1 -0
- package/dist/tool-help.js.map +1 -1
- package/dist/tool-search.js +1 -0
- package/dist/tool-search.js.map +1 -1
- package/dist/tool-use.js +2 -1
- package/dist/tool-use.js.map +1 -1
- package/dist/tree.js +1 -0
- package/dist/tree.js.map +1 -1
- package/dist/typecheck.js +1 -0
- package/dist/typecheck.js.map +1 -1
- package/dist/write.js +1 -0
- package/dist/write.js.map +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs4 from 'fs/promises';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { dirname } from 'path';
|
|
4
|
-
import { atomicWrite, unifiedDiff, detectNewlineStyle, normalizeToLf, toStyle, compileGlob, buildChildEnv, stripAnsi } from '@wrongstack/core';
|
|
4
|
+
import { atomicWrite, unifiedDiff, detectNewlineStyle, normalizeToLf, toStyle, compileGlob, buildChildEnv, stripAnsi, loadPlan, emptyPlan, clearPlan, savePlan, removePlanItem, setPlanItemStatus, addPlanItem, formatPlan } from '@wrongstack/core';
|
|
5
5
|
import { spawn } from 'child_process';
|
|
6
6
|
import * as os from 'os';
|
|
7
7
|
import * as dns from 'dns/promises';
|
|
@@ -48,6 +48,7 @@ function isBinaryBuffer(buf) {
|
|
|
48
48
|
var MAX_BYTES = 5 * 1024 * 1024;
|
|
49
49
|
var readTool = {
|
|
50
50
|
name: "read",
|
|
51
|
+
category: "Filesystem",
|
|
51
52
|
description: "Read the contents of a file. Lines are 1-indexed and prefixed with line numbers.",
|
|
52
53
|
usageHint: "Read a file before editing it. Returns lines numbered like ` 1\u2192content`. Use `offset` and `limit` for large files (default reads up to 2000 lines).",
|
|
53
54
|
permission: "auto",
|
|
@@ -99,6 +100,7 @@ var readTool = {
|
|
|
99
100
|
};
|
|
100
101
|
var writeTool = {
|
|
101
102
|
name: "write",
|
|
103
|
+
category: "Filesystem",
|
|
102
104
|
description: "Write or overwrite a file. For existing files, prefer `edit` over `write`.",
|
|
103
105
|
usageHint: "Use `write` for new files or full replacements. For partial edits use `edit`. Existing files must have been `read` first in this session.",
|
|
104
106
|
permission: "confirm",
|
|
@@ -149,6 +151,7 @@ var writeTool = {
|
|
|
149
151
|
};
|
|
150
152
|
var editTool = {
|
|
151
153
|
name: "edit",
|
|
154
|
+
category: "Filesystem",
|
|
152
155
|
description: "Make a surgical edit by replacing exact text. Fails if `old_string` is not unique unless `replace_all` is true.",
|
|
153
156
|
usageHint: "Always `read` the file first. `old_string` must be an EXACT match (whitespace included). If multiple matches exist, either narrow `old_string` with more context or set `replace_all: true`.",
|
|
154
157
|
permission: "confirm",
|
|
@@ -302,6 +305,7 @@ function capSubject(line) {
|
|
|
302
305
|
var DEFAULT_IGNORE = ["node_modules", ".git", "dist", "build", ".next", "coverage"];
|
|
303
306
|
var replaceTool = {
|
|
304
307
|
name: "replace",
|
|
308
|
+
category: "Transform",
|
|
305
309
|
description: "Batch replace a pattern across multiple files matched by glob. Returns diff for each modified file.",
|
|
306
310
|
usageHint: 'Use `glob` for broad patterns (e.g. "**/*.ts"). Set `dry_run: true` to preview without modifying. `files` can be a single path, comma-separated list, or glob pattern.',
|
|
307
311
|
permission: "confirm",
|
|
@@ -330,7 +334,7 @@ var replaceTool = {
|
|
|
330
334
|
if (input.replacement === void 0) throw new Error("replace: replacement is required");
|
|
331
335
|
if (!input?.files) throw new Error("replace: files is required");
|
|
332
336
|
const replaceAll = input.replace_all ?? true;
|
|
333
|
-
const compiled = compileUserRegex(input.pattern,
|
|
337
|
+
const compiled = compileUserRegex(input.pattern, "g");
|
|
334
338
|
if (!compiled.ok) {
|
|
335
339
|
throw new Error(`replace: ${compiled.reason}`);
|
|
336
340
|
}
|
|
@@ -369,11 +373,17 @@ var replaceTool = {
|
|
|
369
373
|
const style = detectNewlineStyle(content);
|
|
370
374
|
const contentLf = normalizeToLf(content);
|
|
371
375
|
re.lastIndex = 0;
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
const
|
|
376
|
+
const allMatches = [...contentLf.matchAll(re)];
|
|
377
|
+
if (allMatches.length === 0) continue;
|
|
378
|
+
const matches = replaceAll ? allMatches : allMatches.slice(0, 1);
|
|
379
|
+
const count = matches.length;
|
|
380
|
+
let newContentLf = contentLf;
|
|
381
|
+
for (let i = matches.length - 1; i >= 0; i--) {
|
|
382
|
+
const m = matches[i];
|
|
383
|
+
newContentLf = newContentLf.slice(0, m.index) + input.replacement + newContentLf.slice(m.index + m[0].length);
|
|
384
|
+
}
|
|
375
385
|
re.lastIndex = 0;
|
|
376
|
-
totalReplacements +=
|
|
386
|
+
totalReplacements += count;
|
|
377
387
|
if (!dryRun) {
|
|
378
388
|
const newContent = toStyle(newContentLf, style);
|
|
379
389
|
await atomicWrite(realPath, newContent, { mode: stat9.mode & 511 });
|
|
@@ -485,6 +495,7 @@ async function globNative(pattern, base, extraGlob) {
|
|
|
485
495
|
var DEFAULT_IGNORE2 = ["node_modules", ".git", "dist", "build", ".next", "coverage", ".turbo"];
|
|
486
496
|
var globTool = {
|
|
487
497
|
name: "glob",
|
|
498
|
+
category: "Filesystem",
|
|
488
499
|
description: "Find files matching a glob pattern. Returns paths sorted by mtime (newest first).",
|
|
489
500
|
usageHint: "Examples: `**/*.ts`, `src/**/*.test.ts`, `*.json`. Common dirs (node_modules, .git, dist) are ignored by default. Returns up to 1000 paths.",
|
|
490
501
|
permission: "auto",
|
|
@@ -559,6 +570,7 @@ async function readGitignore(dir) {
|
|
|
559
570
|
var DEFAULT_IGNORE3 = ["node_modules", ".git", "dist", "build", ".next", "coverage"];
|
|
560
571
|
var grepTool = {
|
|
561
572
|
name: "grep",
|
|
573
|
+
category: "Search",
|
|
562
574
|
description: "Search file contents with a regex. Uses ripgrep when available.",
|
|
563
575
|
usageHint: 'Pattern is regex. Use `output_mode: "content"` for matched lines, `"files_with_matches"` for paths, `"count"` for tallies. `glob` filters files (e.g. `*.ts`).',
|
|
564
576
|
permission: "auto",
|
|
@@ -591,6 +603,10 @@ var grepTool = {
|
|
|
591
603
|
const base = input.path ? safeResolve(input.path, ctx) : ctx.cwd;
|
|
592
604
|
const mode = input.output_mode ?? "content";
|
|
593
605
|
const limit = Math.max(1, Math.min(input.limit ?? 200, 2e3));
|
|
606
|
+
const validation = compileUserRegex(input.pattern, input.case_insensitive ? "i" : "");
|
|
607
|
+
if (!validation.ok) {
|
|
608
|
+
throw new Error(`grep: ${validation.reason}`);
|
|
609
|
+
}
|
|
594
610
|
const rgAvailable = await detectRg(opts.signal);
|
|
595
611
|
if (rgAvailable) {
|
|
596
612
|
try {
|
|
@@ -624,11 +640,15 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
624
640
|
args.push("-n");
|
|
625
641
|
if (input.context_lines) args.push("-C", String(input.context_lines));
|
|
626
642
|
}
|
|
643
|
+
for (const ignored of DEFAULT_IGNORE3) {
|
|
644
|
+
args.push("--glob", `!${ignored}/**`, "--glob", `!**/${ignored}/**`);
|
|
645
|
+
}
|
|
627
646
|
if (input.glob) args.push("--glob", input.glob);
|
|
628
647
|
args.push("--", input.pattern, base);
|
|
629
648
|
const matches = [];
|
|
630
649
|
let buf = "";
|
|
631
650
|
let totalLines = 0;
|
|
651
|
+
let totalCount = 0;
|
|
632
652
|
let batchSinceFlush = 0;
|
|
633
653
|
const FLUSH_AT = 16;
|
|
634
654
|
const MAX_BUF_BYTES = 1e6;
|
|
@@ -685,6 +705,7 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
685
705
|
for (const line of ready.split("\n")) {
|
|
686
706
|
if (!line) continue;
|
|
687
707
|
totalLines++;
|
|
708
|
+
if (mode === "count") totalCount += parseRgCountLine(line);
|
|
688
709
|
if (matches.length < limit) {
|
|
689
710
|
matches.push(line);
|
|
690
711
|
pendingBatch.push(line);
|
|
@@ -705,6 +726,7 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
705
726
|
for (const line of buf.split("\n")) {
|
|
706
727
|
if (!line) continue;
|
|
707
728
|
totalLines++;
|
|
729
|
+
if (mode === "count") totalCount += parseRgCountLine(line);
|
|
708
730
|
if (matches.length < limit) {
|
|
709
731
|
matches.push(line);
|
|
710
732
|
pendingBatch.push(line);
|
|
@@ -723,12 +745,18 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
723
745
|
type: "final",
|
|
724
746
|
output: {
|
|
725
747
|
matches,
|
|
726
|
-
count: totalLines,
|
|
748
|
+
count: mode === "count" ? totalCount : totalLines,
|
|
727
749
|
truncated: totalLines > limit || bufOverflow,
|
|
728
750
|
used: "rg"
|
|
729
751
|
}
|
|
730
752
|
};
|
|
731
753
|
}
|
|
754
|
+
function parseRgCountLine(line) {
|
|
755
|
+
const idx = line.lastIndexOf(":");
|
|
756
|
+
if (idx === -1) return 0;
|
|
757
|
+
const n = Number.parseInt(line.slice(idx + 1), 10);
|
|
758
|
+
return Number.isFinite(n) ? n : 0;
|
|
759
|
+
}
|
|
732
760
|
async function runNative(input, base, mode, limit, signal) {
|
|
733
761
|
const flags = input.case_insensitive ? "i" : "";
|
|
734
762
|
const compiled = compileUserRegex(input.pattern, flags);
|
|
@@ -809,6 +837,7 @@ var STREAM_FLUSH_INTERVAL_MS = 200;
|
|
|
809
837
|
var STREAM_FLUSH_BYTES = 4 * 1024;
|
|
810
838
|
var bashTool = {
|
|
811
839
|
name: "bash",
|
|
840
|
+
category: "Shell",
|
|
812
841
|
description: "Run a shell command. stdout and stderr are merged.",
|
|
813
842
|
usageHint: "Runs via `bash -c` (or `cmd /c` on Windows). Cwd is the project root. Default timeout 30s. Output truncated from the middle if oversized. Use for git, npm, builds, tests.",
|
|
814
843
|
permission: "confirm",
|
|
@@ -1032,10 +1061,11 @@ var MAX_OUTPUT2 = 2e5;
|
|
|
1032
1061
|
var TIMEOUT_MS = 3e4;
|
|
1033
1062
|
var execTool = {
|
|
1034
1063
|
name: "exec",
|
|
1064
|
+
category: "Shell",
|
|
1035
1065
|
description: "Restricted shell that only runs pre-approved commands with constrained arguments. Safer alternative to `bash`.",
|
|
1036
1066
|
usageHint: "Set `command` (must be in allowlist). `args` passed through. For arbitrary shell access use the `bash` tool instead.",
|
|
1037
1067
|
permission: "confirm",
|
|
1038
|
-
mutating:
|
|
1068
|
+
mutating: true,
|
|
1039
1069
|
timeoutMs: TIMEOUT_MS,
|
|
1040
1070
|
inputSchema: {
|
|
1041
1071
|
type: "object",
|
|
@@ -1177,6 +1207,7 @@ async function fetchWithRedirectLimit(url, maxRedirects, signal) {
|
|
|
1177
1207
|
}
|
|
1178
1208
|
var fetchTool = {
|
|
1179
1209
|
name: "fetch",
|
|
1210
|
+
category: "Network",
|
|
1180
1211
|
description: "Fetch the contents of a URL. HTML is converted to markdown by default.",
|
|
1181
1212
|
usageHint: "HTTPS only by default. Localhost and RFC1918 ranges blocked unless WRONGSTACK_FETCH_ALLOW_PRIVATE=1. Max 5 redirects, 20s timeout, 128KB cap.",
|
|
1182
1213
|
permission: "confirm",
|
|
@@ -1428,6 +1459,7 @@ var MAX_RESULTS = 50;
|
|
|
1428
1459
|
var TIMEOUT_MS3 = 15e3;
|
|
1429
1460
|
var searchTool = {
|
|
1430
1461
|
name: "search",
|
|
1462
|
+
category: "Search",
|
|
1431
1463
|
description: "Search the web for information. Returns title, URL, and snippet for each result.",
|
|
1432
1464
|
usageHint: "Set `num_results` (1-50, default 10). Use `source` to pick engine: duckduckgo (default), google, bing.",
|
|
1433
1465
|
permission: "confirm",
|
|
@@ -1638,6 +1670,7 @@ function stripTags2(html) {
|
|
|
1638
1670
|
// src/todo.ts
|
|
1639
1671
|
var todoTool = {
|
|
1640
1672
|
name: "todo",
|
|
1673
|
+
category: "Session",
|
|
1641
1674
|
description: "Replace the current todo list with a new set of items.",
|
|
1642
1675
|
usageHint: "Use for multi-step tasks. Replace the full list on each call. At most ONE task may be in_progress at a time. Items have id, content, status (pending|in_progress|completed), and optional activeForm.",
|
|
1643
1676
|
permission: "auto",
|
|
@@ -1684,10 +1717,109 @@ var todoTool = {
|
|
|
1684
1717
|
};
|
|
1685
1718
|
}
|
|
1686
1719
|
};
|
|
1720
|
+
var planTool = {
|
|
1721
|
+
name: "plan",
|
|
1722
|
+
category: "Session",
|
|
1723
|
+
description: "Inspect or edit the strategic plan board for this session. Plans persist across resume (unlike todos). Use this to lay out the multi-step approach before diving in, then mark steps in_progress/done as the work proceeds.",
|
|
1724
|
+
usageHint: "Set action to one of: show | add | start | done | remove | clear. Pass `title` for add. Pass `target` (item id, 1-based index, or title substring) for start/done/remove. Always returns the formatted plan plus open/total counts.",
|
|
1725
|
+
permission: "auto",
|
|
1726
|
+
mutating: false,
|
|
1727
|
+
timeoutMs: 2e3,
|
|
1728
|
+
inputSchema: {
|
|
1729
|
+
type: "object",
|
|
1730
|
+
properties: {
|
|
1731
|
+
action: {
|
|
1732
|
+
type: "string",
|
|
1733
|
+
enum: ["show", "add", "start", "done", "remove", "clear"]
|
|
1734
|
+
},
|
|
1735
|
+
title: { type: "string", description: "Required when action = add." },
|
|
1736
|
+
details: { type: "string", description: "Optional extra context for add." },
|
|
1737
|
+
target: {
|
|
1738
|
+
type: "string",
|
|
1739
|
+
description: "Plan item id, 1-based index, or title substring. Required for start/done/remove."
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
required: ["action"]
|
|
1743
|
+
},
|
|
1744
|
+
async execute(input, ctx) {
|
|
1745
|
+
const planPath = ctx.meta["plan.path"];
|
|
1746
|
+
if (typeof planPath !== "string" || !planPath) {
|
|
1747
|
+
return {
|
|
1748
|
+
ok: false,
|
|
1749
|
+
message: "Plan storage path is not configured for this session.",
|
|
1750
|
+
plan: "",
|
|
1751
|
+
count: 0,
|
|
1752
|
+
open: 0
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
const sessionId = ctx.session?.id ?? "unknown";
|
|
1756
|
+
let plan = await loadPlan(planPath) ?? emptyPlan(sessionId);
|
|
1757
|
+
switch (input.action) {
|
|
1758
|
+
case "show":
|
|
1759
|
+
break;
|
|
1760
|
+
case "add": {
|
|
1761
|
+
const title = input.title?.trim();
|
|
1762
|
+
if (!title) {
|
|
1763
|
+
return mkResult(plan, false, "add requires `title`.");
|
|
1764
|
+
}
|
|
1765
|
+
({ plan } = addPlanItem(plan, title, input.details?.trim() || void 0));
|
|
1766
|
+
await savePlan(planPath, plan);
|
|
1767
|
+
break;
|
|
1768
|
+
}
|
|
1769
|
+
case "start":
|
|
1770
|
+
case "done": {
|
|
1771
|
+
if (!input.target) {
|
|
1772
|
+
return mkResult(plan, false, `${input.action} requires \`target\` (id|index|substring).`);
|
|
1773
|
+
}
|
|
1774
|
+
const next = setPlanItemStatus(
|
|
1775
|
+
plan,
|
|
1776
|
+
input.target,
|
|
1777
|
+
input.action === "start" ? "in_progress" : "done"
|
|
1778
|
+
);
|
|
1779
|
+
if (next === plan) {
|
|
1780
|
+
return mkResult(plan, false, `No plan item matched "${input.target}".`);
|
|
1781
|
+
}
|
|
1782
|
+
plan = next;
|
|
1783
|
+
await savePlan(planPath, plan);
|
|
1784
|
+
break;
|
|
1785
|
+
}
|
|
1786
|
+
case "remove": {
|
|
1787
|
+
if (!input.target) {
|
|
1788
|
+
return mkResult(plan, false, "remove requires `target` (id|index|substring).");
|
|
1789
|
+
}
|
|
1790
|
+
const next = removePlanItem(plan, input.target);
|
|
1791
|
+
if (next === plan) {
|
|
1792
|
+
return mkResult(plan, false, `No plan item matched "${input.target}".`);
|
|
1793
|
+
}
|
|
1794
|
+
plan = next;
|
|
1795
|
+
await savePlan(planPath, plan);
|
|
1796
|
+
break;
|
|
1797
|
+
}
|
|
1798
|
+
case "clear":
|
|
1799
|
+
plan = clearPlan(plan);
|
|
1800
|
+
await savePlan(planPath, plan);
|
|
1801
|
+
break;
|
|
1802
|
+
default:
|
|
1803
|
+
return mkResult(plan, false, `Unknown action "${input.action}".`);
|
|
1804
|
+
}
|
|
1805
|
+
return mkResult(plan, true, `Plan ${input.action} ok.`);
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
function mkResult(plan, ok, message) {
|
|
1809
|
+
const open = plan.items.filter((i) => i.status !== "done").length;
|
|
1810
|
+
return {
|
|
1811
|
+
ok,
|
|
1812
|
+
message,
|
|
1813
|
+
plan: formatPlan(plan),
|
|
1814
|
+
count: plan.items.length,
|
|
1815
|
+
open
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1687
1818
|
var TIMEOUT_MS4 = 3e4;
|
|
1688
1819
|
var MAX_OUTPUT3 = 1e5;
|
|
1689
1820
|
var gitTool = {
|
|
1690
1821
|
name: "git",
|
|
1822
|
+
category: "Git",
|
|
1691
1823
|
description: "Run git commands. Wraps common operations: status, log, diff, commit, branch, checkout, stash, push, pull, fetch, reset.",
|
|
1692
1824
|
usageHint: "Prefer built-in subcommands over raw args. `command` is required. `message` for commits. `branch` for checkout/branch. `files` for status/diff. `format` for log.",
|
|
1693
1825
|
permission: "confirm",
|
|
@@ -1851,6 +1983,7 @@ function runGit(args, cwd, signal) {
|
|
|
1851
1983
|
}
|
|
1852
1984
|
var patchTool = {
|
|
1853
1985
|
name: "patch",
|
|
1986
|
+
category: "Filesystem",
|
|
1854
1987
|
description: "Apply a unified diff patch to files. Writes .orig and .rej files on failure.",
|
|
1855
1988
|
usageHint: "Set `patch` (the diff text). `directory` defaults to cwd. `strip` removes leading path components. `dry_run` previews.",
|
|
1856
1989
|
permission: "confirm",
|
|
@@ -1959,6 +2092,7 @@ function extractPatchedFiles(output) {
|
|
|
1959
2092
|
}
|
|
1960
2093
|
var jsonTool = {
|
|
1961
2094
|
name: "json",
|
|
2095
|
+
category: "Data",
|
|
1962
2096
|
description: "Parse, query, and validate JSON/JSON5/YAML. Use `query` with JMESPath-like paths to extract values.",
|
|
1963
2097
|
usageHint: 'Provide `file` path or `data` string. `query` supports dot notation (e.g. "results[0].name"). `format` outputs in specified format.',
|
|
1964
2098
|
permission: "auto",
|
|
@@ -2079,6 +2213,7 @@ function toYaml(data, indent = 0) {
|
|
|
2079
2213
|
}
|
|
2080
2214
|
var diffTool = {
|
|
2081
2215
|
name: "diff",
|
|
2216
|
+
category: "Filesystem",
|
|
2082
2217
|
description: "Show differences between files, commits, or branches. Supports staged vs working tree.",
|
|
2083
2218
|
usageHint: "Use `files` for file paths, `a`/`b` for commit refs, `staged` for git index. `mode`: unified (default), stat, side-by-side.",
|
|
2084
2219
|
permission: "auto",
|
|
@@ -2204,6 +2339,7 @@ var DEFAULT_IGNORE4 = [
|
|
|
2204
2339
|
];
|
|
2205
2340
|
var treeTool = {
|
|
2206
2341
|
name: "tree",
|
|
2342
|
+
category: "Filesystem",
|
|
2207
2343
|
description: "Display directory structure as an ASCII tree. Shows files and folders with indentation.",
|
|
2208
2344
|
usageHint: "Set `path` (default: cwd). `depth` limits nesting (default: 3). `glob` filters files. `exclude` ignores dirs. `show_files` toggles file listing (default: true).",
|
|
2209
2345
|
permission: "auto",
|
|
@@ -2438,6 +2574,7 @@ async function* spawnStream(opts) {
|
|
|
2438
2574
|
// src/lint.ts
|
|
2439
2575
|
var lintTool = {
|
|
2440
2576
|
name: "lint",
|
|
2577
|
+
category: "Code Quality",
|
|
2441
2578
|
description: "Run a linter on files. Auto-detects biome, eslint, or tslint. Use `fix` to auto-fix issues.",
|
|
2442
2579
|
usageHint: "Set `files` (glob or comma-separated). `fix` applies corrections. `linter` forces specific tool.",
|
|
2443
2580
|
permission: "confirm",
|
|
@@ -2529,6 +2666,7 @@ async function detectLinter(cwd) {
|
|
|
2529
2666
|
// src/format.ts
|
|
2530
2667
|
var formatTool = {
|
|
2531
2668
|
name: "format",
|
|
2669
|
+
category: "Code Quality",
|
|
2532
2670
|
description: "Format files with biome or prettier. Use `check` to verify without modifying.",
|
|
2533
2671
|
usageHint: "Set `files` (glob or comma-separated). `check` only validates. `fixer` forces tool.",
|
|
2534
2672
|
permission: "confirm",
|
|
@@ -2625,6 +2763,7 @@ async function detectFixer(cwd) {
|
|
|
2625
2763
|
}
|
|
2626
2764
|
var typecheckTool = {
|
|
2627
2765
|
name: "typecheck",
|
|
2766
|
+
category: "Code Quality",
|
|
2628
2767
|
description: "Run TypeScript type checking with `tsc --noEmit`. Checks for type errors without compiling.",
|
|
2629
2768
|
usageHint: "Set `project` for tsconfig path (default: nearest). `strict` enables strictest flags. `all` checks all projects in workspace.",
|
|
2630
2769
|
permission: "confirm",
|
|
@@ -2704,6 +2843,7 @@ async function findTsConfig(cwd) {
|
|
|
2704
2843
|
}
|
|
2705
2844
|
var testTool = {
|
|
2706
2845
|
name: "test",
|
|
2846
|
+
category: "Code Quality",
|
|
2707
2847
|
description: "Run tests with vitest, jest, or mocha. Returns pass/fail counts and output.",
|
|
2708
2848
|
usageHint: "Set `files` for specific tests. `watch` enables watch mode. `coverage` generates coverage report. `grep` filters by name.",
|
|
2709
2849
|
permission: "confirm",
|
|
@@ -2851,6 +2991,7 @@ function parseResult(runner, result, duration) {
|
|
|
2851
2991
|
// src/install.ts
|
|
2852
2992
|
var installTool = {
|
|
2853
2993
|
name: "install",
|
|
2994
|
+
category: "Package Management",
|
|
2854
2995
|
description: "Install npm packages. Detects pnpm/npm/yarn and uses the right package manager.",
|
|
2855
2996
|
usageHint: "Set `packages` to install. `save` as dependency type. `global` for global install. `dry_run` to preview.",
|
|
2856
2997
|
permission: "confirm",
|
|
@@ -2946,6 +3087,7 @@ async function detectPackageManager(cwd) {
|
|
|
2946
3087
|
// src/audit.ts
|
|
2947
3088
|
var auditTool = {
|
|
2948
3089
|
name: "audit",
|
|
3090
|
+
category: "Package Management",
|
|
2949
3091
|
description: "Run npm/pnpm security audit. Returns vulnerabilities sorted by severity.",
|
|
2950
3092
|
usageHint: "Set `level` to filter minimum severity. `fix` attempts auto-fix. `packages` checks specific packages.",
|
|
2951
3093
|
permission: "confirm",
|
|
@@ -3053,6 +3195,7 @@ function parseAuditOutput(json, exitCode) {
|
|
|
3053
3195
|
}
|
|
3054
3196
|
var outdatedTool = {
|
|
3055
3197
|
name: "outdated",
|
|
3198
|
+
category: "Package Management",
|
|
3056
3199
|
description: "Check for outdated npm packages. Shows current, wanted, and latest versions.",
|
|
3057
3200
|
usageHint: "Set `check` to filter specific packages. `format` as list or table. `include_deprecated` shows deprecated packages.",
|
|
3058
3201
|
permission: "auto",
|
|
@@ -3164,6 +3307,7 @@ function parseOutdatedOutput(json, exitCode) {
|
|
|
3164
3307
|
}
|
|
3165
3308
|
var logsTool = {
|
|
3166
3309
|
name: "logs",
|
|
3310
|
+
category: "Logs",
|
|
3167
3311
|
description: "Stream or fetch logs from a service or file. Supports Docker, systemd, or plain log files.",
|
|
3168
3312
|
usageHint: "Set `service` for Docker/systemd, `path` for file. `lines` limits output. `stream` for tail -f behavior. `filter` regex filters lines.",
|
|
3169
3313
|
permission: "confirm",
|
|
@@ -3341,6 +3485,7 @@ function parseLine(line) {
|
|
|
3341
3485
|
}
|
|
3342
3486
|
var documentTool = {
|
|
3343
3487
|
name: "document",
|
|
3488
|
+
category: "Project",
|
|
3344
3489
|
description: "Generate or update documentation comments for functions, classes, and types. Supports JSDoc, TSDoc, and block comments.",
|
|
3345
3490
|
usageHint: "Set `target` for what to document. `files` for paths. `style` for comment format. `overwrite` replaces existing docs.",
|
|
3346
3491
|
permission: "confirm",
|
|
@@ -3580,6 +3725,7 @@ describe('{{Name}}', () => {
|
|
|
3580
3725
|
};
|
|
3581
3726
|
var scaffoldTool = {
|
|
3582
3727
|
name: "scaffold",
|
|
3728
|
+
category: "Project",
|
|
3583
3729
|
description: "Generate boilerplate code from built-in templates or paths. Creates package.json, source files, tests.",
|
|
3584
3730
|
usageHint: "Set `template` (npm-package, cli-tool, react-component) and `name`. `vars` for template variables. `dry_run` preview.",
|
|
3585
3731
|
permission: "confirm",
|
|
@@ -3665,6 +3811,7 @@ function substituteVars(content, name, vars) {
|
|
|
3665
3811
|
// src/tool-search.ts
|
|
3666
3812
|
var toolSearchTool = {
|
|
3667
3813
|
name: "tool_search",
|
|
3814
|
+
category: "Meta",
|
|
3668
3815
|
description: "Search available tools by name, description, tags, permission level, or mutating flag.",
|
|
3669
3816
|
usageHint: "Set `query` for keyword search. `tags` to filter by category. `permission` to filter by required permission. `mutating` to filter by mutating flag.",
|
|
3670
3817
|
permission: "auto",
|
|
@@ -3732,10 +3879,11 @@ var toolSearchTool = {
|
|
|
3732
3879
|
// src/tool-use.ts
|
|
3733
3880
|
var toolUseTool = {
|
|
3734
3881
|
name: "tool_use",
|
|
3882
|
+
category: "Meta",
|
|
3735
3883
|
description: "Execute a specific tool by name with given input. Useful when the agent knows exactly which tool to call.",
|
|
3736
3884
|
usageHint: "Set `tool` with exact tool name and `input` with the tool parameters. Returns result or error.",
|
|
3737
3885
|
permission: "confirm",
|
|
3738
|
-
mutating:
|
|
3886
|
+
mutating: true,
|
|
3739
3887
|
timeoutMs: 6e4,
|
|
3740
3888
|
inputSchema: {
|
|
3741
3889
|
type: "object",
|
|
@@ -3800,10 +3948,11 @@ var toolUseTool = {
|
|
|
3800
3948
|
// src/batch-tool-use.ts
|
|
3801
3949
|
var batchToolUseTool = {
|
|
3802
3950
|
name: "batch_tool_use",
|
|
3951
|
+
category: "Meta",
|
|
3803
3952
|
description: "Execute multiple tool calls in sequence or parallel. Returns all results.",
|
|
3804
3953
|
usageHint: "Set `calls` array with tool names and inputs. `stop_on_error` halts on first failure. `parallel` runs concurrently (default: true).",
|
|
3805
3954
|
permission: "confirm",
|
|
3806
|
-
mutating:
|
|
3955
|
+
mutating: true,
|
|
3807
3956
|
timeoutMs: 12e4,
|
|
3808
3957
|
inputSchema: {
|
|
3809
3958
|
type: "object",
|
|
@@ -3903,6 +4052,7 @@ async function executeSingle(call, ctx, opts) {
|
|
|
3903
4052
|
// src/tool-help.ts
|
|
3904
4053
|
var toolHelpTool = {
|
|
3905
4054
|
name: "tool_help",
|
|
4055
|
+
category: "Meta",
|
|
3906
4056
|
description: "Get help and usage information for a specific tool or list all available tools.",
|
|
3907
4057
|
usageHint: "Set `tool` for specific help. Omit to list all tools. `format`: short (one-liner), full (schema), markdown (formatted).",
|
|
3908
4058
|
permission: "auto",
|
|
@@ -4025,6 +4175,7 @@ function formatAllToolsMarkdown(tools) {
|
|
|
4025
4175
|
function rememberTool(memory) {
|
|
4026
4176
|
return {
|
|
4027
4177
|
name: "remember",
|
|
4178
|
+
category: "Session",
|
|
4028
4179
|
description: "Persist a short note to project or user memory.",
|
|
4029
4180
|
usageHint: "Use sparingly. Only for facts that should outlive the session (project conventions, user preferences). Transient state belongs in `todo`. Scope defaults to project-memory.",
|
|
4030
4181
|
permission: "auto",
|
|
@@ -4049,6 +4200,7 @@ function rememberTool(memory) {
|
|
|
4049
4200
|
function forgetTool(memory) {
|
|
4050
4201
|
return {
|
|
4051
4202
|
name: "forget",
|
|
4203
|
+
category: "Session",
|
|
4052
4204
|
description: "Remove memory entries matching a substring (case-insensitive).",
|
|
4053
4205
|
usageHint: "Removes ALL matching bullet lines in the given scope. Use a unique substring.",
|
|
4054
4206
|
permission: "confirm",
|
|
@@ -4075,6 +4227,7 @@ function forgetTool(memory) {
|
|
|
4075
4227
|
function createModeTool(modeStore) {
|
|
4076
4228
|
return {
|
|
4077
4229
|
name: "mode",
|
|
4230
|
+
category: "Session",
|
|
4078
4231
|
description: "Get, list, or switch the agent mode. Modes inject role-specific prompts into the system prompt.",
|
|
4079
4232
|
usageHint: "Set `action`: `get` (current mode), `list` (all modes), `set <modeId>` (switch), `clear` (reset to default).",
|
|
4080
4233
|
permission: "confirm",
|
|
@@ -4166,6 +4319,7 @@ var builtinTools = [
|
|
|
4166
4319
|
fetchTool,
|
|
4167
4320
|
searchTool,
|
|
4168
4321
|
todoTool,
|
|
4322
|
+
planTool,
|
|
4169
4323
|
gitTool,
|
|
4170
4324
|
patchTool,
|
|
4171
4325
|
jsonTool,
|
|
@@ -4187,6 +4341,13 @@ var builtinTools = [
|
|
|
4187
4341
|
toolHelpTool
|
|
4188
4342
|
];
|
|
4189
4343
|
|
|
4190
|
-
|
|
4344
|
+
// src/pack.ts
|
|
4345
|
+
var builtinToolsPack = {
|
|
4346
|
+
name: "builtin-tools",
|
|
4347
|
+
description: "WrongStack built-in filesystem, execution, network, lifecycle, and agent-control tools.",
|
|
4348
|
+
tools: builtinTools
|
|
4349
|
+
};
|
|
4350
|
+
|
|
4351
|
+
export { auditTool, bashTool, batchToolUseTool, builtinTools, builtinToolsPack, createModeTool, diffTool, documentTool, editTool, execTool, fetchTool, forgetTool, formatTool, gitTool, globTool, grepTool, installTool, jsonTool, lintTool, logsTool, outdatedTool, patchTool, planTool, readTool, rememberTool, replaceTool, scaffoldTool, searchTool, testTool, todoTool, toolHelpTool, toolSearchTool, toolUseTool, treeTool, typecheckTool, writeTool };
|
|
4191
4352
|
//# sourceMappingURL=index.js.map
|
|
4192
4353
|
//# sourceMappingURL=index.js.map
|