ptywright 0.3.0 → 0.5.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 +76 -31
- package/dist/agent.mjs +2 -2
- package/dist/bin/ptywright.mjs +1 -1
- package/dist/{cli-CfvlbRoZ.mjs → cli-PnG6UR43.mjs} +2390 -2309
- package/dist/cli.mjs +1 -1
- package/dist/config-bGg636EW.mjs +52 -0
- package/dist/config.mjs +2 -0
- package/dist/env-DPYHo-zH.mjs +36 -0
- package/dist/index.mjs +1 -1
- package/dist/manifest_files-DW80c1H7.mjs +77 -0
- package/dist/mcp.mjs +1 -1
- package/dist/pty-cassette.mjs +1 -1
- package/dist/{runner-zi0nItvB.mjs → runner-C1gPRyCM.mjs} +2002 -1038
- package/dist/{runner-zApMYWZx.mjs → runner-wW_DCBX7.mjs} +1576 -1422
- package/dist/script.mjs +1 -1
- package/dist/{server-BC3yo-dq.mjs → server-DMnnXjWv.mjs} +2643 -2527
- package/dist/session.mjs +1 -1
- package/dist/{terminal_session-DopC7Xg6.mjs → terminal_session-DJKr-O3X.mjs} +349 -328
- package/package.json +3 -1
- package/skills/ptywright-testing/SKILL.md +113 -79
- package/skills/ptywright-testing/agents/openai.yaml +4 -0
- package/skills/ptywright-testing/references/agent-regression.md +132 -0
- package/skills/ptywright-testing/references/ci-and-debugging.md +95 -0
- package/skills/ptywright-testing/references/mcp-tools.md +91 -0
- package/skills/ptywright-testing/references/raw-pty-cassettes.md +82 -0
- package/skills/ptywright-testing/references/script-runner.md +80 -0
- package/dist/{pty_like-Cpkh_O9B.mjs → pty_like-BjeBibSL.mjs} +2 -2
package/README.md
CHANGED
|
@@ -315,64 +315,71 @@ expose the terminal root as `[data-terminal-root]`.
|
|
|
315
315
|
|
|
316
316
|
```bash
|
|
317
317
|
# First run records snapshots, screenshots, replay metadata, and report.
|
|
318
|
-
bun run
|
|
318
|
+
bun run src/cli.ts agent run examples/agent_deterministic.json --update-snapshots
|
|
319
319
|
|
|
320
320
|
# Later runs compare terminal + DOM snapshots like a test snapshot.
|
|
321
|
-
bun run
|
|
321
|
+
bun run src/cli.ts agent run examples/agent_deterministic.json
|
|
322
322
|
|
|
323
323
|
# Replay does not need AI; it uses the recorded flow artifact.
|
|
324
|
-
bun run
|
|
324
|
+
bun run src/cli.ts agent replay .tmp/agent/agent_deterministic/agent_deterministic.agent-run.json
|
|
325
325
|
|
|
326
326
|
# Cassette files are also directly replayable.
|
|
327
|
-
bun run
|
|
327
|
+
bun run src/cli.ts agent replay .tmp/agent/agent_deterministic/agent_deterministic.cassette.json
|
|
328
328
|
|
|
329
329
|
# Promote a live run/cassette into the committed non-AI regression suite.
|
|
330
|
-
bun run
|
|
330
|
+
bun run src/cli.ts agent promote \
|
|
331
331
|
.tmp/agent/agent_deterministic/agent_deterministic.cassette.json \
|
|
332
332
|
--update-snapshots
|
|
333
333
|
|
|
334
334
|
# Batch replay committed cassettes/run records as a regression suite.
|
|
335
|
-
bun run
|
|
335
|
+
bun run src/cli.ts agent replay-all .tmp/agent --artifacts-root .tmp/agent-replay-all
|
|
336
336
|
|
|
337
337
|
# Rerun directly from a generated summary artifact.
|
|
338
|
-
bun run
|
|
339
|
-
bun run
|
|
340
|
-
bun run
|
|
338
|
+
bun run src/cli.ts agent rerun .tmp/agent-promote/agent_deterministic/agent-promote.summary.json
|
|
339
|
+
bun run src/cli.ts agent rerun .tmp/agent-check/agent-check.summary.json
|
|
340
|
+
bun run src/cli.ts agent rerun .tmp/agent-check/agent-replay.summary.json --update-snapshots
|
|
341
341
|
|
|
342
342
|
# Read reusable commands from any supported agent artifact.
|
|
343
|
-
bun run
|
|
344
|
-
bun run
|
|
345
|
-
bun run
|
|
346
|
-
bun run
|
|
347
|
-
bun run
|
|
348
|
-
bun run
|
|
349
|
-
bun run
|
|
350
|
-
bun run
|
|
351
|
-
bun run
|
|
352
|
-
bun run
|
|
343
|
+
bun run src/cli.ts agent commands .tmp/agent-check/agent-check.summary.json --json
|
|
344
|
+
bun run src/cli.ts agent commands .tmp/agent-check/agent-check.summary.json --command rerun
|
|
345
|
+
bun run src/cli.ts agent commands .tmp/agent-check --json
|
|
346
|
+
bun run src/cli.ts agent inspect .tmp/agent-check
|
|
347
|
+
bun run src/cli.ts agent inspect .tmp/agent-check --json
|
|
348
|
+
bun run src/cli.ts agent validate .tmp/agent-check
|
|
349
|
+
bun run src/cli.ts agent exec .tmp/agent-check --command rerun
|
|
350
|
+
bun run src/cli.ts agent exec .tmp/agent-check --command updateSnapshots
|
|
351
|
+
bun run src/cli.ts agent exec .tmp/agent-check/agent-check.summary.json --command rerun
|
|
352
|
+
bun run src/cli.ts agent exec .tmp/agent-check/agent-check.summary.json --command updateSnapshots
|
|
353
353
|
|
|
354
354
|
# Validate flow/cassette/run-record/summary artifacts before committing.
|
|
355
|
-
bun run
|
|
355
|
+
bun run src/cli.ts agent validate .tmp/agent-replay-all
|
|
356
356
|
|
|
357
357
|
# Run committed cassette replay regression without launching live agents.
|
|
358
|
-
bun run
|
|
359
|
-
bun run
|
|
358
|
+
bun run src/cli.ts agent check
|
|
359
|
+
bun run src/cli.ts agent check --json
|
|
360
360
|
|
|
361
361
|
# Update terminal/DOM baselines from committed cassettes intentionally.
|
|
362
|
-
bun run
|
|
362
|
+
bun run src/cli.ts agent replay-all tests/agent-cassettes --update-snapshots
|
|
363
363
|
|
|
364
364
|
# Record browser interactions into a replayable flow spec.
|
|
365
|
-
bun run
|
|
365
|
+
bun run src/cli.ts agent record examples/agents/codex_browser_smoke.json \
|
|
366
366
|
--out scripts/agents/codex_recorded.flow.json \
|
|
367
367
|
--duration-ms 60000 \
|
|
368
368
|
--headed
|
|
369
369
|
|
|
370
370
|
# Generate starter specs for real agents.
|
|
371
|
-
bun run
|
|
372
|
-
bun run
|
|
373
|
-
bun run
|
|
371
|
+
bun run src/cli.ts agent init codex examples/agents/codex_browser_smoke.json
|
|
372
|
+
bun run src/cli.ts agent init claude examples/agents/claude_browser_smoke.json
|
|
373
|
+
bun run src/cli.ts agent init droidx examples/agents/droidx_browser_smoke.json
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
+
DOM artifact viewers use `@aitty/snapshot` as the report renderer. ptywright
|
|
377
|
+
copies `@aitty/snapshot/style.css` and the classic
|
|
378
|
+
`@aitty/snapshot/web-component.global.js` bundle into the report artifacts, then
|
|
379
|
+
renders snapshots through `<aitty-snapshot>`. Terminal internals such as wterm
|
|
380
|
+
rows, ANSI styling, termvision, and viewport-pan come from `@aitty/snapshot`;
|
|
381
|
+
ptywright only supplies the report frame and copied assets.
|
|
382
|
+
|
|
376
383
|
Artifacts are split intentionally:
|
|
377
384
|
- `.tmp/agent/<name>/` contains run output, screenshots, `*.flow.json`,
|
|
378
385
|
`*.agent-run.json`, `*.cassette.json`, `index.html`, and
|
|
@@ -380,6 +387,44 @@ Artifacts are split intentionally:
|
|
|
380
387
|
- `tests/agent-snapshots/<name>/` contains stable terminal/DOM baselines.
|
|
381
388
|
- `--update-snapshots` is the explicit update path for intentional UI changes.
|
|
382
389
|
|
|
390
|
+
### Project Config
|
|
391
|
+
|
|
392
|
+
For repeated agent regression work, put project-level defaults in
|
|
393
|
+
`ptywright.config.ts` instead of repeating paths and browser defaults in every
|
|
394
|
+
flow file. The CLI discovers `ptywright.config.ts|mts|cts|js|mjs|cjs` from the
|
|
395
|
+
current directory upward, and `--config <file>` selects one explicitly.
|
|
396
|
+
|
|
397
|
+
```ts
|
|
398
|
+
import { defineConfig } from "ptywright/config";
|
|
399
|
+
|
|
400
|
+
export default defineConfig({
|
|
401
|
+
agent: {
|
|
402
|
+
artifactsRoot: ".tmp/agent",
|
|
403
|
+
cassetteDir: "tests/agent-cassettes",
|
|
404
|
+
snapshotDir: "tests/agent-snapshots",
|
|
405
|
+
defaults: {
|
|
406
|
+
headless: true,
|
|
407
|
+
timeoutMs: 45_000,
|
|
408
|
+
screenshot: false,
|
|
409
|
+
viewports: [{ name: "desktop", width: 1280, height: 820 }],
|
|
410
|
+
mask: [{ regex: "session_[a-z0-9]+", replacement: "<session>" }],
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
ptywright agent run tests/agents/codex.flow.json --update-snapshots
|
|
418
|
+
ptywright agent check
|
|
419
|
+
ptywright agent replay-all --update-snapshots
|
|
420
|
+
ptywright agent promote .tmp/agent/codex/codex.cassette.json --update-snapshots
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Config paths are resolved relative to the config file directory. CLI arguments
|
|
424
|
+
override config defaults, and fields written in a flow file override config
|
|
425
|
+
defaults for that flow. The flow file remains the test case; the config file is
|
|
426
|
+
only for shared project defaults and common artifact locations.
|
|
427
|
+
|
|
383
428
|
`launch.mode=command` is the recommended integration contract. `command` and
|
|
384
429
|
`args` are spawned directly, and ptywright reads the first URL printed to stdout
|
|
385
430
|
or stderr. Use `waitForUrlMs` to tune startup timeouts and `urlRegex` when the
|
|
@@ -529,7 +574,7 @@ details.
|
|
|
529
574
|
bun install
|
|
530
575
|
|
|
531
576
|
# Start MCP server
|
|
532
|
-
bun run
|
|
577
|
+
bun run src/cli.ts mcp
|
|
533
578
|
|
|
534
579
|
# Run tests
|
|
535
580
|
bun run test
|
|
@@ -543,11 +588,11 @@ bun run lint
|
|
|
543
588
|
bun run format:check
|
|
544
589
|
|
|
545
590
|
# Run scripts
|
|
546
|
-
bun run
|
|
547
|
-
bun run
|
|
591
|
+
bun run src/cli.ts run scripts/m5_mask_demo.json
|
|
592
|
+
bun run src/cli.ts run-all
|
|
548
593
|
|
|
549
594
|
# Run browser agent regression
|
|
550
|
-
bun run
|
|
595
|
+
bun run src/cli.ts agent run examples/agent_deterministic.json --update-snapshots
|
|
551
596
|
```
|
|
552
597
|
|
|
553
598
|
## Environment Variables
|
package/dist/agent.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { defaultSpecNameForPath,
|
|
1
|
+
import { a as formatAgentLaunchPlan, i as runAgentSpecPath, n as replayAgentRecordPath, r as runAgentSpec, t as defaultSpecNameForPath } from "./runner-C1gPRyCM.mjs";
|
|
2
|
+
export { defaultSpecNameForPath, formatAgentLaunchPlan, replayAgentRecordPath, runAgentSpec, runAgentSpecPath };
|
package/dist/bin/ptywright.mjs
CHANGED