Skip to content

Commit cdbb22c

Browse files
committed
Fix #8: Enforce package.json updates for new dependencies instead of shell npm install
1 parent a41031e commit cdbb22c

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

app/lib/agent/prompts.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ You operate in WebContainer, an in-browser Node.js runtime that emulates a Linux
8585
- ALWAYS run commands as SEPARATE devonz_run_command calls, one command per call
8686
- If you must chain, use ; (semicolon) — NOT && or ||
8787
88+
**DEPENDENCY INSTALLATION (CRITICAL):**
89+
- NEVER use \`npm install <package>\` to add new dependencies — this does NOT update package.json
90+
- Instead, ALWAYS update package.json via devonz_write_file to add packages to dependencies/devDependencies
91+
- Then run a single \`npm install\` command to install everything
92+
- WRONG: \`npm install react-router-dom zustand\` (packages won't be in package.json)
93+
- RIGHT: Write updated package.json with new packages, then run \`npm install\`
94+
8895
**Database preference:** You MUST use Supabase, libsql, or sqlite (no native binaries)
8996
9097
**Working directory:** ${cwd}
@@ -337,6 +344,8 @@ Before reporting task completion, verify:
337344
- [ ] NO UI COMPONENTS FROM LUCIDE: Tooltip, Dialog, Sheet, Popover, Select, Accordion, etc. are imported from \`@/components/ui/\` — NEVER from \`lucide-react\`
338345
- [ ] FINAL ICON AUDIT: Re-read EVERY file that imports from 'lucide-react' and verify EVERY PascalCase JSX element used as \`<Name />\` or \`<Name \` has a corresponding import. Pay special attention to icons used inside .map() callbacks, conditional renders, and nested components.
339346
- [ ] Shell commands use SEPARATE devonz_run_command calls — NEVER chain with &&
347+
- [ ] New dependencies added to package.json via devonz_write_file — NOT via \`npm install <pkg>\` shell command
348+
- [ ] All packages imported in code are listed in package.json dependencies/devDependencies
340349
Completeness (CRITICAL):
341350
- [ ] No hardcoded mock data arrays — real state management with CRUD operations used
342351
- [ ] No external API calls with API keys — all demo content uses local seed data

app/lib/common/prompts/new-prompt.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ export const getFineTunedPrompt = (
157157
* Second action: npm run dev
158158
- If you must chain commands in a single action, use ; (semicolon) — NOT && or ||
159159
- This applies to ALL shell commands, not just npm
160+
161+
DEPENDENCY INSTALLATION (CRITICAL):
162+
- NEVER use "npm install <package>" shell commands to add new dependencies
163+
- Instead, ALWAYS update package.json via a boltAction type="file" to add packages to "dependencies" or "devDependencies"
164+
- Then run a single "npm install" shell action to install everything at once
165+
- Why: Shell-only npm install does NOT persist dependencies in package.json, causing cascading failures when the dev server restarts
166+
- Correct workflow for adding new packages:
167+
1. Write updated package.json with new packages added to dependencies/devDependencies
168+
2. Run "npm install" as a shell action
169+
3. Run "npm run dev" as a separate shell action
170+
- WRONG: \`npm install react-router-dom zustand\` (packages not in package.json)
171+
- RIGHT: Update package.json file to include react-router-dom and zustand, then run \`npm install\`
160172
</system_constraints>
161173
162174
<technology_preferences>
@@ -894,6 +906,8 @@ The todo app is running with local storage persistence.</assistant_response>
894906
[ ] \`npm install\` runs BEFORE \`npm run dev\`
895907
[ ] Artifact ENDS with \`<boltAction type="start">npm run dev</boltAction>\`
896908
[ ] Each shell command is in its OWN boltAction — NEVER chain with && (jsh does not support it)
909+
[ ] New dependencies added to package.json via file action — NOT via \`npm install <pkg>\` shell command
910+
[ ] All packages imported in code are listed in package.json dependencies/devDependencies
897911
898912
Performance & Accessibility:
899913
[ ] Images have \`loading="lazy"\` or \`fetchpriority="high"\` as appropriate

0 commit comments

Comments
 (0)