@react-spa-scaffold/mcp 1.2.0 → 1.2.1
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/constants.d.ts +35 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +35 -0
- package/dist/constants.js.map +1 -0
- package/dist/features/definitions/theming.d.ts.map +1 -1
- package/dist/features/definitions/theming.js +2 -1
- package/dist/features/definitions/theming.js.map +1 -1
- package/dist/features/types.d.ts +14 -19
- package/dist/features/types.d.ts.map +1 -1
- package/dist/features/types.js +4 -21
- package/dist/features/types.js.map +1 -1
- package/dist/features/types.test.d.ts +5 -0
- package/dist/features/types.test.d.ts.map +1 -0
- package/dist/features/types.test.js +32 -0
- package/dist/features/types.test.js.map +1 -0
- package/dist/resources/docs.d.ts +2 -8
- package/dist/resources/docs.d.ts.map +1 -1
- package/dist/resources/docs.js +27 -49
- package/dist/resources/docs.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/get-example.d.ts +4 -15
- package/dist/tools/get-example.d.ts.map +1 -1
- package/dist/tools/get-example.js +3 -11
- package/dist/tools/get-example.js.map +1 -1
- package/dist/tools/get-features.d.ts +15 -9
- package/dist/tools/get-features.d.ts.map +1 -1
- package/dist/tools/get-features.js +12 -0
- package/dist/tools/get-features.js.map +1 -1
- package/dist/tools/get-file.d.ts +23 -0
- package/dist/tools/get-file.d.ts.map +1 -0
- package/dist/tools/get-file.js +53 -0
- package/dist/tools/get-file.js.map +1 -0
- package/dist/tools/get-file.test.d.ts +5 -0
- package/dist/tools/get-file.test.d.ts.map +1 -0
- package/dist/tools/get-file.test.js +63 -0
- package/dist/tools/get-file.test.js.map +1 -0
- package/dist/tools/get-scaffold.d.ts +8 -29
- package/dist/tools/get-scaffold.d.ts.map +1 -1
- package/dist/tools/get-scaffold.js +18 -24
- package/dist/tools/get-scaffold.js.map +1 -1
- package/dist/tools/get-scaffold.test.js +19 -16
- package/dist/tools/get-scaffold.test.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/registry.d.ts +4 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +33 -15
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/types.d.ts +24 -6
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +3 -0
- package/dist/tools/types.js.map +1 -1
- package/dist/utils/cache.d.ts +9 -5
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/cache.js +21 -5
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/docs.d.ts +1 -3
- package/dist/utils/docs.d.ts.map +1 -1
- package/dist/utils/docs.js +3 -8
- package/dist/utils/docs.js.map +1 -1
- package/dist/utils/examples/index.d.ts +1 -1
- package/dist/utils/examples/index.d.ts.map +1 -1
- package/dist/utils/examples/index.js +6 -10
- package/dist/utils/examples/index.js.map +1 -1
- package/dist/utils/examples/patterns.test.d.ts +6 -0
- package/dist/utils/examples/patterns.test.d.ts.map +1 -0
- package/dist/utils/examples/patterns.test.js +75 -0
- package/dist/utils/examples/patterns.test.js.map +1 -0
- package/dist/utils/paths.d.ts +9 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +19 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +22 -1
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/scaffold/claude-md/index.d.ts +7 -0
- package/dist/utils/scaffold/claude-md/index.d.ts.map +1 -0
- package/dist/utils/scaffold/claude-md/index.js +23 -0
- package/dist/utils/scaffold/claude-md/index.js.map +1 -0
- package/dist/utils/scaffold/claude-md/sections.d.ts +16 -0
- package/dist/utils/scaffold/claude-md/sections.d.ts.map +1 -0
- package/dist/utils/scaffold/claude-md/sections.js +269 -0
- package/dist/utils/scaffold/claude-md/sections.js.map +1 -0
- package/dist/utils/scaffold/commands.d.ts +2 -6
- package/dist/utils/scaffold/commands.d.ts.map +1 -1
- package/dist/utils/scaffold/commands.js +9 -12
- package/dist/utils/scaffold/commands.js.map +1 -1
- package/dist/utils/scaffold/compute.d.ts +5 -8
- package/dist/utils/scaffold/compute.d.ts.map +1 -1
- package/dist/utils/scaffold/compute.js +26 -41
- package/dist/utils/scaffold/compute.js.map +1 -1
- package/dist/utils/scaffold/dependencies.d.ts +10 -17
- package/dist/utils/scaffold/dependencies.d.ts.map +1 -1
- package/dist/utils/scaffold/dependencies.js +28 -34
- package/dist/utils/scaffold/dependencies.js.map +1 -1
- package/dist/utils/scaffold/generators.d.ts +3 -11
- package/dist/utils/scaffold/generators.d.ts.map +1 -1
- package/dist/utils/scaffold/generators.js +20 -288
- package/dist/utils/scaffold/generators.js.map +1 -1
- package/dist/utils/scaffold/index.d.ts +2 -3
- package/dist/utils/scaffold/index.d.ts.map +1 -1
- package/dist/utils/scaffold/index.js +1 -3
- package/dist/utils/scaffold/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/utils/scaffold/dependencies.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/utils/scaffold/dependencies.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOlD,MAAM,eAAe,GAAG,oBAAoB,EAAc,CAAC;AAE3D,2DAA2D;AAC3D,KAAK,UAAU,qBAAqB;IAClC,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;QACzC,MAAM,IAA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AE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjF,OAAO;QACL,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;QACtC,eAAe,EAAE,UAAU,CAAC,eAAe,CAAC;QAC5C,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,UAAuB;IAClD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content generators for CLAUDE.md, env.ts, routes.ts, etc.
|
|
3
|
-
*/
|
|
4
1
|
import type { FeatureId } from '../../features/types.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Generate vite-env.d.ts content based on selected features
|
|
9
|
-
*/
|
|
2
|
+
export { generateClaudeMd } from './claude-md/index.js';
|
|
3
|
+
/** Generate vite-env.d.ts content based on selected features. */
|
|
10
4
|
export declare function generateViteEnvDts(featureIds: FeatureId[]): string;
|
|
11
|
-
/**
|
|
12
|
-
* Generate env.ts content based on selected features
|
|
13
|
-
*/
|
|
5
|
+
/** Generate env.ts content based on selected features. */
|
|
14
6
|
export declare function generateEnvTs(featureIds: FeatureId[]): string;
|
|
15
7
|
/** Generates routes.ts content. */
|
|
16
8
|
export declare function generateRoutesTs(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../src/utils/scaffold/generators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../src/utils/scaffold/generators.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,iEAAiE;AACjE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAgClE;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAwE7D;AAED,mCAAmC;AACnC,wBAAgB,gBAAgB,IAAI,MAAM,CAazC"}
|
|
@@ -1,289 +1,24 @@
|
|
|
1
1
|
// noinspection JSUnresolvedReference
|
|
2
|
-
/** Generates CLAUDE.md content based on selected features. */
|
|
3
|
-
export function generateClaudeMd(featureIds, projectName, scripts) {
|
|
4
|
-
const sections = [];
|
|
5
|
-
// Header
|
|
6
|
-
sections.push(`# CLAUDE.md
|
|
7
|
-
|
|
8
|
-
AI assistant guidance for **${projectName}** - a React 19 + TypeScript + Vite 7 codebase.`);
|
|
9
|
-
// Commands section - based on actual scripts
|
|
10
|
-
const commandLines = [];
|
|
11
|
-
const scriptDescriptions = {
|
|
12
|
-
dev: 'Dev server at localhost:5173',
|
|
13
|
-
build: 'Production build (typecheck + bundle)',
|
|
14
|
-
preview: 'Preview production build',
|
|
15
|
-
typecheck: 'TypeScript only',
|
|
16
|
-
lint: 'ESLint check',
|
|
17
|
-
'lint:fix': 'ESLint auto-fix',
|
|
18
|
-
format: 'Prettier format',
|
|
19
|
-
'format:check': 'Prettier check',
|
|
20
|
-
test: 'Vitest once',
|
|
21
|
-
'test:watch': 'Vitest watch mode',
|
|
22
|
-
'test:coverage': 'Coverage (80% threshold)',
|
|
23
|
-
e2e: 'Playwright E2E',
|
|
24
|
-
'e2e:ui': 'Playwright UI mode',
|
|
25
|
-
'i18n:extract': 'Extract translations to .po',
|
|
26
|
-
prepare: 'Initialize Husky hooks',
|
|
27
|
-
};
|
|
28
|
-
for (const script of Object.keys(scripts).sort()) {
|
|
29
|
-
const desc = scriptDescriptions[script] || '';
|
|
30
|
-
const padding = ' '.repeat(Math.max(1, 20 - script.length));
|
|
31
|
-
commandLines.push(`npm run ${script}${padding}# ${desc}`);
|
|
32
|
-
}
|
|
33
|
-
sections.push(`
|
|
34
|
-
## Commands
|
|
35
|
-
|
|
36
|
-
\`\`\`bash
|
|
37
|
-
${commandLines.join('\n')}
|
|
38
|
-
\`\`\``);
|
|
39
|
-
// Project Structure - dynamic based on features
|
|
40
|
-
const structureParts = ['src/', '├── components/ # ui/ (primitives), layout/, shared/ (features)'];
|
|
41
|
-
if (featureIds.includes('api') || featureIds.includes('i18n') || featureIds.includes('mobile')) {
|
|
42
|
-
structureParts.push('├── contexts/ # React Context providers');
|
|
43
|
-
}
|
|
44
|
-
structureParts.push('├── hooks/ # Custom hooks');
|
|
45
|
-
structureParts.push('├── lib/ # config, utils, format' +
|
|
46
|
-
(featureIds.includes('api') ? ', api' : '') +
|
|
47
|
-
(featureIds.includes('routing') ? ', routes' : '') +
|
|
48
|
-
(featureIds.includes('state') ? ', storage' : ''));
|
|
49
|
-
if (featureIds.includes('routing')) {
|
|
50
|
-
structureParts.push('├── pages/ # Lazy-loaded route components');
|
|
51
|
-
}
|
|
52
|
-
if (featureIds.includes('state')) {
|
|
53
|
-
structureParts.push('├── stores/ # Zustand stores');
|
|
54
|
-
}
|
|
55
|
-
if (featureIds.includes('i18n')) {
|
|
56
|
-
structureParts.push('├── i18n/ # LinguiJS config and catalogs');
|
|
57
|
-
structureParts.push('├── locales/ # Translation files (.po)');
|
|
58
|
-
}
|
|
59
|
-
structureParts.push('└── types/ # TypeScript definitions');
|
|
60
|
-
if (featureIds.includes('testing')) {
|
|
61
|
-
structureParts.push('');
|
|
62
|
-
structureParts.push('# Unit tests co-located: *.test.ts/tsx next to source');
|
|
63
|
-
structureParts.push('e2e/tests/ # Playwright functional E2E tests');
|
|
64
|
-
if (featureIds.includes('performance')) {
|
|
65
|
-
structureParts.push('e2e/performance/ # Performance regression tests');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
sections.push(`
|
|
69
|
-
## Project Structure
|
|
70
|
-
|
|
71
|
-
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for full structure and data flow.
|
|
72
|
-
|
|
73
|
-
\`\`\`
|
|
74
|
-
${structureParts.join('\n')}
|
|
75
|
-
\`\`\``);
|
|
76
|
-
// Code Patterns - always included
|
|
77
|
-
const stateHierarchy = [];
|
|
78
|
-
if (featureIds.includes('state'))
|
|
79
|
-
stateHierarchy.push('Zustand (persisted)');
|
|
80
|
-
if (featureIds.includes('api'))
|
|
81
|
-
stateHierarchy.push('TanStack Query (server)');
|
|
82
|
-
stateHierarchy.push('Context (UI)', 'useState (local)');
|
|
83
|
-
sections.push(`
|
|
84
|
-
## Code Patterns
|
|
85
|
-
|
|
86
|
-
**Imports**: Always use \`@/\` path alias
|
|
87
|
-
|
|
88
|
-
**Components**: Named exports + \`Props\` interface. Pages use default exports for lazy loading.
|
|
89
|
-
|
|
90
|
-
**TypeScript**: \`type\` for unions, \`interface\` for objects
|
|
91
|
-
|
|
92
|
-
**State hierarchy**: ${stateHierarchy.join(' → ')}
|
|
93
|
-
|
|
94
|
-
See [docs/CODING_STANDARDS.md](docs/CODING_STANDARDS.md) and [docs/COMPONENT_GUIDELINES.md](docs/COMPONENT_GUIDELINES.md).`);
|
|
95
|
-
// UI Components section - only if ui feature
|
|
96
|
-
if (featureIds.includes('ui')) {
|
|
97
|
-
sections.push(`
|
|
98
|
-
## UI Components (Shadcn/UI)
|
|
99
|
-
|
|
100
|
-
This project uses **Shadcn/UI** with radix-nova style. Components live in \`src/components/ui/\`.
|
|
101
|
-
|
|
102
|
-
### Adding New Components
|
|
103
|
-
|
|
104
|
-
\`\`\`bash
|
|
105
|
-
npx shadcn@latest add button # Single component
|
|
106
|
-
npx shadcn@latest add dialog card input # Multiple components
|
|
107
|
-
\`\`\`
|
|
108
|
-
|
|
109
|
-
**Pattern**: Import directly (no barrel exports for UI):
|
|
110
|
-
|
|
111
|
-
\`\`\`tsx
|
|
112
|
-
import { Button } from '@/components/ui/button';
|
|
113
|
-
import { cn } from '@/lib/utils';
|
|
114
|
-
\`\`\``);
|
|
115
|
-
}
|
|
116
|
-
// Mobile section - only if mobile feature
|
|
117
|
-
if (featureIds.includes('mobile')) {
|
|
118
|
-
sections.push(`
|
|
119
|
-
## Mobile & Responsive Design
|
|
120
|
-
|
|
121
|
-
This project includes mobile-first responsive utilities.
|
|
122
|
-
|
|
123
|
-
### Viewport Detection
|
|
124
|
-
|
|
125
|
-
\`\`\`tsx
|
|
126
|
-
import { MobileProvider, useMobileContext } from '@/contexts/mobileContext';
|
|
127
|
-
|
|
128
|
-
// Wrap app with MobileProvider
|
|
129
|
-
<MobileProvider>{children}</MobileProvider>
|
|
130
|
-
|
|
131
|
-
// Use in components
|
|
132
|
-
const { isMobile, isTablet, isDesktop, width } = useMobileContext();
|
|
133
|
-
\`\`\`
|
|
134
|
-
|
|
135
|
-
### Breakpoints
|
|
136
|
-
|
|
137
|
-
\`\`\`tsx
|
|
138
|
-
import { BREAKPOINTS, useIsMobile, useIsDesktop } from '@/hooks/useMediaQuery';
|
|
139
|
-
|
|
140
|
-
// BREAKPOINTS: sm (640), md (768), lg (1024), xl (1280)
|
|
141
|
-
const isMobile = useIsMobile(); // width < 768px
|
|
142
|
-
const isDesktop = useIsDesktop(); // width >= 1024px
|
|
143
|
-
\`\`\`
|
|
144
|
-
|
|
145
|
-
### Touch-Aware Sizing
|
|
146
|
-
|
|
147
|
-
\`\`\`tsx
|
|
148
|
-
import { useTouchSizes } from '@/hooks/useTouchSizes';
|
|
149
|
-
|
|
150
|
-
const sizes = useTouchSizes();
|
|
151
|
-
<Button size={sizes.button}>Click</Button> // 'touch' on mobile, 'default' on desktop
|
|
152
|
-
\`\`\``);
|
|
153
|
-
}
|
|
154
|
-
// Theming section - only if theming feature
|
|
155
|
-
if (featureIds.includes('theming')) {
|
|
156
|
-
sections.push(`
|
|
157
|
-
## Theming
|
|
158
|
-
|
|
159
|
-
Light/dark/system theme support with Zustand persistence.
|
|
160
|
-
|
|
161
|
-
### Usage
|
|
162
|
-
|
|
163
|
-
\`\`\`tsx
|
|
164
|
-
import { usePreferencesStore } from '@/stores/preferencesStore';
|
|
165
|
-
|
|
166
|
-
// Get current theme
|
|
167
|
-
const theme = usePreferencesStore((s) => s.theme);
|
|
168
|
-
|
|
169
|
-
// Toggle theme
|
|
170
|
-
const toggleTheme = usePreferencesStore((s) => s.toggleTheme);
|
|
171
|
-
|
|
172
|
-
// Get resolved theme (actual light/dark value when 'system')
|
|
173
|
-
const getResolvedTheme = usePreferencesStore((s) => s.getResolvedTheme);
|
|
174
|
-
\`\`\`
|
|
175
|
-
|
|
176
|
-
The \`useThemeEffect\` hook automatically applies the \`.dark\` class to the document.
|
|
177
|
-
The ThemeToggle component provides a UI for switching between light, dark, and system themes.`);
|
|
178
|
-
}
|
|
179
|
-
// MCP Servers section - always helpful
|
|
180
|
-
sections.push(`
|
|
181
|
-
## MCP Servers (PREFER OVER WebSearch)
|
|
182
|
-
|
|
183
|
-
Use MCP servers for documentation lookup. They provide **structured, version-accurate data** directly from source.`);
|
|
184
|
-
if (featureIds.includes('ui')) {
|
|
185
|
-
sections.push(`
|
|
186
|
-
### Shadcn MCP (UI Components)
|
|
187
|
-
|
|
188
|
-
| Need | Tool |
|
|
189
|
-
| ------------------- | ------------------------------------------------ |
|
|
190
|
-
| Find component | \`mcp__shadcn__search_items_in_registries\` |
|
|
191
|
-
| View component code | \`mcp__shadcn__view_items_in_registries\` |
|
|
192
|
-
| Usage examples | \`mcp__shadcn__get_item_examples_from_registries\` |
|
|
193
|
-
| CLI add command | \`mcp__shadcn__get_add_command_for_items\` |`);
|
|
194
|
-
}
|
|
195
|
-
sections.push(`
|
|
196
|
-
### Context7 MCP (All Libraries)
|
|
197
|
-
|
|
198
|
-
Use for **any npm package** documentation:
|
|
199
|
-
|
|
200
|
-
\`\`\`
|
|
201
|
-
resolve-library-id → get-library-docs
|
|
202
|
-
\`\`\`
|
|
203
|
-
|
|
204
|
-
**Examples**: react-hook-form, @tanstack/react-query, zustand, zod, date-fns
|
|
205
|
-
|
|
206
|
-
### Decision Flow
|
|
207
|
-
|
|
208
|
-
\`\`\`
|
|
209
|
-
Need UI component? → Shadcn MCP
|
|
210
|
-
Need library docs? → Context7 MCP (any npm package)
|
|
211
|
-
Need general info? → WebSearch (fallback only)
|
|
212
|
-
\`\`\``);
|
|
213
|
-
// Translations section - only if i18n feature
|
|
214
|
-
if (featureIds.includes('i18n')) {
|
|
215
|
-
sections.push(`
|
|
216
|
-
## Translations (CRITICAL)
|
|
217
|
-
|
|
218
|
-
All user-facing text MUST have translator comments. ESLint enforces this.
|
|
219
|
-
|
|
220
|
-
\`\`\`tsx
|
|
221
|
-
<Trans comment="Dashboard heading">Welcome back</Trans>
|
|
222
|
-
t({ message: 'Close', comment: 'Close button' })
|
|
223
|
-
\`\`\`
|
|
224
|
-
|
|
225
|
-
See [docs/INTERNATIONALIZATION.md](docs/INTERNATIONALIZATION.md).`);
|
|
226
|
-
}
|
|
227
|
-
// Testing section - only if testing feature
|
|
228
|
-
if (featureIds.includes('testing')) {
|
|
229
|
-
sections.push(`
|
|
230
|
-
## Testing
|
|
231
|
-
|
|
232
|
-
See [docs/TESTING.md](docs/TESTING.md) and [docs/E2E_TESTING.md](docs/E2E_TESTING.md).
|
|
233
|
-
|
|
234
|
-
Unit tests are **co-located** with source files (\`*.test.ts/tsx\`). 80% coverage required.
|
|
235
|
-
|
|
236
|
-
\`\`\`typescript
|
|
237
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
238
|
-
import { screen, renderHook } from '@testing-library/react';
|
|
239
|
-
import { render, mockMatchMedia, server } from '@/test';
|
|
240
|
-
\`\`\`
|
|
241
|
-
|
|
242
|
-
MSW handlers auto-reset after each test.`);
|
|
243
|
-
}
|
|
244
|
-
// Common Gotchas - filtered by features
|
|
245
|
-
const gotchas = [];
|
|
246
|
-
if (featureIds.includes('devtools')) {
|
|
247
|
-
gotchas.push('**Node.js >= 22.0.0** required (check `.nvmrc`)');
|
|
248
|
-
gotchas.push('**Conventional commits** enforced by commitlint');
|
|
249
|
-
}
|
|
250
|
-
if (featureIds.includes('mobile')) {
|
|
251
|
-
gotchas.push('**Context hooks throw** outside provider (e.g., `useMobileContext()`)');
|
|
252
|
-
}
|
|
253
|
-
gotchas.push('**Barrel exports** in each directory via `index.ts`');
|
|
254
|
-
if (featureIds.includes('ui')) {
|
|
255
|
-
gotchas.push('**UI components** import directly: `@/components/ui/button` (no barrel)');
|
|
256
|
-
}
|
|
257
|
-
sections.push(`
|
|
258
|
-
## Common Gotchas
|
|
259
|
-
|
|
260
|
-
${gotchas.map((g, i) => `${i + 1}. ${g}`).join('\n')}
|
|
261
|
-
`);
|
|
262
|
-
return sections.join('\n');
|
|
263
|
-
}
|
|
264
2
|
/**
|
|
265
|
-
*
|
|
3
|
+
* Content generators for env.ts, routes.ts, vite-env.d.ts.
|
|
4
|
+
* CLAUDE.md generation moved to ./claude-md/
|
|
266
5
|
*/
|
|
6
|
+
import { FEATURE } from '../../constants.js';
|
|
7
|
+
export { generateClaudeMd } from './claude-md/index.js';
|
|
8
|
+
/** Generate vite-env.d.ts content based on selected features. */
|
|
267
9
|
export function generateViteEnvDts(featureIds) {
|
|
268
10
|
const sections = [];
|
|
269
|
-
|
|
270
|
-
if (featureIds.includes('i18n')) {
|
|
11
|
+
if (featureIds.includes(FEATURE.I18N)) {
|
|
271
12
|
sections.push(`declare module '*.po' {
|
|
272
13
|
import type { Messages } from '@lingui/core';
|
|
273
14
|
export const messages: Messages;
|
|
274
15
|
}`);
|
|
275
16
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// Core env vars (always included)
|
|
279
|
-
envVars.push(' readonly VITE_APP_NAME: string;');
|
|
280
|
-
envVars.push(' readonly VITE_APP_URL: string;');
|
|
281
|
-
// API feature env vars
|
|
282
|
-
if (featureIds.includes('api')) {
|
|
17
|
+
const envVars = [' readonly VITE_APP_NAME: string;', ' readonly VITE_APP_URL: string;'];
|
|
18
|
+
if (featureIds.includes(FEATURE.API)) {
|
|
283
19
|
envVars.push(' readonly VITE_API_URL: string;');
|
|
284
20
|
}
|
|
285
|
-
|
|
286
|
-
if (featureIds.includes('observability')) {
|
|
21
|
+
if (featureIds.includes(FEATURE.OBSERVABILITY)) {
|
|
287
22
|
envVars.push(' readonly VITE_SENTRY_DSN: string;');
|
|
288
23
|
envVars.push(' readonly VITE_SENTRY_ENABLED: string;');
|
|
289
24
|
}
|
|
@@ -298,24 +33,21 @@ interface ImportMeta {
|
|
|
298
33
|
}`);
|
|
299
34
|
return sections.join('\n\n') + '\n';
|
|
300
35
|
}
|
|
301
|
-
/**
|
|
302
|
-
* Generate env.ts content based on selected features
|
|
303
|
-
*/
|
|
36
|
+
/** Generate env.ts content based on selected features. */
|
|
304
37
|
export function generateEnvTs(featureIds) {
|
|
305
|
-
const schemaFields = [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (featureIds.includes(
|
|
38
|
+
const schemaFields = [
|
|
39
|
+
' VITE_APP_NAME: z.string().min(1).optional(),',
|
|
40
|
+
' VITE_APP_URL: z.string().url().optional(),',
|
|
41
|
+
];
|
|
42
|
+
const envFields = [
|
|
43
|
+
' VITE_APP_NAME: import.meta.env.VITE_APP_NAME,',
|
|
44
|
+
' VITE_APP_URL: import.meta.env.VITE_APP_URL,',
|
|
45
|
+
];
|
|
46
|
+
if (featureIds.includes(FEATURE.API)) {
|
|
314
47
|
schemaFields.push(' VITE_API_URL: z.string().url().optional(),');
|
|
315
48
|
envFields.push(' VITE_API_URL: import.meta.env.VITE_API_URL,');
|
|
316
49
|
}
|
|
317
|
-
|
|
318
|
-
if (featureIds.includes('observability')) {
|
|
50
|
+
if (featureIds.includes(FEATURE.OBSERVABILITY)) {
|
|
319
51
|
schemaFields.push(' VITE_SENTRY_DSN: z.string().url().optional(),');
|
|
320
52
|
schemaFields.push(' VITE_SENTRY_ENABLED: z.string().optional(),');
|
|
321
53
|
envFields.push(' VITE_SENTRY_DSN: import.meta.env.VITE_SENTRY_DSN,');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/utils/scaffold/generators.ts"],"names":[],"mappings":"AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/utils/scaffold/generators.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,iEAAiE;AACjE,MAAM,UAAU,kBAAkB,CAAC,UAAuB;IACxD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC;;;EAGhB,CAAC,CAAC;IACF,CAAC;IAED,MAAM,OAAO,GAAa,CAAC,mCAAmC,EAAE,kCAAkC,CAAC,CAAC;IAEpG,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IAC1D,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC;;;EAGd,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;;;;;;;;;;;;;;;;;;;;;;CAsBrB,CAAC;AACF,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;CAWR,CAAC;AACF,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scaffold utilities
|
|
3
|
-
*
|
|
4
|
-
* Re-exports all scaffold-related functions for convenient importing.
|
|
2
|
+
* Scaffold utilities - re-exports for convenient importing.
|
|
5
3
|
*/
|
|
6
4
|
export { resolveFeatureDependencies, mergeDependencies, mergeScripts } from './dependencies.js';
|
|
5
|
+
export type { MergeDependenciesResult } from './dependencies.js';
|
|
7
6
|
export { computeFileStructure, getConfigFiles, readConfigFileContent } from './file-structure.js';
|
|
8
7
|
export { getSetupCommands } from './commands.js';
|
|
9
8
|
export { generateClaudeMd, generateViteEnvDts, generateEnvTs, generateRoutesTs } from './generators.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/scaffold/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/scaffold/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChG,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scaffold utilities
|
|
3
|
-
*
|
|
4
|
-
* Re-exports all scaffold-related functions for convenient importing.
|
|
2
|
+
* Scaffold utilities - re-exports for convenient importing.
|
|
5
3
|
*/
|
|
6
4
|
export { resolveFeatureDependencies, mergeDependencies, mergeScripts } from './dependencies.js';
|
|
7
5
|
export { computeFileStructure, getConfigFiles, readConfigFileContent } from './file-structure.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/scaffold/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/scaffold/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spa-scaffold/mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "MCP server for scaffolding projects based on react-spa-scaffold template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"zod": "^4.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^22.15.0",
|
|
47
46
|
"@react-spa-scaffold/tsconfig": "*",
|
|
47
|
+
"@types/node": "^22.15.0",
|
|
48
48
|
"typescript": "~5.9.0",
|
|
49
49
|
"vitest": "^4.0.16"
|
|
50
50
|
},
|