@bastani/atomic 0.9.0-alpha.3 → 0.9.0
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/CHANGELOG.md +48 -0
- package/dist/builtin/cursor/CHANGELOG.md +7 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +8 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +12 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +17 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +8 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +50 -0
- package/dist/builtin/workflows/README.md +12 -12
- package/dist/builtin/workflows/builtin/goal-prompts.ts +8 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +96 -1
- package/dist/builtin/workflows/builtin/goal-types.ts +2 -0
- package/dist/builtin/workflows/builtin/goal.d.ts +3 -0
- package/dist/builtin/workflows/builtin/goal.ts +12 -1
- package/dist/builtin/workflows/builtin/index.d.ts +8 -8
- package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +359 -0
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +254 -352
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +256 -414
- package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +272 -0
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +58 -68
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +5 -9
- package/dist/builtin/workflows/builtin/open-claude-design.ts +14 -26
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +14 -23
- package/dist/builtin/workflows/skills/impeccable/reference/brand.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +25 -4
- package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +724 -29
- package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +219 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +57 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +750 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +648 -53
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +7 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +29 -4
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +44 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +29 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +27 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +29 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +401 -46
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +6 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/{design-parser.mjs → lib/design-parser.mjs} +8 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +638 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +128 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/{is-generated.mjs → lib/is-generated.mjs} +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +42 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +49 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/{live-completion.mjs → live/completion.mjs} +1 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/{live-event-validation.mjs → live/event-validation.mjs} +6 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +939 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/{live-manual-edits-buffer.mjs → live/manual-edits-buffer.mjs} +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/{live-session-store.mjs → live/session-store.mjs} +21 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +835 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +274 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-core.mjs +180 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +36 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +185 -60
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +146 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +3369 -1026
- package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +133 -9
- package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +42 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +4 -4
- package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +21 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +205 -1269
- package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +30 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +69 -26
- package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +73 -22
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +5 -5
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/docs/index.md +2 -2
- package/docs/quickstart.md +9 -9
- package/docs/workflows.md +42 -23
- package/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/cleanup-deprecated.mjs +0 -284
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable-paths.mjs +0 -126
- /package/dist/builtin/workflows/skills/impeccable/scripts/{live-insert-ui.mjs → live/insert-ui.mjs} +0 -0
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import type { WorkflowParallelOptions, WorkflowTaskOptions, WorkflowTaskResult, WorkflowTaskStep } from "../src/shared/types.js";
|
|
2
2
|
import {
|
|
3
|
-
ANTI_SLOP_RULES,
|
|
4
3
|
DEFAULT_MAX_REFINEMENTS,
|
|
5
|
-
|
|
6
|
-
READ_ONLY_TOOLS,
|
|
4
|
+
REFERENCE_PRECEDENCE,
|
|
7
5
|
buildPlaywrightCliBootstrapRules,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isUrl,
|
|
6
|
+
discoveryDecisionSchema,
|
|
7
|
+
ensurePlaywrightCli,
|
|
11
8
|
joinResults,
|
|
12
|
-
normalizeOutputType,
|
|
13
9
|
positiveInteger,
|
|
14
10
|
prepareArtifactDir,
|
|
15
|
-
|
|
11
|
+
shouldEarlyExitForBrowser,
|
|
16
12
|
taggedPrompt,
|
|
17
|
-
ensurePlaywrightCli,
|
|
18
13
|
} from "./open-claude-design-utils.js";
|
|
19
14
|
import { exportOpenClaudeDesign, refineOpenClaudeDesign } from "./open-claude-design-phases.js";
|
|
15
|
+
import {
|
|
16
|
+
NO_REFERENCES_BRIEF,
|
|
17
|
+
buildReferenceDiscoveryPrompt,
|
|
18
|
+
persistReferencesBrief,
|
|
19
|
+
runDiscoveryAndInit,
|
|
20
|
+
} from "./open-claude-design-setup.js";
|
|
20
21
|
|
|
21
22
|
type OpenClaudeDesignOutputs = {
|
|
22
23
|
readonly output_type?: string; readonly design_system?: string; readonly artifact?: string; readonly handoff?: string;
|
|
@@ -27,7 +28,8 @@ type OpenClaudeDesignOutputs = {
|
|
|
27
28
|
|
|
28
29
|
type OpenClaudeDesignContext = {
|
|
29
30
|
readonly cwd?: string;
|
|
30
|
-
readonly inputs: { readonly prompt: string; readonly
|
|
31
|
+
readonly inputs: { readonly prompt: string; readonly discover_references?: boolean; readonly max_refinements?: number };
|
|
32
|
+
exit?(options?: { readonly status?: string; readonly reason?: string; readonly outputs?: Partial<OpenClaudeDesignOutputs> }): never;
|
|
31
33
|
task(name: string, options: WorkflowTaskOptions): Promise<WorkflowTaskResult>;
|
|
32
34
|
parallel(steps: readonly WorkflowTaskStep[], options: WorkflowParallelOptions): Promise<WorkflowTaskResult[]>;
|
|
33
35
|
};
|
|
@@ -35,442 +37,282 @@ type OpenClaudeDesignContext = {
|
|
|
35
37
|
export async function runOpenClaudeDesignWorkflow(ctx: OpenClaudeDesignContext): Promise<OpenClaudeDesignOutputs> {
|
|
36
38
|
const designContext = ctx;
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const playwrightCli = ensurePlaywrightCli();
|
|
43
|
-
const browserBootstrapRules = buildPlaywrightCliBootstrapRules(playwrightCli);
|
|
40
|
+
// Initial deterministic setup step (no LLM): ensure the playwright-cli skill's
|
|
41
|
+
// `playwright-cli` command is installed before any design stage runs. Best-effort.
|
|
42
|
+
const playwrightCli = ensurePlaywrightCli();
|
|
43
|
+
const browserBootstrapRules = buildPlaywrightCliBootstrapRules(playwrightCli);
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
const inputs = designContext.inputs;
|
|
46
|
+
const prompt = inputs.prompt;
|
|
47
|
+
const discoverReferences = inputs.discover_references !== false;
|
|
48
|
+
const maxRefinements = positiveInteger(
|
|
49
|
+
inputs.max_refinements,
|
|
50
|
+
DEFAULT_MAX_REFINEMENTS,
|
|
51
|
+
);
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
DEFAULT_MAX_REFINEMENTS,
|
|
54
|
-
);
|
|
53
|
+
const workflowCwd = designContext.cwd ?? process.cwd();
|
|
54
|
+
const { runId, artifactDir, previewPath, specPath } = prepareArtifactDir(
|
|
55
|
+
workflowCwd,
|
|
56
|
+
);
|
|
57
|
+
const previewFileUrl = `file://${previewPath}`;
|
|
58
|
+
const specFileUrl = `file://${specPath}`;
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Browser-centric workflow: the discovery/preview review and the interactive
|
|
61
|
+
// `live` QA loop need the playwright-cli browser. If it is unavailable, exit
|
|
62
|
+
// cleanly up front (surfacing artifact paths) rather than generating a design
|
|
63
|
+
// no one can review. Gated off under NODE_ENV=test / runtimes without ctx.exit.
|
|
64
|
+
if (
|
|
65
|
+
shouldEarlyExitForBrowser(playwrightCli.available, process.env.NODE_ENV) &&
|
|
66
|
+
typeof designContext.exit === "function"
|
|
67
|
+
) {
|
|
68
|
+
designContext.exit({
|
|
69
|
+
reason: `open-claude-design needs the playwright-cli skill's browser for interactive design review, which is unavailable (${playwrightCli.error ?? playwrightCli.summary}). No design was generated. Install it (\`npm install -g @playwright/cli@latest\` + \`npx playwright install chromium\`) and re-run.`,
|
|
70
|
+
outputs: {
|
|
71
|
+
playwright_cli_status: playwrightCli.summary, run_id: runId, artifact_dir: artifactDir,
|
|
72
|
+
preview_path: previewPath, preview_file_url: previewFileUrl, spec_path: specPath, spec_file_url: specFileUrl,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
62
76
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const designModelConfig = {
|
|
78
|
+
model: "anthropic/claude-fable-5:xhigh",
|
|
79
|
+
fallbackModels: [
|
|
80
|
+
"github-copilot/claude-opus-4.8 (1m):xhigh",
|
|
81
|
+
"anthropic/claude-opus-4-8:xhigh",
|
|
82
|
+
"zai/glm-5.2:xhigh",
|
|
83
|
+
"zai-coding-cn/glm-5.2:xhigh",
|
|
84
|
+
"github-copilot/claude-sonnet-4.6 (1m):high",
|
|
85
|
+
"anthropic/claude-sonnet-4-6:high",
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
// Phase 1: combined discovery + init — one stage interviews the user via
|
|
89
|
+
// impeccable `shape`, then immediately runs impeccable `init` so PRODUCT.md /
|
|
90
|
+
// DESIGN.md are detected, created, or reconciled before design research.
|
|
91
|
+
const frontDoor = await runDiscoveryAndInit({
|
|
92
|
+
designContext,
|
|
93
|
+
prompt,
|
|
94
|
+
discoveryConfig: { ...designModelConfig, schema: discoveryDecisionSchema },
|
|
95
|
+
});
|
|
96
|
+
const discovery = frontDoor.discovery;
|
|
97
|
+
const designBrief = discovery.brief;
|
|
98
|
+
const outputType = discovery.output_type;
|
|
99
|
+
const references = discovery.references;
|
|
100
|
+
const projectContext = frontDoor.projectContext;
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
const userReferenceContext = references.length > 0
|
|
103
|
+
? references.map((ref, index) => `${index + 1}. ${ref}`).join("\n")
|
|
104
|
+
: "No user-provided references were collected during discovery.";
|
|
105
|
+
const referenceHandlingRules = references.length > 0
|
|
106
|
+
? [
|
|
107
|
+
REFERENCE_PRECEDENCE,
|
|
108
|
+
"For URL references, use browser/screenshot tooling when available and cite only observable traits.",
|
|
109
|
+
"For files, screenshots, or design docs, read or parse the source directly and quote concrete evidence.",
|
|
110
|
+
"Include a `Reference requirements` section so the generator receives the imported constraints.",
|
|
111
|
+
].join("\n")
|
|
112
|
+
: "No user references to import. Focus on project context and curated reference-discovery when present.";
|
|
87
113
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
[
|
|
96
|
-
"objective",
|
|
97
|
-
`Prepare a six-section DESIGN.md-shaped brief that will steer generation of: ${prompt}. Apply the impeccable \`document\` sub-skill to read an existing DESIGN.md / PRODUCT.md (or equivalent).`,
|
|
98
|
-
],
|
|
99
|
-
["design_system_reference", designSystemInput],
|
|
100
|
-
[
|
|
101
|
-
"instructions",
|
|
102
|
-
[
|
|
103
|
-
"1. Read every reference path/URL supplied.",
|
|
104
|
-
"2. Extract: register (brand vs product), Creative North Star, color tokens with descriptive names, type stack, elevation philosophy, components/variants, accessibility constraints, and the named DO/DON'T rules.",
|
|
105
|
-
"3. Distinguish explicit rules in the source from inferred conventions; never invent rules.",
|
|
106
|
-
"4. State what could not be verified instead of guessing.",
|
|
107
|
-
].join("\n"),
|
|
108
|
-
],
|
|
109
|
-
[
|
|
110
|
-
"output_format",
|
|
111
|
-
[
|
|
112
|
-
"Markdown with the six required headings, in this exact order and case:",
|
|
113
|
-
"## Overview",
|
|
114
|
-
"## Colors",
|
|
115
|
-
"## Typography",
|
|
116
|
-
"## Elevation",
|
|
117
|
-
"## Components",
|
|
118
|
-
"## Do's and Don'ts",
|
|
119
|
-
"Then a final `## Gaps / Assumptions` section listing anything unverified.",
|
|
120
|
-
].join("\n"),
|
|
121
|
-
],
|
|
122
|
-
]),
|
|
123
|
-
...designModelConfig,
|
|
124
|
-
});
|
|
125
|
-
designSystem = loaded.text;
|
|
126
|
-
onboarding = [loaded];
|
|
127
|
-
} else {
|
|
128
|
-
onboarding = await designContext.parallel(
|
|
114
|
+
// Phase 3 (combined): a single fan-out gathers project design-system evidence
|
|
115
|
+
// and references. The ds-* stages now also import user URLs/files directly.
|
|
116
|
+
const dsSteps: WorkflowTaskStep[] = [
|
|
117
|
+
{
|
|
118
|
+
name: "ds-locator",
|
|
119
|
+
task: taggedPrompt([
|
|
120
|
+
["role", "You are an opinionated staff design engineer."],
|
|
129
121
|
[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
task: taggedPrompt([
|
|
133
|
-
[
|
|
134
|
-
"role",
|
|
135
|
-
"You are an opinionated staff design engineer.",
|
|
136
|
-
],
|
|
137
|
-
[
|
|
138
|
-
"objective",
|
|
139
|
-
`Find UI/design-system sources for this request: ${prompt}. Apply the impeccable \`extract\` sub-skill to find design-system evidence already living in this codebase.`,
|
|
140
|
-
],
|
|
141
|
-
[
|
|
142
|
-
"instructions",
|
|
143
|
-
[
|
|
144
|
-
"1. Locate UI components, stylesheets, tokens (CSS custom properties, Tailwind config, CSS-in-JS themes, design-token files), Storybook/examples, screenshots, tests, and design docs.",
|
|
145
|
-
"2. Return concrete file paths plus why each path informs design generation.",
|
|
146
|
-
"3. Separate primary sources from supporting examples.",
|
|
147
|
-
"4. If no explicit design system exists, identify the strongest implicit evidence (most-repeated literals, dominant component patterns).",
|
|
148
|
-
].join("\n"),
|
|
149
|
-
],
|
|
150
|
-
[
|
|
151
|
-
"output_format",
|
|
152
|
-
"Markdown table: Path | Evidence type | What it reveals | Repetitions seen | Confidence (low/med/high).",
|
|
153
|
-
],
|
|
154
|
-
]),
|
|
155
|
-
...designModelConfig,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "ds-analyzer",
|
|
159
|
-
task: taggedPrompt([
|
|
160
|
-
[
|
|
161
|
-
"role",
|
|
162
|
-
"You are an opinionated staff design engineer.",
|
|
163
|
-
],
|
|
164
|
-
[
|
|
165
|
-
"objective",
|
|
166
|
-
`Audit the project UI constraints that must shape: ${prompt}. Apply the impeccable \`audit\` sub-skill to evaluate the located design-system evidence against impeccable's six dimensions of design quality and produce a detailed report with actionable insights for generation.`,
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
"impeccable_skill",
|
|
170
|
-
"audit — score 0–4 across Accessibility, Performance, Theming, Responsive, Anti-patterns. Tag every finding P0 (blocks release) → P3 (polish). Document, do not fix.",
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
"instructions",
|
|
174
|
-
[
|
|
175
|
-
"1. Inspect: UI stack, styling approach, token usage, responsive behavior, accessibility conventions, component APIs.",
|
|
176
|
-
"2. Ground every claim in exact paths, symbols, or code examples.",
|
|
177
|
-
"3. Call out constraints that generated designs MUST follow to integrate cleanly.",
|
|
178
|
-
"4. State uncertainty rather than guessing when evidence is incomplete.",
|
|
179
|
-
].join("\n"),
|
|
180
|
-
],
|
|
181
|
-
[
|
|
182
|
-
"output_format",
|
|
183
|
-
[
|
|
184
|
-
"Markdown sections in this order:",
|
|
185
|
-
"1. Stack",
|
|
186
|
-
"2. Tokens",
|
|
187
|
-
"3. Components",
|
|
188
|
-
"4. Layout / responsiveness",
|
|
189
|
-
"5. Accessibility",
|
|
190
|
-
"6. Audit scores (per dimension, 0–4)",
|
|
191
|
-
"7. Hard constraints for generation",
|
|
192
|
-
].join("\n"),
|
|
193
|
-
],
|
|
194
|
-
]),
|
|
195
|
-
...designModelConfig,
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: "ds-patterns",
|
|
199
|
-
task: taggedPrompt([
|
|
200
|
-
[
|
|
201
|
-
"role",
|
|
202
|
-
"You are an opinionated staff design engineer.",
|
|
203
|
-
],
|
|
204
|
-
[
|
|
205
|
-
"objective",
|
|
206
|
-
`Extract reusable patterns and anti-patterns for: ${prompt}. Apply the impeccable \`extract\` sub-skill to find design patterns that should be reused and anti-patterns that must be avoided in generation.`,
|
|
207
|
-
],
|
|
208
|
-
[
|
|
209
|
-
"instructions",
|
|
210
|
-
[
|
|
211
|
-
"1. Find naming, variant, composition, state, animation, and layout patterns that should be reused.",
|
|
212
|
-
"2. Include examples with concrete paths and component/symbol names.",
|
|
213
|
-
"3. Identify anti-patterns the generated design must avoid — cross-reference impeccable's 25 deterministic anti-patterns (gradient text, AI palettes, nested cards, side-tab borders, line-length problems, etc.).",
|
|
214
|
-
"4. Do not generalize beyond the evidence found in the repository.",
|
|
215
|
-
].join("\n"),
|
|
216
|
-
],
|
|
217
|
-
[
|
|
218
|
-
"output_format",
|
|
219
|
-
"Markdown with sections: Reusable patterns | Examples | Anti-patterns | Generation implications.",
|
|
220
|
-
],
|
|
221
|
-
]),
|
|
222
|
-
...designModelConfig,
|
|
223
|
-
},
|
|
122
|
+
"objective",
|
|
123
|
+
`Find UI/design-system sources for this request: ${designBrief}. Apply the impeccable \`extract\` sub-skill to find design-system evidence already living in this codebase, plus any user-provided reference URLs/files that should steer generation.`,
|
|
224
124
|
],
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
[
|
|
231
|
-
"role",
|
|
232
|
-
"You are a staff design enginer.",
|
|
233
|
-
],
|
|
234
|
-
[
|
|
235
|
-
"objective",
|
|
236
|
-
`Build the project DESIGN.md that will steer generation for: ${prompt}. Apply the impeccable \`document\` sub-skill to synthesize a coherent design system spec from the located evidence, audit findings, and pattern analysis. This is the most critical step for generation quality; use impeccable's design knowledge to make smart calls when evidence conflicts or is incomplete.`,
|
|
237
|
-
],
|
|
238
|
-
["onboarding_analysis", "{previous}"],
|
|
239
|
-
[
|
|
240
|
-
"instructions",
|
|
241
|
-
[
|
|
242
|
-
"1. Synthesize locator + auditor + pattern-miner evidence into one coherent source of truth.",
|
|
243
|
-
"2. Keep every claim traceable to a path or symbol from the analysis.",
|
|
244
|
-
"3. Prefer concrete tokens, component conventions, and accessibility rules over vague style adjectives.",
|
|
245
|
-
"4. List assumptions in a separate trailing section; never mix them with verified rules.",
|
|
246
|
-
].join("\n"),
|
|
247
|
-
],
|
|
248
|
-
[
|
|
249
|
-
"output_format",
|
|
250
|
-
[
|
|
251
|
-
"Markdown with exactly these headings, in this order:",
|
|
252
|
-
"## Overview (include the Creative North Star)",
|
|
253
|
-
"## Colors",
|
|
254
|
-
"## Typography",
|
|
255
|
-
"## Elevation",
|
|
256
|
-
"## Components",
|
|
257
|
-
"## Do's and Don'ts (use the impeccable named-rule style)",
|
|
258
|
-
"## Verified vs Assumed",
|
|
259
|
-
].join("\n"),
|
|
260
|
-
],
|
|
261
|
-
]),
|
|
262
|
-
previous: onboarding,
|
|
263
|
-
...designModelConfig,
|
|
264
|
-
});
|
|
265
|
-
designSystem = builder.text;
|
|
266
|
-
onboarding = [...onboarding, builder];
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const importSteps: WorkflowTaskStep[] = [];
|
|
270
|
-
if (isUrl(reference)) {
|
|
271
|
-
importSteps.push({
|
|
272
|
-
name: "web-capture",
|
|
273
|
-
task: taggedPrompt([
|
|
274
|
-
[
|
|
275
|
-
"role",
|
|
276
|
-
"You are a staff QA engineer with design expertise.",
|
|
277
|
-
],
|
|
278
|
-
[
|
|
279
|
-
"objective",
|
|
280
|
-
`Capture transferable design intent from this reference for: ${prompt}. Apply the impeccable \`extract\` sub-skill to lift concrete, citable design traits from the reference URL. Use browser/screenshot tooling if available; never guess about visual traits without observable evidence.`,
|
|
281
|
-
],
|
|
282
|
-
["reference_url", reference],
|
|
283
|
-
["browser_use_guidelines", browserBootstrapRules],
|
|
284
|
-
[
|
|
285
|
-
"instructions",
|
|
286
|
-
[
|
|
287
|
-
"1. Use browser/screenshot tooling (for example the playwright-cli skill's `playwright-cli` command) if available; cite observable evidence rather than guessing.",
|
|
288
|
-
"2. If `playwright-cli` is available but opening the reference URL reports a missing browser executable, follow the bootstrap rules and retry once.",
|
|
289
|
-
"3. Analyze: layout, visual hierarchy, navigation, color, typography, spacing, states, interactions, responsive behavior.",
|
|
290
|
-
"4. Separate reference-specific styling from requirements that should transfer to this project's design system.",
|
|
291
|
-
"5. If the URL is inaccessible or browser bootstrap fails, state that and provide a best-effort fallback based only on available information — never fabricate observations.",
|
|
292
|
-
].join("\n"),
|
|
293
|
-
],
|
|
294
|
-
[
|
|
295
|
-
"output_format",
|
|
296
|
-
"Markdown sections: Observable design traits | Transferable requirements | Assets/content | Uncertainty.",
|
|
297
|
-
],
|
|
298
|
-
]),
|
|
299
|
-
...designModelConfig,
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
if (isFileLike(reference)) {
|
|
303
|
-
importSteps.push({
|
|
304
|
-
name: "file-parser",
|
|
305
|
-
task: taggedPrompt([
|
|
306
|
-
[
|
|
307
|
-
"role",
|
|
308
|
-
"You are an opinionated staff design engineer.",
|
|
309
|
-
],
|
|
310
|
-
[
|
|
311
|
-
"objective",
|
|
312
|
-
`Extract actionable design requirements for: ${prompt}. Apply the impeccable \`extract\` sub-skill to pull out concrete, citable design requirements from this reference file or doc. The reference might be a design file, a screenshot, a code file, or a design doc; adapt your extraction approach accordingly but never guess about traits that are not explicitly observable in the source.`,
|
|
313
|
-
],
|
|
314
|
-
["reference", reference],
|
|
315
|
-
[
|
|
316
|
-
"instructions",
|
|
317
|
-
[
|
|
318
|
-
"1. Extract: requirements, tokens, layout details, interaction notes, assets, copy, constraints, acceptance criteria.",
|
|
319
|
-
"2. Quote or cite concrete sections/paths wherever possible.",
|
|
320
|
-
"3. Separate explicit requirements from inferred design direction.",
|
|
321
|
-
"4. If the reference cannot be read, say exactly what failed and what remains unknown.",
|
|
322
|
-
].join("\n"),
|
|
323
|
-
],
|
|
125
|
+
["user_references", userReferenceContext],
|
|
126
|
+
["reference_handling", referenceHandlingRules],
|
|
127
|
+
["browser_use_guidelines", browserBootstrapRules],
|
|
128
|
+
[
|
|
129
|
+
"instructions",
|
|
324
130
|
[
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const imports =
|
|
334
|
-
importSteps.length > 0
|
|
335
|
-
? await designContext.parallel(importSteps, { task: prompt })
|
|
336
|
-
: [];
|
|
337
|
-
const importContext =
|
|
338
|
-
imports.length > 0
|
|
339
|
-
? joinResults(imports)
|
|
340
|
-
: "No external reference was provided; infer the design direction from the prompt and project design system.";
|
|
341
|
-
|
|
342
|
-
const generated = await designContext.task("generator", {
|
|
343
|
-
prompt: taggedPrompt([
|
|
131
|
+
"1. Locate UI components, stylesheets, tokens, Storybook/examples, screenshots, tests, design docs, and user references.",
|
|
132
|
+
"2. Return concrete file paths, URLs, or artifact paths plus why each source informs design generation.",
|
|
133
|
+
"3. Separate primary sources from supporting examples and from reference-only inspiration.",
|
|
134
|
+
"4. If no explicit design system exists, identify the strongest implicit evidence (most-repeated literals, dominant component patterns).",
|
|
135
|
+
].join("\n"),
|
|
136
|
+
],
|
|
344
137
|
[
|
|
345
|
-
"
|
|
346
|
-
"
|
|
138
|
+
"output_format",
|
|
139
|
+
"Markdown sections: Project sources table | User reference sources | Reference requirements | Confidence notes.",
|
|
347
140
|
],
|
|
141
|
+
]),
|
|
142
|
+
...designModelConfig,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "ds-analyzer",
|
|
146
|
+
task: taggedPrompt([
|
|
147
|
+
["role", "You are an opinionated staff design engineer."],
|
|
348
148
|
[
|
|
349
149
|
"objective",
|
|
350
|
-
`
|
|
150
|
+
`Audit the project UI constraints that must shape: ${designBrief}. Independently scan the repository and evaluate the evidence you find against impeccable's six dimensions of design quality. Also capture/parse any user-provided references in this same pass. This runs in PARALLEL with the locator and pattern passes, so do your own scan rather than relying on their output.`,
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"impeccable_skill",
|
|
154
|
+
"audit — score 0–4 across Accessibility, Performance, Theming, Responsive, Anti-patterns. Tag every finding P0 (blocks release) → P3 (polish). Document, do not fix.",
|
|
351
155
|
],
|
|
352
|
-
["
|
|
353
|
-
["
|
|
354
|
-
["
|
|
355
|
-
["html_rules", HTML_PREVIEW_RULES],
|
|
356
|
-
["anti_design_slop_rules", ANTI_SLOP_RULES],
|
|
156
|
+
["user_references", userReferenceContext],
|
|
157
|
+
["reference_handling", referenceHandlingRules],
|
|
158
|
+
["browser_use_guidelines", browserBootstrapRules],
|
|
357
159
|
[
|
|
358
160
|
"instructions",
|
|
359
161
|
[
|
|
360
|
-
|
|
361
|
-
"2.
|
|
362
|
-
|
|
363
|
-
"4.
|
|
364
|
-
"5. Do not use generic placeholder language when project conventions are available.",
|
|
365
|
-
"6. After writing the file, return a short markdown summary (NOT the HTML body) describing what you built, the decisions you made, and assumptions you are leaving for the user to confirm.",
|
|
162
|
+
"1. Inspect: UI stack, styling approach, token usage, responsive behavior, accessibility conventions, component APIs.",
|
|
163
|
+
"2. Ground every claim in exact paths, symbols, code examples, screenshots, URLs, or quoted reference excerpts.",
|
|
164
|
+
"3. Call out constraints that generated designs MUST follow to integrate cleanly.",
|
|
165
|
+
"4. State uncertainty rather than guessing when evidence is incomplete.",
|
|
366
166
|
].join("\n"),
|
|
367
167
|
],
|
|
368
168
|
[
|
|
369
169
|
"output_format",
|
|
370
170
|
[
|
|
371
|
-
"
|
|
372
|
-
"1.
|
|
373
|
-
"2.
|
|
374
|
-
"3.
|
|
375
|
-
"4.
|
|
376
|
-
"5.
|
|
377
|
-
"6.
|
|
171
|
+
"Markdown sections in this order:",
|
|
172
|
+
"1. Stack",
|
|
173
|
+
"2. Tokens",
|
|
174
|
+
"3. Components",
|
|
175
|
+
"4. Layout / responsiveness",
|
|
176
|
+
"5. Accessibility",
|
|
177
|
+
"6. Audit scores (per dimension, 0–4)",
|
|
178
|
+
"7. Reference requirements",
|
|
179
|
+
"8. Hard constraints for generation",
|
|
378
180
|
].join("\n"),
|
|
379
181
|
],
|
|
380
182
|
]),
|
|
381
|
-
previous: [...onboarding, ...imports],
|
|
382
183
|
...designModelConfig,
|
|
383
|
-
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "ds-patterns",
|
|
187
|
+
task: taggedPrompt([
|
|
188
|
+
["role", "You are an opinionated staff design engineer."],
|
|
189
|
+
[
|
|
190
|
+
"objective",
|
|
191
|
+
`Extract reusable patterns and anti-patterns for: ${designBrief}. Apply the impeccable \`extract\` sub-skill to find design patterns to reuse and anti-patterns to avoid. Also parse/capture user references inside this same pass, translating them into reusable generation patterns. This runs in PARALLEL with the locator and auditor passes, so scan the codebase yourself rather than depending on their output.`,
|
|
192
|
+
],
|
|
193
|
+
["user_references", userReferenceContext],
|
|
194
|
+
["reference_handling", referenceHandlingRules],
|
|
195
|
+
["browser_use_guidelines", browserBootstrapRules],
|
|
196
|
+
[
|
|
197
|
+
"instructions",
|
|
198
|
+
[
|
|
199
|
+
"1. Find naming, variant, composition, state, animation, and layout patterns that should be reused.",
|
|
200
|
+
"2. Include examples with concrete paths, component/symbol names, reference URLs, or quoted file/screenshot evidence.",
|
|
201
|
+
"3. Identify anti-patterns the generated design must avoid — cross-reference impeccable's 25 deterministic anti-patterns.",
|
|
202
|
+
"4. Do not generalize beyond the evidence found in the repository or imported references.",
|
|
203
|
+
].join("\n"),
|
|
204
|
+
],
|
|
205
|
+
[
|
|
206
|
+
"output_format",
|
|
207
|
+
"Markdown sections: Reusable patterns | Examples | Reference requirements | Anti-patterns | Generation implications.",
|
|
208
|
+
],
|
|
209
|
+
]),
|
|
210
|
+
...designModelConfig,
|
|
211
|
+
},
|
|
212
|
+
];
|
|
384
213
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
214
|
+
const onboardingAnalysis = await designContext.parallel(dsSteps, {
|
|
215
|
+
task: designBrief,
|
|
216
|
+
});
|
|
217
|
+
const onboardingSummary = joinResults(onboardingAnalysis);
|
|
388
218
|
|
|
389
|
-
|
|
390
|
-
await designContext
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
["browser_use_guidelines", browserBootstrapRules],
|
|
404
|
-
[
|
|
405
|
-
"instructions",
|
|
406
|
-
[
|
|
407
|
-
"1. Probe for `playwright-cli` availability using the bootstrap rules above.",
|
|
408
|
-
`2. If available, run: \`playwright-cli open ${previewFileUrl}\`. If that reports a missing browser executable, follow the bootstrap rules and retry once.`,
|
|
409
|
-
"3. Then run `playwright-cli snapshot` and, for interactive review, `playwright-cli show --annotate` so the user can draw on the page and add notes; if interactive review is unavailable, ask the user to review the visible page or manual file path and provide notes inline.",
|
|
410
|
-
"4. Capture any annotation artifact path, screenshot path, or user notes and surface them in your output.",
|
|
411
|
-
`5. If \`playwright-cli\` is NOT available or browser bootstrap fails, print a clear instruction block telling the user to open the file manually at: ${previewPath} (or via the URL ${previewFileUrl}).`,
|
|
412
|
-
"6. Never block the workflow on unavailable tooling; always exit with a non-empty status string.",
|
|
413
|
-
].join("\n"),
|
|
414
|
-
],
|
|
415
|
-
[
|
|
416
|
-
"output_format",
|
|
417
|
-
"Markdown with: `display_method`, `preview_path`, `annotated_snapshot` (if available), `user_notes` (if available), `next_action_hint`.",
|
|
418
|
-
],
|
|
419
|
-
]),
|
|
219
|
+
const referenceResult = discoverReferences
|
|
220
|
+
? await designContext.task("reference-discovery", {
|
|
221
|
+
prompt: buildReferenceDiscoveryPrompt({
|
|
222
|
+
prompt: designBrief,
|
|
223
|
+
outputType,
|
|
224
|
+
designContextHint: [
|
|
225
|
+
projectContext.summary,
|
|
226
|
+
"Design-system/reference discovery evidence from codebase design discovery stages:",
|
|
227
|
+
onboardingSummary,
|
|
228
|
+
].join("\n\n"),
|
|
229
|
+
artifactDir,
|
|
230
|
+
browserBootstrapRules,
|
|
231
|
+
}),
|
|
232
|
+
previous: onboardingAnalysis,
|
|
420
233
|
...designModelConfig,
|
|
421
234
|
})
|
|
422
|
-
|
|
235
|
+
: undefined;
|
|
236
|
+
const contextResults = referenceResult === undefined
|
|
237
|
+
? onboardingAnalysis
|
|
238
|
+
: [...onboardingAnalysis, referenceResult];
|
|
423
239
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
maxRefinements,
|
|
429
|
-
previewPath,
|
|
430
|
-
previewFileUrl,
|
|
431
|
-
artifactDir,
|
|
432
|
-
browserBootstrapRules,
|
|
433
|
-
designSystem,
|
|
434
|
-
latestDesign,
|
|
435
|
-
designModelConfig,
|
|
436
|
-
refinementDecisionConfig,
|
|
437
|
-
});
|
|
438
|
-
latestDesign = refinement.latestDesign;
|
|
439
|
-
approvedForExport = refinement.approvedForExport;
|
|
440
|
-
refinementCount = refinement.refinementCount;
|
|
240
|
+
const referencesBriefRaw = (referenceResult?.text ?? "").trim();
|
|
241
|
+
const referencesBrief =
|
|
242
|
+
referencesBriefRaw.length > 0 ? referencesBriefRaw : NO_REFERENCES_BRIEF;
|
|
243
|
+
if (referencesBriefRaw.length > 0) persistReferencesBrief(artifactDir, referencesBrief);
|
|
441
244
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
245
|
+
const importContext = references.length > 0
|
|
246
|
+
? [
|
|
247
|
+
REFERENCE_PRECEDENCE,
|
|
248
|
+
"Reference sources:",
|
|
249
|
+
userReferenceContext,
|
|
250
|
+
"",
|
|
251
|
+
onboardingSummary,
|
|
252
|
+
].join("\n")
|
|
253
|
+
: "No user reference was provided; infer the design direction from the brief, project design context, research, and curated reference inspiration.";
|
|
254
|
+
const designSystem = [
|
|
255
|
+
"Project design context from `/skill:impeccable init` and PRODUCT.md/DESIGN.md:",
|
|
256
|
+
projectContext.summary,
|
|
257
|
+
"",
|
|
258
|
+
"Design-system and user-reference evidence:",
|
|
259
|
+
onboardingSummary,
|
|
260
|
+
].join("\n\n");
|
|
261
|
+
|
|
262
|
+
let latestDesign = "";
|
|
263
|
+
let approvedForExport = false;
|
|
264
|
+
let refinementCount = 0;
|
|
265
|
+
|
|
266
|
+
const refinement = await refineOpenClaudeDesign({
|
|
267
|
+
designContext,
|
|
268
|
+
prompt: designBrief,
|
|
269
|
+
outputType,
|
|
270
|
+
maxRefinements,
|
|
271
|
+
previewPath,
|
|
272
|
+
previewFileUrl,
|
|
273
|
+
artifactDir,
|
|
274
|
+
browserBootstrapRules,
|
|
275
|
+
designSystem,
|
|
276
|
+
generationContext: contextResults,
|
|
277
|
+
designModelConfig,
|
|
278
|
+
workflowCwd,
|
|
279
|
+
referencesBrief,
|
|
280
|
+
importContext,
|
|
281
|
+
});
|
|
282
|
+
latestDesign = refinement.latestDesign;
|
|
283
|
+
approvedForExport = refinement.approvedForExport;
|
|
284
|
+
refinementCount = refinement.refinementCount;
|
|
458
285
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
};
|
|
286
|
+
const exportResult = await exportOpenClaudeDesign({
|
|
287
|
+
designContext,
|
|
288
|
+
prompt: designBrief,
|
|
289
|
+
outputType,
|
|
290
|
+
previewPath,
|
|
291
|
+
previewFileUrl,
|
|
292
|
+
specPath,
|
|
293
|
+
specFileUrl,
|
|
294
|
+
browserBootstrapRules,
|
|
295
|
+
designSystem,
|
|
296
|
+
latestDesign,
|
|
297
|
+
designModelConfig,
|
|
298
|
+
});
|
|
299
|
+
latestDesign = exportResult.latestDesign;
|
|
300
|
+
const handoff = exportResult.handoff;
|
|
475
301
|
|
|
302
|
+
return {
|
|
303
|
+
output_type: outputType,
|
|
304
|
+
design_system: "project-derived design system",
|
|
305
|
+
artifact: latestDesign,
|
|
306
|
+
handoff: handoff.text,
|
|
307
|
+
approved_for_export: approvedForExport,
|
|
308
|
+
refinements_completed: refinementCount,
|
|
309
|
+
import_context: importContext,
|
|
310
|
+
run_id: runId,
|
|
311
|
+
artifact_dir: artifactDir,
|
|
312
|
+
preview_path: previewPath,
|
|
313
|
+
preview_file_url: previewFileUrl,
|
|
314
|
+
spec_path: specPath,
|
|
315
|
+
spec_file_url: specFileUrl,
|
|
316
|
+
playwright_cli_status: playwrightCli.summary,
|
|
317
|
+
};
|
|
476
318
|
}
|