@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,39 @@
|
|
|
1
|
+
export interface ScriptCheckResult {
|
|
2
|
+
screen: string;
|
|
3
|
+
specPath: string | null;
|
|
4
|
+
automatedScenarios: number;
|
|
5
|
+
manualScenarios: number;
|
|
6
|
+
specTestBlocks: number;
|
|
7
|
+
countMatch: boolean;
|
|
8
|
+
missingInSpec: string[];
|
|
9
|
+
extraInSpec: string[];
|
|
10
|
+
drift: 'in-sync' | 'drift' | 'no-spec';
|
|
11
|
+
driftHunks: string[];
|
|
12
|
+
assertionlessTests: string[];
|
|
13
|
+
hollowSteps: {
|
|
14
|
+
test: string;
|
|
15
|
+
step: string;
|
|
16
|
+
}[];
|
|
17
|
+
bypass: boolean;
|
|
18
|
+
status: 'OK' | 'FAIL';
|
|
19
|
+
findings: string[];
|
|
20
|
+
}
|
|
21
|
+
/** Split a spec into test() blocks (title + body) via brace counting. */
|
|
22
|
+
export declare function extractTestBlocks(specSrc: string): {
|
|
23
|
+
title: string;
|
|
24
|
+
body: string[];
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Faithfulness / anti-bypass: a non-@manual test that performs actions but proves
|
|
28
|
+
* nothing (0 assertions), or a step-comment that emitted no executable code (hollow
|
|
29
|
+
* — the testcase step is not run). Structural 1:1 can't see these.
|
|
30
|
+
*/
|
|
31
|
+
export declare function analyzeFaithfulness(specSrc: string, automatedTitles: Set<string>): {
|
|
32
|
+
assertionlessTests: string[];
|
|
33
|
+
hollowSteps: {
|
|
34
|
+
test: string;
|
|
35
|
+
step: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
export declare function runScriptCheck(screenDir: string, screenName: string, flowMode: boolean): Promise<ScriptCheckResult>;
|
|
39
|
+
//# sourceMappingURL=script-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-check.d.ts","sourceRoot":"","sources":["../../src/harness/script-check.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACvC,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,CAgBtF;AAID;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC;;;cAEpD,MAAM;cAAQ,MAAM;;EAkBhD;AA0CD,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+FzH"}
|
|
@@ -0,0 +1,251 @@
|
|
|
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.extractTestBlocks = extractTestBlocks;
|
|
37
|
+
exports.analyzeFaithfulness = analyzeFaithfulness;
|
|
38
|
+
exports.runScriptCheck = runScriptCheck;
|
|
39
|
+
/**
|
|
40
|
+
* Script-check — verify the generated Playwright spec is a faithful 1:1 of the
|
|
41
|
+
* Gherkin feature, i.e. "the testcase and the test code are not two different things".
|
|
42
|
+
*
|
|
43
|
+
* Two deterministic checks:
|
|
44
|
+
* A. Structural 1:1 — every non-@manual / non-@steps scenario has exactly one
|
|
45
|
+
* matching `test('<title>')` block in the committed spec (and no extras).
|
|
46
|
+
* B. Drift — regenerate the spec from the SAME .feature + selectors + test-data
|
|
47
|
+
* into a temp dir and diff against the committed spec. Any difference means
|
|
48
|
+
* the committed spec was hand-edited or is stale (feature changed without a
|
|
49
|
+
* regenerate) → the script no longer reflects the testcase.
|
|
50
|
+
*
|
|
51
|
+
* Pure-deterministic (reuses the compiler). No AI.
|
|
52
|
+
*/
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const os = __importStar(require("os"));
|
|
56
|
+
const parse_1 = require("./parse");
|
|
57
|
+
/** Split a spec into test() blocks (title + body) via brace counting. */
|
|
58
|
+
function extractTestBlocks(specSrc) {
|
|
59
|
+
const lines = specSrc.split('\n');
|
|
60
|
+
const blocks = [];
|
|
61
|
+
for (let i = 0; i < lines.length; i++) {
|
|
62
|
+
const m = lines[i].match(/\btest(?:\.(?:only|skip|fixme))?\(\s*(['"`])([^'"`]+)\1/);
|
|
63
|
+
if (!m)
|
|
64
|
+
continue;
|
|
65
|
+
let depth = 0, started = false;
|
|
66
|
+
const body = [];
|
|
67
|
+
for (let j = i; j < lines.length; j++) {
|
|
68
|
+
for (const ch of lines[j]) {
|
|
69
|
+
if (ch === '{') {
|
|
70
|
+
depth++;
|
|
71
|
+
started = true;
|
|
72
|
+
}
|
|
73
|
+
else if (ch === '}')
|
|
74
|
+
depth--;
|
|
75
|
+
}
|
|
76
|
+
body.push(lines[j]);
|
|
77
|
+
if (started && depth <= 0)
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
blocks.push({ title: m[2].trim(), body });
|
|
81
|
+
}
|
|
82
|
+
return blocks;
|
|
83
|
+
}
|
|
84
|
+
const CODE_LINE = /\b(await|expect|testData|page\.)\b|=\s*[^=]/;
|
|
85
|
+
/**
|
|
86
|
+
* Faithfulness / anti-bypass: a non-@manual test that performs actions but proves
|
|
87
|
+
* nothing (0 assertions), or a step-comment that emitted no executable code (hollow
|
|
88
|
+
* — the testcase step is not run). Structural 1:1 can't see these.
|
|
89
|
+
*/
|
|
90
|
+
function analyzeFaithfulness(specSrc, automatedTitles) {
|
|
91
|
+
const assertionlessTests = [];
|
|
92
|
+
const hollowSteps = [];
|
|
93
|
+
for (const blk of extractTestBlocks(specSrc)) {
|
|
94
|
+
if (!automatedTitles.has(blk.title))
|
|
95
|
+
continue; // only non-@manual scenarios
|
|
96
|
+
const body = blk.body;
|
|
97
|
+
if (!body.some((l) => /expect\(/.test(l)))
|
|
98
|
+
assertionlessTests.push(blk.title);
|
|
99
|
+
// hollow step: a `// step` whose region (until the NEXT step-comment / block end)
|
|
100
|
+
// contains no executable code. The region — not just the next line — is checked,
|
|
101
|
+
// so block-style steps (`// Assert all … { … expect … }`) are correctly counted.
|
|
102
|
+
const stepIdx = [];
|
|
103
|
+
for (let k = 1; k < body.length; k++)
|
|
104
|
+
if (body[k].trim().startsWith('//'))
|
|
105
|
+
stepIdx.push(k);
|
|
106
|
+
for (let s = 0; s < stepIdx.length; s++) {
|
|
107
|
+
const start = stepIdx[s] + 1;
|
|
108
|
+
const end = s + 1 < stepIdx.length ? stepIdx[s + 1] : body.length;
|
|
109
|
+
const hasCode = body.slice(start, end).some((l) => CODE_LINE.test(l));
|
|
110
|
+
if (!hasCode)
|
|
111
|
+
hollowSteps.push({ test: blk.title, step: body[stepIdx[s]].trim().slice(0, 70) });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { assertionlessTests, hollowSteps };
|
|
115
|
+
}
|
|
116
|
+
function extractTestTitles(specSrc) {
|
|
117
|
+
// Count real test cases only: test(...), test.only/.skip/.fixme(...).
|
|
118
|
+
// Exclude test.describe / test.beforeAll / hooks (not test cases).
|
|
119
|
+
const titles = [];
|
|
120
|
+
const re = /\btest(?:\.(?:only|skip|fixme))?\(\s*(['"`])([^'"`]+)\1/g;
|
|
121
|
+
let m;
|
|
122
|
+
while ((m = re.exec(specSrc)))
|
|
123
|
+
titles.push(m[2].trim());
|
|
124
|
+
return titles;
|
|
125
|
+
}
|
|
126
|
+
function normalize(src) {
|
|
127
|
+
return src
|
|
128
|
+
.split('\n')
|
|
129
|
+
.map((l) => l.replace(/\s+$/, ''))
|
|
130
|
+
.join('\n')
|
|
131
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
132
|
+
.trim();
|
|
133
|
+
}
|
|
134
|
+
function findSpec(dir, name, flowMode) {
|
|
135
|
+
// Screens compile to <dir>/<name>/<feature>.spec.ts
|
|
136
|
+
// Flows compile to <dir>/flows/<name>/<feature>.spec.ts
|
|
137
|
+
// Scope the search to THIS target's own subdir — otherwise the first spec of
|
|
138
|
+
// ANY other screen/flow is returned, which (for an uncompiled flow) falsely
|
|
139
|
+
// reports the wrong screen's tests as drift.
|
|
140
|
+
const hits = [];
|
|
141
|
+
const walk = (d) => {
|
|
142
|
+
if (!fs.existsSync(d))
|
|
143
|
+
return;
|
|
144
|
+
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
145
|
+
const p = path.join(d, e.name);
|
|
146
|
+
if (e.isDirectory())
|
|
147
|
+
walk(p);
|
|
148
|
+
else if (e.name.endsWith('.spec.ts'))
|
|
149
|
+
hits.push(p);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const scoped = flowMode ? path.join(dir, 'flows', name) : path.join(dir, name);
|
|
153
|
+
if (!fs.existsSync(scoped))
|
|
154
|
+
return null; // no spec for this target (e.g. not compiled yet)
|
|
155
|
+
walk(scoped);
|
|
156
|
+
return hits[0] ?? null;
|
|
157
|
+
}
|
|
158
|
+
async function runScriptCheck(screenDir, screenName, flowMode) {
|
|
159
|
+
const featurePath = path.join(screenDir, 'features', `${screenName}.feature`);
|
|
160
|
+
const scenarios = (0, parse_1.loadScenarios)(featurePath);
|
|
161
|
+
const automated = scenarios.filter((s) => !s.manual);
|
|
162
|
+
const manual = scenarios.filter((s) => s.manual);
|
|
163
|
+
const committedSpec = findSpec(path.join(process.cwd(), 'specs', 'generated'), screenName, flowMode);
|
|
164
|
+
const findings = [];
|
|
165
|
+
let specTitles = [];
|
|
166
|
+
let specSrc = '';
|
|
167
|
+
if (committedSpec) {
|
|
168
|
+
specSrc = fs.readFileSync(committedSpec, 'utf-8');
|
|
169
|
+
specTitles = extractTestTitles(specSrc);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
findings.push('No generated spec found under specs/generated/ — run `sungen generate` / `/sungen:run-test` first.');
|
|
173
|
+
}
|
|
174
|
+
// A. Structural 1:1
|
|
175
|
+
const specTitleSet = new Set(specTitles);
|
|
176
|
+
const scenTitleSet = new Set(automated.map((s) => s.name));
|
|
177
|
+
const missingInSpec = automated.filter((s) => !specTitleSet.has(s.name)).map((s) => s.name);
|
|
178
|
+
const extraInSpec = specTitles.filter((t) => !scenTitleSet.has(t));
|
|
179
|
+
const countMatch = committedSpec ? automated.length === specTitles.length : false;
|
|
180
|
+
if (committedSpec && !countMatch) {
|
|
181
|
+
findings.push(`Count mismatch: ${automated.length} automated scenarios vs ${specTitles.length} test() blocks.`);
|
|
182
|
+
}
|
|
183
|
+
for (const t of missingInSpec)
|
|
184
|
+
findings.push(`MISSING in spec: scenario "${t}" has no test() block (stale spec — regenerate).`);
|
|
185
|
+
for (const t of extraInSpec)
|
|
186
|
+
findings.push(`EXTRA in spec: test "${t}" has no matching scenario (hand-edited spec).`);
|
|
187
|
+
// B. Drift — regenerate to temp and diff
|
|
188
|
+
let drift = committedSpec ? 'in-sync' : 'no-spec';
|
|
189
|
+
const driftHunks = [];
|
|
190
|
+
if (committedSpec) {
|
|
191
|
+
try {
|
|
192
|
+
const { CodeGenerator } = require('../generators/test-generator/code-generator');
|
|
193
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sungen-scriptcheck-'));
|
|
194
|
+
const qaSourceDir = path.join(process.cwd(), 'qa', flowMode ? 'flows' : 'screens');
|
|
195
|
+
const gen = new CodeGenerator({ framework: 'playwright', screenName, runtimeData: true, flowMode });
|
|
196
|
+
await gen.generateAllTests(qaSourceDir, tmp, [featurePath]);
|
|
197
|
+
const fresh = findSpec(tmp, screenName, flowMode);
|
|
198
|
+
if (fresh) {
|
|
199
|
+
const a = normalize(specSrc);
|
|
200
|
+
const b = normalize(fs.readFileSync(fresh, 'utf-8'));
|
|
201
|
+
if (a !== b) {
|
|
202
|
+
drift = 'drift';
|
|
203
|
+
// collect a few differing lines
|
|
204
|
+
const al = a.split('\n'), bl = b.split('\n');
|
|
205
|
+
const max = Math.max(al.length, bl.length);
|
|
206
|
+
for (let i = 0, shown = 0; i < max && shown < 6; i++) {
|
|
207
|
+
if (al[i] !== bl[i]) {
|
|
208
|
+
driftHunks.push(` L${i + 1}\n committed: ${(al[i] ?? '∅').trim().slice(0, 100)}\n expected : ${(bl[i] ?? '∅').trim().slice(0, 100)}`);
|
|
209
|
+
shown++;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
findings.push('DRIFT: committed spec differs from a fresh regenerate → spec was hand-edited or the .feature changed without `sungen generate`. The test code no longer reflects the Gherkin.');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
findings.push(`Drift check skipped (regenerate failed): ${e instanceof Error ? e.message : e}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// C. Anti-bypass / faithfulness
|
|
222
|
+
const { assertionlessTests, hollowSteps } = committedSpec
|
|
223
|
+
? analyzeFaithfulness(specSrc, scenTitleSet)
|
|
224
|
+
: { assertionlessTests: [], hollowSteps: [] };
|
|
225
|
+
for (const t of assertionlessTests) {
|
|
226
|
+
findings.push(`BYPASS: test "${t}" has 0 assertions (action-only — proves nothing). The testcase is not really automated.`);
|
|
227
|
+
}
|
|
228
|
+
for (const h of hollowSteps) {
|
|
229
|
+
findings.push(`BYPASS: in "${h.test}", step "${h.step}" emitted no code (hollow — the testcase step is not executed).`);
|
|
230
|
+
}
|
|
231
|
+
const bypass = assertionlessTests.length > 0 || hollowSteps.length > 0;
|
|
232
|
+
const ok = !!committedSpec && countMatch && missingInSpec.length === 0 && extraInSpec.length === 0 && drift === 'in-sync' && !bypass;
|
|
233
|
+
return {
|
|
234
|
+
screen: screenName,
|
|
235
|
+
specPath: committedSpec,
|
|
236
|
+
automatedScenarios: automated.length,
|
|
237
|
+
manualScenarios: manual.length,
|
|
238
|
+
specTestBlocks: specTitles.length,
|
|
239
|
+
countMatch,
|
|
240
|
+
missingInSpec,
|
|
241
|
+
extraInSpec,
|
|
242
|
+
drift,
|
|
243
|
+
driftHunks,
|
|
244
|
+
assertionlessTests,
|
|
245
|
+
hollowSteps,
|
|
246
|
+
bypass,
|
|
247
|
+
status: ok ? 'OK' : 'FAIL',
|
|
248
|
+
findings,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=script-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-check.js","sourceRoot":"","sources":["../../src/harness/script-check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,8CAgBC;AASD,kDAoBC;AA0CD,wCA+FC;AA7ND;;;;;;;;;;;;;GAaG;AACH,uCAA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UAAU;QACV,aAAa;QACb,WAAW;QACX,KAAK;QACL,UAAU;QACV,kBAAkB;QAClB,WAAW;QACX,MAAM;QACN,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;QAC1B,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SecretHit {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
reason: string;
|
|
5
|
+
}
|
|
6
|
+
/** Scan a screen/flow dir's test-data/*.yaml for likely real secrets. */
|
|
7
|
+
export declare function scanTestDataSecrets(baseDir: string): SecretHit[];
|
|
8
|
+
//# sourceMappingURL=secret-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-scan.d.ts","sourceRoot":"","sources":["../../src/harness/secret-scan.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,SAAS;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AA4BzE,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,CAUhE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.scanTestDataSecrets = scanTestDataSecrets;
|
|
37
|
+
/**
|
|
38
|
+
* Secret scanner (security S0) — warn (never block) when test-data appears to
|
|
39
|
+
* contain a REAL secret rather than a safe placeholder/test value.
|
|
40
|
+
*
|
|
41
|
+
* test-data/*.yaml is committed by design, so a real API key / prod token there is
|
|
42
|
+
* a leak waiting to happen. We flag high-confidence signals only, to avoid nagging
|
|
43
|
+
* about ordinary test passwords ("Test@123") or `{{vars}}`.
|
|
44
|
+
*/
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
// High-confidence vendor token prefixes (very low false-positive rate).
|
|
48
|
+
const VENDOR_PREFIXES = /\b(figd_[A-Za-z0-9_-]{12,}|ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,}|glpat-[A-Za-z0-9_-]{16,}|sk-[A-Za-z0-9]{16,}|AKIA[0-9A-Z]{12,}|xox[baprs]-[A-Za-z0-9-]{10,}|AIza[0-9A-Za-z_-]{30,})/;
|
|
49
|
+
// A secret-named key assigned a long, non-placeholder value.
|
|
50
|
+
const SECRET_KEY = /\b(password|passwd|secret|token|api[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret)\b\s*:\s*(.+)$/i;
|
|
51
|
+
const PLACEHOLDERish = /\{\{|<.*>|changeme|example|dummy|test\b|placeholder|xxxx|\*\*\*/i;
|
|
52
|
+
function scanText(text, file) {
|
|
53
|
+
const hits = [];
|
|
54
|
+
text.split('\n').forEach((raw, i) => {
|
|
55
|
+
const line = i + 1;
|
|
56
|
+
if (VENDOR_PREFIXES.test(raw)) {
|
|
57
|
+
hits.push({ file, line, reason: 'looks like a real vendor API token/key' });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const m = raw.match(SECRET_KEY);
|
|
61
|
+
if (m) {
|
|
62
|
+
const val = m[2].trim().replace(/^["']|["']$/g, '');
|
|
63
|
+
// Long, high-entropy-ish, not an obvious placeholder/test value.
|
|
64
|
+
if (val.length >= 20 && !PLACEHOLDERish.test(raw) && /[A-Za-z]/.test(val) && /[0-9]/.test(val)) {
|
|
65
|
+
hits.push({ file, line, reason: `secret-named key "${m[1]}" with a long literal value` });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return hits;
|
|
70
|
+
}
|
|
71
|
+
/** Scan a screen/flow dir's test-data/*.yaml for likely real secrets. */
|
|
72
|
+
function scanTestDataSecrets(baseDir) {
|
|
73
|
+
const tdDir = path.join(baseDir, 'test-data');
|
|
74
|
+
if (!fs.existsSync(tdDir))
|
|
75
|
+
return [];
|
|
76
|
+
const hits = [];
|
|
77
|
+
for (const f of fs.readdirSync(tdDir)) {
|
|
78
|
+
if (!/\.ya?ml$/i.test(f))
|
|
79
|
+
continue;
|
|
80
|
+
const p = path.join(tdDir, f);
|
|
81
|
+
try {
|
|
82
|
+
hits.push(...scanText(fs.readFileSync(p, 'utf-8'), path.join('test-data', f)));
|
|
83
|
+
}
|
|
84
|
+
catch { /* ignore */ }
|
|
85
|
+
}
|
|
86
|
+
return hits;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=secret-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-scan.js","sourceRoot":"","sources":["../../src/harness/secret-scan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,kDAUC;AAlDD;;;;;;;GAOG;AACH,uCAAyB;AACzB,2CAA6B;AAI7B,wEAAwE;AACxE,MAAM,eAAe,GAAG,0LAA0L,CAAC;AACnN,6DAA6D;AAC7D,MAAM,UAAU,GAAG,8GAA8G,CAAC;AAClI,MAAM,cAAc,GAAG,kEAAkE,CAAC;AAE1F,SAAS,QAAQ,CAAC,IAAY,EAAE,IAAY;IAC1C,MAAM,IAAI,GAAgB,EAAE,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QAClC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,wCAAwC,EAAE,CAAC,CAAC;YAC5E,OAAO;QACT,CAAC;QACD,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,CAAC;YACN,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YACpD,iEAAiE;YACjE,IAAI,GAAG,CAAC,MAAM,IA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
requires: string;
|
|
4
|
+
cross_screen?: boolean;
|
|
5
|
+
keywords?: string[];
|
|
6
|
+
template?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CatalogTheme {
|
|
9
|
+
theme: string;
|
|
10
|
+
keywords: string[];
|
|
11
|
+
depth?: ThemeDepth;
|
|
12
|
+
}
|
|
13
|
+
export interface Catalog {
|
|
14
|
+
page_types: Record<string, {
|
|
15
|
+
detect_keywords: string[];
|
|
16
|
+
must_cover: CatalogTheme[];
|
|
17
|
+
}>;
|
|
18
|
+
universal: CatalogTheme[];
|
|
19
|
+
}
|
|
20
|
+
export declare function loadCatalog(): Catalog;
|
|
21
|
+
export interface GateResult {
|
|
22
|
+
pageType: string | null;
|
|
23
|
+
themesTotal: number;
|
|
24
|
+
themesCovered: number;
|
|
25
|
+
coverageRatio: number;
|
|
26
|
+
gaps: {
|
|
27
|
+
theme: string;
|
|
28
|
+
keywords: string[];
|
|
29
|
+
status: 'missing' | 'shallow';
|
|
30
|
+
}[];
|
|
31
|
+
universalGaps: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function viewpointGate(scenarios: ScenarioInfo[], viewpoints: ViewpointEntry[], catalog: Catalog): GateResult;
|
|
34
|
+
export type DepthVerdict = 'pass' | 'warn' | 'fail';
|
|
35
|
+
export interface DepthResult {
|
|
36
|
+
total: number;
|
|
37
|
+
shallowTotal: number;
|
|
38
|
+
shallowRatio: number;
|
|
39
|
+
businessCriticalTotal: number;
|
|
40
|
+
businessCriticalShallow: number;
|
|
41
|
+
bcDepthRatio: number;
|
|
42
|
+
shallowBusinessCritical: {
|
|
43
|
+
name: string;
|
|
44
|
+
category?: string;
|
|
45
|
+
}[];
|
|
46
|
+
focus: string;
|
|
47
|
+
threshold: number;
|
|
48
|
+
verdict: DepthVerdict;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Depth = do DATA-correctness scenarios actually assert DATA (not just visibility)?
|
|
52
|
+
* "Depth-required" is CATALOG-DRIVEN: only scenarios matching a theme whose
|
|
53
|
+
* `depth.requires === 'data-assertion'` are measured. Navigation viewpoints
|
|
54
|
+
* (category NAV) are excluded — landing on a page IS their correct assertion.
|
|
55
|
+
* This avoids the old keyword-based false-positives (e.g. "API list page").
|
|
56
|
+
*/
|
|
57
|
+
export declare function assertionDepth(scenarios: ScenarioInfo[], dataThemes?: CatalogTheme[], focus?: string): DepthResult;
|
|
58
|
+
/** Collect data-correctness themes (depth.requires) for a page-type + universal. */
|
|
59
|
+
export declare function dataThemesFor(catalog: Catalog, pageType: string | null): CatalogTheme[];
|
|
60
|
+
export interface BalanceResult {
|
|
61
|
+
byBucket: Record<string, number>;
|
|
62
|
+
byCategory: Record<string, number>;
|
|
63
|
+
coreCount: number;
|
|
64
|
+
secondaryCount: number;
|
|
65
|
+
imbalanced: boolean;
|
|
66
|
+
note: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function coverageBalance(scenarios: ScenarioInfo[]): BalanceResult;
|
|
69
|
+
export interface DuplicateResult {
|
|
70
|
+
clusters: {
|
|
71
|
+
skeleton: string;
|
|
72
|
+
scenarios: string[];
|
|
73
|
+
sameDataLikely: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
exactDuplicateCount: number;
|
|
76
|
+
sameShapeCount: number;
|
|
77
|
+
}
|
|
78
|
+
export declare function duplicateClusters(scenarios: ScenarioInfo[]): DuplicateResult;
|
|
79
|
+
export interface TraceResult {
|
|
80
|
+
total: number;
|
|
81
|
+
withVpCode: number;
|
|
82
|
+
mappedToOverview: number;
|
|
83
|
+
withVpCodeRatio: number;
|
|
84
|
+
mappedRatio: number;
|
|
85
|
+
note: string;
|
|
86
|
+
}
|
|
87
|
+
export declare function traceability(scenarios: ScenarioInfo[], viewpoints: ViewpointEntry[]): TraceResult;
|
|
88
|
+
//# sourceMappingURL=sensors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensors.d.ts","sourceRoot":"","sources":["../../src/harness/sensors.ts"],"names":[],"mapp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