Skip to content

Commit 0d12c7c

Browse files
committed
Fix terminal command execution with proper working directory support
- Updated runShellCommand to accept optional cwd parameter - Modified response processor to use cwd parameter instead of cd commands - This ensures backend terminal commands execute in the correct directory - Fixes issues with Django migrations and other backend commands failing
1 parent 3738bfc commit 0d12c7c

File tree

4 files changed

+71
-106
lines changed

4 files changed

+71
-106
lines changed

scaffold/AI_RULES.md

Lines changed: 58 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,80 @@
1-
<!-- # Tech Stack
2-
- You are building a React application.
3-
- Use TypeScript.
4-
- Use React Router. KEEP the routes in src/App.tsx
5-
- Always put source code in the src folder.
6-
- Put pages into src/pages/
7-
- Put components into src/components/
8-
- The main page (default page) is src/pages/Index.tsx
9-
- UPDATE the main page to include the new components. OTHERWISE, the user can NOT see any components!
10-
- ALWAYS try to use the shadcn/ui library.
11-
- Tailwind CSS: always use Tailwind CSS for styling components. Utilize Tailwind classes extensively for layout, spacing, colors, and other design aspects.
12-
13-
Available packages and libraries:
14-
15-
- The lucide-react package is installed for icons.
16-
- The date-fns package is installed for date/time manipulation.
17-
- The uuid package is installed for generating unique identifiers.
18-
- The leaflet and react-leaflet packages are installed for interactive maps.
19-
- The axios package is installed for HTTP requests.
20-
- You ALREADY have ALL the shadcn/ui components and their dependencies installed. So you don't need to install them again.
21-
- You have ALL the necessary Radix UI components installed.
22-
- Use prebuilt components from the shadcn/ui library after importing them. Note that these files shouldn't be edited, so make new components if you need to change them. -->
23-
24-
25-
# Extended Tech & AI Development Rules
26-
27-
## TL;DR Quick Rules
28-
- Use **React + TypeScript**.
29-
- Keep routes in `src/App.tsx`.
30-
- Pages → `src/pages/`, Components → `src/components/`.
31-
- Default page → `src/pages/Index.tsx`. Always update Index to show new components.
32-
- Use **Tailwind CSS** for styling. Prefer gradients, glassmorphism, subtle animations.
33-
<!-- - Default to **shadcn/ui** components. Use **Radix UI** primitives when needed. -->
34-
- Default to **MUI** components. Use **shadcn/ui** or **Radix UI** primitives when needed.
35-
- Use **Framer Motion** for animations & transitions.
36-
- Use **react-query** for API calls. Prefer `react-hook-form + zod` for forms.
37-
- Use **sonner** or **react-hot-toast** for notifications.
38-
- Ensure **dark mode** and **responsiveness** for all components.
39-
- Follow **strict TypeScript** and **atomic design principles**.
40-
- Optimize with lazy loading and performance best practices.
1+
# AI_RULES.md
2+
3+
## 3D Landing Page Development Rules (Webflow-like with Modern 3D)
4+
5+
These rules define how to create a **modern 3D landing page** with Webflow-like aesthetics using **React, TypeScript, Tailwind CSS, and open-source 3D libraries** such as Three.js, React Three Fiber, and Spline alternatives.
416

427
---
8+
439
## Core Tech Stack
44-
- **React (TypeScript)** for building the application.
45-
- **React Router** for routing. Keep routes defined in `src/App.tsx`.
46-
- **File structure**:
47-
- Source code → `src/`
48-
- Pages → `src/pages/`
49-
- Components → `src/components/`
50-
- Main page (default page) → `src/pages/Index.tsx`
51-
- **Update `Index.tsx`** whenever new components are created, otherwise they won’t be visible.
52-
- **Styling**:
53-
- Use **Tailwind CSS** for all styling.
54-
- Utilize **utility classes** for spacing, colors, layouts, gradients, transitions, and shadows.
55-
- Follow **modern design principles**: clean UI, white space, gradients, subtle glassmorphism, and motion.
10+
- **React + TypeScript** (strict mode).
11+
- **React Three Fiber (r3f)** for Three.js integration.
12+
- **@react-three/drei** for helpers, controls, and loaders.
13+
- **Framer Motion** for UI/UX animations & transitions.
14+
- **Tailwind CSS** for responsive layout and styling.
15+
- **shadcn/ui** for UI components (navigation, buttons, forms).
16+
- **Radix UI** primitives when needed.
17+
- **react-query** for data fetching (if APIs are needed).
18+
- **sonner** or **react-hot-toast** for notifications.
5619

5720
---
5821

59-
## UI/UX Component Libraries
60-
- **shadcn/ui** → primary component library.
61-
- **Radix UI** → for low-level primitives (accessible modals, popovers, menus).
62-
- **lucide-react** → for modern, lightweight icons.
22+
## File & Code Organization
23+
- `src/pages/` → All main page layouts.
24+
- `src/components/` → UI components (Hero, Navbar, Footer, CTA).
25+
- `src/components/3d/` → 3D scene components (CanvasWrapper, HeroScene, Models).
26+
- `src/assets/models/` → GLTF/GLB models and textures.
27+
- `src/hooks/` → Custom hooks (e.g., useResponsive3D, useAnimations).
28+
- `src/styles/` → Tailwind configurations and global styles.
6329

6430
---
6531

66-
## Additional Recommended Open-Source Libraries
67-
- **Framer Motion** → animations & transitions (cards, modals, page transitions, staggered lists).
68-
- **react-spring** → physics-based animations (optional alternative to Framer Motion).
69-
- **tailwindcss-animate** → prebuilt animation utilities for Tailwind.
70-
- **tailwind-variants** or **class-variance-authority (CVA)** → manage Tailwind component variants.
71-
- **tailwind-gradient-mask-image** → gradient masking utilities.
72-
- **tailwindcss-gradients / tailwind-gradient-generator** → gradient utilities for vibrant UI.
73-
- **tailwindcss-fluid-type** → fluid typography scaling across breakpoints.
74-
- **react-awesome-reveal** → reveal-on-scroll animations.
75-
- **react-wrap-balancer** → better text wrapping for responsive layouts.
76-
- **react-hot-toast** or **sonner** → modern, minimal toast notifications.
32+
## 3D & Animation Rules
33+
1. Use **React Three Fiber** for all 3D rendering.
34+
2. Use **drei helpers** (OrbitControls, Environment, Text, ContactShadows).
35+
3. Optimize 3D models before adding (Blender, glTF compression).
36+
4. Always wrap the 3D scene inside a `CanvasWrapper` with lazy loading + suspense.
37+
5. Use **Framer Motion** for UI overlays and transitions.
38+
6. Keep animations smooth (60fps target, GPU accelerated).
39+
7. Favor **lightweight materials & baked lighting** for performance.
40+
8. Use **responsive scaling** for 3D objects across devices.
41+
9. Consider **scroll-based animations** using `react-scroll` or `framer-motion`.
7742

7843
---
7944

80-
## Visualization & Data Display
81-
- **Recharts** or **Nivo** → interactive and modern charts.
82-
- **react-leaflet** → maps (already installed).
83-
- **react-confetti** or **canvas-confetti** → celebratory UI moments (gamification touch).
45+
## Modern Design Guidelines
46+
- **Hero Section** → Fullscreen 3D canvas with a call-to-action overlay.
47+
- **Navigation** → Sticky navbar with smooth scroll + animated underline.
48+
- **Sections** → Use gradient backgrounds + glassmorphism cards.
49+
- **Typography** → Modern sans-serif with Tailwind presets.
50+
- **Animations** → Subtle parallax, hover effects, microinteractions.
51+
- **Dark Mode** → Ensure 3D scenes + UI adapt to dark/light themes.
52+
- **Responsiveness** → Test across mobile, tablet, and desktop.
8453

8554
---
8655

87-
## Forms & Validation
88-
- **react-hook-form** → lightweight form handling.
89-
- **zod** → schema validation, can be paired with react-hook-form.
90-
- **@tanstack/react-query** → API data fetching, caching, optimistic updates.
56+
## Performance Rules
57+
1. Use **GLTF/GLB** optimized models only.
58+
2. Use `useMemo` and `useFrame` wisely for animations.
59+
3. Leverage `drei/PerformanceMonitor` for adaptive quality.
60+
4. Enable **lazy loading** for 3D models & textures.
61+
5. Compress assets (images → WebP/AVIF, models → Draco/Basis).
62+
6. Run **Lighthouse CI** for performance audits.
9163

9264
---
9365

94-
## Animations & Effects (Modern SaaS Feel)
95-
- Use **Framer Motion** for page transitions, modals, and list animations.
96-
- Add **gradient backgrounds** (Tailwind + gradient utilities).
97-
- Use **glassmorphism overlays** (blurred translucent cards).
98-
- Add **micro-interactions** → hover states, animated icons, small feedback animations.
99-
- Add **parallax effects** with `react-scroll-parallax` for modern landing pages.
100-
- Implement **dark mode** using Tailwind’s `dark:` utilities.
66+
## Deployment & Build
67+
- Deploy via **Vercel/Netlify** with CDN asset hosting.
68+
- Preload critical assets but lazy load non-essentials.
69+
- Ensure PWA support (manifest.json, service worker).
70+
- Add SEO meta tags and Open Graph tags.
10171

10272
---
10373

104-
## AI Rules (Extended)
105-
1. Always prioritize **accessibility** (ARIA roles, keyboard navigation).
106-
2. Default to **shadcn/ui** components. Extend only with modern libraries when needed.
107-
3. **Animations should be smooth & subtle**, not overwhelming (300–500ms duration).
108-
4. Use **gradients & glass effects** sparingly for clean SaaS aesthetics.
109-
5. Use **react-query** for API calls instead of raw axios unless custom logic is required.
110-
6. **Forms**: Always use `react-hook-form` with `zod` for validation.
111-
7. **Notifications**: Use `sonner` or `react-hot-toast` for toast alerts.
112-
8. **Charts/Visuals**: Use **Recharts/Nivo** for analytics dashboards.
113-
9. **Dark mode support** is required for every new component.
114-
10. Place reusable utilities (hooks, helpers) under `src/lib/` or `src/hooks/`.
115-
11. Write code in **strict TypeScript** (avoid `any`).
116-
12. Follow **atomic design principles**: build small components, compose into pages.
117-
13. Ensure **responsiveness** across mobile, tablet, desktop.
118-
14. Use **lazy loading** (`React.lazy`) for heavy components (charts, maps).
119-
15. Optimize for **performance**: prefer Tailwind classes, avoid unnecessary re-renders.
74+
## TL;DR Quick Setup
75+
- `CanvasWrapper` + `HeroScene` in `src/components/3d/`.
76+
- Navbar, Hero, Features, CTA, Footer inside `src/pages/Index.tsx`.
77+
- Use **r3f + drei** for 3D, **Framer Motion** for UI, **Tailwind** for styling.
78+
- Optimize models and test performance with Lighthouse.
12079

121-
---
80+
---

scaffold/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@
6464
"typescript": "^5.5.3",
6565
"uuid": "^10.0.0",
6666
"vaul": "^0.9.3",
67-
"zod": "^3.23.8"
67+
"zod": "^3.23.8",
68+
"@react-three/drei": "^9.88.13",
69+
"@react-three/fiber": "^8.15.12",
70+
"framer-motion": "^11.2.12",
71+
"three": "^0.158.0"
6872
},
6973
"devDependencies": {
7074
"@dyad-sh/react-vite-component-tagger": "^0.8.0",
@@ -75,6 +79,7 @@
7579
"@types/react": "^18.3.3",
7680
"@types/react-dom": "^18.3.0",
7781
"@types/uuid": "^10.0.0",
82+
"@types/three": "^0.158.0",
7883
"@vitejs/plugin-react": "^4.3.1",
7984
"autoprefixer": "^10.4.20",
8085
"eslint": "^9.9.0",

src/ipc/processors/response_processor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export async function processFullResponseActions(
235235
// We need to import and use the backendTerminalOutputAtom
236236
// For now, we'll use a more direct approach by sending IPC messages to update the UI
237237

238-
const result = await runShellCommand(`cd "${cwd}" && ${cmdTag.command}`);
238+
const result = await runShellCommand(cmdTag.command, cwd);
239239

240240
if (result === null) {
241241
errors.push({
@@ -277,7 +277,7 @@ export async function processFullResponseActions(
277277

278278
logger.log(`Executing frontend terminal command: ${cmdTag.command} in ${cwd}`);
279279

280-
const result = await runShellCommand(`cd "${cwd}" && ${cmdTag.command}`);
280+
const result = await runShellCommand(cmdTag.command, cwd);
281281

282282
if (result === null) {
283283
errors.push({
@@ -420,7 +420,7 @@ export async function processFullResponseActions(
420420

421421
logger.log(`Executing general terminal command: ${cleanCommand} in ${cwd} (routing to ${terminalType} terminal)`);
422422

423-
const result = await runShellCommand(`cd "${cwd}" && ${cleanCommand}`);
423+
const result = await runShellCommand(cleanCommand, cwd);
424424

425425
if (result === null) {
426426
errors.push({

src/ipc/utils/runShellCommand.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import log from "electron-log";
33

44
const logger = log.scope("runShellCommand");
55

6-
export function runShellCommand(command: string): Promise<string | null> {
7-
logger.log(`Running command: ${command}`);
6+
export function runShellCommand(command: string, cwd?: string): Promise<string | null> {
7+
logger.log(`Running command: ${command}${cwd ? ` in ${cwd}` : ''}`);
88
return new Promise((resolve) => {
99
let output = "";
10-
const process = spawn(command, {
10+
const process = spawn(command, [], {
1111
shell: true,
1212
stdio: ["ignore", "pipe", "pipe"], // ignore stdin, pipe stdout/stderr
13+
cwd: cwd, // Set working directory if provided
1314
});
1415

1516
process.stdout?.on("data", (data) => {

0 commit comments

Comments
 (0)