@sun-asterisk/sungen 2.7.0-beta.0 → 3.0.0-beta.71

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 (256) 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/challenge.d.ts +3 -0
  13. package/dist/cli/commands/challenge.d.ts.map +1 -0
  14. package/dist/cli/commands/challenge.js +102 -0
  15. package/dist/cli/commands/challenge.js.map +1 -0
  16. package/dist/cli/commands/feedback.d.ts +3 -0
  17. package/dist/cli/commands/feedback.d.ts.map +1 -0
  18. package/dist/cli/commands/feedback.js +72 -0
  19. package/dist/cli/commands/feedback.js.map +1 -0
  20. package/dist/cli/commands/generate.d.ts.map +1 -1
  21. package/dist/cli/commands/generate.js +22 -0
  22. package/dist/cli/commands/generate.js.map +1 -1
  23. package/dist/cli/commands/ledger.d.ts +3 -0
  24. package/dist/cli/commands/ledger.d.ts.map +1 -0
  25. package/dist/cli/commands/ledger.js +71 -0
  26. package/dist/cli/commands/ledger.js.map +1 -0
  27. package/dist/cli/commands/manifest.d.ts +3 -0
  28. package/dist/cli/commands/manifest.d.ts.map +1 -0
  29. package/dist/cli/commands/manifest.js +101 -0
  30. package/dist/cli/commands/manifest.js.map +1 -0
  31. package/dist/cli/commands/script-check.d.ts +3 -0
  32. package/dist/cli/commands/script-check.d.ts.map +1 -0
  33. package/dist/cli/commands/script-check.js +97 -0
  34. package/dist/cli/commands/script-check.js.map +1 -0
  35. package/dist/cli/commands/trace.d.ts +3 -0
  36. package/dist/cli/commands/trace.d.ts.map +1 -0
  37. package/dist/cli/commands/trace.js +110 -0
  38. package/dist/cli/commands/trace.js.map +1 -0
  39. package/dist/cli/commands/update.d.ts.map +1 -1
  40. package/dist/cli/commands/update.js +22 -9
  41. package/dist/cli/commands/update.js.map +1 -1
  42. package/dist/cli/index.js +16 -0
  43. package/dist/cli/index.js.map +1 -1
  44. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  45. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  46. package/dist/generators/test-generator/patterns/capture-patterns.d.ts +16 -0
  47. package/dist/generators/test-generator/patterns/capture-patterns.d.ts.map +1 -0
  48. package/dist/generators/test-generator/patterns/capture-patterns.js +54 -0
  49. package/dist/generators/test-generator/patterns/capture-patterns.js.map +1 -0
  50. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  51. package/dist/generators/test-generator/patterns/index.js +2 -0
  52. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  53. package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
  54. package/dist/generators/test-generator/step-mapper.js +1 -0
  55. package/dist/generators/test-generator/step-mapper.js.map +1 -1
  56. package/dist/generators/test-generator/utils/data-resolver.d.ts +5 -0
  57. package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
  58. package/dist/generators/test-generator/utils/data-resolver.js +17 -0
  59. package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
  60. package/dist/harness/audit.d.ts +24 -0
  61. package/dist/harness/audit.d.ts.map +1 -0
  62. package/dist/harness/audit.js +115 -0
  63. package/dist/harness/audit.js.map +1 -0
  64. package/dist/harness/blindspot.d.ts +15 -0
  65. package/dist/harness/blindspot.d.ts.map +1 -0
  66. package/dist/harness/blindspot.js +85 -0
  67. package/dist/harness/blindspot.js.map +1 -0
  68. package/dist/harness/catalog/universal-viewpoints.yaml +114 -0
  69. package/dist/harness/challenge.d.ts +21 -0
  70. package/dist/harness/challenge.d.ts.map +1 -0
  71. package/dist/harness/challenge.js +151 -0
  72. package/dist/harness/challenge.js.map +1 -0
  73. package/dist/harness/feedback.d.ts +29 -0
  74. package/dist/harness/feedback.d.ts.map +1 -0
  75. package/dist/harness/feedback.js +106 -0
  76. package/dist/harness/feedback.js.map +1 -0
  77. package/dist/harness/intent.d.ts +11 -0
  78. package/dist/harness/intent.d.ts.map +1 -0
  79. package/dist/harness/intent.js +86 -0
  80. package/dist/harness/intent.js.map +1 -0
  81. package/dist/harness/ledger.d.ts +42 -0
  82. package/dist/harness/ledger.d.ts.map +1 -0
  83. package/dist/harness/ledger.js +171 -0
  84. package/dist/harness/ledger.js.map +1 -0
  85. package/dist/harness/manifest.d.ts +42 -0
  86. package/dist/harness/manifest.d.ts.map +1 -0
  87. package/dist/harness/manifest.js +209 -0
  88. package/dist/harness/manifest.js.map +1 -0
  89. package/dist/harness/parse.d.ts +22 -0
  90. package/dist/harness/parse.d.ts.map +1 -0
  91. package/dist/harness/parse.js +163 -0
  92. package/dist/harness/parse.js.map +1 -0
  93. package/dist/harness/script-check.d.ts +16 -0
  94. package/dist/harness/script-check.d.ts.map +1 -0
  95. package/dist/harness/script-check.js +169 -0
  96. package/dist/harness/script-check.js.map +1 -0
  97. package/dist/harness/secret-scan.d.ts +8 -0
  98. package/dist/harness/secret-scan.d.ts.map +1 -0
  99. package/dist/harness/secret-scan.js +88 -0
  100. package/dist/harness/secret-scan.js.map +1 -0
  101. package/dist/harness/sensors.d.ts +88 -0
  102. package/dist/harness/sensors.d.ts.map +1 -0
  103. package/dist/harness/sensors.js +232 -0
  104. package/dist/harness/sensors.js.map +1 -0
  105. package/dist/harness/trace.d.ts +31 -0
  106. package/dist/harness/trace.d.ts.map +1 -0
  107. package/dist/harness/trace.js +173 -0
  108. package/dist/harness/trace.js.map +1 -0
  109. package/dist/orchestrator/ai-rules-updater.d.ts +1 -0
  110. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  111. package/dist/orchestrator/ai-rules-updater.js +55 -11
  112. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  113. package/dist/orchestrator/figma/spec-figma-renderer.d.ts +2 -2
  114. package/dist/orchestrator/figma/spec-figma-renderer.js +2 -2
  115. package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +1 -1
  116. package/dist/orchestrator/figma/spec-figma-section-renderers.js +1 -1
  117. package/dist/orchestrator/project-initializer.d.ts +5 -0
  118. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  119. package/dist/orchestrator/project-initializer.js +26 -6
  120. package/dist/orchestrator/project-initializer.js.map +1 -1
  121. package/dist/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  122. package/dist/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  123. package/dist/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  124. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  125. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  126. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +45 -13
  127. package/dist/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  128. package/dist/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  129. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  130. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +8 -3
  131. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  132. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  133. package/dist/orchestrator/templates/ai-instructions/{github-skill-sungen-figma-source.md → claude-skill-capture-mode-figma-pat.md} +14 -48
  134. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  135. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  136. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  137. package/dist/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  138. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  139. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  140. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +53 -1
  141. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  142. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  143. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +27 -11
  144. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  145. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  146. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  147. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +6 -3
  148. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  149. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  150. 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
  151. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  152. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  153. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  154. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  155. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +62 -16
  156. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  157. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  158. package/dist/orchestrator/templates/qa-context.md +90 -0
  159. package/dist/orchestrator/templates/readme.md +16 -13
  160. package/dist/orchestrator/templates/specs-test-data.ts +9 -0
  161. package/dist/tools/figma/figma-auth.d.ts +5 -2
  162. package/dist/tools/figma/figma-auth.d.ts.map +1 -1
  163. package/dist/tools/figma/figma-auth.js +19 -9
  164. package/dist/tools/figma/figma-auth.js.map +1 -1
  165. package/docs/orchestration-spec.md +267 -0
  166. package/package.json +10 -6
  167. package/src/cli/commands/add.ts +3 -3
  168. package/src/cli/commands/audit.ts +92 -0
  169. package/src/cli/commands/blindspot.ts +48 -0
  170. package/src/cli/commands/challenge.ts +55 -0
  171. package/src/cli/commands/feedback.ts +65 -0
  172. package/src/cli/commands/generate.ts +19 -0
  173. package/src/cli/commands/ledger.ts +61 -0
  174. package/src/cli/commands/manifest.ts +55 -0
  175. package/src/cli/commands/script-check.ts +50 -0
  176. package/src/cli/commands/trace.ts +60 -0
  177. package/src/cli/commands/update.ts +30 -10
  178. package/src/cli/index.ts +16 -0
  179. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
  180. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
  181. package/src/generators/test-generator/patterns/capture-patterns.ts +59 -0
  182. package/src/generators/test-generator/patterns/index.ts +2 -0
  183. package/src/generators/test-generator/step-mapper.ts +1 -0
  184. package/src/generators/test-generator/utils/data-resolver.ts +20 -0
  185. package/src/harness/audit.ts +112 -0
  186. package/src/harness/blindspot.ts +51 -0
  187. package/src/harness/catalog/universal-viewpoints.yaml +114 -0
  188. package/src/harness/challenge.ts +131 -0
  189. package/src/harness/feedback.ts +84 -0
  190. package/src/harness/intent.ts +58 -0
  191. package/src/harness/ledger.ts +155 -0
  192. package/src/harness/manifest.ts +173 -0
  193. package/src/harness/parse.ts +145 -0
  194. package/src/harness/script-check.ts +149 -0
  195. package/src/harness/secret-scan.ts +51 -0
  196. package/src/harness/sensors.ts +279 -0
  197. package/src/harness/trace.ts +138 -0
  198. package/src/orchestrator/ai-rules-updater.ts +57 -10
  199. package/src/orchestrator/figma/spec-figma-renderer.ts +2 -2
  200. package/src/orchestrator/figma/spec-figma-section-renderers.ts +1 -1
  201. package/src/orchestrator/project-initializer.ts +30 -7
  202. package/src/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
  203. package/src/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
  204. package/src/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
  205. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
  206. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
  207. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +45 -13
  208. package/src/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
  209. package/src/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
  210. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
  211. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +8 -3
  212. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -4
  213. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
  214. 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
  215. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
  216. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
  217. package/src/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
  218. package/src/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
  219. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  220. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  221. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +53 -1
  222. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
  223. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
  224. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +27 -11
  225. package/src/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
  226. package/src/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
  227. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
  228. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +6 -3
  229. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
  230. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
  231. 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
  232. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
  233. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
  234. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
  235. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
  236. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +62 -16
  237. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  238. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
  239. package/src/orchestrator/templates/qa-context.md +90 -0
  240. package/src/orchestrator/templates/readme.md +16 -13
  241. package/src/orchestrator/templates/specs-test-data.ts +9 -0
  242. package/src/tools/figma/figma-auth.ts +20 -9
  243. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  244. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  245. package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  246. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  247. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  248. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  249. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
  250. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
  251. package/src/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
  252. package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +0 -151
  253. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
  254. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
  255. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
  256. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +0 -151
@@ -0,0 +1,21 @@
1
+ export interface ChallengeFinding {
2
+ scenario?: string;
3
+ issue: string;
4
+ suggestion: string;
5
+ }
6
+ export interface ChallengeReport {
7
+ screen: string;
8
+ overCovered: {
9
+ bucket: string;
10
+ count: number;
11
+ note: string;
12
+ }[];
13
+ shallowThemes: string[];
14
+ collectionClaimSingular: ChallengeFinding[];
15
+ noveltyPrompts: string[];
16
+ explorationReadiness: string[];
17
+ }
18
+ export declare function buildChallenge(screenDir: string, screenName: string): ChallengeReport;
19
+ /** Render the Challenge Report as Markdown (advisory — not part of the official suite). */
20
+ export declare function renderChallengeMarkdown(r: ChallengeReport): string;
21
+ //# sourceMappingURL=challenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/harness/challenge.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB,uBAAuB,EAAE,gBAAgB,EAAE,CAAC;IAE5C,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAkBD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CA2CrF;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CA0BlE"}
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildChallenge = buildChallenge;
37
+ exports.renderChallengeMarkdown = renderChallengeMarkdown;
38
+ /**
39
+ * Challenge / Exploration Harness (harness-roadmap P4) — Loop 2.
40
+ *
41
+ * Production mode (Loop 1: create-test → audit gate → repair) is deterministic by
42
+ * design: same spec + viewpoint → same official suite. That is the *feature* for
43
+ * delivery/CI, but it can feel like "a machine that always outputs the same thing".
44
+ *
45
+ * The Challenge Harness is the antidote: it does NOT regenerate the suite — it
46
+ * ATTACKS the existing one to surface what production missed. It is advisory
47
+ * (never auto-merges) and read-only.
48
+ *
49
+ * This module is the DETERMINISTIC spine — three structural critics:
50
+ * 1. Coverage — over-covered (low-value) areas + shallow gate themes.
51
+ * 2. Depth — titles that claim a collection but assert a single element.
52
+ * 3. Novelty — risk-based prompts the AI `sungen-challenge` agent expands into
53
+ * concrete novelty candidates (semantic — not deterministic here).
54
+ *
55
+ * The AI agent layer adds the semantic + novelty judgement on top of this spine.
56
+ */
57
+ const path = __importStar(require("path"));
58
+ const parse_1 = require("./parse");
59
+ const audit_1 = require("./audit");
60
+ // A collection claim = a PLURAL set noun (or an explicit quantifier) used with a
61
+ // DISPLAY verb. Plural-only avoids false-positives on single-item actions like
62
+ // "Adding A product ... shows the dialog" (which correctly asserts one item).
63
+ const PLURAL_NOUN = /\b(cards|items|products|rows|results|prices|entries|records)\b/i;
64
+ const QUANTIFIER = /\b(all|every|each)\b/i;
65
+ const DISPLAY_VERB = /\b(displays?|shows?|lists?|grid|contains?)\b/i;
66
+ /** Risk lenses the Novelty critic prompts the AI to explore (beyond the catalog). */
67
+ const NOVELTY_LENSES = [
68
+ 'double-submit / rapid repeat of the primary action (duplicate side-effects?)',
69
+ 'state after partial / slow load (assert against a not-yet-ready page)',
70
+ 'boundary & unusual data (very long text, 0 / max quantity, special chars)',
71
+ 'concurrency / back-button / refresh mid-flow',
72
+ 'historical-incident mindset — what has broken on similar screens before?',
73
+ ];
74
+ function buildChallenge(screenDir, screenName) {
75
+ const featurePath = path.join(screenDir, 'features', `${screenName}.feature`);
76
+ const scenarios = (0, parse_1.loadScenarios)(featurePath);
77
+ const audit = (0, audit_1.runAudit)(screenDir, screenName);
78
+ // 1. Coverage critic — over-covered buckets (secondary >> business-core) + shallow themes.
79
+ const buckets = audit.balance.byBucket;
80
+ const core = buckets['business-core'] || 0;
81
+ const overCovered = [];
82
+ for (const [bucket, count] of Object.entries(buckets)) {
83
+ if (['business-core', 'other'].includes(bucket))
84
+ continue;
85
+ if (core > 0 && count > core * 1.5) {
86
+ overCovered.push({ bucket, count, note: `${count} scenarios vs ${core} business-core — likely low-value expansion; trim toward correctness.` });
87
+ }
88
+ }
89
+ const shallowThemes = audit.gate.gaps.filter((g) => g.status === 'shallow').map((g) => g.theme);
90
+ // 2. Depth critic — title claims a collection but the assertion is singular (no "see all").
91
+ const collectionClaimSingular = [];
92
+ for (const s of scenarios) {
93
+ if (s.manual || s.category === 'NAV')
94
+ continue;
95
+ const claimsCollection = (PLURAL_NOUN.test(s.name) || QUANTIFIER.test(s.name)) && DISPLAY_VERB.test(s.name);
96
+ const assertsAll = /\bsee all\b/.test(s.haystack);
97
+ if (claimsCollection && !assertsAll) {
98
+ collectionClaimSingular.push({
99
+ scenario: s.name,
100
+ issue: 'Title implies a set (cards/items/all) but the assertion targets a single element.',
101
+ suggestion: 'Prove EVERY member: `Then User see all [<Card/Row>] contain {{...}}` instead of a single `see [X]`.',
102
+ });
103
+ }
104
+ }
105
+ // 3. Novelty critic — deterministic prompts; the AI agent expands these into candidates.
106
+ const noveltyPrompts = NOVELTY_LENSES.map((l) => `Find 1 non-obvious, valuable scenario via: ${l}`);
107
+ // Roll-up — exploration readiness signals (not a fake score).
108
+ const explorationReadiness = [];
109
+ if (collectionClaimSingular.length)
110
+ explorationReadiness.push(`${collectionClaimSingular.length} title↔assertion gap(s) — deterministic depth critic flagged these; an AI Business-Depth critic should confirm + fix.`);
111
+ if (overCovered.length)
112
+ explorationReadiness.push(`${overCovered.length} possibly over-covered area(s) — rebalance toward correctness.`);
113
+ if (shallowThemes.length)
114
+ explorationReadiness.push(`Shallow themes: ${shallowThemes.join(', ')}.`);
115
+ explorationReadiness.push('Novelty candidates are NOT generated deterministically — run the `sungen-challenge` agent (Claude) or its inline criteria (Copilot) to propose them, then QA accept/reject (≤20% of official, no auto-merge).');
116
+ return { screen: screenName, overCovered, shallowThemes, collectionClaimSingular, noveltyPrompts, explorationReadiness };
117
+ }
118
+ /** Render the Challenge Report as Markdown (advisory — not part of the official suite). */
119
+ function renderChallengeMarkdown(r) {
120
+ const lines = [];
121
+ lines.push(`# Challenge Report — ${r.screen}`, '');
122
+ lines.push('> Advisory (Loop 2 / exploration mode). Does NOT change the official suite — it attacks it to surface blind spots. QA decides what to adopt.', '');
123
+ lines.push('## Depth — title claims a collection but asserts a single element');
124
+ if (r.collectionClaimSingular.length) {
125
+ lines.push('| Scenario | Issue | Suggested |', '|---|---|---|');
126
+ for (const f of r.collectionClaimSingular)
127
+ lines.push(`| ${f.scenario} | ${f.issue} | ${f.suggestion} |`);
128
+ }
129
+ else
130
+ lines.push('_none_');
131
+ lines.push('');
132
+ lines.push('## Coverage — possibly over-covered / shallow');
133
+ if (r.overCovered.length)
134
+ for (const o of r.overCovered)
135
+ lines.push(`- **${o.bucket}** — ${o.note}`);
136
+ if (r.shallowThemes.length)
137
+ lines.push(`- Shallow themes: ${r.shallowThemes.join(', ')}`);
138
+ if (!r.overCovered.length && !r.shallowThemes.length)
139
+ lines.push('_balanced_');
140
+ lines.push('');
141
+ lines.push('## Novelty — prompts for the AI critic (expand into candidates, ≤20% of official, no auto-merge)');
142
+ for (const p of r.noveltyPrompts)
143
+ lines.push(`- ${p}`);
144
+ lines.push('');
145
+ lines.push('## Exploration readiness');
146
+ for (const e of r.explorationReadiness)
147
+ lines.push(`- ${e}`);
148
+ lines.push('');
149
+ return lines.join('\n');
150
+ }
151
+ //# sourceMappingURL=challenge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/harness/challenge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,wCA2CC;AAGD,0DA0BC;AAlID;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CAA6B;AAC7B,mCAAsD;AACtD,mCAAmC;AAqBnC,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,WAAW,GAAG,iEAAiE,CAAC;AACtF,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAC3C,MAAM,YAAY,GAAG,+CAA+C,CAAC;AAErE,qFAAqF;AACrF,MAAM,cAAc,GAAG;IACrB,8EAA8E;IAC9E,uEAAuE;IACvE,2EAA2E;IAC3E,8CAA8C;IAC9C,0EAA0E;CAC3E,CAAC;AAEF,SAAgB,cAAc,CAAC,SAAiB,EAAE,UAAkB;IAClE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,UAAU,UAAU,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAmB,IAAA,qBAAa,EAAC,WAAW,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAA,gBAAQ,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAE9C,2FAA2F;IAC3F,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;IACvC,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAmC,EAAE,CAAC;IACvD,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,QAAQ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 'accept' | 'reject' | 'edit' | 'add' | 'none';
3
+ export interface FeedbackEntry {
4
+ ts: string;
5
+ type: FeedbackType;
6
+ screen?: string;
7
+ target?: string;
8
+ decision?: FeedbackDecision;
9
+ message: string;
10
+ reason?: string;
11
+ source: string;
12
+ auditScore?: number;
13
+ }
14
+ export declare function recordFeedback(entry: Omit<FeedbackEntry, 'ts' | 'source' | 'auditScore'> & {
15
+ ts?: string;
16
+ source?: string;
17
+ }): string;
18
+ export declare function readFeedback(): FeedbackEntry[];
19
+ export interface FeedbackSummary {
20
+ total: number;
21
+ byType: Record<string, number>;
22
+ byDecision: Record<string, number>;
23
+ entries: FeedbackEntry[];
24
+ }
25
+ export declare function summarize(filter?: {
26
+ screen?: string;
27
+ type?: FeedbackType;
28
+ }): FeedbackSummary;
29
+ //# sourceMappingURL=feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/harness/feedback.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpI;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAI9C;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAA;CAAE,GAAG,eAAe,CAW5F"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.recordFeedback = recordFeedback;
37
+ exports.readFeedback = readFeedback;
38
+ exports.summarize = summarize;
39
+ /**
40
+ * Feedback — local-first capture of QA feedback. The most valuable use of
41
+ * feedback is closing the learning loop WITHIN a project (feed reuse/regenerate
42
+ * + improve the Guide), which needs no server. A future opt-in `feedback sync`
43
+ * can push anonymized metadata to a central API (Nấc 2) — not implemented here.
44
+ *
45
+ * Two purposes are kept distinct:
46
+ * - test-design: a viewpoint/scenario is wrong / missing / duplicate → knowledge
47
+ * - product: Sungen itself did X wrong → telemetry/issue
48
+ *
49
+ * Storage: .sungen/feedback/feedback.jsonl (append-only)
50
+ */
51
+ const fs = __importStar(require("fs"));
52
+ const path = __importStar(require("path"));
53
+ function feedbackPath() {
54
+ return path.join(process.cwd(), '.sungen', 'feedback', 'feedback.jsonl');
55
+ }
56
+ function currentAuditScore(screen) {
57
+ if (!screen)
58
+ return undefined;
59
+ const p = path.join(process.cwd(), '.sungen', 'reports', `${screen}-audit.json`);
60
+ if (!fs.existsSync(p))
61
+ return undefined;
62
+ try {
63
+ return JSON.parse(fs.readFileSync(p, 'utf-8'))?.score?.overall;
64
+ }
65
+ catch {
66
+ return undefined;
67
+ }
68
+ }
69
+ function recordFeedback(entry) {
70
+ const p = feedbackPath();
71
+ fs.mkdirSync(path.dirname(p), { recursive: true });
72
+ const full = {
73
+ ts: entry.ts ?? new Date().toISOString(),
74
+ type: entry.type,
75
+ screen: entry.screen,
76
+ target: entry.target,
77
+ decision: entry.decision ?? 'none',
78
+ message: entry.message,
79
+ reason: entry.reason,
80
+ source: entry.source ?? 'qa',
81
+ auditScore: currentAuditScore(entry.screen),
82
+ };
83
+ fs.appendFileSync(p, JSON.stringify(full) + '\n', 'utf-8');
84
+ return p;
85
+ }
86
+ function readFeedback() {
87
+ const p = feedbackPath();
88
+ if (!fs.existsSync(p))
89
+ return [];
90
+ return fs.readFileSync(p, 'utf-8').split('\n').filter(Boolean).map((l) => JSON.parse(l));
91
+ }
92
+ function summarize(filter) {
93
+ let entries = readFeedback();
94
+ if (filter?.screen)
95
+ entries = entries.filter((e) => e.screen === filter.screen);
96
+ if (filter?.type)
97
+ entries = entries.filter((e) => e.type === filter.type);
98
+ const byType = {};
99
+ const byDecision = {};
100
+ for (const e of entries) {
101
+ byType[e.type] = (byType[e.type] || 0) + 1;
102
+ byDecision[e.decision || 'none'] = (byDecision[e.decision || 'none'] || 0) + 1;
103
+ }
104
+ return { total: entries.length, byType, byDecision, entries };
105
+ }
106
+ //# sourceMappingURL=feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../src/harness/feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,wCAgBC;AAED,oCAIC;AASD,8BAWC;AAnFD;;;;;;;;;;;GAWG;AACH,uCAAyB;AACzB,2CAA6B;AAiB7B,SAAS,YAAY;IACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAe;IACxC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,CAAC;IACjF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,OAAO,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,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC;AASD,SAAgB,SAAS,CAAC,MAAiD;IACzE,IAAI,OAAO,GAAG,YAAY,EAAE,CAAC;IAC7B,IAAI,MAAM,EAAE,MAAM;QAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC;IAChF,IAAI,MAAM,EAAE,IAAI;QAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3C,UAAU,CAAC,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type IntentFocus = 'functional' | 'e-commerce' | 'security' | 'smoke';
2
+ export interface IntentProfile {
3
+ focus: IntentFocus;
4
+ riskTier: 'high' | 'normal' | 'low';
5
+ tierScope: 'tier-1' | 'full';
6
+ source: 'context.md' | 'default';
7
+ }
8
+ /** Resolve project root from a screen/flow dir (…/qa/screens/<name>). */
9
+ export declare function projectRootFromScreenDir(screenDir: string): string;
10
+ export declare function readIntent(projectRoot: string): IntentProfile;
11
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../src/harness/intent.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAClC;AAQD,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAoB7D"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.projectRootFromScreenDir = projectRootFromScreenDir;
37
+ exports.readIntent = readIntent;
38
+ /**
39
+ * Intent Profile (harness-roadmap P3) — lets the gate flex to project intent.
40
+ *
41
+ * Read from qa/context.md so a project can declare what it cares about:
42
+ *
43
+ * ## Intent
44
+ * focus: security # functional | e-commerce | security | smoke
45
+ * risk_tier: high # high | normal | low (reserved — future weighting)
46
+ * tier_scope: full # tier-1 | full (reserved)
47
+ *
48
+ * Keys may appear anywhere in context.md (a heading is optional). Unknown / missing
49
+ * values fall back to the safe default (functional), so behaviour is unchanged for
50
+ * projects that haven't declared an intent.
51
+ */
52
+ const fs = __importStar(require("fs"));
53
+ const path = __importStar(require("path"));
54
+ const DEFAULT_INTENT = {
55
+ focus: 'functional', riskTier: 'normal', tierScope: 'full', source: 'default',
56
+ };
57
+ const FOCI = ['functional', 'e-commerce', 'security', 'smoke'];
58
+ /** Resolve project root from a screen/flow dir (…/qa/screens/<name>). */
59
+ function projectRootFromScreenDir(screenDir) {
60
+ return path.resolve(screenDir, '..', '..', '..');
61
+ }
62
+ function readIntent(projectRoot) {
63
+ const ctx = path.join(projectRoot, 'qa', 'context.md');
64
+ if (!fs.existsSync(ctx))
65
+ return DEFAULT_INTENT;
66
+ let text;
67
+ try {
68
+ text = fs.readFileSync(ctx, 'utf-8').toLowerCase();
69
+ }
70
+ catch {
71
+ return DEFAULT_INTENT;
72
+ }
73
+ const grab = (key) => {
74
+ const m = text.match(new RegExp(`(?:^|\\n)\\s*${key}\\s*:\\s*([a-z0-9-]+)`));
75
+ return m?.[1];
76
+ };
77
+ const focusRaw = grab('focus');
78
+ const focus = (FOCI.includes(focusRaw) ? focusRaw : DEFAULT_INTENT.focus);
79
+ const risk = grab('risk_tier');
80
+ const riskTier = (['high', 'normal', 'low'].includes(risk) ? risk : DEFAULT_INTENT.riskTier);
81
+ const scope = grab('tier_scope');
82
+ const tierScope = (['tier-1', 'full'].includes(scope) ? scope : DEFAULT_INTENT.tierScope);
83
+ const found = focusRaw || risk || scope;
84
+ return { focus, riskTier, tierScope, source: found ? 'context.md' : 'default' };
85
+ }
86
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../src/harness/intent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,4DAEC;AAED,gCAoBC;AAzDD;;;;;;;;;;;;;GAaG;AACH,uCAAyB;AACzB,2CAA6B;AAW7B,MAAM,cAAc,GAAkB;IACpC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS;CAC9E,CAAC;AAEF,MAAM,IAAI,GAAkB,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAE9E,yEAAyE;AACzE,SAAgB,wBAAwB,CAAC,SAAiB;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,UAAU,CAAC,WAAmB;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,cAAc,CAAC;IAC/C,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QAAC,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAA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;
3
+ step: string;
4
+ runId?: string;
5
+ model?: string;
6
+ tokensIn?: number;
7
+ tokensOut?: number;
8
+ ms?: number;
9
+ note?: string;
10
+ }
11
+ /** Split events into runs — by runId when present, else by timestamp gap. */
12
+ export declare function segmentRuns(events: LedgerEvent[]): LedgerEvent[][];
13
+ /** Events of the most recent run only. */
14
+ export declare function latestRunEvents(events: LedgerEvent[]): LedgerEvent[];
15
+ export declare function recordEvent(screen: string, ev: Omit<LedgerEvent, 'ts'> & {
16
+ ts?: string;
17
+ }): string;
18
+ export declare function readEvents(screen: string): LedgerEvent[];
19
+ export interface LedgerReport {
20
+ screen: string;
21
+ runs: number;
22
+ runScope: 'latest' | 'all';
23
+ events: number;
24
+ totalTokens: number;
25
+ totalMs: number;
26
+ byStep: Record<string, {
27
+ tokens: number;
28
+ ms: number;
29
+ count: number;
30
+ }>;
31
+ repairRounds: number;
32
+ repairTokenPct: number;
33
+ coveredCriticalViewpoints: number | null;
34
+ tokensPerCoveredCritical: number | null;
35
+ scenarioCount: number | null;
36
+ tokensPerScenario: number | null;
37
+ verdicts: string[];
38
+ }
39
+ export declare function buildReport(screen: string, opts?: {
40
+ allRuns?: boolean;
41
+ }): LedgerReport;
42
+ //# sourceMappingURL=ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/harness/ledger.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAOD,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAA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