pasika 0.1.6 → 0.2.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/README.md +40 -55
- package/dist/eslint/pasika/index.d.ts +18 -0
- package/dist/eslint/pasika/index.js +18 -3
- package/dist/eslint/pasika/rules/enforce-barrel-exports.d.ts +9 -0
- package/dist/eslint/pasika/rules/enforce-barrel-exports.js +78 -0
- package/dist/eslint/pasika/rules/enforce-cn-merge.d.ts +9 -0
- package/dist/eslint/pasika/rules/enforce-cn-merge.js +84 -0
- package/dist/eslint/pasika/rules/enforce-cva-variant-props.d.ts +9 -0
- package/dist/eslint/pasika/rules/enforce-cva-variant-props.js +76 -0
- package/dist/eslint/pasika/rules/filename-case.js +10 -0
- package/dist/eslint/pasika/rules/import-boundaries.d.ts +2 -0
- package/dist/eslint/pasika/rules/{organization-imports.js → import-boundaries.js} +11 -1
- package/dist/eslint/pasika/rules/no-arbitrary-tailwind.d.ts +9 -0
- package/dist/eslint/pasika/rules/no-arbitrary-tailwind.js +107 -0
- package/dist/eslint/pasika/rules/no-mixed-concerns.d.ts +9 -0
- package/dist/eslint/pasika/rules/no-mixed-concerns.js +84 -0
- package/package.json +5 -16
- package/claude/hooks/.vulyk +0 -3
- package/claude/hooks/AGENTS.md +0 -3
- package/claude/hooks/CLAUDE.md +0 -1
- package/claude/hooks/claude-hooks.md +0 -30
- package/claude/hooks/notification.sh +0 -38
- package/claude/hooks/protect-files.sh +0 -21
- package/claude/hooks/status-line/index.js +0 -57
- package/claude/scripts/render-settings.ts +0 -223
- package/claude/settings.base.json +0 -38
- package/dist/claude/scripts/render-settings.js +0 -145
- package/dist/eslint/pasika/rules/organization-imports.d.ts +0 -2
- package/dist/eslint.config.js +0 -7
- package/dist/scripts/pasika.js +0 -59
- package/docs/agent-conventions.md +0 -27
- package/docs/claude/hooks.md +0 -30
- package/docs/code-organization-guide/code-organization-guide.md +0 -69
- package/docs/code-organization-guide/references/application-architecture-reference.md +0 -149
- package/docs/code-organization-guide/rules/component-placement-rule.md +0 -119
- package/docs/code-organization-guide/rules/configuration-rule.md +0 -42
- package/docs/code-organization-guide/rules/constants-rule.md +0 -74
- package/docs/code-organization-guide/rules/exports-and-imports-rule.md +0 -84
- package/docs/code-organization-guide/rules/folder-nesting-rule.md +0 -82
- package/docs/code-organization-guide/rules/hook-extraction-rule.md +0 -141
- package/docs/code-organization-guide/rules/interactive-component-rule.md +0 -97
- package/docs/code-organization-guide/rules/jsx-hygiene-rule.md +0 -67
- package/docs/code-organization-guide/rules/locales-rule.md +0 -53
- package/docs/code-organization-guide/rules/nameable-visual-concept-rule.md +0 -66
- package/docs/code-organization-guide/rules/no-mixed-concerns-rule.md +0 -63
- package/docs/code-organization-guide/rules/repeated-structure-rule.md +0 -93
- package/docs/code-organization-guide/rules/smart-vs-dumb-component-rule.md +0 -112
- package/docs/code-organization-guide/rules/sole-state-owner-rule.md +0 -101
- package/docs/code-organization-guide/rules/types-and-schemas-rule.md +0 -139
- package/docs/code-organization-guide/rules/utilities-rule.md +0 -86
- package/docs/documentation-guide/_templates/grouped-reference.md +0 -11
- package/docs/documentation-guide/_templates/guide.md +0 -19
- package/docs/documentation-guide/_templates/rule.md +0 -21
- package/docs/documentation-guide/_templates/single-lookup-reference.md +0 -5
- package/docs/documentation-guide/documentation-guide.md +0 -13
- package/docs/documentation-guide/references/documentation-types-reference.md +0 -9
- package/docs/documentation-guide/rules/guide-creation-rule.md +0 -113
- package/docs/documentation-guide/rules/reference-creation-rule.md +0 -132
- package/docs/documentation-guide/rules/rule-creation-rule.md +0 -81
- package/docs/documentation-guide/rules/template-usage-rule.md +0 -49
- package/docs/shadcn-theme.md +0 -121
- package/docs/styling-guide/rules/arbitrary-value-rule.md +0 -31
- package/docs/styling-guide/rules/class-composition-rule.md +0 -52
- package/docs/styling-guide/rules/component-ui-state-rule.md +0 -53
- package/docs/styling-guide/rules/component-variant-rule.md +0 -125
- package/docs/styling-guide/rules/global-stylesheet-rule.md +0 -67
- package/docs/styling-guide/rules/theme-and-utility-definition-rule.md +0 -86
- package/docs/styling-guide/styling-guide.md +0 -14
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# Guide Creation Rule
|
|
2
|
-
|
|
3
|
-
Guides without a consistent creation process invent their own structure. This rule defines how to create a Guide document.
|
|
4
|
-
|
|
5
|
-
- Each How To step MUST be concise and use one sentence.
|
|
6
|
-
- A Guide MAY reference Rules, References, and other Guides.
|
|
7
|
-
- A Guide overview MUST contain one or two short descriptive sentences about the guide's scope and purpose, and MUST NOT contain instructions or links to other documentation.
|
|
8
|
-
- Each How To step MUST link at most one documentation file total, whether that file is a Rule, Reference, or Guide.
|
|
9
|
-
- When a step links a Rule, Reference, or Guide, the step MUST name the concrete decision or result the reader will have after reading it.
|
|
10
|
-
- A step that links another Guide MUST link directly to the relevant How To section.
|
|
11
|
-
- How To sections MUST NOT nest inside other How To sections.
|
|
12
|
-
- Guide file names MUST match the document title in kebab-case and use the `-guide` suffix (e.g., `foo-guide.md`).
|
|
13
|
-
- A Guide with private support files MUST become a folder named the same as its entry-point file, without the `.md` extension.
|
|
14
|
-
- Private Rule files for a Guide MUST live in a `rules/` subfolder inside the Guide's folder.
|
|
15
|
-
- Private Reference files for a Guide MUST live in a `references/` subfolder inside the Guide's folder.
|
|
16
|
-
|
|
17
|
-
## Incorrect — Private Documents Mixed at the Guide Root
|
|
18
|
-
|
|
19
|
-
```text
|
|
20
|
-
feature-workflow-guide/
|
|
21
|
-
├── feature-workflow-guide.md
|
|
22
|
-
├── naming-rule.md
|
|
23
|
-
└── option-reference.md
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Why: mixed Markdown files turn the doc folder into an undifferentiated list once the doc grows.
|
|
27
|
-
|
|
28
|
-
## Correct — Private Documents Grouped by Kind
|
|
29
|
-
|
|
30
|
-
```text
|
|
31
|
-
feature-workflow-guide/
|
|
32
|
-
├── feature-workflow-guide.md
|
|
33
|
-
├── rules/
|
|
34
|
-
│ └── naming-rule.md
|
|
35
|
-
└── references/
|
|
36
|
-
└── option-reference.md
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Why: private support files stay colocated with the entry point while being grouped by document kind.
|
|
40
|
-
|
|
41
|
-
## Incorrect — Step Links to Multiple Documents
|
|
42
|
-
|
|
43
|
-
```markdown
|
|
44
|
-
1. Follow the [Naming Rule](rules/naming-rule.md) and the [Layout Rule](rules/layout-rule.md) so the doc looks right.
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Why: step links two Rules and does not name a concrete decision or result.
|
|
48
|
-
|
|
49
|
-
## Correct — Step Links to One Document
|
|
50
|
-
|
|
51
|
-
```markdown
|
|
52
|
-
1. Follow the [Naming Rule](rules/naming-rule.md) so the doc has a predictable file name.
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Why: step links one Rule and names the concrete result the reader will have.
|
|
56
|
-
|
|
57
|
-
## Incorrect — Nested How To Section
|
|
58
|
-
|
|
59
|
-
```markdown
|
|
60
|
-
## How To Deploy
|
|
61
|
-
|
|
62
|
-
1. Build the project.
|
|
63
|
-
### How To Build
|
|
64
|
-
1. Run the build script.
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Why: a How To section nests inside a step of another How To section.
|
|
68
|
-
|
|
69
|
-
## Correct — Flat How To Sections
|
|
70
|
-
|
|
71
|
-
```markdown
|
|
72
|
-
## How To Deploy
|
|
73
|
-
|
|
74
|
-
1. Follow [How To Build](#how-to-build) to build the project.
|
|
75
|
-
|
|
76
|
-
## How To Build
|
|
77
|
-
|
|
78
|
-
1. Run the build script.
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Why: How To sections stay flat and reference each other via links.
|
|
82
|
-
|
|
83
|
-
## Incorrect — Multi-Sentence Step
|
|
84
|
-
|
|
85
|
-
```markdown
|
|
86
|
-
1. First, check the configuration file. Then verify all required fields are present. After that, confirm none of the fields contain invalid values.
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Why: step uses multiple sentences instead of one concise sentence.
|
|
90
|
-
|
|
91
|
-
## Correct — Concise Step
|
|
92
|
-
|
|
93
|
-
```markdown
|
|
94
|
-
1. Run the config check script.
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Why: step is one concise sentence with a concrete action.
|
|
98
|
-
|
|
99
|
-
## Incorrect — Guide Link Omits Its How To Section
|
|
100
|
-
|
|
101
|
-
```markdown
|
|
102
|
-
1. Follow the [Build Guide](build-guide.md) to build the project.
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Why: link points at a Guide file but does not anchor to a specific How To section, so the reader lands on the guide's introduction and has to search for the relevant workflow.
|
|
106
|
-
|
|
107
|
-
## Correct — Guide Link Targets Its How To Section
|
|
108
|
-
|
|
109
|
-
```markdown
|
|
110
|
-
1. Follow [How To Build](build-guide.md#how-to-build) to build the project.
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Why: link anchors to the specific How To section, so the reader lands directly on the relevant workflow.
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Reference Creation Rule
|
|
2
|
-
|
|
3
|
-
References without a consistent creation process scatter lookup material. This rule defines how to create a Reference document.
|
|
4
|
-
|
|
5
|
-
- Reference file names MUST match the document title in kebab-case and use the `-reference` suffix (e.g., `foo-reference.md`).
|
|
6
|
-
- A Reference MUST NOT link to Rules, Guides, or other References.
|
|
7
|
-
- A Reference MUST NOT use RFC 2119 vocabulary (`MUST`, `MUST NOT`, `SHOULD`, `SHOULD NOT`, `MAY`), because lookup material describes what exists rather than imposing requirements.
|
|
8
|
-
- A Reference overview and the overview of each headed lookup block MUST contain one or two short sentences.
|
|
9
|
-
- A Reference with a single lookup block MUST NOT add a section heading for it.
|
|
10
|
-
- A Reference with two or more lookup blocks MUST add a section heading for every block, including the first.
|
|
11
|
-
|
|
12
|
-
## Incorrect — Reference Links to Another Document
|
|
13
|
-
|
|
14
|
-
```markdown
|
|
15
|
-
- See the [Naming Rule](../rules/naming-rule.md) for the file naming conventions.
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Why: reference body contains a reference to another Rule.
|
|
19
|
-
|
|
20
|
-
## Correct — Reference States the Lookup Fact Directly
|
|
21
|
-
|
|
22
|
-
```markdown
|
|
23
|
-
- File names are kebab-case, match the document title, and have a `-reference` suffix.
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Why: reference states lookup content directly without linking to its source.
|
|
27
|
-
|
|
28
|
-
## Incorrect — Reference Uses Requirement Vocabulary
|
|
29
|
-
|
|
30
|
-
```markdown
|
|
31
|
-
| Layer | Contents |
|
|
32
|
-
| ----- | ------------------------------------------------- |
|
|
33
|
-
| `app` | Routing files only — a route MUST NOT hold a util |
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Why: the cell carries RFC 2119 vocabulary, so a Reference asserts a requirement that only a Rule can own, and the same constraint ends up stated in two documents.
|
|
37
|
-
|
|
38
|
-
## Correct — Reference Describes Existing Content
|
|
39
|
-
|
|
40
|
-
```markdown
|
|
41
|
-
| Layer | Contents |
|
|
42
|
-
| ----- | ------------------ |
|
|
43
|
-
| `app` | Routing files only |
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Why: the cell describes what the layer holds, leaving the requirement to the Rule that owns it.
|
|
47
|
-
|
|
48
|
-
## Incorrect — Single Lookup Block Has a Heading
|
|
49
|
-
|
|
50
|
-
```markdown
|
|
51
|
-
# Option Reference
|
|
52
|
-
|
|
53
|
-
Use this reference to choose between the two supported project sizes when starting a new initiative.
|
|
54
|
-
|
|
55
|
-
## Options
|
|
56
|
-
|
|
57
|
-
Pick the size that matches the team's headcount and timeline.
|
|
58
|
-
|
|
59
|
-
| Option | Use Case |
|
|
60
|
-
| ------ | -------------- |
|
|
61
|
-
| A | Small projects |
|
|
62
|
-
| B | Large projects |
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Why: section heading is unnecessary and forces a duplicated intro covering what the reference is for and what the group contains.
|
|
66
|
-
|
|
67
|
-
## Correct — Single Lookup Block Has No Heading
|
|
68
|
-
|
|
69
|
-
```markdown
|
|
70
|
-
# Option Reference
|
|
71
|
-
|
|
72
|
-
Use this reference to choose between the two supported project sizes when starting a new initiative.
|
|
73
|
-
|
|
74
|
-
| Option | Use Case |
|
|
75
|
-
| ------ | -------------- |
|
|
76
|
-
| A | Small projects |
|
|
77
|
-
| B | Large projects |
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Why: single lookup block sits directly under the intro without a heading.
|
|
81
|
-
|
|
82
|
-
## Incorrect — First of Multiple Lookup Blocks Has No Heading
|
|
83
|
-
|
|
84
|
-
```markdown
|
|
85
|
-
# Option Reference
|
|
86
|
-
|
|
87
|
-
Use this reference to look up the supported project sizes and the review gates each one requires.
|
|
88
|
-
|
|
89
|
-
| Option | Use Case |
|
|
90
|
-
| ------ | -------------- |
|
|
91
|
-
| A | Small projects |
|
|
92
|
-
| B | Large projects |
|
|
93
|
-
|
|
94
|
-
## Review Gates
|
|
95
|
-
|
|
96
|
-
Each size carries a different approval bar.
|
|
97
|
-
|
|
98
|
-
| Option | Approvals |
|
|
99
|
-
| ------ | --------- |
|
|
100
|
-
| A | 1 |
|
|
101
|
-
| B | 2 |
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Why: the reference has two lookup blocks but only the second is headed, so the first table reads as part of the intro and cannot be scanned or linked as a group of its own.
|
|
105
|
-
|
|
106
|
-
## Correct — Every Lookup Block Has a Heading
|
|
107
|
-
|
|
108
|
-
```markdown
|
|
109
|
-
# Option Reference
|
|
110
|
-
|
|
111
|
-
Use this reference to look up the supported project sizes and the review gates each one requires.
|
|
112
|
-
|
|
113
|
-
## Project Sizes
|
|
114
|
-
|
|
115
|
-
Pick the size that matches the team's headcount and timeline.
|
|
116
|
-
|
|
117
|
-
| Option | Use Case |
|
|
118
|
-
| ------ | -------------- |
|
|
119
|
-
| A | Small projects |
|
|
120
|
-
| B | Large projects |
|
|
121
|
-
|
|
122
|
-
## Review Gates
|
|
123
|
-
|
|
124
|
-
Each size carries a different approval bar.
|
|
125
|
-
|
|
126
|
-
| Option | Approvals |
|
|
127
|
-
| ------ | --------- |
|
|
128
|
-
| A | 1 |
|
|
129
|
-
| B | 2 |
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Why: both lookup blocks are headed, so they read as peers and each is independently scannable and linkable.
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Rule Creation Rule
|
|
2
|
-
|
|
3
|
-
Rules without a consistent creation process invent their own structure and enforcement language. This rule defines how to create a Rule document.
|
|
4
|
-
|
|
5
|
-
- Rule file names MUST match the document title in kebab-case and use the `-rule` suffix (e.g., `foo-rule.md`).
|
|
6
|
-
- A Rule MUST contain at least one bullet point that uses [RFC 2119 vocabulary](https://datatracker.ietf.org/doc/html/rfc2119) (`MUST`, `MUST NOT`, `SHOULD`, `SHOULD NOT`, `MAY`).
|
|
7
|
-
- RFC 2119 vocabulary MUST appear only in bullet points, so the bullet list is the single place a requirement is stated.
|
|
8
|
-
- Prose outside bullet points — intros, `Why:` explanations, table cells, and code comments — MUST restate a requirement in plain language instead of repeating RFC 2119 vocabulary.
|
|
9
|
-
- `MUST` MUST mean required.
|
|
10
|
-
- `MUST NOT` MUST mean forbidden.
|
|
11
|
-
- `SHOULD` MUST mean recommended, with exceptions possible.
|
|
12
|
-
- `SHOULD NOT` MUST mean discouraged, with exceptions possible.
|
|
13
|
-
- `MAY` MUST mean optional.
|
|
14
|
-
- A Rule MUST contain at least one Incorrect/Correct pair.
|
|
15
|
-
- A Rule MAY contain multiple Incorrect/Correct pairs.
|
|
16
|
-
- An Incorrect/Correct pair MUST add a concise description after an em dash in both headings, so readers can scan the examples by decision.
|
|
17
|
-
- A Rule MUST NOT link to References, Guides, or other Rules.
|
|
18
|
-
|
|
19
|
-
## Incorrect — Lowercase Requirement Words
|
|
20
|
-
|
|
21
|
-
```markdown
|
|
22
|
-
- Authors must remove unused sections.
|
|
23
|
-
- New docs should use the -rule suffix.
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Why: lower-case "must" and "should" do not carry RFC 2119 meaning.
|
|
27
|
-
|
|
28
|
-
## Correct — RFC 2119 Requirement Words
|
|
29
|
-
|
|
30
|
-
```markdown
|
|
31
|
-
- Authors MUST remove unused sections.
|
|
32
|
-
- New docs SHOULD use the -rule suffix.
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Why: uppercase keywords carry their canonical RFC 2119 meaning.
|
|
36
|
-
|
|
37
|
-
## Incorrect — Rule Links to a Reference
|
|
38
|
-
|
|
39
|
-
```markdown
|
|
40
|
-
- Rule bodies MUST follow the guidance in the [Vocabulary Reference](../references/vocabulary-reference.md).
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Why: rule contains a reference to another Reference.
|
|
44
|
-
|
|
45
|
-
## Correct — Rule States Its Vocabulary Directly
|
|
46
|
-
|
|
47
|
-
```markdown
|
|
48
|
-
- Rule bodies MUST use RFC 2119 vocabulary: MUST, MUST NOT, SHOULD, SHOULD NOT, or MAY.
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Why: rule states requirements directly without referencing other docs.
|
|
52
|
-
|
|
53
|
-
## Incorrect — Requirement Repeated in an Explanation
|
|
54
|
-
|
|
55
|
-
```markdown
|
|
56
|
-
- A helper file MUST use named exports.
|
|
57
|
-
|
|
58
|
-
## Incorrect — Default Export
|
|
59
|
-
|
|
60
|
-
// helper.ts
|
|
61
|
-
export default function sum(a, b) {}
|
|
62
|
-
|
|
63
|
-
Why: a helper file MUST use named exports, so `export default` is not allowed here.
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Why: the explanation repeats the bullet's requirement word, so the requirement now lives in two places and a later edit can leave the bullet and the explanation disagreeing about what is required.
|
|
67
|
-
|
|
68
|
-
## Correct — Requirement Explained in Plain Language
|
|
69
|
-
|
|
70
|
-
```markdown
|
|
71
|
-
- A helper file MUST use named exports.
|
|
72
|
-
|
|
73
|
-
## Incorrect — Default Export
|
|
74
|
-
|
|
75
|
-
// helper.ts
|
|
76
|
-
export default function sum(a, b) {}
|
|
77
|
-
|
|
78
|
-
Why: helper files use named exports only, so `export default` does not belong here.
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Why: the bullet is the only place the requirement is stated, and the explanation describes the example in plain language.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Template Usage Rule
|
|
2
|
-
|
|
3
|
-
Authoring without a template makes every doc invent its own title, orientation, and section shape. This rule keeps new docs predictable. Templates for each document kind live in `../_templates/`.
|
|
4
|
-
|
|
5
|
-
- Authors MUST start from the template that matches the chosen document kind and structure.
|
|
6
|
-
- Authors MUST replace each bracketed prompt with the final title, explanation, step, or lookup content it asks for.
|
|
7
|
-
- Authors MUST delete template branches that do not apply to the document being written.
|
|
8
|
-
- Documentation support assets MAY live in folders whose names start with an underscore.
|
|
9
|
-
|
|
10
|
-
## Incorrect — Template Prompts and Unused Branches Kept
|
|
11
|
-
|
|
12
|
-
```markdown
|
|
13
|
-
# Example Guide
|
|
14
|
-
|
|
15
|
-
[1-2 short sentences explaining the underlying idea behind this guide and why it matters.]
|
|
16
|
-
|
|
17
|
-
## How To Do Something
|
|
18
|
-
|
|
19
|
-
[What does this accomplish? When should it run?]
|
|
20
|
-
|
|
21
|
-
1. [Step 1]
|
|
22
|
-
2. [Step 2]
|
|
23
|
-
|
|
24
|
-
## How To Another Workflow
|
|
25
|
-
|
|
26
|
-
[What does this accomplish? When should it run?]
|
|
27
|
-
|
|
28
|
-
1. [Step 1]
|
|
29
|
-
2. [Step 2]
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Why: committed doc still contains bracketed prompts, and the unused "Another Workflow" section was not deleted.
|
|
33
|
-
|
|
34
|
-
## Correct — Template Prompts Replaced and Unused Branches Removed
|
|
35
|
-
|
|
36
|
-
```markdown
|
|
37
|
-
# Example Guide
|
|
38
|
-
|
|
39
|
-
This guide shows how to do something useful. It matters because doing it wrong breaks the build.
|
|
40
|
-
|
|
41
|
-
## How To Do Something
|
|
42
|
-
|
|
43
|
-
Run this before every release.
|
|
44
|
-
|
|
45
|
-
1. Check the config.
|
|
46
|
-
2. Run the deploy script.
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Why: all bracketed prompts are replaced, unused template branches are deleted, and no leftover brackets remain.
|
package/docs/shadcn-theme.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# shadcn Theme
|
|
2
|
-
|
|
3
|
-
Use this profile when a project uses shadcn UI tokens as its theme baseline.
|
|
4
|
-
|
|
5
|
-
## File structure
|
|
6
|
-
|
|
7
|
-
Read the theme file by section:
|
|
8
|
-
|
|
9
|
-
1. `@theme inline` exposes CSS variables to Tailwind utilities.
|
|
10
|
-
2. `:root` defines light-mode token values.
|
|
11
|
-
3. `.dark` defines dark-mode token values.
|
|
12
|
-
4. `@layer base` applies default page, border, and outline styling.
|
|
13
|
-
|
|
14
|
-
Component authors write utilities such as `bg-primary`, `text-primary-foreground`, and `rounded-lg`. Tailwind resolves those utilities through the tokens registered in `@theme inline`. Do not write generated CSS by hand.
|
|
15
|
-
|
|
16
|
-
## Registered Tailwind tokens
|
|
17
|
-
|
|
18
|
-
`@theme inline` maps project CSS variables to Tailwind token names. The categories below mirror the groups in a standard shadcn `globals.css`.
|
|
19
|
-
|
|
20
|
-
| Category | CSS variables | Utility examples |
|
|
21
|
-
|---|---|---|
|
|
22
|
-
| Page defaults | `--color-background`, `--color-foreground` | `bg-background`, `text-foreground` |
|
|
23
|
-
| Content surfaces | `--color-card`, `--color-card-foreground`, `--color-popover`, `--color-popover-foreground` | `bg-card text-card-foreground`, `bg-popover text-popover-foreground` |
|
|
24
|
-
| Action and state surfaces | `--color-primary`, `--color-primary-foreground`, `--color-secondary`, `--color-secondary-foreground`, `--color-muted`, `--color-muted-foreground`, `--color-accent`, `--color-accent-foreground`, `--color-destructive` | `bg-primary text-primary-foreground`, `bg-muted text-muted-foreground`, `bg-destructive text-white` |
|
|
25
|
-
| Borders, form fields, focus | `--color-border`, `--color-input`, `--color-ring` | `border`, `border-input`, `ring-ring`, `outline-ring/50` |
|
|
26
|
-
| Charts | `--color-chart-1` through `--color-chart-5` | `bg-chart-1`, `text-chart-2` |
|
|
27
|
-
| Sidebar | `--color-sidebar`, `--color-sidebar-foreground`, `--color-sidebar-primary`, `--color-sidebar-primary-foreground`, `--color-sidebar-accent`, `--color-sidebar-accent-foreground`, `--color-sidebar-border`, `--color-sidebar-ring` | `bg-sidebar`, `text-sidebar-foreground`, `border-sidebar-border` |
|
|
28
|
-
| Radius | `--radius-sm`, `--radius-md`, `--radius-lg`, `--radius-xl`, `--radius-2xl`, `--radius-3xl`, `--radius-4xl` | `rounded-sm`, `rounded-md`, `rounded-lg`, `rounded-xl`, `rounded-2xl`, `rounded-3xl`, `rounded-4xl` |
|
|
29
|
-
|
|
30
|
-
## Value tokens
|
|
31
|
-
|
|
32
|
-
`:root` and `.dark` define the actual values for the same semantic tokens. The token names stay stable; only the values change between theme modes.
|
|
33
|
-
|
|
34
|
-
### Page defaults
|
|
35
|
-
|
|
36
|
-
| Token | Use |
|
|
37
|
-
|---|---|
|
|
38
|
-
| `background` | App/page background |
|
|
39
|
-
| `foreground` | Default app text |
|
|
40
|
-
|
|
41
|
-
Use together as `bg-background text-foreground`.
|
|
42
|
-
|
|
43
|
-
### Content surfaces
|
|
44
|
-
|
|
45
|
-
| Token pair | Use |
|
|
46
|
-
|---|---|
|
|
47
|
-
| `card` / `card-foreground` | Card or elevated surface content |
|
|
48
|
-
| `popover` / `popover-foreground` | Floating surfaces like menus, tooltips, dialogs |
|
|
49
|
-
|
|
50
|
-
Use as `bg-card text-card-foreground` and `bg-popover text-popover-foreground`.
|
|
51
|
-
|
|
52
|
-
### Action and state surfaces
|
|
53
|
-
|
|
54
|
-
| Token pair | Use |
|
|
55
|
-
|---|---|
|
|
56
|
-
| `primary` / `primary-foreground` | Main action or selected/high-emphasis filled state |
|
|
57
|
-
| `secondary` / `secondary-foreground` | Supporting action or lower-emphasis filled state |
|
|
58
|
-
| `muted` / `muted-foreground` | Subtle surface and de-emphasized content |
|
|
59
|
-
| `accent` / `accent-foreground` | Transient hover, active, or current-row surface |
|
|
60
|
-
| `destructive` | Destructive action or error surface |
|
|
61
|
-
|
|
62
|
-
Fresh shadcn components use fixed white foreground on destructive filled surfaces:
|
|
63
|
-
|
|
64
|
-
```tsx
|
|
65
|
-
<Button className="bg-destructive text-white" />
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Borders, form fields, and focus
|
|
69
|
-
|
|
70
|
-
| Token | shadcn use | Utility examples |
|
|
71
|
-
|---|---|---|
|
|
72
|
-
| `border` | Default borders and separators | `border`, `border-b` |
|
|
73
|
-
| `input` | Form-control border color and input-like surface treatment | `border-input`, `dark:bg-input/30`, `dark:border-input`, `dark:hover:bg-input/50` |
|
|
74
|
-
| `ring` | Focus border, ring, and outline color | `focus-visible:border-ring`, `focus-visible:ring-ring/50`, `focus-visible:outline-ring`, `outline-ring/50` |
|
|
75
|
-
|
|
76
|
-
The base layer already applies `border-border` and `outline-ring/50`; component code usually needs only the structural border utility (`border`, `border-b`, etc.) unless it is using another border role or overriding a competing border-color class.
|
|
77
|
-
|
|
78
|
-
### Charts
|
|
79
|
-
|
|
80
|
-
`chart-1` through `chart-5` are palette slots for charts and data visualizations. They are not app surface tokens and do not imply foreground pairs.
|
|
81
|
-
|
|
82
|
-
### Sidebar
|
|
83
|
-
|
|
84
|
-
Sidebar tokens are scoped versions of the same shadcn roles for sidebar UI:
|
|
85
|
-
|
|
86
|
-
- `sidebar` / `sidebar-foreground`
|
|
87
|
-
- `sidebar-primary` / `sidebar-primary-foreground`
|
|
88
|
-
- `sidebar-accent` / `sidebar-accent-foreground`
|
|
89
|
-
- `sidebar-border`
|
|
90
|
-
- `sidebar-ring`
|
|
91
|
-
|
|
92
|
-
### Radius
|
|
93
|
-
|
|
94
|
-
`radius` is the base radius value. `@theme inline` derives Tailwind radius utilities from it.
|
|
95
|
-
|
|
96
|
-
## Base layer
|
|
97
|
-
|
|
98
|
-
shadcn applies default app chrome in `@layer base`:
|
|
99
|
-
|
|
100
|
-
```css
|
|
101
|
-
@layer base {
|
|
102
|
-
* {
|
|
103
|
-
@apply border-border outline-ring/50;
|
|
104
|
-
}
|
|
105
|
-
body {
|
|
106
|
-
@apply bg-background text-foreground;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
The base layer applies `border-border` and `outline-ring/50` globally. Plain `border`, `border-b`, etc. inherit the default border color when no competing border-color class is present. Add an explicit border color for another role, such as `border-input`, `border-primary`, `border-destructive`, or `focus-visible:border-ring`, or when overriding a component variant such as `border-transparent`.
|
|
112
|
-
|
|
113
|
-
## Adding tokens
|
|
114
|
-
|
|
115
|
-
Treat fresh shadcn tokens as the baseline. Add project-specific tokens only when the project explicitly adopts an extension beyond shadcn defaults, and document that extension outside this baseline profile.
|
|
116
|
-
|
|
117
|
-
## Update trigger
|
|
118
|
-
|
|
119
|
-
Re-check this document when the [shadcn changelog](https://ui.shadcn.com/docs/changelog) changes the theme token contract, default theme CSS, or generated component styling conventions.
|
|
120
|
-
|
|
121
|
-
When re-checking, verify the affected claims against current shadcn docs and generated registry components before editing this document.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Arbitrary Value Rule
|
|
2
|
-
|
|
3
|
-
Literal arbitrary-value classes hide values used for the project's styling in component code. This rule requires every such value to have a named utility or token.
|
|
4
|
-
|
|
5
|
-
- Components MUST NOT use arbitrary-value classes for project styling. They MUST use an existing Tailwind or project utility, or define a project token or custom utility first.
|
|
6
|
-
|
|
7
|
-
## Incorrect — Literal Arbitrary Radius
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
<button className="rounded-[13px]">Save</button>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Why: the design value is hidden in markup and cannot be tracked as part of the project's explicit token set.
|
|
14
|
-
|
|
15
|
-
## Correct — Named Radius Token
|
|
16
|
-
|
|
17
|
-
```css
|
|
18
|
-
:root {
|
|
19
|
-
--radius-md: 0.375rem;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@theme inline {
|
|
23
|
-
--radius-md: var(--radius-md);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
<button className="rounded-md">Save</button>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Why: the named value makes the radius searchable and exposes the matching Tailwind radius utility.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Class Composition Rule
|
|
2
|
-
|
|
3
|
-
`cn` is the project's helper for combining conditional classes and resolving conflicting Tailwind utilities. It gives conditional classes and a passed `className` one predictable merge point.
|
|
4
|
-
|
|
5
|
-
- Components MUST use `cn` or the project's equivalent class-merging helper for conditional classes and a `className` passed to the component.
|
|
6
|
-
- Components MUST NOT concatenate class strings with template literals or `+` when any part is conditional.
|
|
7
|
-
- A `className` passed to a component MUST contain only outer-layout utilities: margins, sizing, flex or grid item placement, and `z-index`.
|
|
8
|
-
- A component MUST expose its supported appearance and size variants through typed props, not through a passed `className` or separate class-name props for internal elements.
|
|
9
|
-
- A static class list with more than five class names MUST use `cn` with multiple string literals, each grouped by styling concern and containing no more than five class names.
|
|
10
|
-
|
|
11
|
-
## Incorrect — Conditional Classes Concatenated Manually
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
<button className={"rounded px-3 " + (active ? "bg-primary" : "bg-muted")} />
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Why: the condition and merge order are embedded in a string expression, which becomes difficult to extend with consumer overrides.
|
|
18
|
-
|
|
19
|
-
## Correct — Conditional Classes Merged with `cn`
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
export function Card({ className, ...props }: CardProps): React.JSX.Element {
|
|
23
|
-
return <article className={cn("card-surface rounded-lg p-4", className)} {...props} />;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
<Card className="w-full max-w-lg self-center" />;
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Why: every class source is explicit, and a consumer can add outer layout such as `w-full max-w-lg self-center` without reconstructing the card's internal treatment.
|
|
30
|
-
|
|
31
|
-
## Incorrect — Long Static Class Literal
|
|
32
|
-
|
|
33
|
-
```tsx
|
|
34
|
-
<article className="rounded-lg border border-border bg-card px-6 py-4 shadow-sm transition-shadow hover:shadow-md" />
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Why: one static literal contains more than five class names, so its styling concerns are difficult to scan.
|
|
38
|
-
|
|
39
|
-
## Correct — Static Classes Grouped in `cn`
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
<article
|
|
43
|
-
className={cn(
|
|
44
|
-
"rounded-lg border border-border",
|
|
45
|
-
"bg-card shadow-sm",
|
|
46
|
-
"px-6 py-4",
|
|
47
|
-
"transition-shadow hover:shadow-md",
|
|
48
|
-
)}
|
|
49
|
-
/>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Why: each literal contains at most five class names and groups one styling concern.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Component UI State Rule
|
|
2
|
-
|
|
3
|
-
Visual state communicates whether a component can be used and what will happen when it is used. This rule keeps that feedback owned by the component rather than reconstructed by every caller.
|
|
4
|
-
|
|
5
|
-
- A component MUST own a distinguishable appearance for every UI state it supports.
|
|
6
|
-
- A component MUST use Tailwind "state variants" when they can express a supported UI state.
|
|
7
|
-
- Components MUST use native semantic elements and attributes and MUST NOT use custom equivalents.
|
|
8
|
-
|
|
9
|
-
## Incorrect — State Styled Only with Classes
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
<Button className={isSaving ? "pointer-events-none opacity-50" : ""}>Save</Button>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Why: every caller has to reconstruct the saving or disabled treatment, and the button does not receive a semantic disabled state.
|
|
16
|
-
|
|
17
|
-
## Correct — State Exposed Through Component Props
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import { cn } from "@/utils/cn";
|
|
21
|
-
|
|
22
|
-
type ButtonProps = {
|
|
23
|
-
children: React.ReactNode;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
loading?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export function Button({ children, disabled = false, loading = false }: ButtonProps): React.JSX.Element {
|
|
29
|
-
const isUnavailable = disabled || loading;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<button
|
|
33
|
-
aria-busy={loading}
|
|
34
|
-
className={cn(
|
|
35
|
-
"rounded px-3",
|
|
36
|
-
"hover:opacity-90 focus-visible:outline-2",
|
|
37
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
38
|
-
"aria-busy:animate-pulse",
|
|
39
|
-
)}
|
|
40
|
-
disabled={isUnavailable}
|
|
41
|
-
type="button"
|
|
42
|
-
>
|
|
43
|
-
{loading ? "Saving…" : children}
|
|
44
|
-
</button>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
<Button loading={isSaving}>
|
|
49
|
-
Save
|
|
50
|
-
</Button>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Why: `Button` uses native disabled and ARIA busy attributes with Tailwind state variants, while callers express only loading through its typed API.
|