claudeship 0.2.23 → 0.2.25
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/apps/server/dist/chat/chat.module.js +8 -1
- package/apps/server/dist/chat/chat.module.js.map +1 -1
- package/apps/server/dist/chat/chat.service.d.ts +5 -1
- package/apps/server/dist/chat/chat.service.js +35 -4
- package/apps/server/dist/chat/chat.service.js.map +1 -1
- package/apps/server/dist/chat/framework-detector.service.d.ts +17 -0
- package/apps/server/dist/chat/framework-detector.service.js +193 -0
- package/apps/server/dist/chat/framework-detector.service.js.map +1 -0
- package/apps/server/dist/chat/prompts/backend/django.d.ts +1 -0
- package/apps/server/dist/chat/prompts/backend/django.js +207 -0
- package/apps/server/dist/chat/prompts/backend/django.js.map +1 -0
- package/apps/server/dist/chat/prompts/backend/express.d.ts +1 -0
- package/apps/server/dist/chat/prompts/backend/express.js +260 -0
- package/apps/server/dist/chat/prompts/backend/express.js.map +1 -0
- package/apps/server/dist/chat/prompts/backend/fastapi.d.ts +1 -0
- package/apps/server/dist/chat/prompts/backend/fastapi.js +246 -0
- package/apps/server/dist/chat/prompts/backend/fastapi.js.map +1 -0
- package/apps/server/dist/chat/prompts/backend/index.d.ts +4 -0
- package/apps/server/dist/chat/prompts/backend/index.js +12 -0
- package/apps/server/dist/chat/prompts/backend/index.js.map +1 -0
- package/apps/server/dist/chat/prompts/backend/nestjs.d.ts +1 -0
- package/apps/server/dist/chat/prompts/backend/nestjs.js +270 -0
- package/apps/server/dist/chat/prompts/backend/nestjs.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/expo.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/expo.js +208 -0
- package/apps/server/dist/chat/prompts/frontend/expo.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/flutter.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/flutter.js +271 -0
- package/apps/server/dist/chat/prompts/frontend/flutter.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/index.d.ts +4 -0
- package/apps/server/dist/chat/prompts/frontend/index.js +12 -0
- package/apps/server/dist/chat/prompts/frontend/index.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/nextjs.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/nextjs.js +195 -0
- package/apps/server/dist/chat/prompts/frontend/nextjs.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/react-native.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/react-native.js +224 -0
- package/apps/server/dist/chat/prompts/frontend/react-native.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/react-vite.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/react-vite.js +187 -0
- package/apps/server/dist/chat/prompts/frontend/react-vite.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/svelte.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/svelte.js +255 -0
- package/apps/server/dist/chat/prompts/frontend/svelte.js.map +1 -0
- package/apps/server/dist/chat/prompts/frontend/vue.d.ts +1 -0
- package/apps/server/dist/chat/prompts/frontend/vue.js +267 -0
- package/apps/server/dist/chat/prompts/frontend/vue.js.map +1 -0
- package/apps/server/dist/chat/prompts/index.d.ts +4 -0
- package/apps/server/dist/chat/prompts/index.js +20 -1
- package/apps/server/dist/chat/prompts/index.js.map +1 -1
- package/apps/server/dist/chat/prompts/prompt-builder.service.d.ts +15 -0
- package/apps/server/dist/chat/prompts/prompt-builder.service.js +177 -0
- package/apps/server/dist/chat/prompts/prompt-builder.service.js.map +1 -0
- package/apps/server/dist/chat/prompts/sections/core.d.ts +9 -0
- package/apps/server/dist/chat/prompts/sections/core.js +149 -0
- package/apps/server/dist/chat/prompts/sections/core.js.map +1 -0
- package/apps/server/dist/project/project.controller.d.ts +6 -0
- package/apps/server/dist/project/project.service.d.ts +6 -0
- package/apps/server/dist/tsconfig.tsbuildinfo +1 -1
- package/apps/server/package.json +1 -1
- package/apps/server/prisma/dev.db +0 -0
- package/apps/server/prisma/migrations/20260127071040_add_frontend_framework/migration.sql +24 -0
- package/apps/server/prisma/migrations/20260127071520_add_app_type_and_mobile/migration.sql +25 -0
- package/apps/server/prisma/schema.prisma +33 -5
- package/apps/web/.next/BUILD_ID +1 -1
- package/apps/web/.next/app-build-manifest.json +10 -8
- package/apps/web/.next/app-path-routes-manifest.json +2 -2
- package/apps/web/.next/build-manifest.json +2 -2
- package/apps/web/.next/cache/.previewinfo +1 -1
- package/apps/web/.next/cache/.rscinfo +1 -1
- package/apps/web/.next/cache/.tsbuildinfo +1 -1
- package/apps/web/.next/cache/config.json +3 -3
- package/apps/web/.next/cache/eslint/.cache_j3uhuz +1 -1
- package/apps/web/.next/cache/webpack/client-production/0.pack +0 -0
- package/apps/web/.next/cache/webpack/client-production/index.pack +0 -0
- package/apps/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/apps/web/.next/cache/webpack/server-production/0.pack +0 -0
- package/apps/web/.next/cache/webpack/server-production/index.pack +0 -0
- package/apps/web/.next/prerender-manifest.json +3 -3
- package/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/_not-found.html +1 -1
- package/apps/web/.next/server/app/_not-found.rsc +2 -2
- package/apps/web/.next/server/app/index.html +1 -1
- package/apps/web/.next/server/app/index.rsc +3 -3
- package/apps/web/.next/server/app/page.js +2 -2
- package/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/project/[id]/page.js +2 -2
- package/apps/web/.next/server/app/project/[id]/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/settings/page.js +1 -1
- package/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/apps/web/.next/server/app/settings.html +1 -1
- package/apps/web/.next/server/app/settings.rsc +2 -2
- package/apps/web/.next/server/app-paths-manifest.json +2 -2
- package/apps/web/.next/server/pages/404.html +1 -1
- package/apps/web/.next/server/pages/500.html +1 -1
- package/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/apps/web/.next/static/chunks/18-22b1cf4231121555.js +1 -0
- package/apps/web/.next/static/chunks/700-75e1212e819e279c.js +1 -0
- package/apps/web/.next/static/chunks/app/page-6ea560755549086e.js +1 -0
- package/apps/web/.next/static/chunks/app/project/[id]/page-3e4777b355c4aec9.js +1 -0
- package/apps/web/.next/static/css/45ddb08a7b4470d5.css +3 -0
- package/apps/web/.next/trace +18 -18
- package/apps/web/package.json +1 -1
- package/apps/web/src/app/page.tsx +2 -5
- package/apps/web/src/components/project/CreateProjectModal.tsx +175 -80
- package/apps/web/src/components/project/ProjectCard.tsx +122 -31
- package/apps/web/src/stores/useProjectStore.ts +2 -1
- package/package.json +1 -1
- package/packages/shared/src/index.ts +1 -0
- package/packages/shared/src/types/project.ts +18 -3
- package/packages/shared/src/types/tech-stack.ts +74 -0
- package/apps/web/.next/static/chunks/700-a927807facd2c50d.js +0 -1
- package/apps/web/.next/static/chunks/app/page-93b78578e7896d90.js +0 -1
- package/apps/web/.next/static/chunks/app/project/[id]/page-e9304c25ba897608.js +0 -1
- package/apps/web/.next/static/css/70f2a13cf3d254d8.css +0 -3
- /package/apps/web/.next/static/{c-H9phuqk4ohtFNK0geg2 → IMWKpuHss3gLOeJ7K93sg}/_buildManifest.js +0 -0
- /package/apps/web/.next/static/{c-H9phuqk4ohtFNK0geg2 → IMWKpuHss3gLOeJ7K93sg}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REACT_NATIVE_PROMPT = void 0;
|
|
4
|
+
exports.REACT_NATIVE_PROMPT = `## React Native Development Guide
|
|
5
|
+
|
|
6
|
+
### Project Structure
|
|
7
|
+
|
|
8
|
+
\`\`\`
|
|
9
|
+
frontend/
|
|
10
|
+
├── src/
|
|
11
|
+
│ ├── screens/ # Screen components
|
|
12
|
+
│ │ ├── HomeScreen.tsx
|
|
13
|
+
│ │ └── ProfileScreen.tsx
|
|
14
|
+
│ ├── components/ # Reusable components
|
|
15
|
+
│ │ ├── ui/ # Basic UI components
|
|
16
|
+
│ │ └── features/ # Feature-specific
|
|
17
|
+
│ ├── navigation/ # Navigation config
|
|
18
|
+
│ │ ├── RootNavigator.tsx
|
|
19
|
+
│ │ └── types.ts
|
|
20
|
+
│ ├── hooks/ # Custom hooks
|
|
21
|
+
│ ├── lib/ # Utilities
|
|
22
|
+
│ ├── stores/ # State management
|
|
23
|
+
│ └── types/ # TypeScript types
|
|
24
|
+
├── android/ # Android native code
|
|
25
|
+
├── ios/ # iOS native code
|
|
26
|
+
├── index.js # Entry point
|
|
27
|
+
├── App.tsx # Root component
|
|
28
|
+
├── package.json
|
|
29
|
+
├── metro.config.js
|
|
30
|
+
└── tsconfig.json
|
|
31
|
+
\`\`\`
|
|
32
|
+
|
|
33
|
+
### Essential Dependencies
|
|
34
|
+
|
|
35
|
+
\`\`\`json
|
|
36
|
+
{
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"react": "18.2.0",
|
|
39
|
+
"react-native": "0.74.0",
|
|
40
|
+
"@react-navigation/native": "^6.1.0",
|
|
41
|
+
"@react-navigation/native-stack": "^6.9.0",
|
|
42
|
+
"@react-navigation/bottom-tabs": "^6.5.0",
|
|
43
|
+
"react-native-screens": "^3.29.0",
|
|
44
|
+
"react-native-safe-area-context": "^4.8.0",
|
|
45
|
+
"react-native-gesture-handler": "^2.14.0",
|
|
46
|
+
"react-native-reanimated": "^3.6.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@babel/core": "^7.23.0",
|
|
50
|
+
"@babel/preset-env": "^7.23.0",
|
|
51
|
+
"@babel/runtime": "^7.23.0",
|
|
52
|
+
"@types/react": "^18.2.0",
|
|
53
|
+
"typescript": "^5.3.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
\`\`\`
|
|
57
|
+
|
|
58
|
+
### Navigation Setup
|
|
59
|
+
|
|
60
|
+
**Root Navigator**:
|
|
61
|
+
\`\`\`tsx
|
|
62
|
+
// src/navigation/RootNavigator.tsx
|
|
63
|
+
import { NavigationContainer } from "@react-navigation/native";
|
|
64
|
+
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
|
65
|
+
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|
66
|
+
|
|
67
|
+
const Stack = createNativeStackNavigator<RootStackParamList>();
|
|
68
|
+
const Tab = createBottomTabNavigator<TabParamList>();
|
|
69
|
+
|
|
70
|
+
function TabNavigator() {
|
|
71
|
+
return (
|
|
72
|
+
<Tab.Navigator>
|
|
73
|
+
<Tab.Screen name="Home" component={HomeScreen} />
|
|
74
|
+
<Tab.Screen name="Profile" component={ProfileScreen} />
|
|
75
|
+
</Tab.Navigator>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function RootNavigator() {
|
|
80
|
+
return (
|
|
81
|
+
<NavigationContainer>
|
|
82
|
+
<Stack.Navigator>
|
|
83
|
+
<Stack.Screen
|
|
84
|
+
name="Main"
|
|
85
|
+
component={TabNavigator}
|
|
86
|
+
options={{ headerShown: false }}
|
|
87
|
+
/>
|
|
88
|
+
<Stack.Screen name="Details" component={DetailsScreen} />
|
|
89
|
+
</Stack.Navigator>
|
|
90
|
+
</NavigationContainer>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
**Navigation Types**:
|
|
96
|
+
\`\`\`tsx
|
|
97
|
+
// src/navigation/types.ts
|
|
98
|
+
import type { NativeStackScreenProps } from "@react-navigation/native-stack";
|
|
99
|
+
|
|
100
|
+
export type RootStackParamList = {
|
|
101
|
+
Main: undefined;
|
|
102
|
+
Details: { id: string };
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type RootStackScreenProps<T extends keyof RootStackParamList> =
|
|
106
|
+
NativeStackScreenProps<RootStackParamList, T>;
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
### Screen Component Pattern
|
|
110
|
+
|
|
111
|
+
\`\`\`tsx
|
|
112
|
+
// src/screens/HomeScreen.tsx
|
|
113
|
+
import { StyleSheet, View, Text, FlatList } from "react-native";
|
|
114
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
115
|
+
import type { RootStackScreenProps } from "../navigation/types";
|
|
116
|
+
|
|
117
|
+
export function HomeScreen({ navigation }: RootStackScreenProps<"Main">) {
|
|
118
|
+
return (
|
|
119
|
+
<SafeAreaView style={styles.container}>
|
|
120
|
+
<Text style={styles.title}>Home</Text>
|
|
121
|
+
<FlatList
|
|
122
|
+
data={items}
|
|
123
|
+
keyExtractor={(item) => item.id}
|
|
124
|
+
renderItem={({ item }) => (
|
|
125
|
+
<TouchableOpacity
|
|
126
|
+
onPress={() => navigation.navigate("Details", { id: item.id })}
|
|
127
|
+
>
|
|
128
|
+
<ItemCard item={item} />
|
|
129
|
+
</TouchableOpacity>
|
|
130
|
+
)}
|
|
131
|
+
/>
|
|
132
|
+
</SafeAreaView>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
container: {
|
|
138
|
+
flex: 1,
|
|
139
|
+
backgroundColor: "#fff",
|
|
140
|
+
},
|
|
141
|
+
title: {
|
|
142
|
+
fontSize: 24,
|
|
143
|
+
fontWeight: "bold",
|
|
144
|
+
padding: 16,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
### API Communication
|
|
150
|
+
|
|
151
|
+
\`\`\`tsx
|
|
152
|
+
// src/lib/api.ts
|
|
153
|
+
import { Platform } from "react-native";
|
|
154
|
+
|
|
155
|
+
// Android emulator uses 10.0.2.2 for localhost
|
|
156
|
+
const getBaseUrl = () => {
|
|
157
|
+
if (__DEV__) {
|
|
158
|
+
return Platform.OS === "android"
|
|
159
|
+
? "http://10.0.2.2:3001"
|
|
160
|
+
: "http://localhost:3001";
|
|
161
|
+
}
|
|
162
|
+
return "https://api.example.com";
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const API_URL = getBaseUrl();
|
|
166
|
+
|
|
167
|
+
export async function fetcher<T>(endpoint: string, options?: RequestInit): Promise<T> {
|
|
168
|
+
const response = await fetch(\`\${API_URL}\${endpoint}\`, {
|
|
169
|
+
headers: {
|
|
170
|
+
"Content-Type": "application/json",
|
|
171
|
+
...options?.headers,
|
|
172
|
+
},
|
|
173
|
+
...options,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!response.ok) {
|
|
177
|
+
throw new Error(\`API Error: \${response.status}\`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return response.json();
|
|
181
|
+
}
|
|
182
|
+
\`\`\`
|
|
183
|
+
|
|
184
|
+
### Critical Rules
|
|
185
|
+
|
|
186
|
+
1. **Use SafeAreaView** from react-native-safe-area-context
|
|
187
|
+
2. **Use FlatList** for lists, not ScrollView with map
|
|
188
|
+
3. **Handle Android back button** with BackHandler
|
|
189
|
+
4. **Test on both platforms** - iOS Simulator and Android Emulator
|
|
190
|
+
5. **Use StyleSheet.create** for performance
|
|
191
|
+
6. **Handle keyboard** with KeyboardAvoidingView
|
|
192
|
+
|
|
193
|
+
### Platform-Specific Code
|
|
194
|
+
|
|
195
|
+
\`\`\`tsx
|
|
196
|
+
import { Platform, StyleSheet } from "react-native";
|
|
197
|
+
|
|
198
|
+
const styles = StyleSheet.create({
|
|
199
|
+
shadow: Platform.select({
|
|
200
|
+
ios: {
|
|
201
|
+
shadowColor: "#000",
|
|
202
|
+
shadowOffset: { width: 0, height: 2 },
|
|
203
|
+
shadowOpacity: 0.1,
|
|
204
|
+
shadowRadius: 4,
|
|
205
|
+
},
|
|
206
|
+
android: {
|
|
207
|
+
elevation: 4,
|
|
208
|
+
},
|
|
209
|
+
}),
|
|
210
|
+
});
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
### Package Scripts
|
|
214
|
+
|
|
215
|
+
\`\`\`json
|
|
216
|
+
{
|
|
217
|
+
"scripts": {
|
|
218
|
+
"dev": "react-native start",
|
|
219
|
+
"android": "react-native run-android",
|
|
220
|
+
"ios": "react-native run-ios"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
\`\`\``;
|
|
224
|
+
//# sourceMappingURL=react-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../../src/chat/prompts/frontend/react-native.ts"],"names":[],"mappings":";;;AAIa,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2N5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REACT_VITE_PROMPT = "## Frontend: React + Vite + Tailwind CSS\n\nYou are building a React application using Vite as the build tool and Tailwind CSS for styling.\n\n### Technology Stack (Frontend)\n\n| Category | Technology | Notes |\n|----------|------------|-------|\n| Build Tool | Vite | Fast HMR and build |\n| Framework | React 18+ | Functional components with hooks |\n| Language | TypeScript | Strict mode |\n| UI Components | shadcn/ui | Install: `npx shadcn@latest add <component>` |\n| Styling | Tailwind CSS | Use design tokens |\n| State | Zustand | For global state |\n| Forms | React Hook Form + Zod | For validation |\n| Icons | Lucide React | Consistent iconography |\n| Routing | React Router | Client-side routing |\n\n### Project Initialization\n\n```bash\n# Create Vite project\nnpm create vite@latest . -- --template react-ts\n\n# Install dependencies\nnpm install react-router-dom zustand lucide-react clsx tailwind-merge\nnpm install react-hook-form @hookform/resolvers zod\n\n# Setup Tailwind CSS\nnpm install -D tailwindcss postcss autoprefixer\nnpx tailwindcss init -p\n\n# Initialize shadcn/ui\nnpx shadcn@latest init -d\n```\n\n### Project Structure\n\n```\nsrc/\n\u251C\u2500\u2500 components/\n\u2502 \u251C\u2500\u2500 ui/ # shadcn/ui components\n\u2502 \u2514\u2500\u2500 [feature]/ # Feature-specific components\n\u251C\u2500\u2500 pages/ # Page components\n\u251C\u2500\u2500 hooks/ # Custom React hooks\n\u251C\u2500\u2500 lib/\n\u2502 \u251C\u2500\u2500 utils.ts # cn() helper\n\u2502 \u2514\u2500\u2500 api.ts # API client (if backend exists)\n\u251C\u2500\u2500 store/ # Zustand stores\n\u251C\u2500\u2500 types/ # TypeScript types\n\u251C\u2500\u2500 App.tsx # Main app with router\n\u251C\u2500\u2500 main.tsx # Entry point\n\u2514\u2500\u2500 index.css # Tailwind imports\n```\n\n### Vite Configuration\n\n```typescript\n// vite.config.ts\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\nimport path from 'path';\n\nexport default defineConfig({\n plugins: [react()],\n resolve: {\n alias: {\n '@': path.resolve(__dirname, './src'),\n },\n },\n server: {\n port: 3000,\n proxy: {\n '/api': {\n target: 'http://localhost:3001',\n changeOrigin: true,\n },\n },\n },\n});\n```\n\n### Router Setup\n\n```typescript\n// src/App.tsx\nimport { BrowserRouter, Routes, Route } from 'react-router-dom';\nimport { Layout } from '@/components/Layout';\nimport { HomePage } from '@/pages/HomePage';\nimport { AboutPage } from '@/pages/AboutPage';\n\nexport default function App() {\n return (\n <BrowserRouter>\n <Layout>\n <Routes>\n <Route path=\"/\" element={<HomePage />} />\n <Route path=\"/about\" element={<AboutPage />} />\n </Routes>\n </Layout>\n </BrowserRouter>\n );\n}\n```\n\n### State Management (Zustand)\n\n```typescript\n// src/store/useStore.ts\nimport { create } from 'zustand';\n\ninterface AppState {\n user: User | null;\n setUser: (user: User | null) => void;\n isLoading: boolean;\n setLoading: (loading: boolean) => void;\n}\n\nexport const useStore = create<AppState>((set) => ({\n user: null,\n setUser: (user) => set({ user }),\n isLoading: false,\n setLoading: (isLoading) => set({ isLoading }),\n}));\n```\n\n### API Client Pattern\n\n```typescript\n// src/lib/api.ts\nconst API_URL = import.meta.env.VITE_API_URL || '/api';\n\nclass ApiClient {\n async get<T>(endpoint: string): Promise<T> {\n const res = await fetch(`${API_URL}${endpoint}`);\n if (!res.ok) throw new Error(`API Error: ${res.status}`);\n return res.json();\n }\n\n async post<T>(endpoint: string, data: unknown): Promise<T> {\n const res = await fetch(`${API_URL}${endpoint}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(data),\n });\n if (!res.ok) throw new Error(`API Error: ${res.status}`);\n return res.json();\n }\n}\n\nexport const api = new ApiClient();\n```\n\n### UI/UX Requirements\n\n- Use semantic HTML (header, main, footer, nav, section)\n- Implement responsive design (mobile-first)\n- Use shadcn/ui Button, Card, Input, etc.\n- Add hover/focus states for interactive elements\n- Include loading spinners for async operations\n- Show toast notifications for user feedback\n\n### Header/Navbar Best Practices\n\n- **NEVER use `container` class for headers** - it creates max-width gaps on wide screens\n- Use `w-full` for full-width headers that span the entire viewport\n\n```tsx\n// GOOD: Full-width header\n<header className=\"sticky top-0 z-50 border-b bg-background\">\n <div className=\"flex h-14 w-full items-center justify-between px-4\">\n {/* Logo on left, Nav on right */}\n </div>\n</header>\n```\n\n### React Best Practices\n\n- **Custom hooks** for logic reuse (`useAuth`, `useProducts`)\n- **Memoization** for expensive operations (`useMemo`, `useCallback`)\n- **Proper dependency arrays** in useEffect\n- **Loading/Error states**: Always handle loading, error, and empty states\n- **Lazy loading** for code splitting with `React.lazy()`";
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REACT_VITE_PROMPT = void 0;
|
|
4
|
+
exports.REACT_VITE_PROMPT = `## Frontend: React + Vite + Tailwind CSS
|
|
5
|
+
|
|
6
|
+
You are building a React application using Vite as the build tool and Tailwind CSS for styling.
|
|
7
|
+
|
|
8
|
+
### Technology Stack (Frontend)
|
|
9
|
+
|
|
10
|
+
| Category | Technology | Notes |
|
|
11
|
+
|----------|------------|-------|
|
|
12
|
+
| Build Tool | Vite | Fast HMR and build |
|
|
13
|
+
| Framework | React 18+ | Functional components with hooks |
|
|
14
|
+
| Language | TypeScript | Strict mode |
|
|
15
|
+
| UI Components | shadcn/ui | Install: \`npx shadcn@latest add <component>\` |
|
|
16
|
+
| Styling | Tailwind CSS | Use design tokens |
|
|
17
|
+
| State | Zustand | For global state |
|
|
18
|
+
| Forms | React Hook Form + Zod | For validation |
|
|
19
|
+
| Icons | Lucide React | Consistent iconography |
|
|
20
|
+
| Routing | React Router | Client-side routing |
|
|
21
|
+
|
|
22
|
+
### Project Initialization
|
|
23
|
+
|
|
24
|
+
\`\`\`bash
|
|
25
|
+
# Create Vite project
|
|
26
|
+
npm create vite@latest . -- --template react-ts
|
|
27
|
+
|
|
28
|
+
# Install dependencies
|
|
29
|
+
npm install react-router-dom zustand lucide-react clsx tailwind-merge
|
|
30
|
+
npm install react-hook-form @hookform/resolvers zod
|
|
31
|
+
|
|
32
|
+
# Setup Tailwind CSS
|
|
33
|
+
npm install -D tailwindcss postcss autoprefixer
|
|
34
|
+
npx tailwindcss init -p
|
|
35
|
+
|
|
36
|
+
# Initialize shadcn/ui
|
|
37
|
+
npx shadcn@latest init -d
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
### Project Structure
|
|
41
|
+
|
|
42
|
+
\`\`\`
|
|
43
|
+
src/
|
|
44
|
+
├── components/
|
|
45
|
+
│ ├── ui/ # shadcn/ui components
|
|
46
|
+
│ └── [feature]/ # Feature-specific components
|
|
47
|
+
├── pages/ # Page components
|
|
48
|
+
├── hooks/ # Custom React hooks
|
|
49
|
+
├── lib/
|
|
50
|
+
│ ├── utils.ts # cn() helper
|
|
51
|
+
│ └── api.ts # API client (if backend exists)
|
|
52
|
+
├── store/ # Zustand stores
|
|
53
|
+
├── types/ # TypeScript types
|
|
54
|
+
├── App.tsx # Main app with router
|
|
55
|
+
├── main.tsx # Entry point
|
|
56
|
+
└── index.css # Tailwind imports
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
### Vite Configuration
|
|
60
|
+
|
|
61
|
+
\`\`\`typescript
|
|
62
|
+
// vite.config.ts
|
|
63
|
+
import { defineConfig } from 'vite';
|
|
64
|
+
import react from '@vitejs/plugin-react';
|
|
65
|
+
import path from 'path';
|
|
66
|
+
|
|
67
|
+
export default defineConfig({
|
|
68
|
+
plugins: [react()],
|
|
69
|
+
resolve: {
|
|
70
|
+
alias: {
|
|
71
|
+
'@': path.resolve(__dirname, './src'),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
server: {
|
|
75
|
+
port: 3000,
|
|
76
|
+
proxy: {
|
|
77
|
+
'/api': {
|
|
78
|
+
target: 'http://localhost:3001',
|
|
79
|
+
changeOrigin: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
### Router Setup
|
|
87
|
+
|
|
88
|
+
\`\`\`typescript
|
|
89
|
+
// src/App.tsx
|
|
90
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
91
|
+
import { Layout } from '@/components/Layout';
|
|
92
|
+
import { HomePage } from '@/pages/HomePage';
|
|
93
|
+
import { AboutPage } from '@/pages/AboutPage';
|
|
94
|
+
|
|
95
|
+
export default function App() {
|
|
96
|
+
return (
|
|
97
|
+
<BrowserRouter>
|
|
98
|
+
<Layout>
|
|
99
|
+
<Routes>
|
|
100
|
+
<Route path="/" element={<HomePage />} />
|
|
101
|
+
<Route path="/about" element={<AboutPage />} />
|
|
102
|
+
</Routes>
|
|
103
|
+
</Layout>
|
|
104
|
+
</BrowserRouter>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
### State Management (Zustand)
|
|
110
|
+
|
|
111
|
+
\`\`\`typescript
|
|
112
|
+
// src/store/useStore.ts
|
|
113
|
+
import { create } from 'zustand';
|
|
114
|
+
|
|
115
|
+
interface AppState {
|
|
116
|
+
user: User | null;
|
|
117
|
+
setUser: (user: User | null) => void;
|
|
118
|
+
isLoading: boolean;
|
|
119
|
+
setLoading: (loading: boolean) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const useStore = create<AppState>((set) => ({
|
|
123
|
+
user: null,
|
|
124
|
+
setUser: (user) => set({ user }),
|
|
125
|
+
isLoading: false,
|
|
126
|
+
setLoading: (isLoading) => set({ isLoading }),
|
|
127
|
+
}));
|
|
128
|
+
\`\`\`
|
|
129
|
+
|
|
130
|
+
### API Client Pattern
|
|
131
|
+
|
|
132
|
+
\`\`\`typescript
|
|
133
|
+
// src/lib/api.ts
|
|
134
|
+
const API_URL = import.meta.env.VITE_API_URL || '/api';
|
|
135
|
+
|
|
136
|
+
class ApiClient {
|
|
137
|
+
async get<T>(endpoint: string): Promise<T> {
|
|
138
|
+
const res = await fetch(\`\${API_URL}\${endpoint}\`);
|
|
139
|
+
if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
|
|
140
|
+
return res.json();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async post<T>(endpoint: string, data: unknown): Promise<T> {
|
|
144
|
+
const res = await fetch(\`\${API_URL}\${endpoint}\`, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers: { 'Content-Type': 'application/json' },
|
|
147
|
+
body: JSON.stringify(data),
|
|
148
|
+
});
|
|
149
|
+
if (!res.ok) throw new Error(\`API Error: \${res.status}\`);
|
|
150
|
+
return res.json();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const api = new ApiClient();
|
|
155
|
+
\`\`\`
|
|
156
|
+
|
|
157
|
+
### UI/UX Requirements
|
|
158
|
+
|
|
159
|
+
- Use semantic HTML (header, main, footer, nav, section)
|
|
160
|
+
- Implement responsive design (mobile-first)
|
|
161
|
+
- Use shadcn/ui Button, Card, Input, etc.
|
|
162
|
+
- Add hover/focus states for interactive elements
|
|
163
|
+
- Include loading spinners for async operations
|
|
164
|
+
- Show toast notifications for user feedback
|
|
165
|
+
|
|
166
|
+
### Header/Navbar Best Practices
|
|
167
|
+
|
|
168
|
+
- **NEVER use \`container\` class for headers** - it creates max-width gaps on wide screens
|
|
169
|
+
- Use \`w-full\` for full-width headers that span the entire viewport
|
|
170
|
+
|
|
171
|
+
\`\`\`tsx
|
|
172
|
+
// GOOD: Full-width header
|
|
173
|
+
<header className="sticky top-0 z-50 border-b bg-background">
|
|
174
|
+
<div className="flex h-14 w-full items-center justify-between px-4">
|
|
175
|
+
{/* Logo on left, Nav on right */}
|
|
176
|
+
</div>
|
|
177
|
+
</header>
|
|
178
|
+
\`\`\`
|
|
179
|
+
|
|
180
|
+
### React Best Practices
|
|
181
|
+
|
|
182
|
+
- **Custom hooks** for logic reuse (\`useAuth\`, \`useProducts\`)
|
|
183
|
+
- **Memoization** for expensive operations (\`useMemo\`, \`useCallback\`)
|
|
184
|
+
- **Proper dependency arrays** in useEffect
|
|
185
|
+
- **Loading/Error states**: Always handle loading, error, and empty states
|
|
186
|
+
- **Lazy loading** for code splitting with \`React.lazy()\``;
|
|
187
|
+
//# sourceMappingURL=react-vite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-vite.js","sourceRoot":"","sources":["../../../../src/chat/prompts/frontend/react-vite.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAsL2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SVELTE_PROMPT = "## Frontend: SvelteKit + Tailwind CSS\n\nYou are building a SvelteKit application with Tailwind CSS.\n\n### Technology Stack (Frontend)\n\n| Category | Technology | Notes |\n|----------|------------|-------|\n| Framework | SvelteKit | File-based routing |\n| Language | TypeScript | Strict mode |\n| Styling | Tailwind CSS | Use design tokens |\n| State | Svelte stores | Built-in reactivity |\n| Forms | Superforms + Zod | For validation |\n| Icons | Lucide Svelte | Consistent iconography |\n\n### Project Initialization\n\n```bash\n# Create SvelteKit project\nnpx sv create . --template minimal --types ts\n\n# Install dependencies\nnpm install lucide-svelte clsx tailwind-merge\nnpm install sveltekit-superforms zod\n\n# Setup Tailwind CSS\nnpx svelte-add@latest tailwindcss\n```\n\n### Project Structure\n\n```\nsrc/\n\u251C\u2500\u2500 routes/\n\u2502 \u251C\u2500\u2500 +layout.svelte # Root layout\n\u2502 \u251C\u2500\u2500 +page.svelte # Home page\n\u2502 \u251C\u2500\u2500 +error.svelte # Error page\n\u2502 \u251C\u2500\u2500 about/\n\u2502 \u2502 \u2514\u2500\u2500 +page.svelte\n\u2502 \u2514\u2500\u2500 api/ # API routes\n\u2502 \u2514\u2500\u2500 users/\n\u2502 \u2514\u2500\u2500 +server.ts\n\u251C\u2500\u2500 lib/\n\u2502 \u251C\u2500\u2500 components/ # Reusable components\n\u2502 \u2502 \u2514\u2500\u2500 ui/\n\u2502 \u251C\u2500\u2500 stores/ # Svelte stores\n\u2502 \u2514\u2500\u2500 utils.ts # Utilities\n\u251C\u2500\u2500 app.html # HTML template\n\u251C\u2500\u2500 app.css # Global styles\n\u2514\u2500\u2500 app.d.ts # Type declarations\n```\n\n### Component Pattern\n\n```svelte\n<!-- src/lib/components/UserCard.svelte -->\n<script lang=\"ts\">\n import type { User } from '$lib/types';\n\n export let user: User;\n export let showEmail = true;\n\n $: initials = user.name\n .split(' ')\n .map((n) => n[0])\n .join('')\n .toUpperCase();\n\n import { createEventDispatcher } from 'svelte';\n const dispatch = createEventDispatcher<{ select: User }>();\n\n const handleClick = () => {\n dispatch('select', user);\n };\n</script>\n\n<div\n class=\"p-4 border rounded-lg hover:border-primary cursor-pointer\"\n on:click={handleClick}\n on:keypress={handleClick}\n role=\"button\"\n tabindex=\"0\"\n>\n <div class=\"flex items-center gap-3\">\n <div class=\"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center\">\n {initials}\n </div>\n <div>\n <h3 class=\"font-medium\">{user.name}</h3>\n {#if showEmail}\n <p class=\"text-sm text-muted-foreground\">{user.email}</p>\n {/if}\n </div>\n </div>\n</div>\n```\n\n### Svelte Store\n\n```typescript\n// src/lib/stores/userStore.ts\nimport { writable, derived } from 'svelte/store';\nimport type { User } from '$lib/types';\n\nfunction createUserStore() {\n const users = writable<User[]>([]);\n const isLoading = writable(false);\n const error = writable<string | null>(null);\n\n const userCount = derived(users, ($users) => $users.length);\n\n async function fetchUsers() {\n isLoading.set(true);\n error.set(null);\n try {\n const res = await fetch('/api/users');\n if (!res.ok) throw new Error('Failed to fetch');\n users.set(await res.json());\n } catch (e) {\n error.set(e instanceof Error ? e.message : 'Unknown error');\n } finally {\n isLoading.set(false);\n }\n }\n\n return {\n users,\n isLoading,\n error,\n userCount,\n fetchUsers,\n };\n}\n\nexport const userStore = createUserStore();\n```\n\n### Page Load Data\n\n```typescript\n// src/routes/users/+page.server.ts\nimport type { PageServerLoad } from './$types';\nimport { db } from '$lib/server/db';\n\nexport const load: PageServerLoad = async () => {\n const users = await db.user.findMany();\n return { users };\n};\n```\n\n```svelte\n<!-- src/routes/users/+page.svelte -->\n<script lang=\"ts\">\n import type { PageData } from './$types';\n import UserCard from '$lib/components/UserCard.svelte';\n\n export let data: PageData;\n</script>\n\n<div class=\"container mx-auto py-8\">\n <h1 class=\"text-2xl font-bold mb-6\">Users</h1>\n <div class=\"grid gap-4 md:grid-cols-2 lg:grid-cols-3\">\n {#each data.users as user (user.id)}\n <UserCard {user} />\n {/each}\n </div>\n</div>\n```\n\n### API Routes\n\n```typescript\n// src/routes/api/users/+server.ts\nimport { json } from '@sveltejs/kit';\nimport type { RequestHandler } from './$types';\nimport { db } from '$lib/server/db';\n\nexport const GET: RequestHandler = async () => {\n const users = await db.user.findMany();\n return json(users);\n};\n\nexport const POST: RequestHandler = async ({ request }) => {\n const body = await request.json();\n const user = await db.user.create({ data: body });\n return json(user, { status: 201 });\n};\n```\n\n### Form Actions\n\n```typescript\n// src/routes/contact/+page.server.ts\nimport type { Actions } from './$types';\nimport { fail } from '@sveltejs/kit';\n\nexport const actions: Actions = {\n default: async ({ request }) => {\n const formData = await request.formData();\n const email = formData.get('email') as string;\n const message = formData.get('message') as string;\n\n if (!email || !message) {\n return fail(400, { error: 'All fields are required' });\n }\n\n // Process form...\n\n return { success: true };\n },\n};\n```\n\n```svelte\n<!-- src/routes/contact/+page.svelte -->\n<script lang=\"ts\">\n import type { ActionData } from './$types';\n import { enhance } from '$app/forms';\n\n export let form: ActionData;\n</script>\n\n<form method=\"POST\" use:enhance>\n <input name=\"email\" type=\"email\" required />\n <textarea name=\"message\" required />\n <button type=\"submit\">Send</button>\n\n {#if form?.error}\n <p class=\"text-red-500\">{form.error}</p>\n {/if}\n {#if form?.success}\n <p class=\"text-green-500\">Message sent!</p>\n {/if}\n</form>\n```\n\n### Svelte Best Practices\n\n- **Use `$:` for reactive statements** - Svelte's reactivity is automatic\n- **Prefer stores for shared state** - Use writable/readable/derived appropriately\n- **Use `{#each}` with keys** - Always provide key for lists\n- **Server load functions** - Fetch data on server when possible\n- **Form actions** - Use SvelteKit form actions for mutations\n- **`use:enhance`** - Progressive enhancement for forms\n\n### What NOT to Do (Svelte specific)\n\n- Never use React/Vue patterns - Svelte has its own idioms\n- Never forget to export props with `export let`\n- Never mutate store values directly - use `.set()` or `.update()`\n- Never skip `$:` for reactive statements";
|