waygraph 0.10.4 → 0.10.5

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  A typed graph of reusable Blocks for driving a browser through E2E flows, in place of a
4
4
  flat pile of ad hoc helper functions.
5
5
 
6
- **Current:** `0.10.4` — CLI less-is-more (`auto` / `demo` / `run` + `.flow.ts` paths). Page hubs still as in 0.9.0.
6
+ **Current:** `0.10.5` — CLI less-is-more (`auto` / `demo` / `run` + `.flow.ts` paths). Page hubs still as in 0.9.0.
7
7
 
8
8
  This repo is the `waygraph` npm package itself. The full live **Sauce Demo** example
9
9
  (Page inventory hub, Effect Add/Remove, MemNav Open details, `waygraph auto`) ships
@@ -262,12 +262,13 @@ Deliberately **not yet implemented** (tracked on the project board):
262
262
  Mermaid) is `waygraph graph [project]` (`--mermaid`). Unattended JSON execution is
263
263
  `chain` + `WAYGRAPH_JSON=1`.
264
264
 
265
- **Friendly demo / run / auto (0.10.4 — flows are files):**
265
+ **Friendly demo / run / auto (0.10.5 — flows are files):**
266
266
 
267
267
  | Want | Command |
268
268
  |------|---------|
269
269
  | List flows | `waygraph list` → `src/flows/shop.flow.ts shopFlow` |
270
270
  | Run by file | `waygraph run src/flows/shop.flow.ts --data '{…}'` |
271
+ | Same via `auto` | `waygraph auto src/flows/shop.flow.ts --data '{…}'` |
271
272
  | Run by export | `waygraph run --blocks shopFlow` |
272
273
  | Manual watch | `waygraph demo src/flows/shop.flow.ts` |
273
274
  | Auto-advance | `waygraph demo --blocks shopFlow --auto-next` |
@@ -278,6 +279,7 @@ Mermaid) is `waygraph graph [project]` (`--mermaid`). Unattended JSON execution
278
279
  | Path-find | `waygraph auto --blocks LoginPage OrderComplete` |
279
280
 
280
281
  `--blocks` / positional accepts a Flow export, a `.flow.ts` path, or `"a then b"`.
282
+ `auto <file.flow.ts>` **runs** that flow (same as `run`); bare `auto` still explores.
281
283
  `--auto-next` (alias `--autoplay`) = panel Auto-advance. `--auto-play-video` is **demo only**.
282
284
  `chain` remains a compat alias for `run --blocks` / `auto --blocks`.
283
285
 
package/dist/cli.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * waygraph CLI -- tooling around this same package's engine.
4
4
  *
5
5
  * Primary verbs (less is more):
6
- * auto Explore picker; `--blocks From To` = graph path-find + run
6
+ * auto Explore picker; `.flow.ts` / `--blocks From To` = run that path
7
7
  * demo Watch (step overlay); `--blocks` `--data` `--auto-next` `--auto-play-video`
8
8
  * run Execute; `--blocks` `--data` `--non-headless` `--video`
9
9
  *
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * waygraph CLI -- tooling around this same package's engine.
4
4
  *
5
5
  * Primary verbs (less is more):
6
- * auto Explore picker; `--blocks From To` = graph path-find + run
6
+ * auto Explore picker; `.flow.ts` / `--blocks From To` = run that path
7
7
  * demo Watch (step overlay); `--blocks` `--data` `--auto-next` `--auto-play-video`
8
8
  * run Execute; `--blocks` `--data` `--non-headless` `--video`
9
9
  *
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * "project" defaults to cwd. Flags beat WAYGRAPH_* env.
14
14
  */
15
- import { existsSync, readdirSync, readFileSync, writeFileSync, rmSync, cpSync, mkdirSync, mkdtempSync } from "node:fs";
15
+ import { existsSync, readdirSync, readFileSync, writeFileSync, rmSync, cpSync, mkdirSync, mkdtempSync, statSync } from "node:fs";
16
16
  import { resolve, relative, join, basename, dirname } from "node:path";
17
17
  import { tmpdir } from "node:os";
18
18
  import { fileURLToPath } from "node:url";
@@ -3058,10 +3058,11 @@ function usage() {
3058
3058
  console.log(`waygraph -- graph project tool + engine CLI
3059
3059
 
3060
3060
  Primary (less is more):
3061
- waygraph auto [project] Interactive explore (picker)
3061
+ waygraph auto [project|.flow.ts] Interactive explore (picker)
3062
3062
  --cli Terminal menu instead of browser panel
3063
3063
  --blocks <From> <To> Graph path-find From->To, then run
3064
3064
  --data '{...}' Mem seed (same as demo/run)
3065
+ (pass a .flow.ts to run that flow - same as run)
3065
3066
  waygraph demo [--blocks <flow|file|spec>] Watch with step overlay (QA path)
3066
3067
  --data '{...}' Mem seed JSON (or inline flow({...}))
3067
3068
  --auto-next Auto-advance steps (alias: --autoplay)
@@ -3083,6 +3084,7 @@ Examples:
3083
3084
  waygraph run --blocks shopFlow --non-headless --video
3084
3085
  waygraph demo --blocks src/flows/cart-bulk.flow.ts --auto-next
3085
3086
  waygraph try auto:cli
3087
+ waygraph auto src/flows/shop.flow.ts --data '{...}' # run by file (same as run)
3086
3088
  waygraph auto --cli --data '{"saucedemo.credentials":{...}}'
3087
3089
  waygraph auto --blocks LoginPage OrderComplete
3088
3090
  waygraph run --blocks "loginFlow then add-all-to-cart" --data '{...}' --video
@@ -3091,7 +3093,7 @@ Aliases (compat): \`chain <spec>\` -> run --blocks; \`chain auto A B\` -> auto -
3091
3093
  --autoplay -> --auto-next. Prefer the primary verbs above.
3092
3094
 
3093
3095
  Project path optional (defaults to cwd). Flags beat WAYGRAPH_* env.
3094
- \`--blocks\` / positional: Flow export (shopFlow), .flow.ts path, or "a then b" chain.
3096
+ \`run\`/\`demo\`/\`auto\`: Flow export, .flow.ts path, or "a then b" chain (auto also explores).
3095
3097
  `);
3096
3098
  process.exit(0);
3097
3099
  }
@@ -3241,11 +3243,35 @@ async function main() {
3241
3243
  const mermaid = flags.mermaid === true;
3242
3244
  const mapOnly = command === "graph" || flags.map === true;
3243
3245
  const cliPicker = flags.cli === true;
3244
- const proj = resolve(flags.positionals[0] ?? process.cwd());
3246
+ const firstPos = flags.positionals[0];
3247
+ // auto src/flows/shop.flow.ts → run that flow (same as `run`). Do not
3248
+ // treat a .flow.ts path as a project directory (existsSync is true for files).
3249
+ if (command === "auto" && firstPos && looksLikeFlowFileRef(firstPos) && !flags.blocksFromTo) {
3250
+ const proj = resolve(process.cwd());
3251
+ if (!existsSync(proj) || !statSync(proj).isDirectory()) {
3252
+ console.error(`waygraph: no such directory: ${proj}`);
3253
+ process.exit(1);
3254
+ }
3255
+ if (!process.env.WAYGRAPH_BASE_URL) {
3256
+ const resolved = resolveBaseUrl(proj);
3257
+ if (resolved)
3258
+ process.env.WAYGRAPH_BASE_URL = resolved;
3259
+ }
3260
+ await runChain(proj, firstPos);
3261
+ break;
3262
+ }
3263
+ const proj = resolve(firstPos ?? process.cwd());
3245
3264
  if (!existsSync(proj)) {
3246
3265
  console.error(`waygraph: no such directory: ${proj}`);
3247
3266
  process.exit(1);
3248
3267
  }
3268
+ if (!statSync(proj).isDirectory()) {
3269
+ console.error(`waygraph ${command}: "${firstPos}" is a file, not a project directory\n` +
3270
+ " run a flow: waygraph auto src/flows/shop.flow.ts\n" +
3271
+ " or explore: waygraph auto\n" +
3272
+ " or path-find: waygraph auto --blocks LoginPage OrderComplete");
3273
+ process.exit(1);
3274
+ }
3249
3275
  // auto --blocks From To (graph path-find + run)
3250
3276
  if (command === "auto" && (flags.blocksFromTo || flags.blocks)) {
3251
3277
  if (flags.blocksFromTo) {
@@ -3255,7 +3281,8 @@ async function main() {
3255
3281
  }
3256
3282
  console.error("waygraph auto --blocks expects <fromCheckpoint> <toCheckpoint>\n" +
3257
3283
  ' e.g. waygraph auto --blocks LoginPage OrderComplete\n' +
3258
- ' for a hand-named chain use: waygraph run --blocks "a then b"');
3284
+ ' for a hand-named chain use: waygraph run --blocks "a then b"\n' +
3285
+ " or: waygraph auto src/flows/shop.flow.ts");
3259
3286
  process.exit(1);
3260
3287
  }
3261
3288
  if (mapOnly || mermaid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waygraph",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "type": "module",
5
5
  "description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "baseUrl": "https://www.saucedemo.com"
24
24
  },
25
25
  "dependencies": {
26
- "waygraph": "^0.10.4"
26
+ "waygraph": "^0.10.5"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@playwright/test": "^1.55.0",