@united-workforce/cli 0.3.0 → 0.4.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/README.md +15 -8
- package/dist/__tests__/adapter-json-roundtrip.test.js +1 -1
- package/dist/__tests__/adapter-json-roundtrip.test.js.map +1 -1
- package/dist/__tests__/agent-resolution-llm-free.test.d.ts +2 -0
- package/dist/__tests__/agent-resolution-llm-free.test.d.ts.map +1 -0
- package/dist/__tests__/agent-resolution-llm-free.test.js +30 -0
- package/dist/__tests__/agent-resolution-llm-free.test.js.map +1 -0
- package/dist/__tests__/build-step-entry.test.d.ts +2 -0
- package/dist/__tests__/build-step-entry.test.d.ts.map +1 -0
- package/dist/__tests__/build-step-entry.test.js +173 -0
- package/dist/__tests__/build-step-entry.test.js.map +1 -0
- package/dist/__tests__/clear-thread-failed-attempts.test.d.ts +2 -0
- package/dist/__tests__/clear-thread-failed-attempts.test.d.ts.map +1 -0
- package/dist/__tests__/clear-thread-failed-attempts.test.js +93 -0
- package/dist/__tests__/clear-thread-failed-attempts.test.js.map +1 -0
- package/dist/__tests__/config.test.js +26 -302
- package/dist/__tests__/config.test.js.map +1 -1
- package/dist/__tests__/current-role.test.js +7 -6
- package/dist/__tests__/current-role.test.js.map +1 -1
- package/dist/__tests__/e2e-mock-agent.test.js +20 -23
- package/dist/__tests__/e2e-mock-agent.test.js.map +1 -1
- package/dist/__tests__/issue-180-workflow-ref-removed.test.d.ts +2 -0
- package/dist/__tests__/issue-180-workflow-ref-removed.test.d.ts.map +1 -0
- package/dist/__tests__/issue-180-workflow-ref-removed.test.js +40 -0
- package/dist/__tests__/issue-180-workflow-ref-removed.test.js.map +1 -0
- package/dist/__tests__/moderator-evaluate.test.js +9 -50
- package/dist/__tests__/moderator-evaluate.test.js.map +1 -1
- package/dist/__tests__/pid-recycling.test.d.ts +2 -0
- package/dist/__tests__/pid-recycling.test.d.ts.map +1 -0
- package/dist/__tests__/pid-recycling.test.js +271 -0
- package/dist/__tests__/pid-recycling.test.js.map +1 -0
- package/dist/__tests__/prompt.test.js +321 -0
- package/dist/__tests__/prompt.test.js.map +1 -1
- package/dist/__tests__/resolve-head-hash.test.js +4 -4
- package/dist/__tests__/resolve-head-hash.test.js.map +1 -1
- package/dist/__tests__/setup-agent-discovery.test.js +21 -30
- package/dist/__tests__/setup-agent-discovery.test.js.map +1 -1
- package/dist/__tests__/setup-complexity.test.js +2 -168
- package/dist/__tests__/setup-complexity.test.js.map +1 -1
- package/dist/__tests__/setup-no-llm.test.d.ts +2 -0
- package/dist/__tests__/setup-no-llm.test.d.ts.map +1 -0
- package/dist/__tests__/setup-no-llm.test.js +52 -0
- package/dist/__tests__/setup-no-llm.test.js.map +1 -0
- package/dist/__tests__/solve-issue-tea-worktree.test.js +24 -27
- package/dist/__tests__/solve-issue-tea-worktree.test.js.map +1 -1
- package/dist/__tests__/step-ask.test.d.ts +2 -0
- package/dist/__tests__/step-ask.test.d.ts.map +1 -0
- package/dist/__tests__/step-ask.test.js +499 -0
- package/dist/__tests__/step-ask.test.js.map +1 -0
- package/dist/__tests__/step-show-json.test.js +1 -0
- package/dist/__tests__/step-show-json.test.js.map +1 -1
- package/dist/__tests__/step-timing.test.js +2 -0
- package/dist/__tests__/step-timing.test.js.map +1 -1
- package/dist/__tests__/store-global-cas.test.js +2 -2
- package/dist/__tests__/store-global-cas.test.js.map +1 -1
- package/dist/__tests__/store-unified-threads.test.js +9 -9
- package/dist/__tests__/store-unified-threads.test.js.map +1 -1
- package/dist/__tests__/thread-cancel-status.test.js +6 -6
- package/dist/__tests__/thread-cancel-status.test.js.map +1 -1
- package/dist/__tests__/thread-list-filters.test.js +344 -9
- package/dist/__tests__/thread-list-filters.test.js.map +1 -1
- package/dist/__tests__/thread-poke.test.d.ts +2 -0
- package/dist/__tests__/thread-poke.test.d.ts.map +1 -0
- package/dist/__tests__/thread-poke.test.js +412 -0
- package/dist/__tests__/thread-poke.test.js.map +1 -0
- package/dist/__tests__/thread-resume.test.js +10 -14
- package/dist/__tests__/thread-resume.test.js.map +1 -1
- package/dist/__tests__/thread-show-status.test.js +17 -28
- package/dist/__tests__/thread-show-status.test.js.map +1 -1
- package/dist/__tests__/thread-suspend-step.test.js +8 -14
- package/dist/__tests__/thread-suspend-step.test.js.map +1 -1
- package/dist/__tests__/thread-suspended-display.test.js +10 -22
- package/dist/__tests__/thread-suspended-display.test.js.map +1 -1
- package/dist/__tests__/thread.test.js +4 -4
- package/dist/__tests__/thread.test.js.map +1 -1
- package/dist/__tests__/validate-semantic.test.js +49 -21
- package/dist/__tests__/validate-semantic.test.js.map +1 -1
- package/dist/__tests__/workflow-list-recursive.test.d.ts +2 -0
- package/dist/__tests__/workflow-list-recursive.test.d.ts.map +1 -0
- package/dist/__tests__/workflow-list-recursive.test.js +283 -0
- package/dist/__tests__/workflow-list-recursive.test.js.map +1 -0
- package/dist/__tests__/workflow-resolution.test.js +36 -21
- package/dist/__tests__/workflow-resolution.test.js.map +1 -1
- package/dist/__tests__/workflow-show-resolution.test.d.ts +2 -0
- package/dist/__tests__/workflow-show-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/workflow-show-resolution.test.js +210 -0
- package/dist/__tests__/workflow-show-resolution.test.js.map +1 -0
- package/dist/__tests__/workflow-validate.test.d.ts +2 -0
- package/dist/__tests__/workflow-validate.test.d.ts.map +1 -0
- package/dist/__tests__/workflow-validate.test.js +687 -0
- package/dist/__tests__/workflow-validate.test.js.map +1 -0
- package/dist/background/background.d.ts +22 -1
- package/dist/background/background.d.ts.map +1 -1
- package/dist/background/background.js +83 -6
- package/dist/background/background.js.map +1 -1
- package/dist/background/index.d.ts +1 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/types.d.ts +1 -0
- package/dist/background/types.d.ts.map +1 -1
- package/dist/cli.js +66 -31
- package/dist/cli.js.map +1 -1
- package/dist/commands/config.d.ts +3 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +7 -33
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/prompt.d.ts.map +1 -1
- package/dist/commands/prompt.js +15 -2
- package/dist/commands/prompt.js.map +1 -1
- package/dist/commands/setup.d.ts +7 -39
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +27 -302
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/step.d.ts +44 -1
- package/dist/commands/step.d.ts.map +1 -1
- package/dist/commands/step.js +255 -11
- package/dist/commands/step.js.map +1 -1
- package/dist/commands/thread.d.ts +16 -3
- package/dist/commands/thread.d.ts.map +1 -1
- package/dist/commands/thread.js +379 -140
- package/dist/commands/thread.js.map +1 -1
- package/dist/commands/workflow.d.ts +9 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +130 -6
- package/dist/commands/workflow.js.map +1 -1
- package/dist/moderator/__tests__/evaluate.test.js +31 -17
- package/dist/moderator/__tests__/evaluate.test.js.map +1 -1
- package/dist/moderator/evaluate.d.ts.map +1 -1
- package/dist/moderator/evaluate.js +4 -16
- package/dist/moderator/evaluate.js.map +1 -1
- package/dist/moderator/index.d.ts +1 -2
- package/dist/moderator/index.d.ts.map +1 -1
- package/dist/moderator/index.js +0 -1
- package/dist/moderator/index.js.map +1 -1
- package/dist/moderator/types.d.ts +6 -10
- package/dist/moderator/types.d.ts.map +1 -1
- package/dist/moderator/types.js +1 -3
- package/dist/moderator/types.js.map +1 -1
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +5 -3
- package/dist/schemas.js.map +1 -1
- package/dist/store.d.ts +28 -9
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +75 -16
- package/dist/store.js.map +1 -1
- package/dist/validate-semantic.d.ts.map +1 -1
- package/dist/validate-semantic.js +83 -66
- package/dist/validate-semantic.js.map +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +24 -0
- package/dist/validate.js.map +1 -1
- package/package.json +8 -10
- package/src/__tests__/adapter-json-roundtrip.test.ts +1 -1
- package/src/__tests__/agent-resolution-llm-free.test.ts +39 -0
- package/src/__tests__/build-step-entry.test.ts +203 -0
- package/src/__tests__/clear-thread-failed-attempts.test.ts +122 -0
- package/src/__tests__/config.test.ts +33 -321
- package/src/__tests__/current-role.test.ts +7 -6
- package/src/__tests__/e2e-mock-agent.test.ts +20 -23
- package/src/__tests__/fixtures/e2e-count.workflow.yaml +1 -0
- package/src/__tests__/fixtures/e2e-linear.workflow.yaml +1 -0
- package/src/__tests__/fixtures/{e2e-mustache.workflow.yaml → e2e-liquid.workflow.yaml} +3 -2
- package/src/__tests__/fixtures/e2e-loop.workflow.yaml +1 -0
- package/src/__tests__/fixtures/e2e-suspend.mock.yaml +2 -2
- package/src/__tests__/fixtures/e2e-suspend.workflow.yaml +6 -10
- package/src/__tests__/issue-180-workflow-ref-removed.test.ts +43 -0
- package/src/__tests__/moderator-evaluate.test.ts +9 -52
- package/src/__tests__/pid-recycling.test.ts +328 -0
- package/src/__tests__/prompt.test.ts +397 -0
- package/src/__tests__/resolve-head-hash.test.ts +4 -4
- package/src/__tests__/setup-agent-discovery.test.ts +26 -51
- package/src/__tests__/setup-complexity.test.ts +1 -203
- package/src/__tests__/setup-no-llm.test.ts +68 -0
- package/src/__tests__/solve-issue-tea-worktree.test.ts +24 -30
- package/src/__tests__/step-ask.test.ts +670 -0
- package/src/__tests__/step-show-json.test.ts +1 -0
- package/src/__tests__/step-timing.test.ts +2 -0
- package/src/__tests__/store-global-cas.test.ts +2 -2
- package/src/__tests__/store-unified-threads.test.ts +9 -9
- package/src/__tests__/thread-cancel-status.test.ts +6 -6
- package/src/__tests__/thread-list-filters.test.ts +434 -8
- package/src/__tests__/thread-poke.test.ts +545 -0
- package/src/__tests__/thread-resume.test.ts +10 -14
- package/src/__tests__/thread-show-status.test.ts +17 -29
- package/src/__tests__/thread-suspend-step.test.ts +8 -14
- package/src/__tests__/thread-suspended-display.test.ts +10 -22
- package/src/__tests__/thread.test.ts +4 -4
- package/src/__tests__/validate-semantic.test.ts +59 -31
- package/src/__tests__/workflow-list-recursive.test.ts +370 -0
- package/src/__tests__/workflow-resolution.test.ts +39 -21
- package/src/__tests__/workflow-show-resolution.test.ts +285 -0
- package/src/__tests__/workflow-validate.test.ts +806 -0
- package/src/background/background.ts +88 -6
- package/src/background/index.ts +2 -0
- package/src/background/types.ts +1 -0
- package/src/cli.ts +97 -47
- package/src/commands/config.ts +7 -35
- package/src/commands/prompt.ts +15 -2
- package/src/commands/setup.ts +29 -357
- package/src/commands/step.ts +339 -12
- package/src/commands/thread.ts +463 -169
- package/src/commands/workflow.ts +159 -4
- package/src/moderator/__tests__/evaluate.test.ts +34 -17
- package/src/moderator/evaluate.ts +5 -17
- package/src/moderator/index.ts +1 -6
- package/src/moderator/types.ts +6 -14
- package/src/schemas.ts +13 -3
- package/src/store.ts +86 -20
- package/src/validate-semantic.ts +109 -78
- package/src/validate.ts +27 -0
- package/dist/__tests__/setup-validate.test.d.ts +0 -2
- package/dist/__tests__/setup-validate.test.d.ts.map +0 -1
- package/dist/__tests__/setup-validate.test.js +0 -108
- package/dist/__tests__/setup-validate.test.js.map +0 -1
- package/src/__tests__/setup-validate.test.ts +0 -148
- /package/src/__tests__/fixtures/{e2e-mustache.mock.yaml → e2e-liquid.mock.yaml} +0 -0
|
@@ -5,6 +5,7 @@ import { describe, expect, test } from "vitest";
|
|
|
5
5
|
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
|
|
8
|
+
import { generateCliReference } from "@united-workforce/util";
|
|
8
9
|
import {
|
|
9
10
|
cmdPromptAdapterDeveloping,
|
|
10
11
|
cmdPromptBootstrap,
|
|
@@ -42,6 +43,24 @@ describe("prompt commands", () => {
|
|
|
42
43
|
expect(result.length).toBeGreaterThan(500);
|
|
43
44
|
});
|
|
44
45
|
|
|
46
|
+
test("prompt usage describes .workflows/ auto-discovery", () => {
|
|
47
|
+
const result = cmdPromptUsage();
|
|
48
|
+
expect(result).toContain(".workflows/");
|
|
49
|
+
expect(result).toContain("uwf thread start solve-issue");
|
|
50
|
+
expect(result.toLowerCase()).toContain("auto-discover");
|
|
51
|
+
expect(result.toLowerCase()).toContain("recommended");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("prompt cli-reference describes .workflows/ auto-discovery", () => {
|
|
55
|
+
const ref = generateCliReference();
|
|
56
|
+
expect(ref).toContain(".workflows/");
|
|
57
|
+
expect(ref.toLowerCase()).toContain("cwd upward");
|
|
58
|
+
expect(ref).toContain("workflow list");
|
|
59
|
+
expect(ref).toMatch(/CAS hash/i);
|
|
60
|
+
expect(ref).toMatch(/file path/i);
|
|
61
|
+
expect(ref).toMatch(/registry/i);
|
|
62
|
+
});
|
|
63
|
+
|
|
45
64
|
test("prompt workflow-authoring returns non-empty markdown string with frontmatter", () => {
|
|
46
65
|
const result = cmdPromptWorkflowAuthoring();
|
|
47
66
|
expect(typeof result).toBe("string");
|
|
@@ -56,6 +75,41 @@ describe("prompt commands", () => {
|
|
|
56
75
|
expect(result.length).toBeGreaterThan(500);
|
|
57
76
|
});
|
|
58
77
|
|
|
78
|
+
test("prompt workflow-authoring documents .workflows/ Placement section", () => {
|
|
79
|
+
const result = cmdPromptWorkflowAuthoring();
|
|
80
|
+
expect(result).toContain("## Placement");
|
|
81
|
+
expect(result).toContain(".workflows/");
|
|
82
|
+
expect(result).toContain("solve-issue.yaml");
|
|
83
|
+
expect(result.toLowerCase()).toContain("auto-discover");
|
|
84
|
+
expect(result.toLowerCase()).toContain("no workflow add");
|
|
85
|
+
// Placement must appear before Self-Testing
|
|
86
|
+
expect(result.indexOf("## Placement")).toBeLessThan(result.indexOf("## Self-Testing"));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("prompt workflow-authoring mentions .workflow/ as legacy fallback", () => {
|
|
90
|
+
const result = cmdPromptWorkflowAuthoring();
|
|
91
|
+
expect(result).toContain(".workflow/");
|
|
92
|
+
expect(result.toLowerCase()).toContain("legacy");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("prompt workflow-authoring documents Liquid filters with join example", () => {
|
|
96
|
+
const result = cmdPromptWorkflowAuthoring();
|
|
97
|
+
expect(result).toContain("| join");
|
|
98
|
+
expect(result.toLowerCase()).toContain("filter");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("prompt workflow-authoring documents Liquid loops with for example", () => {
|
|
102
|
+
const result = cmdPromptWorkflowAuthoring();
|
|
103
|
+
expect(result).toContain("{% for");
|
|
104
|
+
expect(result).toContain("{% endfor %}");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("prompt workflow-authoring uses Liquid terminology with no Mustache remnants", () => {
|
|
108
|
+
const result = cmdPromptWorkflowAuthoring();
|
|
109
|
+
expect(result.toLowerCase()).not.toContain("mustache");
|
|
110
|
+
expect(result.toLowerCase()).toContain("liquid");
|
|
111
|
+
});
|
|
112
|
+
|
|
59
113
|
test("prompt adapter-developing returns non-empty markdown string with frontmatter", () => {
|
|
60
114
|
const result = cmdPromptAdapterDeveloping();
|
|
61
115
|
expect(typeof result).toBe("string");
|
|
@@ -110,3 +164,346 @@ describe("prompt commands", () => {
|
|
|
110
164
|
expect(output).not.toContain("usage-reference");
|
|
111
165
|
});
|
|
112
166
|
});
|
|
167
|
+
|
|
168
|
+
describe("prompt adapter-developing — issue #214 v0.4 contract", () => {
|
|
169
|
+
const text = cmdPromptAdapterDeveloping();
|
|
170
|
+
const lower = text.toLowerCase();
|
|
171
|
+
|
|
172
|
+
// ── Item 1 — AgentOptions includes fork and cleanup ─────────────────
|
|
173
|
+
test("AgentOptions documents fork field with AgentForkFn | null", () => {
|
|
174
|
+
expect(text).toContain("AgentOptions");
|
|
175
|
+
expect(text).toMatch(/fork\s*:\s*AgentForkFn\s*\|\s*null/);
|
|
176
|
+
expect(text).toContain("AgentForkFn");
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("AgentOptions documents cleanup field with AgentCleanupFn | null", () => {
|
|
180
|
+
expect(text).toMatch(/cleanup\s*:\s*AgentCleanupFn\s*\|\s*null/);
|
|
181
|
+
expect(text).toContain("AgentCleanupFn");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test("explains that fork=null is acceptable for adapters that do not implement step ask", () => {
|
|
185
|
+
expect(lower).toMatch(/fork.*null.*(do(es)? not|no).*step ask|step ask.*fork.*null/);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("explains that cleanup runs after the agent completes (success or failure)", () => {
|
|
189
|
+
expect(lower).toMatch(
|
|
190
|
+
/cleanup.*(after|completes|invoked).*(release|i\/?o|resources|subprocess)/,
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// ── Item 2 — Public helpers table is complete ───────────────────────
|
|
195
|
+
test("helpers table lists buildRolePrompt", () => {
|
|
196
|
+
expect(text).toContain("buildRolePrompt");
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("helpers table lists buildContinuationPrompt", () => {
|
|
200
|
+
expect(text).toContain("buildContinuationPrompt");
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test("helpers table lists buildThreadProgress", () => {
|
|
204
|
+
expect(text).toContain("buildThreadProgress");
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("helpers table lists buildOutputFormatInstruction", () => {
|
|
208
|
+
expect(text).toContain("buildOutputFormatInstruction");
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test("helpers table lists buildSuspendOutput", () => {
|
|
212
|
+
expect(text).toContain("buildSuspendOutput");
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test("helpers table lists buildFrontmatterRetryPrompt", () => {
|
|
216
|
+
expect(text).toContain("buildFrontmatterRetryPrompt");
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("helpers table lists session-cache helpers", () => {
|
|
220
|
+
expect(text).toContain("getCachedSessionId");
|
|
221
|
+
expect(text).toContain("setCachedSessionId");
|
|
222
|
+
expect(text).toContain("getAskSessionId");
|
|
223
|
+
expect(text).toContain("setAskSessionId");
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// ── Item 3 — $SUSPEND coroutine yield ───────────────────────────────
|
|
227
|
+
test("documents $SUSPEND as coroutine yield with reason", () => {
|
|
228
|
+
expect(text).toContain("$SUSPEND");
|
|
229
|
+
expect(lower).toContain("coroutine");
|
|
230
|
+
expect(lower).toMatch(/reason/);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("documents buildSuspendOutput helper to emit a $SUSPEND output", () => {
|
|
234
|
+
expect(text).toContain("buildSuspendOutput");
|
|
235
|
+
expect(text).toMatch(/buildSuspendOutput\s*\(/);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test("documents trySuspendFastPath round-trip and SUSPEND_OUTPUT_SCHEMA", () => {
|
|
239
|
+
expect(text).toContain("trySuspendFastPath");
|
|
240
|
+
expect(text).toMatch(/SUSPEND_OUTPUT_SCHEMA|suspendOutput/);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("explains engine intercepts $SUSPEND before the moderator", () => {
|
|
244
|
+
expect(lower).toMatch(/intercept.*moderator|before the moderator|engine.*suspend/);
|
|
245
|
+
expect(lower).toMatch(/(thread|state).*suspend/);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test("notes that $SUSPEND is reserved and may be emitted by any role regardless of declared output", () => {
|
|
249
|
+
expect(lower).toMatch(/(any role|every role|regardless).*\$?suspend|reserved/);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// ── Item 4 — step ask adapter contract ──────────────────────────────
|
|
253
|
+
test("documents step ask --mode fork CLI contract for adapters", () => {
|
|
254
|
+
expect(text).toContain("--mode fork");
|
|
255
|
+
expect(text).toContain("--session");
|
|
256
|
+
expect(lower).toMatch(/fork.*(stdout|prints|return).*session/);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test("documents step ask --mode ask CLI contract", () => {
|
|
260
|
+
expect(text).toContain("--mode ask");
|
|
261
|
+
expect(text).toContain("--prompt");
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test("explains that fork: null adapters do not need to handle --mode fork/ask", () => {
|
|
265
|
+
expect(lower).toMatch(/fork\s*:\s*null.*(do(es)? not|no|not required).*(--mode|step ask)/);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
test("documents the per-stepHash ask-session cache key", () => {
|
|
269
|
+
expect(text).toContain("getAskSessionId");
|
|
270
|
+
expect(lower).toMatch(/(<step ?hash>|stephash).*:ask|ask.*cache|forked.*session.*step/);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// ── Item 5 — Adapter-owned LLM config ───────────────────────────────
|
|
274
|
+
test("explains engine config.yaml is LLM-free (no providers/models)", () => {
|
|
275
|
+
expect(lower).toMatch(/engine.*(config|llm-free|llm free)/);
|
|
276
|
+
expect(lower).toMatch(/no.*(provider|model|api[- ]?key)/);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
test("shows the adapter-owned config path convention ~/.uwf/agents/<name>.yaml", () => {
|
|
280
|
+
expect(text).toMatch(/~\/?\.uwf\/agents\/.+\.yaml/);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("shows a concrete example with provider.baseUrl, provider.apiKey, model", () => {
|
|
284
|
+
expect(text).toContain("baseUrl");
|
|
285
|
+
expect(text).toContain("apiKey");
|
|
286
|
+
expect(text).toMatch(/^\s*model\s*:/m);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
test("references storageRoot from AgentContext as the way to resolve the adapter config path", () => {
|
|
290
|
+
expect(text).toContain("storageRoot");
|
|
291
|
+
expect(lower).toMatch(/(storageroot|ctx\.storageroot).*(agents\/|config|yaml)/);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// ── Item 6 — previousAttempts and $status: error ────────────────────
|
|
295
|
+
test("documents the failed-step retry path with $status: error", () => {
|
|
296
|
+
expect(text).toMatch(/\$status\s*:\s*["']?error["']?/);
|
|
297
|
+
expect(text).toContain("ErrorOutputPayload");
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test("documents previousAttempts as CAS refs to prior failed StepNodes", () => {
|
|
301
|
+
expect(text).toContain("previousAttempts");
|
|
302
|
+
expect(lower).toMatch(/previousattempts.*(failed|prior|retry).*step/);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
test("explains thread head is NOT advanced on isError=true", () => {
|
|
306
|
+
expect(lower).toMatch(/(head|thread).*not.*advance|advance.*not|isError.*true/);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test("documents the @uwf/thread-failed variable for tracking failed attempts across runs", () => {
|
|
310
|
+
expect(text).toContain("@uwf/thread-failed/");
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test("explains MAX_FRONTMATTER_RETRIES (2) before persisting the error step", () => {
|
|
314
|
+
expect(text).toMatch(/2\s*(retries?|attempts?|frontmatter)/i);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// ── Item 7 — Realistic run() skeleton ───────────────────────────────
|
|
318
|
+
test("Quick Start run() builds prompt via helpers (not empty comments)", () => {
|
|
319
|
+
expect(text).toMatch(/buildRolePrompt|buildContinuationPrompt|buildThreadProgress/);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test("Quick Start run() returns all 5 AgentRunResult fields", () => {
|
|
323
|
+
expect(text).toContain("assembledPrompt");
|
|
324
|
+
expect(text).toContain("usage");
|
|
325
|
+
expect(text).toContain("detailHash");
|
|
326
|
+
expect(text).toContain("sessionId");
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
test("documents Usage type fields turns/inputTokens/outputTokens/duration", () => {
|
|
330
|
+
expect(text).toContain("inputTokens");
|
|
331
|
+
expect(text).toContain("outputTokens");
|
|
332
|
+
expect(text).toMatch(/turns/);
|
|
333
|
+
expect(text).toContain("duration");
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test("Quick Start example does NOT contain the placeholder stub `// 1. Build your prompt from ctx`", () => {
|
|
337
|
+
expect(text).not.toMatch(/\/\/\s*1\.\s*Build your prompt from ctx\b/);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// ── Item 8 — isFirstVisit ───────────────────────────────────────────
|
|
341
|
+
test("explains isFirstVisit semantics", () => {
|
|
342
|
+
expect(text).toContain("isFirstVisit");
|
|
343
|
+
expect(lower).toMatch(/isfirstvisit.*(true|false).*(role|appeared|run|history)/);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
test("explains the first-visit / re-entry branching pattern", () => {
|
|
347
|
+
expect(lower).toMatch(/(first[- ]?visit|isfirstvisit)[\s\S]*(re-?entry|resume)/);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// ── Item 9 — Fast path jargon explained ─────────────────────────────
|
|
351
|
+
test("introduces frontmatter extraction concept before the symbol name", () => {
|
|
352
|
+
const idxConcept = lower.search(
|
|
353
|
+
/frontmatter extraction|extract.*frontmatter|parse.*frontmatter/,
|
|
354
|
+
);
|
|
355
|
+
const idxSymbol = text.indexOf("tryFrontmatterFastPath");
|
|
356
|
+
if (idxSymbol !== -1) {
|
|
357
|
+
expect(idxConcept).toBeGreaterThanOrEqual(0);
|
|
358
|
+
expect(idxConcept).toBeLessThan(idxSymbol);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
test("does not use the bare term 'fast path' without an explanation in the surrounding 200 chars", () => {
|
|
363
|
+
const re = /fast[- ]?path/gi;
|
|
364
|
+
let m: RegExpExecArray | null = re.exec(text);
|
|
365
|
+
while (m !== null) {
|
|
366
|
+
const window = text.slice(Math.max(0, m.index - 200), m.index + 200).toLowerCase();
|
|
367
|
+
expect(window).toMatch(/extract|parse|attempt|try|interpret/);
|
|
368
|
+
m = re.exec(text);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// ── Item 10 — No undefined schema variables ─────────────────────────
|
|
373
|
+
test("does not reference an undefined `textSchema` in the code samples", () => {
|
|
374
|
+
const idx = text.indexOf("textSchema");
|
|
375
|
+
if (idx !== -1) {
|
|
376
|
+
const window = text.slice(Math.max(0, idx - 200), idx + 200);
|
|
377
|
+
expect(window).toMatch(/registerAgentSchemas|schemas\.text|putSchema|TEXT_SCHEMA/);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test("does not reference an undefined `detailSchema` in the code samples", () => {
|
|
382
|
+
const idx = text.indexOf("detailSchema");
|
|
383
|
+
if (idx !== -1) {
|
|
384
|
+
const window = text.slice(Math.max(0, idx - 200), idx + 200);
|
|
385
|
+
expect(window).toMatch(/registerAgentSchemas|schemas|putSchema/);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
test("Storing Session Detail section uses real APIs (storeBuiltinDetail / storeClaudeCodeDetail or store.cas.put with a registered schema)", () => {
|
|
390
|
+
expect(text).toMatch(
|
|
391
|
+
/store\.cas\.put|storeBuiltinDetail|storeClaudeCodeDetail|registerAgentSchemas/,
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// ── Cross-cutting structural tests ──────────────────────────────────
|
|
396
|
+
test("AdapterOutput JSON envelope (not just step hash) is documented as the stdout contract", () => {
|
|
397
|
+
expect(text).toContain("AdapterOutput");
|
|
398
|
+
expect(lower).toMatch(/json.*stdout|stdout.*json/);
|
|
399
|
+
expect(text).toContain("isError");
|
|
400
|
+
expect(text).toContain("errorMessage");
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
test("documents AgentContext storageRoot and casDir fields", () => {
|
|
404
|
+
expect(text).toContain("storageRoot");
|
|
405
|
+
expect(text).toContain("casDir");
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test("documents UWF_HOME / OCAS_HOME env propagation from CLI to adapter", () => {
|
|
409
|
+
expect(text).toContain("UWF_HOME");
|
|
410
|
+
expect(text).toContain("OCAS_HOME");
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
test("Existing Adapters table still lists hermes, builtin, claude-code", () => {
|
|
414
|
+
expect(text).toContain("uwf-hermes");
|
|
415
|
+
expect(text).toContain("uwf-builtin");
|
|
416
|
+
expect(text).toContain("uwf-claude-code");
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test("Checklist now includes fork, cleanup, $SUSPEND, and adapter-owned LLM config items", () => {
|
|
420
|
+
const checklistIdx = text.search(/##\s+Checklist/);
|
|
421
|
+
expect(checklistIdx).toBeGreaterThan(-1);
|
|
422
|
+
const checklist = text.slice(checklistIdx);
|
|
423
|
+
expect(checklist).toContain("fork");
|
|
424
|
+
expect(checklist).toContain("cleanup");
|
|
425
|
+
expect(checklist).toContain("$SUSPEND");
|
|
426
|
+
expect(checklist.toLowerCase()).toMatch(/llm config|agents\/.+\.yaml|adapter-owned/);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
describe("prompt workflow-authoring — issue #226 edge location field", () => {
|
|
431
|
+
const text = cmdPromptWorkflowAuthoring();
|
|
432
|
+
const lower = text.toLowerCase();
|
|
433
|
+
|
|
434
|
+
// ── Group 1 — Field documentation ───────────────────────────────────
|
|
435
|
+
test("documents the location field on graph edges", () => {
|
|
436
|
+
expect(text).toMatch(/^\s*\|\s*`?location`?\s*\|/m);
|
|
437
|
+
expect(text).toMatch(/location[\s\S]{0,200}(working directory|cwd)/i);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
test("documents location as optional with null fallback", () => {
|
|
441
|
+
expect(lower).toMatch(/location[\s\S]{0,300}(null|omitted|optional|default|fall(s| ?back))/i);
|
|
442
|
+
expect(lower).toMatch(/(thread.*cwd|start.*cwd|creation cwd|thread['']?s cwd)/);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
test("documents Liquid template support for location", () => {
|
|
446
|
+
expect(text).toMatch(/location[\s\S]{0,400}\{\{\s*[a-zA-Z_]\w*\s*\}\}/);
|
|
447
|
+
expect(lower).toMatch(/location[\s\S]{0,300}liquid/);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// ── Group 2 — Inheritance chain ─────────────────────────────────────
|
|
451
|
+
test("documents the cwd inheritance chain end-to-end", () => {
|
|
452
|
+
expect(text).toContain("--cwd");
|
|
453
|
+
expect(text).toMatch(/StartNodePayload\.cwd|start(\.|node\.)?cwd|thread start cwd/i);
|
|
454
|
+
expect(text).toMatch(/Target\.location|edge\s+location|location\s+(field|override)/i);
|
|
455
|
+
expect(text).toMatch(/StepRecord\.cwd|StepNodePayload\.cwd|step(\.|node\.)?cwd|step.*cwd/i);
|
|
456
|
+
const flagIdx = text.indexOf("--cwd");
|
|
457
|
+
const startIdx = text.search(/StartNodePayload\.cwd|start(\.|node\.)?cwd|thread start cwd/i);
|
|
458
|
+
const locIdx = text.search(/Target\.location|edge\s+location|location\s+(field|override)/i);
|
|
459
|
+
const stepIdx = text.search(/StepRecord\.cwd|StepNodePayload\.cwd|step(\.|node\.)?cwd/i);
|
|
460
|
+
expect(flagIdx).toBeGreaterThanOrEqual(0);
|
|
461
|
+
expect(startIdx).toBeGreaterThan(flagIdx);
|
|
462
|
+
expect(locIdx).toBeGreaterThan(startIdx);
|
|
463
|
+
expect(stepIdx).toBeGreaterThan(locIdx);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
test("explains location override is per-step (not per-thread)", () => {
|
|
467
|
+
expect(lower).toMatch(/(each|per).?step|override.*per.*step|step['']?s (working|cwd)/);
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// ── Group 3 — Realistic cross-cwd example ───────────────────────────
|
|
471
|
+
test("includes a YAML example showing location on an edge", () => {
|
|
472
|
+
const yamlBlocks = text.match(/```yaml[\s\S]*?```/g) ?? [];
|
|
473
|
+
const hasLocationEdge = yamlBlocks.some(
|
|
474
|
+
(b) => /graph\s*:/.test(b) && /^\s*location\s*:/m.test(b),
|
|
475
|
+
);
|
|
476
|
+
expect(hasLocationEdge).toBe(true);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
test("example demonstrates cross-cwd execution with a Liquid-templated path", () => {
|
|
480
|
+
const yamlBlocks = text.match(/```yaml[\s\S]*?```/g) ?? [];
|
|
481
|
+
const hasCrossCwdExample = yamlBlocks.some((b) =>
|
|
482
|
+
/location\s*:\s*['"]?\{\{\s*[a-zA-Z_]\w*\s*\}\}/m.test(b),
|
|
483
|
+
);
|
|
484
|
+
expect(hasCrossCwdExample).toBe(true);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
test("example narrates a realistic scenario", () => {
|
|
488
|
+
expect(lower).toMatch(
|
|
489
|
+
/(clone|checkout|dispatch|cross[- ]repo|different (repo|directory|working directory|cwd))/,
|
|
490
|
+
);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
// ── Group 4 — Structural placement ──────────────────────────────────
|
|
494
|
+
test("location documentation appears under the Graph Routing section", () => {
|
|
495
|
+
const graphIdx = text.indexOf("## Graph Routing");
|
|
496
|
+
expect(graphIdx).toBeGreaterThanOrEqual(0);
|
|
497
|
+
const after = text.slice(graphIdx);
|
|
498
|
+
const localLocIdx = after.search(/\blocation\b/i);
|
|
499
|
+
expect(localLocIdx).toBeGreaterThanOrEqual(0);
|
|
500
|
+
const nextHeadingIdx = after.slice(1).search(/\n## /);
|
|
501
|
+
expect(localLocIdx).toBeLessThan(nextHeadingIdx === -1 ? after.length : nextHeadingIdx + 1);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
test("Target field table still includes role and prompt alongside location", () => {
|
|
505
|
+
expect(text).toMatch(/\|\s*`?role`?\s*\|/m);
|
|
506
|
+
expect(text).toMatch(/\|\s*`?prompt`?\s*\|/m);
|
|
507
|
+
expect(text).toMatch(/\|\s*`?location`?\s*\|/m);
|
|
508
|
+
});
|
|
509
|
+
});
|
|
@@ -37,7 +37,7 @@ describe("resolveHeadHash", () => {
|
|
|
37
37
|
const uwf = await createUwfStore(tmpDir);
|
|
38
38
|
const headHash = (await uwf.store.cas.put(uwf.schemas.text, "completed-head")) as CasRef;
|
|
39
39
|
setThread(uwf.varStore, threadId, createThreadIndexEntry(headHash));
|
|
40
|
-
completeThread(uwf.varStore, threadId, "
|
|
40
|
+
completeThread(uwf.varStore, threadId, "end");
|
|
41
41
|
|
|
42
42
|
const result = await resolveHeadHash(tmpDir, threadId);
|
|
43
43
|
|
|
@@ -71,13 +71,13 @@ describe("resolveHeadHash", () => {
|
|
|
71
71
|
const hash3 = (await uwf.store.cas.put(uwf.schemas.text, "hash-thread3")) as CasRef;
|
|
72
72
|
|
|
73
73
|
setThread(uwf.varStore, threadId1, createThreadIndexEntry(hash1));
|
|
74
|
-
completeThread(uwf.varStore, threadId1, "
|
|
74
|
+
completeThread(uwf.varStore, threadId1, "end");
|
|
75
75
|
|
|
76
76
|
setThread(uwf.varStore, threadId2, createThreadIndexEntry(hash2));
|
|
77
|
-
completeThread(uwf.varStore, threadId2, "
|
|
77
|
+
completeThread(uwf.varStore, threadId2, "end");
|
|
78
78
|
|
|
79
79
|
setThread(uwf.varStore, threadId3, createThreadIndexEntry(hash3));
|
|
80
|
-
completeThread(uwf.varStore, threadId3, "
|
|
80
|
+
completeThread(uwf.varStore, threadId3, "end");
|
|
81
81
|
|
|
82
82
|
const result = await resolveHeadHash(tmpDir, threadId2);
|
|
83
83
|
|
|
@@ -59,7 +59,7 @@ describe("_printAgentMenu", () => {
|
|
|
59
59
|
|
|
60
60
|
// ─── cmdSetup agent config ───────────────────────────────────────────────────
|
|
61
61
|
|
|
62
|
-
describe("cmdSetup agent configuration", () => {
|
|
62
|
+
describe("cmdSetup agent configuration (engine config is LLM-free, issue #143)", () => {
|
|
63
63
|
let storageRoot: string;
|
|
64
64
|
|
|
65
65
|
beforeEach(async () => {
|
|
@@ -71,33 +71,8 @@ describe("cmdSetup agent configuration", () => {
|
|
|
71
71
|
await rm(storageRoot, { recursive: true, force: true });
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
const baseArgs = () => ({
|
|
75
|
-
provider: "testprovider",
|
|
76
|
-
baseUrl: "https://api.test.com/v1",
|
|
77
|
-
apiKey: "sk-test",
|
|
78
|
-
model: "test-model",
|
|
79
|
-
storageRoot,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("defaults to hermes agent when no agent specified", async () => {
|
|
83
|
-
vi.spyOn(globalThis, "fetch").mockResolvedValue(
|
|
84
|
-
new Response(JSON.stringify({}), { status: 200 }),
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const result = await cmdSetup(baseArgs());
|
|
88
|
-
|
|
89
|
-
expect(result.defaultAgent).toBe("hermes");
|
|
90
|
-
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
91
|
-
expect(config.agents.hermes).toEqual({ command: "uwf-hermes", args: [] });
|
|
92
|
-
expect(config.defaultAgent).toBe("hermes");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
74
|
test("writes specified agent as default", async () => {
|
|
96
|
-
|
|
97
|
-
new Response(JSON.stringify({}), { status: 200 }),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const result = await cmdSetup({ ...baseArgs(), agent: "claude-code" });
|
|
75
|
+
const result = await cmdSetup({ agent: "claude-code", storageRoot });
|
|
101
76
|
|
|
102
77
|
expect(result.defaultAgent).toBe("claude-code");
|
|
103
78
|
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
@@ -106,14 +81,8 @@ describe("cmdSetup agent configuration", () => {
|
|
|
106
81
|
});
|
|
107
82
|
|
|
108
83
|
test("preserves existing agents when adding new one", async () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
// First setup with hermes
|
|
114
|
-
await cmdSetup(baseArgs());
|
|
115
|
-
// Second setup with claude-code
|
|
116
|
-
await cmdSetup({ ...baseArgs(), agent: "claude-code" });
|
|
84
|
+
await cmdSetup({ agent: "hermes", storageRoot });
|
|
85
|
+
await cmdSetup({ agent: "claude-code", storageRoot });
|
|
117
86
|
|
|
118
87
|
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
119
88
|
expect(config.agents.hermes).toBeDefined();
|
|
@@ -122,25 +91,17 @@ describe("cmdSetup agent configuration", () => {
|
|
|
122
91
|
});
|
|
123
92
|
|
|
124
93
|
test("updates defaultAgent on re-run with different agent", async () => {
|
|
125
|
-
|
|
126
|
-
new Response(JSON.stringify({}), { status: 200 }),
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
await cmdSetup(baseArgs());
|
|
94
|
+
await cmdSetup({ agent: "hermes", storageRoot });
|
|
130
95
|
const config1 = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
131
96
|
expect(config1.defaultAgent).toBe("hermes");
|
|
132
97
|
|
|
133
|
-
await cmdSetup({
|
|
98
|
+
await cmdSetup({ agent: "builtin", storageRoot });
|
|
134
99
|
const config2 = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
135
100
|
expect(config2.defaultAgent).toBe("builtin");
|
|
136
101
|
});
|
|
137
102
|
|
|
138
103
|
test("normalizes agent name with uwf- prefix to bare name", async () => {
|
|
139
|
-
|
|
140
|
-
new Response(JSON.stringify({}), { status: 200 }),
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
const result = await cmdSetup({ ...baseArgs(), agent: "uwf-hermes" });
|
|
104
|
+
const result = await cmdSetup({ agent: "uwf-hermes", storageRoot });
|
|
144
105
|
|
|
145
106
|
expect(result.defaultAgent).toBe("hermes");
|
|
146
107
|
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
@@ -151,11 +112,7 @@ describe("cmdSetup agent configuration", () => {
|
|
|
151
112
|
});
|
|
152
113
|
|
|
153
114
|
test("normalizes uwf-claude-code to claude-code", async () => {
|
|
154
|
-
|
|
155
|
-
new Response(JSON.stringify({}), { status: 200 }),
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
const result = await cmdSetup({ ...baseArgs(), agent: "uwf-claude-code" });
|
|
115
|
+
const result = await cmdSetup({ agent: "uwf-claude-code", storageRoot });
|
|
159
116
|
|
|
160
117
|
expect(result.defaultAgent).toBe("claude-code");
|
|
161
118
|
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
@@ -164,4 +121,22 @@ describe("cmdSetup agent configuration", () => {
|
|
|
164
121
|
// Verify no duplicate uwf- prefix
|
|
165
122
|
expect(config.agents["uwf-claude-code"]).toBeUndefined();
|
|
166
123
|
});
|
|
124
|
+
|
|
125
|
+
test("rewrite drops legacy provider/model fields from existing config", async () => {
|
|
126
|
+
// First create a config that contains legacy LLM fields
|
|
127
|
+
const { writeFileSync, mkdirSync } = await import("node:fs");
|
|
128
|
+
mkdirSync(storageRoot, { recursive: true });
|
|
129
|
+
writeFileSync(
|
|
130
|
+
join(storageRoot, "config.yaml"),
|
|
131
|
+
"providers:\n openai: { baseUrl: x, apiKey: y }\nmodels:\n default: { provider: openai, name: gpt-4o }\ndefaultModel: default\nagents:\n hermes: { command: uwf-hermes, args: [] }\ndefaultAgent: hermes\n",
|
|
132
|
+
"utf8",
|
|
133
|
+
);
|
|
134
|
+
await cmdSetup({ agent: "hermes", storageRoot });
|
|
135
|
+
const config = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
|
|
136
|
+
expect(config.providers).toBeUndefined();
|
|
137
|
+
expect(config.models).toBeUndefined();
|
|
138
|
+
expect(config.defaultModel).toBeUndefined();
|
|
139
|
+
expect(config.agents.hermes).toEqual({ command: "uwf-hermes", args: [] });
|
|
140
|
+
expect(config.defaultAgent).toBe("hermes");
|
|
141
|
+
});
|
|
167
142
|
});
|