@yandy-r/ycc-opencode 0.0.0-stage → 6.0.0

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 (407) hide show
  1. package/AGENTS.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +41 -2
  4. package/agents/ansible-automation-expert.md +115 -0
  5. package/agents/api-docs-expert.md +146 -0
  6. package/agents/api-documenter.md +105 -0
  7. package/agents/architect.md +264 -0
  8. package/agents/architecture-analyst.md +99 -0
  9. package/agents/backport-conflict-resolver.md +134 -0
  10. package/agents/cloudflare-architect.md +85 -0
  11. package/agents/cloudflare-developer.md +196 -0
  12. package/agents/code-architect.md +101 -0
  13. package/agents/code-documenter.md +114 -0
  14. package/agents/code-explorer.md +99 -0
  15. package/agents/code-finder.md +83 -0
  16. package/agents/code-researcher.md +102 -0
  17. package/agents/code-reviewer.md +268 -0
  18. package/agents/code-simplifier.md +77 -0
  19. package/agents/codebase-advisor.md +130 -0
  20. package/agents/db-modifier.md +235 -0
  21. package/agents/docs-git-committer.md +220 -0
  22. package/agents/documentation-writer.md +92 -0
  23. package/agents/feature-researcher.md +121 -0
  24. package/agents/feature-writer.md +89 -0
  25. package/agents/frontend-ui-developer.md +98 -0
  26. package/agents/git-cleanup.md +173 -0
  27. package/agents/go-api-architect.md +172 -0
  28. package/agents/go-expert-architect.md +147 -0
  29. package/agents/implementor.md +167 -0
  30. package/agents/library-docs-writer.md +128 -0
  31. package/agents/nextjs-ux-ui-expert.md +127 -0
  32. package/agents/nodejs-backend-architect.md +112 -0
  33. package/agents/nodejs-backend-developer.md +184 -0
  34. package/agents/planner.md +257 -0
  35. package/agents/pr-comment-fixer.md +284 -0
  36. package/agents/practices-researcher.md +80 -0
  37. package/agents/project-file-cleaner.md +140 -0
  38. package/agents/prp-researcher.md +231 -0
  39. package/agents/python-developer.md +171 -0
  40. package/agents/python-expert-architect.md +188 -0
  41. package/agents/readme-generator.md +100 -0
  42. package/agents/release-fix-applier.md +194 -0
  43. package/agents/releaser.md +147 -0
  44. package/agents/research-specialist.md +106 -0
  45. package/agents/reverse-proxy-architect.md +131 -0
  46. package/agents/review-fixer.md +264 -0
  47. package/agents/root-cause-analyzer.md +105 -0
  48. package/agents/rust-build-resolver.md +183 -0
  49. package/agents/rust-expert-architect.md +149 -0
  50. package/agents/rust-reviewer.md +126 -0
  51. package/agents/sql-database-developer.md +195 -0
  52. package/agents/systems-engineering-expert.md +203 -0
  53. package/agents/terraform-architect.md +109 -0
  54. package/agents/terraform-developer.md +229 -0
  55. package/agents/test-strategy-planner.md +126 -0
  56. package/agents/turso-database-architect.md +139 -0
  57. package/agents/typescript-developer.md +170 -0
  58. package/agents/typescript-expert-architect.md +167 -0
  59. package/index.js +260 -0
  60. package/package.json +35 -4
  61. package/registration.json +4384 -0
  62. package/shared/references/agent-native-setup.md +121 -0
  63. package/shared/references/branch-prep.md +31 -0
  64. package/shared/references/branching-model.md +162 -0
  65. package/shared/references/ci-monitoring.md +445 -0
  66. package/shared/references/forge-detection.md +162 -0
  67. package/shared/references/goal-pairing.md +53 -0
  68. package/shared/references/pr-base-and-backport.md +143 -0
  69. package/shared/references/review-artifact-format.md +141 -0
  70. package/shared/references/review-checklist.md +161 -0
  71. package/shared/references/review-dispatch.md +71 -0
  72. package/shared/references/session-state.md +159 -0
  73. package/shared/references/standalone-dispatch.md +298 -0
  74. package/shared/references/target-capability-matrix.md +325 -0
  75. package/shared/references/visual-mode.md +155 -0
  76. package/shared/references/worktree-strategy.md +310 -0
  77. package/shared/scripts/backport-audit.sh +283 -0
  78. package/shared/scripts/ci-monitor.sh +637 -0
  79. package/shared/scripts/lib/backport-lib.sh +47 -0
  80. package/shared/scripts/lib/ci-classify.sh +103 -0
  81. package/shared/scripts/lib/forge.sh +264 -0
  82. package/shared/scripts/lib/release-state-lib.sh +300 -0
  83. package/shared/scripts/list-worktrees.sh +178 -0
  84. package/shared/scripts/merge-children.sh +82 -0
  85. package/shared/scripts/move-plan-to-worktree.sh +231 -0
  86. package/shared/scripts/pr-guard.sh +283 -0
  87. package/shared/scripts/prepare-feature-branch.sh +326 -0
  88. package/shared/scripts/release-ci-monitor.sh +671 -0
  89. package/shared/scripts/release-state-update.sh +216 -0
  90. package/shared/scripts/release-state.sh +178 -0
  91. package/shared/scripts/report-bundle-drift.sh +343 -0
  92. package/shared/scripts/require-python.sh +17 -0
  93. package/shared/scripts/resolve-plans-dir.sh +262 -0
  94. package/shared/scripts/rules-pointer.sh +20 -0
  95. package/shared/scripts/rules_pointer.py +267 -0
  96. package/shared/scripts/setup-worktree.sh +288 -0
  97. package/shared/scripts/validate-file-paths.sh +249 -0
  98. package/shared/scripts/visual-egress-guard.sh +303 -0
  99. package/shared/scripts/visual-recap-collect.sh +247 -0
  100. package/shared/scripts/worktree-paths.sh +86 -0
  101. package/skills/backport/SKILL.md +291 -0
  102. package/skills/backport/scripts/cherry-pick-pr.sh +232 -0
  103. package/skills/backport/scripts/find-pending.sh +199 -0
  104. package/skills/blueprint/SKILL.md +410 -0
  105. package/skills/blueprint/references/bootstrap-mapping.md +87 -0
  106. package/skills/bundle-author/SKILL.md +119 -0
  107. package/skills/bundle-author/references/surface-map.md +128 -0
  108. package/skills/bundle-author/references/templates/agent-template.md +21 -0
  109. package/skills/bundle-author/references/templates/skill-template.md +36 -0
  110. package/skills/bundle-author/references/when-not-to-scaffold.md +85 -0
  111. package/skills/bundle-author/scripts/scaffold-skill.sh +156 -0
  112. package/skills/bundle-release/SKILL.md +188 -0
  113. package/skills/bundle-release/references/release-checklist.md +196 -0
  114. package/skills/bundle-release/references/release-notes-template.md +48 -0
  115. package/skills/bundle-release/references/version-policy.md +150 -0
  116. package/skills/bundle-release/scripts/bump-version.sh +97 -0
  117. package/skills/bundle-release/scripts/draft-notes.sh +222 -0
  118. package/skills/bundle-release/scripts/preflight.sh +164 -0
  119. package/skills/bundle-release/scripts/release_versions.py +361 -0
  120. package/skills/clean/SKILL.md +107 -0
  121. package/skills/clean/references/agent-prompts.md +199 -0
  122. package/skills/clean/references/safety-config.md +125 -0
  123. package/skills/clean/scripts/detect-project-type.sh +423 -0
  124. package/skills/clean/scripts/generate-report.sh +245 -0
  125. package/skills/clean/scripts/validate-safety.sh +401 -0
  126. package/skills/code-report/SKILL.md +375 -0
  127. package/skills/code-report/scripts/check-prerequisites.sh +65 -0
  128. package/skills/code-report/templates/report-structure.md +202 -0
  129. package/skills/code-review/SKILL.md +153 -0
  130. package/skills/code-review/references/pr-procedure.md +311 -0
  131. package/skills/compatibility-audit/SKILL.md +226 -0
  132. package/skills/compatibility-audit/references/reading-the-report.md +159 -0
  133. package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +372 -0
  134. package/skills/compatibility-audit/scripts/audit-target-features.sh +558 -0
  135. package/skills/deep-research/SKILL.md +251 -0
  136. package/skills/deep-research/references/analysis-prompts.md +702 -0
  137. package/skills/deep-research/references/completion-summary-template.md +66 -0
  138. package/skills/deep-research/references/persona-analogical.md +159 -0
  139. package/skills/deep-research/references/persona-archaeological.md +69 -0
  140. package/skills/deep-research/references/persona-contrarian.md +155 -0
  141. package/skills/deep-research/references/persona-futurist.md +70 -0
  142. package/skills/deep-research/references/persona-historical.md +142 -0
  143. package/skills/deep-research/references/persona-journalistic.md +69 -0
  144. package/skills/deep-research/references/persona-negative-space.md +70 -0
  145. package/skills/deep-research/references/persona-systems.md +69 -0
  146. package/skills/deep-research/references/synthesis-template.md +569 -0
  147. package/skills/deep-research/references/verification-log-template.md +32 -0
  148. package/skills/deep-research/scripts/check-prerequisites.sh +153 -0
  149. package/skills/deep-research/scripts/validate-research.sh +244 -0
  150. package/skills/feature-research/SKILL.md +292 -0
  151. package/skills/feature-research/scripts/validate-research.sh +159 -0
  152. package/skills/feature-research/scripts/validate-spec.sh +270 -0
  153. package/skills/feature-research/templates/research-agents.md +569 -0
  154. package/skills/feature-research/templates/spec-structure.md +437 -0
  155. package/skills/formatters/SKILL.md +207 -0
  156. package/skills/formatters/references/best-practices.md +78 -0
  157. package/skills/formatters/references/flag-reference.md +178 -0
  158. package/skills/formatters/references/stack-detection.md +119 -0
  159. package/skills/formatters/references/templates/husky-pre-commit.tmpl +13 -0
  160. package/skills/formatters/references/templates/justfile-snippet.just.tmpl +31 -0
  161. package/skills/formatters/references/templates/lefthook.yml.tmpl +22 -0
  162. package/skills/formatters/references/templates/lint-autofix.yml.tmpl +94 -0
  163. package/skills/formatters/references/templates/lint.yml.tmpl +85 -0
  164. package/skills/formatters/references/templates/makefile-snippet.mk.tmpl +34 -0
  165. package/skills/formatters/references/templates/package-json-scripts.json.tmpl +14 -0
  166. package/skills/formatters/references/templates/readme-section.md.tmpl +118 -0
  167. package/skills/formatters/scripts/apply-aliases.sh +245 -0
  168. package/skills/formatters/scripts/apply-ci.sh +136 -0
  169. package/skills/formatters/scripts/apply-docs.sh +187 -0
  170. package/skills/formatters/scripts/apply-hooks.sh +261 -0
  171. package/skills/formatters/scripts/bundle/format.sh +15 -0
  172. package/skills/formatters/scripts/bundle/go-tools.sh +119 -0
  173. package/skills/formatters/scripts/bundle/init-formatters.sh +517 -0
  174. package/skills/formatters/scripts/bundle/install-shellcheck.sh +85 -0
  175. package/skills/formatters/scripts/bundle/lib/excludes.sh +179 -0
  176. package/skills/formatters/scripts/bundle/lib/modified-files.sh +222 -0
  177. package/skills/formatters/scripts/bundle/lib/shellcheck-resolve.sh +81 -0
  178. package/skills/formatters/scripts/bundle/lib/shellcheck-version.sh +5 -0
  179. package/skills/formatters/scripts/bundle/lint.sh +15 -0
  180. package/skills/formatters/scripts/bundle/style.sh +1410 -0
  181. package/skills/formatters/scripts/bundle/templates/biome.json +81 -0
  182. package/skills/formatters/scripts/bundle/templates/clippy.toml +2 -0
  183. package/skills/formatters/scripts/bundle/templates/markdownlint.json +14 -0
  184. package/skills/formatters/scripts/bundle/templates/markdownlintignore +38 -0
  185. package/skills/formatters/scripts/bundle/templates/prettierignore +45 -0
  186. package/skills/formatters/scripts/bundle/templates/prettierrc.json +11 -0
  187. package/skills/formatters/scripts/bundle/templates/python-pyproject.toml +80 -0
  188. package/skills/formatters/scripts/bundle/templates/rustfmt.toml +41 -0
  189. package/skills/formatters/scripts/bundle/templates/tsconfig.json +21 -0
  190. package/skills/formatters/scripts/profile-style.sh +264 -0
  191. package/skills/frontend-design/SKILL.md +151 -0
  192. package/skills/frontend-patterns/SKILL.md +66 -0
  193. package/skills/frontend-patterns/references/animation.md +21 -0
  194. package/skills/frontend-patterns/references/components-and-state.md +40 -0
  195. package/skills/frontend-patterns/references/data-and-performance.md +34 -0
  196. package/skills/frontend-patterns/references/forms-errors-a11y.md +35 -0
  197. package/skills/git-cleanup/SKILL.md +286 -0
  198. package/skills/git-cleanup/references/active-code-rules.md +318 -0
  199. package/skills/git-cleanup/references/host-detection.md +217 -0
  200. package/skills/git-workflow/SKILL.md +130 -0
  201. package/skills/git-workflow/references/ci-monitoring-phase.md +130 -0
  202. package/skills/git-workflow/references/commit-phases.md +247 -0
  203. package/skills/git-workflow/references/examples-and-troubleshooting.md +47 -0
  204. package/skills/git-workflow/references/goal-pairing.md +23 -0
  205. package/skills/git-workflow/references/pr-creation.md +269 -0
  206. package/skills/git-workflow/scripts/analyze-changes.sh +266 -0
  207. package/skills/git-workflow/scripts/create-pr.sh +464 -0
  208. package/skills/git-workflow/scripts/validate-commit.sh +235 -0
  209. package/skills/git-workflow/templates/agent-prompts.md +518 -0
  210. package/skills/git-workflow/templates/commit-types.md +504 -0
  211. package/skills/git-workflow/templates/documentation-decision.md +509 -0
  212. package/skills/git-workflow/templates/pr-template.md +772 -0
  213. package/skills/go-patterns/SKILL.md +89 -0
  214. package/skills/go-patterns/references/design-and-tooling.md +336 -0
  215. package/skills/go-patterns/references/errors-and-concurrency.md +292 -0
  216. package/skills/go-testing/SKILL.md +133 -0
  217. package/skills/go-testing/references/advanced-testing.md +349 -0
  218. package/skills/go-testing/references/test-structure.md +277 -0
  219. package/skills/hooks-workflow/SKILL.md +232 -0
  220. package/skills/hooks-workflow/references/support-notes.md +134 -0
  221. package/skills/hooks-workflow/references/templates/claude-settings.json.tmpl +13 -0
  222. package/skills/hooks-workflow/references/templates/codex-config-fragment.toml.tmpl +9 -0
  223. package/skills/hooks-workflow/references/templates/cursor-rule-fragment.mdc.tmpl +16 -0
  224. package/skills/hooks-workflow/scripts/build-hook-config.sh +487 -0
  225. package/skills/hooks-workflow/scripts/verify-hooks.sh +257 -0
  226. package/skills/implement-plan/SKILL.md +221 -0
  227. package/skills/implement-plan/references/agent-task-prompt.md +214 -0
  228. package/skills/implement-plan/references/output-formats.md +150 -0
  229. package/skills/implement-plan/references/plan-inputs.md +126 -0
  230. package/skills/implement-plan/scripts/check-prerequisites.sh +78 -0
  231. package/skills/implement-plan/scripts/parse-dependencies.sh +206 -0
  232. package/skills/init/SKILL.md +272 -0
  233. package/skills/init/references/conventional-commits.md +114 -0
  234. package/skills/init/references/flag-reference.md +236 -0
  235. package/skills/init/references/label-taxonomy.md +115 -0
  236. package/skills/init/references/project-profile-heuristics.md +156 -0
  237. package/skills/init/references/template-library.md +129 -0
  238. package/skills/init/scripts/count-source-files.sh +60 -0
  239. package/skills/init/scripts/generate-agent-catalog.sh +193 -0
  240. package/skills/init/scripts/generate-mcp-catalog.sh +214 -0
  241. package/skills/init/scripts/migrate-rules.py +459 -0
  242. package/skills/init/scripts/migrate-rules.sh +26 -0
  243. package/skills/init/scripts/profile-project.sh +453 -0
  244. package/skills/init/scripts/render-template.py +226 -0
  245. package/skills/init/scripts/render-template.sh +25 -0
  246. package/skills/init/scripts/rules-report.sh +31 -0
  247. package/skills/init/scripts/rules_file_lib.py +41 -0
  248. package/skills/init/templates/AGENTS.md.tmpl +38 -0
  249. package/skills/init/templates/CLAUDE.md.tmpl +7 -0
  250. package/skills/init/templates/ai-rule.md.tmpl +3 -0
  251. package/skills/init/templates/cursor-rule.mdc.tmpl +7 -0
  252. package/skills/init/templates/git/commitlint.config.cjs.tmpl +40 -0
  253. package/skills/init/templates/git/gitignore.tmpl +120 -0
  254. package/skills/init/templates/git/gitmessage.tmpl +27 -0
  255. package/skills/init/templates/git/install-lefthook.sh.tmpl +131 -0
  256. package/skills/init/templates/git/lefthook-usage.md.tmpl +101 -0
  257. package/skills/init/templates/git/lefthook.yml.tmpl +64 -0
  258. package/skills/init/templates/github/bug_report.yml.tmpl +78 -0
  259. package/skills/init/templates/github/config.yml.tmpl +5 -0
  260. package/skills/init/templates/github/copilot-instructions.md.tmpl +24 -0
  261. package/skills/init/templates/github/docs_request.yml.tmpl +41 -0
  262. package/skills/init/templates/github/feature_request.yml.tmpl +59 -0
  263. package/skills/init/templates/github/labels.md.tmpl +75 -0
  264. package/skills/init/templates/github/pull_request_template.md.tmpl +66 -0
  265. package/skills/init/templates/github/workflows/pr-title-autofix.yml.tmpl +101 -0
  266. package/skills/init/templates/github/workflows/pr-title.yml.tmpl +55 -0
  267. package/skills/init/templates/workspace-report.md +83 -0
  268. package/skills/orchestrate/SKILL.md +165 -0
  269. package/skills/orchestrate/references/agent-catalog.md +601 -0
  270. package/skills/orchestrate/references/agent-prompts.md +495 -0
  271. package/skills/orchestrate/references/dispatch-playbook.md +333 -0
  272. package/skills/orchestrate/references/task-breakdown.md +410 -0
  273. package/skills/orchestrate/scripts/analyze-task.sh +139 -0
  274. package/skills/orchestrate/scripts/summarize-results.sh +160 -0
  275. package/skills/orchestrate/scripts/validate-agents.sh +92 -0
  276. package/skills/parallel-plan/SKILL.md +124 -0
  277. package/skills/plan/SKILL.md +134 -0
  278. package/skills/plan/references/enhanced-personas.md +131 -0
  279. package/skills/plan/references/personas-and-merge.md +77 -0
  280. package/skills/plan/references/plan-validation.md +65 -0
  281. package/skills/plan/references/planner-prompts.md +68 -0
  282. package/skills/plan/references/planning-tracks.md +73 -0
  283. package/skills/plan-workflow/SKILL.md +406 -0
  284. package/skills/plan-workflow/references/checkpoint-messages.md +370 -0
  285. package/skills/plan-workflow/references/plan-structure.md +238 -0
  286. package/skills/plan-workflow/references/planning-agents.md +511 -0
  287. package/skills/plan-workflow/references/research-agents-optimized.md +348 -0
  288. package/skills/plan-workflow/references/research-agents.md +436 -0
  289. package/skills/plan-workflow/references/shared-structure.md +152 -0
  290. package/skills/plan-workflow/references/validation-agents.md +363 -0
  291. package/skills/plan-workflow/scripts/check-prerequisites.sh +65 -0
  292. package/skills/plan-workflow/scripts/check-state.sh +190 -0
  293. package/skills/plan-workflow/scripts/persist-or-fail.sh +135 -0
  294. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +216 -0
  295. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +225 -0
  296. package/skills/plan-workflow/scripts/validate-shared.sh +229 -0
  297. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +256 -0
  298. package/skills/pr-autofix/SKILL.md +307 -0
  299. package/skills/pr-autofix/references/ci-loop.md +64 -0
  300. package/skills/pr-autofix/references/comment-sources.md +197 -0
  301. package/skills/pr-autofix/references/data-shapes.md +87 -0
  302. package/skills/pr-autofix/references/goal-example.md +30 -0
  303. package/skills/pr-autofix/references/output-templates.md +162 -0
  304. package/skills/pr-autofix/references/prompt-injection-safety.md +165 -0
  305. package/skills/pr-autofix/references/related-skills.md +11 -0
  306. package/skills/pr-autofix/references/severity-mapping.md +146 -0
  307. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +364 -0
  308. package/skills/pr-autofix/scripts/post-summary.sh +226 -0
  309. package/skills/pr-autofix/scripts/resolve-thread.sh +251 -0
  310. package/skills/prp-commit/SKILL.md +128 -0
  311. package/skills/prp-implement/SKILL.md +177 -0
  312. package/skills/prp-implement/references/agent-task-prompt.md +36 -0
  313. package/skills/prp-implement/references/detection.md +49 -0
  314. package/skills/prp-implement/references/dry-run.md +0 -0
  315. package/skills/prp-implement/references/report-output.md +204 -0
  316. package/skills/prp-implement/references/validation-and-failures.md +118 -0
  317. package/skills/prp-plan/SKILL.md +323 -0
  318. package/skills/prp-plan/references/enhanced-researchers.md +425 -0
  319. package/skills/prp-plan/references/parallel-additions.md +56 -0
  320. package/skills/prp-plan/references/plan-template.md +264 -0
  321. package/skills/prp-plan/references/synthesis-map.md +25 -0
  322. package/skills/prp-plan/scripts/preflight-enhanced-agents.sh +111 -0
  323. package/skills/prp-plan/scripts/validate-prp-plan.sh +368 -0
  324. package/skills/prp-pr/SKILL.md +402 -0
  325. package/skills/prp-prd/SKILL.md +442 -0
  326. package/skills/prp-spec/SKILL.md +274 -0
  327. package/skills/python-patterns/SKILL.md +103 -0
  328. package/skills/python-patterns/references/core-idioms.md +304 -0
  329. package/skills/python-patterns/references/design-and-tooling.md +407 -0
  330. package/skills/python-testing/SKILL.md +114 -0
  331. package/skills/python-testing/references/mocking-and-integration.md +395 -0
  332. package/skills/python-testing/references/pytest-core.md +366 -0
  333. package/skills/quick-fix/SKILL.md +246 -0
  334. package/skills/quick-review/SKILL.md +304 -0
  335. package/skills/release-model/SKILL.md +231 -0
  336. package/skills/release-model/references/pointer-and-labels.md +83 -0
  337. package/skills/release-model/references/signals-and-proposal.md +68 -0
  338. package/skills/release-model/references/template-placeholders.md +42 -0
  339. package/skills/release-model/references/upgrade-and-audit.md +131 -0
  340. package/skills/release-model/scripts/collect-signals.sh +459 -0
  341. package/skills/release-model/scripts/pointer-targets.sh +29 -0
  342. package/skills/release-model/templates/RELEASING.md.tmpl +151 -0
  343. package/skills/releaser/SKILL.md +251 -0
  344. package/skills/releaser/references/ci-optimization-checklist.md +149 -0
  345. package/skills/releaser/references/ci-templates/docker-release.yml +88 -0
  346. package/skills/releaser/references/ci-templates/generic-release.yml +69 -0
  347. package/skills/releaser/references/ci-templates/go-release.yml +50 -0
  348. package/skills/releaser/references/ci-templates/node-release.yml +126 -0
  349. package/skills/releaser/references/ci-templates/python-release.yml +95 -0
  350. package/skills/releaser/references/ci-templates/rust-release.yml +128 -0
  351. package/skills/releaser/references/ci-workflow-modes.md +42 -0
  352. package/skills/releaser/references/goal-pairing.md +37 -0
  353. package/skills/releaser/references/output-templates.md +143 -0
  354. package/skills/releaser/references/project-type-matrix.md +144 -0
  355. package/skills/releaser/references/release-branches.md +138 -0
  356. package/skills/releaser/references/release-ci-loop.md +249 -0
  357. package/skills/releaser/references/release-notes-template.md +42 -0
  358. package/skills/releaser/references/release-preparation.md +210 -0
  359. package/skills/releaser/scripts/check-release-branch.sh +235 -0
  360. package/skills/releaser/scripts/detect-project.sh +234 -0
  361. package/skills/releaser/scripts/draft-changelog.sh +387 -0
  362. package/skills/releaser/scripts/publish-release.sh +302 -0
  363. package/skills/research-to-issues/SKILL.md +285 -0
  364. package/skills/research-to-issues/references/label-taxonomy.md +48 -0
  365. package/skills/research-to-issues/references/parse-deep-research.md +86 -0
  366. package/skills/research-to-issues/references/parse-feature-spec.md +143 -0
  367. package/skills/research-to-issues/references/parse-parallel-plan.md +124 -0
  368. package/skills/research-to-issues/references/parse-prd.md +184 -0
  369. package/skills/research-to-issues/references/parse-prp-plan.md +237 -0
  370. package/skills/research-to-issues/references/plan-display-format.md +136 -0
  371. package/skills/research-to-issues/scripts/validate-prerequisites.sh +312 -0
  372. package/skills/research-to-issues/templates/feature-issue.md +131 -0
  373. package/skills/research-to-issues/templates/task-issue.md +104 -0
  374. package/skills/research-to-issues/templates/tracking-issue.md +126 -0
  375. package/skills/resume-session/SKILL.md +152 -0
  376. package/skills/review-fix/SKILL.md +229 -0
  377. package/skills/review-fix/references/fix-report.md +121 -0
  378. package/skills/review-fix/references/fixer-dispatch.md +79 -0
  379. package/skills/review-fix/references/plan.md +119 -0
  380. package/skills/rust-patterns/SKILL.md +85 -0
  381. package/skills/rust-patterns/references/concurrency-unsafe-modules.md +243 -0
  382. package/skills/rust-patterns/references/ownership-errors-types.md +262 -0
  383. package/skills/rust-testing/SKILL.md +99 -0
  384. package/skills/rust-testing/references/advanced-testing.md +247 -0
  385. package/skills/rust-testing/references/unit-and-integration.md +193 -0
  386. package/skills/save-session/SKILL.md +159 -0
  387. package/skills/shared-context/SKILL.md +101 -0
  388. package/skills/ts-patterns/SKILL.md +159 -0
  389. package/skills/ts-patterns/references/async-runtimes-tooling.md +375 -0
  390. package/skills/ts-patterns/references/types-errors-modules.md +336 -0
  391. package/skills/ts-testing/SKILL.md +151 -0
  392. package/skills/ts-testing/references/advanced-testing.md +350 -0
  393. package/skills/ts-testing/references/vitest-core.md +318 -0
  394. package/skills/visual-plan/SKILL.md +221 -0
  395. package/skills/visual-plan/references/canvas.md +132 -0
  396. package/skills/visual-plan/references/document-quality.md +178 -0
  397. package/skills/visual-plan/references/exemplar.md +120 -0
  398. package/skills/visual-plan/references/wireframe.md +212 -0
  399. package/skills/visual-plan/scripts/derive-visual-dir.sh +77 -0
  400. package/skills/visual-recap/SKILL.md +238 -0
  401. package/skills/visual-recap/references/wireframe.md +237 -0
  402. package/skills/write-docs/SKILL.md +354 -0
  403. package/skills/write-docs/scripts/audit-documentation.sh +190 -0
  404. package/skills/write-docs/scripts/generate-doc-index.sh +125 -0
  405. package/skills/write-docs/scripts/verify-links.sh +81 -0
  406. package/skills/write-docs/templates/docs-readme.md +34 -0
  407. package/skills/write-docs/templates/documentation-strategy.md +91 -0
@@ -0,0 +1,350 @@
1
+ # TypeScript Testing Patterns: Advanced Testing
2
+
3
+ ## Contents
4
+
5
+ - Parameterized Tests with `test.each`
6
+ - Property-Based Testing with fast-check
7
+ - Mocking
8
+ - Type-Level Testing
9
+ - Benchmarks
10
+ - CI Integration
11
+ - Alternatives to Vitest
12
+
13
+ ## Parameterized Tests with `test.each`
14
+
15
+ ### Table of Cases
16
+
17
+ ```ts
18
+ import { describe, it, expect } from 'vitest';
19
+
20
+ describe('add', () => {
21
+ it.each([
22
+ { a: 2, b: 3, expected: 5 },
23
+ { a: -1, b: -2, expected: -3 },
24
+ { a: 0, b: 0, expected: 0 },
25
+ { a: -1, b: 1, expected: 0 },
26
+ { a: 1_000_000, b: 2_000_000, expected: 3_000_000 },
27
+ ])('add($a, $b) → $expected', ({ a, b, expected }) => {
28
+ expect(add(a, b)).toBe(expected);
29
+ });
30
+ });
31
+ ```
32
+
33
+ ### Running a Whole Suite Against Multiple Configs
34
+
35
+ ```ts
36
+ import { describe, it, expect, beforeEach } from 'vitest';
37
+
38
+ describe.each([{ db: 'postgres' as const }, { db: 'sqlite' as const }])('storage with $db', ({ db }) => {
39
+ let store: Store;
40
+
41
+ beforeEach(() => {
42
+ store = makeStore(db);
43
+ });
44
+
45
+ it('writes and reads', async () => {
46
+ await store.set('key', 'value');
47
+ expect(await store.get('key')).toBe('value');
48
+ });
49
+
50
+ it('enforces constraints', async () => {
51
+ await expect(store.set('', 'value')).rejects.toThrow();
52
+ });
53
+ });
54
+ ```
55
+
56
+ ## Property-Based Testing with fast-check
57
+
58
+ ### Basic Properties
59
+
60
+ ```ts
61
+ import { describe } from 'vitest';
62
+ import { fc, test } from '@fast-check/vitest';
63
+ import { encode, decode } from './codec';
64
+
65
+ describe('codec', () => {
66
+ test.prop([fc.string()])('encode then decode returns input', (input) => {
67
+ const encoded = encode(input);
68
+ const decoded = decode(encoded);
69
+ return decoded === input;
70
+ });
71
+
72
+ test.prop([fc.array(fc.integer(), { maxLength: 100 })])('sort preserves length and is ordered', (arr) => {
73
+ const sorted = [...arr].sort((a, b) => a - b);
74
+ if (sorted.length !== arr.length) return false;
75
+ for (let i = 1; i < sorted.length; i++) {
76
+ if (sorted[i - 1]! > sorted[i]!) return false;
77
+ }
78
+ return true;
79
+ });
80
+ });
81
+ ```
82
+
83
+ ### Custom Arbitraries
84
+
85
+ ```ts
86
+ import { fc, test } from '@fast-check/vitest';
87
+ import { expect } from 'vitest';
88
+ import { User } from './user';
89
+
90
+ const validEmail = fc
91
+ .tuple(fc.stringMatching(/^[a-z]{1,10}$/), fc.stringMatching(/^[a-z]{1,5}$/))
92
+ .map(([user, domain]) => `${user}@${domain}.com`);
93
+
94
+ test.prop([validEmail])('accepts valid emails', (email) => {
95
+ expect(() => new User('Test', email)).not.toThrow();
96
+ });
97
+ ```
98
+
99
+ ## Mocking
100
+
101
+ ### `vi.fn()` — a Fresh Spy
102
+
103
+ ```ts
104
+ import { describe, it, expect, vi } from 'vitest';
105
+
106
+ describe('processItems', () => {
107
+ it('invokes the callback for each item', () => {
108
+ const cb = vi.fn();
109
+ processItems([1, 2, 3], cb);
110
+ expect(cb).toHaveBeenCalledTimes(3);
111
+ expect(cb).toHaveBeenNthCalledWith(1, 1);
112
+ expect(cb).toHaveBeenLastCalledWith(3);
113
+ });
114
+
115
+ it('returns configured values on sequential calls', async () => {
116
+ const loader = vi.fn<(id: string) => Promise<User>>();
117
+ loader
118
+ .mockResolvedValueOnce({ id: '1', name: 'Alice', email: 'a@x.com' })
119
+ .mockRejectedValueOnce(new Error('not found'));
120
+
121
+ await expect(loader('1')).resolves.toMatchObject({ name: 'Alice' });
122
+ await expect(loader('2')).rejects.toThrow('not found');
123
+ });
124
+ });
125
+ ```
126
+
127
+ ### `vi.spyOn()` — Wrap an Existing Method
128
+
129
+ ```ts
130
+ import { describe, it, expect, vi, afterEach } from 'vitest';
131
+ import { UserService } from './user-service';
132
+
133
+ describe('UserService.saveUser', () => {
134
+ afterEach(() => {
135
+ vi.restoreAllMocks();
136
+ });
137
+
138
+ it('logs before saving', async () => {
139
+ const logger = { info: vi.fn(), error: vi.fn() };
140
+ const service = new UserService({ logger });
141
+ const saveSpy = vi.spyOn(service, 'save');
142
+
143
+ await service.saveUser({ id: '1', name: 'Alice', email: 'a@x.com' });
144
+
145
+ expect(logger.info).toHaveBeenCalledWith(expect.stringContaining('saving user'));
146
+ expect(saveSpy).toHaveBeenCalled();
147
+ });
148
+ });
149
+ ```
150
+
151
+ ### `vi.mock()` — Module-Level Mock
152
+
153
+ ```ts
154
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
155
+ import { sendEmail } from './mailer';
156
+ import { registerUser } from './auth';
157
+
158
+ vi.mock('./mailer', () => ({
159
+ sendEmail: vi.fn().mockResolvedValue({ id: 'msg_1' }),
160
+ }));
161
+
162
+ describe('registerUser', () => {
163
+ beforeEach(() => {
164
+ vi.clearAllMocks();
165
+ });
166
+
167
+ it('sends a welcome email on success', async () => {
168
+ await registerUser({ name: 'Alice', email: 'alice@example.com' });
169
+ expect(sendEmail).toHaveBeenCalledWith(
170
+ expect.objectContaining({
171
+ to: 'alice@example.com',
172
+ subject: expect.stringMatching(/welcome/i),
173
+ })
174
+ );
175
+ });
176
+ });
177
+ ```
178
+
179
+ ### Dependency Injection > Module Mocks
180
+
181
+ ```ts
182
+ // Good: inject an interface — no vi.mock() needed, fully type-checked
183
+ interface UserRepository {
184
+ findById(id: string): Promise<User | null>;
185
+ save(user: User): Promise<void>;
186
+ }
187
+
188
+ class UserService {
189
+ constructor(private readonly repo: UserRepository) {}
190
+
191
+ async getUser(id: string): Promise<User> {
192
+ const user = await this.repo.findById(id);
193
+ if (!user) throw new NotFoundError('user', id);
194
+ return user;
195
+ }
196
+ }
197
+
198
+ // Test with a plain fake — type-checked, no runner magic
199
+ it('throws when user is missing', async () => {
200
+ const fakeRepo: UserRepository = {
201
+ findById: async () => null,
202
+ save: async () => {},
203
+ };
204
+ const service = new UserService(fakeRepo);
205
+ await expect(service.getUser('missing')).rejects.toThrow(NotFoundError);
206
+ });
207
+ ```
208
+
209
+ ## Type-Level Testing
210
+
211
+ ### `expectTypeOf` (Built Into Vitest)
212
+
213
+ ```ts
214
+ import { describe, it, expectTypeOf } from 'vitest';
215
+ import { parseJSON, type JsonValue } from './json';
216
+
217
+ describe('parseJSON types', () => {
218
+ it('returns JsonValue', () => {
219
+ expectTypeOf(parseJSON).returns.toEqualTypeOf<JsonValue>();
220
+ });
221
+
222
+ it('accepts string input', () => {
223
+ expectTypeOf(parseJSON).parameter(0).toEqualTypeOf<string>();
224
+ });
225
+ });
226
+ ```
227
+
228
+ ### `expect-type` (Standalone Library)
229
+
230
+ ```ts
231
+ import { expectTypeOf } from 'expect-type';
232
+ import type { User } from './user';
233
+
234
+ expectTypeOf<User>().toHaveProperty('email').toEqualTypeOf<string>();
235
+ expectTypeOf<User>().toHaveProperty('name').toEqualTypeOf<string>();
236
+ ```
237
+
238
+ ### `tsd` (Separate Type-Only Test Suite)
239
+
240
+ ```ts
241
+ // test-d/user.test-d.ts
242
+ import { expectType, expectError } from 'tsd';
243
+ import { makeUser } from '..';
244
+
245
+ expectType<{ id: string; name: string }>(makeUser('alice'));
246
+ expectError(makeUser(42)); // should fail type check
247
+ ```
248
+
249
+ **When to test types vs runtime:**
250
+
251
+ - Test **types** when authoring a library whose public API makes type-level
252
+ guarantees (inference, conditional return types, branded outputs).
253
+ - Test **runtime** for everything else — types catch compile-time bugs; runtime
254
+ tests catch the rest.
255
+
256
+ ## Benchmarks
257
+
258
+ ```ts
259
+ // src/join.bench.ts
260
+ import { bench, describe } from 'vitest';
261
+
262
+ const parts = ['hello', 'world', 'foo', 'bar', 'baz'];
263
+
264
+ describe('string join', () => {
265
+ bench('plus operator', () => {
266
+ let s = '';
267
+ for (const p of parts) s += p;
268
+ });
269
+
270
+ bench('Array.join', () => {
271
+ const _ = parts.join('');
272
+ });
273
+
274
+ bench('template literal', () => {
275
+ const _ = `${parts[0]}${parts[1]}${parts[2]}${parts[3]}${parts[4]}`;
276
+ });
277
+ });
278
+
279
+ // $ vitest bench
280
+ // BenchmarkJoin
281
+ // plus operator 12,345,678 ops/sec
282
+ // Array.join 18,765,432 ops/sec
283
+ // template literal 22,109,876 ops/sec
284
+ ```
285
+
286
+ For heavier, standalone benchmarks (stats, multiple runs, comparison reports),
287
+ reach for `tinybench` or `mitata` directly.
288
+
289
+ ## CI Integration
290
+
291
+ ```yaml
292
+ # .github/workflows/test.yml
293
+ name: test
294
+ on:
295
+ push:
296
+ branches: [main]
297
+ pull_request:
298
+
299
+ jobs:
300
+ test:
301
+ runs-on: ubuntu-latest
302
+ steps:
303
+ - uses: actions/checkout@v4
304
+ - uses: pnpm/action-setup@v4
305
+ with: { version: 10 }
306
+ - uses: actions/setup-node@v4
307
+ with:
308
+ node-version: '22'
309
+ cache: 'pnpm'
310
+
311
+ - run: pnpm install --frozen-lockfile
312
+
313
+ - name: Type check
314
+ run: pnpm exec tsc --noEmit
315
+
316
+ - name: Lint
317
+ run: pnpm exec biome ci .
318
+
319
+ - name: Run tests with coverage
320
+ run: pnpm exec vitest run --coverage
321
+
322
+ - uses: codecov/codecov-action@v4
323
+ with:
324
+ files: ./coverage/lcov.info
325
+ ```
326
+
327
+ ## Alternatives to Vitest
328
+
329
+ The ecosystem has several other runners; reach for them when the constraints fit.
330
+
331
+ - **Jest** — legacy-common, large plugin ecosystem. Vitest's `describe` / `it` /
332
+ `expect` / `vi.fn` / `vi.mock` surface is intentionally Jest-compatible, so
333
+ migration usually means aliasing imports and adjusting config. Prefer Vitest for
334
+ new projects — it's faster, has native ESM/TS, and shares config with Vite.
335
+ - **`node:test`** — Node's built-in test runner (Node 18+). Zero dependencies.
336
+ Good fit for small libraries or when avoiding bundler/transform deps. Lacks
337
+ Vitest's mocking ergonomics, snapshot polish, and watch-mode UI.
338
+ - **`bun test`** — Bun's built-in runner, Jest-compatible API, very fast
339
+ install-plus-run cycle. Good on Bun-first projects; some Vitest plugins don't
340
+ have Bun equivalents.
341
+ - **`deno test`** — Deno's built-in runner using the standard `@std/assert`
342
+ module. Good for Deno-native code. Permissions model means integration tests
343
+ need explicit flags.
344
+ - **Playwright** — end-to-end browser testing. _Complements_ Vitest rather than
345
+ replacing it — use Vitest for unit and integration, Playwright for real-browser
346
+ e2e flows.
347
+
348
+ **Remember**: Tests are documentation. They show how your code is meant to be used.
349
+ Keep them clear, fast, and strict-mode-compliant. The best test is one that fails
350
+ loudly when the behavior it describes breaks — and stays silent the rest of the time.
@@ -0,0 +1,318 @@
1
+ # TypeScript Testing Patterns: Vitest Core
2
+
3
+ ## Contents
4
+
5
+ - TDD Workflow for TypeScript
6
+ - Unit Tests
7
+ - Assertions
8
+ - Error and Rejection Testing
9
+ - Integration Tests
10
+ - Async Tests and Fake Timers
11
+
12
+ ## TDD Workflow for TypeScript
13
+
14
+ ### The RED-GREEN-REFACTOR Cycle
15
+
16
+ ```
17
+ RED → Write a failing test first
18
+ GREEN → Write minimal code to pass the test
19
+ REFACTOR → Improve code while keeping tests green
20
+ REPEAT → Continue with next requirement
21
+ ```
22
+
23
+ ### Step-by-Step TDD in TypeScript
24
+
25
+ ```ts
26
+ // calculator.ts — RED: stub with a placeholder that throws
27
+ export function add(a: number, b: number): number {
28
+ throw new Error('not yet implemented');
29
+ }
30
+ ```
31
+
32
+ ```ts
33
+ // calculator.test.ts — write the test first
34
+ import { describe, it, expect } from 'vitest';
35
+ import { add } from './calculator';
36
+
37
+ describe('add', () => {
38
+ it('sums two numbers', () => {
39
+ expect(add(2, 3)).toBe(5);
40
+ });
41
+ });
42
+
43
+ // $ vitest
44
+ // FAIL calculator.test.ts > add > sums two numbers
45
+ // Error: not yet implemented
46
+ ```
47
+
48
+ ```ts
49
+ // GREEN: minimal implementation
50
+ export function add(a: number, b: number): number {
51
+ return a + b;
52
+ }
53
+ // $ vitest → PASS, then REFACTOR while tests stay green
54
+ ```
55
+
56
+ ## Unit Tests
57
+
58
+ ### Colocated Unit Tests
59
+
60
+ ```ts
61
+ // src/user.ts
62
+ export class User {
63
+ constructor(
64
+ public readonly name: string,
65
+ public readonly email: string
66
+ ) {
67
+ if (!email.includes('@')) {
68
+ throw new Error(`invalid email: ${email}`);
69
+ }
70
+ }
71
+
72
+ get displayName(): string {
73
+ return this.name;
74
+ }
75
+ }
76
+ ```
77
+
78
+ ```ts
79
+ // src/user.test.ts — colocated with the source
80
+ import { describe, it, expect } from 'vitest';
81
+ import { User } from './user';
82
+
83
+ describe('User', () => {
84
+ it('creates a user with a valid email', () => {
85
+ const user = new User('Alice', 'alice@example.com');
86
+ expect(user.displayName).toBe('Alice');
87
+ expect(user.email).toBe('alice@example.com');
88
+ });
89
+
90
+ it('rejects invalid emails', () => {
91
+ expect(() => new User('Bob', 'not-an-email')).toThrow('invalid email');
92
+ });
93
+ });
94
+ ```
95
+
96
+ **File conventions:**
97
+
98
+ - `.test.ts` or `.spec.ts` are picked up by Vitest by default.
99
+ - Colocation (`src/user.ts` + `src/user.test.ts`) or a `__tests__/` directory both
100
+ work — colocation is more common and easier to navigate.
101
+ - Configure via `test.include` in `vitest.config.ts`.
102
+
103
+ ## Assertions
104
+
105
+ ```ts
106
+ import { expect } from 'vitest';
107
+
108
+ expect(2 + 2).toBe(4); // strict equality
109
+ expect({ a: 1 }).toEqual({ a: 1 }); // deep equality
110
+ expect([1, 2, 3]).toContain(2); // array contains
111
+ expect('hello world').toMatch(/world/); // regex match
112
+ expect(value).toBeDefined(); // not undefined
113
+ expect(value).toBeNull(); // strict null
114
+ expect(value).toBeTruthy(); // JS truthy
115
+ expect(0.1 + 0.2).toBeCloseTo(0.3); // float compare
116
+ expect({ a: 1, b: 2, c: 3 }).toMatchObject({ a: 1 }); // partial deep equal
117
+ expect(fn).toHaveBeenCalledWith('expected-arg'); // spy assertion
118
+
119
+ // Snapshots
120
+ expect(result).toMatchInlineSnapshot(`
121
+ {
122
+ "items": [1, 2, 3],
123
+ "status": "ok",
124
+ }
125
+ `);
126
+ ```
127
+
128
+ ### Custom Matchers
129
+
130
+ ```ts
131
+ import { expect } from 'vitest';
132
+
133
+ expect.extend({
134
+ toBeValidEmail(received: string) {
135
+ const pass = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(received);
136
+ return {
137
+ pass,
138
+ message: () => `expected ${received} ${pass ? 'not ' : ''}to be a valid email`,
139
+ };
140
+ },
141
+ });
142
+
143
+ // Extend Vitest's type surface
144
+ declare module 'vitest' {
145
+ interface Assertion<T = unknown> {
146
+ toBeValidEmail(): T;
147
+ }
148
+ }
149
+
150
+ expect('alice@example.com').toBeValidEmail();
151
+ ```
152
+
153
+ ## Error and Rejection Testing
154
+
155
+ ```ts
156
+ import { describe, it, expect } from 'vitest';
157
+
158
+ describe('parseConfig', () => {
159
+ it('throws on invalid input', () => {
160
+ expect(() => parseConfig('}{invalid')).toThrow();
161
+ expect(() => parseConfig('}{invalid')).toThrow(/invalid JSON/);
162
+ expect(() => parseConfig('}{invalid')).toThrow(SyntaxError);
163
+ });
164
+ });
165
+
166
+ describe('fetchUser', () => {
167
+ it('rejects for missing users', async () => {
168
+ await expect(fetchUser('missing')).rejects.toThrow('not found');
169
+ await expect(fetchUser('missing')).rejects.toBeInstanceOf(NotFoundError);
170
+ });
171
+
172
+ it('resolves for valid users', async () => {
173
+ await expect(fetchUser('alice')).resolves.toMatchObject({ name: 'Alice' });
174
+ });
175
+ });
176
+ ```
177
+
178
+ ## Integration Tests
179
+
180
+ ### File Layout
181
+
182
+ ```text
183
+ my-pkg/
184
+ ├── src/
185
+ │ ├── app.ts
186
+ │ └── app.test.ts # unit tests colocated
187
+ ├── tests/ # integration tests
188
+ │ ├── api.test.ts
189
+ │ ├── helpers.ts
190
+ │ └── setup.ts # global setup/teardown
191
+ ├── vitest.config.ts
192
+ ```
193
+
194
+ ### Global Setup and Teardown
195
+
196
+ ```ts
197
+ // tests/setup.ts
198
+ import { afterAll, beforeAll } from 'vitest';
199
+ import { startTestServer, stopTestServer } from './helpers';
200
+
201
+ beforeAll(async () => {
202
+ await startTestServer();
203
+ });
204
+
205
+ afterAll(async () => {
206
+ await stopTestServer();
207
+ });
208
+ ```
209
+
210
+ ```ts
211
+ // vitest.config.ts
212
+ import { defineConfig } from 'vitest/config';
213
+
214
+ export default defineConfig({
215
+ test: {
216
+ setupFiles: ['./tests/setup.ts'],
217
+ include: ['src/**/*.test.ts', 'tests/**/*.test.ts'],
218
+ },
219
+ });
220
+ ```
221
+
222
+ ### Writing an Integration Test
223
+
224
+ ```ts
225
+ // tests/api.test.ts
226
+ import { describe, it, expect, beforeEach } from 'vitest';
227
+ import { App, Config } from '../src/app';
228
+
229
+ describe('full request lifecycle', () => {
230
+ let app: App;
231
+
232
+ beforeEach(() => {
233
+ app = new App(Config.testDefault());
234
+ });
235
+
236
+ it('handles /health', async () => {
237
+ const res = await app.handleRequest('/health');
238
+ expect(res.status).toBe(200);
239
+ expect(await res.text()).toBe('OK');
240
+ });
241
+
242
+ it('returns 404 for unknown paths', async () => {
243
+ const res = await app.handleRequest('/nope');
244
+ expect(res.status).toBe(404);
245
+ });
246
+ });
247
+ ```
248
+
249
+ ## Async Tests and Fake Timers
250
+
251
+ ### Native Async Tests
252
+
253
+ ```ts
254
+ import { describe, it, expect } from 'vitest';
255
+
256
+ describe('async operations', () => {
257
+ it('resolves after fetching', async () => {
258
+ const data = await fetchData('/api');
259
+ expect(data.items).toHaveLength(3);
260
+ });
261
+
262
+ it('races against a timeout', async () => {
263
+ // Abort the loser so slowOp stops running after the timeout wins
264
+ const controller = new AbortController();
265
+ let timeout: ReturnType<typeof setTimeout>;
266
+ try {
267
+ await expect(
268
+ Promise.race([
269
+ slowOp(controller.signal),
270
+ new Promise<never>((_, reject) => {
271
+ timeout = setTimeout(() => {
272
+ reject(new Error('timeout'));
273
+ controller.abort();
274
+ }, 100);
275
+ }),
276
+ ])
277
+ ).rejects.toThrow('timeout');
278
+ } finally {
279
+ clearTimeout(timeout!);
280
+ controller.abort();
281
+ }
282
+ });
283
+ });
284
+ ```
285
+
286
+ ### Fake Timers
287
+
288
+ ```ts
289
+ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
290
+
291
+ describe('debounce', () => {
292
+ beforeEach(() => {
293
+ vi.useFakeTimers();
294
+ });
295
+
296
+ afterEach(() => {
297
+ vi.useRealTimers();
298
+ });
299
+
300
+ it('delays execution by the wait period', () => {
301
+ const cb = vi.fn();
302
+ const debounced = debounce(cb, 1000);
303
+
304
+ debounced();
305
+ expect(cb).not.toHaveBeenCalled();
306
+
307
+ vi.advanceTimersByTime(1000);
308
+ expect(cb).toHaveBeenCalledTimes(1);
309
+ });
310
+
311
+ it('advances all pending timers', async () => {
312
+ const spy = vi.fn();
313
+ setTimeout(spy, 5000);
314
+ await vi.runAllTimersAsync();
315
+ expect(spy).toHaveBeenCalled();
316
+ });
317
+ });
318
+ ```