@tayo-dev/rtl 1.4.0 → 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.
- package/README.md +16 -75
- package/assets/claude/commands/@tayo-dev/rtl/generate.md +42 -5
- package/assets/claude/commands/@tayo-dev/rtl/help.md +2 -2
- package/assets/codex/@tayo-dev/rtl-conventions/SKILL.md +38 -6
- package/assets/codex/@tayo-dev/rtl-generate/SKILL.md +125 -13
- package/assets/codex/@tayo-dev/rtl-generate/references/assertion-markers.md +62 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/auth.md +92 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/conventions-schema.md +184 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/entry-path-fidelity.md +68 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/intent-model.md +232 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/mock-store.md +18 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/quality-scoring.md +189 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/state-schema.md +119 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/test-index.md +12 -0
- package/assets/codex/@tayo-dev/rtl-generate/references/verification-gate.md +93 -0
- package/assets/codex/@tayo-dev/rtl-help/SKILL.md +21 -7
- package/assets/codex/@tayo-dev/rtl-mocks/SKILL.md +55 -9
- package/assets/gemini/commands/@tayo-dev/rtl/generate.toml +27 -5
- package/assets/gemini/commands/@tayo-dev/rtl/help.toml +2 -2
- package/assets/opencode/commands/@tayo-dev/rtl-generate.md +31 -5
- package/assets/opencode/commands/@tayo-dev/rtl-help.md +2 -2
- package/dist/cli/commands/generate.d.ts +1 -7
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +50 -96
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/core/generator.d.ts +0 -2
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/generator.js +1 -1
- package/dist/core/generator.js.map +1 -1
- package/dist/core/input-loader.d.ts +2 -2
- package/dist/core/input-loader.d.ts.map +1 -1
- package/dist/core/input-loader.js +6 -16
- package/dist/core/input-loader.js.map +1 -1
- package/dist/core/js-parser.js +1 -1
- package/dist/core/js-parser.js.map +1 -1
- package/dist/core/writer.d.ts +0 -1
- package/dist/core/writer.d.ts.map +1 -1
- package/dist/core/writer.js +3 -3
- package/dist/core/writer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/install/runtimes/codex.d.ts.map +1 -1
- package/dist/install/runtimes/codex.js +18 -0
- package/dist/install/runtimes/codex.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Tayo
|
|
2
2
|
|
|
3
|
-
Install Tayo into Claude Code, OpenCode, Gemini CLI, or Codex, then generate React Testing Library tests from Testing Library Recorder
|
|
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
|
-
Tayo ships as an installer-first package. The package entrypoint bootstraps runtime-native commands or skills into your agent environment, and
|
|
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
|
|
|
@@ -88,7 +88,12 @@ 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
|
|
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,20 +105,13 @@ After installation, use `tayo 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
|
-
Tayo supports
|
|
108
|
+
Tayo supports one export path:
|
|
104
109
|
|
|
105
|
-
- Testing Library Recorder 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
|
-
|
|
111
|
-
# JS baseline path
|
|
112
|
-
tayo generate ./recording.js
|
|
113
|
-
|
|
114
|
-
# Supported JSON path
|
|
115
|
-
tayo 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
|
|
|
@@ -139,51 +137,6 @@ When Tayo cannot prove the final render/query boundary yet, it keeps the output
|
|
|
139
137
|
|
|
140
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.
|
|
141
139
|
|
|
142
|
-
## CLI Reference
|
|
143
|
-
|
|
144
|
-
### `tayo 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, Tayo 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
|
-
tayo generate ./recordings/checkout-flow.js
|
|
169
|
-
|
|
170
|
-
# Preview without writing (dry run)
|
|
171
|
-
tayo generate --dry-run ./recordings/checkout-flow.js
|
|
172
|
-
|
|
173
|
-
# Write to a specific path
|
|
174
|
-
tayo generate --output src/__tests__/checkout.test.tsx ./recordings/checkout-flow.js
|
|
175
|
-
|
|
176
|
-
# Overwrite an existing test
|
|
177
|
-
tayo generate --force ./recordings/checkout-flow.js
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Output file naming:**
|
|
181
|
-
If `--output` is not provided, Tayo 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; Tayo 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; Tayo preserves the existing JSON generate flow while JS fidelity improves
|
|
186
|
-
|
|
187
140
|
## Worked Example
|
|
188
141
|
|
|
189
142
|
### Input: Testing Library Recorder export (`login-flow.js`)
|
|
@@ -204,11 +157,9 @@ test('login flow', async () => {
|
|
|
204
157
|
})
|
|
205
158
|
```
|
|
206
159
|
|
|
207
|
-
###
|
|
160
|
+
### Runtime command
|
|
208
161
|
|
|
209
|
-
|
|
210
|
-
tayo 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
|
|
|
@@ -254,25 +205,15 @@ describe('login flow', () => {
|
|
|
254
205
|
|
|
255
206
|
> **Note:** The component import path (`../LoginPage`) is a placeholder. Tayo generates a comment in the file indicating where to update it.
|
|
256
207
|
|
|
257
|
-
### JSON is also supported
|
|
258
|
-
|
|
259
|
-
If you export Chrome Recorder JSON instead, the command surface stays the same:
|
|
260
|
-
|
|
261
|
-
```bash
|
|
262
|
-
tayo 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, Tayo keeps those gaps explicit with score and manual-review messaging instead of fabricating stronger evidence.
|
|
266
|
-
|
|
267
208
|
## Agent Usage
|
|
268
209
|
|
|
269
|
-
After installation, each runtime gets a namespaced help entrypoint plus a generate command or skill that
|
|
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
|
-
-
|
|
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
|
|
274
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
|
|
275
|
-
- Pass `--force` when re-recording an updated flow to overwrite the old test
|
|
276
217
|
- The `.tayo/` directory should be committed to your repo so convention learning persists across team members
|
|
277
218
|
|
|
278
219
|
### Notes
|
|
@@ -4,12 +4,49 @@ 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
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
14
|
-
4.
|
|
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`
|
|
14
|
-
4.
|
|
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
|
|
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
|
-
|
|
8
|
+
Invoke this skill with `$@tayo-dev/rtl-conventions`.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## What `.tayo/conventions.json` Controls
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
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
|
-
|
|
8
|
+
Invoke this skill with `$@tayo-dev/rtl-generate`.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Purpose
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
|
|
14
|
+
Non-negotiable expectations:
|
|
18
15
|
|
|
19
|
-
|
|
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
|
-
##
|
|
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
|
|
27
|
-
- whether
|
|
28
|
-
-
|
|
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.
|