create-claude-workspace 1.1.32 → 1.1.33

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.
@@ -40,7 +40,7 @@ If the file does not exist, detect the framework from `package.json` dependencie
40
40
 
41
41
  - **Frontend frameworks**: Angular, React, Vue, Svelte — apply whichever the project uses
42
42
  - **TypeScript**: Advanced typing, strict mode, no `any`
43
- - **Styling**: SCSS/CSS with theme systems, design tokens, responsive design
43
+ - **Styling**: @themecraft/core for theming (SCSS engine, CLI, runtime ThemeManager), design tokens, responsive design
44
44
  - **Monorepo patterns**: Library architecture, dependency boundaries
45
45
  - **Component architecture**: Smart/dumb separation, composite pattern, content projection/slots
46
46
  - **Performance**: Lazy loading, code splitting, deferred rendering, no unnecessary re-renders
@@ -101,7 +101,7 @@ Write clean, elegant code that is easy to test and reason about:
101
101
  - If Figma MCP is available and design exists: implement from Figma with 1:1 fidelity
102
102
  - If UX.md exists: follow its design tokens, typography, colors, breakpoints
103
103
  - If neither: use `/frontend-design` skill for high-quality UI generation
104
- - Always use theme system — no hardcoded color/size values
104
+ - Always use @themecraft theme system (`color-var()`, `size-var()`, `typography-level-var()`) — no hardcoded color/size values
105
105
 
106
106
  ## Output Format
107
107
 
@@ -139,23 +139,94 @@ After generation, the architect's plan specifies what code to write IN the gener
139
139
  - `$localize` in TS, `i18n` attribute in templates
140
140
  - Keep translation keys stable
141
141
 
142
- ## Theme System
143
-
144
- Pattern layers:
145
- 1. Token definitions (`variables/_colors.scss`) — raw SCSS maps
146
- 2. Core functions (`_theming.scss`) — `define-light-theme()`, `color-var()`, `size-var()`, `size()`
147
- 3. Theme infrastructure (`_themes.scss`) — `variables()` emits CSS custom properties, breakpoint mixins
148
- 4. Consumer SCSS (`_colors.scss`) — `$background-body: theming.color-var(variables.$background-body)`
149
- 5. Theme definitions (`themes/light.scss`, `dark.scss`) call `define-light-theme()` with maps
150
- 6. Angular service (`theme.ts`) — `provideTheme()` for no-flash, `provideThemeServer()` for SSR
151
-
152
- SCSS package.json exports:
153
- { "./themes", "./theming", "./colors", "./typography", "./sizes", "./breakpoints" }
154
-
155
- Component SCSS usage:
156
- @use '@[PREFIX]/theme/colors';
157
- @use '@[PREFIX]/theme/sizes';
158
- @use '@[PREFIX]/theme/typography';
142
+ ## Theme System — @themecraft
143
+
144
+ Use `@themecraft/core` (SCSS engine + CLI + runtime) and `@themecraft/angular` (Angular adapter) for all theming.
145
+
146
+ **Install:**
147
+ ```bash
148
+ npm install @themecraft/core @themecraft/angular
149
+ npx themecraft init # generates themecraft.config.json + tokens.json
150
+ npx themecraft generate # generates type-safe SCSS from tokens.json
151
+ ```
152
+
153
+ **Pipeline:**
154
+ 1. `tokens.json` — define token names (colors, sizes, typography, breakpoints) with JSON schema validation
155
+ 2. `npx themecraft generate` — produces type-safe SCSS variables with IDE autocomplete
156
+ 3. Theme files (`themes/light.scss`, `dark.scss`) — use `define-light-theme()` / `define-dark-theme()` with token value maps
157
+ 4. `@themecraft/core/themes` → `variables()` mixin emits CSS custom properties at `:root`
158
+ 5. `@themecraft/angular` → `provideTheme()` for runtime switching, `provideThemeServer()` for SSR (no FOUC)
159
+
160
+ **SCSS imports** (in component `.scss` files):
161
+ ```scss
162
+ @use '@themecraft/core/theming' as theming;
163
+
164
+ .card {
165
+ background: theming.color-var('surface');
166
+ color: theming.color-var('on-surface');
167
+ padding: theming.size-var('card-padding');
168
+ @include theming.typography-level-var('body-primary');
169
+ @include theming.theme-transition(); // smooth theme switch
170
+ }
171
+ ```
172
+
173
+ **Token accessors** (always use these, NEVER hardcode colors/sizes):
174
+ - `theming.color-var($name)` → `var(--color-#{$name})`
175
+ - `theming.size-var($name)` → `var(--size-#{$name})`
176
+ - `theming.breakpoints-var($name)` → `var(--breakpoint-#{$name})`
177
+ - `@include theming.typography-level-var($level)` → all typography properties
178
+ - `theming.size($small, $medium, $large)` → responsive size map (auto breakpoint media queries)
179
+
180
+ **Theme definition** (`themes/light.scss`):
181
+ ```scss
182
+ @use '@themecraft/core/theming' as theming;
183
+ @use '@themecraft/core/themes' as themes;
184
+
185
+ themes.$themes: (
186
+ light: theming.define-light-theme((
187
+ color: theming.define-color-scheme(( surface: #ffffff, on-surface: #1a1a1a, primary: #0066cc )),
188
+ size: theming.define-sizes(( card-padding: theming.size(12px, 16px, 24px) )),
189
+ typography: ( body-primary: theming.define-typography-level(16px, 1.5, 400, 'Inter, sans-serif') ),
190
+ breakpoint: ( medium: 768px, large: 1200px ),
191
+ ))
192
+ );
193
+
194
+ @include themes.variables();
195
+ ```
196
+
197
+ **Angular app config** (`app.config.ts`):
198
+ ```typescript
199
+ import { provideTheme } from '@themecraft/angular';
200
+
201
+ export const appConfig = {
202
+ providers: [
203
+ provideTheme({
204
+ themes: ['light', 'dark'],
205
+ defaultTheme: 'light',
206
+ basePath: '/themes/',
207
+ storage: 'localStorage',
208
+ preferSystemTheme: { light: 'light', dark: 'dark' },
209
+ transition: { duration: '200ms' },
210
+ }),
211
+ ],
212
+ };
213
+ ```
214
+
215
+ **SSR** (`app.config.server.ts`):
216
+ ```typescript
217
+ import { provideThemeServer } from '@themecraft/angular';
218
+ // mergeApplicationConfig with: provideThemeServer((req) => req.cookies['theme'])
219
+ ```
220
+
221
+ **Theme switching** (inject `ThemeLoader`):
222
+ ```typescript
223
+ readonly #theme = inject(ThemeLoader);
224
+ switchTheme(name: string) { this.#theme.load(name); }
225
+ ```
226
+
227
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations from compiled CSS.
228
+
229
+ **Figma sync** (optional): `npx themecraft figma-sync` pulls design variables from Figma API into `tokens.json`.
159
230
 
160
231
  ## Atomic UI Component Library
161
232
 
@@ -149,25 +149,74 @@ src/
149
149
  - Keep translation keys stable and descriptive
150
150
  - Co-locate translations near features when possible
151
151
 
152
- ## Theme System
152
+ ## Theme System — @themecraft
153
153
 
154
- Pattern layers:
155
- 1. Token definitions (`tokens/colors.ts` or `variables/colors.css`) — design tokens as CSS custom properties
156
- 2. Core utilities (`theme.ts`) — `createTheme()`, token accessors, media query helpers
157
- 3. Theme infrastructure (`globals.css` or `theme-provider.tsx`) — emits CSS custom properties on `:root`
158
- 4. Consumer styles — reference tokens via `var(--color-primary)`, `var(--size-md)`
159
- 5. Theme definitions (`themes/light.css`, `dark.css`) set token values per theme
160
- 6. React provider (`ThemeProvider`) — handles theme toggle, persistence, SSR no-flash (inline script or cookie)
154
+ Use `@themecraft/core` for all theming (SCSS engine + CLI + runtime ThemeManager).
155
+
156
+ **Install:**
157
+ ```bash
158
+ npm install @themecraft/core
159
+ npx themecraft init # generates themecraft.config.json + tokens.json
160
+ npx themecraft generate # generates type-safe SCSS from tokens.json
161
+ ```
162
+
163
+ **Pipeline:**
164
+ 1. `tokens.json` — define token names (colors, sizes, typography, breakpoints) with JSON schema validation
165
+ 2. `npx themecraft generate` — produces type-safe SCSS variables with IDE autocomplete
166
+ 3. Theme files (`themes/light.scss`, `dark.scss`) — use `define-light-theme()` / `define-dark-theme()`
167
+ 4. `@themecraft/core/themes` → `variables()` mixin emits CSS custom properties at `:root`
168
+ 5. `ThemeManager` (from `@themecraft/core/runtime`) — runtime theme switching, storage persistence, FOUC prevention
169
+
170
+ **SCSS imports** (in component `.module.scss` or global styles):
171
+ ```scss
172
+ @use '@themecraft/core/theming' as theming;
173
+
174
+ .card {
175
+ background: theming.color-var('surface');
176
+ color: theming.color-var('on-surface');
177
+ padding: theming.size-var('card-padding');
178
+ @include theming.typography-level-var('body-primary');
179
+ @include theming.theme-transition();
180
+ }
181
+ ```
182
+
183
+ **Token accessors** (always use these, NEVER hardcode colors/sizes):
184
+ - `theming.color-var($name)` → `var(--color-#{$name})`
185
+ - `theming.size-var($name)` → `var(--size-#{$name})`
186
+ - `@include theming.typography-level-var($level)` → all typography properties
187
+ - `theming.size($small, $medium, $large)` → responsive size map
188
+
189
+ **Runtime setup** (in layout or `_app.tsx`):
190
+ ```typescript
191
+ import { ThemeManager } from '@themecraft/core/runtime';
192
+
193
+ const themeManager = new ThemeManager({
194
+ themes: ['light', 'dark'],
195
+ defaultTheme: 'light',
196
+ basePath: '/themes/',
197
+ storage: 'localStorage',
198
+ preferSystemTheme: { light: 'light', dark: 'dark' },
199
+ transition: { duration: '200ms' },
200
+ }, document);
201
+
202
+ // SSR FOUC prevention — add inline script to <head>:
203
+ // themeManager.getInlineScript()
204
+ // SSR link tag: ThemeManager.buildSSRLinkTag(config)
205
+ ```
161
206
 
162
207
  **Styling approach** (pick one per project, set in CLAUDE.md):
163
- - **CSS Modules** (`.module.css`) — scoped by default, zero runtime cost, works with SSR
164
- - **Tailwind CSS** — utility-first, configure via `tailwind.config.ts` with design tokens
165
- - No CSS-in-JS with runtime overhead (styled-components, emotion) unless explicitly chosen
208
+ - **CSS Modules** (`.module.scss`) — scoped by default, zero runtime cost, works with SSR
209
+ - **Tailwind CSS** — utility-first, configure with design tokens from @themecraft
210
+ - No CSS-in-JS with runtime overhead unless explicitly chosen
211
+
212
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
213
+
214
+ **Figma sync** (optional): `npx themecraft figma-sync` pulls design variables from Figma API into `tokens.json`.
166
215
 
167
216
  Component style usage:
168
217
  ```tsx
169
- import styles from './user-card.module.css';
170
- // or with Tailwind: className="flex items-center gap-2 text-primary"
218
+ import styles from './user-card.module.scss';
219
+ // tokens available via CSS custom properties in SCSS
171
220
  ```
172
221
 
173
222
  ## Atomic UI Component Library
@@ -150,30 +150,69 @@ SvelteKit file-based routing:
150
150
  - Alternative: `svelte-i18n` — runtime-based, ICU message format
151
151
  - Keep translation keys stable, co-locate message files with features when possible
152
152
 
153
- ## Theme System
153
+ ## Theme System — @themecraft
154
154
 
155
- Pattern layers:
156
- 1. Token definitions (`app.css` or `tokens/`) — CSS custom properties at `:root`
157
- 2. Semantic tokens — map raw tokens to semantic names (`--color-surface`, `--color-on-surface`)
158
- 3. Theme variants (`[data-theme="dark"]`) — override semantic tokens per theme
159
- 4. Component styles — use `var(--color-surface)` in scoped `<style>` blocks
160
- 5. Theme toggle — store preference in cookie (SSR-safe) + `$state` for reactivity
155
+ Use `@themecraft/core` for all theming (SCSS engine + CLI + runtime ThemeManager).
161
156
 
162
- Svelte scoped styles + CSS custom properties:
157
+ **Install:**
158
+ ```bash
159
+ npm install @themecraft/core
160
+ npx themecraft init # generates themecraft.config.json + tokens.json
161
+ npx themecraft generate # generates type-safe SCSS from tokens.json
162
+ ```
163
+
164
+ **Pipeline:**
165
+ 1. `tokens.json` — define token names (colors, sizes, typography, breakpoints)
166
+ 2. `npx themecraft generate` — produces type-safe SCSS variables with IDE autocomplete
167
+ 3. Theme files (`themes/light.scss`, `dark.scss`) — use `define-light-theme()` / `define-dark-theme()`
168
+ 4. `@themecraft/core/themes` → `variables()` mixin emits CSS custom properties at `:root`
169
+ 5. `ThemeManager` (from `@themecraft/core/runtime`) — runtime switching, storage, FOUC prevention
170
+
171
+ **SCSS in scoped styles** (`<style lang="scss">`):
163
172
  ```svelte
164
- <style>
173
+ <style lang="scss">
174
+ @use '@themecraft/core/theming' as theming;
175
+
165
176
  .card {
166
- background: var(--color-surface);
167
- color: var(--color-on-surface);
168
- padding: var(--space-md);
169
- border-radius: var(--radius-md);
177
+ background: theming.color-var('surface');
178
+ color: theming.color-var('on-surface');
179
+ padding: theming.size-var('card-padding');
180
+ @include theming.typography-level-var('body-primary');
181
+ @include theming.theme-transition();
170
182
  }
171
183
  </style>
172
184
  ```
173
185
 
174
- Global styles via `:global()` selector or `app.css` use sparingly.
186
+ **Token accessors** (always use these, NEVER hardcode colors/sizes):
187
+ - `theming.color-var($name)` → `var(--color-#{$name})`
188
+ - `theming.size-var($name)` → `var(--size-#{$name})`
189
+ - `@include theming.typography-level-var($level)` → all typography properties
190
+ - `theming.size($small, $medium, $large)` → responsive size map
191
+
192
+ **Runtime setup** (in `+layout.svelte` or `hooks.server.ts`):
193
+ ```typescript
194
+ import { ThemeManager } from '@themecraft/core/runtime';
195
+
196
+ const themeManager = new ThemeManager({
197
+ themes: ['light', 'dark'],
198
+ defaultTheme: 'light',
199
+ basePath: '/themes/',
200
+ storage: 'localStorage',
201
+ preferSystemTheme: { light: 'light', dark: 'dark' },
202
+ transition: { duration: '200ms' },
203
+ }, document);
204
+
205
+ // SSR: use ThemeManager.buildSSRLinkTag(config) in hooks.server.ts
206
+ // FOUC prevention: ThemeManager.buildInlineScript(config) in <svelte:head>
207
+ ```
208
+
209
+ Global styles via `:global()` selector or `app.scss` — use sparingly.
175
210
  Component-scoped styles are the default and preferred approach.
176
211
 
212
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
213
+
214
+ **Figma sync** (optional): `npx themecraft figma-sync` pulls design variables from Figma API into `tokens.json`.
215
+
177
216
  ## Atomic UI Component Library
178
217
 
179
218
  Atomic design: atoms -> molecules -> organisms -> templates -> pages.
@@ -175,35 +175,71 @@ src/
175
175
  - Keep translation keys stable and organized by feature/domain
176
176
  - Locale files: JSON format, one per language (`en.json`, `cs.json`)
177
177
 
178
- ## Theme System
178
+ ## Theme System — @themecraft
179
179
 
180
- Pattern layers:
181
- 1. Token definitions (`variables/_colors.css`) — CSS custom properties for design tokens
182
- 2. Semantic tokens (`variables/_semantic.css`) — map raw tokens to semantic names (`--color-text-primary`, `--color-bg-surface`)
183
- 3. Theme definitions (`themes/light.css`, `dark.css`) — assign token values per theme
184
- 4. Utility composable (`useTheme.ts`) — toggle theme, persist preference, no-flash on load
185
- 5. Component usage via CSS custom properties — never hardcode colors/sizes
180
+ Use `@themecraft/core` for all theming (SCSS engine + CLI + runtime ThemeManager).
186
181
 
187
- **Scoped styles with `<style scoped>`:**
188
- - Default to `<style scoped>` — styles are automatically scoped to the component
189
- - Use `:deep()` pseudo-class to style child component internals (sparingly)
190
- - Use `:slotted()` to style slot content from parent
191
- - Use `:global()` for truly global overrides (rare)
182
+ **Install:**
183
+ ```bash
184
+ npm install @themecraft/core
185
+ npx themecraft init # generates themecraft.config.json + tokens.json
186
+ npx themecraft generate # generates type-safe SCSS from tokens.json
187
+ ```
192
188
 
193
- **CSS Modules:** `<style module>` for class-based scoping (`:class="$style.myClass"`). Prefer scoped styles for most cases.
189
+ **Pipeline:**
190
+ 1. `tokens.json` — define token names (colors, sizes, typography, breakpoints)
191
+ 2. `npx themecraft generate` — produces type-safe SCSS variables with IDE autocomplete
192
+ 3. Theme files (`themes/light.scss`, `dark.scss`) — use `define-light-theme()` / `define-dark-theme()`
193
+ 4. `@themecraft/core/themes` → `variables()` mixin emits CSS custom properties at `:root`
194
+ 5. `ThemeManager` (from `@themecraft/core/runtime`) — runtime switching, storage, FOUC prevention
194
195
 
195
- Component style usage:
196
+ **SCSS in scoped styles** (`<style scoped lang="scss">`):
196
197
  ```vue
197
- <style scoped>
198
+ <style scoped lang="scss">
199
+ @use '@themecraft/core/theming' as theming;
200
+
198
201
  .card {
199
- background: var(--color-bg-surface);
200
- color: var(--color-text-primary);
201
- padding: var(--spacing-md);
202
- border-radius: var(--radius-md);
202
+ background: theming.color-var('surface');
203
+ color: theming.color-var('on-surface');
204
+ padding: theming.size-var('card-padding');
205
+ @include theming.typography-level-var('body-primary');
206
+ @include theming.theme-transition();
203
207
  }
204
208
  </style>
205
209
  ```
206
210
 
211
+ **Token accessors** (always use these, NEVER hardcode colors/sizes):
212
+ - `theming.color-var($name)` → `var(--color-#{$name})`
213
+ - `theming.size-var($name)` → `var(--size-#{$name})`
214
+ - `@include theming.typography-level-var($level)` → all typography properties
215
+ - `theming.size($small, $medium, $large)` → responsive size map
216
+
217
+ **Runtime setup** (in `App.vue` or plugin):
218
+ ```typescript
219
+ import { ThemeManager } from '@themecraft/core/runtime';
220
+
221
+ const themeManager = new ThemeManager({
222
+ themes: ['light', 'dark'],
223
+ defaultTheme: 'light',
224
+ basePath: '/themes/',
225
+ storage: 'localStorage',
226
+ preferSystemTheme: { light: 'light', dark: 'dark' },
227
+ transition: { duration: '200ms' },
228
+ }, document);
229
+ ```
230
+
231
+ **Scoped styles with `<style scoped>`:**
232
+ - Default to `<style scoped lang="scss">` — styles are automatically scoped to the component
233
+ - Use `:deep()` pseudo-class to style child component internals (sparingly)
234
+ - Use `:slotted()` to style slot content from parent
235
+ - Use `:global()` for truly global overrides (rare)
236
+
237
+ **CSS Modules:** `<style module lang="scss">` for class-based scoping. Prefer scoped styles for most cases.
238
+
239
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
240
+
241
+ **Figma sync** (optional): `npx themecraft figma-sync` pulls design variables from Figma API into `tokens.json`.
242
+
207
243
  ## Atomic UI Component Library
208
244
 
209
245
  Atomic design: atoms -> molecules -> organisms -> templates -> pages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-workspace",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
4
4
  "description": "Scaffold a project with Claude Code agents for autonomous AI-driven development",
5
5
  "type": "module",
6
6
  "bin": {