@sun-asterisk/sungen 2.7.0-beta.0 → 3.0.0-beta.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +22 -0
- 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 +16 -0
- package/dist/cli/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/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/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/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/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/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 +16 -0
- package/dist/harness/script-check.d.ts.map +1 -0
- package/dist/harness/script-check.js +169 -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 +26 -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 +45 -13
- 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 +8 -3
- 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-selector-fix.md +57 -11
- package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
- package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +53 -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 +27 -11
- 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 +6 -3
- 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 +62 -16
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/dist/orchestrator/templates/qa-context.md +90 -0
- package/dist/orchestrator/templates/readme.md +16 -13
- package/dist/orchestrator/templates/specs-test-data.ts +9 -0
- 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 +10 -6
- 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/challenge.ts +55 -0
- package/src/cli/commands/feedback.ts +65 -0
- package/src/cli/commands/generate.ts +19 -0
- 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 +16 -0
- 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/patterns/capture-patterns.ts +59 -0
- 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/harness/audit.ts +112 -0
- package/src/harness/blindspot.ts +51 -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/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 +149 -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 +30 -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 +45 -13
- 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 +8 -3
- 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-selector-fix.md +57 -11
- package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
- package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +53 -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 +27 -11
- 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 +6 -3
- 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 +62 -16
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +40 -1
- package/src/orchestrator/templates/qa-context.md +90 -0
- package/src/orchestrator/templates/readme.md +16 -13
- package/src/orchestrator/templates/specs-test-data.ts +9 -0
- 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
|
@@ -54,6 +54,15 @@ export class TestDataLoader {
|
|
|
54
54
|
}
|
|
55
55
|
return String(current);
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Set a value at runtime (used by captured-variable steps:
|
|
60
|
+
* `User remember [X] text as {{var}}`). Stored at top level so a later
|
|
61
|
+
* `{{var}}` reference resolves via get().
|
|
62
|
+
*/
|
|
63
|
+
set(key: string, value: string): void {
|
|
64
|
+
this.data[key] = value;
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
function loadYamlSync(filePath: string): Record<string, any> | null {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Safeguards enforced on every save AND every assertSafeToUse call:
|
|
8
8
|
* 1. .env must appear in .gitignore (abort if not).
|
|
9
|
-
* 2. No tracked file may contain
|
|
9
|
+
* 2. No tracked file may contain an assigned token value (FIGMA_PAT=<token>).
|
|
10
|
+
* The scan matches a token-shaped value, not bare mentions of the key in
|
|
11
|
+
* code or docs (those are not secrets).
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
import * as fs from 'fs';
|
|
@@ -17,6 +19,14 @@ const PAT_KEY = 'FIGMA_PAT';
|
|
|
17
19
|
const ENV_FILE = '.env';
|
|
18
20
|
const GITIGNORE_FILE = '.gitignore';
|
|
19
21
|
|
|
22
|
+
// A real leak is an assigned token value (`FIGMA_PAT=<token>`), not a bare
|
|
23
|
+
// mention of the key name in code or documentation. Figma PATs are long
|
|
24
|
+
// (~40+ chars), so we only flag an assignment whose value looks like an actual
|
|
25
|
+
// token: at least 16 non-space characters after `=` (an optional quote allowed).
|
|
26
|
+
// This is an ERE pattern for `git grep -E`; it deliberately does NOT match this
|
|
27
|
+
// file's own comments or template literals (`${PAT_KEY}=...`).
|
|
28
|
+
const PAT_VALUE_PATTERN = `${PAT_KEY}=['"]?[^[:space:]]{16,}`;
|
|
29
|
+
|
|
20
30
|
// ---------------------------------------------------------------------------
|
|
21
31
|
// Internal helpers
|
|
22
32
|
// ---------------------------------------------------------------------------
|
|
@@ -57,11 +67,11 @@ function isEnvIgnored(cwd: string): boolean {
|
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
/**
|
|
60
|
-
*
|
|
70
|
+
* Scan tracked files for an assigned Figma token value (not bare key mentions).
|
|
61
71
|
* Returns list of matching tracked file paths (empty = safe).
|
|
62
72
|
*/
|
|
63
73
|
async function findTrackedFilesWithPat(cwd: string): Promise<string[]> {
|
|
64
|
-
const result = await execFileNoThrow('git', ['grep', '-
|
|
74
|
+
const result = await execFileNoThrow('git', ['grep', '-lE', PAT_VALUE_PATTERN], cwd);
|
|
65
75
|
if (result.status === 0 && result.stdout.trim()) {
|
|
66
76
|
return result.stdout.trim().split('\n').filter(Boolean);
|
|
67
77
|
}
|
|
@@ -105,13 +115,13 @@ export async function savePat(cwd: string, token: string): Promise<void> {
|
|
|
105
115
|
);
|
|
106
116
|
}
|
|
107
117
|
|
|
108
|
-
// Safeguard 2: no tracked file may contain
|
|
118
|
+
// Safeguard 2: no tracked file may contain an assigned token value
|
|
109
119
|
const leakedFiles = await findTrackedFilesWithPat(cwd);
|
|
110
120
|
if (leakedFiles.length > 0) {
|
|
111
121
|
throw new Error(
|
|
112
|
-
`Refusing to save FIGMA_PAT: token
|
|
122
|
+
`Refusing to save FIGMA_PAT: a token value appears in tracked file(s):\n` +
|
|
113
123
|
leakedFiles.map((f) => ` ${f}`).join('\n') +
|
|
114
|
-
`\n\nRemove
|
|
124
|
+
`\n\nRemove the token from those files, commit the removal, then re-run.\n`,
|
|
115
125
|
);
|
|
116
126
|
}
|
|
117
127
|
|
|
@@ -145,7 +155,8 @@ export function clearPat(cwd: string): void {
|
|
|
145
155
|
|
|
146
156
|
/**
|
|
147
157
|
* Run tracked-file scan on every Figma CLI / skill invocation.
|
|
148
|
-
* Aborts with actionable message if
|
|
158
|
+
* Aborts with an actionable message if an assigned token value is found in any
|
|
159
|
+
* tracked file (bare mentions of the key name are ignored).
|
|
149
160
|
*
|
|
150
161
|
* @throws Error with remediation instructions on safeguard failure.
|
|
151
162
|
*/
|
|
@@ -153,9 +164,9 @@ export async function assertSafeToUse(cwd: string): Promise<void> {
|
|
|
153
164
|
const leakedFiles = await findTrackedFilesWithPat(cwd);
|
|
154
165
|
if (leakedFiles.length > 0) {
|
|
155
166
|
throw new Error(
|
|
156
|
-
`Security check failed:
|
|
167
|
+
`Security check failed: a Figma token value appears in tracked file(s):\n` +
|
|
157
168
|
leakedFiles.map((f) => ` ${f}`).join('\n') +
|
|
158
|
-
`\n\nRemove
|
|
169
|
+
`\n\nRemove the token from those files and commit the removal before using Figma commands.\n`,
|
|
159
170
|
);
|
|
160
171
|
}
|
|
161
172
|
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sungen-capture-figma
|
|
3
|
-
description: 'Fetch design context + PNG from a Figma frame URL via Figma Dev Mode MCP. Auto-loaded by create-test when user picks Figma as the visual source.'
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Pull **structured design data** (layout, typography, colors, component tree, design tokens) and a **PNG screenshot** from a Figma frame URL, so `sungen-tc-generation` can author Gherkin + test-data before a live domain exists.
|
|
10
|
-
|
|
11
|
-
Use this when the project is pre-launch, or when Figma is the source of truth and the live build lags the design.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Prerequisites
|
|
16
|
-
|
|
17
|
-
- **Figma MCP server** (`https://mcp.figma.com/mcp`, HTTP transport) connected in the user's `.mcp.json` — `sungen init` scaffolds this automatically. On first use, Claude Code opens a browser for Figma OAuth. Official tools: `get_design_context`, `get_variable_defs`, `get_screenshot`.
|
|
18
|
-
- Figma account signed in with access to the file. **Dev/Full seats** get per-minute rate limits; **Starter/View seats** get monthly tool-call limits.
|
|
19
|
-
- A Figma URL with both **fileKey** and **nodeId** in it.
|
|
20
|
-
|
|
21
|
-
If the MCP is not connected, **do not fail silently** — tell the user:
|
|
22
|
-
> "Figma MCP not detected. Run `sungen init` to scaffold the config, or manually add `figma` with `url: https://mcp.figma.com/mcp` to `.mcp.json`. Then sign in when Claude Code prompts."
|
|
23
|
-
|
|
24
|
-
Then stop.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Steps
|
|
29
|
-
|
|
30
|
-
### 1. Resolve Figma URL
|
|
31
|
-
|
|
32
|
-
Prefer in this order:
|
|
33
|
-
|
|
34
|
-
1. `Figma URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
|
|
35
|
-
2. If empty or missing → `AskUserQuestion`: *"Paste the Figma frame URL"* (free text)
|
|
36
|
-
|
|
37
|
-
Accept any of these URL shapes:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
https://www.figma.com/file/<fileKey>/<title>?node-id=<nodeId>
|
|
41
|
-
https://www.figma.com/design/<fileKey>/<title>?node-id=<nodeId>
|
|
42
|
-
https://www.figma.com/proto/<fileKey>/<title>?node-id=<nodeId>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Parse:
|
|
46
|
-
- `fileKey` = the segment after `/file/`, `/design/`, or `/proto/`
|
|
47
|
-
- `nodeId` = the `node-id` query param (may use `-` or `:` — pass through as-is; MCP accepts both)
|
|
48
|
-
|
|
49
|
-
If `node-id` is missing, ask the user to select a frame in Figma and copy the **frame URL** specifically (not the file root URL).
|
|
50
|
-
|
|
51
|
-
### 2. Fetch design context
|
|
52
|
-
|
|
53
|
-
Call **both** in parallel:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
get_design_context({ fileKey, nodeId })
|
|
57
|
-
get_variable_defs({ fileKey, nodeId })
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`get_design_context` returns layout, typography, color values, component structure, spacing.
|
|
61
|
-
`get_variable_defs` returns named design tokens (color/spacing/typography variables).
|
|
62
|
-
|
|
63
|
-
### 3. Fetch screenshot
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
get_screenshot({ fileKey, nodeId })
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Save the returned PNG to:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
qa/screens/<screen>/requirements/ui/figma-<sanitized-nodeId>.png
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Sanitize `nodeId` for filesystem: replace `:` and `-` with `_`. Example: `42-15` → `figma-42_15.png`.
|
|
76
|
-
|
|
77
|
-
### 4. Write metadata dump
|
|
78
|
-
|
|
79
|
-
Combine the design context + variables into a Markdown summary at:
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
qa/screens/<screen>/requirements/ui/figma-meta.md
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Format:
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
# Figma Capture — <nodeId>
|
|
89
|
-
|
|
90
|
-
**Source:** <full Figma URL>
|
|
91
|
-
**Captured:** <ISO date>
|
|
92
|
-
|
|
93
|
-
## Components
|
|
94
|
-
<hierarchical list of component names + variants from get_design_context>
|
|
95
|
-
|
|
96
|
-
## Typography
|
|
97
|
-
<font families, sizes, weights, line heights>
|
|
98
|
-
|
|
99
|
-
## Colors
|
|
100
|
-
<color tokens + raw hex values>
|
|
101
|
-
|
|
102
|
-
## Spacing & Layout
|
|
103
|
-
<spacing tokens, auto-layout specs>
|
|
104
|
-
|
|
105
|
-
## Text Content
|
|
106
|
-
<visible text strings from the frame — used by tc-generation to populate test-data>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
This file is consumed by `sungen-tc-generation` as a secondary source alongside `spec.md`.
|
|
110
|
-
|
|
111
|
-
### 5. Report back
|
|
112
|
-
|
|
113
|
-
Output a short summary to the user:
|
|
114
|
-
|
|
115
|
-
> Captured Figma frame `<nodeId>`:
|
|
116
|
-
> - Components: N
|
|
117
|
-
> - Text strings: M
|
|
118
|
-
> - Design tokens: K
|
|
119
|
-
> - Screenshot: `qa/screens/<screen>/requirements/ui/figma-<nodeId>.png`
|
|
120
|
-
> - Metadata: `requirements/ui/figma-meta.md`
|
|
121
|
-
|
|
122
|
-
Then hand back to the calling command.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Error handling
|
|
127
|
-
|
|
128
|
-
| Error | Action |
|
|
129
|
-
|---|---|
|
|
130
|
-
| MCP tool not available | Print setup instructions, stop, do not fall back silently |
|
|
131
|
-
| `fileKey` missing from URL | Ask user to paste a valid frame URL |
|
|
132
|
-
| `nodeId` missing from URL | Ask user to right-click a frame in Figma → *Copy link to selection* |
|
|
133
|
-
| `get_design_context` 403 | Ask user to check Dev Mode seat on that file |
|
|
134
|
-
| `get_screenshot` returns no image | Continue with metadata only; warn user no PNG was captured |
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## What this skill does NOT do
|
|
139
|
-
|
|
140
|
-
- Does not generate Gherkin (that's `sungen-tc-generation`)
|
|
141
|
-
- Does not write `selectors.yaml` (that's `/sungen:run-test`)
|
|
142
|
-
- Does not validate the design against live UI (future skill: `sungen-capture-live` can be run afterwards for cross-check)
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sungen-capture-live
|
|
3
|
-
description: 'Capture a live running page via Playwright MCP — snapshot + screenshot for visual context. Auto-loaded by create-test when user picks Live page scan.'
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Navigate a running application, take **one accessibility snapshot** and **one screenshot**, and save them as visual context for test generation. Use when the app is live (dev, staging, or production with read-only access) and you want the tests grounded in the actual rendered UI.
|
|
10
|
-
|
|
11
|
-
This skill handles auth gracefully: if the page redirects to login, it asks the user to sign in manually rather than injecting cookies.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Prerequisites
|
|
16
|
-
|
|
17
|
-
- Playwright MCP connected.
|
|
18
|
-
- Dev/staging server reachable (or a public URL).
|
|
19
|
-
- `playwright.config.ts` exists at the project root (for `baseURL` fallback).
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Steps
|
|
24
|
-
|
|
25
|
-
### 1. Resolve target URL
|
|
26
|
-
|
|
27
|
-
Resolve in this order:
|
|
28
|
-
|
|
29
|
-
1. `Live URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
|
|
30
|
-
2. `baseURL` from `playwright.config.ts` + `URL Path` from `spec.md`
|
|
31
|
-
3. If neither works → `AskUserQuestion`: *"Paste the full URL for the page to scan"*
|
|
32
|
-
|
|
33
|
-
### 2. Navigate
|
|
34
|
-
|
|
35
|
-
`browser_navigate` to the resolved URL.
|
|
36
|
-
|
|
37
|
-
### 3. Handle auth redirect
|
|
38
|
-
|
|
39
|
-
If the page redirects to a login route (URL contains `/login`, `/signin`, `/auth`, or the page title/content indicates a login screen):
|
|
40
|
-
|
|
41
|
-
1. Tell the user which login URL they landed on.
|
|
42
|
-
2. `AskUserQuestion`:
|
|
43
|
-
- **I'll log in manually** — wait for user confirmation, then re-navigate to the target URL
|
|
44
|
-
- **Skip live scan** — tell caller to invoke `sungen-capture-local` instead
|
|
45
|
-
- **Cancel**
|
|
46
|
-
3. **Never** inject cookies or localStorage via `browser_evaluate` or `browser_run_code`. Auth belongs to the user.
|
|
47
|
-
|
|
48
|
-
### 4. Snapshot
|
|
49
|
-
|
|
50
|
-
Take **ONE** `browser_snapshot`. This accessibility tree is the primary AI context — it contains roles, names, text, and structure that the tc-generation skill uses to identify sections and fields.
|
|
51
|
-
|
|
52
|
-
### 5. Screenshot (optional but recommended)
|
|
53
|
-
|
|
54
|
-
Take **ONE** `browser_take_screenshot` with `fullPage: true`. Save to:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
qa/screens/<screen>/requirements/ui/live-<timestamp>.png
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Where `<timestamp>` is `YYYYMMDD-HHMM` in local time (e.g. `live-20260421-1430.png`).
|
|
61
|
-
|
|
62
|
-
This gives users a visual record they can reference later without re-scanning.
|
|
63
|
-
|
|
64
|
-
### 6a. Verify unauthenticated redirect target (flow capture only)
|
|
65
|
-
|
|
66
|
-
When capturing for a **flow** that includes security scenarios (e.g., "unauthenticated user cannot access X"):
|
|
67
|
-
|
|
68
|
-
1. Open a **fresh incognito/unauthenticated** browser context (no storage state).
|
|
69
|
-
2. `browser_navigate` to the protected route (e.g., `/dashboard`).
|
|
70
|
-
3. Record the **actual redirect URL** — do NOT assume it goes to `/login`. The app may redirect to `/register`, `/`, or any other route.
|
|
71
|
-
4. Report the redirect target to the caller: *"Unauthenticated access to `/dashboard` redirects to `/register`"*.
|
|
72
|
-
5. The caller must use the **actual redirect URL** in Gherkin assertions (e.g., `Then User is on [Register] page`), never an assumed one.
|
|
73
|
-
|
|
74
|
-
Skip this step if the flow has no security scenarios or the user explicitly says to skip.
|
|
75
|
-
|
|
76
|
-
### 6. Detect discrepancies vs spec
|
|
77
|
-
|
|
78
|
-
If `spec.md` exists, briefly cross-check the snapshot against spec sections:
|
|
79
|
-
|
|
80
|
-
- Fields listed in spec but not in snapshot → flag as *missing in UI*
|
|
81
|
-
- Elements visible in snapshot but not in spec → flag as *missing in spec*
|
|
82
|
-
|
|
83
|
-
Report findings but **do not** auto-edit `spec.md` — let the user decide.
|
|
84
|
-
|
|
85
|
-
### 7. Report back
|
|
86
|
-
|
|
87
|
-
> Captured live page `<URL>`:
|
|
88
|
-
> - Snapshot: <N> interactive elements detected
|
|
89
|
-
> - Screenshot: `requirements/ui/live-<timestamp>.png`
|
|
90
|
-
> - Discrepancies vs spec: <count, or "none">
|
|
91
|
-
|
|
92
|
-
Hand back to the calling command.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## What this skill does NOT do
|
|
97
|
-
|
|
98
|
-
- Does not run tests
|
|
99
|
-
- Does not generate `selectors.yaml` (that's `/sungen:run-test`)
|
|
100
|
-
- Does not inject auth state (user logs in manually)
|
|
101
|
-
- Does not crawl — scans **exactly one** page per invocation
|
|
102
|
-
- Does not generate Gherkin — that's `sungen-tc-generation`
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Relationship to other capture skills
|
|
107
|
-
|
|
108
|
-
- `sungen-capture-figma` — design source of truth (pre-launch)
|
|
109
|
-
- `sungen-capture-local` — any image the user dropped in `requirements/ui/`
|
|
110
|
-
- `sungen-capture-live` — this skill, verifies/supplements against the running app
|
|
111
|
-
|
|
112
|
-
All three write to `requirements/ui/` and report back to the caller. They are mutually exclusive per create-test run, but a user can run create-test multiple times with different sources to layer context.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sungen-capture-local
|
|
3
|
-
description: 'Load existing UI assets (screenshots, Figma exports, hand-drawn mockups) from requirements/ui/. Auto-loaded by create-test when user picks UI images as the visual source.'
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Use **pre-existing images** in `qa/screens/<screen>/requirements/ui/` as visual context for test generation. No network, no MCP, no live site required — works for any design tool (Figma export, Sketch, Penpot, Zeplin, hand-drawn, screenshots of a staging env).
|
|
10
|
-
|
|
11
|
-
This is the **baseline fallback**: if live domain is down and Figma MCP isn't configured, this always works as long as the user drops images in the folder.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Steps
|
|
16
|
-
|
|
17
|
-
### 1. List available images
|
|
18
|
-
|
|
19
|
-
Glob `qa/screens/<screen>/requirements/ui/*.{png,jpg,jpeg,webp,gif}` and report count + filenames.
|
|
20
|
-
|
|
21
|
-
Filter out metadata files (e.g. `figma-meta.md` written by `sungen-capture-figma`) — those are read by `tc-generation` separately, not treated as images here.
|
|
22
|
-
|
|
23
|
-
### 2. Handle empty folder
|
|
24
|
-
|
|
25
|
-
If no images found:
|
|
26
|
-
|
|
27
|
-
1. Tell the user the folder is empty, with the full path so they can navigate there in Finder.
|
|
28
|
-
2. `AskUserQuestion`:
|
|
29
|
-
- **I'll drop images now** — wait for user to confirm, then re-glob
|
|
30
|
-
- **Switch to Figma URL** — tell caller to invoke `sungen-capture-figma` instead
|
|
31
|
-
- **Switch to live page scan** — tell caller to invoke `sungen-capture-live` instead
|
|
32
|
-
- **Cancel** — abort create-test
|
|
33
|
-
3. If user picks "drop images now", wait for their confirmation message (e.g. "done") then re-run step 1.
|
|
34
|
-
|
|
35
|
-
### 3. Read images for context
|
|
36
|
-
|
|
37
|
-
Use the `Read` tool on each image file — Claude Code can read PNG/JPG/WebP directly as visual context.
|
|
38
|
-
|
|
39
|
-
For large sets (>10 images), ask the user which are primary and which are states/variants, to avoid loading too much visual context at once.
|
|
40
|
-
|
|
41
|
-
### 4. Summarize
|
|
42
|
-
|
|
43
|
-
Output a short summary:
|
|
44
|
-
|
|
45
|
-
> Loaded N image(s) from `qa/screens/<screen>/requirements/ui/`:
|
|
46
|
-
> - `<filename-1>` — <one-line description of what's visible>
|
|
47
|
-
> - `<filename-2>` — <one-line description>
|
|
48
|
-
> ...
|
|
49
|
-
|
|
50
|
-
Hand back to the calling command.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## File naming hints for users
|
|
55
|
-
|
|
56
|
-
When this skill reports back, nudge users toward consistent filenames so future runs are self-documenting:
|
|
57
|
-
|
|
58
|
-
- `<section>-default.png` — baseline state of a section
|
|
59
|
-
- `<section>-error.png` — error state
|
|
60
|
-
- `<section>-loading.png` — loading state
|
|
61
|
-
- `<section>-empty.png` — empty state
|
|
62
|
-
- `full-page.png` / `viewport.png` — whole screen (auto-generated by `sungen add --capture`)
|
|
63
|
-
|
|
64
|
-
Don't enforce — just suggest if filenames are ambiguous.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## What this skill does NOT do
|
|
69
|
-
|
|
70
|
-
- Does not download images from external URLs
|
|
71
|
-
- Does not generate images (no AI image generation)
|
|
72
|
-
- Does not modify existing images (no crop/resize)
|
|
73
|
-
- Does not generate Gherkin — that's `sungen-tc-generation`
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sungen-capture-figma
|
|
3
|
-
description: 'Fetch design context + PNG from a Figma frame URL via Figma Dev Mode MCP. Auto-loaded by create-test when user picks Figma as the visual source.'
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Pull **structured design data** (layout, typography, colors, component tree, design tokens) and a **PNG screenshot** from a Figma frame URL, so `sungen-tc-generation` can author Gherkin + test-data before a live domain exists.
|
|
10
|
-
|
|
11
|
-
Use this when the project is pre-launch, or when Figma is the source of truth and the live build lags the design.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Prerequisites
|
|
16
|
-
|
|
17
|
-
- **Figma MCP server** (`https://mcp.figma.com/mcp`, HTTP transport) connected in `.vscode/mcp.json` — `sungen init` scaffolds this automatically. On first use, VS Code / Copilot opens a browser for Figma OAuth. Official tools: `get_design_context`, `get_variable_defs`, `get_screenshot`.
|
|
18
|
-
- Figma account signed in with access to the file. **Dev/Full seats** get per-minute rate limits; **Starter/View seats** get monthly tool-call limits.
|
|
19
|
-
- A Figma URL with both **fileKey** and **nodeId** in it.
|
|
20
|
-
|
|
21
|
-
If the MCP is not connected, **do not fail silently** — tell the user:
|
|
22
|
-
> "Figma MCP not detected. Run `sungen init` to scaffold the config, or manually add `figma` with `url: https://mcp.figma.com/mcp` to `.vscode/mcp.json`. Then sign in when VS Code prompts."
|
|
23
|
-
|
|
24
|
-
Then stop.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Steps
|
|
29
|
-
|
|
30
|
-
### 1. Resolve Figma URL
|
|
31
|
-
|
|
32
|
-
Prefer in this order:
|
|
33
|
-
|
|
34
|
-
1. `Figma URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
|
|
35
|
-
2. If empty or missing → ask the user: *"Paste the Figma frame URL"*
|
|
36
|
-
|
|
37
|
-
Accept any of these URL shapes:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
https://www.figma.com/file/<fileKey>/<title>?node-id=<nodeId>
|
|
41
|
-
https://www.figma.com/design/<fileKey>/<title>?node-id=<nodeId>
|
|
42
|
-
https://www.figma.com/proto/<fileKey>/<title>?node-id=<nodeId>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Parse:
|
|
46
|
-
- `fileKey` = the segment after `/file/`, `/design/`, or `/proto/`
|
|
47
|
-
- `nodeId` = the `node-id` query param (may use `-` or `:` — pass through as-is; MCP accepts both)
|
|
48
|
-
|
|
49
|
-
If `node-id` is missing, ask the user to select a frame in Figma and copy the **frame URL** specifically (not the file root URL).
|
|
50
|
-
|
|
51
|
-
### 2. Fetch design context
|
|
52
|
-
|
|
53
|
-
Call **both** in parallel:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
get_design_context({ fileKey, nodeId })
|
|
57
|
-
get_variable_defs({ fileKey, nodeId })
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`get_design_context` returns layout, typography, color values, component structure, spacing.
|
|
61
|
-
`get_variable_defs` returns named design tokens (color/spacing/typography variables).
|
|
62
|
-
|
|
63
|
-
### 3. Fetch screenshot
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
get_screenshot({ fileKey, nodeId })
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Save the returned PNG to:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
qa/screens/<screen>/requirements/ui/figma-<sanitized-nodeId>.png
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Sanitize `nodeId` for filesystem: replace `:` and `-` with `_`. Example: `42-15` → `figma-42_15.png`.
|
|
76
|
-
|
|
77
|
-
### 4. Write metadata dump
|
|
78
|
-
|
|
79
|
-
Combine the design context + variables into a Markdown summary at:
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
qa/screens/<screen>/requirements/ui/figma-meta.md
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Format:
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
# Figma Capture — <nodeId>
|
|
89
|
-
|
|
90
|
-
**Source:** <full Figma URL>
|
|
91
|
-
**Captured:** <ISO date>
|
|
92
|
-
|
|
93
|
-
## Components
|
|
94
|
-
<hierarchical list of component names + variants from get_design_context>
|
|
95
|
-
|
|
96
|
-
## Typography
|
|
97
|
-
<font families, sizes, weights, line heights>
|
|
98
|
-
|
|
99
|
-
## Colors
|
|
100
|
-
<color tokens + raw hex values>
|
|
101
|
-
|
|
102
|
-
## Spacing & Layout
|
|
103
|
-
<spacing tokens, auto-layout specs>
|
|
104
|
-
|
|
105
|
-
## Text Content
|
|
106
|
-
<visible text strings from the frame — used by tc-generation to populate test-data>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
This file is consumed by `sungen-tc-generation` as a secondary source alongside `spec.md`.
|
|
110
|
-
|
|
111
|
-
### 5. Report back
|
|
112
|
-
|
|
113
|
-
Output a short summary to the user:
|
|
114
|
-
|
|
115
|
-
> Captured Figma frame `<nodeId>`:
|
|
116
|
-
> - Components: N
|
|
117
|
-
> - Text strings: M
|
|
118
|
-
> - Design tokens: K
|
|
119
|
-
> - Screenshot: `qa/screens/<screen>/requirements/ui/figma-<nodeId>.png`
|
|
120
|
-
> - Metadata: `requirements/ui/figma-meta.md`
|
|
121
|
-
|
|
122
|
-
Then hand back to the calling command.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Error handling
|
|
127
|
-
|
|
128
|
-
| Error | Action |
|
|
129
|
-
|---|---|
|
|
130
|
-
| MCP tool not available | Print setup instructions, stop, do not fall back silently |
|
|
131
|
-
| `fileKey` missing from URL | Ask user to paste a valid frame URL |
|
|
132
|
-
| `nodeId` missing from URL | Ask user to right-click a frame in Figma → *Copy link to selection* |
|
|
133
|
-
| `get_design_context` 403 | Ask user to check Dev Mode seat on that file |
|
|
134
|
-
| `get_screenshot` returns no image | Continue with metadata only; warn user no PNG was captured |
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## What this skill does NOT do
|
|
139
|
-
|
|
140
|
-
- Does not generate Gherkin (that's `sungen-tc-generation`)
|
|
141
|
-
- Does not write `selectors.yaml` (that's `/sungen-run-test`)
|
|
142
|
-
- Does not validate the design against live UI (future skill: `sungen-capture-live` can be run afterwards for cross-check)
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sungen-capture-live
|
|
3
|
-
description: 'Capture a live running page via Playwright MCP — snapshot + screenshot for visual context. Auto-loaded by create-test when user picks Live page scan.'
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Navigate a running application, take **one accessibility snapshot** and **one screenshot**, and save them as visual context for test generation. Use when the app is live (dev, staging, or production with read-only access) and you want the tests grounded in the actual rendered UI.
|
|
10
|
-
|
|
11
|
-
This skill handles auth gracefully: if the page redirects to login, it asks the user to sign in manually rather than injecting cookies.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Prerequisites
|
|
16
|
-
|
|
17
|
-
- Playwright MCP connected.
|
|
18
|
-
- Dev/staging server reachable (or a public URL).
|
|
19
|
-
- `playwright.config.ts` exists at the project root (for `baseURL` fallback).
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Steps
|
|
24
|
-
|
|
25
|
-
### 1. Resolve target URL
|
|
26
|
-
|
|
27
|
-
Resolve in this order:
|
|
28
|
-
|
|
29
|
-
1. `Live URL` field in `qa/screens/<screen>/requirements/spec.md` (Overview section)
|
|
30
|
-
2. `baseURL` from `playwright.config.ts` + `URL Path` from `spec.md`
|
|
31
|
-
3. If neither works → ask the user: *"Paste the full URL for the page to scan"*
|
|
32
|
-
|
|
33
|
-
### 2. Navigate
|
|
34
|
-
|
|
35
|
-
`browser_navigate` to the resolved URL.
|
|
36
|
-
|
|
37
|
-
### 3. Handle auth redirect
|
|
38
|
-
|
|
39
|
-
If the page redirects to a login route (URL contains `/login`, `/signin`, `/auth`, or the page title/content indicates a login screen):
|
|
40
|
-
|
|
41
|
-
1. Tell the user which login URL they landed on.
|
|
42
|
-
2. Ask the user:
|
|
43
|
-
- **1) I'll log in manually** — wait for user confirmation, then re-navigate to the target URL
|
|
44
|
-
- **2) Skip live scan** — tell caller to invoke `sungen-capture-local` instead
|
|
45
|
-
- **3) Cancel**
|
|
46
|
-
3. **Never** inject cookies or localStorage via `browser_evaluate` or `browser_run_code`. Auth belongs to the user.
|
|
47
|
-
|
|
48
|
-
### 4. Snapshot
|
|
49
|
-
|
|
50
|
-
Take **ONE** `browser_snapshot`. This accessibility tree is the primary AI context — it contains roles, names, text, and structure that the tc-generation skill uses to identify sections and fields.
|
|
51
|
-
|
|
52
|
-
### 5. Screenshot (optional but recommended)
|
|
53
|
-
|
|
54
|
-
Take **ONE** `browser_take_screenshot` with `fullPage: true`. Save to:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
qa/screens/<screen>/requirements/ui/live-<timestamp>.png
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Where `<timestamp>` is `YYYYMMDD-HHMM` in local time (e.g. `live-20260421-1430.png`).
|
|
61
|
-
|
|
62
|
-
This gives users a visual record they can reference later without re-scanning.
|
|
63
|
-
|
|
64
|
-
### 6a. Verify unauthenticated redirect target (flow capture only)
|
|
65
|
-
|
|
66
|
-
When capturing for a **flow** that includes security scenarios (e.g., "unauthenticated user cannot access X"):
|
|
67
|
-
|
|
68
|
-
1. Open a **fresh incognito/unauthenticated** browser context (no storage state).
|
|
69
|
-
2. `browser_navigate` to the protected route (e.g., `/dashboard`).
|
|
70
|
-
3. Record the **actual redirect URL** — do NOT assume it goes to `/login`. The app may redirect to `/register`, `/`, or any other route.
|
|
71
|
-
4. Report the redirect target to the caller: *"Unauthenticated access to `/dashboard` redirects to `/register`"*.
|
|
72
|
-
5. The caller must use the **actual redirect URL** in Gherkin assertions (e.g., `Then User is on [Register] page`), never an assumed one.
|
|
73
|
-
|
|
74
|
-
Skip this step if the flow has no security scenarios or the user explicitly says to skip.
|
|
75
|
-
|
|
76
|
-
### 6. Detect discrepancies vs spec
|
|
77
|
-
|
|
78
|
-
If `spec.md` exists, briefly cross-check the snapshot against spec sections:
|
|
79
|
-
|
|
80
|
-
- Fields listed in spec but not in snapshot → flag as *missing in UI*
|
|
81
|
-
- Elements visible in snapshot but not in spec → flag as *missing in spec*
|
|
82
|
-
|
|
83
|
-
Report findings but **do not** auto-edit `spec.md` — let the user decide.
|
|
84
|
-
|
|
85
|
-
### 7. Report back
|
|
86
|
-
|
|
87
|
-
> Captured live page `<URL>`:
|
|
88
|
-
> - Snapshot: <N> interactive elements detected
|
|
89
|
-
> - Screenshot: `requirements/ui/live-<timestamp>.png`
|
|
90
|
-
> - Discrepancies vs spec: <count, or "none">
|
|
91
|
-
|
|
92
|
-
Hand back to the calling command.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## What this skill does NOT do
|
|
97
|
-
|
|
98
|
-
- Does not run tests
|
|
99
|
-
- Does not generate `selectors.yaml` (that's `/sungen-run-test`)
|
|
100
|
-
- Does not inject auth state (user logs in manually)
|
|
101
|
-
- Does not crawl — scans **exactly one** page per invocation
|
|
102
|
-
- Does not generate Gherkin — that's `sungen-tc-generation`
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Relationship to other capture skills
|
|
107
|
-
|
|
108
|
-
- `sungen-capture-figma` — design source of truth (pre-launch)
|
|
109
|
-
- `sungen-capture-local` — any image the user dropped in `requirements/ui/`
|
|
110
|
-
- `sungen-capture-live` — this skill, verifies/supplements against the running app
|
|
111
|
-
|
|
112
|
-
All three write to `requirements/ui/` and report back to the caller. They are mutually exclusive per create-test run, but a user can run create-test multiple times with different sources to layer context.
|