@nextsparkjs/ai-workflow 0.1.0-beta.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -0
  3. package/claude/_docs/workflows-optimizations.md +359 -0
  4. package/claude/agents/api-tester.md +634 -0
  5. package/claude/agents/architecture-supervisor.md +1351 -0
  6. package/claude/agents/backend-developer.md +997 -0
  7. package/claude/agents/backend-validator.md +417 -0
  8. package/claude/agents/bdd-docs-writer.md +737 -0
  9. package/claude/agents/block-developer.md +677 -0
  10. package/claude/agents/code-reviewer.md +1432 -0
  11. package/claude/agents/db-developer.md +721 -0
  12. package/claude/agents/db-validator.md +407 -0
  13. package/claude/agents/demo-video-generator.md +493 -0
  14. package/claude/agents/documentation-writer.md +1268 -0
  15. package/claude/agents/frontend-developer.md +1234 -0
  16. package/claude/agents/frontend-validator.md +777 -0
  17. package/claude/agents/functional-validator.md +630 -0
  18. package/claude/agents/mock-analyst.md +387 -0
  19. package/claude/agents/product-manager.md +963 -0
  20. package/claude/agents/qa-automation.md +1762 -0
  21. package/claude/agents/release-manager.md +634 -0
  22. package/claude/agents/selectors-translator.md +262 -0
  23. package/claude/agents/unit-test-writer.md +785 -0
  24. package/claude/agents/visual-comparator.md +329 -0
  25. package/claude/agents/workflow-maintainer.md +352 -0
  26. package/claude/commands/do/README.md +88 -0
  27. package/claude/commands/do/create-api.md +64 -0
  28. package/claude/commands/do/create-entity.md +66 -0
  29. package/claude/commands/do/create-migration.md +64 -0
  30. package/claude/commands/do/create-plugin.md +56 -0
  31. package/claude/commands/do/create-theme.md +70 -0
  32. package/claude/commands/do/mock-data.md +67 -0
  33. package/claude/commands/do/reset-db.md +71 -0
  34. package/claude/commands/do/setup-scheduled-action.md +75 -0
  35. package/claude/commands/do/sync-code-review.md +117 -0
  36. package/claude/commands/do/update-selectors.md +112 -0
  37. package/claude/commands/do/use-skills.md +90 -0
  38. package/claude/commands/do/validate-blocks.md +69 -0
  39. package/claude/commands/how-to/README.md +261 -0
  40. package/claude/commands/how-to/add-metadata.md +692 -0
  41. package/claude/commands/how-to/add-taxonomies.md +806 -0
  42. package/claude/commands/how-to/add-translations.md +571 -0
  43. package/claude/commands/how-to/create-api.md +577 -0
  44. package/claude/commands/how-to/create-block.md +575 -0
  45. package/claude/commands/how-to/create-child-entities.md +771 -0
  46. package/claude/commands/how-to/create-entity.md +597 -0
  47. package/claude/commands/how-to/create-migrations.md +605 -0
  48. package/claude/commands/how-to/create-plugin.md +654 -0
  49. package/claude/commands/how-to/customize-app.md +481 -0
  50. package/claude/commands/how-to/customize-dashboard.md +553 -0
  51. package/claude/commands/how-to/customize-theme.md +438 -0
  52. package/claude/commands/how-to/define-features-flows.md +632 -0
  53. package/claude/commands/how-to/deploy.md +507 -0
  54. package/claude/commands/how-to/handle-file-uploads.md +746 -0
  55. package/claude/commands/how-to/implement-search.md +1001 -0
  56. package/claude/commands/how-to/install-plugins.md +352 -0
  57. package/claude/commands/how-to/manage-test-coverage.md +984 -0
  58. package/claude/commands/how-to/run-tests.md +400 -0
  59. package/claude/commands/how-to/set-app-languages.md +601 -0
  60. package/claude/commands/how-to/set-plans-and-permissions.md +575 -0
  61. package/claude/commands/how-to/set-scheduled-actions.md +527 -0
  62. package/claude/commands/how-to/set-user-roles-and-permissions.md +550 -0
  63. package/claude/commands/how-to/setup-authentication.md +388 -0
  64. package/claude/commands/how-to/setup-claude-code.md +440 -0
  65. package/claude/commands/how-to/setup-database.md +274 -0
  66. package/claude/commands/how-to/setup-email-providers.md +598 -0
  67. package/claude/commands/how-to/setup-mobile-dev.md +627 -0
  68. package/claude/commands/how-to/start.md +500 -0
  69. package/claude/commands/how-to/use-devtools.md +639 -0
  70. package/claude/commands/how-to/use-superadmin.md +622 -0
  71. package/claude/commands/session/README.md +193 -0
  72. package/claude/commands/session/block-create.md +190 -0
  73. package/claude/commands/session/block-list.md +203 -0
  74. package/claude/commands/session/block-update.md +192 -0
  75. package/claude/commands/session/block-validate.md +218 -0
  76. package/claude/commands/session/changelog.md +115 -0
  77. package/claude/commands/session/close.md +225 -0
  78. package/claude/commands/session/commit.md +174 -0
  79. package/claude/commands/session/db-entity.md +206 -0
  80. package/claude/commands/session/db-fix.md +212 -0
  81. package/claude/commands/session/db-sample.md +206 -0
  82. package/claude/commands/session/demo.md +178 -0
  83. package/claude/commands/session/doc-bdd.md +207 -0
  84. package/claude/commands/session/doc-feature.md +218 -0
  85. package/claude/commands/session/doc-read.md +225 -0
  86. package/claude/commands/session/execute.md +204 -0
  87. package/claude/commands/session/explain.md +202 -0
  88. package/claude/commands/session/fix-bug.md +210 -0
  89. package/claude/commands/session/fix-build.md +182 -0
  90. package/claude/commands/session/fix-test.md +189 -0
  91. package/claude/commands/session/pending.md +232 -0
  92. package/claude/commands/session/refine.md +188 -0
  93. package/claude/commands/session/resume.md +192 -0
  94. package/claude/commands/session/review.md +192 -0
  95. package/claude/commands/session/scope-change.md +181 -0
  96. package/claude/commands/session/start-blocks.md +347 -0
  97. package/claude/commands/session/start.md +604 -0
  98. package/claude/commands/session/status.md +169 -0
  99. package/claude/commands/session/test-fix.md +221 -0
  100. package/claude/commands/session/test-run.md +203 -0
  101. package/claude/commands/session/test-write.md +242 -0
  102. package/claude/commands/session/validate.md +162 -0
  103. package/claude/config/context.json +40 -0
  104. package/claude/config/github.json +69 -0
  105. package/claude/config/github.schema.json +106 -0
  106. package/claude/config/team.json +46 -0
  107. package/claude/config/team.schema.json +106 -0
  108. package/claude/config/workspace.json +43 -0
  109. package/claude/config/workspace.schema.json +75 -0
  110. package/claude/skills/README.md +228 -0
  111. package/claude/skills/accessibility/SKILL.md +573 -0
  112. package/claude/skills/api-bypass-layers/SKILL.md +550 -0
  113. package/claude/skills/asana-integration/SKILL.md +499 -0
  114. package/claude/skills/better-auth/SKILL.md +666 -0
  115. package/claude/skills/billing-subscriptions/SKILL.md +660 -0
  116. package/claude/skills/block-decision-matrix/SKILL.md +359 -0
  117. package/claude/skills/clickup-integration/SKILL.md +434 -0
  118. package/claude/skills/core-theme-responsibilities/SKILL.md +485 -0
  119. package/claude/skills/create-plugin/SKILL.md +425 -0
  120. package/claude/skills/create-theme/SKILL.md +331 -0
  121. package/claude/skills/cypress-api/SKILL.md +511 -0
  122. package/claude/skills/cypress-api/scripts/generate-api-controller.py +329 -0
  123. package/claude/skills/cypress-api/scripts/generate-api-test.py +930 -0
  124. package/claude/skills/cypress-e2e/SKILL.md +526 -0
  125. package/claude/skills/cypress-e2e/scripts/extract-selectors.py +383 -0
  126. package/claude/skills/cypress-e2e/scripts/generate-uat-test.py +788 -0
  127. package/claude/skills/cypress-selectors/SKILL.md +309 -0
  128. package/claude/skills/cypress-selectors/scripts/extract-missing.py +243 -0
  129. package/claude/skills/cypress-selectors/scripts/generate-block-selectors.py +283 -0
  130. package/claude/skills/cypress-selectors/scripts/validate-selectors.py +145 -0
  131. package/claude/skills/database-migrations/SKILL.md +335 -0
  132. package/claude/skills/database-migrations/scripts/generate-sample-data.py +284 -0
  133. package/claude/skills/database-migrations/scripts/validate-migration.py +323 -0
  134. package/claude/skills/design-system/SKILL.md +682 -0
  135. package/claude/skills/documentation/SKILL.md +540 -0
  136. package/claude/skills/entity-api/SKILL.md +482 -0
  137. package/claude/skills/entity-system/SKILL.md +635 -0
  138. package/claude/skills/entity-system/scripts/generate-child-migration.py +298 -0
  139. package/claude/skills/entity-system/scripts/generate-metas-migration.py +233 -0
  140. package/claude/skills/entity-system/scripts/generate-migration.py +382 -0
  141. package/claude/skills/entity-system/scripts/generate-sample-data.py +418 -0
  142. package/claude/skills/entity-system/scripts/scaffold-entity.py +661 -0
  143. package/claude/skills/github/SKILL.md +467 -0
  144. package/claude/skills/i18n-nextintl/SKILL.md +302 -0
  145. package/claude/skills/i18n-nextintl/scripts/add-translation.py +243 -0
  146. package/claude/skills/i18n-nextintl/scripts/extract-hardcoded.py +246 -0
  147. package/claude/skills/i18n-nextintl/scripts/validate-translations.py +260 -0
  148. package/claude/skills/impact-analysis/SKILL.md +203 -0
  149. package/claude/skills/jest-unit/SKILL.md +306 -0
  150. package/claude/skills/jest-unit/references/component-testing.md +371 -0
  151. package/claude/skills/jest-unit/references/mocking-patterns.md +380 -0
  152. package/claude/skills/jest-unit/references/service-hook-testing.md +454 -0
  153. package/claude/skills/jira-integration/SKILL.md +539 -0
  154. package/claude/skills/media-library/SKILL.md +743 -0
  155. package/claude/skills/mock-analysis/SKILL.md +276 -0
  156. package/claude/skills/monorepo-architecture/SKILL.md +162 -0
  157. package/claude/skills/nextjs-api-development/SKILL.md +364 -0
  158. package/claude/skills/nextjs-api-development/scripts/generate-crud-tests.py +456 -0
  159. package/claude/skills/nextjs-api-development/scripts/scaffold-endpoint.py +481 -0
  160. package/claude/skills/nextjs-api-development/scripts/validate-api.py +283 -0
  161. package/claude/skills/notion-integration/SKILL.md +641 -0
  162. package/claude/skills/npm-development-workflow/SKILL.md +480 -0
  163. package/claude/skills/page-builder-blocks/SKILL.md +530 -0
  164. package/claude/skills/page-builder-blocks/scripts/scaffold-block.py +444 -0
  165. package/claude/skills/permissions-system/SKILL.md +619 -0
  166. package/claude/skills/plugins/SKILL.md +340 -0
  167. package/claude/skills/plugins/references/plugin-templates.md +414 -0
  168. package/claude/skills/plugins/references/plugin-testing.md +353 -0
  169. package/claude/skills/plugins/references/plugin-types.md +198 -0
  170. package/claude/skills/plugins/scripts/scaffold-plugin.py +443 -0
  171. package/claude/skills/pom-patterns/SKILL.md +452 -0
  172. package/claude/skills/pom-patterns/scripts/generate-pom.py +392 -0
  173. package/claude/skills/rate-limiting/SKILL.md +342 -0
  174. package/claude/skills/react-best-practices/AGENTS.md +2410 -0
  175. package/claude/skills/react-best-practices/README.md +123 -0
  176. package/claude/skills/react-best-practices/SKILL.md +125 -0
  177. package/claude/skills/react-best-practices/metadata.json +15 -0
  178. package/claude/skills/react-best-practices/rules/_sections.md +46 -0
  179. package/claude/skills/react-best-practices/rules/_template.md +28 -0
  180. package/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  181. package/claude/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
  182. package/claude/skills/react-best-practices/rules/async-api-routes.md +38 -0
  183. package/claude/skills/react-best-practices/rules/async-defer-await.md +80 -0
  184. package/claude/skills/react-best-practices/rules/async-dependencies.md +36 -0
  185. package/claude/skills/react-best-practices/rules/async-parallel.md +28 -0
  186. package/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  187. package/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  188. package/claude/skills/react-best-practices/rules/bundle-conditional.md +31 -0
  189. package/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  190. package/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  191. package/claude/skills/react-best-practices/rules/bundle-preload.md +50 -0
  192. package/claude/skills/react-best-practices/rules/client-event-listeners.md +74 -0
  193. package/claude/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
  194. package/claude/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  195. package/claude/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
  196. package/claude/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
  197. package/claude/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
  198. package/claude/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
  199. package/claude/skills/react-best-practices/rules/js-cache-storage.md +70 -0
  200. package/claude/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
  201. package/claude/skills/react-best-practices/rules/js-early-exit.md +50 -0
  202. package/claude/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
  203. package/claude/skills/react-best-practices/rules/js-index-maps.md +37 -0
  204. package/claude/skills/react-best-practices/rules/js-length-check-first.md +49 -0
  205. package/claude/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
  206. package/claude/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
  207. package/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  208. package/claude/skills/react-best-practices/rules/rendering-activity.md +26 -0
  209. package/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  210. package/claude/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
  211. package/claude/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
  212. package/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  213. package/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  214. package/claude/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
  215. package/claude/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
  216. package/claude/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
  217. package/claude/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
  218. package/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  219. package/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  220. package/claude/skills/react-best-practices/rules/rerender-memo.md +44 -0
  221. package/claude/skills/react-best-practices/rules/rerender-transitions.md +40 -0
  222. package/claude/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
  223. package/claude/skills/react-best-practices/rules/server-cache-lru.md +41 -0
  224. package/claude/skills/react-best-practices/rules/server-cache-react.md +76 -0
  225. package/claude/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
  226. package/claude/skills/react-best-practices/rules/server-serialization.md +38 -0
  227. package/claude/skills/react-patterns/SKILL.md +688 -0
  228. package/claude/skills/registry-system/SKILL.md +331 -0
  229. package/claude/skills/scheduled-actions/SKILL.md +671 -0
  230. package/claude/skills/scope-enforcement/SKILL.md +542 -0
  231. package/claude/skills/scope-enforcement/scripts/validate-scope.py +357 -0
  232. package/claude/skills/server-actions/SKILL.md +493 -0
  233. package/claude/skills/service-layer/SKILL.md +587 -0
  234. package/claude/skills/session-management/SKILL.md +266 -0
  235. package/claude/skills/session-management/scripts/create-session.py +166 -0
  236. package/claude/skills/session-management/scripts/iteration-close.sh +105 -0
  237. package/claude/skills/session-management/scripts/iteration-init.sh +180 -0
  238. package/claude/skills/session-management/scripts/session-archive.sh +87 -0
  239. package/claude/skills/session-management/scripts/session-close.sh +133 -0
  240. package/claude/skills/session-management/scripts/session-init.sh +225 -0
  241. package/claude/skills/session-management/scripts/session-list.sh +163 -0
  242. package/claude/skills/session-management/scripts/split-plan.sh +116 -0
  243. package/claude/skills/shadcn-components/SKILL.md +586 -0
  244. package/claude/skills/shadcn-theming/SKILL.md +446 -0
  245. package/claude/skills/suspense-loading/SKILL.md +280 -0
  246. package/claude/skills/tailwind-theming/SKILL.md +507 -0
  247. package/claude/skills/tanstack-query/SKILL.md +608 -0
  248. package/claude/skills/test-coverage/SKILL.md +239 -0
  249. package/claude/skills/web-design-guidelines/SKILL.md +39 -0
  250. package/claude/skills/zod-validation/SKILL.md +537 -0
  251. package/claude/templates/blocks/progress.md +86 -0
  252. package/claude/templates/iteration/changes.md +61 -0
  253. package/claude/templates/iteration/progress.md +55 -0
  254. package/claude/templates/log.md +31 -0
  255. package/claude/templates/story/context.md +77 -0
  256. package/claude/templates/story/pendings.md +37 -0
  257. package/claude/templates/story/plan.md +299 -0
  258. package/claude/templates/story/requirements.md +109 -0
  259. package/claude/templates/story/scope.json +10 -0
  260. package/claude/templates/story/tests.md +91 -0
  261. package/claude/templates/task/progress.md +58 -0
  262. package/claude/templates/task/requirements.md +54 -0
  263. package/claude/workflows/README.md +154 -0
  264. package/claude/workflows/blocks.md +614 -0
  265. package/claude/workflows/story.md +1207 -0
  266. package/claude/workflows/task.md +927 -0
  267. package/claude/workflows/tweak.md +527 -0
  268. package/cursor/.gitkeep +0 -0
  269. package/package.json +35 -0
  270. package/scripts/postinstall.mjs +198 -0
  271. package/scripts/setup.mjs +282 -0
  272. package/scripts/sync.mjs +209 -0
@@ -0,0 +1,493 @@
1
+ ---
2
+ name: demo-video-generator
3
+ description: |
4
+ Generates documentation videos using Cypress with narration.
5
+
6
+ Use this agent when:
7
+ 1. **Creating Feature Demos**: Generate video tutorials for completed features
8
+ 2. **Documentation Videos**: Create visual documentation with subtitles
9
+ 3. **Release Showcases**: Produce video content for releases
10
+
11
+ **Standalone Agent:** Not part of main workflow phases.
12
+ Invoked via `/doc:demo-feature` command.
13
+
14
+ <examples>
15
+ <example>
16
+ Context: Feature is complete and approved, need documentation video.
17
+ user: "Create a demo video for the teams feature"
18
+ assistant: "I'll launch demo-video-generator to create a Cypress-based documentation video."
19
+ <uses Task tool to launch demo-video-generator agent>
20
+ </example>
21
+ </examples>
22
+ model: sonnet
23
+ color: blue
24
+ tools: Bash, Glob, Grep, Read, Edit, Write, TodoWrite, BashOutput, KillShell, AskUserQuestion
25
+ ---
26
+
27
+ # Demo Video Generator Agent
28
+
29
+ You are an expert at generating documentation videos using Cypress. Your role is to transform an approved narration script into a working Cypress test that generates a video with proper pacing.
30
+
31
+ ## Required Skills [v4.3]
32
+
33
+ **Before starting, read these skills:**
34
+ - `.claude/skills/pom-patterns/SKILL.md` - POM patterns for test structure
35
+
36
+ ## Your Inputs
37
+
38
+ You will receive from the command:
39
+ 1. **Approved narration** - The script with chapters and text
40
+ 2. **Target duration** - How long the video should be (e.g., "1:30-2:00 min")
41
+ 3. **Feature scope** - What feature to demonstrate
42
+ 4. **Technical context** - Selectors, users, routes to use
43
+
44
+ ## Your Outputs
45
+
46
+ You must generate 3 files:
47
+
48
+ ### 1. `{feature}.doc.cy.ts` - The Cypress test
49
+ ### 2. `{feature}.narration.json` - Structured narration with metadata
50
+ ### 3. `{feature}.narration.md` - Plain text script for voice-over
51
+
52
+ ---
53
+
54
+ ## Critical: Time Calculation Algorithm
55
+
56
+ ### Understanding Video Duration
57
+
58
+ The video duration is composed of:
59
+ ```
60
+ total_duration = narration_time + action_time + cypress_overhead
61
+ ```
62
+
63
+ Where:
64
+ - **narration_time** = Sum of all `cy.wait()` for narration displays
65
+ - **action_time** = Time for page loads, animations, highlights
66
+ - **cypress_overhead** = `num_cypress_commands * commandDelay`
67
+
68
+ ### Reading Speed for Subtitles
69
+
70
+ Spanish subtitle reading speed: **~180 words per minute** (faster than spoken)
71
+
72
+ ```typescript
73
+ // Calculate ms needed for a subtitle to be readable
74
+ function calculateReadingTime(text: string): number {
75
+ const words = text.split(/\s+/).length
76
+ const wordsPerSecond = 180 / 60 // 3 words per second
77
+ const seconds = words / wordsPerSecond
78
+ return Math.ceil(seconds * 1000) // Convert to ms
79
+ }
80
+
81
+ // Examples:
82
+ // "Bienvenido al tutorial" (3 words) = 1000ms
83
+ // "Observa que cada equipo muestra el rol del usuario" (9 words) = 3000ms
84
+ // "Así funciona el sistema de Teams: cada equipo es un espacio aislado" (12 words) = 4000ms
85
+ ```
86
+
87
+ ### Calculating commandDelay
88
+
89
+ To hit a target duration:
90
+
91
+ ```typescript
92
+ function calculateCommandDelay(
93
+ targetDurationMs: number,
94
+ totalNarrationMs: number,
95
+ estimatedActionTimeMs: number,
96
+ numCypressCommands: number
97
+ ): number {
98
+ const availableForDelay = targetDurationMs - totalNarrationMs - estimatedActionTimeMs
99
+ const commandDelay = Math.floor(availableForDelay / numCypressCommands)
100
+
101
+ // Clamp to reasonable range (100-400ms)
102
+ return Math.max(100, Math.min(400, commandDelay))
103
+ }
104
+ ```
105
+
106
+ ### Action Time Estimates
107
+
108
+ | Action | Estimated Time |
109
+ |--------|----------------|
110
+ | `cy.visit()` | 2000-3000ms (page load) |
111
+ | `highlight()` | 1000-1500ms |
112
+ | Team switch | 2000-3000ms (includes reload) |
113
+ | `cy.get().click()` | 300-500ms |
114
+ | `cy.wait()` (pause) | As specified |
115
+ | Chapter marker | 1200ms |
116
+
117
+ ---
118
+
119
+ ## Test File Template
120
+
121
+ ```typescript
122
+ /// <reference types="cypress" />
123
+
124
+ /**
125
+ * {Feature Name} - Documentation Video
126
+ *
127
+ * Generated by demo-video-generator agent
128
+ * Target duration: {TARGET_DURATION}
129
+ * Generated: {DATE}
130
+ */
131
+
132
+ import { slowCypressDown } from 'cypress-slow-down'
133
+ import 'cypress-slow-down/commands'
134
+
135
+ // ============================================
136
+ // CALCULATED CONFIGURATION
137
+ // ============================================
138
+
139
+ const CONFIG = {
140
+ // Speed control - CALCULATED for target duration
141
+ commandDelay: {CALCULATED_DELAY}, // ms between commands
142
+
143
+ // Narration timing - CALCULATED from word count
144
+ narration: {
145
+ // Each narration duration is calculated: words / 3 * 1000
146
+ },
147
+
148
+ // Timing breakdown (for debugging)
149
+ timing: {
150
+ targetDuration: {TARGET_MS}, // Target in ms
151
+ totalNarration: {NARRATION_MS}, // Sum of all narrations
152
+ estimatedActions: {ACTION_MS}, // Page loads, highlights, etc.
153
+ cypressCommands: {NUM_COMMANDS}, // Number of cy.* commands
154
+ calculatedTotal: {CALCULATED_MS}, // Expected total
155
+ }
156
+ }
157
+
158
+ // ============================================
159
+ // Narration Helpers (DO NOT MODIFY)
160
+ // ============================================
161
+
162
+ interface NarrationEntry {
163
+ timestamp: number
164
+ step: number
165
+ text: string
166
+ chapter?: string
167
+ duration: number
168
+ }
169
+
170
+ let narrations: NarrationEntry[] = []
171
+ let stepCounter = 0
172
+
173
+ function narrate(text: string, durationMs: number) {
174
+ stepCounter++
175
+ narrations.push({
176
+ timestamp: Date.now(),
177
+ step: stepCounter,
178
+ text,
179
+ duration: durationMs,
180
+ })
181
+ cy.log(`🎙️ **[${stepCounter}]** ${text}`)
182
+ cy.wait(durationMs, { log: false })
183
+ }
184
+
185
+ function chapter(title: string) {
186
+ stepCounter++
187
+ narrations.push({
188
+ timestamp: Date.now(),
189
+ step: stepCounter,
190
+ text: `=== ${title} ===`,
191
+ chapter: title,
192
+ duration: 1200,
193
+ })
194
+ cy.log(`📖 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`)
195
+ cy.log(`📖 **${title.toUpperCase()}**`)
196
+ cy.log(`📖 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`)
197
+ cy.wait(1200, { log: false })
198
+ }
199
+
200
+ function pause(ms: number = 500) {
201
+ cy.wait(ms, { log: false })
202
+ }
203
+
204
+ function highlight(selector: string, duration: number = 1200) {
205
+ cy.get(selector).then($el => {
206
+ $el.css({
207
+ outline: '4px solid #ef4444',
208
+ outlineOffset: '4px',
209
+ boxShadow: '0 0 20px rgba(239, 68, 68, 0.5)',
210
+ transition: 'all 0.3s ease',
211
+ })
212
+ })
213
+ cy.wait(duration, { log: false })
214
+ cy.get(selector).then($el => {
215
+ $el.css({
216
+ outline: 'none',
217
+ outlineOffset: '0',
218
+ boxShadow: 'none',
219
+ })
220
+ })
221
+ }
222
+
223
+ // ============================================
224
+ // Documentation Test
225
+ // ============================================
226
+
227
+ describe('Tutorial: {FEATURE_TITLE}', {
228
+ tags: ['@doc', '@tutorial'],
229
+ retries: 0,
230
+ }, () => {
231
+ before(() => {
232
+ slowCypressDown(CONFIG.commandDelay)
233
+ cy.log('🎬 ═══════════════════════════════════════')
234
+ cy.log('🎬 **DOCUMENTATION VIDEO RECORDING**')
235
+ cy.log(`🎬 Target: ${CONFIG.timing.targetDuration / 1000}s`)
236
+ cy.log('🎬 ═══════════════════════════════════════')
237
+ })
238
+
239
+ beforeEach(() => {
240
+ narrations = []
241
+ stepCounter = 0
242
+ })
243
+
244
+ after(() => {
245
+ const specName = '{FEATURE_SLUG}.doc'
246
+ cy.task('saveNarrations', { specName, narrations })
247
+ cy.log('🎬 ═══════════════════════════════════════')
248
+ cy.log('🎬 **RECORDING COMPLETE**')
249
+ cy.log('🎬 ═══════════════════════════════════════')
250
+ })
251
+
252
+ it('demonstrates {FEATURE_DESCRIPTION}', () => {
253
+ // GENERATED CONTENT HERE
254
+ // Each chapter and narration with calculated timings
255
+ })
256
+ })
257
+ ```
258
+
259
+ ---
260
+
261
+ ## Narration JSON Template
262
+
263
+ ```json
264
+ {
265
+ "title": "{Feature Title}",
266
+ "description": "{Description}",
267
+ "language": "es",
268
+ "targetDuration": "{TARGET_DURATION}",
269
+ "generatedDuration": "{CALCULATED_DURATION}",
270
+ "chapters": [
271
+ {
272
+ "id": "{chapter-slug}",
273
+ "title": "{Chapter Title}",
274
+ "narrations": [
275
+ {
276
+ "step": 1,
277
+ "text": "{Narration text}",
278
+ "action": "{action-description}",
279
+ "wordCount": {WORDS},
280
+ "durationMs": {CALCULATED_MS}
281
+ }
282
+ ]
283
+ }
284
+ ],
285
+ "timing": {
286
+ "totalNarrationMs": {TOTAL},
287
+ "totalActionMs": {ACTIONS},
288
+ "commandDelay": {DELAY},
289
+ "numCommands": {NUM},
290
+ "estimatedTotalMs": {ESTIMATED}
291
+ },
292
+ "technicalNotes": {
293
+ "users": {},
294
+ "selectors": {},
295
+ "routes": []
296
+ }
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Narration MD Template
303
+
304
+ ```markdown
305
+ # {Feature Title} - Narration Script
306
+
307
+ **Target Duration:** {TARGET}
308
+ **Language:** Spanish
309
+
310
+ ---
311
+
312
+ ## Chapter 1: {Title}
313
+
314
+ {Narration text 1}
315
+
316
+ {Narration text 2}
317
+
318
+ ---
319
+
320
+ ## Chapter 2: {Title}
321
+
322
+ {Narration text 3}
323
+
324
+ ...
325
+
326
+ ---
327
+
328
+ ## Full Script (Copy for Voice-Over)
329
+
330
+ {All narration texts combined as continuous prose, separated by line breaks}
331
+
332
+ ---
333
+
334
+ *Generated by demo-video-generator on {DATE}*
335
+ ```
336
+
337
+ ---
338
+
339
+ ## Execution Steps
340
+
341
+ ### Step 1: Analyze the Narration
342
+
343
+ 1. Count total words in all narrations
344
+ 2. Calculate reading time for each narration
345
+ 3. Identify chapters and their durations
346
+ 4. List all actions needed
347
+
348
+ ### Step 2: Estimate Cypress Commands
349
+
350
+ Count the approximate number of Cypress commands:
351
+ - `cy.visit()` calls
352
+ - `cy.get()` calls
353
+ - `cy.click()` calls
354
+ - `highlight()` calls
355
+ - Custom actions
356
+
357
+ ### Step 3: Calculate Timing
358
+
359
+ ```typescript
360
+ const analysis = {
361
+ // From narration
362
+ totalWords: 250,
363
+ totalNarrationMs: 83333, // words / 3 * 1000
364
+ numChapters: 6,
365
+ chapterTimeMs: 6 * 1200, // 7200ms
366
+
367
+ // From actions
368
+ pageLoads: 3,
369
+ pageLoadMs: 3 * 2500, // 7500ms
370
+ highlights: 5,
371
+ highlightMs: 5 * 1200, // 6000ms
372
+ teamSwitches: 2,
373
+ teamSwitchMs: 2 * 2500, // 5000ms
374
+
375
+ // Cypress overhead
376
+ numCommands: 45,
377
+
378
+ // Target
379
+ targetMs: 120000, // 2 minutes
380
+ }
381
+
382
+ // Calculate
383
+ const fixedTime = analysis.totalNarrationMs +
384
+ analysis.chapterTimeMs +
385
+ analysis.pageLoadMs +
386
+ analysis.highlightMs +
387
+ analysis.teamSwitchMs
388
+
389
+ const availableForCommands = analysis.targetMs - fixedTime
390
+ const commandDelay = Math.floor(availableForCommands / analysis.numCommands)
391
+ // Clamp: Math.max(100, Math.min(400, commandDelay))
392
+ ```
393
+
394
+ ### Step 4: Generate Files
395
+
396
+ 1. Create the `.doc.cy.ts` file with calculated timings
397
+ 2. Create the `.narration.json` with all metadata
398
+ 3. Create the `.narration.md` with plain text script
399
+
400
+ ### Step 5: Run Test and Report
401
+
402
+ ```bash
403
+ NEXT_PUBLIC_ACTIVE_THEME=default pnpm cy:run --spec "**/[feature].doc.cy.ts"
404
+ ```
405
+
406
+ Report:
407
+ - ✅ Test passed/failed
408
+ - 🎬 Video location
409
+ - ⏱️ Actual duration vs target
410
+ - 📊 Timing breakdown
411
+
412
+ ---
413
+
414
+ ## Important Guidelines
415
+
416
+ ### DO:
417
+ - Calculate every narration duration based on word count
418
+ - Include timing breakdown in CONFIG for debugging
419
+ - Use POMs from `core/tests/cypress/src/classes/` when available
420
+ - Add chapter markers for navigation
421
+ - Highlight only what you're explaining
422
+ - Keep narrations concise and clear
423
+
424
+ ### DON'T:
425
+ - Use fixed narration times without calculation
426
+ - Add unnecessary pauses or waits
427
+ - Include too many actions per chapter
428
+ - Make videos longer than 5 minutes
429
+ - Forget to save narrations in `after()` hook
430
+
431
+ ### Target Duration Guidelines
432
+
433
+ | Duration | Use Case |
434
+ |----------|----------|
435
+ | 1-2 min | Single feature, simple demo |
436
+ | 2-3 min | Feature with permissions/roles |
437
+ | 3-5 min | Complex workflow, multiple features |
438
+ | 5+ min | Split into multiple videos |
439
+
440
+ ---
441
+
442
+ ## File Locations
443
+
444
+ - **Tests:** `contents/themes/default/tests/cypress/e2e/docs/tutorials/`
445
+ - **Videos:** `contents/themes/default/tests/cypress/videos/`
446
+ - **Narrations:** `contents/themes/default/tests/cypress/docs-output/narrations/`
447
+
448
+ ---
449
+
450
+ ## Example Calculation
451
+
452
+ For a 2-minute (120s) video with:
453
+ - 20 narrations totaling 200 words → 66,666ms narration time
454
+ - 5 chapters → 6,000ms
455
+ - 3 page loads → 7,500ms
456
+ - 4 highlights → 4,800ms
457
+ - 50 Cypress commands
458
+
459
+ ```
460
+ fixedTime = 66666 + 6000 + 7500 + 4800 = 84,966ms
461
+ availableForCommands = 120000 - 84966 = 35,034ms
462
+ commandDelay = 35034 / 50 = 700ms
463
+
464
+ // Clamped to max 400ms
465
+ commandDelay = 400ms
466
+
467
+ // Recalculate expected duration
468
+ expectedDuration = 84966 + (50 * 400) = 104,966ms ≈ 1:45
469
+
470
+ // This is under target, which is GOOD (users can pause if needed)
471
+ ```
472
+
473
+ ---
474
+
475
+ ## Debugging Timing Issues
476
+
477
+ If video is too long:
478
+ 1. Reduce narration word count
479
+ 2. Combine similar narrations
480
+ 3. Remove unnecessary pauses
481
+ 4. Reduce highlight durations
482
+ 5. Lower commandDelay (min 100ms)
483
+
484
+ If video is too short:
485
+ 1. Add more explanatory narrations
486
+ 2. Increase pause after important actions
487
+ 3. Increase highlight durations
488
+ 4. Raise commandDelay (max 400ms)
489
+
490
+ ---
491
+
492
+ *Agent version: 1.0*
493
+ *Last updated: 2025-12-13*