@decantr/cli 1.0.0-beta.8 → 1.1.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/dist/chunk-K6MIDPQH.js +205 -0
- package/dist/chunk-PDX44BCA.js +11 -0
- package/dist/heal-2OPN63OT.js +63 -0
- package/dist/index.js +1454 -370
- package/dist/upgrade-KRFCKUMR.js +68 -0
- package/package.json +8 -7
- package/src/bundled/blueprints/default.json +24 -0
- package/src/bundled/patterns/content-section.json +27 -0
- package/src/bundled/patterns/footer.json +27 -0
- package/src/bundled/patterns/form-basic.json +27 -0
- package/src/bundled/patterns/hero.json +28 -0
- package/src/bundled/patterns/nav-header.json +28 -0
- package/src/bundled/shells/default.json +20 -0
- package/src/bundled/themes/default.json +48 -0
- package/src/templates/DECANTR.md.template +145 -6
- package/src/templates/task-add-page.md.template +3 -3
- package/src/templates/task-modify.md.template +2 -2
- package/src/templates/task-scaffold.md.template +2 -2
- package/LICENSE +0 -21
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
RegistryClient
|
|
4
|
+
} from "./chunk-K6MIDPQH.js";
|
|
5
|
+
import "./chunk-PDX44BCA.js";
|
|
6
|
+
|
|
7
|
+
// src/commands/upgrade.ts
|
|
8
|
+
import { readFileSync, existsSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
var GREEN = "\x1B[32m";
|
|
11
|
+
var YELLOW = "\x1B[33m";
|
|
12
|
+
var RESET = "\x1B[0m";
|
|
13
|
+
var DIM = "\x1B[2m";
|
|
14
|
+
async function cmdUpgrade(projectRoot = process.cwd()) {
|
|
15
|
+
const essencePath = join(projectRoot, "decantr.essence.json");
|
|
16
|
+
if (!existsSync(essencePath)) {
|
|
17
|
+
console.error("No decantr.essence.json found. Run `decantr init` first.");
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const essence = JSON.parse(readFileSync(essencePath, "utf-8"));
|
|
22
|
+
const client = new RegistryClient({
|
|
23
|
+
cacheDir: join(projectRoot, ".decantr", "cache")
|
|
24
|
+
});
|
|
25
|
+
console.log("Checking for updates...\n");
|
|
26
|
+
const upgrades = [];
|
|
27
|
+
if (essence.theme?.style) {
|
|
28
|
+
const theme = await client.fetchTheme(essence.theme.style);
|
|
29
|
+
if (theme && theme.data.version) {
|
|
30
|
+
const current = essence.theme.version || "0.0.0";
|
|
31
|
+
if (theme.data.version !== current) {
|
|
32
|
+
upgrades.push({
|
|
33
|
+
type: "theme",
|
|
34
|
+
id: essence.theme.style,
|
|
35
|
+
currentVersion: current,
|
|
36
|
+
latestVersion: theme.data.version
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (essence.blueprint) {
|
|
42
|
+
const blueprint = await client.fetchBlueprint(essence.blueprint);
|
|
43
|
+
if (blueprint && blueprint.data.version) {
|
|
44
|
+
const current = essence.blueprintVersion || "0.0.0";
|
|
45
|
+
if (blueprint.data.version !== current) {
|
|
46
|
+
upgrades.push({
|
|
47
|
+
type: "blueprint",
|
|
48
|
+
id: essence.blueprint,
|
|
49
|
+
currentVersion: current,
|
|
50
|
+
latestVersion: blueprint.data.version
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (upgrades.length === 0) {
|
|
56
|
+
console.log(`${GREEN}Everything is up to date.${RESET}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
console.log("Available upgrades:\n");
|
|
60
|
+
for (const u of upgrades) {
|
|
61
|
+
console.log(` ${u.type}/${u.id}: ${DIM}${u.currentVersion}${RESET} -> ${GREEN}${u.latestVersion}${RESET}`);
|
|
62
|
+
}
|
|
63
|
+
console.log(`
|
|
64
|
+
${YELLOW}Run with --apply to apply upgrades.${RESET}`);
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
cmdUpgrade
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decantr/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Decantr CLI — search the registry, validate essence files, and access design intelligence from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,18 +16,19 @@
|
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
19
|
-
"src/templates"
|
|
19
|
+
"src/templates",
|
|
20
|
+
"src/bundled"
|
|
20
21
|
],
|
|
21
22
|
"publishConfig": {
|
|
22
23
|
"access": "public"
|
|
23
24
|
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@decantr/essence-spec": "1.0.0-beta.3",
|
|
26
|
-
"@decantr/registry": "1.0.0-beta.3"
|
|
27
|
-
},
|
|
28
25
|
"scripts": {
|
|
29
26
|
"build": "tsup",
|
|
30
27
|
"test": "vitest run",
|
|
31
28
|
"test:watch": "vitest"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@decantr/essence-spec": "workspace:*",
|
|
32
|
+
"@decantr/registry": "workspace:*"
|
|
32
33
|
}
|
|
33
|
-
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "default",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/blueprint.v1.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Decantr Default",
|
|
7
|
+
"description": "Minimal starter blueprint for offline scaffolding. Visit decantr.ai/registry for more options.",
|
|
8
|
+
"tags": ["starter", "minimal", "offline"],
|
|
9
|
+
"compose": ["starter"],
|
|
10
|
+
"theme": {
|
|
11
|
+
"style": "default",
|
|
12
|
+
"mode": "system",
|
|
13
|
+
"recipe": null,
|
|
14
|
+
"shape": "rounded"
|
|
15
|
+
},
|
|
16
|
+
"personality": ["clean", "minimal"],
|
|
17
|
+
"features": [],
|
|
18
|
+
"routes": {
|
|
19
|
+
"/": {
|
|
20
|
+
"shell": "default",
|
|
21
|
+
"page": "home"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "content-section",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/pattern.v2.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Content Section",
|
|
7
|
+
"description": "Generic content section with heading and body.",
|
|
8
|
+
"components": [],
|
|
9
|
+
"default_preset": "standard",
|
|
10
|
+
"presets": {
|
|
11
|
+
"standard": {
|
|
12
|
+
"description": "Centered content with max-width",
|
|
13
|
+
"layout": {
|
|
14
|
+
"layout": "stack",
|
|
15
|
+
"atoms": "_flex _col _gap4 _py8 _px6 _mxauto _maxw[800px]"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"default_layout": {
|
|
20
|
+
"layout": "stack",
|
|
21
|
+
"atoms": "_flex _col _gap4 _py8 _px6 _mxauto _maxw[800px]",
|
|
22
|
+
"slots": {
|
|
23
|
+
"heading": "Section heading",
|
|
24
|
+
"body": "Section content"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "footer",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/pattern.v2.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Footer",
|
|
7
|
+
"description": "Page footer with links and copyright.",
|
|
8
|
+
"components": ["Link"],
|
|
9
|
+
"default_preset": "standard",
|
|
10
|
+
"presets": {
|
|
11
|
+
"standard": {
|
|
12
|
+
"description": "Simple footer with links and copyright",
|
|
13
|
+
"layout": {
|
|
14
|
+
"layout": "row",
|
|
15
|
+
"atoms": "_flex _aic _jcsb _px6 _py4 _borderT _fgmuted"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"default_layout": {
|
|
20
|
+
"layout": "row",
|
|
21
|
+
"atoms": "_flex _aic _jcsb _px6 _py4 _borderT _fgmuted",
|
|
22
|
+
"slots": {
|
|
23
|
+
"links": "Footer links",
|
|
24
|
+
"copyright": "Copyright notice"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "form-basic",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/pattern.v2.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Basic Form",
|
|
7
|
+
"description": "Simple form with inputs and submit button.",
|
|
8
|
+
"components": ["Input", "Button", "Label"],
|
|
9
|
+
"default_preset": "standard",
|
|
10
|
+
"presets": {
|
|
11
|
+
"standard": {
|
|
12
|
+
"description": "Vertical form with stacked fields",
|
|
13
|
+
"layout": {
|
|
14
|
+
"layout": "stack",
|
|
15
|
+
"atoms": "_flex _col _gap4"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"default_layout": {
|
|
20
|
+
"layout": "stack",
|
|
21
|
+
"atoms": "_flex _col _gap4",
|
|
22
|
+
"slots": {
|
|
23
|
+
"fields": "Form input fields",
|
|
24
|
+
"actions": "Submit/cancel buttons"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "hero",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/pattern.v2.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Hero",
|
|
7
|
+
"description": "Landing page hero section with headline, subheadline, and CTA.",
|
|
8
|
+
"components": ["Button"],
|
|
9
|
+
"default_preset": "standard",
|
|
10
|
+
"presets": {
|
|
11
|
+
"standard": {
|
|
12
|
+
"description": "Centered hero with headline and CTA",
|
|
13
|
+
"layout": {
|
|
14
|
+
"layout": "stack",
|
|
15
|
+
"atoms": "_flex _col _aic _tc _py12 _gap6"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"default_layout": {
|
|
20
|
+
"layout": "stack",
|
|
21
|
+
"atoms": "_flex _col _aic _tc _py12 _gap6",
|
|
22
|
+
"slots": {
|
|
23
|
+
"headline": "Main headline text",
|
|
24
|
+
"subheadline": "Supporting description",
|
|
25
|
+
"cta": "Call-to-action button(s)"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "nav-header",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/pattern.v2.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Navigation Header",
|
|
7
|
+
"description": "Top navigation bar with logo, links, and actions.",
|
|
8
|
+
"components": ["Button", "Link"],
|
|
9
|
+
"default_preset": "standard",
|
|
10
|
+
"presets": {
|
|
11
|
+
"standard": {
|
|
12
|
+
"description": "Horizontal nav with logo left, links center, actions right",
|
|
13
|
+
"layout": {
|
|
14
|
+
"layout": "row",
|
|
15
|
+
"atoms": "_flex _aic _jcsb _px6 _py3 _borderB"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"default_layout": {
|
|
20
|
+
"layout": "row",
|
|
21
|
+
"atoms": "_flex _aic _jcsb _px6 _py3 _borderB",
|
|
22
|
+
"slots": {
|
|
23
|
+
"logo": "Brand logo or name",
|
|
24
|
+
"links": "Navigation links",
|
|
25
|
+
"actions": "Action buttons (login, signup)"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "default",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/shell.v1.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": "Default Shell",
|
|
6
|
+
"description": "Simple top-nav + main content layout.",
|
|
7
|
+
"layout": "stack",
|
|
8
|
+
"atoms": "_flex _col _minh[100vh]",
|
|
9
|
+
"config": {
|
|
10
|
+
"regions": ["header", "body"],
|
|
11
|
+
"header": {
|
|
12
|
+
"height": "auto",
|
|
13
|
+
"sticky": true
|
|
14
|
+
},
|
|
15
|
+
"body": {
|
|
16
|
+
"scroll": true,
|
|
17
|
+
"flex": 1
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "default",
|
|
3
|
+
"$schema": "https://decantr.ai/schemas/theme.v1.json",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"decantr_compat": ">=1.0.0",
|
|
6
|
+
"name": "Decantr Default",
|
|
7
|
+
"description": "Neutral theme that works in light and dark modes. Clean and professional.",
|
|
8
|
+
"tags": ["neutral", "light", "dark", "minimal"],
|
|
9
|
+
"personality": "clean + minimal + professional",
|
|
10
|
+
"seed": {
|
|
11
|
+
"primary": "#3B82F6",
|
|
12
|
+
"secondary": "#6B7280",
|
|
13
|
+
"accent": "#8B5CF6",
|
|
14
|
+
"background": "#FFFFFF"
|
|
15
|
+
},
|
|
16
|
+
"palette": {
|
|
17
|
+
"background": {
|
|
18
|
+
"light": "#FFFFFF",
|
|
19
|
+
"dark": "#18181B"
|
|
20
|
+
},
|
|
21
|
+
"surface": {
|
|
22
|
+
"light": "#F9FAFB",
|
|
23
|
+
"dark": "#27272A"
|
|
24
|
+
},
|
|
25
|
+
"surface-raised": {
|
|
26
|
+
"light": "#F3F4F6",
|
|
27
|
+
"dark": "#3F3F46"
|
|
28
|
+
},
|
|
29
|
+
"border": {
|
|
30
|
+
"light": "#E5E7EB",
|
|
31
|
+
"dark": "#52525B"
|
|
32
|
+
},
|
|
33
|
+
"text": {
|
|
34
|
+
"light": "#111827",
|
|
35
|
+
"dark": "#FAFAFA"
|
|
36
|
+
},
|
|
37
|
+
"text-muted": {
|
|
38
|
+
"light": "#6B7280",
|
|
39
|
+
"dark": "#A1A1AA"
|
|
40
|
+
},
|
|
41
|
+
"primary": {
|
|
42
|
+
"light": "#3B82F6",
|
|
43
|
+
"dark": "#60A5FA"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"modes": ["light", "dark", "system"],
|
|
47
|
+
"shapes": ["rounded", "sharp", "pill"]
|
|
48
|
+
}
|
|
@@ -98,6 +98,20 @@ When a user request would violate guard rules:
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Theme Quick Reference
|
|
102
|
+
|
|
103
|
+
{{THEME_QUICK_REFERENCE}}
|
|
104
|
+
|
|
105
|
+
**To fetch complete theme and recipe specs:**
|
|
106
|
+
```bash
|
|
107
|
+
npx @decantr/cli get theme {{THEME_STYLE}}
|
|
108
|
+
npx @decantr/cli get recipe {{THEME_RECIPE}}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
{{ACCESSIBILITY_SECTION}}
|
|
112
|
+
|
|
113
|
+
{{SEO_SECTION}}
|
|
114
|
+
|
|
101
115
|
### Pages
|
|
102
116
|
|
|
103
117
|
{{PAGES_TABLE}}
|
|
@@ -112,16 +126,32 @@ When a user request would violate guard rules:
|
|
|
112
126
|
|
|
113
127
|
**Always check these before generating UI code:**
|
|
114
128
|
|
|
115
|
-
###
|
|
129
|
+
### Quick Commands
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Get full theme spec (colors, palette, modes)
|
|
133
|
+
npx @decantr/cli get theme {{THEME_STYLE}}
|
|
134
|
+
|
|
135
|
+
# Get recipe decorators and effects
|
|
136
|
+
npx @decantr/cli get recipe {{THEME_RECIPE}}
|
|
137
|
+
|
|
138
|
+
# Get pattern structure and presets
|
|
139
|
+
npx @decantr/cli get pattern <pattern-name>
|
|
140
|
+
|
|
141
|
+
# Search for patterns
|
|
142
|
+
npx @decantr/cli search <query>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### With MCP Tools (If Available)
|
|
116
146
|
|
|
117
|
-
|
|
147
|
+
> Note: MCP tools require the `@decantr/mcp-server` to be configured. If these tools are not available, use the CLI commands above.
|
|
118
148
|
|
|
119
149
|
1. `decantr_read_essence` — Load the current essence
|
|
120
150
|
2. `decantr_check_drift` — Verify your planned changes won't violate rules
|
|
121
151
|
3. `decantr_resolve_pattern` — Get pattern details before implementing
|
|
122
152
|
4. `decantr_suggest_patterns` — Find appropriate patterns for new sections
|
|
123
153
|
|
|
124
|
-
### Without MCP Tools
|
|
154
|
+
### Without MCP Tools or CLI
|
|
125
155
|
|
|
126
156
|
1. Read `decantr.essence.json` in the project root
|
|
127
157
|
2. Verify the page you're editing exists in `structure[]`
|
|
@@ -159,7 +189,7 @@ After generating code, verify:
|
|
|
159
189
|
Run validation to check for violations:
|
|
160
190
|
|
|
161
191
|
```bash
|
|
162
|
-
decantr validate
|
|
192
|
+
npx @decantr/cli validate
|
|
163
193
|
```
|
|
164
194
|
|
|
165
195
|
Or use the MCP tool:
|
|
@@ -205,6 +235,115 @@ Use the same component variants throughout a pattern. If buttons are `primary` s
|
|
|
205
235
|
|
|
206
236
|
---
|
|
207
237
|
|
|
238
|
+
## CSS Implementation
|
|
239
|
+
|
|
240
|
+
This project uses **@decantr/css** for layout atoms and the generated CSS files for theme tokens and recipe decorators.
|
|
241
|
+
|
|
242
|
+
### Setup
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
// 1. Import the atoms runtime
|
|
246
|
+
import { css } from '@decantr/css';
|
|
247
|
+
|
|
248
|
+
// 2. Import generated CSS files (created by decantr init)
|
|
249
|
+
import './styles/tokens.css'; // Theme tokens (--d-primary, --d-surface, etc.)
|
|
250
|
+
import './styles/decorators.css'; // Recipe decorators ({{THEME_RECIPE}}-card, etc.)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### HTML Setup
|
|
254
|
+
|
|
255
|
+
Your `index.html` MUST have theme and mode attributes:
|
|
256
|
+
|
|
257
|
+
```html
|
|
258
|
+
<!DOCTYPE html>
|
|
259
|
+
<html lang="en" data-theme="{{THEME_STYLE}}" data-mode="{{THEME_MODE}}">
|
|
260
|
+
<head>
|
|
261
|
+
<meta name="color-scheme" content="{{THEME_MODE}}">
|
|
262
|
+
...
|
|
263
|
+
</head>
|
|
264
|
+
</html>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Why this matters:**
|
|
268
|
+
- `data-theme` enables theme switching via JS without reloading CSS
|
|
269
|
+
- `data-mode` enables light/dark toggle
|
|
270
|
+
- `color-scheme` tells the browser to style native controls (scrollbars, inputs) correctly
|
|
271
|
+
|
|
272
|
+
### Using Atoms
|
|
273
|
+
|
|
274
|
+
The `css()` function processes atom strings and injects CSS at runtime:
|
|
275
|
+
|
|
276
|
+
```jsx
|
|
277
|
+
// Layout atoms
|
|
278
|
+
<div className={css('_flex _col _gap4 _p4')}>
|
|
279
|
+
<h1 className={css('_heading1')}>Title</h1>
|
|
280
|
+
<p className={css('_textsm _fgmuted')}>Description</p>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
// Responsive prefixes (mobile-first)
|
|
284
|
+
<div className={css('_gc1 _sm:gc2 _lg:gc4')}>
|
|
285
|
+
{/* 1 col -> 2 cols at 640px -> 4 cols at 1024px */}
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
// Pseudo-class prefixes
|
|
289
|
+
<button className={css('_bgprimary _h:bgprimary/80')}>
|
|
290
|
+
Hover me
|
|
291
|
+
</button>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Common Atoms
|
|
295
|
+
|
|
296
|
+
| Category | Atoms | Description |
|
|
297
|
+
|----------|-------|-------------|
|
|
298
|
+
| Display | `_flex`, `_grid`, `_block`, `_none` | Display types |
|
|
299
|
+
| Flexbox | `_col`, `_row`, `_wrap`, `_flex1` | Flex direction/behavior |
|
|
300
|
+
| Alignment | `_aic`, `_jcc`, `_jcsb` | Align/justify content |
|
|
301
|
+
| Spacing | `_gap{n}`, `_p{n}`, `_m{n}`, `_px{n}` | Gap, padding, margin |
|
|
302
|
+
| Sizing | `_wfull`, `_hfull`, `_w{n}`, `_h{n}` | Width, height |
|
|
303
|
+
| Typography | `_textsm`, `_textlg`, `_heading1`-`_heading6` | Font sizes |
|
|
304
|
+
| Colors | `_bgprimary`, `_bgsurface`, `_fgmuted` | Background, foreground |
|
|
305
|
+
|
|
306
|
+
### CSS Architecture
|
|
307
|
+
|
|
308
|
+
The CSS is organized into two parts:
|
|
309
|
+
|
|
310
|
+
1. **Atoms (@decantr/css)** - Layout utilities injected at runtime into `@layer d.atoms`
|
|
311
|
+
2. **Generated CSS files** - Theme tokens and recipe decorators created during scaffold
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
src/styles/
|
|
315
|
+
tokens.css # :root { --d-primary: #...; --d-surface: #...; }
|
|
316
|
+
decorators.css # .{{THEME_RECIPE}}-card { ... }
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Variable Naming Convention
|
|
320
|
+
|
|
321
|
+
| Prefix | Purpose | Example |
|
|
322
|
+
|--------|---------|---------|
|
|
323
|
+
| `--d-` | Core Decantr tokens | `--d-primary`, `--d-bg` |
|
|
324
|
+
| `--d-gap-{n}` | Spacing tokens | `--d-gap-4`, `--d-gap-8` |
|
|
325
|
+
| `--d-radius` | Border radius | `--d-radius`, `--d-radius-lg` |
|
|
326
|
+
|
|
327
|
+
### Theme Switching (JavaScript)
|
|
328
|
+
|
|
329
|
+
```javascript
|
|
330
|
+
// Switch theme
|
|
331
|
+
document.documentElement.dataset.theme = 'newTheme';
|
|
332
|
+
|
|
333
|
+
// Switch mode
|
|
334
|
+
document.documentElement.dataset.mode = 'light';
|
|
335
|
+
document.querySelector('meta[name="color-scheme"]').content = 'light';
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Get Full Theme/Recipe Specs
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npx @decantr/cli get theme {{THEME_STYLE}} # See seed colors, palette
|
|
342
|
+
npx @decantr/cli get recipe {{THEME_RECIPE}} # See decorators, effects
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
208
347
|
## Spatial Guidelines
|
|
209
348
|
|
|
210
349
|
### Personality to Density Mapping
|
|
@@ -341,7 +480,7 @@ These files contain tier-specific rules and checklists.
|
|
|
341
480
|
**"I don't know which pattern to use"**
|
|
342
481
|
1. Use `decantr_suggest_patterns` with a description
|
|
343
482
|
2. Or check the patterns in `.decantr/cache/patterns/`
|
|
344
|
-
3. Or search the registry with `decantr search <query>`
|
|
483
|
+
3. Or search the registry with `npx @decantr/cli search <query>`
|
|
345
484
|
|
|
346
485
|
---
|
|
347
486
|
|
|
@@ -366,7 +505,7 @@ When the user wants to change the design spec:
|
|
|
366
505
|
|
|
367
506
|
1. Read the current `decantr.essence.json`
|
|
368
507
|
2. Make the requested changes
|
|
369
|
-
3. Validate with `decantr validate`
|
|
508
|
+
3. Validate with `npx @decantr/cli validate`
|
|
370
509
|
4. Write the updated file
|
|
371
510
|
5. Regenerate `DECANTR.md` if structure changed significantly
|
|
372
511
|
|
|
@@ -40,7 +40,7 @@ Before generating code for a new page, add it to the essence:
|
|
|
40
40
|
Run validation to ensure the essence is valid:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
decantr validate
|
|
43
|
+
npx @decantr/cli validate
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### 3. Then Generate
|
|
@@ -54,7 +54,7 @@ Before adding a page:
|
|
|
54
54
|
- [ ] The page ID is added to `structure[]` in essence
|
|
55
55
|
- [ ] The page has a `shell` defined
|
|
56
56
|
- [ ] The page has a `layout[]` with pattern IDs
|
|
57
|
-
- [ ] Validation passes (`decantr validate`)
|
|
57
|
+
- [ ] Validation passes (`npx @decantr/cli validate`)
|
|
58
58
|
|
|
59
59
|
During code generation:
|
|
60
60
|
|
|
@@ -65,7 +65,7 @@ During code generation:
|
|
|
65
65
|
|
|
66
66
|
After generation:
|
|
67
67
|
|
|
68
|
-
- [ ] Run `decantr validate`
|
|
68
|
+
- [ ] Run `npx @decantr/cli validate`
|
|
69
69
|
- [ ] Verify the page matches the theme
|
|
70
70
|
- [ ] Check that the recipe styles are applied
|
|
71
71
|
|
|
@@ -102,8 +102,8 @@ During modification:
|
|
|
102
102
|
|
|
103
103
|
After modification:
|
|
104
104
|
|
|
105
|
-
- [ ] Run `decantr validate`
|
|
106
|
-
- [ ] Run `decantr audit` to check drift
|
|
105
|
+
- [ ] Run `npx @decantr/cli validate`
|
|
106
|
+
- [ ] Run `npx @decantr/cli audit` to check drift
|
|
107
107
|
- [ ] Verify no warnings or errors
|
|
108
108
|
|
|
109
109
|
## Spacing Enforcement
|
|
@@ -41,7 +41,7 @@ During scaffolding:
|
|
|
41
41
|
|
|
42
42
|
After scaffolding:
|
|
43
43
|
|
|
44
|
-
- [ ] Run `decantr validate` to check the essence
|
|
44
|
+
- [ ] Run `npx @decantr/cli validate` to check the essence
|
|
45
45
|
- [ ] Verify each page renders correctly
|
|
46
46
|
- [ ] Check theme consistency across pages
|
|
47
47
|
|
|
@@ -56,7 +56,7 @@ After scaffolding is complete:
|
|
|
56
56
|
1. Run the development server
|
|
57
57
|
2. Verify all pages load
|
|
58
58
|
3. Check theme consistency
|
|
59
|
-
4. Run `decantr validate`
|
|
59
|
+
4. Run `npx @decantr/cli validate`
|
|
60
60
|
|
|
61
61
|
Once verified, subsequent changes will use **{{GUARD_MODE}}** enforcement mode.
|
|
62
62
|
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Decantr AI
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|