@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.
- package/README.md +38 -97
- package/assets/claude/commands/@tayo-dev/rtl/generate.md +43 -6
- 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 +28 -6
- package/assets/gemini/commands/@tayo-dev/rtl/help.toml +2 -2
- package/assets/opencode/commands/@tayo-dev/rtl-generate.md +32 -6
- 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 +264 -101
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/install.js +6 -6
- package/dist/core/baseline-normalizer.d.ts.map +1 -1
- package/dist/core/baseline-normalizer.js +42 -0
- package/dist/core/baseline-normalizer.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 +81 -8
- 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 +7 -16
- package/dist/core/input-loader.js.map +1 -1
- package/dist/core/js-parser.d.ts +2 -1
- package/dist/core/js-parser.d.ts.map +1 -1
- package/dist/core/js-parser.js +70 -1
- package/dist/core/js-parser.js.map +1 -1
- package/dist/core/orchestrator.d.ts +1 -1
- package/dist/core/orchestrator.js +4 -4
- package/dist/core/parser.js +2 -2
- package/dist/core/recording-intelligence.d.ts +1 -1
- package/dist/core/recording-intelligence.d.ts.map +1 -1
- package/dist/core/recording-intelligence.js +298 -4
- package/dist/core/recording-intelligence.js.map +1 -1
- package/dist/core/resolver.d.ts +2 -1
- package/dist/core/resolver.d.ts.map +1 -1
- package/dist/core/resolver.js +334 -4
- package/dist/core/resolver.js.map +1 -1
- package/dist/core/scanner.d.ts +3 -3
- package/dist/core/scanner.js +9 -9
- package/dist/core/scorer.d.ts +6 -2
- package/dist/core/scorer.d.ts.map +1 -1
- package/dist/core/scorer.js +75 -7
- package/dist/core/scorer.js.map +1 -1
- package/dist/core/suite-planner.d.ts.map +1 -1
- package/dist/core/suite-planner.js +186 -17
- package/dist/core/suite-planner.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 +2 -2
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/install/planner.js +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/dist/install/types.d.ts +1 -1
- package/dist/learner/index.d.ts +2 -2
- package/dist/learner/index.js +3 -3
- package/dist/learner/storage.d.ts +1 -1
- package/dist/learner/storage.js +2 -2
- package/dist/templates/test-template.d.ts +4 -0
- package/dist/templates/test-template.d.ts.map +1 -1
- package/dist/templates/test-template.js +10 -1
- package/dist/templates/test-template.js.map +1 -1
- package/dist/types/recording.d.ts +118 -0
- package/dist/types/recording.d.ts.map +1 -1
- package/dist/types/recording.js.map +1 -1
- package/dist/types/score.d.ts +15 -0
- package/dist/types/score.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Unified State Schema
|
|
2
|
+
|
|
3
|
+
Stored at:
|
|
4
|
+
.tayo/state.json
|
|
5
|
+
|
|
6
|
+
Purpose:
|
|
7
|
+
Persistent, self-evolving knowledge graph of the repository and Tayo runs.
|
|
8
|
+
|
|
9
|
+
Rules:
|
|
10
|
+
- Must remain project-agnostic.
|
|
11
|
+
- Must never store secrets.
|
|
12
|
+
- Must store evidence and confidence for learned signals.
|
|
13
|
+
- Must remain bounded in size.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Storage Limits
|
|
18
|
+
|
|
19
|
+
Recommended caps:
|
|
20
|
+
|
|
21
|
+
* conventions evidence per signal: 50
|
|
22
|
+
* sampledFiles per scan: 50
|
|
23
|
+
* surface scan files per run: 5
|
|
24
|
+
* generatedTests entries: 200 (rotate oldest)
|
|
25
|
+
* auth recipes: 10 (keep by scope recency)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Schema
|
|
30
|
+
|
|
31
|
+
```jsonc
|
|
32
|
+
{
|
|
33
|
+
"version": 1,
|
|
34
|
+
|
|
35
|
+
"meta": {
|
|
36
|
+
"createdAt": "ISO-8601",
|
|
37
|
+
"updatedAt": "ISO-8601",
|
|
38
|
+
"tayoVersion": "string"
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
"conventions": {
|
|
42
|
+
"signals": {}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"auth": {
|
|
46
|
+
"recipes": []
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
"mockStore": {
|
|
50
|
+
"rootDir": "string | null",
|
|
51
|
+
"importHint": "string | null",
|
|
52
|
+
"resources": [
|
|
53
|
+
{ "name": "string", "file": "string", "exports": ["string"], "updatedAt": "ISO-8601" }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
"generatedTests": [
|
|
58
|
+
{
|
|
59
|
+
"recordingHash": "sha256:...",
|
|
60
|
+
"recordingUrl": "string",
|
|
61
|
+
"sourceFile": "string",
|
|
62
|
+
"testFile": "string",
|
|
63
|
+
"dependencies": { "apiCalls": ["string"], "hooks": ["string"] },
|
|
64
|
+
"quality": {
|
|
65
|
+
"overall": 0,
|
|
66
|
+
"grade": "F|D|C|B|A",
|
|
67
|
+
"dimensions": {
|
|
68
|
+
"robustness": 0,
|
|
69
|
+
"readability": 0,
|
|
70
|
+
"assertionStrength": 0,
|
|
71
|
+
"mockFidelity": 0,
|
|
72
|
+
"maintainability": 0
|
|
73
|
+
},
|
|
74
|
+
"signals": {
|
|
75
|
+
"usesCssSelectors": false,
|
|
76
|
+
"usesTestId": false,
|
|
77
|
+
"usesRoleQueries": false,
|
|
78
|
+
"hasMeaningfulAssertions": false,
|
|
79
|
+
"hasDeterministicFixtures": false,
|
|
80
|
+
"hasProviderWrapper": false,
|
|
81
|
+
"hasUiLibraryReimplementation": false
|
|
82
|
+
},
|
|
83
|
+
"reasons": [
|
|
84
|
+
{ "dimension": "string", "delta": 0, "reason": "string" }
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"verification": {
|
|
88
|
+
"mockAudit": {
|
|
89
|
+
"forbiddenReimplementations": ["string"],
|
|
90
|
+
"allowedBoundaryMocks": ["string"]
|
|
91
|
+
},
|
|
92
|
+
"checkpoint": {
|
|
93
|
+
"status": "none|approval_required",
|
|
94
|
+
"reason": "string|null",
|
|
95
|
+
"blockedWrites": false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"discovery": {
|
|
99
|
+
"surfaceScan": {
|
|
100
|
+
"count": 0,
|
|
101
|
+
"selectedFiles": ["string"],
|
|
102
|
+
"skippedExpansions": ["string"],
|
|
103
|
+
"limitedByBudget": false
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"createdAt": "ISO-8601"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Checkpoint Write Rule
|
|
115
|
+
|
|
116
|
+
When `verification.checkpoint.status` is `approval_required`:
|
|
117
|
+
|
|
118
|
+
- Tayo must not append a new generatedTests history entry.
|
|
119
|
+
- Tayo must output checkpoint details and stop write operations for generated tests/state history.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Verification Gate
|
|
2
|
+
|
|
3
|
+
Goal:
|
|
4
|
+
Prevent Tayo from claiming success unless the generated test is demonstrably runnable
|
|
5
|
+
and compliant with mock-boundary policy.
|
|
6
|
+
|
|
7
|
+
Rules:
|
|
8
|
+
|
|
9
|
+
- Prefer running real project commands if they can be detected.
|
|
10
|
+
- If commands cannot be detected, run minimal checks and clearly log limitations.
|
|
11
|
+
- Always run static mock audit before runtime checks.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Static Mock Audit (Required)
|
|
16
|
+
|
|
17
|
+
Run an AST/text audit on the generated test before typecheck/test/lint.
|
|
18
|
+
|
|
19
|
+
Detect:
|
|
20
|
+
|
|
21
|
+
- `vi.mock(...)` / `jest.mock(...)` blocks that replace UI-library modules
|
|
22
|
+
(for example design-system packages such as `@digitax/components`).
|
|
23
|
+
- Broad object-return replacement patterns that provide custom component
|
|
24
|
+
implementations for UI libraries.
|
|
25
|
+
|
|
26
|
+
Allowed:
|
|
27
|
+
|
|
28
|
+
- boundary-safe targets: data/auth/router/env/local-child modules.
|
|
29
|
+
|
|
30
|
+
If forbidden replacement is detected:
|
|
31
|
+
|
|
32
|
+
- set checkpoint status to `approval_required`
|
|
33
|
+
- set `blockedWrites = true`
|
|
34
|
+
- record offending targets in `verification.mockAudit.forbiddenReimplementations`
|
|
35
|
+
- do not write generated test file
|
|
36
|
+
- do not mutate `.tayo/state.json` generated-test history
|
|
37
|
+
- output:
|
|
38
|
+
- violation reason
|
|
39
|
+
- exact offending target(s)
|
|
40
|
+
- minimal alternatives attempted/available
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Preferred Checks (in order)
|
|
45
|
+
|
|
46
|
+
1. Static mock audit (required)
|
|
47
|
+
2. Typecheck (if tsconfig exists and command discoverable)
|
|
48
|
+
3. Run test for the generated file (framework-aware)
|
|
49
|
+
4. Lint the generated file (eslint if available)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Command Detection (project-agnostic heuristics)
|
|
54
|
+
|
|
55
|
+
Tayo may attempt to infer commands by checking:
|
|
56
|
+
|
|
57
|
+
- package.json scripts (if readable/locatable)
|
|
58
|
+
- presence of vitest/jest dependencies in lockfiles or package manifests
|
|
59
|
+
|
|
60
|
+
If no reliable detection:
|
|
61
|
+
|
|
62
|
+
- Log: `Verification commands not detected; minimal validation only.`
|
|
63
|
+
- Minimal validation must include:
|
|
64
|
+
- file can be imported
|
|
65
|
+
- no syntax errors
|
|
66
|
+
- TypeScript types are not obviously invalid (best-effort)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Repair Pass (single iteration only)
|
|
71
|
+
|
|
72
|
+
If verification fails:
|
|
73
|
+
|
|
74
|
+
- apply one repair attempt:
|
|
75
|
+
- switch getByRole → findByRole for async
|
|
76
|
+
- add missing await for userEvent
|
|
77
|
+
- fix obvious import alias mismatch based on conventions signals
|
|
78
|
+
- add lightweight env polyfill for browser gaps (for example `ResizeObserver`)
|
|
79
|
+
- rerun verification once
|
|
80
|
+
|
|
81
|
+
Never loop indefinitely.
|
|
82
|
+
Never claim success if still failing.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Output Contract
|
|
87
|
+
|
|
88
|
+
- `Verification: Passed` only if all required checks pass and no checkpoint is active.
|
|
89
|
+
- `Verification: Failed` if runtime checks fail or checkpoint is active.
|
|
90
|
+
- If checkpoint is active, output must include:
|
|
91
|
+
- `Checkpoint: approval_required`
|
|
92
|
+
- `Blocked writes: true`
|
|
93
|
+
- violation reason and offending targets.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "@tayo-dev/rtl-help"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Route Codex users to the correct packaged Tayo skill and explain the installed Codex entrypoints. Use when the user asks how to use Tayo in Codex, which Tayo skill to invoke, whether installation worked, or whether they need generate, conventions, or mocks guidance."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Tayo Codex Help
|
|
7
7
|
|
|
8
|
-
Use this skill when you need the Codex-facing entrypoint for Tayo or you need to route the user to the right packaged skill.
|
|
9
|
-
|
|
10
8
|
## Entrypoint
|
|
11
9
|
|
|
12
10
|
Invoke this skill with `$@tayo-dev/rtl-help`.
|
|
@@ -17,9 +15,25 @@ Invoke this skill with `$@tayo-dev/rtl-help`.
|
|
|
17
15
|
- `$@tayo-dev/rtl-conventions` for convention-aware generation guidance
|
|
18
16
|
- `$@tayo-dev/rtl-mocks` for mock and fixture review
|
|
19
17
|
|
|
18
|
+
## Routing guide
|
|
19
|
+
|
|
20
|
+
- Use `$@tayo-dev/rtl-generate` when the user already has a Testing Library Recorder `.js` export and wants a test generated.
|
|
21
|
+
- Use `$@tayo-dev/rtl-conventions` when the user asks why generated output follows a certain style, file location, import pattern, or helper setup.
|
|
22
|
+
- Use `$@tayo-dev/rtl-mocks` when the generated test needs API, router, auth, fixture, or provider boundary guidance.
|
|
23
|
+
|
|
20
24
|
## Default workflow
|
|
21
25
|
|
|
22
|
-
1. Confirm the
|
|
23
|
-
2.
|
|
24
|
-
3.
|
|
25
|
-
4.
|
|
26
|
+
1. Confirm whether the user needs generation, convention diagnosis, or mock guidance.
|
|
27
|
+
2. Ask for the recording path or generated test path only if that input is still missing.
|
|
28
|
+
3. Choose the matching packaged Tayo skill.
|
|
29
|
+
4. For generation, use `$@tayo-dev/rtl-generate`. Tayo writes `{recording-name}.test.tsx` next to the `.js` recording and refuses to overwrite an existing file.
|
|
30
|
+
5. Report the generated file path if generation ran, the score, and blockers that still require manual cleanup.
|
|
31
|
+
|
|
32
|
+
## Response contract
|
|
33
|
+
|
|
34
|
+
Return:
|
|
35
|
+
|
|
36
|
+
- the correct Tayo skill or runtime entrypoint
|
|
37
|
+
- the next runtime action to take
|
|
38
|
+
- any missing input required before proceeding
|
|
39
|
+
- any blocker that prevents safe generation or review
|
|
@@ -1,22 +1,68 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "@tayo-dev/rtl-mocks"
|
|
3
|
-
description: "Review mock targets, fixture shape, and post-generation follow-up for Tayo output."
|
|
3
|
+
description: "Review mock targets, provider boundaries, fixture shape, and post-generation follow-up for Tayo output. Use when a generated RTL test needs API mocking, router/auth/context setup, fixture guidance, or when the user asks why Tayo suggested certain mocks."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Tayo Mocks
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Invoke this skill with `$@tayo-dev/rtl-mocks`.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Boundary Review Workflow
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
1. Identify the external boundaries the generated test crosses.
|
|
13
|
+
2. Keep only the minimum mocks needed to make the user flow deterministic.
|
|
14
|
+
3. Align with the repo's existing mock stack before proposing new patterns.
|
|
15
|
+
4. Decide whether each mock should stay inline or move into a shared fixture or helper.
|
|
15
16
|
|
|
16
|
-
##
|
|
17
|
+
## Inline vs Extract Decision
|
|
18
|
+
|
|
19
|
+
- **Same mock target in 1 test file** → keep inline (`vi.mock` in module scope of that file)
|
|
20
|
+
- **Same mock target in 2+ test files** → extract to a shared fixture or `__mocks__` factory
|
|
21
|
+
- **Provider wrappers** (router, auth, query client) → always extract to a shared render helper
|
|
22
|
+
|
|
23
|
+
## Mock Instability Patterns to Fix
|
|
24
|
+
|
|
25
|
+
Tayo detects and flags two instability patterns:
|
|
26
|
+
|
|
27
|
+
**`recreated-factory`** — `vi.mock()` or `jest.mock()` is declared inside `it()`/`test()` bodies. This recreates the module factory on every test run and produces inconsistent state.
|
|
28
|
+
- Fix: move `vi.mock('...')` to module scope (outside all test callbacks).
|
|
29
|
+
|
|
30
|
+
**`per-test-churn`** — `clearAllMocks`/`resetAllMocks` is called repeatedly alongside many `mockReturnValue`/`mockResolvedValue` calls, which means mock configuration is torn down and rebuilt per test.
|
|
31
|
+
- Fix: consolidate shared mock state in `beforeEach`, use `mockReturnValueOnce` for per-test overrides only.
|
|
32
|
+
|
|
33
|
+
## Mutation Lifecycle Coverage
|
|
34
|
+
|
|
35
|
+
When the recorded flow involves a mutation (submit, save, create, update, delete), the generated test should cover all three stages:
|
|
36
|
+
|
|
37
|
+
| Stage | What to assert | Mock setup |
|
|
38
|
+
|-------|----------------|------------|
|
|
39
|
+
| `loading` | Submit button is disabled, spinner/pending indicator visible | Before `mockResolvedValue` resolves |
|
|
40
|
+
| `success` | Success message, redirect, or updated value visible | `mockResolvedValue(...)` |
|
|
41
|
+
| `error` | `role="alert"` error message visible | `mockRejectedValue(new Error(...))` |
|
|
42
|
+
|
|
43
|
+
If only one or two stages are present in the generated output, explain what the missing stages should assert.
|
|
44
|
+
|
|
45
|
+
## Common Boundaries
|
|
46
|
+
|
|
47
|
+
- network and data-fetching clients (fetch, axios, React Query, SWR, tRPC)
|
|
48
|
+
- router and navigation hooks (`useRouter`, `useNavigate`)
|
|
49
|
+
- auth or session providers (`useAuth`, `useSession`)
|
|
50
|
+
- feature flags and runtime config
|
|
51
|
+
- time, randomness, and browser APIs (`Date.now`, `Math.random`, `localStorage`)
|
|
52
|
+
|
|
53
|
+
## Guardrails
|
|
54
|
+
|
|
55
|
+
- do not invent API shapes, endpoints, or fixture payloads without evidence from the repo
|
|
56
|
+
- prefer existing fixtures, factories, and render wrappers over new one-off helpers
|
|
57
|
+
- call out provider requirements separately from pure data mocks
|
|
58
|
+
- separate blocking mock requirements from optional cleanup
|
|
59
|
+
|
|
60
|
+
## Output Contract
|
|
17
61
|
|
|
18
62
|
Summarize:
|
|
19
63
|
|
|
20
|
-
- the mock targets that matter
|
|
21
|
-
- the
|
|
64
|
+
- the mock targets that matter and whether each should be inline or extracted
|
|
65
|
+
- which instability patterns were detected and the specific fix
|
|
66
|
+
- whether mutation lifecycle coverage is complete or which stages are missing
|
|
67
|
+
- the fixture shape or shared helper to reuse
|
|
22
68
|
- any manual follow-up still required after generation
|
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
description = "Generate RTL tests from Recorder exports with
|
|
1
|
+
description = "Generate RTL tests from Recorder exports with Tayo"
|
|
2
2
|
prompt = """
|
|
3
3
|
You are the installed /@tayo-dev/rtl:generate command for @tayo-dev/rtl.
|
|
4
4
|
|
|
5
|
-
Generate a React Testing Library test from a Recorder export.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Generate a React Testing Library test from a Testing Library Recorder JS export.
|
|
6
|
+
|
|
7
|
+
Process:
|
|
8
|
+
1. Confirm the recording file path and extension (.js only).
|
|
9
|
+
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.
|
|
10
|
+
3. Run `tayo __generate <recording-file>`.
|
|
11
|
+
4. Parse the score and work through any required manual fixes.
|
|
12
|
+
|
|
13
|
+
Scoring dimensions (Grade: A>=90, B>=80, C>=70, D>=60, F<60; below 80 or QUAL-02 failure = manual review required):
|
|
14
|
+
- Query (30%): getByRole > getByLabelText > getByText > getByPlaceholderText > getByTestId. Each tayo-query-checkpoint: comment deducts 3pts (cap -40).
|
|
15
|
+
- Assertions (25%): toHaveValue/toBeChecked/toHaveTextContent/toBeVisible = full credit. toBeInTheDocument = 30% credit. No assertions = 0.
|
|
16
|
+
- Structure (20%): render(<App />) -25, tayo-boundary-warning: -20, describe() block +20, each extra it() +15.
|
|
17
|
+
- Boundary (25%): leaf-render-boundary -35, inline-hook-mock -30, helper-embedded-assertion -20, positional-control-selection -15.
|
|
18
|
+
|
|
19
|
+
Boundary issue fixes:
|
|
20
|
+
- leaf-render-boundary: render the page/module that owns the trigger and dialog lifecycle, not the *Form/*Dialog directly.
|
|
21
|
+
- inline-hook-mock: move use*Query/use*Mutation mocks to a shared fixture or raise the render boundary.
|
|
22
|
+
- helper-embedded-assertion: assertions belong in the it() body; helpers handle setup/navigation only.
|
|
23
|
+
- positional-control-selection: replace getAllByRole(...)[n] with within() scoping or a more specific accessible name.
|
|
24
|
+
|
|
25
|
+
Post-generation checklist:
|
|
26
|
+
1. Fix render(<App />) — render the narrowest component that owns the flow.
|
|
27
|
+
2. Resolve tayo-query-checkpoint: comments — apply the query hierarchy above.
|
|
28
|
+
3. Upgrade toBeInTheDocument() — use toHaveTextContent(), toHaveValue(), or toBeVisible().
|
|
29
|
+
4. Fix tayo-boundary-warning: comments per the boundary issue fixes above.
|
|
30
|
+
|
|
31
|
+
Report: command run, generated file path, score + grade, manual review status, top blockers, and which checklist steps apply with specific guidance.
|
|
10
32
|
"""
|
|
@@ -5,7 +5,7 @@ You are the installed /@tayo-dev/rtl:help command for @tayo-dev/rtl.
|
|
|
5
5
|
When the user wants help:
|
|
6
6
|
1. Explain that /@tayo-dev/rtl:help is the runtime-native help entrypoint.
|
|
7
7
|
2. For installation or updates, tell them to run `npx @tayo-dev/rtl@latest`.
|
|
8
|
-
3. For generation, direct them to /@tayo-dev/rtl:generate
|
|
9
|
-
4.
|
|
8
|
+
3. For generation, direct them to /@tayo-dev/rtl:generate with a Testing Library Recorder `.js` export.
|
|
9
|
+
4. Tell them Tayo writes `{recording-name}.test.tsx` next to the recording and will not overwrite an existing file.
|
|
10
10
|
5. When generation runs, report the score and generated file path.
|
|
11
11
|
"""
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Generate RTL tests from Recorder exports with
|
|
2
|
+
description: Generate RTL tests from Recorder exports with Tayo
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
You are the installed `/@tayo-dev/rtl-generate` command for `@tayo-dev/rtl`.
|
|
6
6
|
|
|
7
|
-
Generate a React Testing Library test from a Recorder export.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Generate a React Testing Library test from a Testing Library Recorder JS export.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
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 the score output and work through any required manual fixes.
|
|
15
|
+
|
|
16
|
+
## Scoring
|
|
17
|
+
|
|
18
|
+
Tayo scores on four weighted dimensions. Grade: A ≥ 90, B ≥ 80, C ≥ 70, D ≥ 60, F < 60. Score below 80 or QUAL-02 failure → "Manual review required".
|
|
19
|
+
|
|
20
|
+
**Query (30%):** `getByRole` = best, `getByLabelText` = good, `getByText` = fine, `getByPlaceholderText` = fallback, `getByTestId` = last resort. Each `tayo-query-checkpoint:` comment deducts 3pts.
|
|
21
|
+
|
|
22
|
+
**Assertions (25%):** `toHaveValue`/`toBeChecked`/`toHaveTextContent`/`toBeVisible` = full credit. `toBeInTheDocument` = 30% credit.
|
|
23
|
+
|
|
24
|
+
**Structure (20%):** `render(<App />)` −25, `tayo-boundary-warning:` −20. `describe()` block +20.
|
|
25
|
+
|
|
26
|
+
**Boundary (25%):** `leaf-render-boundary` −35, `inline-hook-mock` −30, `helper-embedded-assertion` −20, `positional-control-selection` −15.
|
|
27
|
+
|
|
28
|
+
## Post-Generation Checklist
|
|
29
|
+
|
|
30
|
+
1. Fix `render(<App />)` — render the narrowest component that owns the flow.
|
|
31
|
+
2. Resolve `// tayo-query-checkpoint:` comments — apply the query hierarchy above.
|
|
32
|
+
3. Upgrade `toBeInTheDocument()` — use `toHaveTextContent()`, `toHaveValue()`, or `toBeVisible()`.
|
|
33
|
+
4. Fix `tayo-boundary-warning:` — see boundary penalties for specific fixes.
|
|
34
|
+
|
|
35
|
+
## Response
|
|
36
|
+
|
|
37
|
+
Report: command run, generated file path, score + grade, manual review status, top blockers, and which checklist steps apply.
|
|
@@ -7,6 +7,6 @@ You are the installed `/@tayo-dev/rtl-help` command for `@tayo-dev/rtl`.
|
|
|
7
7
|
When the user wants help:
|
|
8
8
|
1. Explain that `/@tayo-dev/rtl-help` is the runtime-native help entrypoint.
|
|
9
9
|
2. For installation or updates, tell them to run `npx @tayo-dev/rtl@latest`.
|
|
10
|
-
3. For generation, direct them to `/@tayo-dev/rtl-generate`
|
|
11
|
-
4.
|
|
10
|
+
3. For generation, direct them to `/@tayo-dev/rtl-generate` with a Testing Library Recorder `.js` export.
|
|
11
|
+
4. Tell them Tayo writes `{recording-name}.test.tsx` next to the recording and will not overwrite an existing file.
|
|
12
12
|
5. When generation runs, report the score and generated file path.
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate command
|
|
3
|
-
*
|
|
4
|
-
* Converts Recorder exports into React Testing Library test files.
|
|
3
|
+
* Internal runtime-only generation pipeline for Testing Library Recorder JS exports.
|
|
5
4
|
*/
|
|
6
5
|
import { Command } from 'commander';
|
|
7
|
-
export interface GenerateOptions {
|
|
8
|
-
output?: string;
|
|
9
|
-
dryRun?: boolean;
|
|
10
|
-
force?: boolean;
|
|
11
|
-
}
|
|
12
6
|
export declare function createGenerateCommand(): Command;
|
|
13
7
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA44BnC,wBAAgB,qBAAqB,IAAI,OAAO,CAmK/C"}
|