@ethlete/agent-rules 0.1.0-next.4 → 0.1.0-next.40
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/AGENTS.md +28 -0
- package/CHANGELOG.md +620 -0
- package/CLAUDE.md +1 -0
- package/README.md +406 -29
- package/THIRD-PARTY-LICENSES.md +35 -0
- package/content/defaults.json +1 -1
- package/content/git-hooks/post-checkout.sh +10 -0
- package/content/git-hooks/pre-push.sh +5 -0
- package/content/hooks/away-mode.py +287 -0
- package/content/hooks/background-design-commands.py +215 -0
- package/content/hooks/builder-chat-words.py +269 -0
- package/content/hooks/context-warning.py +836 -142
- package/content/hooks/git-safety.py +213 -0
- package/content/hooks/subagent-model-policy.py +261 -0
- package/content/mods/.claude-plugin/marketplace.json +16 -0
- package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
- package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
- package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
- package/content/mods/plugins/e2e-progress/types/index.d.ts +23 -0
- package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/status-line/hooks/line.ts +73 -0
- package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
- package/content/mods/plugins/status-line/types/index.d.ts +5 -0
- package/content/output-styles/ste-clarity.md +131 -0
- package/content/rules/agent-sessions-wake-up.md +11 -0
- package/content/rules/app-styling.md +66 -0
- package/content/rules/comments.md +4 -1
- package/content/rules/lint-and-format.md +7 -5
- package/content/rules/nx-layout.md +53 -0
- package/content/rules/reactive-state.md +1 -1
- package/content/rules/styling.md +19 -10
- package/content/rules/subagent-models.md +42 -0
- package/content/skills/agent-sessions/SKILL.md +94 -0
- package/content/skills/agent-sessions/agent-sessions.mjs +1079 -0
- package/content/skills/angular-patterns/SKILL.md +31 -7
- package/content/skills/api-source/SKILL.md +156 -0
- package/content/skills/app-testing/SKILL.md +141 -0
- package/content/skills/codex-subagent/SKILL.md +90 -0
- package/content/skills/codex-subagent/codex-agent.mjs +229 -0
- package/content/skills/design-exploration/SKILL.md +190 -0
- package/content/skills/design-exploration/check-story.mjs +139 -0
- package/content/skills/design-exploration/reference-check-and-notes.md +92 -0
- package/content/skills/design-exploration/reference-flows-and-wireframes.md +78 -0
- package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
- package/content/skills/design-exploration/reference-order-and-design-system.md +124 -0
- package/content/skills/design-exploration/reference-products-and-sketches.md +211 -0
- package/content/skills/design-exploration/reference-shots.md +25 -0
- package/content/skills/design-exploration/shoot-template.mjs +61 -0
- package/content/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/content/skills/domain-modeling/SKILL.md +80 -0
- package/content/skills/e2e-triage/SKILL.md +80 -0
- package/content/skills/figma-export/SKILL.md +191 -0
- package/content/skills/figma-export/dump-figma-layers.py +83 -0
- package/content/skills/figma-export/dump-figma-svg.py +235 -0
- package/content/skills/figma-export/measure-template.mjs +87 -0
- package/content/skills/git-commit/SKILL.md +21 -7
- package/content/skills/git-flow/SKILL.md +87 -0
- package/content/skills/grill-with-docs/SKILL.md +13 -0
- package/content/skills/grilling/SKILL.md +52 -0
- package/content/skills/handoff/SKILL.md +29 -69
- package/content/skills/handoff/save.md +187 -0
- package/content/skills/query/SKILL.md +165 -64
- package/content/skills/report/SKILL.md +26 -0
- package/content/skills/rxjs-signals/SKILL.md +33 -4
- package/content/skills/sdk-docs/SKILL.md +50 -14
- package/content/skills/sdk-local-build/SKILL.md +26 -8
- package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
- package/content/skills/sdk-source/SKILL.md +37 -34
- package/content/skills/sdk-update/SKILL.md +103 -0
- package/content/skills/story-styling/SKILL.md +10 -8
- package/content/skills/styleguide/SKILL.md +13 -8
- package/content/skills/styleguide/assets.md +54 -0
- package/content/skills/styleguide/changesets.md +17 -0
- package/content/skills/styleguide/file-structure.md +73 -0
- package/content/skills/styleguide/lint-rule-lookup.md +52 -0
- package/content/skills/styleguide/storybook-structure.md +25 -0
- package/content/skills/theming/SKILL.md +56 -28
- package/content/skills/timetrack/SKILL.md +324 -0
- package/content/skills/verify-in-app/SKILL.md +107 -0
- package/content/skills/verify-in-storybook/SKILL.md +1 -1
- package/migrations/list-state-query-form.md +20 -0
- package/migrations/nx-layout.md +29 -0
- package/migrations/sdk-components-over-hand-built-ui.md +27 -0
- package/migrations/search-query-field.md +52 -0
- package/migrations.json +39 -0
- package/package.json +19 -3
- package/src/index.js +99 -32
- package/src/index.js.map +1 -1
- package/src/lib/cli-args.d.ts +9 -0
- package/src/lib/cli-args.js +48 -0
- package/src/lib/cli-args.js.map +1 -0
- package/src/lib/commitlint.d.ts +10 -0
- package/src/lib/commitlint.js +51 -0
- package/src/lib/commitlint.js.map +1 -0
- package/src/lib/config.d.ts +51 -6
- package/src/lib/config.js +127 -10
- package/src/lib/config.js.map +1 -1
- package/src/lib/filter.d.ts +2 -0
- package/src/lib/filter.js +4 -4
- package/src/lib/filter.js.map +1 -1
- package/src/lib/frontmatter.d.ts +2 -0
- package/src/lib/frontmatter.js +33 -5
- package/src/lib/frontmatter.js.map +1 -1
- package/src/lib/git-flow/build.d.ts +35 -0
- package/src/lib/git-flow/build.js +24 -0
- package/src/lib/git-flow/build.js.map +1 -0
- package/src/lib/git-flow/config.d.ts +59 -0
- package/src/lib/git-flow/config.js +50 -0
- package/src/lib/git-flow/config.js.map +1 -0
- package/src/lib/git-flow/index.d.ts +6 -0
- package/src/lib/git-flow/index.js +23 -0
- package/src/lib/git-flow/index.js.map +1 -0
- package/src/lib/git-flow/parse.d.ts +49 -0
- package/src/lib/git-flow/parse.js +300 -0
- package/src/lib/git-flow/parse.js.map +1 -0
- package/src/lib/git-flow/rename.d.ts +24 -0
- package/src/lib/git-flow/rename.js +70 -0
- package/src/lib/git-flow/rename.js.map +1 -0
- package/src/lib/git-flow/start.d.ts +49 -0
- package/src/lib/git-flow/start.js +57 -0
- package/src/lib/git-flow/start.js.map +1 -0
- package/src/lib/git-flow/validate.d.ts +34 -0
- package/src/lib/git-flow/validate.js +72 -0
- package/src/lib/git-flow/validate.js.map +1 -0
- package/src/lib/git-flow-command.d.ts +4 -0
- package/src/lib/git-flow-command.js +165 -0
- package/src/lib/git-flow-command.js.map +1 -0
- package/src/lib/git-flow-repair.d.ts +17 -0
- package/src/lib/git-flow-repair.js +165 -0
- package/src/lib/git-flow-repair.js.map +1 -0
- package/src/lib/git-flow-start.d.ts +20 -0
- package/src/lib/git-flow-start.js +140 -0
- package/src/lib/git-flow-start.js.map +1 -0
- package/src/lib/git-test-env.fixtures.d.ts +11 -0
- package/src/lib/git-test-env.fixtures.js +31 -0
- package/src/lib/git-test-env.fixtures.js.map +1 -0
- package/src/lib/git.d.ts +64 -0
- package/src/lib/git.js +131 -0
- package/src/lib/git.js.map +1 -0
- package/src/lib/gitlab.d.ts +35 -0
- package/src/lib/gitlab.js +116 -0
- package/src/lib/gitlab.js.map +1 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +26 -11
- package/src/lib/index.js.map +1 -1
- package/src/lib/migrate.js +8 -2
- package/src/lib/migrate.js.map +1 -1
- package/src/lib/output-style-command.d.ts +3 -0
- package/src/lib/output-style-command.js +69 -0
- package/src/lib/output-style-command.js.map +1 -0
- package/src/lib/output-style.d.ts +38 -0
- package/src/lib/output-style.js +134 -0
- package/src/lib/output-style.js.map +1 -0
- package/src/lib/owned-paths.js +27 -3
- package/src/lib/owned-paths.js.map +1 -1
- package/src/lib/package-runner.d.ts +4 -0
- package/src/lib/package-runner.js +86 -0
- package/src/lib/package-runner.js.map +1 -0
- package/src/lib/peer-path.d.ts +12 -0
- package/src/lib/peer-path.js +39 -0
- package/src/lib/peer-path.js.map +1 -0
- package/src/lib/plain-text.d.ts +9 -0
- package/src/lib/plain-text.js +22 -0
- package/src/lib/plain-text.js.map +1 -0
- package/src/lib/plan.d.ts +6 -6
- package/src/lib/plan.js +168 -40
- package/src/lib/plan.js.map +1 -1
- package/src/lib/prettier.d.ts +21 -0
- package/src/lib/prettier.js +51 -0
- package/src/lib/prettier.js.map +1 -0
- package/src/lib/prompt.d.ts +8 -0
- package/src/lib/prompt.js +35 -0
- package/src/lib/prompt.js.map +1 -0
- package/src/lib/render.d.ts +26 -2
- package/src/lib/render.js +45 -10
- package/src/lib/render.js.map +1 -1
- package/src/lib/report-command.d.ts +33 -0
- package/src/lib/report-command.js +312 -0
- package/src/lib/report-command.js.map +1 -0
- package/src/lib/sessions-command.d.ts +4 -0
- package/src/lib/sessions-command.js +16 -0
- package/src/lib/sessions-command.js.map +1 -0
- package/src/lib/sync.d.ts +1 -2
- package/src/lib/sync.js +37 -17
- package/src/lib/sync.js.map +1 -1
- package/src/lib/targets/agents-skills.js +1 -1
- package/src/lib/targets/agents-skills.js.map +1 -1
- package/src/lib/targets/claude-hooks.d.ts +3 -23
- package/src/lib/targets/claude-hooks.js +22 -86
- package/src/lib/targets/claude-hooks.js.map +1 -1
- package/src/lib/targets/claude-mods.d.ts +20 -0
- package/src/lib/targets/claude-mods.js +47 -0
- package/src/lib/targets/claude-mods.js.map +1 -0
- package/src/lib/targets/claude.js +2 -3
- package/src/lib/targets/claude.js.map +1 -1
- package/src/lib/targets/codex-hooks.d.ts +12 -0
- package/src/lib/targets/codex-hooks.js +35 -0
- package/src/lib/targets/codex-hooks.js.map +1 -0
- package/src/lib/targets/codex.js +4 -4
- package/src/lib/targets/codex.js.map +1 -1
- package/src/lib/targets/copilot.js +4 -4
- package/src/lib/targets/copilot.js.map +1 -1
- package/src/lib/targets/cursor.js +3 -3
- package/src/lib/targets/cursor.js.map +1 -1
- package/src/lib/targets/git-hooks.d.ts +25 -0
- package/src/lib/targets/git-hooks.js +71 -0
- package/src/lib/targets/git-hooks.js.map +1 -0
- package/src/lib/targets/hooks-shared.d.ts +60 -0
- package/src/lib/targets/hooks-shared.js +174 -0
- package/src/lib/targets/hooks-shared.js.map +1 -0
- package/src/lib/targets/mcp.d.ts +16 -0
- package/src/lib/targets/mcp.js +72 -0
- package/src/lib/targets/mcp.js.map +1 -0
- package/src/lib/targets/shared.d.ts +1 -9
- package/src/lib/targets/shared.js +4 -8
- package/src/lib/targets/shared.js.map +1 -1
- package/src/lib/timetrack-command.d.ts +11 -0
- package/src/lib/timetrack-command.js +1262 -0
- package/src/lib/timetrack-command.js.map +1 -0
- package/src/lib/timetrack-snapshot.d.ts +66 -0
- package/src/lib/timetrack-snapshot.js +146 -0
- package/src/lib/timetrack-snapshot.js.map +1 -0
- package/src/lib/timetrack.d.ts +607 -0
- package/src/lib/timetrack.js +285 -0
- package/src/lib/timetrack.js.map +1 -0
- package/content/skills/styleguide/STYLEGUIDE.md +0 -520
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Run one Codex agent to completion and print only its final message.
|
|
4
|
+
*
|
|
5
|
+
* `codex exec` streams its whole reasoning and command trace to stdout. That trace costs a
|
|
6
|
+
* calling agent more context than the answer is worth, so it stays in a log file here.
|
|
7
|
+
*
|
|
8
|
+
* Usage: node codex-agent.mjs [options] "<prompt>"
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
12
|
+
import { createWriteStream, mkdirSync, readFileSync, rmSync } from 'node:fs';
|
|
13
|
+
import { tmpdir } from 'node:os';
|
|
14
|
+
import { join } from 'node:path';
|
|
15
|
+
import { createInterface } from 'node:readline';
|
|
16
|
+
|
|
17
|
+
const DEFAULT_MODEL = 'gpt-6.1-terra';
|
|
18
|
+
const DEFAULT_TIMEOUT_SECONDS = 900;
|
|
19
|
+
|
|
20
|
+
const USAGE = `Usage: node codex-agent.mjs [options] "<prompt>"
|
|
21
|
+
|
|
22
|
+
-m, --model <id> Model id (default ${DEFAULT_MODEL})
|
|
23
|
+
-e, --effort <level> Reasoning effort: low | medium | high | xhigh
|
|
24
|
+
-w, --write Let the agent edit the working tree (default: read-only)
|
|
25
|
+
-C, --cd <dir> Working root for the agent (default: the current directory)
|
|
26
|
+
--resume <thread> Continue an earlier thread instead of starting one
|
|
27
|
+
--prompt-file <f> Read the prompt from a file
|
|
28
|
+
--schema <file> JSON Schema the final message must match
|
|
29
|
+
--timeout <sec> Give up after this many seconds (default ${DEFAULT_TIMEOUT_SECONDS})
|
|
30
|
+
--trace Also print the command and file-change trace
|
|
31
|
+
-h, --help Print this help`;
|
|
32
|
+
|
|
33
|
+
const parseArgs = (argv) => {
|
|
34
|
+
const options = {
|
|
35
|
+
model: DEFAULT_MODEL,
|
|
36
|
+
effort: '',
|
|
37
|
+
write: false,
|
|
38
|
+
cd: process.cwd(),
|
|
39
|
+
resume: '',
|
|
40
|
+
promptFile: '',
|
|
41
|
+
schema: '',
|
|
42
|
+
timeout: DEFAULT_TIMEOUT_SECONDS,
|
|
43
|
+
trace: false,
|
|
44
|
+
prompt: '',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const rest = [];
|
|
48
|
+
|
|
49
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
50
|
+
const arg = argv[index];
|
|
51
|
+
const next = () => {
|
|
52
|
+
index += 1;
|
|
53
|
+
if (index >= argv.length) throw new Error(`${arg} needs a value.`);
|
|
54
|
+
return argv[index];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (arg === '-m' || arg === '--model') options.model = next();
|
|
58
|
+
else if (arg === '-e' || arg === '--effort') options.effort = next();
|
|
59
|
+
else if (arg === '-w' || arg === '--write') options.write = true;
|
|
60
|
+
else if (arg === '-C' || arg === '--cd') options.cd = next();
|
|
61
|
+
else if (arg === '--resume') options.resume = next();
|
|
62
|
+
else if (arg === '--prompt-file') options.promptFile = next();
|
|
63
|
+
else if (arg === '--schema') options.schema = next();
|
|
64
|
+
else if (arg === '--timeout') options.timeout = Number(next());
|
|
65
|
+
else if (arg === '--trace') options.trace = true;
|
|
66
|
+
else if (arg === '-h' || arg === '--help') options.help = true;
|
|
67
|
+
else if (arg.startsWith('-') && arg !== '-') throw new Error(`Unknown option ${arg}.`);
|
|
68
|
+
else rest.push(arg);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
options.prompt = options.promptFile ? readFileSync(options.promptFile, 'utf8') : rest.join(' ');
|
|
72
|
+
|
|
73
|
+
return options;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const readStdin = () =>
|
|
77
|
+
new Promise((resolve) => {
|
|
78
|
+
let buffer = '';
|
|
79
|
+
process.stdin.setEncoding('utf8');
|
|
80
|
+
process.stdin.on('data', (chunk) => (buffer += chunk));
|
|
81
|
+
process.stdin.on('end', () => resolve(buffer));
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const buildArgs = (options, lastMessageFile) => {
|
|
85
|
+
const args = ['exec'];
|
|
86
|
+
|
|
87
|
+
if (options.resume) args.push('resume');
|
|
88
|
+
|
|
89
|
+
args.push('--json', '--skip-git-repo-check', '-o', lastMessageFile, '-m', options.model);
|
|
90
|
+
|
|
91
|
+
// `codex exec resume` carries the sandbox and the working root of the session it resumes,
|
|
92
|
+
// and rejects both flags, so only a fresh run may pass them.
|
|
93
|
+
if (!options.resume) {
|
|
94
|
+
args.push('-C', options.cd, '--sandbox', options.write ? 'workspace-write' : 'read-only');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (options.effort) args.push('-c', `model_reasoning_effort="${options.effort}"`);
|
|
98
|
+
if (options.schema) args.push('--output-schema', options.schema);
|
|
99
|
+
if (options.resume) args.push(options.resume);
|
|
100
|
+
|
|
101
|
+
args.push('-');
|
|
102
|
+
|
|
103
|
+
return args;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const describeItem = (item) => {
|
|
107
|
+
if (item.type === 'command_execution') return `$ ${String(item.command ?? '').split('\n')[0]}`;
|
|
108
|
+
if (item.type === 'file_change') {
|
|
109
|
+
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
110
|
+
return `~ ${changes.map((change) => `${change.kind ?? 'edit'} ${change.path ?? ''}`).join(', ')}`;
|
|
111
|
+
}
|
|
112
|
+
if (item.type === 'error') return `! ${item.message ?? 'unknown error'}`;
|
|
113
|
+
return '';
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const duration = (milliseconds) => {
|
|
117
|
+
const seconds = Math.round(milliseconds / 1000);
|
|
118
|
+
return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m${String(seconds % 60).padStart(2, '0')}s`;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const run = async () => {
|
|
122
|
+
const options = parseArgs(process.argv.slice(2));
|
|
123
|
+
|
|
124
|
+
if (options.help) {
|
|
125
|
+
process.stdout.write(`${USAGE}\n`);
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!options.prompt.trim() && !process.stdin.isTTY) options.prompt = await readStdin();
|
|
130
|
+
|
|
131
|
+
if (!options.prompt.trim()) {
|
|
132
|
+
process.stderr.write(`${USAGE}\n`);
|
|
133
|
+
return 2;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const logDir = join(tmpdir(), 'codex-agent');
|
|
137
|
+
mkdirSync(logDir, { recursive: true });
|
|
138
|
+
|
|
139
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
140
|
+
const logFile = join(logDir, `${stamp}.jsonl`);
|
|
141
|
+
const lastMessageFile = join(logDir, `${stamp}.last.md`);
|
|
142
|
+
const log = createWriteStream(logFile);
|
|
143
|
+
const started = Date.now();
|
|
144
|
+
|
|
145
|
+
const child = spawn('codex', buildArgs(options, lastMessageFile), {
|
|
146
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
147
|
+
env: process.env,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
child.stdin.end(options.prompt);
|
|
151
|
+
|
|
152
|
+
const state = { thread: '', usage: null, errors: [], trace: [], failed: false };
|
|
153
|
+
|
|
154
|
+
createInterface({ input: child.stdout }).on('line', (line) => {
|
|
155
|
+
log.write(`${line}\n`);
|
|
156
|
+
|
|
157
|
+
let event;
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
event = JSON.parse(line);
|
|
161
|
+
} catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (event.type === 'thread.started') state.thread = event.thread_id ?? '';
|
|
166
|
+
else if (event.type === 'turn.completed') state.usage = event.usage ?? null;
|
|
167
|
+
else if (event.type === 'turn.failed') {
|
|
168
|
+
state.failed = true;
|
|
169
|
+
state.errors.push(event.error?.message ?? 'the turn failed');
|
|
170
|
+
} else if (event.type === 'item.completed') {
|
|
171
|
+
const description = describeItem(event.item ?? {});
|
|
172
|
+
if (description) state.trace.push(description);
|
|
173
|
+
if (event.item?.type === 'error') state.errors.push(event.item.message ?? 'unknown error');
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
let stderrText = '';
|
|
178
|
+
child.stderr.setEncoding('utf8');
|
|
179
|
+
child.stderr.on('data', (chunk) => (stderrText += chunk));
|
|
180
|
+
|
|
181
|
+
const timer = setTimeout(() => child.kill('SIGKILL'), Math.max(1, options.timeout) * 1000);
|
|
182
|
+
const code = await new Promise((resolve) => child.on('close', resolve));
|
|
183
|
+
|
|
184
|
+
clearTimeout(timer);
|
|
185
|
+
log.end();
|
|
186
|
+
|
|
187
|
+
let finalMessage;
|
|
188
|
+
|
|
189
|
+
try {
|
|
190
|
+
finalMessage = readFileSync(lastMessageFile, 'utf8').trim();
|
|
191
|
+
rmSync(lastMessageFile, { force: true });
|
|
192
|
+
} catch {
|
|
193
|
+
finalMessage = '';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const failed = code !== 0 || state.failed || (!finalMessage && state.errors.length > 0);
|
|
197
|
+
|
|
198
|
+
if (options.trace && state.trace.length > 0) process.stdout.write(`${state.trace.join('\n')}\n\n`);
|
|
199
|
+
if (finalMessage) process.stdout.write(`${finalMessage}\n`);
|
|
200
|
+
|
|
201
|
+
if (failed) {
|
|
202
|
+
const reason = state.errors.join('\n') || stderrText.trim() || `codex exited with code ${code}`;
|
|
203
|
+
process.stdout.write(`\ncodex agent FAILED: ${reason}\n`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const parts = [
|
|
207
|
+
`codex ${options.model}`,
|
|
208
|
+
options.write ? 'workspace-write' : 'read-only',
|
|
209
|
+
duration(Date.now() - started),
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
if (state.usage) parts.push(`${state.usage.output_tokens ?? 0} out tok`);
|
|
213
|
+
|
|
214
|
+
process.stdout.write(`\n--- ${parts.join(' · ')}\n`);
|
|
215
|
+
|
|
216
|
+
if (state.thread) process.stdout.write(`resume: --resume ${state.thread}\n`);
|
|
217
|
+
|
|
218
|
+
process.stdout.write(`log: ${logFile}\n`);
|
|
219
|
+
|
|
220
|
+
return failed ? 1 : 0;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
run().then(
|
|
224
|
+
(code) => process.exit(code),
|
|
225
|
+
(error) => {
|
|
226
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
227
|
+
process.exit(2);
|
|
228
|
+
},
|
|
229
|
+
);
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-exploration
|
|
3
|
+
description: 'How a visual design exploration runs: step size, what to show the user at each stop, when you may commit. Read BEFORE any visual design work on a sketch, prototype, theme, palette or component look.'
|
|
4
|
+
kind: skill
|
|
5
|
+
scope: both
|
|
6
|
+
vars: [storybookUrl]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Design exploration
|
|
10
|
+
|
|
11
|
+
A design exploration is a dialog. **The user is the designer. You find and frame. The user
|
|
12
|
+
chooses.** A finding is not a licence to pick the fix.
|
|
13
|
+
|
|
14
|
+
One exception: where the rules of the project give your role its own picks, build your recommendation, record the
|
|
15
|
+
pick with `--by <model id>` and report it. Do not stop for a choice then.
|
|
16
|
+
|
|
17
|
+
The unit of work is one open question, with every answer drawn side by side at the same
|
|
18
|
+
geometry: a **sketch** on a product, or a **call** in a repository with the old setup. A variant wins
|
|
19
|
+
or loses only against the other variants of its question.
|
|
20
|
+
|
|
21
|
+
## The rules
|
|
22
|
+
|
|
23
|
+
1. **One open call at a time.** Take one question. Draw its variants. Stop.
|
|
24
|
+
2. **Put the variants in the call, then name your pick.** Two to four variants, drawn for
|
|
25
|
+
real, side by side, labelled, with what each one costs. Your pick is a proposal. Never ask
|
|
26
|
+
a yes/no question about content, and never ask the user what they want: deliver strong
|
|
27
|
+
variants, and the user picks.
|
|
28
|
+
3. **Commit only when the user says commit.** A merge the user makes in Ethlete Studio counts as
|
|
29
|
+
that word for the merged part: commit the part, not the open sketches.
|
|
30
|
+
4. **A clear rejection starts the next call.** Settle and record the rejected call, then draw
|
|
31
|
+
the next focused question automatically, within the user's original scope. Stop only when the
|
|
32
|
+
user asks to pause or end the exploration, or when their feedback leaves no grounded next
|
|
33
|
+
question.
|
|
34
|
+
5. **Keep the answer short.** 120 words at most.
|
|
35
|
+
6. **A reference informs, it is not a template.** Before you show a round led by a reference
|
|
36
|
+
(a Figma file, another product), state the problem the reference solves, the principle you take
|
|
37
|
+
from it, and how each variant differs in concept. Then review the variants beside the reference
|
|
38
|
+
for literal copies. Derive the composition from the product's own visual language; a new palette
|
|
39
|
+
or spacing on the reference's layout is not a different concept.
|
|
40
|
+
|
|
41
|
+
7. **Visible UI is built only from a sketch the user picked.** A new or changed element, label,
|
|
42
|
+
badge or layout needs a picked sketch, and the build brief names its id. "Decision" and
|
|
43
|
+
"regression" items are no exception. Without a picked sketch, build data and specs only and
|
|
44
|
+
stop at the UI.
|
|
45
|
+
|
|
46
|
+
Confirm the step size once, at the start. Do not ask again at every stop. A task is not
|
|
47
|
+
finished while the user is still talking about it.
|
|
48
|
+
|
|
49
|
+
## What one stop looks like
|
|
50
|
+
|
|
51
|
+
- The question, in one sentence.
|
|
52
|
+
- The sketch (or call slug) to look at.
|
|
53
|
+
- The variants, labelled A, B, C, one line each.
|
|
54
|
+
- Your pick, one line on why.
|
|
55
|
+
- Nothing else. No next step, no second finding.
|
|
56
|
+
|
|
57
|
+
**Do not send a screenshot.** The user keeps the call open. Screenshot only for your own check that a
|
|
58
|
+
variant renders: `et design shot <layer>/<name> --states [--variants]` draws one contact sheet. Every
|
|
59
|
+
flag, the motion shots and the raw screenshot script are in {%resource:reference-shots.md%}. Do not
|
|
60
|
+
write a scratch script for batch shots.
|
|
61
|
+
|
|
62
|
+
If a second defect appears, add it to the open list and give it one line. Do not draw it.
|
|
63
|
+
|
|
64
|
+
## Where the variants are drawn
|
|
65
|
+
|
|
66
|
+
The exploration's plan file names the tool. Two shapes exist.
|
|
67
|
+
|
|
68
|
+
**A repository with a `.ethlete/design` folder** keeps one design system per **product**, and the
|
|
69
|
+
user reads and decides in Ethlete Studio. The tool is `et design`, from `@ethlete/cli`; run
|
|
70
|
+
`et design --help` for every command, `et design <command> [<subcommand>] --help` for one.
|
|
71
|
+
In the SDK checkout, `yarn design` builds the CLI before each call; in a check-and-shot loop,
|
|
72
|
+
build once and call `node dist/libs/cli/src/index.js design` instead.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
.ethlete/design/
|
|
76
|
+
config.json the port and one `products` entry each
|
|
77
|
+
<product>/<layer>/<part>/ layer: foundations, components, elements, pages
|
|
78
|
+
<product>/flows/<name>.json a flow: pages and their states joined by lines
|
|
79
|
+
<product>/sketches/<layer>-<name>/ an open sketch: sketch.json and one folder per variant
|
|
80
|
+
<product>/comments/<id>.json a comment the user wrote in Studio
|
|
81
|
+
calls/ old calls: Legacy, read-only
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Studio no longer takes new calls. **New work goes to a product, never to a new call**; do not run
|
|
85
|
+
`et design new`. Old calls stay in Studio's Legacy tab as reference for moving them into a
|
|
86
|
+
product. They take no picks and no new variants.
|
|
87
|
+
|
|
88
|
+
## Hard rules for products and sketches
|
|
89
|
+
|
|
90
|
+
- A change to a merged part, also a small one, is a **sketch**; never edit a merged part directly. When
|
|
91
|
+
nothing is to choose, the sketch has one variant (`--variants a`). Variants are alternatives, never a state
|
|
92
|
+
of another variant. Two to four variants, each with its cost; run `sketch check` before `sketch ready`.
|
|
93
|
+
- **Never run `sketch merge` or `sketch discard`, and never pick a variant, unless your role has its own picks.** Studio merges on the user's
|
|
94
|
+
click. After a pick or discard, do not merge. Run `sketch reject` or `reopen` only when the user did.
|
|
95
|
+
- Mark a sketch `ready` only when no change to it waits on anything; otherwise `sketch hold`.
|
|
96
|
+
- Every write command takes `--by <model id>`. **Never guess your id**: use the one your prompt names, or ask
|
|
97
|
+
the coordinator or the user before you write.
|
|
98
|
+
- A direct edit of a merged part is never accepted by hand: `design check` opens an old/new edit sketch and the
|
|
99
|
+
user picks in Studio. Remove a part only with `et design part remove`, never `git rm`.
|
|
100
|
+
- Studio takes no new calls: never run `et design new`. New work goes to a product.
|
|
101
|
+
- Share code between variants in the sketch's `shared/` folder only; no shared parameter or branch for one
|
|
102
|
+
variant. An asset is one file in `<product>/assets/`, never inlined.
|
|
103
|
+
- A user comment to combine variants is a new variant in a new round (`sketch variant --from --round --note`).
|
|
104
|
+
- Read the inbox at the start of a session and after each `ready`. Answer with `inbox done <id> --note`,
|
|
105
|
+
ask with `comment reply --question` only when you cannot go on. Only the user resolves a thread.
|
|
106
|
+
- Use the `ethlete-design` MCP tools when they are in your tool list, and call `sketch_report` before every
|
|
107
|
+
variant edit.
|
|
108
|
+
- Draw from the design system, never invent a button or field: the product's parts, then SDK components via
|
|
109
|
+
`ng()`, then new. Colours come from the SDK theming systems, never your own tokens. A part exists only
|
|
110
|
+
because the user picked a sketch.
|
|
111
|
+
- A wireframe is rough and fast: regions and names only, no polish, no subagent, one sketch per screen.
|
|
112
|
+
- Do not start a design stage before the one above it is settled: wireframes, foundations, logo and CI,
|
|
113
|
+
components, elements, pages, prototype.
|
|
114
|
+
|
|
115
|
+
Details, commands and examples, read on demand:
|
|
116
|
+
|
|
117
|
+
- {%resource:reference-products-and-sketches.md%}: creating a product, every `sketch` command, shared code,
|
|
118
|
+
assets, rounds, `--by`, the merge and accept flow. Read before the first sketch command.
|
|
119
|
+
- {%resource:reference-inbox-and-mcp.md%}: reading and answering comments, thread states, the MCP tools.
|
|
120
|
+
- {%resource:reference-flows-and-wireframes.md%}: flow JSON, the wireframe kit and its rules.
|
|
121
|
+
- {%resource:reference-check-and-notes.md%}: `design check` rules and warnings, drawing-file constraints,
|
|
122
|
+
`setup`, `ngStates`, notes.
|
|
123
|
+
- {%resource:reference-order-and-design-system.md%}: the stage order, component states and
|
|
124
|
+
`interactionRows`, `ng()` and form fields, theming rules.
|
|
125
|
+
- {%resource:reference-shots.md%}: every `shot` flag, motion shots, the screenshot script.
|
|
126
|
+
|
|
127
|
+
## Check before you look
|
|
128
|
+
|
|
129
|
+
A broken build draws an overlay, so a screenshot of it looks like a design. **One check
|
|
130
|
+
covers that, and it is the whole gate.** Name the files you changed, never a whole project,
|
|
131
|
+
which is far slower and can fight the user's own editor.
|
|
132
|
+
|
|
133
|
+
With `et design`, run the checker from the checkout it draws:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
et design check --lint <changed files> --tsconfig
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`--tsconfig` with no path types every call of the checkout. `--tsconfig` also types each variant of
|
|
140
|
+
an open sketch and prints the tsc output of a failing one. `--checkout <path>` names another
|
|
141
|
+
one.
|
|
142
|
+
|
|
143
|
+
With a Storybook, copy {%resource:check-story.mjs%} to the **repository root** first:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
node check-story.mjs --lint <changed files> --tsconfig apps/<app>/.storybook/tsconfig.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Both take about four seconds and need no dev server. Then stop and hand the slug to the
|
|
150
|
+
user. Do not also render it in a browser: it costs a browser launch, and both tools
|
|
151
|
+
transpile without type checking, so the render reports `ok` on a file that does not
|
|
152
|
+
compile. Open it only when the check passes and the drawing still does not appear:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
et design check --call <slug> # every variant of the call
|
|
156
|
+
et design check --call <slug> --variant b # one of them
|
|
157
|
+
node check-story.mjs --tsconfig <path> --story <story-id>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
A passing check says the variant builds, not that it looks good. Before `sketch ready`, look at
|
|
161
|
+
each variant at a readable scale and in its whole host page, and critique its hierarchy, spacing,
|
|
162
|
+
nesting and host context together. Drop a variant that is technically valid but visually weak
|
|
163
|
+
before the user sees it. In your summary, say "renders correctly", never "good" or "approved":
|
|
164
|
+
the user decides that.
|
|
165
|
+
|
|
166
|
+
## Delegating a sketch
|
|
167
|
+
|
|
168
|
+
Every brief names `model: opus`, and every prompt names the exact model id the sub-agent runs on,
|
|
169
|
+
for example "Your model id is `claude-opus-5-5`; pass `--by claude-opus-5-5` to every write
|
|
170
|
+
command." You know the id because you chose the model; the sub-agent does not, and must not guess.
|
|
171
|
+
|
|
172
|
+
1. **One agent per sketch.** It draws all the variants of the sketch. Give it the sketch folder, the
|
|
173
|
+
fixture it must not change, and the claim of each variant. Do not spawn one agent per
|
|
174
|
+
variant: each would re-read the skill, the call, the fixture and the example, about 45-57k
|
|
175
|
+
tokens each, so the cost is several times higher. Calls are independent, so several calls
|
|
176
|
+
can run at once, one agent each.
|
|
177
|
+
2. **One check-and-fix agent, after the drawing agents return.** Give it the changed files
|
|
178
|
+
and the call slug. It runs the check above, fixes what it reports, and repeats until the
|
|
179
|
+
check says `ok`. It may not change what a variant draws, only what stops it rendering.
|
|
180
|
+
3. **One write-up agent, once the user settles the sketch in Studio.** Give it the verdict in the
|
|
181
|
+
user's own words and the plan file. It records what won, what lost and why, it sets each
|
|
182
|
+
variant's `verdict` in an old call's `call.ts` (a product sketch needs none; the merge sets the note). It runs while you open
|
|
183
|
+
the next call.
|
|
184
|
+
|
|
185
|
+
## Writing it down
|
|
186
|
+
|
|
187
|
+
Every settled call goes in the exploration's plan file: what won, what lost, and why. Keep
|
|
188
|
+
an **Open** list for the calls not yet made. A rejected variant written down stops the next
|
|
189
|
+
session from drawing it again. After a clear rejection, use that record to frame and draw the
|
|
190
|
+
next call; do not wait for the user to type “continue”.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find out why a story does not render, in the cheapest order.
|
|
3
|
+
*
|
|
4
|
+
* A compile error renders as an overlay on top of the story, so a screenshot of it looks
|
|
5
|
+
* like a design. Run this first, and never screenshot before it says `ok`.
|
|
6
|
+
*
|
|
7
|
+
* Copy to the repository root - Node resolves `playwright` from the working directory.
|
|
8
|
+
*
|
|
9
|
+
* node check-story.mjs --lint <file>… --tsconfig <path> # ~4s, no browser
|
|
10
|
+
* node check-story.mjs --tsconfig <path> --story <story-id> # + the render
|
|
11
|
+
* SB_URL=http://localhost:4401 node check-story.mjs --story <story-id>
|
|
12
|
+
*
|
|
13
|
+
* Three stages, because they cost three different amounts:
|
|
14
|
+
*
|
|
15
|
+
* 1. `eslint` on the files you changed, about a second. Name the files - never a whole
|
|
16
|
+
* project, which is far slower and can fight the user's own editor.
|
|
17
|
+
* 2. `tsc --noEmit` reads the source. It needs no dev server, waits for no rebuild, and
|
|
18
|
+
* catches every syntax and type error in about three seconds. Almost everything you
|
|
19
|
+
* break is caught here.
|
|
20
|
+
* 3. The browser catches what the source cannot: an Angular template error, a runtime
|
|
21
|
+
* throw, a missing story id. It costs a browser launch, and it can only see a build the
|
|
22
|
+
* dev server has already finished, so a fresh edit needs a few seconds first.
|
|
23
|
+
*
|
|
24
|
+
* A type error does not stop this repo's Storybook - it transpiles without checking - so
|
|
25
|
+
* stage 2 alone will report `ok` on a file that does not compile. That is why stage 1 exists.
|
|
26
|
+
*/
|
|
27
|
+
import { execFileSync } from 'node:child_process';
|
|
28
|
+
|
|
29
|
+
const BASE = process.env.SB_URL ?? 'http://localhost:4400';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The type checker to run. `tsc` resolves the one the repository installed. Set
|
|
33
|
+
* `TSC=@typescript/native-preview` for the Go port, which is about a third faster - but it
|
|
34
|
+
* rejects a `baseUrl` in the config, so a repository that still uses one cannot run it.
|
|
35
|
+
*/
|
|
36
|
+
const TSC = process.env.TSC ?? null;
|
|
37
|
+
|
|
38
|
+
const flags = { '--lint': [], '--tsconfig': [], '--story': [] };
|
|
39
|
+
let current = null;
|
|
40
|
+
|
|
41
|
+
for (const arg of process.argv.slice(2)) {
|
|
42
|
+
if (arg in flags) current = arg;
|
|
43
|
+
else if (current) flags[current].push(arg);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const lintFiles = flags['--lint'];
|
|
47
|
+
const [tsconfig] = flags['--tsconfig'];
|
|
48
|
+
const [id] = flags['--story'];
|
|
49
|
+
|
|
50
|
+
if (lintFiles.length === 0 && !tsconfig && !id) {
|
|
51
|
+
console.error('usage: node check-story.mjs [--lint <file>…] [--tsconfig <path>] [--story <id>]');
|
|
52
|
+
process.exit(2);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A bundler stack runs to hundreds of frames and says nothing. Keep the message. */
|
|
56
|
+
const trim = (text) =>
|
|
57
|
+
[...new Set(text.split('\n').filter((line) => !/^\s+at /.test(line) && line.trim() !== ''))].slice(0, 12).join('\n');
|
|
58
|
+
|
|
59
|
+
if (lintFiles.length > 0) {
|
|
60
|
+
try {
|
|
61
|
+
execFileSync('npx', ['eslint', ...lintFiles], { encoding: 'utf8', stdio: 'pipe' });
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`LINT\n${trim(`${error.stdout ?? ''}${error.stderr ?? ''}`)}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (tsconfig) {
|
|
69
|
+
try {
|
|
70
|
+
const cmd = TSC ? ['-y', TSC] : ['tsc'];
|
|
71
|
+
execFileSync('npx', [...cmd, '--noEmit', '-p', tsconfig], { encoding: 'utf8', stdio: 'pipe' });
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error(`TYPE ERROR\n${trim(`${error.stdout ?? ''}${error.stderr ?? ''}`)}`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!id) {
|
|
79
|
+
console.log('ok');
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const { chromium } = await import('playwright');
|
|
84
|
+
|
|
85
|
+
const browser = await chromium.launch();
|
|
86
|
+
const page = await browser.newPage({ viewport: { width: 1400, height: 900 } });
|
|
87
|
+
|
|
88
|
+
/** Angular throws at render time; the overlay never shows those, so read the console too. */
|
|
89
|
+
const consoleErrors = [];
|
|
90
|
+
page.on('console', (m) => m.type() === 'error' && consoleErrors.push(m.text()));
|
|
91
|
+
page.on('pageerror', (e) => consoleErrors.push(e.message));
|
|
92
|
+
|
|
93
|
+
await page.goto(`${BASE}/iframe.html?id=${id}&viewMode=story`, { waitUntil: 'domcontentloaded' });
|
|
94
|
+
|
|
95
|
+
const rendered = await page
|
|
96
|
+
.locator('#storybook-root > *')
|
|
97
|
+
.first()
|
|
98
|
+
.waitFor({ timeout: 15000 })
|
|
99
|
+
.then(
|
|
100
|
+
() => true,
|
|
101
|
+
() => false,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
/** The webpack overlay is an iframe, so its text is only reachable through a frame locator. */
|
|
105
|
+
const webpackOverlayText =
|
|
106
|
+
(await page.locator('#webpack-dev-server-client-overlay').count()) > 0
|
|
107
|
+
? await page
|
|
108
|
+
.frameLocator('#webpack-dev-server-client-overlay')
|
|
109
|
+
.locator('body')
|
|
110
|
+
.innerText()
|
|
111
|
+
.catch(() => '(overlay present, text unreadable)')
|
|
112
|
+
: '';
|
|
113
|
+
/** The Vite overlay keeps its text in a shadow root. */
|
|
114
|
+
const viteOverlayText = await page.evaluate(() => {
|
|
115
|
+
const overlay = document.querySelector('vite-error-overlay');
|
|
116
|
+
if (!overlay) return '';
|
|
117
|
+
return overlay.shadowRoot?.textContent?.trim() || '(overlay present, text unreadable)';
|
|
118
|
+
});
|
|
119
|
+
const overlayText = webpackOverlayText || viteOverlayText;
|
|
120
|
+
|
|
121
|
+
await browser.close();
|
|
122
|
+
|
|
123
|
+
if (overlayText) {
|
|
124
|
+
console.error(`COMPILE ERROR on ${id}\n${trim(overlayText)}`);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!rendered) {
|
|
129
|
+
console.error(`EMPTY on ${id} - #storybook-root never got a child.`);
|
|
130
|
+
if (consoleErrors.length > 0) console.error(trim(consoleErrors.join('\n')));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (consoleErrors.length > 0) {
|
|
135
|
+
console.error(`RENDERED WITH ERRORS on ${id}\n${trim(consoleErrors.join('\n'))}`);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
console.log(`ok ${id}`);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Design exploration: checking a product, drawing files and notes
|
|
2
|
+
|
|
3
|
+
### Check a product
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
et design check --product <name> # layer dependencies, hard-coded colours, undefined tokens, copied components, scripted motion, tsc (open sketch variants too), render
|
|
7
|
+
et design system --json # each part's origin, note, states, presets and problems
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Without `--product`, `check` covers every product. A part may only use its own layer and the
|
|
11
|
+
layers below it (see "The order of a design"). Rule `FLOW` reports a misshaped flow file, a frame
|
|
12
|
+
naming a part or state that exists neither in the product nor in an open sketch of that part, a duplicate state, and a line to a state that is not a frame of
|
|
13
|
+
the flow. Rule `WIREFRAME-KIT` reports a component or foundation importing the kit. Pass the changed files to the check below as before.
|
|
14
|
+
|
|
15
|
+
Once the other rules pass, the check draws every state in a headless Chromium on a server of its own
|
|
16
|
+
(pages at each preset, a part with `widths` at each width, any other part fitted), and
|
|
17
|
+
`sketch check` does the same for the open variants and the pages they show in. Each line names
|
|
18
|
+
product, part, state, size and a selector path:
|
|
19
|
+
|
|
20
|
+
- `OVERFLOW` - the frame scrolls: content wider than the frame, or taller than a preset height.
|
|
21
|
+
- `CLIPPED` - an element with `overflow: hidden|clip` cuts its content, unless it sets
|
|
22
|
+
`text-overflow: ellipsis` or a line clamp.
|
|
23
|
+
- `WRAP` - text in a button, tab, badge, chip or `white-space: nowrap` box runs onto a second line.
|
|
24
|
+
- `ZERO-SIZE` - the part root has no width or no height.
|
|
25
|
+
- `UNKNOWN-THEME` - a `et-color--<name>` class names a colour theme no stylesheet of the frame defines, so it draws in the fallback colour.
|
|
26
|
+
- `RENDER` - the frame refused to draw, or the part did not load.
|
|
27
|
+
|
|
28
|
+
A `WARNING` line does not fail the check:
|
|
29
|
+
|
|
30
|
+
- `UNDEFINED-CLASS` - a class carries a prefix the product's part CSS uses (`st-`, not the SDK's
|
|
31
|
+
`et-`), but no stylesheet of the frame defines it. Named once, at the first part that draws it.
|
|
32
|
+
- `GRID-COVERAGE` - some `grid` rows fill every interaction column (`rest`, `hover`, `active`,
|
|
33
|
+
`focus-visible`, `disabled`) and others leave some out, so a state can break there unseen.
|
|
34
|
+
|
|
35
|
+
A part that breaks a rule on purpose names it: `definePart({ checks: { skip: ['CLIPPED'] }, … })`;
|
|
36
|
+
the skip covers the part wherever it is drawn. Without Playwright Chromium the check prints
|
|
37
|
+
`RENDER CHECK SKIPPED` and passes on the other rules.
|
|
38
|
+
|
|
39
|
+
A project's `config.json` entry can name `themes`, `{ "surface": [...], "color": [...] }`; a
|
|
40
|
+
frame asked for a theme gets the `et-surface--<name>` and `et-color--<name>` classes on its root,
|
|
41
|
+
so a drawing must take its colours from the theme tokens and never set a surface or colour class
|
|
42
|
+
on its own root. An inner panel may set `et-surface--<name>`.
|
|
43
|
+
|
|
44
|
+
`et design [checkout]` serves the frames; the checkout defaults to the working directory and
|
|
45
|
+
`DE_PORT` overrules the port. In the ethlete SDK the user reads Studio, started with `yarn studio`,
|
|
46
|
+
which serves the frames itself: do not start `yarn design` next to it. Studio carries its own copy
|
|
47
|
+
of the tool, so a checkout that installs nothing still draws.
|
|
48
|
+
|
|
49
|
+
Three constraints on a drawing file:
|
|
50
|
+
|
|
51
|
+
- **Never import a package barrel.** The libraries resolve to source, so one barrel makes the
|
|
52
|
+
browser request every module and the requests fail with `ERR_INSUFFICIENT_RESOURCES`. Import
|
|
53
|
+
the one file you need.
|
|
54
|
+
- **The fixture is shared, and a variant may not change it.**
|
|
55
|
+
- **One file per variant**, so a broken variant breaks its own frame only.
|
|
56
|
+
|
|
57
|
+
A `<script>` in a drawing never runs. For behavior give the drawing a `setup(root)` function
|
|
58
|
+
(called once after the markup is in `root`, no cleanup, wire one delegated listener). Render each
|
|
59
|
+
state of a prototype with `ngStates({ closed: …, open: … }, { imports })` and swap them with
|
|
60
|
+
`setup: flow.on([{ click: '.trigger', go: 'open' }])`. To draw an open overlay, open it in the
|
|
61
|
+
template (`<et-select [open]="true">`); `ng()` returns the real panel and the frame places it.
|
|
62
|
+
`ngStates` wraps the states in `<div data-de-states style="display: contents">`, so a selector
|
|
63
|
+
rule must not depend on that wrapper.
|
|
64
|
+
|
|
65
|
+
**A repository with a sketch Storybook** draws every variant in the **same** story, side by
|
|
66
|
+
side, under the real geometry the thing ships in. The default Storybook is
|
|
67
|
+
{%storybookUrl%}; an app with its own sketch Storybook names its port in the plan file.
|
|
68
|
+
|
|
69
|
+
Either way:
|
|
70
|
+
|
|
71
|
+
- Sketches take inputs only and stay out of the application's build.
|
|
72
|
+
- Prototype, never refactor. Do not touch the shipped component until the treatment is
|
|
73
|
+
settled.
|
|
74
|
+
- Keep the rejected variants drawn, marked as rejected.
|
|
75
|
+
|
|
76
|
+
### Notes
|
|
77
|
+
|
|
78
|
+
A note explains a state: why it looks this way, what it shows. A comment is feedback that needs
|
|
79
|
+
an answer. Write a note when nothing is asked of the reader.
|
|
80
|
+
|
|
81
|
+
A note is `<product>/notes/<timestamp>-<id>.json`:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{ "part": "button", "state": "disabled", "point": { "x": 24, "y": 8 }, "size": "mobile", "text": "Muted, not hidden." }
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `part`, `state` and `text` are required. `point` is optional, in CSS pixels.
|
|
88
|
+
- `size` is required when `point` is set: the preset, the CSS pixel width, or `"fitted"` the note was written at. A
|
|
89
|
+
pointed note shows only at that size; a note without a point shows at every size.
|
|
90
|
+
- A free note on a flow is an entry in the `notes` array of `flows/<name>.json`:
|
|
91
|
+
`{ "id": "…", "text": "…", "at": { "x": 0, "y": -40 } }`. `at` is optional, the note's top-left
|
|
92
|
+
corner on the flow canvas, and may be negative.
|