@wrongstack/tools 0.5.5 → 0.5.6
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/builtin.js +46 -7
- package/dist/builtin.js.map +1 -1
- package/dist/index.d.ts +16 -5
- package/dist/index.js +46 -7
- package/dist/index.js.map +1 -1
- package/dist/pack.js +46 -7
- package/dist/pack.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -43,18 +43,22 @@ export { builtinToolsPack } from './pack.js';
|
|
|
43
43
|
* during startup so the tool always knows where to read/write.
|
|
44
44
|
*
|
|
45
45
|
* One tool, multiple actions, JSON in/out. The action discriminates the
|
|
46
|
-
* operation so the LLM can do show / add / start / done / remove /
|
|
47
|
-
* via a single tool registration instead of
|
|
48
|
-
*
|
|
46
|
+
* operation so the LLM can do show / add / start / done / remove / promote /
|
|
47
|
+
* derive / template_use / clear via a single tool registration instead of
|
|
48
|
+
* bloating the surface with nine near-identical tools.
|
|
49
49
|
*/
|
|
50
50
|
interface PlanInput {
|
|
51
|
-
action: 'show' | 'add' | 'start' | 'done' | 'remove' | 'clear';
|
|
51
|
+
action: 'show' | 'add' | 'start' | 'done' | 'remove' | 'promote' | 'derive' | 'template_use' | 'clear';
|
|
52
52
|
/** Required for add. */
|
|
53
53
|
title?: string;
|
|
54
54
|
/** Optional detail line for add. */
|
|
55
55
|
details?: string;
|
|
56
|
-
/** Required for start/done/remove — accepts plan item id OR 1-based index OR title substring. */
|
|
56
|
+
/** Required for start/done/remove/promote/derive — accepts plan item id OR 1-based index OR title substring. */
|
|
57
57
|
target?: string;
|
|
58
|
+
/** Optional subtasks for promote/derive. If omitted, a single todo is created from the plan item title. */
|
|
59
|
+
subtasks?: string[];
|
|
60
|
+
/** Required for template_use — the template name (e.g. "new-feature", "bug-fix"). */
|
|
61
|
+
template?: string;
|
|
58
62
|
}
|
|
59
63
|
interface PlanOutput {
|
|
60
64
|
ok: boolean;
|
|
@@ -65,6 +69,13 @@ interface PlanOutput {
|
|
|
65
69
|
count: number;
|
|
66
70
|
/** Number of items not in 'done' status. */
|
|
67
71
|
open: number;
|
|
72
|
+
/** When promote/derive succeed, the generated todo items so the caller can inspect them. */
|
|
73
|
+
todos?: Array<{
|
|
74
|
+
id: string;
|
|
75
|
+
content: string;
|
|
76
|
+
status: string;
|
|
77
|
+
activeForm?: string;
|
|
78
|
+
}>;
|
|
68
79
|
}
|
|
69
80
|
declare const planTool: Tool<PlanInput, PlanOutput>;
|
|
70
81
|
|
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, loadPlan, emptyPlan, clearPlan, savePlan, removePlanItem, setPlanItemStatus,
|
|
4
|
+
import { atomicWrite, unifiedDiff, detectNewlineStyle, normalizeToLf, toStyle, compileGlob, buildChildEnv, stripAnsi, loadPlan, emptyPlan, clearPlan, savePlan, getPlanTemplate, addPlanItem, deriveTodosFromPlanItem, removePlanItem, setPlanItemStatus, 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';
|
|
@@ -1821,8 +1821,8 @@ var todoTool = {
|
|
|
1821
1821
|
var planTool = {
|
|
1822
1822
|
name: "plan",
|
|
1823
1823
|
category: "Session",
|
|
1824
|
-
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.",
|
|
1825
|
-
usageHint:
|
|
1824
|
+
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. Promote a plan item to todos to start working on it. Apply templates for common workflows.",
|
|
1825
|
+
usageHint: 'Set action to one of: show | add | start | done | remove | promote | derive | template_use | clear. Pass `title` for add. Pass `target` (item id, 1-based index, or title substring) for start/done/remove/promote/derive. Pass `subtasks` for promote/derive to break the plan item into multiple todos. Pass `template` (e.g. "new-feature", "bug-fix", "refactor", "release") for template_use. Always returns the formatted plan plus open/total counts.',
|
|
1826
1826
|
permission: "auto",
|
|
1827
1827
|
mutating: false,
|
|
1828
1828
|
timeoutMs: 2e3,
|
|
@@ -1831,13 +1831,22 @@ var planTool = {
|
|
|
1831
1831
|
properties: {
|
|
1832
1832
|
action: {
|
|
1833
1833
|
type: "string",
|
|
1834
|
-
enum: ["show", "add", "start", "done", "remove", "clear"]
|
|
1834
|
+
enum: ["show", "add", "start", "done", "remove", "promote", "derive", "template_use", "clear"]
|
|
1835
1835
|
},
|
|
1836
1836
|
title: { type: "string", description: "Required when action = add." },
|
|
1837
1837
|
details: { type: "string", description: "Optional extra context for add." },
|
|
1838
1838
|
target: {
|
|
1839
1839
|
type: "string",
|
|
1840
|
-
description: "Plan item id, 1-based index, or title substring. Required for start/done/remove."
|
|
1840
|
+
description: "Plan item id, 1-based index, or title substring. Required for start/done/remove/promote/derive."
|
|
1841
|
+
},
|
|
1842
|
+
subtasks: {
|
|
1843
|
+
type: "array",
|
|
1844
|
+
items: { type: "string" },
|
|
1845
|
+
description: "Optional subtasks for promote/derive. If omitted, a single todo is created from the plan item title."
|
|
1846
|
+
},
|
|
1847
|
+
template: {
|
|
1848
|
+
type: "string",
|
|
1849
|
+
description: "Template name for template_use action. Available: new-feature, bug-fix, refactor, release, security-audit, onboarding."
|
|
1841
1850
|
}
|
|
1842
1851
|
},
|
|
1843
1852
|
required: ["action"]
|
|
@@ -1896,6 +1905,35 @@ var planTool = {
|
|
|
1896
1905
|
await savePlan(planPath, plan);
|
|
1897
1906
|
break;
|
|
1898
1907
|
}
|
|
1908
|
+
case "promote":
|
|
1909
|
+
case "derive": {
|
|
1910
|
+
if (!input.target) {
|
|
1911
|
+
return mkResult(plan, false, `${input.action} requires \`target\` (id|index|substring).`);
|
|
1912
|
+
}
|
|
1913
|
+
const derived = deriveTodosFromPlanItem(plan, input.target, input.subtasks);
|
|
1914
|
+
if (!derived) {
|
|
1915
|
+
return mkResult(plan, false, `No plan item matched "${input.target}".`);
|
|
1916
|
+
}
|
|
1917
|
+
plan = derived.plan;
|
|
1918
|
+
await savePlan(planPath, plan);
|
|
1919
|
+
ctx.state.replaceTodos(derived.todos);
|
|
1920
|
+
return mkResult(plan, true, `${input.action} ok \u2014 ${derived.todos.length} todo(s) created.`, derived.todos);
|
|
1921
|
+
}
|
|
1922
|
+
case "template_use": {
|
|
1923
|
+
const templateName = input.template?.trim();
|
|
1924
|
+
if (!templateName) {
|
|
1925
|
+
return mkResult(plan, false, "template_use requires `template` name.");
|
|
1926
|
+
}
|
|
1927
|
+
const template = getPlanTemplate(templateName);
|
|
1928
|
+
if (!template) {
|
|
1929
|
+
return mkResult(plan, false, `Unknown template "${templateName}".`);
|
|
1930
|
+
}
|
|
1931
|
+
for (const item of template.items) {
|
|
1932
|
+
({ plan } = addPlanItem(plan, item.title, item.details));
|
|
1933
|
+
}
|
|
1934
|
+
await savePlan(planPath, plan);
|
|
1935
|
+
return mkResult(plan, true, `Applied template "${template.name}" \u2014 ${template.items.length} items added.`);
|
|
1936
|
+
}
|
|
1899
1937
|
case "clear":
|
|
1900
1938
|
plan = clearPlan(plan);
|
|
1901
1939
|
await savePlan(planPath, plan);
|
|
@@ -1906,14 +1944,15 @@ var planTool = {
|
|
|
1906
1944
|
return mkResult(plan, true, `Plan ${input.action} ok.`);
|
|
1907
1945
|
}
|
|
1908
1946
|
};
|
|
1909
|
-
function mkResult(plan, ok, message) {
|
|
1947
|
+
function mkResult(plan, ok, message, todos) {
|
|
1910
1948
|
const open = plan.items.filter((i) => i.status !== "done").length;
|
|
1911
1949
|
return {
|
|
1912
1950
|
ok,
|
|
1913
1951
|
message,
|
|
1914
1952
|
plan: formatPlan(plan),
|
|
1915
1953
|
count: plan.items.length,
|
|
1916
|
-
open
|
|
1954
|
+
open,
|
|
1955
|
+
todos
|
|
1917
1956
|
};
|
|
1918
1957
|
}
|
|
1919
1958
|
var TIMEOUT_MS4 = 3e4;
|