@tayo-dev/rtl 1.3.1 → 1.4.1

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 (87) hide show
  1. package/README.md +38 -97
  2. package/assets/claude/commands/@tayo-dev/rtl/generate.md +43 -6
  3. package/assets/claude/commands/@tayo-dev/rtl/help.md +2 -2
  4. package/assets/codex/@tayo-dev/rtl-conventions/SKILL.md +38 -6
  5. package/assets/codex/@tayo-dev/rtl-generate/SKILL.md +125 -13
  6. package/assets/codex/@tayo-dev/rtl-generate/references/assertion-markers.md +62 -0
  7. package/assets/codex/@tayo-dev/rtl-generate/references/auth.md +92 -0
  8. package/assets/codex/@tayo-dev/rtl-generate/references/conventions-schema.md +184 -0
  9. package/assets/codex/@tayo-dev/rtl-generate/references/entry-path-fidelity.md +68 -0
  10. package/assets/codex/@tayo-dev/rtl-generate/references/intent-model.md +232 -0
  11. package/assets/codex/@tayo-dev/rtl-generate/references/mock-store.md +18 -0
  12. package/assets/codex/@tayo-dev/rtl-generate/references/quality-scoring.md +189 -0
  13. package/assets/codex/@tayo-dev/rtl-generate/references/state-schema.md +119 -0
  14. package/assets/codex/@tayo-dev/rtl-generate/references/test-index.md +12 -0
  15. package/assets/codex/@tayo-dev/rtl-generate/references/verification-gate.md +93 -0
  16. package/assets/codex/@tayo-dev/rtl-help/SKILL.md +21 -7
  17. package/assets/codex/@tayo-dev/rtl-mocks/SKILL.md +55 -9
  18. package/assets/gemini/commands/@tayo-dev/rtl/generate.toml +28 -6
  19. package/assets/gemini/commands/@tayo-dev/rtl/help.toml +2 -2
  20. package/assets/opencode/commands/@tayo-dev/rtl-generate.md +32 -6
  21. package/assets/opencode/commands/@tayo-dev/rtl-help.md +2 -2
  22. package/dist/cli/commands/generate.d.ts +1 -7
  23. package/dist/cli/commands/generate.d.ts.map +1 -1
  24. package/dist/cli/commands/generate.js +264 -101
  25. package/dist/cli/commands/generate.js.map +1 -1
  26. package/dist/cli/commands/install.js +6 -6
  27. package/dist/core/baseline-normalizer.d.ts.map +1 -1
  28. package/dist/core/baseline-normalizer.js +42 -0
  29. package/dist/core/baseline-normalizer.js.map +1 -1
  30. package/dist/core/generator.d.ts +0 -2
  31. package/dist/core/generator.d.ts.map +1 -1
  32. package/dist/core/generator.js +81 -8
  33. package/dist/core/generator.js.map +1 -1
  34. package/dist/core/input-loader.d.ts +2 -2
  35. package/dist/core/input-loader.d.ts.map +1 -1
  36. package/dist/core/input-loader.js +7 -16
  37. package/dist/core/input-loader.js.map +1 -1
  38. package/dist/core/js-parser.d.ts +2 -1
  39. package/dist/core/js-parser.d.ts.map +1 -1
  40. package/dist/core/js-parser.js +70 -1
  41. package/dist/core/js-parser.js.map +1 -1
  42. package/dist/core/orchestrator.d.ts +1 -1
  43. package/dist/core/orchestrator.js +4 -4
  44. package/dist/core/parser.js +2 -2
  45. package/dist/core/recording-intelligence.d.ts +1 -1
  46. package/dist/core/recording-intelligence.d.ts.map +1 -1
  47. package/dist/core/recording-intelligence.js +298 -4
  48. package/dist/core/recording-intelligence.js.map +1 -1
  49. package/dist/core/resolver.d.ts +2 -1
  50. package/dist/core/resolver.d.ts.map +1 -1
  51. package/dist/core/resolver.js +334 -4
  52. package/dist/core/resolver.js.map +1 -1
  53. package/dist/core/scanner.d.ts +3 -3
  54. package/dist/core/scanner.js +9 -9
  55. package/dist/core/scorer.d.ts +6 -2
  56. package/dist/core/scorer.d.ts.map +1 -1
  57. package/dist/core/scorer.js +75 -7
  58. package/dist/core/scorer.js.map +1 -1
  59. package/dist/core/suite-planner.d.ts.map +1 -1
  60. package/dist/core/suite-planner.js +186 -17
  61. package/dist/core/suite-planner.js.map +1 -1
  62. package/dist/core/writer.d.ts +0 -1
  63. package/dist/core/writer.d.ts.map +1 -1
  64. package/dist/core/writer.js +3 -3
  65. package/dist/core/writer.js.map +1 -1
  66. package/dist/index.d.ts +2 -2
  67. package/dist/index.js +19 -15
  68. package/dist/index.js.map +1 -1
  69. package/dist/install/planner.js +1 -1
  70. package/dist/install/runtimes/codex.d.ts.map +1 -1
  71. package/dist/install/runtimes/codex.js +18 -0
  72. package/dist/install/runtimes/codex.js.map +1 -1
  73. package/dist/install/types.d.ts +1 -1
  74. package/dist/learner/index.d.ts +2 -2
  75. package/dist/learner/index.js +3 -3
  76. package/dist/learner/storage.d.ts +1 -1
  77. package/dist/learner/storage.js +2 -2
  78. package/dist/templates/test-template.d.ts +4 -0
  79. package/dist/templates/test-template.d.ts.map +1 -1
  80. package/dist/templates/test-template.js +10 -1
  81. package/dist/templates/test-template.js.map +1 -1
  82. package/dist/types/recording.d.ts +118 -0
  83. package/dist/types/recording.d.ts.map +1 -1
  84. package/dist/types/recording.js.map +1 -1
  85. package/dist/types/score.d.ts +15 -0
  86. package/dist/types/score.d.ts.map +1 -1
  87. package/package.json +5 -5
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Taro
1
+ # Tayo
2
2
 
3
- Install Taro into Claude Code, OpenCode, Gemini CLI, or Codex, then generate React Testing Library tests from Testing Library Recorder recordings.
3
+ Install Tayo into Claude Code, OpenCode, Gemini CLI, or Codex, then generate React Testing Library tests from Testing Library Recorder JS exports.
4
4
 
5
- Taro ships as an installer-first package. The package entrypoint bootstraps runtime-native commands or skills into your agent environment, and the generated runtime surface still routes back to `taro generate` when you want Recorder-to-RTL output.
5
+ Tayo ships as an installer-first package. The package entrypoint bootstraps runtime-native commands or skills into your agent environment, and those runtime entrypoints execute Tayo's internal JS-only generation flow for Recorder-to-RTL output.
6
6
 
7
7
  ## Getting Started
8
8
 
@@ -33,7 +33,7 @@ Re-run the installer package to refresh owned assets and repair missing ones:
33
33
  npx @tayo-dev/rtl@latest
34
34
  ```
35
35
 
36
- Taro refreshes unchanged owned files automatically, restores missing owned files, and protects manual edits instead of overwriting them silently.
36
+ Tayo refreshes unchanged owned files automatically, restores missing owned files, and protects manual edits instead of overwriting them silently.
37
37
 
38
38
  ## Non-interactive Install
39
39
 
@@ -80,15 +80,20 @@ npm run build
80
80
  node dist/index.js --all --local
81
81
 
82
82
  # Or verify the publish boundary with a tarball
83
- env NPM_CONFIG_CACHE=/tmp/taro-npm-cache npm pack --pack-destination /tmp/taro-pack
84
- npx /tmp/taro-pack/tayo-dev-rtl-1.0.0.tgz --codex --local
83
+ env NPM_CONFIG_CACHE=/tmp/tayo-npm-cache npm pack --pack-destination /tmp/tayo-pack
84
+ npx /tmp/tayo-pack/tayo-dev-rtl-1.0.0.tgz --codex --local
85
85
  ```
86
86
 
87
87
  The tarball flow is the closest match to what end users get from npm.
88
88
 
89
89
  ## Generate RTL Tests
90
90
 
91
- After installation, use `taro generate` directly or call the runtime-native installed command/skill that routes to it.
91
+ After installation, use the runtime-native installed generate command or skill for your agent:
92
+
93
+ - Claude Code: `/@tayo-dev/rtl:generate`
94
+ - Gemini CLI: `/@tayo-dev/rtl:generate`
95
+ - OpenCode: `/@tayo-dev/rtl-generate`
96
+ - Codex: `$@tayo-dev/rtl-generate`
92
97
 
93
98
  ### Prerequisites
94
99
 
@@ -100,89 +105,37 @@ After installation, use `taro generate` directly or call the runtime-native inst
100
105
 
101
106
  Open Chrome DevTools → Recorder panel → click "Start new recording" → perform your user flow → click "End recording".
102
107
 
103
- Taro supports two export paths:
108
+ Tayo supports one export path:
104
109
 
105
- - Testing Library Recorder JS baseline export: save as `recording.js`
106
- - Chrome Recorder JSON export: save as `recording.json`
110
+ - Testing Library Recorder JS export: save as `recording.js`
107
111
 
108
112
  ### Generate the test
109
113
 
110
- ```bash
111
- # JS baseline path
112
- taro generate ./recording.js
113
-
114
- # Supported JSON path
115
- taro generate ./recording.json
116
- ```
114
+ Run your runtime-native generate entrypoint against `recording.js`. Tayo writes `recording.test.tsx` next to the recording and refuses to overwrite an existing file, so rename or delete the previous generated file before rerunning.
117
115
 
118
116
  Expected output:
119
117
 
120
118
  ```text
121
119
  Parsed: my user flow — 8 steps
122
- [taro] Score: 78/100 (B) — query: 80, assertions: 70, structure: 85
120
+ [tayo] Score: 78/100 (B) — query: 80, assertions: 70, structure: 85
123
121
  Created: src/components/MyComponent.test.tsx
124
- [taro] ✓ post-write verified
122
+ [tayo] ✓ post-write verified
125
123
  ```
126
124
 
127
- On subsequent runs in the same project, Taro reads `.taro/conventions.json` to match your test style automatically.
125
+ On subsequent runs in the same project, Tayo reads `.tayo/conventions.json` to match your test style automatically.
128
126
 
129
127
  ### Draft-quality output is explicit
130
128
 
131
- When Taro cannot prove the final render/query boundary yet, it keeps the output writable but marks it as draft-quality instead of pretending the gaps are solved.
129
+ When Tayo cannot prove the final render/query boundary yet, it keeps the output writable but marks it as draft-quality instead of pretending the gaps are solved.
132
130
 
133
131
  ```text
134
- [taro] Score: 77/100 (C) — query: 100, assertions: 30, structure: 70, boundary: 100
135
- [taro] Manual review required — this generated test is still a draft (77/100, C).
136
- [taro] Top blockers: The generated test still renders <App /> instead of a resolved repo target. | Boundary warnings remain in the generated file, so the render/mock boundary still needs cleanup.
137
- // taro-query-checkpoint: click step requires manual RTL query recovery
138
- ```
139
-
140
- That draft banner is advisory. Taro does not block writes, but it does tell you when import targets, placeholder queries, or unresolved boundaries still need cleanup.
141
-
142
- ## CLI Reference
143
-
144
- ### `taro generate <file>`
145
-
146
- Generates a React Testing Library test from a Testing Library Recorder JS export or a Chrome Recorder JSON export.
147
-
148
- **Arguments:**
149
-
150
- | Argument | Description |
151
- |----------|-------------|
152
- | `<file>` | Path to the recording file. Accepts Testing Library Recorder JS files (`.js`) and Chrome Recorder JSON files (`.json`). |
153
-
154
- **Options:**
155
-
156
- | Flag | Short | Default | Description |
157
- |------|-------|---------|-------------|
158
- | `--output <path>` | `-o` | Same directory as input, `{name}.test.tsx` | Override the output file path for the generated test. |
159
- | `--dry-run` | `-d` | `false` | Print the generated test to stdout and show the score without writing to disk. Useful for previewing output before committing. |
160
- | `--force` | `-f` | `false` | Overwrite an existing test file. Without this flag, Taro exits with an error if the output file already exists. |
161
- | `--version` | `-v` | — | Print the installed version and exit. |
162
- | `--help` | `-h` | — | Display command help and exit. |
163
-
164
- **Examples:**
165
-
166
- ```bash
167
- # Generate and write a test next to the recording
168
- taro generate ./recordings/checkout-flow.js
169
-
170
- # Preview without writing (dry run)
171
- taro generate --dry-run ./recordings/checkout-flow.js
172
-
173
- # Write to a specific path
174
- taro generate --output src/__tests__/checkout.test.tsx ./recordings/checkout-flow.js
175
-
176
- # Overwrite an existing test
177
- taro generate --force ./recordings/checkout-flow.js
132
+ [tayo] Score: 77/100 (C) — query: 100, assertions: 30, structure: 70, boundary: 100
133
+ [tayo] Manual review required — this generated test is still a draft (77/100, C).
134
+ [tayo] Top blockers: The generated test still renders <App /> instead of a resolved repo target. | Boundary warnings remain in the generated file, so the render/mock boundary still needs cleanup.
135
+ // tayo-query-checkpoint: click step requires manual RTL query recovery
178
136
  ```
179
137
 
180
- **Output file naming:**
181
- If `--output` is not provided, Taro derives the output path from the input file: `{input-dir}/{input-basename}.test.tsx`. For example, `./recordings/login.js` → `./recordings/login.test.tsx`.
182
-
183
- **Supported input formats:**
184
- - Testing Library Recorder JS (`.js`) — primary v1.3 path; Taro treats this as a baseline artifact to parse, enrich, and transform into a project-shaped RTL test
185
- - Chrome Recorder JSON (`.json`) — supported parity path; Taro preserves the existing JSON generate flow while JS fidelity improves
138
+ That draft banner is advisory. Tayo does not block writes, but it does tell you when import targets, placeholder queries, or unresolved boundaries still need cleanup.
186
139
 
187
140
  ## Worked Example
188
141
 
@@ -204,24 +157,22 @@ test('login flow', async () => {
204
157
  })
205
158
  ```
206
159
 
207
- ### Command
160
+ ### Runtime command
208
161
 
209
- ```bash
210
- taro generate ./login-flow.js
211
- ```
162
+ Run your installed runtime-native generate entrypoint with `./login-flow.js`.
212
163
 
213
164
  ### Terminal output
214
165
 
215
166
  ```
216
167
  Parsed: login flow — 7 steps
217
- [taro] Score: 82/100 (B) — query: 90, assertions: 75, structure: 80
168
+ [tayo] Score: 82/100 (B) — query: 90, assertions: 75, structure: 80
218
169
  Created: login-flow.test.tsx
219
- [taro] ✓ post-write verified
170
+ [tayo] ✓ post-write verified
220
171
  ```
221
172
 
222
173
  ### Output: Generated test (`login-flow.test.tsx`)
223
174
 
224
- Taro generates a convention-aware RTL test with accessible queries:
175
+ Tayo generates a convention-aware RTL test with accessible queries:
225
176
 
226
177
  ```typescript
227
178
  import { render, screen } from '@testing-library/react'
@@ -244,7 +195,7 @@ describe('login flow', () => {
244
195
  })
245
196
  ```
246
197
 
247
- ### What Taro did here
198
+ ### What Tayo did here
248
199
 
249
200
  - Parsed the navigate step and inferred the component under test
250
201
  - Upgraded CSS selectors (`#email`, `#password`) to accessible `getByRole` queries using aria attributes from the recording
@@ -252,30 +203,20 @@ describe('login flow', () => {
252
203
  - Mapped the `waitForElement` step to a `toBeInTheDocument()` assertion
253
204
  - Scored the output (82/100) and emitted no blocking errors
254
205
 
255
- > **Note:** The component import path (`../LoginPage`) is a placeholder. Taro generates a comment in the file indicating where to update it.
256
-
257
- ### JSON is also supported
258
-
259
- If you export Chrome Recorder JSON instead, the command surface stays the same:
260
-
261
- ```bash
262
- taro generate ./login-flow.json --dry-run
263
- ```
264
-
265
- JSON generation is still supported, but it does not inherit the repo-aware JS recovery stack. When the generated preview contains placeholder queries or weak assertions, Taro keeps those gaps explicit with score and manual-review messaging instead of fabricating stronger evidence.
206
+ > **Note:** The component import path (`../LoginPage`) is a placeholder. Tayo generates a comment in the file indicating where to update it.
266
207
 
267
208
  ## Agent Usage
268
209
 
269
- After installation, each runtime gets a namespaced help entrypoint plus a generate command or skill that routes back to `taro generate`.
210
+ After installation, each runtime gets a namespaced help entrypoint plus a generate command or skill that runs Tayo's internal JS generator.
270
211
 
271
212
  ### Tips
272
213
 
273
- - Use `--dry-run` first to preview output before committing generated files
274
- - If you record multiple flows, run Taro on each to build up convention state in `.taro/conventions.json` — later runs benefit from earlier ones
275
- - Pass `--force` when re-recording an updated flow to overwrite the old test
276
- - The `.taro/` directory should be committed to your repo so convention learning persists across team members
214
+ - Tayo writes the generated test next to the recording file using the same basename
215
+ - If you re-record a flow, rename or delete the old generated test before running Tayo again
216
+ - If you record multiple flows, run Tayo on each to build up convention state in `.tayo/conventions.json` — later runs benefit from earlier ones
217
+ - The `.tayo/` directory should be committed to your repo so convention learning persists across team members
277
218
 
278
219
  ### Notes
279
220
 
280
- - Taro does not require network access at generation time (DOM inspection via Playwright is optional and only runs when a live URL is in the recording)
281
- - All state is local to `.taro/` — no external service is contacted
221
+ - Tayo does not require network access at generation time (DOM inspection via Playwright is optional and only runs when a live URL is in the recording)
222
+ - All state is local to `.tayo/` — no external service is contacted
@@ -1,15 +1,52 @@
1
1
  ---
2
2
  name: "@tayo-dev/rtl:generate"
3
- description: "Generate RTL tests from Recorder exports with Taro"
3
+ description: "Generate RTL tests from Recorder exports with Tayo"
4
4
  ---
5
5
 
6
6
  <objective>
7
- Generate a React Testing Library test from a Recorder export.
7
+ Generate a React Testing Library test from a Testing Library Recorder JS export, interpret the score output, and guide the user through any required manual fixes.
8
8
  </objective>
9
9
 
10
10
  <process>
11
- 1. Confirm the recording path before running anything destructive.
12
- 2. Run `taro generate <recording-file>` by default.
13
- 3. Add `--dry-run`, `--output <path>`, or `--force` only when the user asks for them or the context requires them.
14
- 4. Report the generated file path and score output.
11
+ 1. Confirm the recording file path and extension (`.js` only).
12
+ 2. Tayo writes `{recording-name}.test.tsx` next to the recording. If that file already exists, stop and tell the user to rename or delete it before rerunning generation.
13
+ 3. Run `tayo __generate <recording-file>`.
14
+ 4. Parse and report the score, grade, and blockers.
15
+ 5. Work through the post-generation checklist for any issues found.
15
16
  </process>
17
+
18
+ <scoring>
19
+ Tayo scores on four weighted dimensions. Grade: A ≥ 90, B ≥ 80, C ≥ 70, D ≥ 60, F < 60.
20
+ Score below 80 or QUAL-02 marker failure → Tayo emits "Manual review required".
21
+
22
+ Query dimension (30%): getByRole = 100pts, getByLabelText = 80pts, getByText = 60pts, getByPlaceholderText = 50pts, getByTestId = 20pts. Each tayo-query-checkpoint comment deducts 3pts (capped at −40).
23
+
24
+ Assertion dimension (25%): toHaveValue/toBeChecked/toHaveTextContent/toBeVisible = full credit. toBeInTheDocument = 30% credit. No assertions = 0.
25
+
26
+ Structure dimension (20%): Base 50. describe() block +20. Each extra it() block +15 (cap +30). render(<App />) −25. tayo-boundary-warning −20. Single test >2000 chars −20.
27
+
28
+ Boundary dimension (25%): Start 100. leaf-render-boundary −35. inline-hook-mock −30. helper-embedded-assertion −20. positional-control-selection −15.
29
+ </scoring>
30
+
31
+ <boundary-issues>
32
+ tayo-boundary-warning comments mark one of four issues:
33
+
34
+ leaf-render-boundary (−35): Test renders *Form, *Dialog, *Modal, or *Drawer directly while the flow involves container-level interaction. Fix: render the nearest page/module component that owns the trigger button and the dialog lifecycle.
35
+
36
+ inline-hook-mock (−30): vi.mock/jest.mock defines use*Query or use*Mutation hooks inline. Fix: move hook mocks to a shared fixture or raise the render boundary.
37
+
38
+ helper-embedded-assertion (−20): A helper function outside the test body contains expect(). Fix: assertions belong in the it() body; helpers handle setup and navigation only.
39
+
40
+ positional-control-selection (−15): getAllByRole('button')[2] positional indexing. Fix: scope with within(container) or use a more specific accessible name.
41
+ </boundary-issues>
42
+
43
+ <post-generation-checklist>
44
+ 1. Fix render(<App />) — find the narrowest component that owns the trigger and expected outcome.
45
+ 2. Resolve tayo-query-checkpoint comments — apply the query hierarchy: getByRole > getByLabelText > getByText > getByPlaceholderText > getByTestId.
46
+ 3. Upgrade toBeInTheDocument() — replace with toHaveTextContent(), toHaveValue(), or toBeVisible() when the expected value is known.
47
+ 4. Fix tayo-boundary-warning comments — apply the boundary fix from the boundary-issues section above.
48
+ </post-generation-checklist>
49
+
50
+ <response-contract>
51
+ Report: the command run, the generated file path, the score and grade (e.g. 82/100 B — query: 90 assertions: 75 structure: 80 boundary: 85), whether manual review is required, the top blockers, and which post-generation steps apply with specific guidance for each.
52
+ </response-contract>
@@ -10,7 +10,7 @@ Help the user install and use @tayo-dev/rtl from Claude Code.
10
10
  <process>
11
11
  1. Explain that `/@tayo-dev/rtl:help` is the installed help entrypoint for @tayo-dev/rtl.
12
12
  2. For installation or updates, tell the user to run `npx @tayo-dev/rtl@latest`.
13
- 3. For test generation, use `/@tayo-dev/rtl:generate` or run `taro generate <recording-file>`.
14
- 4. Mention `--dry-run`, `--output <path>`, and `--force` only when they fit the request.
13
+ 3. For test generation, use `/@tayo-dev/rtl:generate` with a Testing Library Recorder `.js` export.
14
+ 4. Tell the user Tayo writes `{recording-name}.test.tsx` next to the recording and will not overwrite an existing file.
15
15
  5. When generation runs, report the score and generated file path.
16
16
  </process>
@@ -1,19 +1,51 @@
1
1
  ---
2
2
  name: "@tayo-dev/rtl-conventions"
3
- description: "Explain how Tayo learns project test conventions and how to keep them stable."
3
+ description: "Explain and stabilize how Tayo learns project test conventions from `.tayo/conventions.json` and nearby repo examples. Use when generated output style, imports, file placement, helpers, or mock structure differ from expectations, or when the user wants Tayo to follow local testing conventions more closely."
4
4
  ---
5
5
 
6
6
  # Tayo Conventions
7
7
 
8
- Use `$@tayo-dev/rtl-conventions` when the user asks why generated tests follow a certain style or how `.taro/conventions.json` affects output.
8
+ Invoke this skill with `$@tayo-dev/rtl-conventions`.
9
9
 
10
- ## Focus
10
+ ## What `.tayo/conventions.json` Controls
11
11
 
12
- - explain that Tayo learns local test conventions from the codebase
13
- - call out when `.taro/conventions.json` will influence generated imports, mocks, and file placement
14
- - recommend `--dry-run` when the user wants to inspect convention alignment before writing files
12
+ Tayo reads `.tayo/conventions.json` on every generation and uses it to align output with the project's test style. Key fields:
13
+
14
+ | Field | Values | Effect |
15
+ |-------|--------|--------|
16
+ | `importStyle` | `"esm"` (default) / `"cjs"` | Controls `import` vs `require` in generated tests |
17
+ | Render helper name | learned from repo | Tayo reuses existing render wrapper functions instead of writing `render(...)` directly |
18
+ | File placement | learned from repo | Tayo matches `__tests__/`, `*.test.tsx` co-location, or `src/tests/` depending on what exists |
19
+ | Mock shape | learned from repo | Tayo aligns factory shapes with existing `vi.mock` or `jest.mock` examples |
20
+
21
+ Tayo accumulates knowledge from existing test files in the project. Commit `.tayo/conventions.json` to your repo so convention learning persists for all team members.
22
+
23
+ ## Investigation Workflow
24
+
25
+ 1. Check whether `.tayo/conventions.json` exists. If it is missing, Tayo falls back to generic defaults — the fix is to run Tayo on a few existing flows so it can learn the project style.
26
+ 2. Sample nearby existing tests when repo context is available.
27
+ 3. Compare generated output against local patterns for imports, render helpers, user-event setup, mocks, naming, and file placement.
28
+ 4. Explain whether the mismatch comes from learned repo conventions, missing examples, or a current Tayo limitation.
29
+
30
+ ## How to Correct Convention Drift
31
+
32
+ - **Wrong import style** — set `importStyle` in `.tayo/conventions.json` to `"esm"` or `"cjs"`.
33
+ - **Wrong file placement** — move one generated test to the correct location and re-run; Tayo picks up placement from the nearest examples.
34
+ - **Missing render wrapper** — if the project uses a custom `renderWithProviders` helper, add one test that uses it; subsequent generations will prefer it.
35
+ - **Before re-running generation** — make sure the sibling `{recording-name}.test.tsx` path is free, because Tayo writes next to the recording and will not overwrite an existing file.
15
36
 
16
37
  ## Guardrails
17
38
 
18
39
  - prefer existing project conventions over generic defaults
19
40
  - surface missing context instead of inventing project-specific patterns
41
+ - if there is no stable local pattern, say that directly instead of claiming Tayo has a single correct style
42
+ - tell the user what repo examples or config need to exist for future generations to improve
43
+
44
+ ## Response Contract
45
+
46
+ Summarize:
47
+
48
+ - what conventions Tayo is currently picking up (importStyle, render helper, file placement)
49
+ - where the generated output matches or diverges from local patterns
50
+ - whether `.tayo/conventions.json` or repo examples are driving the current behavior
51
+ - the specific field or example the user needs to add or fix to improve future generations
@@ -1,28 +1,140 @@
1
1
  ---
2
2
  name: "@tayo-dev/rtl-generate"
3
- description: "Generate React Testing Library tests from Recorder JS or Chrome Recorder JSON exports with Tayo."
3
+ description: "Generate deterministic, repository-aware React Testing Library tests from Testing Library Recorder JS exports with Tayo. Use when a user provides a Recorder `.js` file, asks to turn a recorded flow into an RTL test, needs render-boundary or mock strategy guidance, or needs score and verification output interpreted precisely."
4
4
  ---
5
5
 
6
6
  # Tayo Generate
7
7
 
8
- Use `$@tayo-dev/rtl-generate` when the user wants to turn a Recorder JS export or Chrome Recorder JSON export into a React Testing Library test.
8
+ Invoke this skill with `$@tayo-dev/rtl-generate`.
9
9
 
10
- ## Inputs
10
+ ## Purpose
11
11
 
12
- - path to the recording file (`.js` or `.json`)
13
- - optional `--output <path>`
14
- - optional `--dry-run`
15
- - optional `--force`
12
+ Transform a Testing Library Recorder `.js` recording into a maintainable, project-aware RTL test without losing behavioral fidelity.
16
13
 
17
- ## Execution
14
+ Non-negotiable expectations:
18
15
 
19
- Run `taro generate <recording-file>` with the requested flags.
16
+ - parse recordings deterministically through the Tayo pipeline; do not improvise a second parser
17
+ - prefer semantic user intent over DOM mechanics
18
+ - treat semantic `dblClick` checkpoints as assertion evidence, not as UI actions to replay
19
+ - preserve the real entry path when the recording opens UI through a parent trigger or route flow
20
+ - never solve a generation problem by reimplementing design-system or shared UI-library components in mocks
21
+ - keep low-confidence gaps explicit instead of pretending the output is finished
20
22
 
21
- ## Response contract
23
+ ## Reference Map
24
+
25
+ Read only the files that apply to the current problem:
26
+
27
+ - `references/intent-model.md` for parsed-step normalization and interaction-intent recovery
28
+ - `references/assertion-markers.md` for converting semantic `dblClick` checkpoints into explicit assertions
29
+ - `references/entry-path-fidelity.md` when deciding parent trigger flow versus direct dialog/form harnesses
30
+ - `references/conventions-schema.md` when interpreting `.tayo/conventions.json` or convention drift
31
+ - `references/mock-store.md` when deciding fixture reuse or persistent mock storage
32
+ - `references/quality-scoring.md` when explaining score changes, grade drops, or blocker priorities
33
+ - `references/verification-gate.md` when deciding whether generated output is acceptable to hand off
34
+ - `references/auth.md` only when live URL inspection or screenshots hit an authentication wall
35
+ - `references/state-schema.md` and `references/test-index.md` only when state/history questions matter
36
+
37
+ ## Working Style
38
+
39
+ Keep discovery narrow and deliberate.
40
+
41
+ - Default cap: inspect at most 5 repo files before generation planning.
42
+ - Prioritize target source, nearest sibling test, shared mock setup, nearest fixture store, then config.
43
+ - If uncertainty remains after that cap, stop expanding scope and report the limitation instead of scanning blindly.
44
+
45
+ When you do repo inspection beyond Tayo's own console output, report:
46
+
47
+ - `Surface scan: {N}/5 files`
48
+ - `Selected files: [...]`
49
+ - `Skipped expansions: [...]`
50
+
51
+ ## Preflight
52
+
53
+ 1. Accept only Testing Library Recorder `.js` exports.
54
+ 2. Tayo writes `{recording-name}.test.tsx` next to the recording.
55
+ 3. If that sibling output file already exists, stop and tell the user to rename or delete it before rerunning generation.
56
+ 4. If the user is asking for convention diagnosis or mock review instead of generation, route them to the more specific Tayo skill when that is the better fit.
57
+
58
+ ## Generation Workflow
59
+
60
+ 1. Validate the input recording and confirm it is the intended flow.
61
+ 2. Recover semantic intent from the recording before discussing code changes.
62
+ 3. Resolve render boundary and mock plan with entry-path fidelity in mind.
63
+ 4. Run `tayo __generate <recording-file>`.
64
+ 5. Interpret score, blockers, marker coverage, and verification output before calling the result complete.
65
+
66
+ ## Intent Recovery Rules
67
+
68
+ - Prefer accessible role/name and visible-text evidence over CSS evidence.
69
+ - Use semantic marker guidance from `references/assertion-markers.md` when the recording preserves checkpoint intent.
70
+ - Treat unresolved selector evidence as an explicit checkpoint to explain, not something to hide with fabricated queries.
71
+ - Use `getByTestId` only as a last resort and only when the repo conventions justify it.
72
+
73
+ ## Entry-Path Fidelity
74
+
75
+ Use `references/entry-path-fidelity.md` whenever the recording opens a form, drawer, dialog, or route through earlier trigger steps.
76
+
77
+ Default behavior:
78
+
79
+ - if the recording clicks a parent trigger first, prefer rendering the parent/module composition and replaying that trigger
80
+ - do not replace a real parent-trigger flow with a directly-open dialog harness when the parent path is available
81
+ - if Tayo emits boundary warnings or falls back to `render(<App />)`, explain that as a fidelity or context gap, not a finished solution
82
+
83
+ ## Mock Boundary Policy
84
+
85
+ This policy is mandatory on every run.
86
+
87
+ Allowed mock targets:
88
+
89
+ - data/query/mutation boundaries
90
+ - auth/session boundaries
91
+ - router/navigation boundaries
92
+ - environment/browser gaps
93
+ - explicit local child modules when isolation clearly requires them
94
+
95
+ Forbidden:
96
+
97
+ - reimplementing design-system or shared UI-library components in generated test mocks
98
+ - swapping an entire UI package with fake replacement components just to satisfy verification
99
+
100
+ If a mock plan would violate that boundary, stop and call out the violation clearly. Use `references/verification-gate.md` and `references/mock-store.md` before suggesting alternatives.
101
+
102
+ ## Score and Verification
103
+
104
+ Read these references when interpreting output quality:
105
+
106
+ - `references/quality-scoring.md`
107
+ - `references/verification-gate.md`
108
+
109
+ Minimum reporting standard after generation:
110
+
111
+ - generated file path
112
+ - score and grade
113
+ - whether manual review is still required
114
+ - top blockers
115
+ - whether marker coverage or boundary fidelity is still incomplete
116
+
117
+ If Tayo reports draft-quality output, QUAL-02 failure, or unresolved marker/boundary gaps, state plainly that the result is not production-ready yet.
118
+
119
+ ## Auth and Screenshots
120
+
121
+ Only read `references/auth.md` when live URL inspection or screenshot capture is relevant.
122
+
123
+ Rules:
124
+
125
+ - auth is optional support for debugging, not a prerequisite for generation
126
+ - never block basic generation on unavailable auth
127
+ - never ask the user for secrets in plain text
128
+
129
+ ## Response Contract
22
130
 
23
131
  Report:
24
132
 
133
+ - the command you ran
25
134
  - the generated test path
26
- - the Tayo score
27
- - whether the output still needs manual review and the top blockers if present
28
- - any follow-up work required to fix component imports, placeholder queries, or flaky selectors
135
+ - the score and grade
136
+ - whether manual review is required
137
+ - the top blockers
138
+ - the smallest concrete next fixes, ordered by impact
139
+
140
+ When repo context was limited, say so explicitly instead of inventing certainty.
@@ -0,0 +1,62 @@
1
+ # Assertion Markers (Tayo)
2
+
3
+ Purpose:
4
+ Allow non-technical users to mark "this should be asserted" during recording
5
+ without opening advanced Recorder assertion settings.
6
+
7
+ ---
8
+
9
+ ## Primary Marker: `dblClick`
10
+
11
+ User action pattern:
12
+
13
+ 1. Trigger UI change (open modal, submit form, continue, save, etc.).
14
+ 2. Double-click the visible target that proves the expected result.
15
+
16
+ Interpretation:
17
+
18
+ - Tayo treats semantic `dblClick` events as `assertExists` markers.
19
+ - Marker assertions are generated as explicit RTL expectations in the closest
20
+ relevant test block.
21
+
22
+ ---
23
+
24
+ ## Mapping Rules (Deterministic)
25
+
26
+ 1. Identify `userEvent.dblClick(...)` events in parsed steps.
27
+ 2. Use the dblClick target itself as the marker target (no copy chord required).
28
+ 3. Build query hints in this order:
29
+ - role + name (if `aria/` evidence exists)
30
+ - text (if `text/` evidence exists)
31
+ - label/placeholder (if input context is explicit)
32
+ 4. If only CSS evidence exists, skip marker-to-assertion conversion and log
33
+ limitation.
34
+
35
+ Important reliability note:
36
+
37
+ - DblClick markers on generic targets like modal containers, table rows, icons
38
+ (`svg/path`), or dynamic radix/css selectors are often ambiguous.
39
+ - These ambiguous markers should be reported as unresolved rather than silently
40
+ converted into weak assertions.
41
+
42
+ ---
43
+
44
+ ## Example Outcomes
45
+
46
+ - Marker dblClick on modal title after "Add Sale" click
47
+ - Generate: assert dialog heading/title exists.
48
+ - Marker dblClick on validation text after empty submit
49
+ - Generate: assert required-field error exists.
50
+ - Marker dblClick on success toast after save
51
+ - Generate: assert success message exists.
52
+
53
+ ---
54
+
55
+ ## Guardrails
56
+
57
+ - Marker assertions are additive; they do not replace required happy/validation/failure tests.
58
+ - `highlight + copy` is not used for marker conversion.
59
+ - Never generate assertions from screenshots.
60
+ - Never infer hidden/internal implementation details from marker actions.
61
+ - If marker conversion fails due to ambiguous selectors, emit a clear warning
62
+ with unresolved marker line references.
@@ -0,0 +1,92 @@
1
+ # Authentication Checkpoint (Provider-Agnostic)
2
+
3
+ Purpose:
4
+ Enable optional browser-based screenshot capture on authenticated routes.
5
+
6
+ Important:
7
+ Authentication must never block test generation.
8
+ Secrets are never stored in state.
9
+ Only environment variable NAMES are stored.
10
+
11
+ Auth recipes are stored inside:
12
+ .tayo/state.json → auth.recipes[]
13
+
14
+ ---
15
+
16
+ ## Auth Recipe Structure (stored in state.json)
17
+
18
+ Each recipe looks like:
19
+
20
+ {
21
+ "id": "string",
22
+ "label": "string",
23
+ "scope": ["string"],
24
+ "strategy": "none | ui_email_password | ui_oauth_manual | cookie | header",
25
+ "detectAuthRequired": {
26
+ "urlIncludes": ["string"],
27
+ "pageTextIncludes": ["string"]
28
+ },
29
+ "detectAuthenticated": {
30
+ "urlExcludes": ["string"],
31
+ "pageTextExcludes": ["string"]
32
+ },
33
+ "ui": {
34
+ "emailSelectors": ["string"],
35
+ "passwordSelectors": ["string"],
36
+ "submitSelectors": ["string"],
37
+ "postLoginWait": {
38
+ "urlNotIncludes": ["string"],
39
+ "pageTextIncludes": ["string"],
40
+ "timeoutMs": 8000
41
+ }
42
+ },
43
+ "credentials": {
44
+ "emailEnv": "string | null",
45
+ "passwordEnv": "string | null",
46
+ "cookieEnv": "string | null",
47
+ "headerEnv": "string | null"
48
+ },
49
+ "confidence": 0.0,
50
+ "evidence": [],
51
+ "createdAt": "ISO-8601",
52
+ "updatedAt": "ISO-8601"
53
+ }
54
+
55
+ ---
56
+
57
+ ## First Run Behavior
58
+
59
+ If Tayo detects a login page but no recipe exists:
60
+
61
+ - Create a recipe with:
62
+ - strategy = "ui_oauth_manual"
63
+ - scope = current site origin
64
+ - detection fields filled from observed URL/text
65
+ - low confidence (0.4)
66
+ - If browser tools are available, run a manual checkpoint:
67
+ - navigate to the protected route
68
+ - instruct the user to complete authentication in-browser
69
+ - wait/poll `detectAuthenticated` until timeout
70
+ - If authenticated during checkpoint:
71
+ - set auth status to `authenticated`
72
+ - continue with screenshot capture
73
+ - If not authenticated by timeout:
74
+ - keep auth status `unknown_recipe`
75
+ - skip screenshots and continue test generation.
76
+
77
+ ## Manual OAuth Checkpoint (ui_oauth_manual)
78
+
79
+ When `strategy` is `ui_oauth_manual`:
80
+
81
+ - Tayo must open the browser and pause for user completion of login.
82
+ - Tayo must poll `detectAuthenticated` conditions (URL/text) until timeout.
83
+ - Tayo must not capture screenshots before authentication succeeds.
84
+ - On success, set auth status `authenticated`; on timeout, set `failed` (or `unknown_recipe` for first-run templates).
85
+
86
+ ---
87
+
88
+ ## Security Rules
89
+
90
+ - Never store passwords in files.
91
+ - Never print credential values.
92
+ - Only read credentials from environment variables.