@atom63/cli 0.1.0-beta.2 → 0.1.0-beta.3
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/generated/agent-index.json +179 -78
- package/package.json +1 -1
- package/src/agents-md.mjs +24 -4
- package/src/rules.mjs +25 -6
package/package.json
CHANGED
package/src/agents-md.mjs
CHANGED
|
@@ -35,6 +35,10 @@ const docsQueries = [
|
|
|
35
35
|
'- Start from a component that exists before writing markup of your own.',
|
|
36
36
|
]
|
|
37
37
|
|
|
38
|
+
/** `a`, `a and b`, `a, b and c`. */
|
|
39
|
+
const list = items =>
|
|
40
|
+
items.length > 1 ? `${items.slice(0, -1).join(', ')} and ${items.at(-1)}` : items.join('')
|
|
41
|
+
|
|
38
42
|
/**
|
|
39
43
|
* `variant: 'cli'` points agents at the `atom63` CLI and MCP server; `'docs'`
|
|
40
44
|
* points them at the published docs, for projects that cannot run the CLI yet.
|
|
@@ -44,11 +48,12 @@ export function agentsSection({ variant = 'cli' } = {}) {
|
|
|
44
48
|
(rule, position) =>
|
|
45
49
|
`${position + 1}. ${rule.rule} ${rule.why}${
|
|
46
50
|
rule.check
|
|
47
|
-
? ` In the design system repo, \`check:craft\` enforces it as ${
|
|
48
|
-
.flat()
|
|
49
|
-
|
|
50
|
-
.join(' and ')}.`
|
|
51
|
+
? ` In the design system repo, \`check:craft\` enforces it as ${list(
|
|
52
|
+
[rule.check].flat().map(check => `\`${check}\``)
|
|
53
|
+
)}.`
|
|
51
54
|
: ''
|
|
55
|
+
}${rule.checkedBy ? ` ${rule.checkedBy}` : ''}${
|
|
56
|
+
rule.unchecked ? ` Not checked mechanically: ${rule.unchecked}` : ''
|
|
52
57
|
}`
|
|
53
58
|
)
|
|
54
59
|
return [
|
|
@@ -62,6 +67,21 @@ export function agentsSection({ variant = 'cli' } = {}) {
|
|
|
62
67
|
].join('\n')
|
|
63
68
|
}
|
|
64
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Rules that do not say how they are enforced: each needs `check` or
|
|
72
|
+
* `checkedBy`, or else `unchecked` with the reason no check can enforce it.
|
|
73
|
+
* @returns {string[]} one message per rule that breaks this
|
|
74
|
+
*/
|
|
75
|
+
export function ruleEnforcementErrors(table = rules) {
|
|
76
|
+
return table.flatMap(rule => {
|
|
77
|
+
const checked = Boolean(rule.check || rule.checkedBy)
|
|
78
|
+
if (checked && rule.unchecked) return [`${rule.id}: names a check and says it is unchecked`]
|
|
79
|
+
if (!checked && !rule.unchecked?.trim())
|
|
80
|
+
return [`${rule.id}: names no check (\`check\`, \`checkedBy\`) and no reason (\`unchecked\`)`]
|
|
81
|
+
return []
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
65
85
|
/** The section wrapped in markers, ready to paste into or sync with an AGENTS.md. */
|
|
66
86
|
export function agentsBlock(options) {
|
|
67
87
|
return `${markers.start}\n\n${agentsSection(options)}\n\n${markers.end}`
|
package/src/rules.mjs
CHANGED
|
@@ -1,50 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The rules an agent follows when it builds UI with Atom63. `atom63 rules`
|
|
3
3
|
* prints them, and the AGENTS.md snippet is generated from the same table.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Every rule says how it is enforced, or why it is not:
|
|
5
|
+
* - `check`: the `check:craft` rule (or rules) that enforces it;
|
|
6
|
+
* - `checkedBy`: another check that enforces it, as a sentence;
|
|
7
|
+
* - `unchecked`: why no check can enforce it mechanically.
|
|
8
|
+
* `check:agents-md` fails on a rule with none of them.
|
|
6
9
|
*/
|
|
7
10
|
export const rules = [
|
|
8
11
|
{
|
|
9
12
|
id: 'query-first',
|
|
10
13
|
rule: 'Query the design system before writing UI: start a screen from the closest page template, then search for components, read their contracts, and start from story examples.',
|
|
11
14
|
why: 'The templates, catalog, contracts and examples are the reviewed answers; guessing reinvents them with drift.',
|
|
15
|
+
unchecked: 'it is a way of working, not a property of the code it produces.',
|
|
12
16
|
},
|
|
13
17
|
{
|
|
14
18
|
id: 'compose-before-create',
|
|
15
19
|
rule: 'Compose existing components before writing new ones. Add a component to the system with `pnpm ds:new`, not by copying another.',
|
|
16
20
|
why: 'A new component must be wired into contracts, recipes, docs and tests; the scaffold does that, a copy does not.',
|
|
21
|
+
unchecked:
|
|
22
|
+
'whether a new component was needed is a judgement; the vibe case studies report the share of elements taken from the system as a diagnostic.',
|
|
17
23
|
},
|
|
18
24
|
{
|
|
19
25
|
id: 'contract-values',
|
|
20
26
|
rule: "Pass only the axis values a component's contract lists (sizes, variants, orientations), and rely on its defaults.",
|
|
21
27
|
why: 'Recipes, the SwiftUI renderer and the Figma variables are built for exactly those values.',
|
|
28
|
+
unchecked:
|
|
29
|
+
"each component's TypeScript props accept only the contract's values, so a type check rejects any other literal and no lint is needed.",
|
|
22
30
|
},
|
|
23
31
|
{
|
|
24
32
|
id: 'tokens-only',
|
|
25
|
-
rule: 'Take every color, space, radius, shadow and duration from `--a63-*` tokens, and look a name up with `atom63 token` before using it. No literal colors and no Tailwind palette utilities.',
|
|
33
|
+
rule: 'Take every color, space, radius, shadow and duration from `--a63-*` tokens, and look a name up with `atom63 token` before using it. No literal colors and no Tailwind palette utilities. Paint text with `--a63-text-*` tokens and backgrounds with fill tokens, not the other way round.',
|
|
26
34
|
why: 'Tokens follow the theme, brand, mode and density; literals break all four, and a token name that does not exist resolves to nothing.',
|
|
27
|
-
check: ['raw-color', 'unknown-token'],
|
|
35
|
+
check: ['raw-color', 'unknown-token', 'token-role'],
|
|
28
36
|
},
|
|
29
37
|
{
|
|
30
38
|
id: 'accent-sparingly',
|
|
31
39
|
rule: 'Use the accent for one or two cues per view; the main action may be neutral. Give a view at most one `variant="primary"` Button. Selection is neutral by default; set `tone="accent"` on a selection, Slider or Progress only when it is one of those cues. Where the product draws its main action or its links in its brand colour, keep `variant="primary"` and `variant="link"`: sparing means one or two cues, not none.',
|
|
32
|
-
why: 'An accent on every control points at nothing. Button `default` is a high-emphasis neutral solid; `primary` is for a main action in the brand colour.
|
|
40
|
+
why: 'An accent on every control points at nothing. Button `default` is a high-emphasis neutral solid; `primary` is for a main action in the brand colour. Taking the accent off a product whose main action is brand-coloured loses the cue the product relies on.',
|
|
41
|
+
checkedBy:
|
|
42
|
+
'The vibe measures warn at more than one primary Button per file, and a case study with that warning is invalid.',
|
|
33
43
|
},
|
|
34
44
|
{
|
|
35
45
|
id: 'quiet-secondary-actions',
|
|
36
46
|
rule: 'Draw secondary actions in toolbars, list rows and card headers as `variant="ghost"` Buttons with `tone="muted"`, icon-only at `icon-sm` or `icon-xs` in dense rows. Keep the main action at full contrast.',
|
|
37
47
|
why: 'Muted ghost actions rest in the secondary text colour, with no box, and go to full contrast on hover, focus and press, so a row of actions stays calm and still answers the pointer.',
|
|
48
|
+
checkedBy:
|
|
49
|
+
'The vibe measures warn at a `variant="ghost"` Button with no `tone`; whether an action is secondary stays a judgement.',
|
|
38
50
|
},
|
|
39
51
|
{
|
|
40
52
|
id: 'one-boundary',
|
|
41
53
|
rule: "One boundary per element: border, fill or shadow, not two. Don't nest outlined containers.",
|
|
42
54
|
why: 'Each extra edge is another line to read past. Card `filled` and `elevated` and Button `raised` give a fill or a shadow without the border.',
|
|
55
|
+
unchecked:
|
|
56
|
+
'borders, fills and shadows add up across components and their parents at render time, so the source does not show the stack; it is left to review.',
|
|
43
57
|
},
|
|
44
58
|
{
|
|
45
59
|
id: 'on-media-colors',
|
|
46
60
|
rule: 'Controls drawn over photos or video use the `--a63-on-media-*` and `--a63-media-*` tokens.',
|
|
47
61
|
why: 'Theme colors are meaningless on an unknown picture; these hold contrast on any image.',
|
|
62
|
+
unchecked:
|
|
63
|
+
'whether a control sits over a picture is a layout fact the source does not show; it is left to review.',
|
|
48
64
|
},
|
|
49
65
|
{
|
|
50
66
|
id: 'content-colors',
|
|
@@ -80,10 +96,13 @@ export const rules = [
|
|
|
80
96
|
id: 'as-child-spreads-props',
|
|
81
97
|
rule: 'A component you pass with `asChild` (or as `render`) must spread the props it receives onto the element it renders and forward its ref.',
|
|
82
98
|
why: 'The part merges its class, data attributes and ref into that element; a wrapper that drops them renders unstyled.',
|
|
99
|
+
unchecked:
|
|
100
|
+
'the component passed is your own code, and whether it spreads the props it receives shows only when it renders.',
|
|
83
101
|
},
|
|
84
102
|
{
|
|
85
103
|
id: 'accessible-by-default',
|
|
86
104
|
rule: 'Keep the native semantics components render (buttons, links, labels, dialogs) and give every icon-only control an accessible name.',
|
|
87
|
-
why: '
|
|
105
|
+
why: 'Assistive technology reads the roles, states and names those elements carry.',
|
|
106
|
+
checkedBy: 'Every story runs axe in CI; code that removes semantics fails it.',
|
|
88
107
|
},
|
|
89
108
|
]
|