orbital-command 0.1.4 → 0.3.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 (380) hide show
  1. package/bin/orbital.js +676 -53
  2. package/dist/assets/PrimitivesConfig-CrmQXYh4.js +32 -0
  3. package/dist/assets/QualityGates-BbasOsF3.js +21 -0
  4. package/dist/assets/SessionTimeline-CGeJsVvy.js +1 -0
  5. package/dist/assets/Settings-oiM496mc.js +12 -0
  6. package/dist/assets/SourceControl-B1fP2nJL.js +41 -0
  7. package/dist/assets/WorkflowVisualizer-CWLYf-f0.js +74 -0
  8. package/dist/assets/arrow-down-CPy85_J6.js +6 -0
  9. package/dist/assets/charts-DbDg0Psc.js +68 -0
  10. package/dist/assets/circle-x-Cwz6ZQDV.js +6 -0
  11. package/dist/assets/file-text-C46Xr65c.js +6 -0
  12. package/dist/assets/formatDistanceToNow-BMqsSP44.js +1 -0
  13. package/dist/assets/globe-Cn2yNZUD.js +6 -0
  14. package/dist/assets/index-Aj4sV8Al.css +1 -0
  15. package/dist/assets/index-Bc9dK3MW.js +354 -0
  16. package/dist/assets/key-OPaNTWJ5.js +6 -0
  17. package/dist/assets/minus-GMsbpKym.js +6 -0
  18. package/dist/assets/shield-DwAFkDYI.js +6 -0
  19. package/dist/assets/ui-BmsSg9jU.js +53 -0
  20. package/dist/assets/useWorkflowEditor-BJkTX_NR.js +16 -0
  21. package/dist/assets/{vendor-Dzv9lrRc.js → vendor-Bqt8AJn2.js} +1 -1
  22. package/dist/assets/zap-DfbUoOty.js +11 -0
  23. package/dist/favicon.svg +1 -0
  24. package/dist/index.html +6 -5
  25. package/dist/server/server/__tests__/data-routes.test.js +124 -0
  26. package/dist/server/server/__tests__/helpers/db.js +17 -0
  27. package/dist/server/server/__tests__/helpers/mock-emitter.js +8 -0
  28. package/dist/server/server/__tests__/scope-routes.test.js +137 -0
  29. package/dist/server/server/__tests__/sprint-routes.test.js +102 -0
  30. package/dist/server/server/__tests__/workflow-routes.test.js +107 -0
  31. package/dist/server/server/config-migrator.js +138 -0
  32. package/dist/server/server/config.js +17 -2
  33. package/dist/server/server/database.js +27 -12
  34. package/dist/server/server/global-config.js +143 -0
  35. package/dist/server/server/index.js +882 -252
  36. package/dist/server/server/init.js +579 -194
  37. package/dist/server/server/launch.js +29 -0
  38. package/dist/server/server/manifest-types.js +8 -0
  39. package/dist/server/server/manifest.js +454 -0
  40. package/dist/server/server/migrate-legacy.js +229 -0
  41. package/dist/server/server/parsers/event-parser.test.js +117 -0
  42. package/dist/server/server/parsers/scope-parser.js +74 -28
  43. package/dist/server/server/parsers/scope-parser.test.js +230 -0
  44. package/dist/server/server/project-context.js +255 -0
  45. package/dist/server/server/project-emitter.js +41 -0
  46. package/dist/server/server/project-manager.js +297 -0
  47. package/dist/server/server/routes/config-routes.js +1 -3
  48. package/dist/server/server/routes/data-routes.js +22 -110
  49. package/dist/server/server/routes/dispatch-routes.js +15 -9
  50. package/dist/server/server/routes/git-routes.js +74 -0
  51. package/dist/server/server/routes/manifest-routes.js +319 -0
  52. package/dist/server/server/routes/scope-routes.js +37 -23
  53. package/dist/server/server/routes/sync-routes.js +134 -0
  54. package/dist/server/server/routes/version-routes.js +1 -15
  55. package/dist/server/server/routes/workflow-routes.js +9 -3
  56. package/dist/server/server/schema.js +2 -0
  57. package/dist/server/server/services/batch-orchestrator.js +26 -16
  58. package/dist/server/server/services/claude-session-service.js +17 -14
  59. package/dist/server/server/services/deploy-service.test.js +119 -0
  60. package/dist/server/server/services/event-service.js +64 -1
  61. package/dist/server/server/services/event-service.test.js +191 -0
  62. package/dist/server/server/services/gate-service.test.js +105 -0
  63. package/dist/server/server/services/git-service.js +108 -4
  64. package/dist/server/server/services/github-service.js +110 -2
  65. package/dist/server/server/services/readiness-service.test.js +190 -0
  66. package/dist/server/server/services/scope-cache.js +5 -1
  67. package/dist/server/server/services/scope-cache.test.js +142 -0
  68. package/dist/server/server/services/scope-service.js +217 -126
  69. package/dist/server/server/services/scope-service.test.js +137 -0
  70. package/dist/server/server/services/sprint-orchestrator.js +7 -6
  71. package/dist/server/server/services/sprint-service.js +21 -1
  72. package/dist/server/server/services/sprint-service.test.js +238 -0
  73. package/dist/server/server/services/sync-service.js +434 -0
  74. package/dist/server/server/services/sync-types.js +2 -0
  75. package/dist/server/server/services/telemetry-service.js +143 -0
  76. package/dist/server/server/services/workflow-service.js +26 -5
  77. package/dist/server/server/services/workflow-service.test.js +159 -0
  78. package/dist/server/server/settings-sync.js +284 -0
  79. package/dist/server/server/update-planner.js +279 -0
  80. package/dist/server/server/utils/cc-hooks-parser.js +3 -0
  81. package/dist/server/server/utils/cc-hooks-parser.test.js +86 -0
  82. package/dist/server/server/utils/dispatch-utils.js +77 -20
  83. package/dist/server/server/utils/dispatch-utils.test.js +182 -0
  84. package/dist/server/server/utils/logger.js +37 -3
  85. package/dist/server/server/utils/package-info.js +30 -0
  86. package/dist/server/server/utils/route-helpers.js +10 -0
  87. package/dist/server/server/utils/terminal-launcher.js +79 -25
  88. package/dist/server/server/utils/worktree-manager.js +13 -4
  89. package/dist/server/server/validator.js +230 -0
  90. package/dist/server/server/watchers/global-watcher.js +63 -0
  91. package/dist/server/server/watchers/scope-watcher.js +27 -12
  92. package/dist/server/server/wizard/config-editor.js +237 -0
  93. package/dist/server/server/wizard/detect.js +96 -0
  94. package/dist/server/server/wizard/doctor.js +115 -0
  95. package/dist/server/server/wizard/index.js +155 -0
  96. package/dist/server/server/wizard/phases/confirm.js +39 -0
  97. package/dist/server/server/wizard/phases/project-setup.js +90 -0
  98. package/dist/server/server/wizard/phases/setup-wizard.js +66 -0
  99. package/dist/server/server/wizard/phases/welcome.js +35 -0
  100. package/dist/server/server/wizard/phases/workflow-setup.js +22 -0
  101. package/dist/server/server/wizard/types.js +29 -0
  102. package/dist/server/server/wizard/ui.js +74 -0
  103. package/dist/server/shared/__fixtures__/workflow-configs.js +75 -0
  104. package/dist/server/shared/default-workflow.json +65 -0
  105. package/dist/server/shared/onboarding-tour.test.js +81 -0
  106. package/dist/server/shared/project-colors.js +24 -0
  107. package/dist/server/shared/workflow-config.test.js +84 -0
  108. package/dist/server/shared/workflow-engine.test.js +302 -0
  109. package/dist/server/shared/workflow-normalizer.js +101 -0
  110. package/dist/server/shared/workflow-normalizer.test.js +100 -0
  111. package/dist/server/src/components/onboarding/tour-steps.js +84 -0
  112. package/package.json +20 -15
  113. package/schemas/orbital.config.schema.json +16 -1
  114. package/scripts/postinstall.js +55 -7
  115. package/server/__tests__/data-routes.test.ts +149 -0
  116. package/server/__tests__/helpers/db.ts +19 -0
  117. package/server/__tests__/helpers/mock-emitter.ts +10 -0
  118. package/server/__tests__/scope-routes.test.ts +157 -0
  119. package/server/__tests__/sprint-routes.test.ts +118 -0
  120. package/server/__tests__/workflow-routes.test.ts +120 -0
  121. package/server/config-migrator.ts +163 -0
  122. package/server/config.ts +26 -2
  123. package/server/database.ts +35 -18
  124. package/server/global-config.ts +200 -0
  125. package/server/index.ts +975 -287
  126. package/server/init.ts +625 -182
  127. package/server/launch.ts +32 -0
  128. package/server/manifest-types.ts +145 -0
  129. package/server/manifest.ts +494 -0
  130. package/server/migrate-legacy.ts +290 -0
  131. package/server/parsers/event-parser.test.ts +135 -0
  132. package/server/parsers/scope-parser.test.ts +270 -0
  133. package/server/parsers/scope-parser.ts +79 -31
  134. package/server/project-context.ts +309 -0
  135. package/server/project-emitter.ts +50 -0
  136. package/server/project-manager.ts +369 -0
  137. package/server/routes/config-routes.ts +3 -5
  138. package/server/routes/data-routes.ts +28 -141
  139. package/server/routes/dispatch-routes.ts +19 -11
  140. package/server/routes/git-routes.ts +77 -0
  141. package/server/routes/manifest-routes.ts +388 -0
  142. package/server/routes/scope-routes.ts +29 -25
  143. package/server/routes/sync-routes.ts +175 -0
  144. package/server/routes/version-routes.ts +1 -16
  145. package/server/routes/workflow-routes.ts +9 -3
  146. package/server/schema.ts +2 -0
  147. package/server/services/batch-orchestrator.ts +24 -16
  148. package/server/services/claude-session-service.ts +16 -14
  149. package/server/services/deploy-service.test.ts +145 -0
  150. package/server/services/deploy-service.ts +2 -2
  151. package/server/services/event-service.test.ts +242 -0
  152. package/server/services/event-service.ts +92 -3
  153. package/server/services/gate-service.test.ts +131 -0
  154. package/server/services/gate-service.ts +2 -2
  155. package/server/services/git-service.ts +137 -4
  156. package/server/services/github-service.ts +120 -2
  157. package/server/services/readiness-service.test.ts +217 -0
  158. package/server/services/scope-cache.test.ts +167 -0
  159. package/server/services/scope-cache.ts +4 -1
  160. package/server/services/scope-service.test.ts +169 -0
  161. package/server/services/scope-service.ts +220 -126
  162. package/server/services/sprint-orchestrator.ts +7 -7
  163. package/server/services/sprint-service.test.ts +271 -0
  164. package/server/services/sprint-service.ts +27 -3
  165. package/server/services/sync-service.ts +482 -0
  166. package/server/services/sync-types.ts +77 -0
  167. package/server/services/telemetry-service.ts +195 -0
  168. package/server/services/workflow-service.test.ts +190 -0
  169. package/server/services/workflow-service.ts +29 -9
  170. package/server/settings-sync.ts +359 -0
  171. package/server/update-planner.ts +346 -0
  172. package/server/utils/cc-hooks-parser.test.ts +96 -0
  173. package/server/utils/cc-hooks-parser.ts +4 -0
  174. package/server/utils/dispatch-utils.test.ts +245 -0
  175. package/server/utils/dispatch-utils.ts +97 -27
  176. package/server/utils/logger.ts +40 -3
  177. package/server/utils/package-info.ts +32 -0
  178. package/server/utils/route-helpers.ts +12 -0
  179. package/server/utils/terminal-launcher.ts +85 -25
  180. package/server/utils/worktree-manager.ts +9 -4
  181. package/server/validator.ts +270 -0
  182. package/server/watchers/global-watcher.ts +77 -0
  183. package/server/watchers/scope-watcher.ts +21 -9
  184. package/server/wizard/config-editor.ts +248 -0
  185. package/server/wizard/detect.ts +104 -0
  186. package/server/wizard/doctor.ts +114 -0
  187. package/server/wizard/index.ts +187 -0
  188. package/server/wizard/phases/confirm.ts +45 -0
  189. package/server/wizard/phases/project-setup.ts +106 -0
  190. package/server/wizard/phases/setup-wizard.ts +78 -0
  191. package/server/wizard/phases/welcome.ts +43 -0
  192. package/server/wizard/phases/workflow-setup.ts +28 -0
  193. package/server/wizard/types.ts +56 -0
  194. package/server/wizard/ui.ts +93 -0
  195. package/shared/__fixtures__/workflow-configs.ts +80 -0
  196. package/shared/default-workflow.json +65 -0
  197. package/shared/onboarding-tour.test.ts +94 -0
  198. package/shared/project-colors.ts +24 -0
  199. package/shared/workflow-config.test.ts +111 -0
  200. package/shared/workflow-config.ts +7 -0
  201. package/shared/workflow-engine.test.ts +388 -0
  202. package/shared/workflow-normalizer.test.ts +119 -0
  203. package/shared/workflow-normalizer.ts +118 -0
  204. package/templates/hooks/end-session.sh +3 -1
  205. package/templates/hooks/orbital-emit.sh +2 -2
  206. package/templates/hooks/orbital-report-deploy.sh +4 -4
  207. package/templates/hooks/orbital-report-gates.sh +4 -4
  208. package/templates/hooks/orbital-scope-update.sh +1 -1
  209. package/templates/hooks/scope-create-cleanup.sh +2 -2
  210. package/templates/hooks/scope-create-gate.sh +0 -1
  211. package/templates/hooks/scope-helpers.sh +18 -0
  212. package/templates/hooks/scope-prepare.sh +66 -11
  213. package/templates/migrations/renames.json +1 -0
  214. package/templates/orbital.config.json +7 -2
  215. package/templates/settings-hooks.json +1 -1
  216. package/templates/skills/git-commit/SKILL.md +9 -4
  217. package/templates/skills/git-dev/SKILL.md +8 -3
  218. package/templates/skills/git-main/SKILL.md +8 -2
  219. package/templates/skills/git-production/SKILL.md +6 -2
  220. package/templates/skills/git-staging/SKILL.md +8 -3
  221. package/templates/skills/scope-create/SKILL.md +17 -3
  222. package/templates/skills/scope-fix-review/SKILL.md +6 -3
  223. package/templates/skills/scope-implement/SKILL.md +4 -1
  224. package/templates/skills/scope-post-review/SKILL.md +63 -5
  225. package/templates/skills/scope-pre-review/SKILL.md +5 -2
  226. package/templates/skills/scope-verify/SKILL.md +5 -3
  227. package/templates/skills/test-code-review/SKILL.md +41 -33
  228. package/templates/skills/test-scaffold/SKILL.md +222 -0
  229. package/dist/assets/WorkflowVisualizer-BZ21PIIF.js +0 -84
  230. package/dist/assets/charts-D__PA1zp.js +0 -72
  231. package/dist/assets/index-D1G6i0nS.css +0 -1
  232. package/dist/assets/index-DpItvKpf.js +0 -419
  233. package/dist/assets/ui-BvF022GT.js +0 -53
  234. package/index.html +0 -15
  235. package/postcss.config.js +0 -6
  236. package/src/App.tsx +0 -33
  237. package/src/components/AgentBadge.tsx +0 -40
  238. package/src/components/BatchPreflightModal.tsx +0 -115
  239. package/src/components/CardDisplayToggle.tsx +0 -74
  240. package/src/components/ColumnHeaderActions.tsx +0 -55
  241. package/src/components/ColumnMenu.tsx +0 -99
  242. package/src/components/DeployHistory.tsx +0 -141
  243. package/src/components/DispatchModal.tsx +0 -164
  244. package/src/components/DispatchPopover.tsx +0 -139
  245. package/src/components/DragOverlay.tsx +0 -25
  246. package/src/components/DriftSidebar.tsx +0 -140
  247. package/src/components/EnvironmentStrip.tsx +0 -88
  248. package/src/components/ErrorBoundary.tsx +0 -62
  249. package/src/components/FilterChip.tsx +0 -105
  250. package/src/components/GateIndicator.tsx +0 -33
  251. package/src/components/IdeaDetailModal.tsx +0 -190
  252. package/src/components/IdeaFormDialog.tsx +0 -113
  253. package/src/components/KanbanColumn.tsx +0 -201
  254. package/src/components/MarkdownRenderer.tsx +0 -114
  255. package/src/components/NeonGrid.tsx +0 -128
  256. package/src/components/PromotionQueue.tsx +0 -89
  257. package/src/components/ScopeCard.tsx +0 -234
  258. package/src/components/ScopeDetailModal.tsx +0 -255
  259. package/src/components/ScopeFilterBar.tsx +0 -152
  260. package/src/components/SearchInput.tsx +0 -102
  261. package/src/components/SessionPanel.tsx +0 -335
  262. package/src/components/SprintContainer.tsx +0 -303
  263. package/src/components/SprintDependencyDialog.tsx +0 -78
  264. package/src/components/SprintPreflightModal.tsx +0 -138
  265. package/src/components/StatusBar.tsx +0 -168
  266. package/src/components/SwimCell.tsx +0 -67
  267. package/src/components/SwimLaneRow.tsx +0 -94
  268. package/src/components/SwimlaneBoardView.tsx +0 -108
  269. package/src/components/VersionBadge.tsx +0 -139
  270. package/src/components/ViewModeSelector.tsx +0 -114
  271. package/src/components/config/AgentChip.tsx +0 -53
  272. package/src/components/config/AgentCreateDialog.tsx +0 -321
  273. package/src/components/config/AgentEditor.tsx +0 -175
  274. package/src/components/config/DirectoryTree.tsx +0 -582
  275. package/src/components/config/FileEditor.tsx +0 -550
  276. package/src/components/config/HookChip.tsx +0 -50
  277. package/src/components/config/StageCard.tsx +0 -198
  278. package/src/components/config/TransitionZone.tsx +0 -173
  279. package/src/components/config/UnifiedWorkflowPipeline.tsx +0 -216
  280. package/src/components/config/WorkflowPipeline.tsx +0 -161
  281. package/src/components/source-control/BranchList.tsx +0 -93
  282. package/src/components/source-control/BranchPanel.tsx +0 -105
  283. package/src/components/source-control/CommitLog.tsx +0 -100
  284. package/src/components/source-control/CommitRow.tsx +0 -47
  285. package/src/components/source-control/GitHubPanel.tsx +0 -110
  286. package/src/components/source-control/GitHubSetupGuide.tsx +0 -52
  287. package/src/components/source-control/GitOverviewBar.tsx +0 -101
  288. package/src/components/source-control/PullRequestList.tsx +0 -69
  289. package/src/components/source-control/WorktreeList.tsx +0 -80
  290. package/src/components/ui/badge.tsx +0 -41
  291. package/src/components/ui/button.tsx +0 -55
  292. package/src/components/ui/card.tsx +0 -78
  293. package/src/components/ui/dialog.tsx +0 -94
  294. package/src/components/ui/popover.tsx +0 -33
  295. package/src/components/ui/scroll-area.tsx +0 -54
  296. package/src/components/ui/separator.tsx +0 -28
  297. package/src/components/ui/tabs.tsx +0 -52
  298. package/src/components/ui/toggle-switch.tsx +0 -35
  299. package/src/components/ui/tooltip.tsx +0 -27
  300. package/src/components/workflow/AddEdgeDialog.tsx +0 -217
  301. package/src/components/workflow/AddListDialog.tsx +0 -201
  302. package/src/components/workflow/ChecklistEditor.tsx +0 -239
  303. package/src/components/workflow/CommandPrefixManager.tsx +0 -118
  304. package/src/components/workflow/ConfigSettingsPanel.tsx +0 -189
  305. package/src/components/workflow/DirectionSelector.tsx +0 -133
  306. package/src/components/workflow/DispatchConfigPanel.tsx +0 -180
  307. package/src/components/workflow/EdgeDetailPanel.tsx +0 -236
  308. package/src/components/workflow/EdgePropertyEditor.tsx +0 -251
  309. package/src/components/workflow/EditToolbar.tsx +0 -138
  310. package/src/components/workflow/HookDetailPanel.tsx +0 -250
  311. package/src/components/workflow/HookExecutionLog.tsx +0 -24
  312. package/src/components/workflow/HookSourceModal.tsx +0 -129
  313. package/src/components/workflow/HooksDashboard.tsx +0 -363
  314. package/src/components/workflow/ListPropertyEditor.tsx +0 -251
  315. package/src/components/workflow/MigrationPreviewDialog.tsx +0 -237
  316. package/src/components/workflow/MovementRulesPanel.tsx +0 -188
  317. package/src/components/workflow/NodeDetailPanel.tsx +0 -245
  318. package/src/components/workflow/PresetSelector.tsx +0 -414
  319. package/src/components/workflow/SkillCommandBuilder.tsx +0 -174
  320. package/src/components/workflow/WorkflowEdgeComponent.tsx +0 -145
  321. package/src/components/workflow/WorkflowNode.tsx +0 -147
  322. package/src/components/workflow/graphLayout.ts +0 -186
  323. package/src/components/workflow/mergeHooks.ts +0 -85
  324. package/src/components/workflow/useEditHistory.ts +0 -88
  325. package/src/components/workflow/useWorkflowEditor.ts +0 -262
  326. package/src/components/workflow/validateConfig.ts +0 -70
  327. package/src/hooks/useActiveDispatches.ts +0 -198
  328. package/src/hooks/useBoardSettings.ts +0 -170
  329. package/src/hooks/useCardDisplay.ts +0 -57
  330. package/src/hooks/useCcHooks.ts +0 -24
  331. package/src/hooks/useConfigTree.ts +0 -51
  332. package/src/hooks/useEnforcementRules.ts +0 -46
  333. package/src/hooks/useEvents.ts +0 -59
  334. package/src/hooks/useFileEditor.ts +0 -165
  335. package/src/hooks/useGates.ts +0 -57
  336. package/src/hooks/useIdeaActions.ts +0 -53
  337. package/src/hooks/useKanbanDnd.ts +0 -410
  338. package/src/hooks/useOrbitalConfig.ts +0 -54
  339. package/src/hooks/usePipeline.ts +0 -47
  340. package/src/hooks/usePipelineData.ts +0 -338
  341. package/src/hooks/useReconnect.ts +0 -25
  342. package/src/hooks/useScopeFilters.ts +0 -125
  343. package/src/hooks/useScopeSessions.ts +0 -44
  344. package/src/hooks/useScopes.ts +0 -67
  345. package/src/hooks/useSearch.ts +0 -67
  346. package/src/hooks/useSettings.tsx +0 -187
  347. package/src/hooks/useSocket.ts +0 -25
  348. package/src/hooks/useSourceControl.ts +0 -105
  349. package/src/hooks/useSprintPreflight.ts +0 -55
  350. package/src/hooks/useSprints.ts +0 -154
  351. package/src/hooks/useStatusBarHighlight.ts +0 -18
  352. package/src/hooks/useSwimlaneBoardSettings.ts +0 -104
  353. package/src/hooks/useTheme.ts +0 -9
  354. package/src/hooks/useTransitionReadiness.ts +0 -53
  355. package/src/hooks/useVersion.ts +0 -155
  356. package/src/hooks/useViolations.ts +0 -65
  357. package/src/hooks/useWorkflow.tsx +0 -125
  358. package/src/hooks/useZoomModifier.ts +0 -19
  359. package/src/index.css +0 -797
  360. package/src/layouts/DashboardLayout.tsx +0 -113
  361. package/src/lib/collisionDetection.ts +0 -20
  362. package/src/lib/scope-fields.ts +0 -61
  363. package/src/lib/swimlane.ts +0 -146
  364. package/src/lib/utils.ts +0 -15
  365. package/src/main.tsx +0 -19
  366. package/src/socket.ts +0 -11
  367. package/src/types/index.ts +0 -497
  368. package/src/views/AgentFeed.tsx +0 -339
  369. package/src/views/DeployPipeline.tsx +0 -59
  370. package/src/views/EnforcementView.tsx +0 -378
  371. package/src/views/PrimitivesConfig.tsx +0 -500
  372. package/src/views/QualityGates.tsx +0 -1012
  373. package/src/views/ScopeBoard.tsx +0 -454
  374. package/src/views/SessionTimeline.tsx +0 -516
  375. package/src/views/Settings.tsx +0 -183
  376. package/src/views/SourceControl.tsx +0 -95
  377. package/src/views/WorkflowVisualizer.tsx +0 -382
  378. package/tailwind.config.js +0 -161
  379. package/tsconfig.json +0 -25
  380. package/vite.config.ts +0 -49
@@ -63,10 +63,16 @@ For each completed scope being pushed:
63
63
  bash .claude/hooks/scope-transition.sh --from completed --to main --scope NNN
64
64
  ```
65
65
 
66
- ### Step 5: Signal Completion
66
+ ### Step 5: Signal Completion (REQUIRED)
67
+
68
+ **Always emit after a successful push/PR** — this is not optional:
67
69
 
68
70
  ```bash
69
- bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_main"}' --scope "NNN"
71
+ # With a scope:
72
+ bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_main"}' --scope "{NNN}"
73
+
74
+ # Without a scope:
75
+ bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_main"}'
70
76
  ```
71
77
 
72
78
  ## Batch Support
@@ -96,12 +96,16 @@ gh pr merge --merge
96
96
  # Your CI/CD pipeline auto-deploys main to production (if configured)
97
97
  ```
98
98
 
99
- ### Step 6: Signal Completion
99
+ ### Step 6: Signal Completion (REQUIRED)
100
100
 
101
- After the merge succeeds, emit the agent completion event if working on a dispatched scope:
101
+ **Always emit after a successful merge** this is not optional:
102
102
 
103
103
  ```bash
104
+ # With a scope:
104
105
  bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_production"}' --scope "{NNN}"
106
+
107
+ # Without a scope:
108
+ bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_production"}'
105
109
  ```
106
110
 
107
111
  ### Step 7: Verify Production
@@ -20,8 +20,7 @@ Creates a GitHub PR from dev to staging. Staging is a release candidate — the
20
20
 
21
21
  Find scopes in `scopes/dev/`:
22
22
  1. For each scope file in `scopes/dev/*.md`:
23
- - `mv scopes/dev/{file} scopes/staging/`
24
- - Update frontmatter: `status: staging`
23
+ - Transition: `bash .claude/hooks/scope-transition.sh --from dev --to staging --scope {NNN}`
25
24
  - Update DASHBOARD: `🚀 **Status**: Staging PR Created`
26
25
 
27
26
  If BATCH_SCOPE_IDS is set, only transition those specific scopes.
@@ -59,10 +58,16 @@ gh pr create --base staging --head dev \
59
58
  - [ ] Files under 400 lines"
60
59
  ```
61
60
 
62
- ### Step 4: Signal Completion
61
+ ### Step 4: Signal Completion (REQUIRED)
62
+
63
+ **Always emit after a successful PR creation** — this is not optional:
63
64
 
64
65
  ```bash
66
+ # With a scope:
65
67
  bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_staging"}' --scope "{NNN}"
68
+
69
+ # Without a scope:
70
+ bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_staging"}'
66
71
  ```
67
72
 
68
73
  ### Step 5: Monitor CI
@@ -46,10 +46,24 @@ Then run:
46
46
  bash .claude/hooks/scope-prepare.sh --new --title "Feature Name" --desc "Description" --category "Backend"
47
47
  ```
48
48
 
49
- The script outputs JSON: `{"id", "path", "title", "description", "session_id", "category", "mode"}`.
49
+ The script outputs JSON: `{"id", "path", "title", "description", "session_id", "category", "effort", "mode", "available_categories", "effort_buckets"}`.
50
50
  The scope file is fully scaffolded with template, frontmatter, dashboard, and process log.
51
51
 
52
- ### Step 2: Fill Specification
52
+ ### Step 2: Categorize and Estimate
53
+
54
+ Read the JSON output from Step 1. Using the title, description, and any preserved idea body
55
+ in the scope file, update the frontmatter:
56
+
57
+ 1. **Category**: Select the best match from `available_categories` in the JSON output.
58
+ Match semantically — "feature" for new capabilities, "bugfix" for fixes, "refactor" for
59
+ restructuring, "infrastructure" for tooling/CI/config, "docs" for documentation.
60
+ If the category is still "TBD", update it in the scope file's frontmatter.
61
+
62
+ 2. **Effort**: Estimate using the bucket system from `effort_buckets` in the JSON output
63
+ (typically: `<1H`, `1-4H`, or `4H+`). Consider the scope of changes implied by the
64
+ title and description. If effort is still "TBD", update it in the scope file's frontmatter.
65
+
66
+ ### Step 3: Fill Specification
53
67
 
54
68
  Edit the scope file to replace the placeholder in **SPECIFICATION > Overview** with the
55
69
  actual problem statement and goal. If coming from a plan, also populate:
@@ -57,7 +71,7 @@ actual problem statement and goal. If coming from a plan, also populate:
57
71
  - **Technical Approach** and rationale
58
72
  - **Implementation Phases** with files, changes, and verification steps
59
73
 
60
- ### Step 3: Report
74
+ ### Step 4: Report
61
75
 
62
76
  ```
63
77
  Created: scopes/planning/NNN-feature-name.md
@@ -12,8 +12,8 @@ Takes ALL findings from the Phase 3 code review (`/test-code-review`) and execut
12
12
 
13
13
  ## Prerequisites
14
14
 
15
- - Phase 3 (`/test-code-review`) must have been run in the current post-review pipeline
16
- - Code review findings must exist in the conversation context
15
+ - Phase 3 (`/test-code-review`) must have been run — either in the current pipeline or in a prior session
16
+ - Code review findings must be available (conversation context OR `.claude/review-findings/NNN.json` on disk)
17
17
  - `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` must be enabled (a hook will block this skill otherwise)
18
18
 
19
19
  ## Steps
@@ -42,7 +42,10 @@ Takes ALL findings from the Phase 3 code review (`/test-code-review`) and execut
42
42
 
43
43
  ### Step 2: Collect and Organize Findings
44
44
 
45
- 1. Gather ALL findings from the Phase 3 code review (from conversation context)
45
+ 1. **Load findings** check both sources in order:
46
+ - **Disk first:** Read `.claude/review-findings/NNN.json` (where NNN is the scope ID). This file is written by `/test-code-review` Phase 4 and enables standalone `/scope-fix-review` without re-running Phase 3.
47
+ - **Conversation fallback:** If the file doesn't exist, gather findings from the Phase 3 code review conversation context.
48
+ - If neither source has findings, report "No findings to fix" and **EXIT**.
46
49
  2. Deduplicate findings across the 6 review agents
47
50
  3. Group findings by **file ownership domain**:
48
51
 
@@ -26,7 +26,10 @@ user-invocable: true
26
26
 
27
27
  ### 2. Implement
28
28
 
29
- **Before starting Phase 1**: Update scope frontmatter to `status: implementing` and DASHBOARD to `🔄 **Status**: Implementing`. Move file: `mv scopes/backlog/{file} scopes/implementing/`.
29
+ **Before starting Phase 1**: Transition the scope and update the DASHBOARD to `🔄 **Status**: Implementing`:
30
+ ```bash
31
+ bash .claude/hooks/scope-transition.sh --from backlog --to implementing --scope {NNN}
32
+ ```
30
33
 
31
34
  For each phase:
32
35
 
@@ -2,7 +2,7 @@
2
2
  name: scope-post-review
3
3
  description: Orchestrates post-implementation review — runs quality gates, formal verification, code review, and optional agent-team fix execution. Use when a scope is ready to move from implementing to review.
4
4
  user-invocable: true
5
- orchestrates: [test-checks, scope-verify, test-code-review, scope-fix-review]
5
+ orchestrates: [test-scaffold, test-checks, scope-verify, test-code-review, scope-fix-review]
6
6
  ---
7
7
 
8
8
  # /scope-post-review NNN — Post-Implementation Review
@@ -16,6 +16,11 @@ Orchestrates the full post-implementation review pipeline for a scope. Runs up t
16
16
  │ /scope-post-review NNN │
17
17
  ├─────────────────────────────────────────────────────────────────┤
18
18
  │ │
19
+ │ Phase 0: Test infrastructure check │
20
+ │ └── If commands.test is null → /test-scaffold │
21
+ │ Analyzes project, installs framework, writes tests. │
22
+ │ SKIPPED if tests already configured. │
23
+ │ │
19
24
  │ Phase 1: /test-checks │
20
25
  │ └── 13 machine-verifiable quality gates │
21
26
  │ Types, lint, build, templates, docs, enforcement, etc. │
@@ -41,10 +46,49 @@ Orchestrates the full post-implementation review pipeline for a scope. Runs up t
41
46
  └─────────────────────────────────────────────────────────────────┘
42
47
  ```
43
48
 
44
- **Rationale**: Quality gates run first to catch obvious issues cheaply. Spec verification runs second to confirm the implementation is actually complete before spending tokens on AI code review. Code review runs third on verified, passing code. Fix execution runs last, using an agent team to address all findings in parallel across non-overlapping file domains.
49
+ **Rationale**: Test infrastructure is checked first so that gate #13 (tests) has something to run. Quality gates run next to catch obvious issues cheaply. Spec verification runs third to confirm the implementation is actually complete before spending tokens on AI code review. Code review runs fourth on verified, passing code. Fix execution runs last, using an agent team to address all findings in parallel across non-overlapping file domains.
45
50
 
46
51
  ## Steps
47
52
 
53
+ ### Phase 0: Test Infrastructure Check
54
+
55
+ Ensure the project has a test suite before running quality gates. This runs in a subagent to keep the main post-review context clean — the scaffolding work (codebase analysis, package installs, writing test files) can be extensive and is not relevant to the review phases that follow.
56
+
57
+ 1. Read `.claude/orbital.config.json`
58
+ 2. Check `commands.test`:
59
+ - **If non-null** → tests are configured. Print:
60
+ ```
61
+ Phase 0: Tests configured (commands.test = "<value>") — skipping.
62
+ ```
63
+ **Skip** to Phase 1.
64
+ - **If null** → no test suite configured. Print:
65
+ ```
66
+ Phase 0: No test suite configured — scaffolding tests via subagent...
67
+ ```
68
+ Launch a subagent to scaffold the test suite:
69
+ ```
70
+ Agent(
71
+ description: "Scaffold test infrastructure",
72
+ prompt: "Run the /test-scaffold skill for this project. The project has no test suite configured (commands.test is null in .claude/orbital.config.json). Follow the skill instructions to: detect the project stack, choose a test framework, install it, write real tests, verify they pass, and update commands.test in .claude/orbital.config.json. Report what you did when finished.",
73
+ mode: "auto"
74
+ )
75
+ ```
76
+ 3. After the subagent completes:
77
+ - Re-read `.claude/orbital.config.json` and confirm `commands.test` is now non-null
78
+ - Run the configured test command to verify tests actually pass:
79
+ ```bash
80
+ <commands.test value> # e.g., npm run test
81
+ ```
82
+ - **If `commands.test` is still null or tests fail:**
83
+ ```
84
+ ╔═══════════════════════════════════════════════════════════════╗
85
+ ║ Phase 0 FAILED — Test scaffolding did not produce passing ║
86
+ ║ tests. Fix manually and re-run: /scope-post-review NNN ║
87
+ ╚═══════════════════════════════════════════════════════════════╝
88
+ ```
89
+ **STOP** — do not proceed to Phase 1 with broken tests.
90
+ - **If tests pass** → continue to Phase 1.
91
+
48
92
  ### Phase 1: Quality Gates (`/test-checks`)
49
93
 
50
94
  Run the 13 quality gates. This is the cheapest and fastest check.
@@ -83,8 +127,12 @@ Run the 6 parallel code review agents on the verified code.
83
127
 
84
128
  1. Invoke: `Skill(skill: "test-code-review")`
85
129
  2. Collect all findings — count BLOCKERS, WARNINGS, and SUGGESTIONS.
86
- 3. If there are **any findings** (blockers, warnings, or suggestions), proceed to Phase 4.
87
- 4. If there are **zero findings**, skip Phase 4 and go to Final Report.
130
+ 3. **Persist findings** write all findings to `.claude/review-findings/NNN.json` so Phase 4 can read them even if run standalone in a separate session:
131
+ ```json
132
+ { "scopeId": NNN, "timestamp": "<ISO>", "blockers": [...], "warnings": [...], "suggestions": [...] }
133
+ ```
134
+ 4. If there are **any findings** (blockers, warnings, or suggestions), proceed to Phase 4.
135
+ 5. If there are **zero findings**, skip Phase 4 and go to Final Report.
88
136
 
89
137
  ### Phase 4: Fix Review Findings (`/scope-fix-review NNN`)
90
138
 
@@ -95,9 +143,14 @@ Execute all Phase 3 findings using a coordinated agent team. **This phase requir
95
143
  echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not set}"
96
144
  ```
97
145
  2. If **enabled** (`1`) and Phase 3 produced findings:
146
+ - If `.claude/review-findings/NNN.json` exists, load findings from there (enables standalone `/scope-fix-review` without re-running Phase 3)
98
147
  - Invoke: `Skill(skill: "scope-fix-review", args: "NNN")`
99
148
  - This spawns an agent team that fixes all findings in parallel across non-overlapping file domains
100
- - Includes a verification step (typecheck + build) at the end
149
+ - After fixes complete, **re-run quality gates** to catch regressions:
150
+ ```
151
+ Skill(skill: "test-checks")
152
+ ```
153
+ If any gate fails, report which gates regressed and **STOP**.
101
154
  3. If **not enabled**:
102
155
  - Read `~/.claude/settings.json`
103
156
  - Merge `"env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" }` into the existing JSON (preserve all other settings)
@@ -120,6 +173,11 @@ Execute all Phase 3 findings using a coordinated agent team. **This phase requir
120
173
 
121
174
  ### Final Report
122
175
 
176
+ Emit the completion event so the dispatch resolves and the dashboard card stops showing the active animation:
177
+ ```bash
178
+ bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"post_review"}' --scope "{NNN}"
179
+ ```
180
+
123
181
  ```
124
182
  ╔═══════════════════════════════════════════════════════════════╗
125
183
  ║ /scope-post-review COMPLETE — Scope NNN ║
@@ -188,8 +188,11 @@ J items are implementation notes (no spec change).
188
188
  ### Step 8: Update Scope Status
189
189
 
190
190
  After applying spec fixes and writing the AGENT REVIEW:
191
- - Update frontmatter: `status: backlog`, `spec_locked: true`
192
- - Move file: `mv scopes/planning/{file} scopes/backlog/`
191
+ - Transition the scope (handles frontmatter + file move atomically):
192
+ ```bash
193
+ bash .claude/hooks/scope-transition.sh --from planning --to backlog --scope {NNN}
194
+ ```
195
+ - Update frontmatter: `spec_locked: true` (scope-transition.sh handles status, this is the extra field)
193
196
  - Update DASHBOARD Quick Status: `🟢 **Status**: Backlog | **Spec Locked**: Yes`
194
197
  - Add to Recent Activity: `Review completed — N blockers, M warnings. X items applied to spec, K clarifications resolved.`
195
198
 
@@ -146,9 +146,11 @@ Overall verdict is PASS only if ALL 4 criteria are PASS.
146
146
  ### Step 6: Scope Transition (on PASS only)
147
147
 
148
148
  If all criteria passed:
149
- 1. Move scope file: `mv scopes/implementing/{file} scopes/review/` (or leave in place if already in `scopes/review/`)
150
- 2. Update frontmatter: `status: review`
151
- 3. Update DASHBOARD: `✅ **Status**: Reviewed | Ready to Commit`
149
+ 1. Transition the scope (handles frontmatter + file move atomically):
150
+ ```bash
151
+ bash .claude/hooks/scope-transition.sh --from implementing --to review --scope {NNN}
152
+ ```
153
+ 2. Update DASHBOARD: `✅ **Status**: Reviewed | Ready to Commit`
152
154
 
153
155
  ### Step 7: Report & Next Steps
154
156
 
@@ -21,9 +21,9 @@ Combines all validation layers into one comprehensive check:
21
21
  │ /test-code-review │
22
22
  ├─────────────────────────────────────────────────────────────────────────┤
23
23
  │ │
24
- │ Phase 1: /test-checks (8 checks)
25
- │ ├── TypeScript, ESLint, Build, Templates
26
- │ └── Doc links, Doc freshness, Enforcement, Workarounds
24
+ │ Phase 1: /test-checks (13 quality gates)
25
+ │ ├── TypeScript, Lint, Build, Templates, Docs, Enforcement
26
+ │ └── Placeholders, Mock data, Shortcuts, Secrets, Stale scopes, Tests
27
27
  │ │
28
28
  │ Phase 2: pre-push (3 checks) │
29
29
  │ ├── Documentation sync │
@@ -50,26 +50,13 @@ Combines all validation layers into one comprehensive check:
50
50
 
51
51
  ### Phase 1: Pre-Commit Checks
52
52
 
53
- Run all 8 quality gates. Read commands from `.claude/orbital.config.json` — skip any that are null:
53
+ Run all 13 quality gates via `/test-checks`:
54
54
 
55
- ```bash
56
- echo "═══ PHASE 1: PRE-COMMIT ═══"
57
- # Run commands.typeCheck from orbital.config.json (skip if null)
58
- echo "[1/8] TypeScript..."
59
- # Run commands.lint from orbital.config.json (skip if null)
60
- echo "[2/8] Lint..."
61
- # Run commands.build from orbital.config.json (skip if null)
62
- echo "[3/8] Build..."
63
- # Run commands.validateTemplates from orbital.config.json (skip if null)
64
- echo "[4/8] Templates..."
65
- # Run commands.validateDocs from orbital.config.json (skip if null)
66
- echo "[5/8] Doc links..."
67
- # Run commands.docFreshness from orbital.config.json (skip if null)
68
- echo "[6/8] Doc freshness..."
69
- # Run commands.checkRules from orbital.config.json (skip if null)
70
- echo "[7/8] Enforcement..."
71
- echo "[8/8] Workarounds..." && echo "✅ Check staged files manually"
72
55
  ```
56
+ Skill(skill: "test-checks")
57
+ ```
58
+
59
+ This runs the full pipeline: typecheck, lint, build, templates, docs, enforcement, placeholders, mock data, shortcuts, secrets, stale scopes, and tests (13 gates total). See `/test-checks` for details.
73
60
 
74
61
  **Stop here if any check fails. Fix before proceeding.**
75
62
 
@@ -120,21 +107,44 @@ Prompt: "Review type design quality"
120
107
 
121
108
  ### Phase 4: Synthesize Results
122
109
 
123
- Collect all findings and report:
110
+ Collect all findings, categorize by severity, and **persist to disk** so `/scope-fix-review` can load them in a standalone session.
111
+
112
+ **4a. Categorize findings** from all 6 agents into BLOCKERS, WARNINGS, and SUGGESTIONS.
113
+
114
+ **4b. Write findings to disk** — if running in a scope context (scope NNN is known from the pipeline), write:
115
+
116
+ ```bash
117
+ mkdir -p .claude/review-findings
118
+ ```
119
+
120
+ Write `.claude/review-findings/NNN.json`:
121
+ ```json
122
+ {
123
+ "scopeId": NNN,
124
+ "timestamp": "<ISO timestamp>",
125
+ "blockers": [{ "agent": "...", "file": "...", "line": N, "message": "...", "fix": "..." }],
126
+ "warnings": [{ "agent": "...", "file": "...", "line": N, "message": "...", "fix": "..." }],
127
+ "suggestions": [{ "agent": "...", "file": "...", "line": N, "message": "...", "fix": "..." }]
128
+ }
129
+ ```
130
+
131
+ If no scope context is available (standalone `/test-code-review` outside post-review), skip the file write — findings remain in conversation context only.
132
+
133
+ **4c. Display summary:**
124
134
 
125
135
  ```
126
136
  ╔═══════════════════════════════════════════════════════════════════════╗
127
- /test-code-review RESULTS
137
+ /test-code-review RESULTS
128
138
  ╠═══════════════════════════════════════════════════════════════════════╣
129
139
  ║ ║
130
- ║ PHASE 1: Pre-Commit [8/8 passed]
131
- ║ PHASE 2: Pre-Push [3/3 passed]
140
+ ║ PHASE 1: Pre-Commit [13/13 passed]
141
+ ║ PHASE 2: Pre-Push [3/3 passed]
132
142
  ║ PHASE 3: Code Review [findings below] ║
133
143
  ║ ║
134
144
  ║ ───────────────────────────────────────────────────────────────── ║
135
- 🚫 BLOCKERS (must fix): 0
136
- ⚠️ WARNINGS (should fix): 2
137
- 💡 SUGGESTIONS (consider): 5
145
+ ║ BLOCKERS (must fix): 0
146
+ ║ WARNINGS (should fix): 2
147
+ ║ SUGGESTIONS (consider): 5
138
148
  ║ ║
139
149
  ╚═══════════════════════════════════════════════════════════════════════╝
140
150
  ```
@@ -199,13 +209,11 @@ If matching scope files are found and all tests passed:
199
209
  #### Step 4: Move Completed Scopes (If User Confirms)
200
210
 
201
211
  ```bash
202
- # Only after user confirmation (scopes are gitignored, use plain mv)
203
- mv scopes/XXX-scope-name.md scopes/completed/
204
- echo "✅ Moved scope XXX to completed folder"
212
+ # Only after user confirmation uses atomic transition (frontmatter + move)
213
+ bash .claude/hooks/scope-transition.sh --from review --to completed --scope XXX
214
+ echo "✅ Moved scope XXX to completed"
205
215
  ```
206
216
 
207
- **Note:** Scopes are gitignored — use plain `mv`, not `git mv`.
208
-
209
217
  ## Modes
210
218
 
211
219
  | Command | What Runs |
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: test-scaffold
3
+ description: Analyzes any project, scaffolds test infrastructure, writes real unit and integration tests, and configures orbital.config.json. Use when a project has no test suite or when commands.test is null.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # /test-scaffold - Scaffold Test Infrastructure & Write Tests
8
+
9
+ ---
10
+ tokens: ~1200
11
+ trigger: /test-scaffold
12
+ purpose: Detect, install, configure, and write a complete test suite for any project
13
+ ---
14
+
15
+ ## What This Does
16
+
17
+ Analyzes the current project, picks the right test framework, installs it, writes real unit and integration tests for the most testable code, and configures `orbital.config.json` so the test gate runs automatically in future quality checks.
18
+
19
+ ## Steps
20
+
21
+ ### Step 1: Detect Existing Test Infrastructure
22
+
23
+ Check if the project already has tests.
24
+
25
+ 1. Read `.claude/orbital.config.json` — check if `commands.test` is non-null
26
+ 2. Check `package.json` (or equivalent) for a `test` script
27
+ 3. Search for existing test files: `*.test.*`, `*.spec.*`, `__tests__/` directories
28
+ 4. Search for test config files: `vitest.config.*`, `jest.config.*`, `pytest.ini`, `pyproject.toml [tool.pytest]`, `*_test.go`
29
+
30
+ If tests exist AND `commands.test` is non-null, **verify they actually pass** by running the test command:
31
+
32
+ ```bash
33
+ <commands.test value> # e.g., npm run test
34
+ ```
35
+
36
+ - **If tests pass** → print "Tests already configured and passing" and **EXIT**.
37
+ - **If tests fail** → print "Tests exist but are failing — proceeding to diagnose and fix." Continue to Step 2, but focus on fixing the existing tests rather than scaffolding from scratch.
38
+
39
+ If no test infrastructure exists at all, continue to Step 2.
40
+
41
+ ### Step 2: Analyze the Project
42
+
43
+ Read the project's configuration and source code to determine the stack:
44
+
45
+ **2a. Identify language and runtime:**
46
+ - Read `package.json` → Node.js/TypeScript project
47
+ - Read `pyproject.toml` or `setup.py` or `requirements.txt` → Python project
48
+ - Read `go.mod` → Go project
49
+ - Read `Cargo.toml` → Rust project
50
+ - Read `pom.xml` or `build.gradle` → Java/Kotlin project
51
+
52
+ **2b. Identify build tooling (for framework selection):**
53
+ - Check for `vite.config.*` → Vite-based (use Vitest)
54
+ - Check for `webpack.config.*` → Webpack-based
55
+ - Check for `tsconfig.json` → TypeScript project
56
+ - Check for `next.config.*` → Next.js
57
+
58
+ **2c. Identify code structure:**
59
+ - List top-level directories (e.g., `src/`, `server/`, `shared/`, `lib/`, `app/`)
60
+ - Note path aliases (from tsconfig `paths`, webpack aliases, etc.)
61
+ - **Monorepo detection:** Check for `pnpm-workspace.yaml`, `lerna.json`, `rush.json`, or `workspaces` field in `package.json`. If detected, scope test scaffolding to the current package (the directory containing the nearest `package.json`), not the workspace root.
62
+
63
+ **2d. Find the most testable code — prioritize in this order:**
64
+
65
+ 1. **Pure functions and classes** — no I/O, no side effects. Look for:
66
+ - Utility modules, parsers, validators, transformers
67
+ - Engine/logic classes that take config and return computed results
68
+ - Type guard functions, normalizers, formatters
69
+
70
+ 2. **Services with injectable dependencies** — constructor takes DB, event emitter, or other services:
71
+ - Database services (CRUD operations)
72
+ - Business logic services
73
+ - Cache/store classes
74
+
75
+ 3. **API routes** — if the project uses Express, Fastify, Flask, etc.:
76
+ - Route handlers with dependency injection
77
+ - REST endpoints that can be tested with HTTP assertions
78
+
79
+ For each candidate, note: file path, exported functions/classes, whether it has side effects, and what test data it would need.
80
+
81
+ ### Step 3: Choose Test Framework
82
+
83
+ Based on the analysis in Step 2, select the appropriate test framework:
84
+
85
+ | Project Type | Framework | HTTP Testing | Why |
86
+ |---|---|---|---|
87
+ | Vite / React / Vue | **Vitest** | supertest | Shares Vite transform pipeline, native ESM |
88
+ | Node.js (no Vite) | **Vitest** | supertest | Fast, modern, good ESM support |
89
+ | Next.js | **Vitest** or **Jest** | supertest | Check if Jest is already a dependency |
90
+ | Python | **pytest** | pytest + httpx/requests | De facto standard |
91
+ | Go | **built-in testing** | net/http/httptest | No external framework needed |
92
+ | Rust | **built-in #[test]** | actix-test / axum::test | No external framework needed |
93
+
94
+ **Do not install a framework the project already has** — check existing dependencies first.
95
+
96
+ ### Step 4: Install and Configure
97
+
98
+ **4a. Install the framework and test utilities:**
99
+
100
+ For Node.js projects:
101
+ ```bash
102
+ npm install -D vitest # (or chosen framework)
103
+ # Add HTTP testing if the project has API routes:
104
+ npm install -D supertest @types/supertest
105
+ ```
106
+
107
+ For Python projects:
108
+ ```bash
109
+ pip install pytest # or add to dev dependencies
110
+ ```
111
+
112
+ **4b. Create the test configuration file:**
113
+
114
+ For Vitest — create `vitest.config.ts` (separate from `vite.config.ts`):
115
+ - Configure `test.environment: 'node'` for server/pure logic tests
116
+ - Configure path aliases to match the project's tsconfig
117
+ - If the project has both pure logic and I/O-dependent code, configure two projects:
118
+ - `unit` — pure logic tests (fast, no setup)
119
+ - `integration` — tests requiring DB, filesystem, or network (may need setup/teardown)
120
+
121
+ **4c. Add test scripts** to `package.json` (or equivalent):
122
+
123
+ ```json
124
+ "test": "<framework> run",
125
+ "test:unit": "<framework> run --project unit",
126
+ "test:integration": "<framework> run --project integration",
127
+ "test:watch": "<framework>",
128
+ "test:coverage": "<framework> run --coverage"
129
+ ```
130
+
131
+ **4d. Add `coverage/` to `.gitignore`** if not already present.
132
+
133
+ ### Step 5: Create Test Helpers
134
+
135
+ Based on what the project needs, create shared test utilities:
136
+
137
+ **If the project uses a database (SQLite, Postgres, etc.):**
138
+ - Create a DB test helper that sets up an isolated test database (in-memory SQLite, test schema, etc.)
139
+ - Helper should return `{ db, cleanup }` for use in `beforeEach`/`afterEach`
140
+ - **Finding the schema:** Search for `schema.*` files (`.ts`, `.js`, `.sql`), `schema/` directories, or migration files. For TypeScript projects, look for exported DDL constants (e.g., `export const SCHEMA_DDL`). For SQL files, import them directly. Apply the discovered schema to the test database.
141
+
142
+ **If services depend on event emitters, websockets, or message buses:**
143
+ - Create a mock factory (e.g., `createMockEmitter()`) that returns a spy-instrumented object matching the real interface
144
+
145
+ **If tests need fixture data (config objects, sample records, etc.):**
146
+ - Create a `__fixtures__/` directory with reusable test data
147
+ - Export named constants: `MINIMAL_CONFIG`, `DEFAULT_CONFIG`, `INVALID_CONFIGS`, etc.
148
+ - Build fixtures from the project's actual config schemas, not invented formats
149
+
150
+ ### Step 6: Write Real Test Cases
151
+
152
+ Write actual, meaningful test cases for the code identified in Step 2. **Do not write stubs or placeholder tests.**
153
+
154
+ **For each testable module, write tests that cover:**
155
+
156
+ 1. **Happy path** — normal inputs produce expected outputs
157
+ 2. **Edge cases** — empty inputs, boundary values, null/undefined
158
+ 3. **Error cases** — invalid inputs throw or return error results
159
+ 4. **Constructor/initialization** — validation logic, required params
160
+
161
+ **Organize tests by module:**
162
+ - Co-locate test files next to source files: `foo.ts` → `foo.test.ts`
163
+ - Exception: integration tests spanning multiple modules go in `__tests__/` directories
164
+
165
+ **Naming convention:**
166
+ ```
167
+ describe('ClassName', () => {
168
+ describe('methodName()', () => {
169
+ it('returns X when given Y', () => { ... });
170
+ it('throws when given invalid input', () => { ... });
171
+ });
172
+ });
173
+ ```
174
+
175
+ **Prioritize coverage by test value:**
176
+ 1. Pure logic with complex branching (highest value)
177
+ 2. Services that write/read data (catches data bugs)
178
+ 3. API routes (catches contract breaks)
179
+ 4. Simple getters/setters (lowest value — skip if time-constrained)
180
+
181
+ ### Step 7: Verify
182
+
183
+ Run the complete test suite and confirm all tests pass:
184
+
185
+ ```bash
186
+ npm run test # or equivalent
187
+ ```
188
+
189
+ If any tests fail:
190
+ 1. Read the failure output
191
+ 2. Fix the test or the test helper (not the source code — tests should match existing behavior)
192
+ 3. Re-run until all pass
193
+
194
+ Also verify the project still builds:
195
+ ```bash
196
+ npm run typecheck # if TypeScript
197
+ npm run build # if applicable
198
+ ```
199
+
200
+ ### Step 8: Update orbital.config.json
201
+
202
+ Set `commands.test` so the test gate (#13 in `/test-checks`) runs automatically:
203
+
204
+ Read `.claude/orbital.config.json`, update the `commands.test` field:
205
+
206
+ ```json
207
+ {
208
+ "commands": {
209
+ "test": "npm run test"
210
+ }
211
+ }
212
+ ```
213
+
214
+ Use the appropriate command for the project's package manager and framework.
215
+
216
+ ## Notes
217
+
218
+ - This skill is framework-agnostic — the framework choice emerges from project analysis
219
+ - For projects with both frontend and backend, focus tests on backend/shared logic first (higher value per test)
220
+ - Do not add component tests (React Testing Library, etc.) unless the project specifically needs them — they require additional setup (jsdom, etc.) and are lower priority than logic tests
221
+ - Do not modify source code to make it testable — tests should work with the existing API surface
222
+ - If the project already has _some_ tests but `commands.test` is null, configure the command without rewriting existing tests