create-claude-workspace 1.1.32 → 1.1.34

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 generated SCSS variables (`colors.$token`, `sizes.$token`, `typo.level()`) — no hardcoded color/size values, no direct `color-var()`/`size-var()` calls
105
105
 
106
106
  ## Output Format
107
107
 
@@ -139,23 +139,92 @@ 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
142
+ ## Theme System — @themecraft
143
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
144
+ Use `@themecraft/core` (SCSS engine + CLI + runtime) and `@themecraft/angular` (Angular adapter) for all theming.
151
145
 
152
- SCSS package.json exports:
153
- { "./themes", "./theming", "./colors", "./typography", "./sizes", "./breakpoints" }
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
+ **Component SCSS** — import generated variables, NEVER call `color-var()`/`size-var()` directly:
161
+ ```scss
162
+ @use 'generated/theme/colors' as colors;
163
+ @use 'generated/theme/sizes' as sizes;
164
+ @use 'generated/theme/typography' as typo;
165
+ @use '@themecraft/core/theming' as theming;
166
+
167
+ .card {
168
+ background: colors.$surface;
169
+ color: colors.$on-surface;
170
+ padding: sizes.$card-padding;
171
+ @include typo.body-primary();
172
+ @include theming.theme-transition(); // smooth theme switch
173
+ }
174
+ ```
175
+
176
+ **How it works:** `npx themecraft generate` reads `tokens.json` and produces typed SCSS files (`generated/theme/colors.scss`, `sizes.scss`, `typography.scss`) that wrap `color-var()`/`size-var()` internally. Components consume these generated variables — never the raw accessor functions.
177
+
178
+ **Figma workflow:** If a Figma design exists, run `npx themecraft figma-sync` FIRST to pull design variables into `tokens.json`, then `npx themecraft generate`.
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
+ ```
154
226
 
155
- Component SCSS usage:
156
- @use '@[PREFIX]/theme/colors';
157
- @use '@[PREFIX]/theme/sizes';
158
- @use '@[PREFIX]/theme/typography';
227
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations from compiled CSS.
159
228
 
160
229
  ## Atomic UI Component Library
161
230
 
@@ -227,7 +296,7 @@ When reviewing Angular code, check:
227
296
  - Subscription cleanup (DestroyRef/takeUntilDestroyed)
228
297
  - Resource disposal (ImageBitmap.close(), stream.stop(), BroadcastChannel.close())
229
298
  - No memory leaks in effects or event listeners
230
- - Theme compliance: color-var(), size-var(), breakpoint mixins — no hardcoded colors/sizes
299
+ - Theme compliance: generated @themecraft SCSS variables — no hardcoded colors/sizes, no direct `color-var()`/`size-var()` calls
231
300
  - Lazy loading via loadComponent/loadChildren, no eager page imports
232
301
  - @defer for heavy below-fold components
233
302
  - Naming: PascalCase components, lib- selectors, kebab-case files
@@ -149,25 +149,73 @@ 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
+ **Component SCSS** (`.module.scss`) — import generated variables, NEVER call `color-var()`/`size-var()` directly:
171
+ ```scss
172
+ @use 'generated/theme/colors' as colors;
173
+ @use 'generated/theme/sizes' as sizes;
174
+ @use 'generated/theme/typography' as typo;
175
+ @use '@themecraft/core/theming' as theming;
176
+
177
+ .card {
178
+ background: colors.$surface;
179
+ color: colors.$on-surface;
180
+ padding: sizes.$card-padding;
181
+ @include typo.body-primary();
182
+ @include theming.theme-transition();
183
+ }
184
+ ```
185
+
186
+ **How it works:** `npx themecraft generate` reads `tokens.json` and produces typed SCSS files (`generated/theme/colors.scss`, `sizes.scss`, `typography.scss`) that wrap `color-var()`/`size-var()` internally. Components consume these generated variables — never the raw accessor functions.
187
+
188
+ **Figma workflow:** If a Figma design exists, run `npx themecraft figma-sync` FIRST to pull design variables into `tokens.json`, then `npx themecraft generate`.
189
+
190
+ **Runtime setup** (in layout or `_app.tsx`):
191
+ ```typescript
192
+ import { ThemeManager } from '@themecraft/core/runtime';
193
+
194
+ const themeManager = new ThemeManager({
195
+ themes: ['light', 'dark'],
196
+ defaultTheme: 'light',
197
+ basePath: '/themes/',
198
+ storage: 'localStorage',
199
+ preferSystemTheme: { light: 'light', dark: 'dark' },
200
+ transition: { duration: '200ms' },
201
+ }, document);
202
+
203
+ // SSR FOUC prevention — add inline script to <head>:
204
+ // themeManager.getInlineScript()
205
+ // SSR link tag: ThemeManager.buildSSRLinkTag(config)
206
+ ```
161
207
 
162
208
  **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
209
+ - **CSS Modules** (`.module.scss`) — scoped by default, zero runtime cost, works with SSR
210
+ - **Tailwind CSS** — utility-first, configure with design tokens from @themecraft
211
+ - No CSS-in-JS with runtime overhead unless explicitly chosen
212
+
213
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
166
214
 
167
215
  Component style usage:
168
216
  ```tsx
169
- import styles from './user-card.module.css';
170
- // or with Tailwind: className="flex items-center gap-2 text-primary"
217
+ import styles from './user-card.module.scss';
218
+ // generated SCSS variables compile to CSS custom properties
171
219
  ```
172
220
 
173
221
  ## Atomic UI Component Library
@@ -241,7 +289,7 @@ When reviewing React code, check:
241
289
  - SSR safety: no direct `window`/`document`/`navigator` access in Server Components, correct `'use client'` boundaries
242
290
  - Server/client separation: Flag WARN if a module mixes server and browser logic without clear boundaries
243
291
  - No memory leaks in effects, event listeners, or subscriptions
244
- - Theme compliance: CSS custom properties for colors/sizes/spacing no hardcoded values
292
+ - Theme compliance: generated @themecraft SCSS variables — no hardcoded colors/sizes, no direct `color-var()`/`size-var()` calls
245
293
  - Code splitting: `React.lazy` + `Suspense` for heavy routes/components, no eager imports of page-level components
246
294
  - Dynamic imports for heavy third-party libraries
247
295
  - Naming: PascalCase components, camelCase hooks, kebab-case files
@@ -150,30 +150,68 @@ 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
+ **Component SCSS** — import generated variables, NEVER call `color-var()`/`size-var()` directly:
163
172
  ```svelte
164
- <style>
173
+ <style lang="scss">
174
+ @use 'generated/theme/colors' as colors;
175
+ @use 'generated/theme/sizes' as sizes;
176
+ @use 'generated/theme/typography' as typo;
177
+ @use '@themecraft/core/theming' as theming;
178
+
165
179
  .card {
166
- background: var(--color-surface);
167
- color: var(--color-on-surface);
168
- padding: var(--space-md);
169
- border-radius: var(--radius-md);
180
+ background: colors.$surface;
181
+ color: colors.$on-surface;
182
+ padding: sizes.$card-padding;
183
+ @include typo.body-primary();
184
+ @include theming.theme-transition();
170
185
  }
171
186
  </style>
172
187
  ```
173
188
 
174
- Global styles via `:global()` selector or `app.css` — use sparingly.
189
+ **How it works:** `npx themecraft generate` reads `tokens.json` and produces typed SCSS files (`generated/theme/colors.scss`, `sizes.scss`, `typography.scss`) that wrap `color-var()`/`size-var()` internally. Components consume these generated variables never the raw accessor functions.
190
+
191
+ **Figma workflow:** If a Figma design exists, run `npx themecraft figma-sync` FIRST to pull design variables into `tokens.json`, then `npx themecraft generate`.
192
+
193
+ **Runtime setup** (in `+layout.svelte` or `hooks.server.ts`):
194
+ ```typescript
195
+ import { ThemeManager } from '@themecraft/core/runtime';
196
+
197
+ const themeManager = new ThemeManager({
198
+ themes: ['light', 'dark'],
199
+ defaultTheme: 'light',
200
+ basePath: '/themes/',
201
+ storage: 'localStorage',
202
+ preferSystemTheme: { light: 'light', dark: 'dark' },
203
+ transition: { duration: '200ms' },
204
+ }, document);
205
+
206
+ // SSR: use ThemeManager.buildSSRLinkTag(config) in hooks.server.ts
207
+ // FOUC prevention: ThemeManager.buildInlineScript(config) in <svelte:head>
208
+ ```
209
+
210
+ Global styles via `:global()` selector or `app.scss` — use sparingly.
175
211
  Component-scoped styles are the default and preferred approach.
176
212
 
213
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
214
+
177
215
  ## Atomic UI Component Library
178
216
 
179
217
  Atomic design: atoms -> molecules -> organisms -> templates -> pages.
@@ -255,7 +293,7 @@ When reviewing Svelte code, check:
255
293
  - Server/client separation: secrets and DB in `+page.server.ts`, not `+page.ts`
256
294
  - `$lib/` imports — no deep relative paths (`../../../`)
257
295
  - `$lib/server/` for server-only modules — enforced by SvelteKit
258
- - Theme compliance: CSS custom properties (`var(--*)`) — no hardcoded colors/sizes
296
+ - Theme compliance: generated @themecraft SCSS variables — no hardcoded colors/sizes, no direct `color-var()`/`size-var()` calls
259
297
  - Lazy loading: routes auto-split, dynamic `import()` for heavy non-route components
260
298
  - Accessibility: all Svelte compiler a11y warnings resolved (not suppressed)
261
299
  - No `{@html}` without sanitization
@@ -175,35 +175,70 @@ 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
+ **Component SCSS** — import generated variables, NEVER call `color-var()`/`size-var()` directly:
196
197
  ```vue
197
- <style scoped>
198
+ <style scoped lang="scss">
199
+ @use 'generated/theme/colors' as colors;
200
+ @use 'generated/theme/sizes' as sizes;
201
+ @use 'generated/theme/typography' as typo;
202
+ @use '@themecraft/core/theming' as theming;
203
+
198
204
  .card {
199
- background: var(--color-bg-surface);
200
- color: var(--color-text-primary);
201
- padding: var(--spacing-md);
202
- border-radius: var(--radius-md);
205
+ background: colors.$surface;
206
+ color: colors.$on-surface;
207
+ padding: sizes.$card-padding;
208
+ @include typo.body-primary();
209
+ @include theming.theme-transition();
203
210
  }
204
211
  </style>
205
212
  ```
206
213
 
214
+ **How it works:** `npx themecraft generate` reads `tokens.json` and produces typed SCSS files (`generated/theme/colors.scss`, `sizes.scss`, `typography.scss`) that wrap `color-var()`/`size-var()` internally. Components consume these generated variables — never the raw accessor functions.
215
+
216
+ **Figma workflow:** If a Figma design exists, run `npx themecraft figma-sync` FIRST to pull design variables into `tokens.json`, then `npx themecraft generate`.
217
+
218
+ **Runtime setup** (in `App.vue` or plugin):
219
+ ```typescript
220
+ import { ThemeManager } from '@themecraft/core/runtime';
221
+
222
+ const themeManager = new ThemeManager({
223
+ themes: ['light', 'dark'],
224
+ defaultTheme: 'light',
225
+ basePath: '/themes/',
226
+ storage: 'localStorage',
227
+ preferSystemTheme: { light: 'light', dark: 'dark' },
228
+ transition: { duration: '200ms' },
229
+ }, document);
230
+ ```
231
+
232
+ **Scoped styles with `<style scoped>`:**
233
+ - Default to `<style scoped lang="scss">` — styles are automatically scoped to the component
234
+ - Use `:deep()` pseudo-class to style child component internals (sparingly)
235
+ - Use `:slotted()` to style slot content from parent
236
+ - Use `:global()` for truly global overrides (rare)
237
+
238
+ **CSS Modules:** `<style module lang="scss">` for class-based scoping. Prefer scoped styles for most cases.
239
+
240
+ **PostCSS optimization** — add `@themecraft/core/postcss` plugin to remove unused token declarations.
241
+
207
242
  ## Atomic UI Component Library
208
243
 
209
244
  Atomic design: atoms -> molecules -> organisms -> templates -> pages.
@@ -284,7 +319,7 @@ When reviewing Vue code, check:
284
319
  - SSR safety: no direct `window`/`document`/`navigator` access outside `onMounted` or client guards
285
320
  - SSR/Client separation: Flag WARN if a composable mixes server and browser logic
286
321
  - `<style scoped>` on all components — no unscoped styles leaking globally
287
- - Theme compliance: CSS custom properties (`var(--token)`) — no hardcoded colors/sizes
322
+ - Theme compliance: generated @themecraft SCSS variables — no hardcoded colors/sizes, no direct `color-var()`/`size-var()` calls
288
323
  - Lazy loading: `defineAsyncComponent` for heavy components, dynamic imports for routes
289
324
  - No `v-html` without sanitization (XSS risk)
290
325
  - Props defined with TypeScript types via `defineProps<{ ... }>()` — not runtime-only validation
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.34",
4
4
  "description": "Scaffold a project with Claude Code agents for autonomous AI-driven development",
5
5
  "type": "module",
6
6
  "bin": {