waygraph 0.15.52 → 0.15.53

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.
Files changed (59) hide show
  1. package/README.md +8 -1
  2. package/dist/analysis/map-check.d.ts +3 -2
  3. package/dist/cli/flags.js +3 -1
  4. package/dist/cli/usage.js +4 -1
  5. package/dist/cli.js +4 -1
  6. package/dist/commands/agent-dive-scaffold.d.ts +0 -20
  7. package/dist/commands/agent-dive-scaffold.js +3 -3
  8. package/dist/commands/init.js +1 -1
  9. package/dist/commands/upgrade.d.ts +1 -1
  10. package/dist/commands/upgrade.js +7 -1
  11. package/dist/config.d.ts +53 -19
  12. package/dist/config.js +55 -13
  13. package/dist/core/block.d.ts +7 -2
  14. package/dist/core/block.js +7 -3
  15. package/dist/core/engine.d.ts +2 -0
  16. package/dist/core/engine.js +3 -1
  17. package/dist/core/flow.d.ts +10 -0
  18. package/dist/core/flow.js +32 -8
  19. package/dist/core/map-builder.d.ts +27 -1
  20. package/dist/core/map-builder.js +42 -4
  21. package/dist/highlights/demo-pace.d.ts +0 -1
  22. package/dist/highlights/demo-pace.js +24 -3
  23. package/dist/index.d.ts +2 -2
  24. package/dist/pilot-overlay/action-ring.d.ts +0 -9
  25. package/dist/pilot-overlay/action-ring.js +1 -1
  26. package/dist/pilot-overlay/panel.d.ts +2 -1
  27. package/dist/runner/interaction-patch.js +32 -1
  28. package/dist/runner/main.js +5 -2
  29. package/dist/runner/step-mode.js +10 -4
  30. package/dist/session/auto-explore.d.ts +2 -1
  31. package/dist/session/auto-session-ipc.d.ts +1 -2
  32. package/dist/session/auto-session-ipc.js +1 -1
  33. package/dist/session/block-inject.d.ts +0 -13
  34. package/dist/session/block-inject.js +3 -3
  35. package/dist/session/pilot.d.ts +0 -2
  36. package/dist/session/pilot.js +1 -2
  37. package/dist/traverse/coverage.d.ts +0 -4
  38. package/dist/traverse/coverage.js +1 -1
  39. package/dist/types.d.ts +1 -1
  40. package/package.json +11 -5
  41. package/templates/scaffold/README.md +1 -1
  42. package/templates/scaffold/STRUCTURE.md +5 -2
  43. package/templates/scaffold/config/waygraph.config.ts +24 -5
  44. package/templates/scaffold/package.json +6 -6
  45. package/templates/scaffold/src/flows/(external)/hoppscotch/auth.flow.ts +36 -0
  46. package/templates/scaffold/src/flows/(external)/hoppscotch/get.flow.ts +24 -0
  47. package/templates/scaffold/src/flows/(external)/hoppscotch/post.flow.ts +34 -0
  48. package/templates/scaffold/src/flows/(user-stories)/email-verification.flow.ts +47 -0
  49. package/templates/scaffold/src/flows/README.md +35 -14
  50. package/templates/scaffold/src/flows/{shop.flow.ts → home/cart.flow.ts} +18 -17
  51. package/templates/scaffold/src/flows/{example.flow.ts → home/hello.flow.ts} +12 -13
  52. package/templates/scaffold/tests/example.spec.ts +5 -5
  53. package/templates/scaffold/tests/hoppscotch.spec.ts +3 -3
  54. package/templates/scaffold/tests/mail-verify.spec.ts +7 -7
  55. package/templates/skills/waygraph-convention.skill.md +14 -6
  56. package/templates/scaffold/src/flows/hoppscotch-auth.flow.ts +0 -35
  57. package/templates/scaffold/src/flows/hoppscotch-get.flow.ts +0 -23
  58. package/templates/scaffold/src/flows/hoppscotch-post.flow.ts +0 -33
  59. package/templates/scaffold/src/flows/mail-verify.flow.ts +0 -46
@@ -68,10 +68,14 @@ against a live site, use `--skill-pilot-blind`.
68
68
 
69
69
  ## Flows, stubs and config (the scaffold's shape)
70
70
 
71
- - **Build flows with `map()`** (`.start().gotoPage(Nav).method(B).assert(A).end({ ... })`; `.gotoExternal` for another origin),
72
- not a raw `defineFlow([start, ...])` array. Flow settings go in `.end`'s options:
73
- `.end({ title: "Shop", memStub: true, sessionReset: true })`. Never `withMemStub(withTitle(withSessionReset(...)))`.
74
- (`defineFlow(blocks, options)` takes the same options.)
71
+ - **Build flows with `map()`** (`engine.map({ memStub }).start().gotoPage(Nav).method(B, { pace }).assert(A).end()`;
72
+ `.gotoExternal` for another origin), never a raw `defineFlow([start, ...])`. Flow settings go in `map({ … })` before the chain
73
+ and `.end()` takes nothing. The flow's title is `ctx.title(...)` in a stub. **Nest flows with `.flow(sub, { reset: true })`**,
74
+ not `chainFlow` / `withSessionReset`. No `withMemStub(withTitle(...))` wrappers.
75
+ - **`src/flows/` holds use cases and mirrors the front end's endpoints**: a folder per page (`flows/auth/login/`) with one
76
+ file per scenario named for its outcome (`success.flow.ts`, `wrong-password.flow.ts`, `empty-fields.flow.ts`), and
77
+ `(user-stories)/` (any `(group)`) for flows that cross pages. Export names are `<page><Outcome>Flow`. Not one file per
78
+ Block chain, not a flat folder of unrelated flows.
75
79
  - **Blocks carry no stubs; the flow does.** Demo highlights are ctx stubs chained on the Block where the flow uses it:
76
80
  `AddItemBlock.stubAfter((ctx) => { ctx.ring("cart", { selector: DemoSel.cartCount, label: "AC · item in cart" }); })`.
77
81
  Not a static `withHighlightFixtures({ "add-item": { stubAfter: {...} } })` map, and not an inline
@@ -79,19 +83,23 @@ against a live site, use `--skill-pilot-blind`.
79
83
  - **Reading a value into `mem` happens in `act`** (`mem.set(Key, value)`), like Mailpit's `extract-email-link`.
80
84
  `observe` is only for a Block that branches (it feeds `resolve`); an empty `act(){}` plus an `observe` that
81
85
  writes `mem` is a misuse.
86
+ - **Demo pace is a map option or config, never a wrapper.** `.method(SetBearerTokenBlock, { pace: "blitz" })` speeds one step,
87
+ `map({ demoPace: "fast" })` a flow, `demo: { pace, typingMs, slowMo }` in the config the whole project. Not `withBlockPace(...)`.
82
88
  - **Per-environment values** (a different `baseUrl` for staging) come from `.env` files read in the config function:
83
89
  `defineConfig(({ env }) => ({ baseUrl: env.BASE_URL }))`; `--env staging` loads `.env.staging`. Never edit the config to switch.
90
+ - **More than one config** (staging, another app) is another file, `config/waygraph.<name>.config.ts`, chosen with `--config <name>`.
91
+ The engine a config exports, and every engine in a flow, follows the selected config.
84
92
  - **A browser dialog (`confirm`, `beforeunload`) is answered with `withDialog(block, { accept, into })`**, not inside the
85
93
  Block's `act`; the click Block stays a plain click.
86
94
  - **Project settings live in `config/waygraph.config.ts`** (`defineConfig({ baseUrl, testDir, webServer,
87
- extensions, playwright: {...} })`). Flows import it and build the Engine from it (`new Engine(config)`); a project needs no
95
+ extensions, playwright: {...} })`). The config file also exports `engine = new Engine(config)`; flows `import { engine } from "../../config/waygraph.config.js"`; a project needs no
88
96
  `playwright.config.ts` - `waygraph test` builds one from it. A leftover `playwright.config.*` is deprecated.
89
97
  - **Another origin the test needs is a Map external** under `src/map/(external)/<tool>/`. For REST API
90
98
  tests, `(external)/hoppscotch` (list `extensions: ["hoppscotch"]` in the config) drives hoppscotch.io's client
91
99
  with the extension, so requests skip CORS: `set-method`, `set-url`, `set-headers`, `set-json-body`,
92
100
  `send-request`, `assert-status`, `read-response-body`, `assert-response-body`.
93
101
  - **Updating an older project:** `npm install waygraph@latest`, then `waygraph upgrade` (dry run) to see new
94
- and differing scaffold files; copy the paths you want with `--apply`.
102
+ and differing scaffold files; copy the paths you want with `--apply`. `waygraph upgrade --skills` refreshes these skills.
95
103
 
96
104
  ## Block kinds (file convention)
97
105
 
@@ -1,35 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetQueryParamsBlock } from "../map/(external)/hoppscotch/_methods/set-query-params.method.block.js";
7
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
8
- import { SetBearerTokenBlock } from "../map/(external)/hoppscotch/_methods/set-bearer-token.method.block.js";
9
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
10
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
11
- import { ReadResponseHeadersBlock } from "../map/(external)/hoppscotch/_methods/read-response-headers.method.block.js";
12
- import { AssertResponseHeaderBlock } from "../map/(external)/hoppscotch/_methods/assert-response-header.method.block.js";
13
- import { ReadResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/read-response-body.method.block.js";
14
- import { AssertResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/assert-response-body.method.block.js";
15
- import "../map/(external)/hoppscotch/_page.block.js";
16
-
17
- const engine = new Engine(config);
18
-
19
- /** GET with query params and a bearer token, check the status, that the API received them, and a response header. Needs `extensions: ["hoppscotch"]`. */
20
- export const hoppscotchAuthFlow = engine
21
- .map()
22
- .start()
23
- .gotoExternal(NavHoppscotchSettingsBlock)
24
- .method(PickExtensionInterceptorBlock)
25
- .gotoExternal(NavHoppscotchRestBlock)
26
- .method(SetUrlBlock)
27
- .method(SetQueryParamsBlock)
28
- .method(SetBearerTokenBlock)
29
- .method(SendRequestBlock)
30
- .assert(AssertStatusBlock)
31
- .method(ReadResponseBodyBlock)
32
- .assert(AssertResponseBodyBlock)
33
- .method(ReadResponseHeadersBlock)
34
- .assert(AssertResponseHeaderBlock)
35
- .end({ title: "Scaffold: Hoppscotch GET with query params and bearer token" });
@@ -1,23 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
7
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
8
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
9
- import "../map/(external)/hoppscotch/_page.block.js";
10
-
11
- const engine = new Engine(config);
12
-
13
- /** GET a URL and check the status. Needs `extensions: ["hoppscotch"]` in waygraph.config.ts. */
14
- export const hoppscotchGetFlow = engine
15
- .map()
16
- .start()
17
- .gotoExternal(NavHoppscotchSettingsBlock)
18
- .method(PickExtensionInterceptorBlock)
19
- .gotoExternal(NavHoppscotchRestBlock)
20
- .method(SetUrlBlock)
21
- .method(SendRequestBlock)
22
- .assert(AssertStatusBlock)
23
- .end({ title: "Scaffold: Hoppscotch GET" });
@@ -1,33 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetMethodBlock } from "../map/(external)/hoppscotch/_methods/set-method.method.block.js";
7
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
8
- import { SetHeadersBlock } from "../map/(external)/hoppscotch/_methods/set-headers.method.block.js";
9
- import { SetJsonBodyBlock } from "../map/(external)/hoppscotch/_methods/set-json-body.method.block.js";
10
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
11
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
12
- import { ReadResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/read-response-body.method.block.js";
13
- import { AssertResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/assert-response-body.method.block.js";
14
- import "../map/(external)/hoppscotch/_page.block.js";
15
-
16
- const engine = new Engine(config);
17
-
18
- /** POST JSON with a header, check the status and the response body. Needs `extensions: ["hoppscotch"]`. */
19
- export const hoppscotchPostFlow = engine
20
- .map()
21
- .start()
22
- .gotoExternal(NavHoppscotchSettingsBlock)
23
- .method(PickExtensionInterceptorBlock)
24
- .gotoExternal(NavHoppscotchRestBlock)
25
- .method(SetMethodBlock)
26
- .method(SetUrlBlock)
27
- .method(SetHeadersBlock)
28
- .method(SetJsonBodyBlock)
29
- .method(SendRequestBlock)
30
- .assert(AssertStatusBlock)
31
- .method(ReadResponseBodyBlock)
32
- .assert(AssertResponseBodyBlock)
33
- .end({ title: "Scaffold: Hoppscotch POST with header and JSON body" });
@@ -1,46 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavMailpitInboxBlock } from "../map/(external)/mailpit/_nav.block.js";
4
- import { AssertEmailReceivedBlock } from "../map/(external)/mailpit/_methods/assert-email-received.method.block.js";
5
- import { OpenMessageBlock } from "../map/(external)/mailpit/_methods/open-message.method.block.js";
6
- import { AssertEmailContentBlock } from "../map/(external)/mailpit/_methods/assert-email-content.method.block.js";
7
- import { ExtractEmailLinkBlock } from "../map/(external)/mailpit/_methods/extract-email-link.method.block.js";
8
- import { NavVerificationLinkBlock } from "../map/(app_base)/home/nav-verification-link.block.js";
9
- import "../map/(external)/mailpit/_page.block.js";
10
- import { MailpitSel } from "../map/(external)/mailpit/_sel.js";
11
-
12
- const engine = new Engine(config);
13
-
14
- /** Needs a Mailpit at WAYGRAPH_MAIL_URL (default http://127.0.0.1:8025); tests/mail-verify.spec.ts starts one. */
15
- export const mailVerifyFlow = engine
16
- .map()
17
- .start()
18
- .gotoExternal(NavMailpitInboxBlock)
19
- .assert(
20
- AssertEmailReceivedBlock.stubAfter((ctx) => {
21
- ctx.ring("note", {
22
- selector: MailpitSel.messageRow,
23
- label: "AC · email arrived",
24
- detail: "Confirmed before opening anything.",
25
- tag: "AC",
26
- });
27
- }),
28
- )
29
- .method(OpenMessageBlock)
30
- .assert(
31
- AssertEmailContentBlock.stubAfter((ctx) => {
32
- ctx.ring("note", { selector: MailpitSel.previewIframe, label: "AC · email body matches expected copy", tag: "AC" });
33
- }),
34
- )
35
- .method(
36
- ExtractEmailLinkBlock.stubAfter((ctx) => {
37
- ctx.ring("note", {
38
- selector: MailpitSel.previewIframe,
39
- label: "AC · link found",
40
- detail: "Read from the message preview iframe.",
41
- tag: "AC",
42
- });
43
- }),
44
- )
45
- .gotoPage(NavVerificationLinkBlock)
46
- .end({ title: "Scaffold: Cross-origin mail verification (QA-rich)" });