create-huenei-template 0.3.3 → 0.3.5
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/dist/core/skills-refresh.js +8 -3
- package/dist/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
- package/dist/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
- package/dist/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
- package/dist/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
- package/dist/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
- package/dist/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
- package/dist/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
- package/dist/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +14 -7
- package/dist/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/CREDENTIALS.md +1 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +102 -22
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +90 -22
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/AGENTS.md +14 -7
- package/dist/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/CREDENTIALS.md +1 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +99 -74
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +102 -22
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +90 -22
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +14 -6
- package/dist/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/CREDENTIALS.md +1 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +99 -28
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/AGENTS.md +14 -6
- package/dist/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/CREDENTIALS.md +1 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +99 -74
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +99 -28
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +14 -6
- package/dist/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/CREDENTIALS.md +1 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +99 -74
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +99 -28
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/setup-project-context.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
- package/dist/test-cli.js +59 -4
- package/package.json +1 -1
- package/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
- package/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
- package/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
- package/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
- package/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
- package/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
- package/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
- package/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +14 -7
- package/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
- package/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
- package/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
- package/templates/automation/e2e-cypress-ts-app-actions/docs/CREDENTIALS.md +1 -0
- package/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
- package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +102 -22
- package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +90 -22
- package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
- package/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-cypress-ts-pom/AGENTS.md +14 -7
- package/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
- package/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
- package/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
- package/templates/automation/e2e-cypress-ts-pom/docs/CREDENTIALS.md +1 -0
- package/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +99 -74
- package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +102 -22
- package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +90 -22
- package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
- package/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +14 -6
- package/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-app-actions/docs/CREDENTIALS.md +1 -0
- package/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
- package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +99 -28
- package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
- package/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-pom/AGENTS.md +14 -6
- package/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-pom/docs/CREDENTIALS.md +1 -0
- package/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +99 -74
- package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +99 -28
- package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
- package/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +14 -6
- package/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-screenplay/docs/CREDENTIALS.md +1 -0
- package/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +99 -74
- package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +101 -21
- package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +99 -28
- package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/setup-project-context.md +1 -1
- package/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
|
@@ -7,7 +7,9 @@ const TEMPLATE_LOCK = "_skills-lock.json";
|
|
|
7
7
|
const UPDATE_TIMEOUT_MS = 60_000;
|
|
8
8
|
/**
|
|
9
9
|
* Brings the vendored skills in `.cursor/skills/` up to date with their sources, silently.
|
|
10
|
-
* `skills update` only downloads skills whose hash changed, into `.agents/skills
|
|
10
|
+
* `skills update` only downloads skills whose hash changed, into `.agents/skills/`, but it also
|
|
11
|
+
* links them into every agent it detects (e.g. `.claude/skills/` outside Cursor), so anything it
|
|
12
|
+
* creates at the project root is removed: `applyAgentTarget` derives the agent layouts later.
|
|
11
13
|
* Without network or npx the bundled copies are kept.
|
|
12
14
|
*/
|
|
13
15
|
export async function refreshVendoredSkills(projectDir) {
|
|
@@ -16,6 +18,7 @@ export async function refreshVendoredSkills(projectDir) {
|
|
|
16
18
|
return;
|
|
17
19
|
const lock = path.join(projectDir, "skills-lock.json");
|
|
18
20
|
const stagingDir = path.join(projectDir, ".agents");
|
|
21
|
+
const rootEntries = new Set(await readdir(projectDir));
|
|
19
22
|
try {
|
|
20
23
|
await rename(templateLock, lock);
|
|
21
24
|
execSync("npx -y skills update --project --yes", {
|
|
@@ -37,7 +40,9 @@ export async function refreshVendoredSkills(projectDir) {
|
|
|
37
40
|
}
|
|
38
41
|
finally {
|
|
39
42
|
await rm(templateLock, { force: true });
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
for (const entry of await readdir(projectDir)) {
|
|
44
|
+
if (!rootEntries.has(entry))
|
|
45
|
+
await rm(path.join(projectDir, entry), { recursive: true, force: true });
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -40,6 +40,13 @@ steps:
|
|
|
40
40
|
# TEST_ADMIN_EMAIL: $(TEST_ADMIN_EMAIL)
|
|
41
41
|
# TEST_ADMIN_PASSWORD: $(TEST_ADMIN_PASSWORD)
|
|
42
42
|
|
|
43
|
+
- task: PublishPipelineArtifact@1
|
|
44
|
+
displayName: Upload Hub results
|
|
45
|
+
condition: succeededOrFailed()
|
|
46
|
+
inputs:
|
|
47
|
+
targetPath: test-results
|
|
48
|
+
artifact: test-results
|
|
49
|
+
|
|
43
50
|
- task: PublishPipelineArtifact@1
|
|
44
51
|
displayName: Upload screenshots on failure
|
|
45
52
|
condition: failed()
|
|
@@ -39,6 +39,15 @@ jobs:
|
|
|
39
39
|
- name: Run tests
|
|
40
40
|
run: corepack pnpm test
|
|
41
41
|
|
|
42
|
+
- name: Upload Hub results
|
|
43
|
+
if: always()
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: test-results
|
|
47
|
+
path: test-results/
|
|
48
|
+
retention-days: 7
|
|
49
|
+
if-no-files-found: ignore
|
|
50
|
+
|
|
42
51
|
- name: Upload screenshots on failure
|
|
43
52
|
if: failure()
|
|
44
53
|
uses: actions/upload-artifact@v4
|
|
@@ -39,13 +39,20 @@ jobs:
|
|
|
39
39
|
- name: Run tests
|
|
40
40
|
run: corepack pnpm test
|
|
41
41
|
|
|
42
|
+
- name: Upload Hub results
|
|
43
|
+
if: always()
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: test-results
|
|
47
|
+
path: test-results/
|
|
48
|
+
retention-days: 7
|
|
49
|
+
if-no-files-found: ignore
|
|
50
|
+
|
|
42
51
|
- name: Upload report on failure
|
|
43
52
|
if: failure()
|
|
44
53
|
uses: actions/upload-artifact@v4
|
|
45
54
|
with:
|
|
46
55
|
name: playwright-report
|
|
47
|
-
path:
|
|
48
|
-
playwright-report/
|
|
49
|
-
test-results/
|
|
56
|
+
path: playwright-report/
|
|
50
57
|
retention-days: 7
|
|
51
58
|
if-no-files-found: ignore
|
|
@@ -49,9 +49,10 @@ pipeline {
|
|
|
49
49
|
post {
|
|
50
50
|
always {
|
|
51
51
|
junit allowEmptyResults: true, testResults: 'test-results/junit.xml'
|
|
52
|
+
archiveArtifacts artifacts: 'test-results/**', allowEmptyArchive: true
|
|
52
53
|
}
|
|
53
54
|
failure {
|
|
54
|
-
archiveArtifacts artifacts: 'playwright-report
|
|
55
|
+
archiveArtifacts artifacts: 'playwright-report/**', allowEmptyArchive: true
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.
|
|
9
|
+
|
|
10
|
+
When exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
|
|
11
|
+
|
|
12
|
+
## What a good test is
|
|
13
|
+
|
|
14
|
+
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.
|
|
15
|
+
|
|
16
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
17
|
+
|
|
18
|
+
## Seams: where tests go
|
|
19
|
+
|
|
20
|
+
A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
|
|
21
|
+
|
|
22
|
+
**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.
|
|
23
|
+
|
|
24
|
+
Ask: "What's the public interface, and which seams should we test?" Give each proposed seam a one-line note on what it catches and what it misses.
|
|
25
|
+
|
|
26
|
+
When the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with "codebase-design" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.
|
|
27
|
+
|
|
28
|
+
## Anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
|
|
31
|
+
- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.
|
|
32
|
+
- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.
|
|
33
|
+
|
|
34
|
+
## Rules of the loop
|
|
35
|
+
|
|
36
|
+
- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
|
|
37
|
+
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
|
|
38
|
+
- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Good and Bad Tests
|
|
2
|
+
|
|
3
|
+
## Good Tests
|
|
4
|
+
|
|
5
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// GOOD: Tests observable behavior
|
|
9
|
+
test("user can checkout with valid cart", async () => {
|
|
10
|
+
const cart = createCart();
|
|
11
|
+
cart.add(product);
|
|
12
|
+
const result = await checkout(cart, paymentMethod);
|
|
13
|
+
expect(result.status).toBe("confirmed");
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Characteristics:
|
|
18
|
+
|
|
19
|
+
- Tests behavior users/callers care about
|
|
20
|
+
- Uses public API only
|
|
21
|
+
- Survives internal refactors
|
|
22
|
+
- Describes WHAT, not HOW
|
|
23
|
+
- One logical assertion per test
|
|
24
|
+
|
|
25
|
+
## Bad Tests
|
|
26
|
+
|
|
27
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// BAD: Tests implementation details
|
|
31
|
+
test("checkout calls paymentService.process", async () => {
|
|
32
|
+
const mockPayment = jest.mock(paymentService);
|
|
33
|
+
await checkout(cart, payment);
|
|
34
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Red flags:
|
|
39
|
+
|
|
40
|
+
- Mocking internal collaborators
|
|
41
|
+
- Testing private methods
|
|
42
|
+
- Asserting on call counts/order
|
|
43
|
+
- Test breaks when refactoring without behavior change
|
|
44
|
+
- Test name describes HOW not WHAT
|
|
45
|
+
- Verifying through external means instead of interface
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// BAD: Bypasses interface to verify
|
|
49
|
+
test("createUser saves to database", async () => {
|
|
50
|
+
await createUser({ name: "Alice" });
|
|
51
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
52
|
+
expect(row).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// GOOD: Verifies through interface
|
|
56
|
+
test("createUser makes user retrievable", async () => {
|
|
57
|
+
const user = await createUser({ name: "Alice" });
|
|
58
|
+
const retrieved = await getUser(user.id);
|
|
59
|
+
expect(retrieved.name).toBe("Alice");
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Tautological tests**: Expected value restates the implementation, so the test passes by construction.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// BAD: Expected value is recomputed the way the code computes it
|
|
67
|
+
test("calculateTotal sums line items", () => {
|
|
68
|
+
const items = [{ price: 10 }, { price: 5 }];
|
|
69
|
+
const expected = items.reduce((sum, i) => sum + i.price, 0);
|
|
70
|
+
expect(calculateTotal(items)).toBe(expected);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// GOOD: Expected value is an independent, known literal
|
|
74
|
+
test("calculateTotal sums line items", () => {
|
|
75
|
+
expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
<!-- huenei-template:start -->
|
|
1
2
|
# AGENTS.md
|
|
2
3
|
|
|
3
4
|
Proyecto de pruebas E2E con **Cypress + TypeScript**, arquitectura **App Actions**.
|
|
4
5
|
|
|
5
6
|
Este archivo es el punto de entrada para cualquier agente (Cursor, Claude Code, Codex/ChatGPT, Copilot, Cursor SDK, Cloud Agents). Las reglas en `.cursor/rules/` lo complementan.
|
|
6
7
|
|
|
8
|
+
<!-- huenei-template:end -->
|
|
9
|
+
|
|
7
10
|
## Aplicación bajo prueba
|
|
8
11
|
|
|
9
12
|
Briefing canónico de la app bajo prueba. Completar con `/setup-project-context`. Los agentes lo leen antes de cualquier tarea E2E.
|
|
@@ -50,6 +53,8 @@ Briefing canónico de la app bajo prueba. Completar con `/setup-project-context`
|
|
|
50
53
|
|
|
51
54
|
Última actualización: <!-- YYYY-MM-DD -->
|
|
52
55
|
|
|
56
|
+
<!-- huenei-template:start -->
|
|
57
|
+
|
|
53
58
|
## Comandos
|
|
54
59
|
|
|
55
60
|
| Acción | Comando |
|
|
@@ -74,21 +79,20 @@ Funcionan en cualquier IDE o extensión. Si la persona escribe el comando, o pid
|
|
|
74
79
|
| Comando | Qué hace | Seguir |
|
|
75
80
|
| --- | --- | --- |
|
|
76
81
|
| `/setup-project-context` | Briefing del SUT → sección `## Aplicación bajo prueba` en `AGENTS.md` | [docs/agent-commands/setup-project-context.md](docs/agent-commands/setup-project-context.md) |
|
|
77
|
-
| `/new-e2e-scenario` |
|
|
78
|
-
| `/new-e2e-test` |
|
|
82
|
+
| `/new-e2e-scenario` | Completa un escenario a partir del borrador/contexto del Hub (o entrevista si no hay borrador) y escribe `scenarios/` + `cypress/fixtures/<id>.json` | [docs/agent-commands/new-e2e-scenario.md](docs/agent-commands/new-e2e-scenario.md) |
|
|
83
|
+
| `/new-e2e-test` | Implementa el spec con ciclo TDD (falla → pasa → puede fallar); no reescribe el escenario | [docs/agent-commands/new-e2e-test.md](docs/agent-commands/new-e2e-test.md) |
|
|
79
84
|
|
|
80
85
|
Antes de cualquier tarea E2E, leer la sección `## Aplicación bajo prueba` de este archivo. Si aún tiene placeholders, sugerí `/setup-project-context`.
|
|
81
86
|
|
|
82
|
-
Cursor, Claude Code (`.claude/commands/`) y Copilot (`.github/prompts/`) los ofrecen como comandos de barra; todos apuntan a esos archivos. En ejecuciones sin persona (Cloud Agents), no usarlos: anotar lo faltante en **Preguntas abiertas** del escenario y en el PR. Excepción: `/setup-project-context` invocado por el Hub con el contexto del proyecto corre en su modo pipeline, sin preguntas.
|
|
87
|
+
Cursor, Claude Code (`.claude/commands/`) y Copilot (`.github/prompts/`) los ofrecen como comandos de barra; todos apuntan a esos archivos. En ejecuciones sin persona (Cloud Agents), no usarlos: anotar lo faltante en **Preguntas abiertas** del escenario y en el PR. Excepción: `/setup-project-context` invocado por el Hub con el contexto del proyecto corre en su modo pipeline, sin preguntas. Excepciones Hub: en **Modo Hub (borrador)**, `/new-e2e-scenario` y `/new-e2e-test` corren sin persona (sin grilling ni preguntas) y los huecos van a **Preguntas abiertas**. En **Modo Hub (interactivo)**, una sesión del Hub los sigue sin repo ni terminal y solo pregunta con bloques `hub-questions`, que responde una persona desde el Hub. Cada comando documenta sus modos en `## Modos`.
|
|
83
88
|
|
|
84
89
|
## Flujo para implementar un escenario
|
|
85
90
|
|
|
86
|
-
1. **Leer el escenario
|
|
91
|
+
1. **Leer** [scenarios/INDEX.md](scenarios/INDEX.md) (estado y Decisiones compartidas) y el escenario en `scenarios/<ID>-<slug>.md` (formato en [scenarios/_template.md](scenarios/_template.md)) y su set de datos en `data_file`. Si la fixture no existe, generarla con las reglas de **Dónde se guarda** de `/new-e2e-scenario`. Si falta información imprescindible, dejarlo anotado en el PR en lugar de inventarla.
|
|
87
92
|
2. **Explorar la aplicación**: correr `pnpm env:check` para ver `BASE_URL` (la URL de la app vive en `.env`) y abrir `BASE_URL` + `target_path`; si el escenario tiene `session`, explorar con la sesión del rol según **Explorar una pantalla que requiere sesión** de la skill `e2e-cypress`: el login lo hace `cypress/auth/<rol>.cy.ts` con `pnpm auth`, y el agente nunca escribe contraseñas en el navegador. Usar el navegador disponible (Playwright MCP en el IDE, el navegador de la VM en Cloud Agents) para confirmar textos y atributos de test reales antes de escribir selectores.
|
|
88
93
|
3. **Implementar según la arquitectura** descrita en [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): reutilizar lo existente antes de crear algo nuevo.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
6. **Dejar el PR listo**: describir el escenario cubierto, los archivos creados y cualquier supuesto.
|
|
94
|
+
5. **Correr y corregir (TDD)**: por caso, aplicar la skill `tdd` (falla → pasa → puede fallar). Luego `pnpm typecheck`, `pnpm lint` y el test deben pasar. Si la app difiere del escenario, anotar en **Preguntas abiertas** — no reescribir pasos ni resultados. Ante un fallo, revisar el trace (`test-results/`).
|
|
95
|
+
6. **Dejar listo para revisión**: actualizar la fila del escenario en [scenarios/INDEX.md](scenarios/INDEX.md) (`implementado` o `bloqueado` con el motivo). En **Modo persona (IDE)**, abrir el PR con el escenario cubierto, archivos y supuestos. En **Modo Hub (borrador)** de `/new-e2e-test`, el resumen agrupa archivos en el orden de commits de [docs/HUB-INTEGRATION.md](docs/HUB-INTEGRATION.md); el disparador del Hub abre el PR.
|
|
92
96
|
|
|
93
97
|
## Skills
|
|
94
98
|
|
|
@@ -101,6 +105,7 @@ En `.cursor/skills/`. Ante cualquier diferencia, este archivo, `.cursor/rules/`
|
|
|
101
105
|
| `cypress-explain` | Explicar specs o APIs de Cypress sin modificar código |
|
|
102
106
|
| `e2e-testing-patterns` | Criterios generales de E2E (qué automatizar, selectores estables, aislamiento) |
|
|
103
107
|
| `grilling` | Entrevistar a la persona sobre el dominio antes de documentar contexto |
|
|
108
|
+
| `tdd` | Ciclo falla → pasa → puede fallar al implementar cada caso E2E |
|
|
104
109
|
| `verification-before-completion` | No dar nada por terminado sin correr y leer typecheck, lint y tests |
|
|
105
110
|
|
|
106
111
|
Antes de declarar un escenario terminado, aplicar `verification-before-completion`: correr `pnpm typecheck`, `pnpm lint` y el test nuevo, y citar el resultado.
|
|
@@ -111,3 +116,5 @@ Antes de declarar un escenario terminado, aplicar `verification-before-completio
|
|
|
111
116
|
- No usar esperas fijas (`cy.wait(<número>)`) ni `.only`.
|
|
112
117
|
- En `cypress.config.ts`, solo agregar secretos al bloque `env` (los escribe `/new-e2e-scenario`), salvo que el escenario requiera más. No cambiar la versión de `cypress` sin revisar la imagen del CI.
|
|
113
118
|
- Los tests deben ser independientes entre sí (Cypress limpia cookies y storage entre tests).
|
|
119
|
+
|
|
120
|
+
<!-- huenei-template:end -->
|
|
@@ -57,7 +57,7 @@ WebKit en Cypress es experimental (`experimentalWebKitSupport` + `playwright-web
|
|
|
57
57
|
cypress/e2e/ Specs y aserciones
|
|
58
58
|
cypress/support/ App actions (app-actions.ts), plugins (e2e.ts), credentials.ts y factories de datos generados
|
|
59
59
|
cypress/fixtures/ Set de datos de cada escenario (<id>.json) y catálogo de usuarios (users.json)
|
|
60
|
-
scenarios/ Escenarios
|
|
60
|
+
scenarios/ Escenarios + INDEX.md (estados y Decisiones compartidas; contrato con el Hub)
|
|
61
61
|
scripts/env-check.mjs Validación de .env (pnpm env:check)
|
|
62
62
|
docs/agent-commands/ /new-e2e-scenario y /new-e2e-test, para cualquier agente
|
|
63
63
|
docs/ARCHITECTURE.md El patrón App Actions y cuándo agregar capas
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"sourceType": "github",
|
|
31
31
|
"skillPath": "skills/productivity/grilling/SKILL.md",
|
|
32
32
|
"computedHash": "e40cc1d348f6d935e28f1e24474302d7368f0a400429271a43b35fe154891dc5"
|
|
33
|
+
},
|
|
34
|
+
"tdd": {
|
|
35
|
+
"source": "mattpocock/skills",
|
|
36
|
+
"sourceType": "github",
|
|
37
|
+
"skillPath": "skills/engineering/tdd/SKILL.md",
|
|
38
|
+
"computedHash": "daf55026f456af104a72fa43247f7bcec89e5127316dc5b1b8d675d6a9d8ce94"
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
2
4
|
import { defineConfig } from 'cypress';
|
|
3
5
|
import { plugin as cypressGrepPlugin } from '@cypress/grep/plugin';
|
|
4
6
|
|
|
@@ -10,13 +12,54 @@ if (!baseUrl) {
|
|
|
10
12
|
// Every TEST_<KEY>_EMAIL / TEST_<KEY>_PASSWORD from .env, read in specs with emailOf()/passwordOf().
|
|
11
13
|
const testUsers = Object.fromEntries(Object.entries(process.env).filter(([name]) => name.startsWith('TEST_')));
|
|
12
14
|
|
|
15
|
+
function writeHubResults(results: CypressCommandLine.CypressRunResult): void {
|
|
16
|
+
const outputFile = 'test-results/results.json';
|
|
17
|
+
mkdirSync(dirname(outputFile), { recursive: true });
|
|
18
|
+
const tests = (results.runs ?? []).flatMap((run) =>
|
|
19
|
+
(run.tests ?? []).map((test) => {
|
|
20
|
+
const titlePath = test.title ?? [];
|
|
21
|
+
const title = titlePath.join(' ');
|
|
22
|
+
const tagMatch = title.match(/@SC-[\w-]+/i);
|
|
23
|
+
return {
|
|
24
|
+
title: titlePath,
|
|
25
|
+
state: test.state,
|
|
26
|
+
tags: tagMatch ? [tagMatch[0]] : [],
|
|
27
|
+
spec: run.spec?.relative,
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
writeFileSync(
|
|
32
|
+
outputFile,
|
|
33
|
+
JSON.stringify(
|
|
34
|
+
{
|
|
35
|
+
totalTests: results.totalTests,
|
|
36
|
+
totalPassed: results.totalPassed,
|
|
37
|
+
totalFailed: results.totalFailed,
|
|
38
|
+
totalPending: results.totalPending,
|
|
39
|
+
totalSkipped: results.totalSkipped,
|
|
40
|
+
startedTestsAt: results.startedTestsAt,
|
|
41
|
+
endedTestsAt: results.endedTestsAt,
|
|
42
|
+
tests,
|
|
43
|
+
},
|
|
44
|
+
null,
|
|
45
|
+
2,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
13
50
|
export default defineConfig({
|
|
14
51
|
e2e: {
|
|
15
52
|
baseUrl,
|
|
16
53
|
specPattern: 'cypress/e2e/**/*.cy.ts',
|
|
17
54
|
supportFile: 'cypress/support/e2e.ts',
|
|
18
|
-
setupNodeEvents(
|
|
55
|
+
setupNodeEvents(on, config) {
|
|
19
56
|
cypressGrepPlugin(config);
|
|
57
|
+
on('after:run', (results) => {
|
|
58
|
+
// cypress open: undefined. Failed boot: no runs. Hub reads this file from CI.
|
|
59
|
+
if (results && 'runs' in results) {
|
|
60
|
+
writeHubResults(results);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
20
63
|
return config;
|
|
21
64
|
},
|
|
22
65
|
},
|
|
@@ -26,4 +26,5 @@ Definir `BASE_URL` como variable y cada `TEST_<CLAVE>_EMAIL` / `TEST_<CLAVE>_PAS
|
|
|
26
26
|
|
|
27
27
|
- Las contraseñas nunca van en el catálogo, en una fixture de escenario ni en un spec: siempre `passwordOf()`, tipeadas con `{ log: false }`. La excepción son los casos negativos con una contraseña inválida a propósito.
|
|
28
28
|
- El agente nunca escribe valores en `.env`: los completa la persona.
|
|
29
|
+
- El agente nunca pide passwords, API keys, PATs ni otros valores secretos, tampoco en las preguntas del Hub (`hub-questions`): para una credencial pregunta la persona (`type: persona`, por clave de rol) o el nombre de la variable (`TEST_<CLAVE>_EMAIL`).
|
|
29
30
|
- En `.env` solo van `BASE_URL`, los usuarios y otros secretos (tokens, claves de API). El resto de los datos de prueba va en la fixture de cada escenario.
|