ruby-anything 0.1.0 → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruby-anything",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Migrate any app to Ruby on Rails 8 with Hotwire, Tailwind and daisyUI, one piece at a time, checked against the original's recorded behavior at every step. Needs the ruby-anything CLI on PATH (npm i -g ruby-anything).",
5
5
  "license": "MIT",
6
6
  "keywords": ["ruby", "rails", "hotwire", "daisyui", "migration", "mcp"]
package/README.md CHANGED
@@ -45,8 +45,16 @@ ruby-anything doctor # checks Ruby, Rails and the runtimes your origina
45
45
 
46
46
  **What counts as done.** Behavior, not your tests. `record` runs the original on generated and given inputs and saves what each call returns, raises and prints; `app record` saves what each HTTP request answers (status, redirects, JSON, page text), running every request twice so changing values become wildcards. A piece is done when `gate` passes: every recorded case matches, and the checks for edited recordings, stubs, recorded answers pasted into the port, unrecorded error paths, fewer tests than before, rubocop and brakeman all pass. Your own `bin/rails test` runs too.
47
47
 
48
+ **Your tests become cases.** `record --from-tests -- pytest` (or `npx jest`, `node --test`) runs the original's own suite with the function instrumented, and every call it makes becomes a recorded case. The source is restored byte for byte afterwards. `--pin-clock` freezes time at 2026-01-01 for the original and the Ruby port alike, so date-dependent code can match.
49
+
50
+ **Side effects count.** A port that forgets to charge the card or send the receipt must fail. `app record --effect-env PAYMENT_API_URL=http,SMTP_HOST=smtp_host,SMTP_PORT=smtp_port --db-dump "<cmd>"` points the app at local stand-ins that record every outgoing HTTP call and email, and dumps the database after every write; replay checks the Rails app makes the same calls, sends the same mail and leaves the same rows.
51
+
52
+ **Web apps and CLI tools.** `app record --http` records a server; `app record --cli --inputs cli.jsonl` records a command-line tool (exit code, stdout, stderr, files written, stdin), each run in a throwaway copy of the repo. A CLI's front door is `rails/bin/<name>`: ported commands run in Rails, the rest exec the original.
53
+
48
54
  **The app keeps running.** `app front-door` runs `rails new` with Tailwind and importmap, adds daisyUI, and puts a small Rack middleware in front that proxies every route Rails does not own yet to the original. Routes move over one at a time with `app wire`, each with a kill switch (`RUBY_ANYTHING_UNIT_<NAME>=original`). `app replay` must stay at 100% while the fallback rate drops to zero; then `app lift` removes the proxy.
49
55
 
56
+ **The original keeps changing?** `ruby-anything drift` re-runs the original on every recorded case and lists what now answers differently, plus routes no case records. CI runs the tests on Linux, Windows and macOS, and the bundled GitHub Action runs `gate` on every pull request.
57
+
50
58
  **A new frontend, the same pages.** Pages are rebuilt as ERB views with Turbo Frames and Streams, Stimulus controllers and daisyUI components. Replay compares them by visible text, so the markup is new but every heading, label, price and empty state must still be there. JSON responses must match exactly.
51
59
 
52
60
  **Report or migrate, you pick.** `analyze` only reports: languages, frameworks, routes, templates and functions in waves (models, logic, routes, views, jobs), every dependency with its Rails equivalent, and the decisions to settle with you. It is a plain command, so the report costs no tokens. `go` migrates: each run moves to the next stage and writes the next task to `rails/port/TASK.md` for your agent.
@@ -64,18 +72,28 @@ Everything it writes lives in `<repo>/rails/`: the Rails app, and `rails/port/`
64
72
  | `ruby-anything go [-- <start command>]` | Move the migration to its next stage and write `rails/port/TASK.md` |
65
73
  | `ruby-anything analyze <repo>` | Plan: routes, templates, functions in waves, dependencies, decisions |
66
74
  | `ruby-anything bridge <repo> <unit>` | Ruby skeleton for one function in `app/services` |
67
- | `ruby-anything record <repo> <unit>` | Record the original function on edge cases and `--inputs` |
75
+ | `ruby-anything record <repo> <unit>` | Record the original function on edge cases, `--inputs`, `--from-tests -- <test cmd>`, `--pin-clock` |
68
76
  | `ruby-anything diff <repo> <unit>` | Replay the cases against the Ruby port (must be N/N) |
69
77
  | `ruby-anything gate <repo> <unit> \| --all \| --app` | Done means gate passes |
70
78
  | `ruby-anything rules <repo> [--add "<rule>"]` | Behavior you corrected, kept by every later piece |
71
- | `ruby-anything app record <repo> --http -- <start command>` | Record the whole original over HTTP |
79
+ | `ruby-anything drift <repo>` | Has the original changed since it was recorded? |
80
+ | `ruby-anything app record <repo> --http -- <start command>` | Record the whole original over HTTP (`--effect-env`, `--db-dump` for side effects) |
81
+ | `ruby-anything app record <repo> --cli --inputs cli.jsonl -- <command>` | Record a CLI tool |
72
82
  | `ruby-anything app front-door <repo>` | Rails app that proxies routes not ported yet |
73
- | `ruby-anything app wire <repo> <unit> --route "GET /path/:id"` | Hand a route to Rails |
83
+ | `ruby-anything app wire <repo> <unit> --route "GET /path/:id"` | Hand a route to Rails (`--command <name>` for a CLI) |
74
84
  | `ruby-anything app replay <repo>` | Replay every HTTP case through Rails (`--original`, `--case`) |
75
85
  | `ruby-anything app status <repo>` | Fallback rate, wired routes, units done |
76
86
  | `ruby-anything app lift <repo>` | Remove the proxy once nothing falls back |
77
87
  | `ruby-anything setup \| doctor \| mcp` | Install for agents, check runtimes, MCP server |
78
88
 
89
+ ## In CI
90
+
91
+ ```yaml
92
+ - uses: akkisavi/ruby-anything/packages/ruby-anything@master
93
+ with:
94
+ app: "true" # also bin/rails test, rubocop, brakeman and the full replay
95
+ ```
96
+
79
97
  ## License
80
98
 
81
99
  Licensed under [MIT](./LICENSE). Ports and generated code in your repository are yours.
package/action.yml ADDED
@@ -0,0 +1,56 @@
1
+ name: ruby-anything gate
2
+ description: Fail the pull request unless every ruby-anything port still matches the original's recorded behavior.
3
+ branding:
4
+ icon: check-circle
5
+ color: red
6
+
7
+ inputs:
8
+ path:
9
+ description: Repository being migrated (the folder that contains rails/).
10
+ default: "."
11
+ units:
12
+ description: Unit ids to gate, one per line. Empty gates every bridged unit (gate --all).
13
+ default: ""
14
+ app:
15
+ description: Also run the whole-app gate (bin/rails test, rubocop, brakeman, HTTP replay).
16
+ default: "false"
17
+ version:
18
+ description: ruby-anything version from npm.
19
+ default: latest
20
+ no-lint:
21
+ description: Skip rubocop in the unit gate.
22
+ default: "false"
23
+
24
+ runs:
25
+ using: composite
26
+ steps:
27
+ - name: Install ruby-anything
28
+ shell: bash
29
+ run: npm install -g "ruby-anything@${{ inputs.version }}"
30
+ - name: Check runtimes
31
+ shell: bash
32
+ run: ruby-anything doctor || true
33
+ - name: Gate units
34
+ shell: bash
35
+ working-directory: ${{ inputs.path }}
36
+ env:
37
+ UNITS: ${{ inputs.units }}
38
+ NO_LINT: ${{ inputs.no-lint }}
39
+ run: |
40
+ flags=()
41
+ [ "$NO_LINT" = "true" ] && flags+=(--no-lint)
42
+ if [ -z "$UNITS" ]; then
43
+ ruby-anything gate . --all "${flags[@]}"
44
+ else
45
+ status=0
46
+ while IFS= read -r unit; do
47
+ [ -z "$unit" ] && continue
48
+ ruby-anything gate . "$unit" "${flags[@]}" || status=1
49
+ done <<< "$UNITS"
50
+ exit $status
51
+ fi
52
+ - name: Gate the app
53
+ if: inputs.app == 'true'
54
+ shell: bash
55
+ working-directory: ${{ inputs.path }}
56
+ run: ruby-anything gate . --app
@@ -285,7 +285,28 @@ async function target(req) {
285
285
  if (typeof fn !== 'function') { emit('fatal', { message: `${req.function} is not an exported function of ${req.module_file}` }); process.exit(2); }
286
286
  return { fn, file };
287
287
  }
288
+ // Opt-in (req.pin_clock): the clock reads 2026-01-01T00:00:00Z and Math.random restarts from seed 0
289
+ // before every run, so time- and random-dependent results are reproducible.
290
+ const PIN_MS = 1767225600000;
291
+ let rngState = 0;
292
+ function reseed() { rngState = 0; }
293
+ function pinClock() {
294
+ const RealDate = Date;
295
+ class PinnedDate extends RealDate {
296
+ constructor(...a) { if (a.length === 0) super(PIN_MS); else super(...a); }
297
+ static now() { return PIN_MS; }
298
+ }
299
+ globalThis.Date = PinnedDate;
300
+ Math.random = () => { // mulberry32
301
+ rngState = (rngState + 0x6D2B79F5) | 0;
302
+ let t = Math.imul(rngState ^ (rngState >>> 15), 1 | rngState);
303
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
304
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
305
+ };
306
+ }
288
307
  async function record(req) {
308
+ const pinned = !!req.pin_clock;
309
+ if (pinned) pinClock();
289
310
  const { fn, file } = await target(req);
290
311
  const raw = fs.readFileSync(file, 'utf8'); const start = locate(raw, req.function, /ts$/.test(file));
291
312
  const params = paramsOf((start >= 0 ? sliceFunction(raw, start) : Function.prototype.toString.call(fn)).replace(/^\s*export\s+(default\s+)?/, '').replace(/^(async\s+)?function\s*\*?\s*[\w$]*/, ''));
@@ -296,7 +317,10 @@ async function record(req) {
296
317
  emit('plan', { total: cases.length, runtime: `node ${process.versions.node}` });
297
318
  const obs = r => JSON.stringify([r.outcome, r.stdout, r.stderr, r.effects]);
298
319
  for (const [index, c] of cases.entries()) {
299
- const first = await runCase(fn, file, c); const second = await runCase(fn, file, c);
320
+ if (pinned) reseed();
321
+ const first = await runCase(fn, file, c);
322
+ if (pinned) reseed();
323
+ const second = await runCase(fn, file, c);
300
324
  emit('case', { index, ref: c.ref ?? null, origin: c.origin || 'manual', args: c.args || [], kwargs: c.kwargs || {}, stable: obs(first) === obs(second), ...first });
301
325
  }
302
326
  emit('done');
@@ -361,7 +361,45 @@ def observable(result):
361
361
  return json.dumps({k: result[k] for k in ("outcome", "stdout", "stderr", "effects")}, sort_keys=True)
362
362
 
363
363
 
364
+ PIN_EPOCH = 1767225600 # 2026-01-01T00:00:00Z
365
+
366
+
367
+ def pin_clock():
368
+ """Freeze the clock at PIN_EPOCH for code imported after this (time, datetime). Opt-in: pin_clock."""
369
+ import datetime as _dt
370
+ import time as _time
371
+
372
+ _time.time = lambda: float(PIN_EPOCH)
373
+ _time.time_ns = lambda: PIN_EPOCH * 1_000_000_000
374
+ real = _dt.datetime
375
+
376
+ class PinnedDatetime(real):
377
+ @classmethod
378
+ def now(cls, tz=None):
379
+ utc = real.fromtimestamp(PIN_EPOCH, _dt.timezone.utc)
380
+ return utc.astimezone(tz) if tz else utc.replace(tzinfo=None)
381
+
382
+ @classmethod
383
+ def utcnow(cls):
384
+ return real.fromtimestamp(PIN_EPOCH, _dt.timezone.utc).replace(tzinfo=None)
385
+
386
+ @classmethod
387
+ def today(cls):
388
+ return cls.now()
389
+
390
+ class PinnedDate(_dt.date):
391
+ @classmethod
392
+ def today(cls):
393
+ return _dt.date(2026, 1, 1)
394
+
395
+ _dt.datetime = PinnedDatetime
396
+ _dt.date = PinnedDate
397
+
398
+
364
399
  def record(req):
400
+ pinned = bool(req.get("pin_clock"))
401
+ if pinned:
402
+ pin_clock()
365
403
  fn = load_function(req["module_file"], req["function"])
366
404
  cases = list(req.get("cases", []))
367
405
  gen = req.get("generate") or {}
@@ -370,7 +408,11 @@ def record(req):
370
408
  emit("log", message=f"recording {len(cases)} cases for {req['function']} (python {sys.version.split()[0]})")
371
409
  emit("plan", total=len(cases), runtime=f"python {sys.version.split()[0]}")
372
410
  for index, case in enumerate(cases):
411
+ if pinned:
412
+ random.seed(0)
373
413
  first = run_case(fn, case)
414
+ if pinned:
415
+ random.seed(0)
374
416
  second = run_case(fn, case)
375
417
  stable = observable(first) == observable(second)
376
418
  emit("case", index=index, ref=case.get("ref"), origin=case.get("origin", "manual"), args=case.get("args", []),
@@ -65,6 +65,17 @@ def snapshot(root)
65
65
  end
66
66
 
67
67
  request = JSON.parse($stdin.read)
68
+
69
+ # Recorded with --pin-clock: the original saw 2026-01-01T00:00:00Z, so the port sees it too.
70
+ # (Random numbers cannot be pinned across languages: pass them in as arguments instead.)
71
+ if request["pin_clock"]
72
+ require "date"
73
+ PIN_TIME = Time.at(1_767_225_600).utc.freeze
74
+ Time.singleton_class.prepend(Module.new { def now(**) = PIN_TIME.dup })
75
+ Date.singleton_class.prepend(Module.new { def today(*) = Date.new(2026, 1, 1) })
76
+ DateTime.singleton_class.prepend(Module.new { def now(*) = DateTime.new(2026, 1, 1, 0, 0, 0) })
77
+ end
78
+
68
79
  $stdout = StringIO.new
69
80
  begin
70
81
  if request["rails_root"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruby-anything",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Migrate any app (TypeScript, JavaScript, Python, Go, Java/Spring, Kotlin, C#, PHP, Rust, Swift) to Ruby on Rails with Hotwire, Tailwind and daisyUI, one piece at a time, checked against the original's recorded behavior at every step.",
5
5
  "keywords": [
6
6
  "ruby",
@@ -18,12 +18,12 @@
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/akkisavi/rust-anything.git",
21
+ "url": "git+https://github.com/akkisavi/ruby-anything.git",
22
22
  "directory": "packages/ruby-anything"
23
23
  },
24
- "homepage": "https://github.com/akkisavi/rust-anything#readme",
24
+ "homepage": "https://github.com/akkisavi/ruby-anything#readme",
25
25
  "bugs": {
26
- "url": "https://github.com/akkisavi/rust-anything/issues"
26
+ "url": "https://github.com/akkisavi/ruby-anything/issues"
27
27
  },
28
28
  "bin": {
29
29
  "ruby-anything": "bin/ruby-anything.js"
@@ -38,11 +38,12 @@
38
38
  ".mcp.json",
39
39
  "README.md",
40
40
  "LICENSE",
41
- "docs"
41
+ "docs",
42
+ "action.yml"
42
43
  ],
43
44
  "scripts": {
44
45
  "prepack": "node scripts/sync-adapters.js",
45
- "test": "node test/run.js"
46
+ "test": "node scripts/test.js"
46
47
  },
47
48
  "engines": {
48
49
  "node": ">=18"
@@ -71,8 +71,19 @@ objects).
71
71
  ruby-anything bridge <repo> <unit-id> # Ruby skeleton + rails/port/TASK.md; never overwrites a method
72
72
  ruby-anything record <repo> <unit-id> # the original's behavior on edge cases -> rails/port/cases/*.jsonl
73
73
  ruby-anything record <repo> <unit-id> --inputs real.jsonl # {"fn": name, "args": [...]} per line
74
+ ruby-anything record <repo> <unit-id> --from-tests -- pytest # or: npx jest, npx vitest run, node --test
75
+ ruby-anything record <repo> <unit-id> --pin-clock # time and dates read 2026-01-01T00:00:00Z
74
76
  ```
75
77
 
78
+ - **The original has tests? Record their calls**: `--from-tests -- <test command>` runs the suite
79
+ with the function instrumented (Python, TypeScript, JavaScript), and every distinct call it makes
80
+ becomes a case next to the generated ones (`--no-generate` for only those). The source file is
81
+ restored byte for byte afterwards, also after a crash.
82
+ - **The function reads the clock** (`datetime.now`, `Date.now`, `time.time`, `date.today`):
83
+ record with `--pin-clock`. The original then sees 2026-01-01T00:00:00Z and `diff` runs the port
84
+ with `Time.now`, `Date.today` and `DateTime.now` frozen at the same instant. Random numbers cannot
85
+ match across languages: make the random value an argument (or inject a generator) instead.
86
+
76
87
  **A port keeps behavior, bugs included.** Port a known bug as it is; fix it in its own change
77
88
  after `gate` passes, with each case it changes in `rails/port/known-diffs.jsonl`
78
89
  (`{"unit", "args", "actual", "reason"}`) and the user's yes.
@@ -103,7 +114,12 @@ corrects how the port behaves, add it right away: `ruby-anything rules <repo> --
103
114
  ruby-anything diff <repo> <unit-id> # must be N/N; groups mismatches and names where each first differs
104
115
  ```
105
116
 
106
- A mismatch is a behavior difference: fix the port, never the recording. When `diff` says the port
117
+ A mismatch is a behavior difference: fix the port, never the recording.
118
+
119
+ **The original keeps changing?** After pulling upstream changes (and in CI while the original is
120
+ still developed), run `ruby-anything drift <repo>`: it re-runs the original on every recorded unit
121
+ case and HTTP/CLI case and lists what now answers differently, plus routes no case records. For
122
+ each drifted unit: `record` again, then `diff`; the new mismatches are what changed upstream. When `diff` says the port
107
123
  is **stalled** (three changes to the port in a row gained no matching case), stop editing: show the
108
124
  user the remaining mismatches and ask. They may know the rule you are missing.
109
125
 
@@ -95,6 +95,34 @@ token in `headers`), and the error paths (bad input, missing records, forbidden,
95
95
  failures). Every GET runs twice: values that change between runs become `[..]` wildcards. Ask the
96
96
  user about each one: is the order part of the contract?
97
97
 
98
+ **Side effects.** If the app calls other APIs, sends email or writes a database, record those too,
99
+ or a port that forgets to charge the card or send the receipt would pass:
100
+
101
+ ```sh
102
+ ruby-anything app record <repo> --http --inputs ... \
103
+ --effect-env PAYMENT_API_URL=http,SMTP_HOST=smtp_host,SMTP_PORT=smtp_port \
104
+ --db-dump "sqlite3 db.sqlite3 .dump" --db-reset "<reset command>" -- <start command>
105
+ ```
106
+
107
+ `--effect-env NAME=KIND` points the app's own setting at a local stand-in: `http` (a URL that
108
+ records every call and answers 200 `{}`, or what `rails/port/app-cases/effect-replies.json`
109
+ says: `[{"method", "path", "status", "body"}]`), `smtp` (an `smtp://host:port` URL), `smtp_host`
110
+ and `smtp_port`. Find the variable names in the app's config; ask the user when it hardcodes a
111
+ URL. `--db-dump` runs after every non-GET request and its rows are part of the case. Replay sets
112
+ the same variables for the Rails app, so Rails must read them too: the payment client's base URL
113
+ from the same env var, Action Mailer's `smtp_settings` from `SMTP_HOST`/`SMTP_PORT` (with
114
+ `delivery_method :smtp` in development), and the same database the dump reads.
115
+
116
+ **CLI apps.** For a command-line tool there is no server: list invocations in
117
+ `rails/port/app-cases/cli.jsonl` (`{"name", "args": [...], "stdin", "env"}`: every command and
118
+ flag, `--help`, bad input, each error exit code) and record with
119
+ `ruby-anything app record <repo> --cli --inputs rails/port/app-cases/cli.jsonl -- python tool.py`
120
+ (or `ruby-anything go --cli -- python tool.py`). Each invocation runs twice in a throwaway copy of
121
+ the repo; exit code, stdout, stderr and the files it writes are the case. The front door is
122
+ `rails/bin/<name>`: a command wired with `app wire <repo> <unit> --command <name>` (`*` for the
123
+ default) runs `Cli::<Unit>.call(argv)` from `rails/app/cli/<unit>.rb` inside the Rails app and
124
+ returns the exit code; every other invocation execs the original.
125
+
98
126
  ## 4. Build the front door
99
127
 
100
128
  ```sh
@@ -154,7 +182,15 @@ ruby-anything app lift <repo> # refuses until nothing falls back; repla
154
182
 
155
183
  ## 7. Prove it, then cut over
156
184
 
157
- Run `ruby-anything app replay <repo>` and `bin/rails test` in CI. A mismatch is a bug in the
185
+ Run `ruby-anything app replay <repo>` and `bin/rails test` in CI, plus `ruby-anything drift <repo>`
186
+ while the original is still developed. In GitHub Actions, the bundled action runs the gate on
187
+ every pull request:
188
+
189
+ ```yaml
190
+ - uses: <owner>/<repo>/packages/ruby-anything@master # or the published copy
191
+ with:
192
+ app: "true"
193
+ ``` A mismatch is a bug in the
158
194
  port, never in the cases: change a case only with the user's approval, recorded in an ADR.
159
195
 
160
196
  After the lift the Rails app no longer has to mirror the original's structure. Offer a reshape
package/src/adapters.js CHANGED
@@ -3,15 +3,16 @@
3
3
  // Recording EXECUTES the original: work on a copy, with a test database.
4
4
  const fs = require('node:fs')
5
5
  const path = require('node:path')
6
- const { PKG, python, which, runHarness } = require('./util')
6
+ const { PKG, python, which, runHarness, canon } = require('./util')
7
7
 
8
8
  const POLYGLOT = { go: 'go', java: 'javac', kotlin: 'kotlinc', csharp: 'dotnet', php: 'php', rust: 'rustc', swift: 'swiftc', ruby: 'ruby' }
9
9
 
10
10
  function adaptersDir() {
11
+ // Inside the PortPilot repo the live adapters win over a copy left by `npm pack`.
12
+ const dev = path.resolve(PKG, '..', '..', 'adapters')
13
+ if (fs.existsSync(path.join(dev, 'polyglot', 'harness.py'))) return dev
11
14
  const bundled = path.join(PKG, 'adapters')
12
15
  if (fs.existsSync(path.join(bundled, 'polyglot'))) return bundled
13
- const dev = path.resolve(PKG, '..', '..', 'adapters') // inside the PortPilot repo
14
- if (fs.existsSync(dev)) return dev
15
16
  throw new Error('language adapters missing: reinstall ruby-anything')
16
17
  }
17
18
 
@@ -47,10 +48,12 @@ async function analyzeUnits(root, lang) {
47
48
  }
48
49
  }
49
50
 
50
- async function record(root, lang, { moduleFile, fn, cases = [], count = 40, seed = 1, mode = 'edge', onEvent }) {
51
+ async function record(root, lang, { moduleFile, fn, cases = [], count = 40, seed = 1, mode = 'edge', pinClock = false, onEvent }) {
51
52
  const h = harnessFor(lang)
52
- const req = { command: 'record', module_file: moduleFile, function: fn, cases, generate: count ? { count, seed, mode } : null }
53
- const { events } = await runHarness(h.argv, req, { env: { ...h.env, PORTPILOT_SRC: root }, cwd: root, onEvent })
53
+ const req = { command: 'record', module_file: moduleFile, function: fn, cases: '__CASES__', generate: count ? { count, seed, mode } : null, pin_clock: !!pinClock }
54
+ // cases keep their int/float kinds ({ $n } values) on the way in
55
+ const raw = JSON.stringify(req).replace('"__CASES__"', canon(cases))
56
+ const { events } = await runHarness(h.argv, raw, { env: { ...h.env, PORTPILOT_SRC: root }, cwd: root, onEvent })
54
57
  return {
55
58
  runtime: events.find((e) => e.event === 'plan')?.runtime,
56
59
  cases: events.filter((e) => e.event === 'case'),