@sun-asterisk/sungen 2.7.0-beta.1 → 3.0.0-beta.72

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 (309) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/commands/add.js +3 -3
  3. package/dist/cli/commands/add.js.map +1 -1
  4. package/dist/cli/commands/audit.d.ts +3 -0
  5. package/dist/cli/commands/audit.d.ts.map +1 -0
  6. package/dist/cli/commands/audit.js +134 -0
  7. package/dist/cli/commands/audit.js.map +1 -0
  8. package/dist/cli/commands/blindspot.d.ts +3 -0
  9. package/dist/cli/commands/blindspot.d.ts.map +1 -0
  10. package/dist/cli/commands/blindspot.js +58 -0
  11. package/dist/cli/commands/blindspot.js.map +1 -0
  12. package/dist/cli/commands/capability.d.ts +3 -0
  13. package/dist/cli/commands/capability.d.ts.map +1 -0
  14. package/dist/cli/commands/capability.js +196 -0
  15. package/dist/cli/commands/capability.js.map +1 -0
  16. package/dist/cli/commands/challenge.d.ts +3 -0
  17. package/dist/cli/commands/challenge.d.ts.map +1 -0
  18. package/dist/cli/commands/challenge.js +102 -0
  19. package/dist/cli/commands/challenge.js.map +1 -0
  20. package/dist/cli/commands/feedback.d.ts +3 -0
  21. package/dist/cli/commands/feedback.d.ts.map +1 -0
  22. package/dist/cli/commands/feedback.js +72 -0
  23. package/dist/cli/commands/feedback.js.map +1 -0
  24. package/dist/cli/commands/flow-check.d.ts +3 -0
  25. package/dist/cli/commands/flow-check.d.ts.map +1 -0
  26. package/dist/cli/commands/flow-check.js +136 -0
  27. package/dist/cli/commands/flow-check.js.map +1 -0
  28. package/dist/cli/commands/generate.d.ts.map +1 -1
  29. package/dist/cli/commands/generate.js +50 -2
  30. package/dist/cli/commands/generate.js.map +1 -1
  31. package/dist/cli/commands/ledger.d.ts +3 -0
  32. package/dist/cli/commands/ledger.d.ts.map +1 -0
  33. package/dist/cli/commands/ledger.js +71 -0
  34. package/dist/cli/commands/ledger.js.map +1 -0
  35. package/dist/cli/commands/manifest.d.ts +3 -0
  36. package/dist/cli/commands/manifest.d.ts.map +1 -0
  37. package/dist/cli/commands/manifest.js +101 -0
  38. package/dist/cli/commands/manifest.js.map +1 -0
  39. package/dist/cli/commands/script-check.d.ts +3 -0
  40. package/dist/cli/commands/script-check.d.ts.map +1 -0
  41. package/dist/cli/commands/script-check.js +97 -0
  42. package/dist/cli/commands/script-check.js.map +1 -0
  43. package/dist/cli/commands/trace.d.ts +3 -0
  44. package/dist/cli/commands/trace.d.ts.map +1 -0
  45. package/dist/cli/commands/trace.js +110 -0
  46. package/dist/cli/commands/trace.js.map +1 -0
  47. package/dist/cli/commands/update.d.ts.map +1 -1
  48. package/dist/cli/commands/update.js +22 -9
  49. package/dist/cli/commands/update.js.map +1 -1
  50. package/dist/cli/index.js +20 -0
  51. package/dist/cli/index.js.map +1 -1
  52. package/dist/generators/test-generator/adapters/adapter-interface.d.ts +1 -0
  53. package/dist/generators/test-generator/adapters/adapter-interface.d.ts.map +1 -1
  54. package/dist/generators/test-generator/adapters/adapter-registry.d.ts +13 -0
  55. package/dist/generators/test-generator/adapters/adapter-registry.d.ts.map +1 -1
  56. package/dist/generators/test-generator/adapters/adapter-registry.js +73 -1
  57. package/dist/generators/test-generator/adapters/adapter-registry.js.map +1 -1
  58. package/dist/generators/test-generator/adapters/index.d.ts +1 -1
  59. package/dist/generators/test-generator/adapters/index.d.ts.map +1 -1
  60. package/dist/generators/test-generator/adapters/index.js +5 -1
  61. package/dist/generators/test-generator/adapters/index.js.map +1 -1
  62. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  63. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  64. package/dist/generators/test-generator/adapters/playwright/templates/test-file.hbs +6 -0
  65. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  66. package/dist/generators/test-generator/code-generator.js +6 -2
  67. package/dist/generators/test-generator/code-generator.js.map +1 -1
  68. package/dist/generators/test-generator/patterns/capture-patterns.d.ts +16 -0
  69. package/dist/generators/test-generator/patterns/capture-patterns.d.ts.map +1 -0
  70. package/dist/generators/test-generator/patterns/capture-patterns.js +54 -0
  71. package/dist/generators/test-generator/patterns/capture-patterns.js.map +1 -0
  72. package/dist/generators/test-generator/patterns/form-patterns.d.ts.map +1 -1
  73. package/dist/generators/test-generator/patterns/form-patterns.js +3 -1
  74. package/dist/generators/test-generator/patterns/form-patterns.js.map +1 -1
  75. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  76. package/dist/generators/test-generator/patterns/index.js +2 -0
  77. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  78. package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
  79. package/dist/generators/test-generator/step-mapper.js +1 -0
  80. package/dist/generators/test-generator/step-mapper.js.map +1 -1
  81. package/dist/generators/test-generator/utils/data-resolver.d.ts +5 -0
  82. package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
  83. package/dist/generators/test-generator/utils/data-resolver.js +17 -0
  84. package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
  85. package/dist/generators/test-generator/utils/runtime-data-transformer.d.ts.map +1 -1
  86. package/dist/generators/test-generator/utils/runtime-data-transformer.js +4 -0
  87. package/dist/generators/test-generator/utils/runtime-data-transformer.js.map +1 -1
  88. package/dist/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
  89. package/dist/generators/test-generator/utils/selector-resolver.js +12 -6
  90. package/dist/generators/test-generator/utils/selector-resolver.js.map +1 -1
  91. package/dist/harness/audit.d.ts +24 -0
  92. package/dist/harness/audit.d.ts.map +1 -0
  93. package/dist/harness/audit.js +115 -0
  94. package/dist/harness/audit.js.map +1 -0
  95. package/dist/harness/blindspot.d.ts +15 -0
  96. package/dist/harness/blindspot.d.ts.map +1 -0
  97. package/dist/harness/blindspot.js +85 -0
  98. package/dist/harness/blindspot.js.map +1 -0
  99. package/dist/harness/capability-plan.d.ts +49 -0
  100. package/dist/harness/capability-plan.d.ts.map +1 -0
  101. package/dist/harness/capability-plan.js +215 -0
  102. package/dist/harness/capability-plan.js.map +1 -0
  103. package/dist/harness/capability.d.ts +23 -0
  104. package/dist/harness/capability.d.ts.map +1 -0
  105. package/dist/harness/capability.js +98 -0
  106. package/dist/harness/capability.js.map +1 -0
  107. package/dist/harness/catalog/drivers.yaml +57 -0
  108. package/dist/harness/catalog/universal-viewpoints.yaml +114 -0
  109. package/dist/harness/challenge.d.ts +21 -0
  110. package/dist/harness/challenge.d.ts.map +1 -0
  111. package/dist/harness/challenge.js +151 -0
  112. package/dist/harness/challenge.js.map +1 -0
  113. package/dist/harness/feedback.d.ts +29 -0
  114. package/dist/harness/feedback.d.ts.map +1 -0
  115. package/dist/harness/feedback.js +106 -0
  116. package/dist/harness/feedback.js.map +1 -0
  117. package/dist/harness/flow-check.d.ts +23 -0
  118. package/dist/harness/flow-check.d.ts.map +1 -0
  119. package/dist/harness/flow-check.js +132 -0
  120. package/dist/harness/flow-check.js.map +1 -0
  121. package/dist/harness/flow-plan.d.ts +23 -0
  122. package/dist/harness/flow-plan.d.ts.map +1 -0
  123. package/dist/harness/flow-plan.js +166 -0
  124. package/dist/harness/flow-plan.js.map +1 -0
  125. package/dist/harness/intent.d.ts +11 -0
  126. package/dist/harness/intent.d.ts.map +1 -0
  127. package/dist/harness/intent.js +86 -0
  128. package/dist/harness/intent.js.map +1 -0
  129. package/dist/harness/ledger.d.ts +42 -0
  130. package/dist/harness/ledger.d.ts.map +1 -0
  131. package/dist/harness/ledger.js +171 -0
  132. package/dist/harness/ledger.js.map +1 -0
  133. package/dist/harness/manifest.d.ts +42 -0
  134. package/dist/harness/manifest.d.ts.map +1 -0
  135. package/dist/harness/manifest.js +209 -0
  136. package/dist/harness/manifest.js.map +1 -0
  137. package/dist/harness/parse.d.ts +22 -0
  138. package/dist/harness/parse.d.ts.map +1 -0
  139. package/dist/harness/parse.js +163 -0
  140. package/dist/harness/parse.js.map +1 -0
  141. package/dist/harness/script-check.d.ts +39 -0
  142. package/dist/harness/script-check.d.ts.map +1 -0
  143. package/dist/harness/script-check.js +251 -0
  144. package/dist/harness/script-check.js.map +1 -0
  145. package/dist/harness/secret-scan.d.ts +8 -0
  146. package/dist/harness/secret-scan.d.ts.map +1 -0
  147. package/dist/harness/secret-scan.js +88 -0
  148. package/dist/harness/secret-scan.js.map +1 -0
  149. package/dist/harness/sensors.d.ts +88 -0
  150. package/dist/harness/sensors.d.ts.map +1 -0
  151. package/dist/harness/sensors.js +232 -0
  152. package/dist/harness/sensors.js.map +1 -0
  153. package/dist/harness/trace.d.ts +31 -0
  154. package/dist/harness/trace.d.ts.map +1 -0
  155. package/dist/harness/trace.js +173 -0
  156. package/dist/harness/trace.js.map +1 -0
  157. package/dist/orchestrator/ai-rules-updater.d.ts +1 -0
  158. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  159. package/dist/orchestrator/ai-rules-updater.js +55 -11
  160. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  161. package/dist/orchestrator/figma/spec-figma-renderer.d.ts +2 -2
  162. package/dist/orchestrator/figma/spec-figma-renderer.js +2 -2
  163. package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +1 -1
  164. package/dist/orchestrator/figma/spec-figma-section-renderers.js +1 -1
  165. package/dist/orchestrator/project-initializer.d.ts +5 -0
  166. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  167. package/dist/orchestrator/project-initializer.js +30 -6
  168. package/dist/orchestrator/project-initializer.js.map +1 -1
  169. package/dist/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  170. package/dist/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  171. package/dist/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  172. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  173. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  174. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
  175. package/dist/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  176. package/dist/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  177. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  178. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
  179. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  180. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  181. package/dist/orchestrator/templates/ai-instructions/{github-skill-sungen-figma-source.md → claude-skill-capture-mode-figma-pat.md} +14 -48
  182. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  183. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  184. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  185. package/dist/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  186. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
  187. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  188. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  189. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
  190. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  191. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  192. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  193. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
  194. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  195. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  196. package/{src/orchestrator/templates/ai-instructions/claude-skill-figma-source.md → dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-pat.md} +14 -48
  197. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  198. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  199. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  200. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  201. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
  202. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  203. package/dist/orchestrator/templates/specs-test-data.ts +20 -6
  204. package/dist/tools/figma/figma-auth.d.ts +5 -2
  205. package/dist/tools/figma/figma-auth.d.ts.map +1 -1
  206. package/dist/tools/figma/figma-auth.js +19 -9
  207. package/dist/tools/figma/figma-auth.js.map +1 -1
  208. package/docs/orchestration-spec.md +267 -0
  209. package/package.json +12 -7
  210. package/src/cli/commands/add.ts +3 -3
  211. package/src/cli/commands/audit.ts +92 -0
  212. package/src/cli/commands/blindspot.ts +48 -0
  213. package/src/cli/commands/capability.ts +160 -0
  214. package/src/cli/commands/challenge.ts +55 -0
  215. package/src/cli/commands/feedback.ts +65 -0
  216. package/src/cli/commands/flow-check.ts +97 -0
  217. package/src/cli/commands/generate.ts +47 -2
  218. package/src/cli/commands/ledger.ts +61 -0
  219. package/src/cli/commands/manifest.ts +55 -0
  220. package/src/cli/commands/script-check.ts +50 -0
  221. package/src/cli/commands/trace.ts +60 -0
  222. package/src/cli/commands/update.ts +30 -10
  223. package/src/cli/index.ts +20 -0
  224. package/src/generators/test-generator/adapters/adapter-interface.ts +1 -0
  225. package/src/generators/test-generator/adapters/adapter-registry.ts +37 -0
  226. package/src/generators/test-generator/adapters/index.ts +4 -1
  227. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  228. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  229. package/src/generators/test-generator/adapters/playwright/templates/test-file.hbs +6 -0
  230. package/src/generators/test-generator/code-generator.ts +6 -2
  231. package/src/generators/test-generator/patterns/capture-patterns.ts +59 -0
  232. package/src/generators/test-generator/patterns/form-patterns.ts +3 -1
  233. package/src/generators/test-generator/patterns/index.ts +2 -0
  234. package/src/generators/test-generator/step-mapper.ts +1 -0
  235. package/src/generators/test-generator/utils/data-resolver.ts +20 -0
  236. package/src/generators/test-generator/utils/runtime-data-transformer.ts +8 -0
  237. package/src/generators/test-generator/utils/selector-resolver.ts +13 -6
  238. package/src/harness/audit.ts +112 -0
  239. package/src/harness/blindspot.ts +51 -0
  240. package/src/harness/capability-plan.ts +180 -0
  241. package/src/harness/capability.ts +75 -0
  242. package/src/harness/catalog/drivers.yaml +57 -0
  243. package/src/harness/catalog/universal-viewpoints.yaml +114 -0
  244. package/src/harness/challenge.ts +131 -0
  245. package/src/harness/feedback.ts +84 -0
  246. package/src/harness/flow-check.ts +99 -0
  247. package/src/harness/flow-plan.ts +135 -0
  248. package/src/harness/intent.ts +58 -0
  249. package/src/harness/ledger.ts +155 -0
  250. package/src/harness/manifest.ts +173 -0
  251. package/src/harness/parse.ts +145 -0
  252. package/src/harness/script-check.ts +222 -0
  253. package/src/harness/secret-scan.ts +51 -0
  254. package/src/harness/sensors.ts +279 -0
  255. package/src/harness/trace.ts +138 -0
  256. package/src/orchestrator/ai-rules-updater.ts +57 -10
  257. package/src/orchestrator/figma/spec-figma-renderer.ts +2 -2
  258. package/src/orchestrator/figma/spec-figma-section-renderers.ts +1 -1
  259. package/src/orchestrator/project-initializer.ts +33 -7
  260. package/src/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  261. package/src/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  262. package/src/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  263. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  264. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  265. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
  266. package/src/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  267. package/src/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  268. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  269. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
  270. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  271. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  272. package/{dist/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md → src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-pat.md} +14 -48
  273. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  274. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  275. package/src/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  276. package/src/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  277. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
  278. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  279. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  280. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
  281. package/src/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  282. package/src/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  283. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  284. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
  285. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  286. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  287. package/{dist/orchestrator/templates/ai-instructions/claude-skill-figma-source.md → src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-pat.md} +14 -48
  288. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  289. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  290. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  291. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  292. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
  293. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  294. package/src/orchestrator/templates/specs-test-data.ts +20 -6
  295. package/src/tools/figma/figma-auth.ts +20 -9
  296. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  297. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  298. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  299. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  300. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  301. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  302. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  303. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  304. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  305. package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +0 -151
  306. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  307. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  308. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  309. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +0 -151
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Trace — visualise the whole executed test-design process and tell the end-user
3
+ * where to focus human-in-the-loop review.
4
+ *
5
+ * Aggregates the artifacts the harness already produces:
6
+ * - .sungen/ledger/<name>.jsonl → what ran, in what order, how many repair loops, time
7
+ * - .sungen/reports/<name>-audit.json → gate result, sub-scores, weak sensor (bottleneck)
8
+ * - .sungen/reports/<name>-script-check.json → Gherkin↔script drift
9
+ * - features/<name>.feature → @manual scenarios (where humans MUST verify)
10
+ *
11
+ * Outputs: a text process map + a Mermaid flowchart (paste into any viewer) +
12
+ * bottleneck analysis + a ranked "human-loop focus" list.
13
+ */
14
+ import * as fs from 'fs';
15
+ import * as path from 'path';
16
+ import { segmentRuns, latestRunEvents, LedgerEvent } from './ledger';
17
+
18
+ interface ManualItem { scenario: string; reason: string }
19
+
20
+ function readJson(p: string): any | null {
21
+ try { return fs.existsSync(p) ? JSON.parse(fs.readFileSync(p, 'utf-8')) : null; } catch { return null; }
22
+ }
23
+
24
+ function readLedger(screen: string): any[] {
25
+ const p = path.join(process.cwd(), '.sungen', 'ledger', `${screen}.jsonl`);
26
+ if (!fs.existsSync(p)) return [];
27
+ return fs.readFileSync(p, 'utf-8').split('\n').filter(Boolean).map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
28
+ }
29
+
30
+ /** Parse @manual scenarios + the explanatory comment line above each. */
31
+ function parseManual(featurePath: string): ManualItem[] {
32
+ if (!fs.existsSync(featurePath)) return [];
33
+ const lines = fs.readFileSync(featurePath, 'utf-8').split('\n');
34
+ const out: ManualItem[] = [];
35
+ for (let i = 0; i < lines.length; i++) {
36
+ const m = lines[i].match(/^\s*Scenario:\s*(.+)$/);
37
+ if (!m) continue;
38
+ // look back for tag line + a reason comment
39
+ let manual = false; let reason = '';
40
+ for (let j = i - 1; j >= 0 && j >= i - 4; j--) {
41
+ const l = lines[j].trim();
42
+ if (/^@/.test(l) && /@manual/.test(l)) manual = true;
43
+ else if (/^#/.test(l) && !reason) reason = l.replace(/^#+\s*/, '');
44
+ else if (l === '' || /^Scenario:/.test(l)) break;
45
+ }
46
+ if (manual) out.push({ scenario: m[1].trim(), reason: reason || '(no reason noted)' });
47
+ }
48
+ return out;
49
+ }
50
+
51
+ export interface TraceReport {
52
+ screen: string;
53
+ runs: number; // total runs on file (process map shows the latest)
54
+ ledger: { step: string; ms: number }[];
55
+ repairRounds: number;
56
+ totalMs: number;
57
+ recordedSteps: string[];
58
+ missingSteps: string[]; // expected phases not recorded in ledger
59
+ audit: { score?: number; gate?: string; weakest?: string; findings?: number; gaps?: string[] } | null;
60
+ drift: string | null;
61
+ manual: ManualItem[];
62
+ bottlenecks: string[];
63
+ humanFocus: string[];
64
+ mermaid: string;
65
+ }
66
+
67
+ const EXPECTED_PHASES = ['discovery', 'viewpoint', 'gherkin', 'audit', 'repair'];
68
+
69
+ export function buildTrace(screenDir: string, screenName: string): TraceReport {
70
+ const allEvents = readLedger(screenName) as LedgerEvent[];
71
+ const runs = segmentRuns(allEvents).length;
72
+ const events = latestRunEvents(allEvents); // scope to the most recent run (P2)
73
+ const ledger = events.map((e) => ({ step: e.step as string, ms: (e.ms as number) || 0 }));
74
+ const repairRounds = new Set(events.filter((e) => /^repair/i.test(e.step)).map((e) => e.step)).size;
75
+ const totalMs = ledger.reduce((n, e) => n + e.ms, 0);
76
+ const recordedSteps = [...new Set(ledger.map((e) => e.step.replace(/:\d+$/, '')))];
77
+ const missingSteps = EXPECTED_PHASES.filter((p) => !recordedSteps.includes(p));
78
+
79
+ const auditRaw = readJson(path.join(process.cwd(), '.sungen', 'reports', `${screenName}-audit.json`));
80
+ let audit: TraceReport['audit'] = null;
81
+ if (auditRaw) {
82
+ const subs: Record<string, number> = {
83
+ coverage: auditRaw.score?.coverage, businessDepth: auditRaw.score?.businessDepth,
84
+ balance: auditRaw.score?.balance, traceability: auditRaw.score?.traceability,
85
+ };
86
+ const weakest = Object.entries(subs).filter(([, v]) => typeof v === 'number').sort((a, b) => a[1] - b[1])[0]?.[0];
87
+ audit = {
88
+ score: auditRaw.score?.overall, gate: auditRaw.gateStatus, weakest,
89
+ findings: (auditRaw.findings || []).length,
90
+ gaps: (auditRaw.gate?.gaps || []).map((g: any) => `${g.theme} (${g.status})`),
91
+ };
92
+ }
93
+
94
+ const scRaw = readJson(path.join(process.cwd(), '.sungen', 'reports', `${screenName}-script-check.json`));
95
+ const drift = scRaw ? scRaw.drift : null;
96
+
97
+ const manual = parseManual(path.join(screenDir, 'features', `${screenName}.feature`));
98
+
99
+ // Bottlenecks
100
+ const bottlenecks: string[] = [];
101
+ if (repairRounds >= 3) bottlenecks.push(`Repair loop hit ${repairRounds} rounds (near/over budget) → first-pass generation (Guide) is the bottleneck.`);
102
+ if (audit?.weakest) bottlenecks.push(`Lowest audit dimension: ${audit.weakest} → focus engine improvement there.`);
103
+ if (audit?.gaps?.length) bottlenecks.push(`Gate gaps: ${audit.gaps.join(', ')}.`);
104
+ if (drift === 'drift') bottlenecks.push('Spec DRIFT vs Gherkin → regenerate (never hand-edit specs).');
105
+ if (missingSteps.length) bottlenecks.push(`Ledger missing phases: ${missingSteps.join(', ')} → instrument \`sungen ledger record\` at each phase for full observability.`);
106
+ if (bottlenecks.length === 0) bottlenecks.push('No bottleneck detected from available signals.');
107
+
108
+ // Human-loop focus (where the user must look)
109
+ const humanFocus: string[] = [];
110
+ if (manual.length) humanFocus.push(`${manual.length} @manual scenario(s) need HUMAN verification (not automated):`);
111
+ for (const m of manual.slice(0, 12)) humanFocus.push(` • ${m.scenario} — ${m.reason}`);
112
+ if (audit?.gaps?.length) humanFocus.push(`Critical gaps deferred/uncovered: ${audit.gaps.join(', ')} — decide flow vs accept.`);
113
+ if (humanFocus.length === 0) humanFocus.push('No manual/uncovered items — automation covers the critical viewpoints.');
114
+
115
+ // Mermaid flowchart of the executed process
116
+ const phaseSeq = ledger.length
117
+ ? ledger.map((e) => e.step)
118
+ : ['(no ledger — process not instrumented)'];
119
+ const nodes = phaseSeq.map((s, i) => ` S${i}["${s}${ledger[i] ? ` (${ledger[i].ms}ms)` : ''}"]`).join('\n');
120
+ const edges = phaseSeq.map((_, i) => (i < phaseSeq.length - 1 ? ` S${i} --> S${i + 1}` : '')).filter(Boolean).join('\n');
121
+ const mermaid = [
122
+ 'flowchart TD',
123
+ ' IN["spec / figma / ui / live"] --> DISC[discovery]',
124
+ ' DISC --> VP[viewpoint overview]',
125
+ ' VP --> GEN[generate Gherkin]',
126
+ ' GEN --> AUD{sungen audit gate}',
127
+ repairRounds ? ` AUD -- FAIL --> REP["repair ×${repairRounds}"]` : '',
128
+ repairRounds ? ' REP --> AUD' : '',
129
+ ` AUD -- ${audit?.gate === 'PASS' ? 'PASS' : 'still failing'} --> DONE[converge]`,
130
+ ' DONE --> SC{script-check 1:1}',
131
+ ` SC -- ${drift === 'drift' ? 'DRIFT → regenerate' : 'in-sync'} --> OUT[generate → run-test → delivery]`,
132
+ ].filter(Boolean).join('\n');
133
+
134
+ return {
135
+ screen: screenName, runs, ledger, repairRounds, totalMs, recordedSteps, missingSteps,
136
+ audit, drift, manual, bottlenecks, humanFocus, mermaid,
137
+ };
138
+ }
@@ -18,21 +18,25 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
18
18
  ['claude-cmd-add-screen.md', '.claude/commands/sungen/add-screen.md'],
19
19
  ['claude-cmd-add-flow.md', '.claude/commands/sungen/add-flow.md'],
20
20
  ['claude-cmd-create-test.md', '.claude/commands/sungen/create-test.md'],
21
+ ['claude-cmd-design.md', '.claude/commands/sungen/design.md'],
21
22
  ['claude-cmd-run-test.md', '.claude/commands/sungen/run-test.md'],
22
23
  ['claude-cmd-review.md', '.claude/commands/sungen/review.md'],
23
24
  ['claude-cmd-delivery.md', '.claude/commands/sungen/delivery.md'],
24
25
  ['claude-cmd-dashboard.md', '.claude/commands/sungen/dashboard.md'],
25
26
  ['claude-cmd-locale.md', '.claude/commands/sungen/locale.md'],
27
+ ['claude-cmd-feedback.md', '.claude/commands/sungen/feedback.md'],
26
28
 
27
29
  // Commands — GitHub Copilot
28
30
  ['copilot-cmd-add-screen.md', '.github/prompts/sungen-add-screen.prompt.md'],
29
31
  ['copilot-cmd-add-flow.md', '.github/prompts/sungen-add-flow.prompt.md'],
30
32
  ['copilot-cmd-create-test.md', '.github/prompts/sungen-create-test.prompt.md'],
33
+ ['copilot-cmd-design.md', '.github/prompts/sungen-design.prompt.md'],
31
34
  ['copilot-cmd-run-test.md', '.github/prompts/sungen-run-test.prompt.md'],
32
35
  ['copilot-cmd-review.md', '.github/prompts/sungen-review.prompt.md'],
33
36
  ['copilot-cmd-delivery.md', '.github/prompts/sungen-delivery.prompt.md'],
34
37
  ['copilot-cmd-dashboard.md', '.github/prompts/sungen-dashboard.prompt.md'],
35
38
  ['copilot-cmd-locale.md', '.github/prompts/sungen-locale.prompt.md'],
39
+ ['copilot-cmd-feedback.md', '.github/prompts/sungen-feedback.prompt.md'],
36
40
 
37
41
  // Skills — Claude Code
38
42
  ['claude-skill-gherkin-syntax.md', '.claude/skills/sungen-gherkin-syntax/SKILL.md'],
@@ -42,6 +46,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
42
46
  ['claude-skill-test-design-techniques.md', '.claude/skills/sungen-test-design-techniques/SKILL.md'],
43
47
  ['claude-skill-selector-fix.md', '.claude/skills/sungen-selector-fix/SKILL.md'],
44
48
  ['claude-skill-tc-review.md', '.claude/skills/sungen-tc-review/SKILL.md'],
49
+ ['claude-skill-harness-audit.md', '.claude/skills/sungen-harness-audit/SKILL.md'],
45
50
  ['claude-skill-viewpoint.md', '.claude/skills/sungen-viewpoint/SKILL.md'],
46
51
  ['claude-skill-viewpoint-group-a-data-entry.md', '.claude/skills/sungen-viewpoint/group-a-data-entry.md'],
47
52
  ['claude-skill-viewpoint-group-b-data-ops.md', '.claude/skills/sungen-viewpoint/group-b-data-ops.md'],
@@ -50,14 +55,19 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
50
55
  ['claude-skill-viewpoint-group-e-identity.md', '.claude/skills/sungen-viewpoint/group-e-identity.md'],
51
56
  ['claude-skill-delivery.md', '.claude/skills/sungen-delivery/SKILL.md'],
52
57
  ['claude-skill-dashboard.md', '.claude/skills/sungen-dashboard/SKILL.md'],
53
- ['claude-skill-capture-figma.md', '.claude/skills/sungen-capture-figma/SKILL.md'],
54
- ['claude-skill-capture-local.md', '.claude/skills/sungen-capture-local/SKILL.md'],
55
- ['claude-skill-capture-live.md', '.claude/skills/sungen-capture-live/SKILL.md'],
56
- ['claude-skill-figma-source.md', '.claude/skills/sungen-figma-source/SKILL.md'],
58
+ // sungen-capture — router skill (1 SKILL.md + 4 mode files). Replaces the former
59
+ // capture-figma / capture-live / capture-local / figma-source standalone skills.
60
+ ['claude-skill-capture.md', '.claude/skills/sungen-capture/SKILL.md'],
61
+ ['claude-skill-capture-mode-figma-mcp.md', '.claude/skills/sungen-capture/mode-figma-mcp.md'],
62
+ ['claude-skill-capture-mode-figma-pat.md', '.claude/skills/sungen-capture/mode-figma-pat.md'],
63
+ ['claude-skill-capture-mode-live.md', '.claude/skills/sungen-capture/mode-live.md'],
64
+ ['claude-skill-capture-mode-local.md', '.claude/skills/sungen-capture/mode-local.md'],
57
65
  ['claude-skill-locale.md', '.claude/skills/sungen-locale/SKILL.md'],
58
66
 
59
- // SkillsCopilot (prompt-based)
60
- ['copilot-skill-figma-source.md', '.github/prompts/sungen-figma-source.prompt.md'],
67
+ // AgentsClaude Code sub-agents (isolated context). Copilot runs these inline.
68
+ ['claude-agent-reviewer.md', '.claude/agents/sungen-reviewer.md'],
69
+ ['claude-agent-discovery.md', '.claude/agents/sungen-discovery.md'],
70
+ ['claude-agent-challenge.md', '.claude/agents/sungen-challenge.md'],
61
71
 
62
72
  // Skills — GitHub Copilot
63
73
  ['github-skill-sungen-gherkin-syntax.md', '.github/skills/sungen-gherkin-syntax/SKILL.md'],
@@ -67,6 +77,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
67
77
  ['github-skill-sungen-test-design-techniques.md', '.github/skills/sungen-test-design-techniques/SKILL.md'],
68
78
  ['github-skill-sungen-selector-fix.md', '.github/skills/sungen-selector-fix/SKILL.md'],
69
79
  ['github-skill-sungen-tc-review.md', '.github/skills/sungen-tc-review/SKILL.md'],
80
+ ['github-skill-sungen-harness-audit.md', '.github/skills/sungen-harness-audit/SKILL.md'],
70
81
  ['github-skill-sungen-viewpoint.md', '.github/skills/sungen-viewpoint/SKILL.md'],
71
82
  ['github-skill-sungen-viewpoint-group-a-data-entry.md', '.github/skills/sungen-viewpoint/group-a-data-entry.md'],
72
83
  ['github-skill-sungen-viewpoint-group-b-data-ops.md', '.github/skills/sungen-viewpoint/group-b-data-ops.md'],
@@ -75,13 +86,29 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
75
86
  ['github-skill-sungen-viewpoint-group-e-identity.md', '.github/skills/sungen-viewpoint/group-e-identity.md'],
76
87
  ['github-skill-sungen-delivery.md', '.github/skills/sungen-delivery/SKILL.md'],
77
88
  ['github-skill-sungen-dashboard.md', '.github/skills/sungen-dashboard/SKILL.md'],
78
- ['github-skill-sungen-capture-figma.md', '.github/skills/sungen-capture-figma/SKILL.md'],
79
- ['github-skill-sungen-capture-local.md', '.github/skills/sungen-capture-local/SKILL.md'],
80
- ['github-skill-sungen-capture-live.md', '.github/skills/sungen-capture-live/SKILL.md'],
81
- ['github-skill-sungen-figma-source.md', '.github/skills/sungen-figma-source/SKILL.md'],
89
+ ['github-skill-sungen-capture.md', '.github/skills/sungen-capture/SKILL.md'],
90
+ ['github-skill-sungen-capture-mode-figma-mcp.md', '.github/skills/sungen-capture/mode-figma-mcp.md'],
91
+ ['github-skill-sungen-capture-mode-figma-pat.md', '.github/skills/sungen-capture/mode-figma-pat.md'],
92
+ ['github-skill-sungen-capture-mode-live.md', '.github/skills/sungen-capture/mode-live.md'],
93
+ ['github-skill-sungen-capture-mode-local.md', '.github/skills/sungen-capture/mode-local.md'],
82
94
  ['github-skill-sungen-locale.md', '.github/skills/sungen-locale/SKILL.md'],
83
95
  ];
84
96
 
97
+ // Skill/asset directories retired in a previous refactor. `sungen update` removes
98
+ // these so already-initialized projects don't keep loading stale skill descriptions.
99
+ // (v3.0: the four capture/figma skills were merged into the `sungen-capture` router.)
100
+ export const STALE_AI_RULES_PATHS: string[] = [
101
+ '.claude/skills/sungen-capture-figma',
102
+ '.claude/skills/sungen-capture-live',
103
+ '.claude/skills/sungen-capture-local',
104
+ '.claude/skills/sungen-figma-source',
105
+ '.github/skills/sungen-capture-figma',
106
+ '.github/skills/sungen-capture-live',
107
+ '.github/skills/sungen-capture-local',
108
+ '.github/skills/sungen-figma-source',
109
+ '.github/prompts/sungen-figma-source.prompt.md',
110
+ ];
111
+
85
112
  export class AIRulesUpdater {
86
113
  private cwd: string;
87
114
  private aiTemplateDir: string;
@@ -133,11 +160,31 @@ export class AIRulesUpdater {
133
160
  }
134
161
  }
135
162
 
163
+ // Remove retired skills/assets so stale descriptions stop loading.
164
+ const removed: string[] = [];
165
+ for (const staleRelPath of STALE_AI_RULES_PATHS) {
166
+ const stalePath = path.join(this.cwd, staleRelPath);
167
+ if (fs.existsSync(stalePath)) {
168
+ if (!dryRun) {
169
+ fs.rmSync(stalePath, { recursive: true, force: true });
170
+ }
171
+ removed.push(staleRelPath);
172
+ }
173
+ }
174
+
136
175
  // Print results
137
176
  if (dryRun) {
138
177
  console.log('📋 Dry run — no files changed\n');
139
178
  }
140
179
 
180
+ if (removed.length > 0) {
181
+ console.log(`🗑️ Removed retired assets (${removed.length}):`);
182
+ for (const f of removed) {
183
+ console.log(` ${f}`);
184
+ }
185
+ console.log();
186
+ }
187
+
141
188
  if (updated.length > 0) {
142
189
  console.log(`✏️ Updated (${updated.length}):`);
143
190
  for (const f of updated) {
@@ -5,7 +5,7 @@
5
5
  * auto-gen banner, Frame metadata, Screenshots, and a SYNTHESIS marker.
6
6
  * Narrative sections (Purpose, ASCII Layout, Regions, Actions, Form Fields,
7
7
  * Data Columns, Navigation) are appended BELOW the marker by the
8
- * sungen-figma-source skill, which reads the raw cached node JSON.
8
+ * sungen-capture skill (mode figma-pat), which reads the raw cached node JSON.
9
9
  *
10
10
  * Section renderers live in spec-figma-section-renderers.ts.
11
11
  *
@@ -55,7 +55,7 @@ export interface RenderSpecFigmaInput {
55
55
 
56
56
  /**
57
57
  * Render the deterministic envelope for spec_figma.md.
58
- * The LLM synthesis step (sungen-figma-source skill) appends the narrative
58
+ * The LLM synthesis step (sungen-capture skill (mode figma-pat)) appends the narrative
59
59
  * sections AFTER the SYNTHESIS_MARKER comment. Re-synthesis replaces
60
60
  * everything from the marker to EOF.
61
61
  *
@@ -5,7 +5,7 @@
5
5
  * needs: frontmatter, Frame metadata, Screenshots, and the SYNTHESIS marker.
6
6
  * All prose sections (Purpose, ASCII Layout, Regions, Actions, Form Fields,
7
7
  * Data Columns, Navigation) are appended below the marker by the
8
- * sungen-figma-source skill.
8
+ * sungen-capture skill (mode figma-pat).
9
9
  *
10
10
  * Pure — no I/O.
11
11
  */
@@ -42,6 +42,9 @@ export class ProjectInitializer {
42
42
  // Create qa/context.md for QA lead to fill project-wide context
43
43
  this.createContext();
44
44
 
45
+ // Create qa/capabilities.yaml — the platform driver profile (default: web/Playwright)
46
+ this.createCapabilities();
47
+
45
48
  // Ensure package.json and install Playwright
46
49
  await this.setupDependencies();
47
50
 
@@ -150,10 +153,12 @@ export class ProjectInitializer {
150
153
  const gitignorePath = path.join(this.cwd, '.gitignore');
151
154
  const sungenEntries = [
152
155
  '# Sungen generated files',
153
- 'specs/.auth/',
156
+ 'specs/.auth/', // session storage state = cookies/tokens (sensitive)
154
157
  'test-results/',
155
158
  'playwright-report/',
156
- '.playwright-mcp/'
159
+ '.playwright-mcp/',
160
+ '.sungen/figma-cache/', // raw Figma node JSON (design IP)
161
+ '.sungen/feedback/', // local QA feedback (may contain product-sensitive notes)
157
162
  ];
158
163
 
159
164
  if (!fs.existsSync(gitignorePath)) {
@@ -162,12 +167,13 @@ export class ProjectInitializer {
162
167
  fs.writeFileSync(gitignorePath, content, 'utf-8');
163
168
  this.createdItems.push('.gitignore');
164
169
  } else {
165
- // Append Sungen entries if not already present
170
+ // Append any Sungen entries that are missing (idempotent — covers projects
171
+ // created before new sensitive paths were added).
166
172
  let content = fs.readFileSync(gitignorePath, 'utf-8');
167
- const needsUpdate = !content.includes('specs/.auth/');
168
-
169
- if (needsUpdate) {
170
- content += '\n' + sungenEntries.join('\n') + '\n';
173
+ const missing = sungenEntries.filter((e) => e.startsWith('#') ? false : !content.includes(e));
174
+ if (missing.length) {
175
+ const block = content.includes('# Sungen generated files') ? missing : ['# Sungen generated files', ...missing];
176
+ content += '\n' + block.join('\n') + '\n';
171
177
  fs.writeFileSync(gitignorePath, content, 'utf-8');
172
178
  this.createdItems.push('.gitignore (updated)');
173
179
  } else {
@@ -383,6 +389,26 @@ export class ProjectInitializer {
383
389
  this.createdItems.push('qa/context.md');
384
390
  }
385
391
 
392
+ /**
393
+ * Create qa/capabilities.yaml — the platform driver profile (Phase 2a).
394
+ * Defaults to `web` (Playwright). Mobile/API projects switch via `sungen capability add`.
395
+ */
396
+ private createCapabilities(): void {
397
+ const p = path.join(this.cwd, 'qa', 'capabilities.yaml');
398
+ if (fs.existsSync(p)) {
399
+ this.skippedItems.push('qa/capabilities.yaml');
400
+ return;
401
+ }
402
+ const content =
403
+ '# Sungen capability profile — which runtime/drivers this project uses.\n' +
404
+ '# platform: the runtime adapter — web → Playwright, mobile → Appium.\n' +
405
+ '# enabled: drivers turned on (add more via `sungen capability add <driver>`).\n\n' +
406
+ 'platform: web\n' +
407
+ 'enabled:\n - web\n';
408
+ fs.writeFileSync(p, content, 'utf-8');
409
+ this.createdItems.push('qa/capabilities.yaml');
410
+ }
411
+
386
412
  /**
387
413
  * Create specs/base.ts for shared browser context
388
414
  */
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: sungen-challenge
3
+ description: Exploration/Challenge critic (Loop 2). Does NOT regenerate the suite — it ATTACKS the existing one to surface blind spots and propose a few high-value novelty candidates. Advisory only; never edits files, never auto-merges. Run after create-test converges, or on demand via `sungen challenge`.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are an **exploration critic** — the antidote to "the harness always outputs the same thing". Production mode (create-test → audit gate → repair) is deterministic by design; your job is to find what that determinism reliably **misses**. You do **not** rewrite the suite — you challenge it and hand back candidates for the QA to accept or reject.
8
+
9
+ ## First, run the deterministic spine
10
+ Run `sungen challenge --screen <name>` (Bash) and read its report (`.sungen/reports/<name>-challenge.md`). It already gives you: title↔assertion collection gaps, over-covered/shallow areas, and novelty prompts. Build on it — don't repeat it.
11
+
12
+ ## Inputs (read)
13
+ - `qa/<screens|flows>/<name>/features/<name>.feature` — the suite under attack.
14
+ - `requirements/spec.md` + `test-viewpoint.md` — source of truth + intended viewpoints.
15
+ - `.sungen/reports/<name>-audit.json` — what the gate already measured.
16
+ - Blind-spot patterns — run `sungen blindspot list --prompt` (Bash) and check the suite against each known pattern.
17
+
18
+ ## Three critics
19
+
20
+ 1. **Coverage critic** — viewpoints that are missing or covered only shallowly; areas over-covered with low value (e.g. many subscription edge cases while cart correctness is thin). Recommend rebalancing, not just adding.
21
+ 2. **Business-Depth critic** — scenarios whose **title claims more than the steps prove** (a set/collection asserted by one element; "correct X" asserted by mere visibility). For each, give the exact deep step to add. Confirm or dismiss the deterministic flags from `sungen challenge`.
22
+ 3. **Novelty critic** — 3–5 **non-obvious, valuable** scenarios outside the existing pattern, via risk lenses (double-submit, partial-load, boundary/unusual data, concurrency/back-button, historical incidents). Each must map to a risk or viewpoint and explain why it isn't a duplicate.
23
+
24
+ ## Guardrails (hard)
25
+ - **Read-only.** Never edit the feature or any file. You return findings; the QA/orchestrator decides.
26
+ - **No auto-merge.** Novelty candidates are proposals, capped at **≤ 20%** of the official scenario count.
27
+ - Each candidate is classified **Required / Recommended / Optional** and must not reduce traceability of the official suite.
28
+
29
+ ## Output (Challenge Report — Markdown, to the caller)
30
+ ```
31
+ # Challenge Report — <name>
32
+ ## Summary
33
+ - Official score: <from audit> · depth gaps confirmed: <n> · novelty candidates: <n>
34
+ ## Weak / missing viewpoints
35
+ | Viewpoint | Issue | Severity | Recommendation |
36
+ ## Shallow assertions (title > steps)
37
+ | Scenario | Claim in title | Current assertion | Suggested deep step |
38
+ ## Over-covered (low value)
39
+ | Area | Why | Suggested action |
40
+ ## Novelty candidates (≤20%, no auto-merge)
41
+ | Candidate | Related risk/viewpoint | Why valuable | Why not a duplicate | Required/Recommended/Optional |
42
+ ## Blind-spot patterns worth storing
43
+ | Pattern | General rule | Example from this screen |
44
+ ```
45
+
46
+ Keep it tight and actionable. End by reminding the QA: these are **advisory** — adopt selectively; promoting a recurring miss to `.sungen/blindspots/` (via `sungen blindspot add`) stops it recurring.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: sungen-discovery
3
+ description: Context explorer for test design. Reads ALL provided sources (spec.md, spec_figma.md, ui/* images, optional live page) in an isolated context and returns a COMPACT discovery report — sources, completeness, conflicts, recommended route, key facts — so the orchestrator's context stays lean for generation. Read-only. Invoked by create-test/design at the discovery step.
4
+ tools: Read, Grep, Glob, Bash, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot
5
+ ---
6
+
7
+ You are a **test-design context explorer**. You run in an **isolated context** so the orchestrator that generates test cases stays uncluttered. Read everything relevant, then return a **compact, structured report** — not raw dumps.
8
+
9
+ ## Explore (do NOT ask the user to pick a source — read all that exist)
10
+ - `requirements/spec.md` — primary behavior source.
11
+ - `requirements/spec_figma.md` — Figma supplement (if present; do NOT call Figma MCP when this exists).
12
+ - `requirements/ui/*` images — layout/visual context.
13
+ - Live page — only if a base URL is configured and reachable: `browser_navigate` + `browser_snapshot` for real element roles/names. Fall back gracefully if it requires login / fails.
14
+
15
+ ## Cross-check
16
+ Flag any **conflicts** between sources (field names, labels, behavior, states that disagree). `spec.md` is authoritative; design/figma/live supplement.
17
+
18
+ ## Output (compact — this is your only deliverable)
19
+ ```
20
+ SOURCES: spec=<yes/no, completeness high|med|low> | figma=<...> | ui=<n images> | live=<reached|offline>
21
+ PAGE TYPE: <e.g. ecommerce-list / form / auth / ...>
22
+ RECOMMENDED ROUTE: <spec-first | source-first | ...> — authoritative source: <which>
23
+ CONFLICTS: <list, or "none">
24
+ KEY FACTS (condensed):
25
+ - Sections: <list>
26
+ - Fields/validation: <key constraints + exact error messages>
27
+ - Business rules: <bullets>
28
+ - States: <lifecycle / empty / error / success>
29
+ ASSUMPTIONS / MISSING INFO: <what's unknown — to be marked in output>
30
+ ```
31
+
32
+ Keep it tight. Do not generate test cases — that is the orchestrator's job. Do not write files.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: sungen-reviewer
3
+ description: Independent QA reviewer for generated Gherkin. Judges SEMANTIC quality the deterministic `sungen audit` cannot — does each scenario's steps PROVE its title/viewpoint, are Thens observable, are business-critical assertions deep. Returns a verdict; does NOT edit files. Invoked by create-test/design during the gate+repair step.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are an **independent Senior QA Reviewer**. You did **not** write these tests — your job is to find where they are weak, not to defend them. You complement the deterministic gate (`sungen audit`), which already checks structural coverage; you judge the **semantics** it cannot.
8
+
9
+ ## Inputs (read them)
10
+ - `qa/<screens|flows>/<name>/features/<name>.feature` — the scenarios under review.
11
+ - `qa/<screens|flows>/<name>/requirements/test-viewpoint.md` — the viewpoint overview (priority).
12
+ - `qa/<screens|flows>/<name>/requirements/spec.md` — source of truth for behavior.
13
+ - `.sungen/reports/<name>-audit.json` — the deterministic findings (don't repeat them; go deeper).
14
+
15
+ ## What to judge (semantic — the gate misses these)
16
+ 1. **Title ↔ steps proof.** For every scenario, do the **steps actually prove the title/viewpoint**? Flag "title claims X but steps only assert Y". (e.g. title "adds the selected product, not a random one" but Then only `see [Added] modal`.)
17
+ 2. **Observable Then.** Is each `Then` an **observable outcome**, not a restated action or a tautology (e.g. `Then User see [Carousel] section` after clicking next — proves nothing changed)?
18
+ 3. **Business-critical depth.** For cart / product-detail / filter / list viewpoints, do steps assert **DATA** (name, price, quantity, all-items-belong) — not just page/modal visibility? Recommend the concrete deep step: `User remember [X] text as {{v}}` + `... with {{v}}`, or `User see all [X] contain {{v}}`.
19
+ 4. **@manual justification.** Is each `@manual` genuinely unautomatable (cross-screen/external/visual) — or a cop-out to dodge the gate? Cross-screen → should be a flow.
20
+ 5. **Meaning-level duplicates & missing criticals** the keyword gate can't see.
21
+
22
+ ## Output (do NOT edit any file)
23
+ Return a concise verdict:
24
+
25
+ ```
26
+ VERDICT: PASS | NEEDS-REPAIR
27
+ SCORE: <0-10> (semantic quality; be strict on business value)
28
+
29
+ ISSUES (most important first):
30
+ 1. [<scenario id>] <problem in one line>
31
+ FIX: <the exact Gherkin step(s) to add/change>
32
+ 2. ...
33
+
34
+ STRENGTHS: <1-2 lines, what is genuinely good>
35
+ ```
36
+
37
+ Be specific and actionable — every issue must have a concrete FIX the generator can apply. Limit to the ~8 highest-impact issues. Do not rewrite the feature file; the orchestrator applies repairs.
@@ -48,9 +48,9 @@ Record the screen list — you will need it for:
48
48
  ### 2. Capture visual source
49
49
 
50
50
  Use `AskUserQuestion`: *"Pick a visual source for this flow's screens:"*
51
- - **Figma designs** (Recommended for pre-launch) — invoke `sungen-capture-figma` skill for each screen
52
- - **Live page scan** (dev/staging is up) — invoke `sungen-capture-live` skill for each screen URL
53
- - **Local images** — invoke `sungen-capture-local` skill to load from `requirements/ui/`
51
+ - **Figma designs** (Recommended for pre-launch) — invoke `sungen-capture` skill (mode figma-mcp) for each screen
52
+ - **Live page scan** (dev/staging is up) — invoke `sungen-capture` skill (mode live) for each screen URL
53
+ - **Local images** — invoke `sungen-capture` skill (mode local) to load from `requirements/ui/`
54
54
  - **Skip** — user will drop images manually into `requirements/ui/` later
55
55
 
56
56
  Each capture skill writes outputs into `qa/flows/<name>/requirements/ui/` and reports back a summary. Do not inline capture logic here — always delegate to the skill so behavior stays consistent with `/sungen:create-test`.
@@ -45,7 +45,7 @@ sungen add --screen <screen> --feature <name> [--path <path>]
45
45
 
46
46
  **Figma branch (when `--figma <url>` is in `$ARGUMENTS`):**
47
47
 
48
- Invoke the `sungen-figma-source` skill by running:
48
+ Invoke the `sungen-capture` skill (mode figma-pat) by running:
49
49
  ```bash
50
50
  sungen add --screen <screen> --figma '<url>' [--path <path>] [--feature <name>] [--refresh] [--scale <n>]
51
51
  # Single-quote the URL — Figma links contain `&` which bash otherwise treats as a background operator.
@@ -71,7 +71,7 @@ In that case, guide the user to run `sungen figma auth set` and retry.
71
71
 
72
72
  ### 1a. Synthesize narrative sections (Figma branch only)
73
73
 
74
- After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is deterministic but the narrative below the `<!-- SYNTHESIS-BELOW -->` marker is empty. Invoke the `sungen-figma-source` skill to fill it:
74
+ After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is deterministic but the narrative below the `<!-- SYNTHESIS-BELOW -->` marker is empty. Invoke the `sungen-capture` skill (mode figma-pat) to fill it:
75
75
 
76
76
  1. Read `qa/screens/<screen>/requirements/spec_figma.md` — note `file_key`, `node_id`, `figma_version_id` from frontmatter.
77
77
  2. Read the cached raw node JSON at `.sungen/figma-cache/<file_key>/<figma_version_id>/<safe_node_id>-raw.json` (colons in node_id become underscores).
@@ -88,11 +88,11 @@ After `sungen add --figma` succeeds, the envelope of `spec_figma.md` is determin
88
88
 
89
89
  **If Figma branch (Step 1) already downloaded PNGs** → visuals already exist. Use `AskUserQuestion` to offer:
90
90
  - **Continue** — Figma visuals are enough (Recommended)
91
- - **Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture-live` skill)
91
+ - **Also capture live page** — supplement Figma with real page scan (invoke `sungen-capture` skill (mode live))
92
92
 
93
93
  **If standard path (no `--figma`)** → go straight to source selection. Use `AskUserQuestion`: *"Pick a visual source for this screen:"*
94
- - **Figma design** (Recommended for pre-launch) — invoke `sungen-capture-figma` skill
95
- - **Live page scan** (dev/staging is up) — invoke `sungen-capture-live` skill
94
+ - **Figma design** (Recommended for pre-launch) — invoke `sungen-capture` skill (mode figma-mcp)
95
+ - **Live page scan** (dev/staging is up) — invoke `sungen-capture` skill (mode live)
96
96
  - **Skip** — user will drop images manually into `requirements/ui/` later
97
97
 
98
98
  Each capture skill writes outputs into `qa/screens/<screen>/requirements/ui/` and reports back a summary. Do not inline capture logic here — always delegate to the skill so behavior stays consistent with `/sungen:create-test`.