designsnitch 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -288,7 +288,7 @@ src/PayButton.tsx
288
288
  "problems": [],
289
289
  "next": [
290
290
  "action이 replace인 1건은 found를 candidates의 값으로 바꾸세요.",
291
- "action이 migrate인 1건은 태그를 candidates의 컴포넌트로 바꾸세요. 먼저 그 컴포넌트를 읽고, import를 더하고, 컴포넌트가 받는 props를 넘기고, 컴포넌트가 이미 주는 className은 지우세요. 태그가 하던 일을 컴포넌트가 못 하면 바꾸지 말고 사용자에게 물으세요.",
291
+ "action이 migrate인 1건은 태그를 candidates의 컴포넌트로 바꾸세요. 먼저 그 컴포넌트를 읽고, import를 더하고, 컴포넌트가 받는 props를 넘기고, 컴포넌트가 이미 주는 className은 지우세요. 태그가 하던 일을 컴포넌트가 못 하거나 모양이 달라지면, 컴포넌트를 고쳐서 맞추지 말고 태그를 그대로 둔 채 사용자에게 물으세요.",
292
292
  "변경하기 전에 decisions의 2건을 사용자에게 물으세요. 사용 횟수와 후보, 확인이 필요한 이유를 함께 알려 주세요.",
293
293
  "고친 뒤 같은 명령을 다시 실행하세요."
294
294
  ],
package/README.md CHANGED
@@ -287,7 +287,7 @@ The first line shows how many tokens and components were read from the config. A
287
287
  "problems": [],
288
288
  "next": [
289
289
  "action \"replace\" (1): replace found with the value in candidates.",
290
- "action \"migrate\" (1): replace the tag with the component in candidates. Read that component first: add the import, pass on the props it accepts, and drop className values it already applies. If it cannot do what the tag did, ask the user instead.",
290
+ "action \"migrate\" (1): replace the tag with the component in candidates. Read that component first: add the import, pass on the props it accepts, and drop className values it already applies. If it cannot do what the tag did or would change how it looks, do not change the component to make it fit: leave the tag and ask the user.",
291
291
  "Before making changes, ask the user about the 2 entries in decisions. Include how often each comes up, the candidates, and the reasons for asking.",
292
292
  "After fixing, run the same command again."
293
293
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "designsnitch",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Keep AI-written UI code manageable and consistent, even without a design system. CLI, agent skills, ESLint plugin and agent hook for React/Next.js with Tailwind CSS v4.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -88,12 +88,20 @@ The exit code is 0 (no errors), 1 (errors found), or 2 (could not run). On 2, re
88
88
  | `action` | What it means | What to do |
89
89
  | --- | --- | --- |
90
90
  | `replace` | A color error whose only candidate keeps the screen and the behavior the same. | Replace `found` with the candidate. |
91
- | `migrate` | A raw tag with exactly one design system component to move to. Whether the component behaves like the tag is not known. | Read the component, then move the tag to it as described below. If the component cannot do what the tag did, such as not passing on `type="submit"` or an event handler, leave the tag and tell the user. The hook does not force this one. |
91
+ | `migrate` | A raw tag with exactly one design system component to move to. Whether the component behaves like the tag is not known. | Read the component, then move the tag to it as described below. If the component does not cover this use, leave the tag and ask the user as described below. The hook does not force this one. |
92
92
  | `ask` | A person has to decide: several candidates, a color that has no token, a token whose value differs between themes, a translucent color (the candidate rounds its opacity), a color in a property that is not a style (such as chart options, where `var()` may not work: read how the value is used before replacing), a token that exists only as a class (no CSS variable to use in a style or a CSS declaration), or a component whose props are dynamic or spread. `message` says which. | Do not change it. Ask the user as described in section 4. |
93
93
  | `repair` | The file could not be parsed. | Fix the syntax error, then check again. |
94
94
 
95
95
  For `migrate`, replacing means more than renaming the tag. Read the design system component file to learn its props, add the import, pass on the tag's props the component accepts, and remove className values that duplicate styles the component already has. Check that event handlers such as `onClick` and attributes such as `type` still reach the rendered element.
96
96
 
97
+ Often the component does not cover the use: it cannot pass on something the tag needs, or moving to it would change how the element looks, such as a text-sized `Button` for a small square icon button. Then there are three ways out, and choosing between them is the user's call, because two of them change the standard.
98
+
99
+ - Extend the component: a new variant, size or prop. This changes a shared component that other screens use.
100
+ - Narrow the rule: a `when` condition in `designsnitch.config.json`, so that this kind of tag is no longer expected to use the component.
101
+ - Keep this tag as an exception, with a disable comment that says why.
102
+
103
+ Leave the tag as it is, and ask. Say what the component lacks, show the place, and recommend one of the three. Do not add a variant to a design system component on your own to make the check pass, even when the result would look the same.
104
+
97
105
  ## 4. Ask so the user can decide
98
106
 
99
107
  Deciding is the user's job. Your job is to make the decision easy. Do not hand over a bare list of violations. Take the questions from `decisions`, most used first. For each one, give:
@@ -127,7 +135,7 @@ Report what you fixed and what you left, separately. For what you left, use the
127
135
 
128
136
  ## What not to do
129
137
 
130
- - Do not edit `designsnitch.config.json` or the token CSS to make the check pass. They are the standard the code is judged against. If one of them seems wrong, explain why and ask the user.
138
+ - Do not edit `designsnitch.config.json`, the token CSS or the design system components to make the check pass. They are the standard the code is judged against. If one of them seems wrong or incomplete, explain why and ask the user.
131
139
  - Do not add `eslint-disable` or `designsnitch-disable-next-line` comments, lower a rule's severity, or turn a rule off to make the check pass. If an exception seems necessary, ask the user.
132
140
  - Do not pick one of several candidates on your own.
133
141
  - Do not change how the tokens are declared, such as turning `@theme` into `@theme static`, to make a `var(--token)` candidate work. Tailwind outputs a theme variable as soon as a class, a style or a CSS file uses it. A variable missing from the compiled CSS before the replacement is expected.
@@ -128,3 +128,4 @@ If you were unsure about a choice, say so and give the alternative. For example,
128
128
  - Do not change an existing config file without asking.
129
129
  - Do not start fixing violations as part of setup.
130
130
  - Do not list a component as a replacement for a tag without reading it.
131
+ - Do not change a design system component so that more tags fit it. Propose it to the user instead.
package/src/messages.js CHANGED
@@ -104,7 +104,7 @@ const en = {
104
104
  nextRepair: (n) => `action "repair" (${n}): fix the syntax error in that file first.`,
105
105
  nextReplace: (n) => `action "replace" (${n}): replace found with the value in candidates.`,
106
106
  nextMigrate: (n) =>
107
- `action "migrate" (${n}): replace the tag with the component in candidates. Read that component first: add the import, pass on the props it accepts, and drop className values it already applies. If it cannot do what the tag did, ask the user instead.`,
107
+ `action "migrate" (${n}): replace the tag with the component in candidates. Read that component first: add the import, pass on the props it accepts, and drop className values it already applies. If it cannot do what the tag did or would change how it looks, do not change the component to make it fit: leave the tag and ask the user.`,
108
108
  nextAsk: (n) =>
109
109
  `Before making changes, ask the user about the ${count(n, "entry", "entries")} in decisions. Include how often each comes up, the candidates, and the reasons for asking.`,
110
110
  hookNextAsk: (n) =>
@@ -256,7 +256,7 @@ const ko = {
256
256
  nextRepair: (n) => `action이 repair인 ${n}건은 그 파일의 문법 오류부터 고치세요.`,
257
257
  nextReplace: (n) => `action이 replace인 ${n}건은 found를 candidates의 값으로 바꾸세요.`,
258
258
  nextMigrate: (n) =>
259
- `action이 migrate인 ${n}건은 태그를 candidates의 컴포넌트로 바꾸세요. 먼저 그 컴포넌트를 읽고, import를 더하고, 컴포넌트가 받는 props를 넘기고, 컴포넌트가 이미 주는 className은 지우세요. 태그가 하던 일을 컴포넌트가 못 하면 바꾸지 말고 사용자에게 물으세요.`,
259
+ `action이 migrate인 ${n}건은 태그를 candidates의 컴포넌트로 바꾸세요. 먼저 그 컴포넌트를 읽고, import를 더하고, 컴포넌트가 받는 props를 넘기고, 컴포넌트가 이미 주는 className은 지우세요. 태그가 하던 일을 컴포넌트가 못 하거나 모양이 달라지면, 컴포넌트를 고쳐서 맞추지 말고 태그를 그대로 둔 채 사용자에게 물으세요.`,
260
260
  nextAsk: (n) =>
261
261
  `변경하기 전에 decisions의 ${n}건을 사용자에게 물으세요. 사용 횟수와 후보, 확인이 필요한 이유를 함께 알려 주세요.`,
262
262
  hookNextAsk: (n) =>