@keystrokehq/cli 0.0.83 → 0.0.85
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.
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Test through `executeWorkflow` from `@keystrokehq/workflow` — it parses input/output and wires up the action runner. **Never call `workflow.run(...)` directly**: that skips Zod validation and has no action context, so any action step throws.
|
|
6
6
|
|
|
7
|
+
`executeWorkflow` runs the workflow via the durable replay engine and resolves to a `ReplayResult`: `{ status: "completed", output }`, `{ status: "failed", error }`, or `{ status: "suspended", items }` (when the body hits `ctx.sleep`/`ctx.hook`). Assert on `status` and read `output`.
|
|
8
|
+
|
|
7
9
|
`keystroke init` scaffolds Vitest and a starter test (e.g. `src/workflows/greeting.test.ts`):
|
|
8
10
|
|
|
9
11
|
```ts
|
|
@@ -14,7 +16,7 @@ import greeting from "./greeting";
|
|
|
14
16
|
describe("greeting workflow", () => {
|
|
15
17
|
it("returns a greeting for a name", async () => {
|
|
16
18
|
const result = await executeWorkflow(greeting, { name: "Ada" });
|
|
17
|
-
expect(result).toEqual({ greeting: "Hello, Ada!" });
|
|
19
|
+
expect(result).toEqual({ status: "completed", output: { greeting: "Hello, Ada!" } });
|
|
18
20
|
});
|
|
19
21
|
});
|
|
20
22
|
```
|
|
@@ -35,7 +37,10 @@ it("runs the pipeline", async () => {
|
|
|
35
37
|
company: "Acme",
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
expect(result.
|
|
40
|
+
expect(result.status).toBe("completed");
|
|
41
|
+
if (result.status === "completed") {
|
|
42
|
+
expect(result.output).toMatchObject({ channel: "#signups" });
|
|
43
|
+
}
|
|
39
44
|
});
|
|
40
45
|
```
|
|
41
46
|
|
|
@@ -62,7 +67,10 @@ it("drafts without calling the agent", async () => {
|
|
|
62
67
|
{ runId, actionStore: store },
|
|
63
68
|
);
|
|
64
69
|
|
|
65
|
-
expect(result.
|
|
70
|
+
expect(result.status).toBe("completed");
|
|
71
|
+
if (result.status === "completed") {
|
|
72
|
+
expect(result.output).toMatchObject({ brief: "stubbed brief" });
|
|
73
|
+
}
|
|
66
74
|
});
|
|
67
75
|
```
|
|
68
76
|
|