ptywright 0.1.1 → 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.
Files changed (67) hide show
  1. package/README.md +287 -1
  2. package/dist/agent.mjs +2 -0
  3. package/dist/bin/ptywright.mjs +6 -0
  4. package/dist/cli-DIUx2w6X.mjs +3587 -0
  5. package/dist/cli.mjs +2 -0
  6. package/{src/index.ts → dist/index.mjs} +7 -9
  7. package/dist/mcp.mjs +2 -0
  8. package/dist/pty-cassette.mjs +24 -0
  9. package/dist/pty_like-Cpkh_O9B.mjs +404 -0
  10. package/dist/runner-DzZlFrt1.mjs +1897 -0
  11. package/dist/runner-zApMYWZx.mjs +3257 -0
  12. package/dist/script.mjs +2 -0
  13. package/dist/server-VHuEWWj_.mjs +3068 -0
  14. package/dist/session.mjs +2 -0
  15. package/dist/terminal_session-DopC7Xg6.mjs +893 -0
  16. package/package.json +28 -21
  17. package/schemas/ptywright-agent-cassette.schema.json +57 -0
  18. package/schemas/ptywright-agent-check.schema.json +122 -0
  19. package/schemas/ptywright-agent-manifest.schema.json +107 -0
  20. package/schemas/ptywright-agent-promote.schema.json +146 -0
  21. package/schemas/ptywright-agent-replay-summary.schema.json +140 -0
  22. package/schemas/ptywright-agent-run.schema.json +126 -0
  23. package/schemas/ptywright-agent.schema.json +182 -0
  24. package/schemas/ptywright-pty-cassette.schema.json +86 -0
  25. package/schemas/ptywright-script-manifest.schema.json +75 -0
  26. package/schemas/ptywright-script-run-summary.schema.json +114 -0
  27. package/schemas/ptywright-script.schema.json +55 -3
  28. package/bin/ptywright +0 -4
  29. package/src/cli.ts +0 -414
  30. package/src/generator/doc_parser.ts +0 -341
  31. package/src/generator/generate.ts +0 -161
  32. package/src/generator/index.ts +0 -10
  33. package/src/generator/script_generator.ts +0 -209
  34. package/src/generator/step_extractor.ts +0 -397
  35. package/src/mcp/http_server.ts +0 -174
  36. package/src/mcp/script_recording.ts +0 -238
  37. package/src/mcp/server.ts +0 -1348
  38. package/src/pty/bun_pty_adapter.ts +0 -34
  39. package/src/pty/bun_terminal_adapter.ts +0 -149
  40. package/src/pty/pty_adapter.ts +0 -31
  41. package/src/script/dsl.ts +0 -188
  42. package/src/script/module.ts +0 -43
  43. package/src/script/path.ts +0 -151
  44. package/src/script/run.ts +0 -108
  45. package/src/script/run_all.ts +0 -229
  46. package/src/script/runner.ts +0 -983
  47. package/src/script/schema.ts +0 -237
  48. package/src/script/steps/assert_snapshot_equals.ts +0 -21
  49. package/src/script/steps/index.ts +0 -2
  50. package/src/script/suite_report.ts +0 -626
  51. package/src/session/session_manager.ts +0 -145
  52. package/src/session/terminal_session.ts +0 -473
  53. package/src/terminal/ansi.ts +0 -142
  54. package/src/terminal/keys.ts +0 -180
  55. package/src/terminal/mask.ts +0 -70
  56. package/src/terminal/mouse.ts +0 -75
  57. package/src/terminal/snapshot.ts +0 -196
  58. package/src/terminal/style.ts +0 -121
  59. package/src/terminal/view.ts +0 -49
  60. package/src/trace/asciicast.ts +0 -20
  61. package/src/trace/asciinema_player_assets.ts +0 -44
  62. package/src/trace/cast_to_txt.ts +0 -116
  63. package/src/trace/recorder.ts +0 -110
  64. package/src/trace/report.ts +0 -2092
  65. package/src/types.ts +0 -86
  66. package/src/util/hash.ts +0 -8
  67. package/src/util/sleep.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptywright",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Terminal/TUI automation driver over PTY + xterm, exposed as MCP tools",
5
5
  "keywords": [
6
6
  "agent",
@@ -22,52 +22,59 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/kingsword09/ptywright.git"
24
24
  },
25
- "main": "src/index.ts",
26
- "exports": {
27
- ".": "./src/index.ts",
28
- "./mcp": "./src/mcp/server.ts",
29
- "./session": "./src/session/terminal_session.ts",
30
- "./script": "./src/script/runner.ts"
31
- },
32
25
  "bin": {
33
- "ptywright": "bin/ptywright"
26
+ "ptywright": "dist/bin/ptywright.mjs"
34
27
  },
35
28
  "files": [
36
- "bin",
37
- "src",
29
+ "dist",
38
30
  "schemas",
39
31
  "skills",
40
32
  "README.md",
41
33
  "LICENSE"
42
34
  ],
43
35
  "type": "module",
36
+ "main": "./dist/cli.mjs",
37
+ "exports": {
38
+ ".": "./dist/cli.mjs",
39
+ "./agent": "./dist/agent.mjs",
40
+ "./mcp": "./dist/mcp.mjs",
41
+ "./pty-cassette": "./dist/pty-cassette.mjs",
42
+ "./session": "./dist/session.mjs",
43
+ "./script": "./dist/script.mjs"
44
+ },
44
45
  "scripts": {
45
- "dev": "bun run src/index.ts",
46
- "test": "bun test",
46
+ "build": "vp pack",
47
+ "dev": "vp dev",
48
+ "mcp": "bun run src/index.ts",
49
+ "agent": "bun run src/cli.ts agent",
50
+ "agent:check": "bun run src/cli.ts agent check",
51
+ "check": "vp check && bun run build && bun run test && bun run agent:check",
52
+ "test": "bun run scripts/test_all.ts",
47
53
  "test:mcp-all-tools": "bun test tests/mcp_all_tools_smoke.test.ts",
48
- "lint": "oxlint --type-aware --type-check .",
49
- "format": "oxfmt src tests '!tests/fixtures/**'",
50
- "format:check": "oxfmt --check src tests '!tests/fixtures/**'",
54
+ "lint": "vp lint",
55
+ "format": "vp fmt",
56
+ "format:check": "vp fmt --check",
51
57
  "trace:report": "bun run src/trace/report.ts",
52
58
  "trace:cast-to-txt": "bun run src/trace/cast_to_txt.ts",
53
59
  "script:run": "bun run src/script/run.ts",
54
60
  "script:run-all": "bun run src/script/run_all.ts",
55
61
  "script:m5-mask-demo": "bun run src/script/run.ts scripts/m5_mask_demo.json",
56
- "prepublishOnly": "bun run format:check && bun run lint && bun test"
62
+ "prepublishOnly": "bun run build"
57
63
  },
58
64
  "dependencies": {
59
65
  "@modelcontextprotocol/sdk": "^1.25.2",
60
66
  "@xterm/headless": "^6.0.0",
61
67
  "asciinema-player": "3.9.0",
62
68
  "bun-pty": "^0.4.7",
69
+ "playwright": "^1.60.0",
63
70
  "zod": "^3.25.76"
64
71
  },
65
72
  "devDependencies": {
66
73
  "bun-types": "^1.3.6",
67
- "oxfmt": "^0.24.0",
68
- "oxlint": "^1.39.0",
69
- "oxlint-tsgolint": "^0.11.1",
70
- "typescript": "^5.9.2"
74
+ "typescript": "^5.9.2",
75
+ "vite": "^8.0.14",
76
+ "vite-plus": "^0.1.22",
77
+ "vitest": "^4.1.7"
71
78
  },
72
79
  "engines": {
73
80
  "bun": ">=1.3.6"
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ptywright.local/schemas/ptywright-agent-cassette.schema.json",
4
+ "title": "ptywright agent cassette",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["version", "name", "createdAt", "spec", "frames"],
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "version": { "const": 1 },
11
+ "name": { "type": "string", "minLength": 1 },
12
+ "createdAt": { "type": "string", "minLength": 1 },
13
+ "spec": { "$ref": "./ptywright-agent.schema.json" },
14
+ "frames": {
15
+ "type": "array",
16
+ "minItems": 1,
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": [
21
+ "viewport",
22
+ "phase",
23
+ "stepIndex",
24
+ "stepType",
25
+ "terminalText",
26
+ "terminalHash",
27
+ "dom",
28
+ "domHash",
29
+ "capturedAt"
30
+ ],
31
+ "properties": {
32
+ "viewport": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["name", "width", "height"],
36
+ "properties": {
37
+ "name": { "type": "string", "minLength": 1 },
38
+ "width": { "type": "integer", "minimum": 1 },
39
+ "height": { "type": "integer", "minimum": 1 },
40
+ "deviceScaleFactor": { "type": "number", "exclusiveMinimum": 0 },
41
+ "isMobile": { "type": "boolean" },
42
+ "hasTouch": { "type": "boolean" }
43
+ }
44
+ },
45
+ "phase": { "type": "integer", "minimum": 0 },
46
+ "stepIndex": { "type": ["integer", "null"], "minimum": 0 },
47
+ "stepType": { "type": "string", "minLength": 1 },
48
+ "terminalText": { "type": "string" },
49
+ "terminalHash": { "type": "string", "minLength": 1 },
50
+ "dom": { "type": "string" },
51
+ "domHash": { "type": "string", "minLength": 1 },
52
+ "capturedAt": { "type": "string", "minLength": 1 }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ptywright.local/schemas/ptywright-agent-check.schema.json",
4
+ "title": "ptywright agent check summary",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "ok",
10
+ "cassetteDir",
11
+ "artifactsRoot",
12
+ "summaryPath",
13
+ "commands",
14
+ "inputs",
15
+ "replay",
16
+ "outputs",
17
+ "failures"
18
+ ],
19
+ "properties": {
20
+ "$schema": { "type": "string" },
21
+ "version": { "const": 1 },
22
+ "ok": { "type": "boolean" },
23
+ "cassetteDir": { "type": "string", "minLength": 1 },
24
+ "artifactsRoot": { "type": "string", "minLength": 1 },
25
+ "summaryPath": { "type": "string", "minLength": 1 },
26
+ "commands": { "$ref": "#/$defs/commands" },
27
+ "inputs": { "$ref": "#/$defs/counts" },
28
+ "replay": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["ok", "totalCount", "failureCount", "reportPath", "summaryPath"],
32
+ "properties": {
33
+ "ok": { "type": "boolean" },
34
+ "totalCount": { "type": "integer", "minimum": 0 },
35
+ "failureCount": { "type": "integer", "minimum": 0 },
36
+ "reportPath": { "type": "string" },
37
+ "summaryPath": { "type": "string" }
38
+ }
39
+ },
40
+ "outputs": { "$ref": "#/$defs/counts" },
41
+ "failures": {
42
+ "type": "array",
43
+ "items": { "$ref": "#/$defs/failure" }
44
+ }
45
+ },
46
+ "$defs": {
47
+ "checkCommand": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": ["argv"],
51
+ "properties": {
52
+ "argv": { "$ref": "#/$defs/checkArgv" }
53
+ }
54
+ },
55
+ "checkUpdateCommand": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["argv"],
59
+ "properties": {
60
+ "argv": {
61
+ "allOf": [
62
+ { "$ref": "#/$defs/checkArgv" },
63
+ { "contains": { "const": "--update-snapshots" } }
64
+ ]
65
+ }
66
+ }
67
+ },
68
+ "rerunCommand": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["argv"],
72
+ "properties": {
73
+ "argv": { "$ref": "#/$defs/rerunArgv" }
74
+ }
75
+ },
76
+ "checkArgv": {
77
+ "type": "array",
78
+ "minItems": 4,
79
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "check" }],
80
+ "items": { "type": "string", "minLength": 1 }
81
+ },
82
+ "rerunArgv": {
83
+ "type": "array",
84
+ "minItems": 4,
85
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "rerun" }],
86
+ "items": { "type": "string", "minLength": 1 }
87
+ },
88
+ "commands": {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": ["check", "updateSnapshots", "rerun"],
92
+ "properties": {
93
+ "check": { "$ref": "#/$defs/checkCommand" },
94
+ "updateSnapshots": { "$ref": "#/$defs/checkUpdateCommand" },
95
+ "rerun": { "$ref": "#/$defs/rerunCommand" }
96
+ }
97
+ },
98
+ "counts": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["totalCount", "failureCount"],
102
+ "properties": {
103
+ "totalCount": { "type": "integer", "minimum": 0 },
104
+ "failureCount": { "type": "integer", "minimum": 0 }
105
+ }
106
+ },
107
+ "failure": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["stage", "filePath", "errors"],
111
+ "properties": {
112
+ "stage": { "type": "string", "enum": ["input", "replay", "output"] },
113
+ "filePath": { "type": "string", "minLength": 1 },
114
+ "kind": { "type": "string" },
115
+ "errors": {
116
+ "type": "array",
117
+ "items": { "type": "string" }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ptywright.local/schemas/ptywright-agent-manifest.schema.json",
4
+ "title": "ptywright agent artifact manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "kind",
10
+ "ok",
11
+ "generatedAt",
12
+ "rootDir",
13
+ "primaryPath",
14
+ "commands",
15
+ "files"
16
+ ],
17
+ "properties": {
18
+ "$schema": { "type": "string" },
19
+ "version": { "const": 1 },
20
+ "kind": { "type": "string", "enum": ["run", "replay-suite", "check", "promote"] },
21
+ "ok": { "type": "boolean" },
22
+ "generatedAt": { "type": "string", "minLength": 1 },
23
+ "rootDir": { "type": "string", "minLength": 1 },
24
+ "primaryPath": { "type": "string", "minLength": 1 },
25
+ "commands": {
26
+ "type": "object",
27
+ "additionalProperties": { "$ref": "#/$defs/command" },
28
+ "minProperties": 1
29
+ },
30
+ "validation": { "$ref": "#/$defs/validation" },
31
+ "files": {
32
+ "type": "array",
33
+ "items": { "$ref": "#/$defs/file" }
34
+ }
35
+ },
36
+ "$defs": {
37
+ "command": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["argv"],
41
+ "properties": {
42
+ "argv": { "$ref": "#/$defs/agentArgv" }
43
+ }
44
+ },
45
+ "agentArgv": {
46
+ "type": "array",
47
+ "minItems": 3,
48
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }],
49
+ "items": { "type": "string", "minLength": 1 }
50
+ },
51
+ "validation": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["ok", "stages"],
55
+ "properties": {
56
+ "ok": { "type": "boolean" },
57
+ "stages": {
58
+ "type": "array",
59
+ "items": { "$ref": "#/$defs/validationStage" }
60
+ }
61
+ }
62
+ },
63
+ "validationStage": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["name", "ok", "totalCount", "failureCount"],
67
+ "properties": {
68
+ "name": { "type": "string", "minLength": 1 },
69
+ "ok": { "type": "boolean" },
70
+ "totalCount": { "type": "integer", "minimum": 0 },
71
+ "failureCount": { "type": "integer", "minimum": 0 }
72
+ }
73
+ },
74
+ "file": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["path", "kind", "bytes", "sha256"],
78
+ "properties": {
79
+ "path": {
80
+ "type": "string",
81
+ "minLength": 1,
82
+ "description": "Path to the artifact file, relative to the manifest directory when the file is inside the artifact root."
83
+ },
84
+ "kind": {
85
+ "type": "string",
86
+ "enum": [
87
+ "flow",
88
+ "cassette",
89
+ "run-record",
90
+ "replay-summary",
91
+ "check-summary",
92
+ "promote-summary",
93
+ "report",
94
+ "terminal",
95
+ "dom",
96
+ "screenshot",
97
+ "diff"
98
+ ]
99
+ },
100
+ "role": { "type": "string", "minLength": 1 },
101
+ "ok": { "type": "boolean" },
102
+ "bytes": { "type": "integer", "minimum": 0 },
103
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ptywright.local/schemas/ptywright-agent-promote.schema.json",
4
+ "title": "ptywright agent promote summary",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "ok",
10
+ "sourcePath",
11
+ "cassetteDir",
12
+ "targetDir",
13
+ "targetCassettePath",
14
+ "snapshotDir",
15
+ "artifactsRoot",
16
+ "summaryPath",
17
+ "updateSnapshots",
18
+ "commands",
19
+ "validation",
20
+ "replay",
21
+ "failures"
22
+ ],
23
+ "properties": {
24
+ "$schema": { "type": "string" },
25
+ "version": { "const": 1 },
26
+ "ok": { "type": "boolean" },
27
+ "sourcePath": { "type": "string", "minLength": 1 },
28
+ "cassetteDir": { "type": "string", "minLength": 1 },
29
+ "targetDir": { "type": "string", "minLength": 1 },
30
+ "targetCassettePath": { "type": "string", "minLength": 1 },
31
+ "snapshotDir": { "type": "string", "minLength": 1 },
32
+ "artifactsRoot": { "type": "string", "minLength": 1 },
33
+ "summaryPath": { "type": "string", "minLength": 1 },
34
+ "updateSnapshots": { "type": "boolean" },
35
+ "commands": { "$ref": "#/$defs/commands" },
36
+ "validation": { "$ref": "#/$defs/countsWithOk" },
37
+ "replay": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["ok", "totalCount", "failureCount", "reportPath", "summaryPath"],
41
+ "properties": {
42
+ "ok": { "type": "boolean" },
43
+ "totalCount": { "type": "integer", "minimum": 0 },
44
+ "failureCount": { "type": "integer", "minimum": 0 },
45
+ "reportPath": { "type": "string" },
46
+ "summaryPath": { "type": "string" }
47
+ }
48
+ },
49
+ "failures": {
50
+ "type": "array",
51
+ "items": { "$ref": "#/$defs/failure" }
52
+ }
53
+ },
54
+ "$defs": {
55
+ "promoteCommand": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["argv"],
59
+ "properties": {
60
+ "argv": { "$ref": "#/$defs/promoteArgv" }
61
+ }
62
+ },
63
+ "checkCommand": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["argv"],
67
+ "properties": {
68
+ "argv": { "$ref": "#/$defs/checkArgv" }
69
+ }
70
+ },
71
+ "checkUpdateCommand": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["argv"],
75
+ "properties": {
76
+ "argv": {
77
+ "allOf": [
78
+ { "$ref": "#/$defs/checkArgv" },
79
+ { "contains": { "const": "--update-snapshots" } }
80
+ ]
81
+ }
82
+ }
83
+ },
84
+ "rerunCommand": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["argv"],
88
+ "properties": {
89
+ "argv": { "$ref": "#/$defs/rerunArgv" }
90
+ }
91
+ },
92
+ "promoteArgv": {
93
+ "type": "array",
94
+ "minItems": 4,
95
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "promote" }],
96
+ "items": { "type": "string", "minLength": 1 }
97
+ },
98
+ "checkArgv": {
99
+ "type": "array",
100
+ "minItems": 4,
101
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "check" }],
102
+ "items": { "type": "string", "minLength": 1 }
103
+ },
104
+ "rerunArgv": {
105
+ "type": "array",
106
+ "minItems": 4,
107
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "rerun" }],
108
+ "items": { "type": "string", "minLength": 1 }
109
+ },
110
+ "commands": {
111
+ "type": "object",
112
+ "additionalProperties": false,
113
+ "required": ["promote", "check", "updateSnapshots", "rerun"],
114
+ "properties": {
115
+ "promote": { "$ref": "#/$defs/promoteCommand" },
116
+ "check": { "$ref": "#/$defs/checkCommand" },
117
+ "updateSnapshots": { "$ref": "#/$defs/checkUpdateCommand" },
118
+ "rerun": { "$ref": "#/$defs/rerunCommand" }
119
+ }
120
+ },
121
+ "countsWithOk": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["ok", "totalCount", "failureCount"],
125
+ "properties": {
126
+ "ok": { "type": "boolean" },
127
+ "totalCount": { "type": "integer", "minimum": 0 },
128
+ "failureCount": { "type": "integer", "minimum": 0 }
129
+ }
130
+ },
131
+ "failure": {
132
+ "type": "object",
133
+ "additionalProperties": false,
134
+ "required": ["stage", "filePath", "errors"],
135
+ "properties": {
136
+ "stage": { "type": "string", "enum": ["validation", "replay"] },
137
+ "filePath": { "type": "string", "minLength": 1 },
138
+ "kind": { "type": "string" },
139
+ "errors": {
140
+ "type": "array",
141
+ "items": { "type": "string" }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,140 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ptywright.local/schemas/ptywright-agent-replay-summary.schema.json",
4
+ "title": "ptywright agent replay summary",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "ok",
10
+ "dir",
11
+ "suiteDir",
12
+ "durationMs",
13
+ "reportPath",
14
+ "summaryPath",
15
+ "commands",
16
+ "updateSnapshots",
17
+ "totalCount",
18
+ "failureCount",
19
+ "entries"
20
+ ],
21
+ "properties": {
22
+ "$schema": { "type": "string" },
23
+ "version": { "const": 1 },
24
+ "ok": { "type": "boolean" },
25
+ "dir": { "type": "string", "minLength": 1 },
26
+ "suiteDir": { "type": "string", "minLength": 1 },
27
+ "durationMs": { "type": "integer", "minimum": 0 },
28
+ "reportPath": { "type": "string", "minLength": 1 },
29
+ "summaryPath": { "type": "string", "minLength": 1 },
30
+ "commands": { "$ref": "#/$defs/commands" },
31
+ "updateSnapshots": { "type": "boolean" },
32
+ "totalCount": { "type": "integer", "minimum": 0 },
33
+ "failureCount": { "type": "integer", "minimum": 0 },
34
+ "entries": {
35
+ "type": "array",
36
+ "items": { "$ref": "#/$defs/entry" }
37
+ }
38
+ },
39
+ "$defs": {
40
+ "replayAllCommand": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["argv"],
44
+ "properties": {
45
+ "argv": { "$ref": "#/$defs/replayAllArgv" }
46
+ }
47
+ },
48
+ "replayAllUpdateCommand": {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": ["argv"],
52
+ "properties": {
53
+ "argv": {
54
+ "allOf": [
55
+ { "$ref": "#/$defs/replayAllArgv" },
56
+ { "contains": { "const": "--update-snapshots" } }
57
+ ]
58
+ }
59
+ }
60
+ },
61
+ "rerunCommand": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["argv"],
65
+ "properties": {
66
+ "argv": { "$ref": "#/$defs/rerunArgv" }
67
+ }
68
+ },
69
+ "replayAllArgv": {
70
+ "type": "array",
71
+ "minItems": 4,
72
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "replay-all" }],
73
+ "items": { "type": "string", "minLength": 1 }
74
+ },
75
+ "rerunArgv": {
76
+ "type": "array",
77
+ "minItems": 4,
78
+ "prefixItems": [{ "const": "ptywright" }, { "const": "agent" }, { "const": "rerun" }],
79
+ "items": { "type": "string", "minLength": 1 }
80
+ },
81
+ "commands": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "required": ["replayAll", "updateSnapshots", "rerun"],
85
+ "properties": {
86
+ "replayAll": { "$ref": "#/$defs/replayAllCommand" },
87
+ "updateSnapshots": { "$ref": "#/$defs/replayAllUpdateCommand" },
88
+ "rerun": { "$ref": "#/$defs/rerunCommand" }
89
+ }
90
+ },
91
+ "entry": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "required": [
95
+ "filePath",
96
+ "durationMs",
97
+ "ok",
98
+ "mode",
99
+ "frames",
100
+ "reportPath",
101
+ "recordPath",
102
+ "cassettePath",
103
+ "failedArtifacts",
104
+ "errors"
105
+ ],
106
+ "properties": {
107
+ "filePath": { "type": "string", "minLength": 1 },
108
+ "durationMs": { "type": "integer", "minimum": 0 },
109
+ "ok": { "type": "boolean" },
110
+ "mode": { "type": "string", "enum": ["live", "replay"] },
111
+ "frames": { "type": "integer", "minimum": 0 },
112
+ "reportPath": { "type": "string", "minLength": 1 },
113
+ "recordPath": { "type": "string", "minLength": 1 },
114
+ "cassettePath": { "type": "string", "minLength": 1 },
115
+ "failedArtifacts": {
116
+ "type": "array",
117
+ "items": { "$ref": "#/$defs/failedArtifact" }
118
+ },
119
+ "errors": {
120
+ "type": "array",
121
+ "items": { "type": "string" }
122
+ }
123
+ }
124
+ },
125
+ "failedArtifact": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "required": ["name", "viewport", "kind", "path"],
129
+ "properties": {
130
+ "name": { "type": "string", "minLength": 1 },
131
+ "viewport": { "type": "string", "minLength": 1 },
132
+ "kind": { "type": "string", "enum": ["terminal", "dom", "screenshot"] },
133
+ "path": { "type": "string", "minLength": 1 },
134
+ "baselinePath": { "type": "string", "minLength": 1 },
135
+ "diffPath": { "type": "string", "minLength": 1 },
136
+ "error": { "type": "string" }
137
+ }
138
+ }
139
+ }
140
+ }