@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.
- package/README.md +1 -1
- package/dist/cli/commands/add.js +3 -3
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/audit.d.ts +3 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +134 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/blindspot.d.ts +3 -0
- package/dist/cli/commands/blindspot.d.ts.map +1 -0
- package/dist/cli/commands/blindspot.js +58 -0
- package/dist/cli/commands/blindspot.js.map +1 -0
- package/dist/cli/commands/capability.d.ts +3 -0
- package/dist/cli/commands/capability.d.ts.map +1 -0
- package/dist/cli/commands/capability.js +196 -0
- package/dist/cli/commands/capability.js.map +1 -0
- package/dist/cli/commands/challenge.d.ts +3 -0
- package/dist/cli/commands/challenge.d.ts.map +1 -0
- package/dist/cli/commands/challenge.js +102 -0
- package/dist/cli/commands/challenge.js.map +1 -0
- package/dist/cli/commands/feedback.d.ts +3 -0
- package/dist/cli/commands/feedback.d.ts.map +1 -0
- package/dist/cli/commands/feedback.js +72 -0
- package/dist/cli/commands/feedback.js.map +1 -0
- package/dist/cli/commands/flow-check.d.ts +3 -0
- package/dist/cli/commands/flow-check.d.ts.map +1 -0
- package/dist/cli/commands/flow-check.js +136 -0
- package/dist/cli/commands/flow-check.js.map +1 -0
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +50 -2
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/ledger.d.ts +3 -0
- package/dist/cli/commands/ledger.d.ts.map +1 -0
- package/dist/cli/commands/ledger.js +71 -0
- package/dist/cli/commands/ledger.js.map +1 -0
- package/dist/cli/commands/manifest.d.ts +3 -0
- package/dist/cli/commands/manifest.d.ts.map +1 -0
- package/dist/cli/commands/manifest.js +101 -0
- package/dist/cli/commands/manifest.js.map +1 -0
- package/dist/cli/commands/script-check.d.ts +3 -0
- package/dist/cli/commands/script-check.d.ts.map +1 -0
- package/dist/cli/commands/script-check.js +97 -0
- package/dist/cli/commands/script-check.js.map +1 -0
- package/dist/cli/commands/trace.d.ts +3 -0
- package/dist/cli/commands/trace.d.ts.map +1 -0
- package/dist/cli/commands/trace.js +110 -0
- package/dist/cli/commands/trace.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +22 -9
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +20 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/adapter-interface.d.ts +1 -0
- package/dist/generators/test-generator/adapters/adapter-interface.d.ts.map +1 -1
- package/dist/generators/test-generator/adapters/adapter-registry.d.ts +13 -0
- package/dist/generators/test-generator/adapters/adapter-registry.d.ts.map +1 -1
- package/dist/generators/test-generator/adapters/adapter-registry.js +73 -1
- package/dist/generators/test-generator/adapters/adapter-registry.js.map +1 -1
- package/dist/generators/test-generator/adapters/index.d.ts +1 -1
- package/dist/generators/test-generator/adapters/index.d.ts.map +1 -1
- package/dist/generators/test-generator/adapters/index.js +5 -1
- package/dist/generators/test-generator/adapters/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
- package/dist/generators/test-generator/adapters/playwright/templates/test-file.hbs +6 -0
- package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
- package/dist/generators/test-generator/code-generator.js +6 -2
- package/dist/generators/test-generator/code-generator.js.map +1 -1
- package/dist/generators/test-generator/patterns/capture-patterns.d.ts +16 -0
- package/dist/generators/test-generator/patterns/capture-patterns.d.ts.map +1 -0
- package/dist/generators/test-generator/patterns/capture-patterns.js +54 -0
- package/dist/generators/test-generator/patterns/capture-patterns.js.map +1 -0
- package/dist/generators/test-generator/patterns/form-patterns.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/form-patterns.js +3 -1
- package/dist/generators/test-generator/patterns/form-patterns.js.map +1 -1
- package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/index.js +2 -0
- package/dist/generators/test-generator/patterns/index.js.map +1 -1
- package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
- package/dist/generators/test-generator/step-mapper.js +1 -0
- package/dist/generators/test-generator/step-mapper.js.map +1 -1
- package/dist/generators/test-generator/utils/data-resolver.d.ts +5 -0
- package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/data-resolver.js +17 -0
- package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
- package/dist/generators/test-generator/utils/runtime-data-transformer.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/runtime-data-transformer.js +4 -0
- package/dist/generators/test-generator/utils/runtime-data-transformer.js.map +1 -1
- package/dist/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/selector-resolver.js +12 -6
- package/dist/generators/test-generator/utils/selector-resolver.js.map +1 -1
- package/dist/harness/audit.d.ts +24 -0
- package/dist/harness/audit.d.ts.map +1 -0
- package/dist/harness/audit.js +115 -0
- package/dist/harness/audit.js.map +1 -0
- package/dist/harness/blindspot.d.ts +15 -0
- package/dist/harness/blindspot.d.ts.map +1 -0
- package/dist/harness/blindspot.js +85 -0
- package/dist/harness/blindspot.js.map +1 -0
- package/dist/harness/capability-plan.d.ts +49 -0
- package/dist/harness/capability-plan.d.ts.map +1 -0
- package/dist/harness/capability-plan.js +215 -0
- package/dist/harness/capability-plan.js.map +1 -0
- package/dist/harness/capability.d.ts +23 -0
- package/dist/harness/capability.d.ts.map +1 -0
- package/dist/harness/capability.js +98 -0
- package/dist/harness/capability.js.map +1 -0
- package/dist/harness/catalog/drivers.yaml +57 -0
- package/dist/harness/catalog/universal-viewpoints.yaml +114 -0
- package/dist/harness/challenge.d.ts +21 -0
- package/dist/harness/challenge.d.ts.map +1 -0
- package/dist/harness/challenge.js +151 -0
- package/dist/harness/challenge.js.map +1 -0
- package/dist/harness/feedback.d.ts +29 -0
- package/dist/harness/feedback.d.ts.map +1 -0
- package/dist/harness/feedback.js +106 -0
- package/dist/harness/feedback.js.map +1 -0
- package/dist/harness/flow-check.d.ts +23 -0
- package/dist/harness/flow-check.d.ts.map +1 -0
- package/dist/harness/flow-check.js +132 -0
- package/dist/harness/flow-check.js.map +1 -0
- package/dist/harness/flow-plan.d.ts +23 -0
- package/dist/harness/flow-plan.d.ts.map +1 -0
- package/dist/harness/flow-plan.js +166 -0
- package/dist/harness/flow-plan.js.map +1 -0
- package/dist/harness/intent.d.ts +11 -0
- package/dist/harness/intent.d.ts.map +1 -0
- package/dist/harness/intent.js +86 -0
- package/dist/harness/intent.js.map +1 -0
- package/dist/harness/ledger.d.ts +42 -0
- package/dist/harness/ledger.d.ts.map +1 -0
- package/dist/harness/ledger.js +171 -0
- package/dist/harness/ledger.js.map +1 -0
- package/dist/harness/manifest.d.ts +42 -0
- package/dist/harness/manifest.d.ts.map +1 -0
- package/dist/harness/manifest.js +209 -0
- package/dist/harness/manifest.js.map +1 -0
- package/dist/harness/parse.d.ts +22 -0
- package/dist/harness/parse.d.ts.map +1 -0
- package/dist/harness/parse.js +163 -0
- package/dist/harness/parse.js.map +1 -0
- package/dist/harness/script-check.d.ts +39 -0
- package/dist/harness/script-check.d.ts.map +1 -0
- package/dist/harness/script-check.js +251 -0
- package/dist/harness/script-check.js.map +1 -0
- package/dist/harness/secret-scan.d.ts +8 -0
- package/dist/harness/secret-scan.d.ts.map +1 -0
- package/dist/harness/secret-scan.js +88 -0
- package/dist/harness/secret-scan.js.map +1 -0
- package/dist/harness/sensors.d.ts +88 -0
- package/dist/harness/sensors.d.ts.map +1 -0
- package/dist/harness/sensors.js +232 -0
- package/dist/harness/sensors.js.map +1 -0
- package/dist/harness/trace.d.ts +31 -0
- package/dist/harness/trace.d.ts.map +1 -0
- package/dist/harness/trace.js +173 -0
- package/dist/harness/trace.js.map +1 -0
- package/dist/orchestrator/ai-rules-updater.d.ts +1 -0
- package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
- package/dist/orchestrator/ai-rules-updater.js +55 -11
- package/dist/orchestrator/ai-rules-updater.js.map +1 -1
- package/dist/orchestrator/figma/spec-figma-renderer.d.ts +2 -2
- package/dist/orchestrator/figma/spec-figma-renderer.js +2 -2
- package/dist/orchestrator/figma/spec-figma-section-renderers.d.ts +1 -1
- package/dist/orchestrator/figma/spec-figma-section-renderers.js +1 -1
- package/dist/orchestrator/project-initializer.d.ts +5 -0
- package/dist/orchestrator/project-initializer.d.ts.map +1 -1
- package/dist/orchestrator/project-initializer.js +30 -6
- package/dist/orchestrator/project-initializer.js.map +1 -1
- package/dist/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
- package/dist/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
- package/dist/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -4
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
- package/dist/orchestrator/templates/ai-instructions/{github-skill-sungen-figma-source.md → claude-skill-capture-mode-figma-pat.md} +14 -48
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
- package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
- package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
- 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
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/dist/orchestrator/templates/specs-test-data.ts +20 -6
- package/dist/tools/figma/figma-auth.d.ts +5 -2
- package/dist/tools/figma/figma-auth.d.ts.map +1 -1
- package/dist/tools/figma/figma-auth.js +19 -9
- package/dist/tools/figma/figma-auth.js.map +1 -1
- package/docs/orchestration-spec.md +267 -0
- package/package.json +12 -7
- package/src/cli/commands/add.ts +3 -3
- package/src/cli/commands/audit.ts +92 -0
- package/src/cli/commands/blindspot.ts +48 -0
- package/src/cli/commands/capability.ts +160 -0
- package/src/cli/commands/challenge.ts +55 -0
- package/src/cli/commands/feedback.ts +65 -0
- package/src/cli/commands/flow-check.ts +97 -0
- package/src/cli/commands/generate.ts +47 -2
- package/src/cli/commands/ledger.ts +61 -0
- package/src/cli/commands/manifest.ts +55 -0
- package/src/cli/commands/script-check.ts +50 -0
- package/src/cli/commands/trace.ts +60 -0
- package/src/cli/commands/update.ts +30 -10
- package/src/cli/index.ts +20 -0
- package/src/generators/test-generator/adapters/adapter-interface.ts +1 -0
- package/src/generators/test-generator/adapters/adapter-registry.ts +37 -0
- package/src/generators/test-generator/adapters/index.ts +4 -1
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/capture-variable.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +7 -0
- package/src/generators/test-generator/adapters/playwright/templates/test-file.hbs +6 -0
- package/src/generators/test-generator/code-generator.ts +6 -2
- package/src/generators/test-generator/patterns/capture-patterns.ts +59 -0
- package/src/generators/test-generator/patterns/form-patterns.ts +3 -1
- package/src/generators/test-generator/patterns/index.ts +2 -0
- package/src/generators/test-generator/step-mapper.ts +1 -0
- package/src/generators/test-generator/utils/data-resolver.ts +20 -0
- package/src/generators/test-generator/utils/runtime-data-transformer.ts +8 -0
- package/src/generators/test-generator/utils/selector-resolver.ts +13 -6
- package/src/harness/audit.ts +112 -0
- package/src/harness/blindspot.ts +51 -0
- package/src/harness/capability-plan.ts +180 -0
- package/src/harness/capability.ts +75 -0
- package/src/harness/catalog/drivers.yaml +57 -0
- package/src/harness/catalog/universal-viewpoints.yaml +114 -0
- package/src/harness/challenge.ts +131 -0
- package/src/harness/feedback.ts +84 -0
- package/src/harness/flow-check.ts +99 -0
- package/src/harness/flow-plan.ts +135 -0
- package/src/harness/intent.ts +58 -0
- package/src/harness/ledger.ts +155 -0
- package/src/harness/manifest.ts +173 -0
- package/src/harness/parse.ts +145 -0
- package/src/harness/script-check.ts +222 -0
- package/src/harness/secret-scan.ts +51 -0
- package/src/harness/sensors.ts +279 -0
- package/src/harness/trace.ts +138 -0
- package/src/orchestrator/ai-rules-updater.ts +57 -10
- package/src/orchestrator/figma/spec-figma-renderer.ts +2 -2
- package/src/orchestrator/figma/spec-figma-section-renderers.ts +1 -1
- package/src/orchestrator/project-initializer.ts +33 -7
- package/src/orchestrator/templates/ai-instructions/claude-agent-challenge.md +46 -0
- package/src/orchestrator/templates/ai-instructions/claude-agent-discovery.md +32 -0
- package/src/orchestrator/templates/ai-instructions/claude-agent-reviewer.md +37 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-flow.md +3 -3
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +5 -5
- package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +36 -12
- package/src/orchestrator/templates/ai-instructions/claude-cmd-design.md +12 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-feedback.md +36 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +27 -30
- package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -1
- package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -4
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-figma-mcp.md +82 -0
- 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
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-live.md +60 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-mode-local.md +38 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture.md +35 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-harness-audit.md +84 -0
- package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +40 -1
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-flow.md +3 -3
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +4 -4
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +18 -10
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-design.md +13 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-feedback.md +24 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +20 -30
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -1
- package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -4
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-figma-mcp.md +82 -0
- 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
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-live.md +60 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-mode-local.md +38 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture.md +35 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-harness-audit.md +84 -0
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -1
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/src/orchestrator/templates/specs-test-data.ts +20 -6
- package/src/tools/figma/figma-auth.ts +20 -9
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
- package/dist/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-figma.md +0 -142
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-live.md +0 -112
- package/src/orchestrator/templates/ai-instructions/claude-skill-capture-local.md +0 -73
- package/src/orchestrator/templates/ai-instructions/copilot-skill-figma-source.md +0 -151
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-figma.md +0 -142
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-live.md +0 -112
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-capture-local.md +0 -73
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-figma-source.md +0 -151
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface Deferral {
|
|
2
|
+
screen: string;
|
|
3
|
+
scenario: string;
|
|
4
|
+
hint: string;
|
|
5
|
+
targets: string[];
|
|
6
|
+
verdict: 'covered' | 'shallow' | 'missing';
|
|
7
|
+
via?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Contract {
|
|
10
|
+
flow: string;
|
|
11
|
+
kind: 'SAME-CARD' | 'ISOLATION';
|
|
12
|
+
scenario?: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FlowCheckReport {
|
|
16
|
+
screens: string[];
|
|
17
|
+
flows: string[];
|
|
18
|
+
deferrals: Deferral[];
|
|
19
|
+
contracts: Contract[];
|
|
20
|
+
missing: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildFlowCheck(cwd: string, onlyFlow?: string): FlowCheckReport;
|
|
23
|
+
//# sourceMappingURL=flow-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-check.d.ts","sourceRoot":"","sources":["../../src/harness/flow-check.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,QAAQ;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;AACzJ,MAAM,WAAW,QAAQ;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAC/G,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACnC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,eAAe,CA+C9E"}
|
|
@@ -0,0 +1,132 @@
|
|
|
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.buildFlowCheck = buildFlowCheck;
|
|
37
|
+
/**
|
|
38
|
+
* Flow first-class checks (flow_firstclass_spec).
|
|
39
|
+
*
|
|
40
|
+
* A. Deferral integrity — every screen `@manual` "deferred to a flow (X -> Y)" must
|
|
41
|
+
* be backed by a real flow scenario that covers Y (deeply). Otherwise the
|
|
42
|
+
* cross-screen (XS) manual is a hidden gap, not "flow-covered".
|
|
43
|
+
* B. Run-test contract — surface the fragile cross-screen patterns (same-card
|
|
44
|
+
* identity scope, shared-state isolation under @parallel) as explicit checks.
|
|
45
|
+
*
|
|
46
|
+
* Deterministic + read-only. No test execution, no selector resolution.
|
|
47
|
+
*/
|
|
48
|
+
const fs = __importStar(require("fs"));
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
const parse_1 = require("./parse");
|
|
51
|
+
const capability_plan_1 = require("./capability-plan");
|
|
52
|
+
const KNOWN_TARGETS = ['cart', 'category', 'brand', 'detail', 'checkout', 'wishlist', 'order', 'payment', 'login'];
|
|
53
|
+
function listDirs(p) {
|
|
54
|
+
return fs.existsSync(p) ? fs.readdirSync(p, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name) : [];
|
|
55
|
+
}
|
|
56
|
+
function featurePath(base, kind, name) {
|
|
57
|
+
return path.join(base, 'qa', kind, name, 'features', `${name}.feature`);
|
|
58
|
+
}
|
|
59
|
+
function featureTags(fp) {
|
|
60
|
+
if (!fs.existsSync(fp))
|
|
61
|
+
return [];
|
|
62
|
+
for (const line of fs.readFileSync(fp, 'utf-8').split('\n')) {
|
|
63
|
+
const t = line.trim();
|
|
64
|
+
if (t.startsWith('Feature:'))
|
|
65
|
+
break;
|
|
66
|
+
if (t.startsWith('@'))
|
|
67
|
+
return t.split(/\s+/).filter((x) => x.startsWith('@'));
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
function targetsFromHint(hint) {
|
|
72
|
+
const h = hint.toLowerCase();
|
|
73
|
+
const hits = KNOWN_TARGETS.filter((k) => h.includes(k));
|
|
74
|
+
if (hits.length)
|
|
75
|
+
return hits;
|
|
76
|
+
// fallback: significant words after "->"
|
|
77
|
+
const after = h.split('->').pop() || h;
|
|
78
|
+
return after.split(/[^a-z]+/).filter((w) => w.length > 3 && !['home', 'page', 'flow', 'products', 'product', 'result'].includes(w));
|
|
79
|
+
}
|
|
80
|
+
function buildFlowCheck(cwd, onlyFlow) {
|
|
81
|
+
const screens = listDirs(path.join(cwd, 'qa', 'screens'));
|
|
82
|
+
const flows = (onlyFlow ? [onlyFlow] : listDirs(path.join(cwd, 'qa', 'flows')));
|
|
83
|
+
// Index flow scenarios (name + haystack + depth).
|
|
84
|
+
const flowScenarios = [];
|
|
85
|
+
for (const f of listDirs(path.join(cwd, 'qa', 'flows'))) {
|
|
86
|
+
for (const s of (0, parse_1.loadScenarios)(featurePath(cwd, 'flows', f))) {
|
|
87
|
+
flowScenarios.push({ flow: f, name: s.name, haystack: s.haystack, deep: s.hasDataAssertion });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// A. Deferral integrity (screens).
|
|
91
|
+
const deferrals = [];
|
|
92
|
+
for (const sc of screens) {
|
|
93
|
+
for (const s of (0, capability_plan_1.parseScenarios)(featurePath(cwd, 'screens', sc))) {
|
|
94
|
+
if (!s.manual || !/deferred to a flow/i.test(s.reason))
|
|
95
|
+
continue;
|
|
96
|
+
const targets = targetsFromHint(s.reason);
|
|
97
|
+
const matches = flowScenarios.filter((fs2) => targets.some((t) => fs2.haystack.includes(t)));
|
|
98
|
+
let verdict = 'missing';
|
|
99
|
+
let via;
|
|
100
|
+
if (matches.some((m) => m.deep)) {
|
|
101
|
+
verdict = 'covered';
|
|
102
|
+
via = matches.find((m) => m.deep).flow;
|
|
103
|
+
}
|
|
104
|
+
else if (matches.length) {
|
|
105
|
+
verdict = 'shallow';
|
|
106
|
+
via = matches[0].flow;
|
|
107
|
+
}
|
|
108
|
+
deferrals.push({ screen: sc, scenario: s.name, hint: s.reason, targets, verdict, via });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// B. Run-test contract (per flow).
|
|
112
|
+
const contracts = [];
|
|
113
|
+
for (const f of flows) {
|
|
114
|
+
const fp = featurePath(cwd, 'flows', f);
|
|
115
|
+
const parallel = featureTags(fp).some((t) => /^@parallel$/i.test(t));
|
|
116
|
+
const scs = (0, parse_1.loadScenarios)(fp);
|
|
117
|
+
let cartStateCount = 0;
|
|
118
|
+
for (const s of scs) {
|
|
119
|
+
const h = s.haystack;
|
|
120
|
+
if (/\bremember\b/.test(h) && /(add to cart|view product)/.test(h)) {
|
|
121
|
+
contracts.push({ flow: f, kind: 'SAME-CARD', scenario: s.name, message: 'remember + Add To Cart/View Product → scope to ONE card at run-test, else the identity proof is hollow.' });
|
|
122
|
+
}
|
|
123
|
+
if (/(add to cart|remove|\bcart\b|quantity)/.test(h))
|
|
124
|
+
cartStateCount++;
|
|
125
|
+
}
|
|
126
|
+
if (parallel && cartStateCount >= 2) {
|
|
127
|
+
contracts.push({ flow: f, kind: 'ISOLATION', message: `@parallel + ${cartStateCount} cart/state scenarios → give each a fresh browser context, else count/quantity asserts are flaky.` });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { screens, flows, deferrals, contracts, missing: deferrals.filter((d) => d.verdict === 'missing').length };
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=flow-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-check.js","sourceRoot":"","sources":["../../src/harness/flow-check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,wCA+CC;AAlGD;;;;;;;;;;GAUG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,mCAAwC;AACxC,uDAAmD;AAEnD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAWnH,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9H,CAAC;AACD,SAAS,WAAW,CAAC,IAAY,EAAE,IAAyB,EAAE,IAAY;IACxE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,UAAU,CAAC,CAAC;AAC1E,CAAC;AACD,SAAS,WAAW,CAAC,EAAU;IAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,EAAE,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,CAAC,CAAC,QAAQ,CAAC;YACrB,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,yGAAyG,EAAE,CAAC,CAAC;YACvL,CAAC;YACD,IAAI,wCAAwC,CAAC,IAAI,CAAC,CAAC,CAAC;gBAAE,cAAc,EAAE,CAAC;QACzE,CAAC;QACD,IAAI,QAAQ,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;YACpC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,cAAc,mGAAmG,EAAE,CAAC,CAAC;QAC5L,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Contract } from './flow-check';
|
|
2
|
+
export interface LegPlan {
|
|
3
|
+
screen: string;
|
|
4
|
+
scenarios: number;
|
|
5
|
+
refs: string[];
|
|
6
|
+
haveKeys: number;
|
|
7
|
+
readiness: 'ready' | 'partial' | 'missing';
|
|
8
|
+
touchedByAutomated: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FlowPlan {
|
|
11
|
+
flow: string;
|
|
12
|
+
total: number;
|
|
13
|
+
legs: LegPlan[];
|
|
14
|
+
byReason: Record<string, number>;
|
|
15
|
+
capabilityManual: number;
|
|
16
|
+
judgmentManual: number;
|
|
17
|
+
contracts: Contract[];
|
|
18
|
+
readiness: 'ready' | 'not-ready';
|
|
19
|
+
missingLegs: string[];
|
|
20
|
+
plan: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function buildFlowPlan(cwd: string, flow: string): FlowPlan;
|
|
23
|
+
//# sourceMappingURL=flow-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-plan.d.ts","sourceRoot":"","sources":["../../src/harness/flow-plan.ts"],"names":[],"mappings":"AAaA,OAAO,EAAkB,QAAQ,EAAE,MAAM,cAAc,CAAC;AA4CxD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC3C,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AACD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,GAAG,WAAW,CAAC;IACjC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAwDjE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
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.buildFlowPlan = buildFlowPlan;
|
|
37
|
+
/**
|
|
38
|
+
* Flow Capability Planner (Phase 2c) — flow-aware, deterministic, recommend-only.
|
|
39
|
+
*
|
|
40
|
+
* Decomposes a flow into per-screen LEGS (from [Screen:Element] refs), reports each
|
|
41
|
+
* leg's SELECTOR READINESS + capability, folds in the manual-reason taxonomy
|
|
42
|
+
* (capability-plan) and the run-test contract (flow-check), and emits a run-test
|
|
43
|
+
* PLAN. Automates the manual diagnosis done while healing cart-and-filter.
|
|
44
|
+
* See reports/sungen_phase2c_spec.md.
|
|
45
|
+
*/
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const yaml_1 = require("yaml");
|
|
49
|
+
const capability_plan_1 = require("./capability-plan");
|
|
50
|
+
const flow_check_1 = require("./flow-check");
|
|
51
|
+
const REF_RE = /\[([A-Za-z][\w ]*?):([\w &.-]+?)\]/g;
|
|
52
|
+
function parseFlowScenarios(featurePath) {
|
|
53
|
+
if (!fs.existsSync(featurePath))
|
|
54
|
+
return [];
|
|
55
|
+
const lines = fs.readFileSync(featurePath, 'utf-8').split('\n');
|
|
56
|
+
const out = [];
|
|
57
|
+
const idx = [];
|
|
58
|
+
lines.forEach((l, i) => { if (/^\s*Scenario:/.test(l))
|
|
59
|
+
idx.push(i); });
|
|
60
|
+
for (let s = 0; s < idx.length; s++) {
|
|
61
|
+
const i = idx[s];
|
|
62
|
+
const end = s + 1 < idx.length ? idx[s + 1] : lines.length;
|
|
63
|
+
const name = lines[i].replace(/^\s*Scenario:\s*/, '').trim();
|
|
64
|
+
// tags + reason from the lines above + first comment in body
|
|
65
|
+
const tags = [];
|
|
66
|
+
let reason = '';
|
|
67
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
68
|
+
const t = lines[j].trim();
|
|
69
|
+
if (t === '')
|
|
70
|
+
break;
|
|
71
|
+
if (/^@/.test(t))
|
|
72
|
+
tags.unshift(...t.split(/\s+/).filter((x) => x.startsWith('@')));
|
|
73
|
+
else if (/^#/.test(t)) {
|
|
74
|
+
if (!reason)
|
|
75
|
+
reason = t.replace(/^#+\s*/, '');
|
|
76
|
+
}
|
|
77
|
+
else
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
const body = lines.slice(i, end).join('\n');
|
|
81
|
+
if (!reason) {
|
|
82
|
+
const m = body.match(/^\s*#\s*(.+)$/m);
|
|
83
|
+
if (m)
|
|
84
|
+
reason = m[1].trim();
|
|
85
|
+
}
|
|
86
|
+
const refs = [];
|
|
87
|
+
let mm;
|
|
88
|
+
REF_RE.lastIndex = 0;
|
|
89
|
+
while ((mm = REF_RE.exec(body)))
|
|
90
|
+
refs.push({ screen: mm[1].trim(), element: mm[2].trim() });
|
|
91
|
+
out.push({ name, manual: tags.some((t) => /^@manual\b/i.test(t)), reason, tags, refs });
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
function selectorKeys(selectorsPath) {
|
|
96
|
+
if (!fs.existsSync(selectorsPath))
|
|
97
|
+
return new Set();
|
|
98
|
+
try {
|
|
99
|
+
const y = (0, yaml_1.parse)(fs.readFileSync(selectorsPath, 'utf-8')) || {};
|
|
100
|
+
return new Set(Object.keys(y).map((k) => k.toLowerCase()));
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return new Set();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function buildFlowPlan(cwd, flow) {
|
|
107
|
+
const featurePath = path.join(cwd, 'qa', 'flows', flow, 'features', `${flow}.feature`);
|
|
108
|
+
const selectorsPath = path.join(cwd, 'qa', 'flows', flow, 'selectors', `${flow}.yaml`);
|
|
109
|
+
const scenarios = parseFlowScenarios(featurePath);
|
|
110
|
+
const keys = selectorKeys(selectorsPath);
|
|
111
|
+
// Legs = distinct screen namespaces.
|
|
112
|
+
const legMap = new Map();
|
|
113
|
+
const byReason = {};
|
|
114
|
+
let capabilityManual = 0, judgmentManual = 0;
|
|
115
|
+
for (const sc of scenarios) {
|
|
116
|
+
if (sc.manual) {
|
|
117
|
+
const { code } = (0, capability_plan_1.inferReasonCode)(sc.tags, sc.reason);
|
|
118
|
+
byReason[code] = (byReason[code] || 0) + 1;
|
|
119
|
+
const cls = capability_plan_1.MANUAL_REASONS[code]?.cls;
|
|
120
|
+
if (cls === 'capability')
|
|
121
|
+
capabilityManual++;
|
|
122
|
+
else if (cls === 'keep')
|
|
123
|
+
judgmentManual++;
|
|
124
|
+
}
|
|
125
|
+
for (const r of sc.refs) {
|
|
126
|
+
const leg = r.screen.toLowerCase();
|
|
127
|
+
const entry = legMap.get(leg) || { scenarios: new Set(), refs: new Set(), automated: false };
|
|
128
|
+
entry.scenarios.add(sc.name);
|
|
129
|
+
entry.refs.add(`${leg}:${r.element.toLowerCase()}`);
|
|
130
|
+
if (!sc.manual)
|
|
131
|
+
entry.automated = true;
|
|
132
|
+
legMap.set(leg, entry);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const legs = [...legMap.entries()].map(([screen, e]) => {
|
|
136
|
+
const refs = [...e.refs];
|
|
137
|
+
const haveKeys = refs.filter((rk) => keys.has(rk)).length;
|
|
138
|
+
const readiness = haveKeys === refs.length ? 'ready' : haveKeys === 0 ? 'missing' : 'partial';
|
|
139
|
+
return { screen, scenarios: e.scenarios.size, refs, haveKeys, readiness, touchedByAutomated: e.automated };
|
|
140
|
+
}).sort((a, b) => b.scenarios - a.scenarios);
|
|
141
|
+
const missingLegs = legs.filter((l) => l.touchedByAutomated && l.readiness !== 'ready').map((l) => l.screen);
|
|
142
|
+
const fc = (0, flow_check_1.buildFlowCheck)(cwd, flow);
|
|
143
|
+
const contracts = fc.contracts.filter((c) => c.flow === flow);
|
|
144
|
+
const readiness = missingLegs.length ? 'not-ready' : 'ready';
|
|
145
|
+
const plan = [];
|
|
146
|
+
if (missingLegs.length) {
|
|
147
|
+
plan.push(`Run \`/sungen:run-test ${flow}\` → Phase 0 generates selectors for: ${missingLegs.join(', ')} (from the live pages).`);
|
|
148
|
+
}
|
|
149
|
+
if (contracts.some((c) => c.kind === 'SAME-CARD'))
|
|
150
|
+
plan.push('Honour SAME-CARD: scope remember + Add To Cart/View Product to ONE card at run-test.');
|
|
151
|
+
if (contracts.some((c) => c.kind === 'ISOLATION'))
|
|
152
|
+
plan.push('Honour ISOLATION: fresh browser context per cart/state scenario (@parallel).');
|
|
153
|
+
const driverReasons = Object.keys(byReason).filter((c) => capability_plan_1.MANUAL_REASONS[c]?.cls === 'capability');
|
|
154
|
+
if (driverReasons.length) {
|
|
155
|
+
const drivers = [...new Set(driverReasons.flatMap((c) => capability_plan_1.MANUAL_REASONS[c].drivers))];
|
|
156
|
+
if (drivers.length)
|
|
157
|
+
plan.push(`Consider drivers (recommend-only): ${drivers.join(', ')} — for capability-manual (${driverReasons.join('/')}).`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
plan.push('No capability driver needed — all automated legs are @ui.');
|
|
161
|
+
}
|
|
162
|
+
if (readiness === 'ready')
|
|
163
|
+
plan.unshift('Selectors present for every automated leg — ready to compile + run.');
|
|
164
|
+
return { flow, total: scenarios.length, legs, byReason, capabilityManual, judgmentManual, contracts, readiness, missingLegs, plan };
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=flow-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-plan.js","sourceRoot":"","sources":["../../src/harness/flow-plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,sCAwDC;AAtID;;;;;;;;GAQG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,+BAA0C;AAC1C,uDAAoE;AACpE,6CAAwD;AAExD,MAAM,MAAM,GAAG,qCAAqC,CAAC;AAIrD,SAAS,kBAAkB,CAAC,WAAmB;IAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChE,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,CAAC,OAAO,CAAC,CAAC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| '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","sourceRo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AM,KAAK,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAgB,CAAC;IACxG,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAA8B,CAAC;IACpI,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IACjC,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAA+B,CAAC;IAElI,MAAM,KAAK,GAAG,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC;IACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface LedgerEvent {
|
|
2
|
+
ts: string;
|
|
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,WAAW,EAAE,GAAG,WAAW,EAAE,EAAE,CAoBlE;AAED,0CAA0C;AAC1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