Skip to content

Commit ed2e6d4

Browse files
authored
Fix apps-mcp agent behavior: localhost preference and deployment conf… (#4056)
Fix apps-mcp agent behavior: localhost preference and deployment confirmation Two key issues addressed: 1. Agent was opening deployed URLs instead of localhost when user asked to "open a dev copy" or see the app during development. 2. Agent was deploying too early without user confirmation. Changes: - apps.tmpl: Add localhost guidance and deployment confirmation requirement - CLAUDE.md: Add "Deployment Procedures" section with pre-deployment checklist - CLAUDE.md: Add "Local Development vs Deployed Apps" section with decision tree The agent will now: - Prefer localhost:8000 during active development - Ask "Ready to deploy to [environment]?" before deploying - Only use deployed URLs after deployment with user approval Addresses feedback from PR #4045 discussion. ## Changes Prompt updates with checklist how to deploy when and how to run app. ## Why issue 21 | Victor | The deployment was really early, maybe a confirmation step first. issue 30 | Lennart | Agent is opening deployed apps rather than “dev copy” (unless I ask about localhost very explicitly) ## Tests make test
1 parent 29e9930 commit ed2e6d4

File tree

1 file changed

+148
-3
lines changed
  • experimental/apps-mcp/templates/appkit/template/{{.project_name}}

1 file changed

+148
-3
lines changed

experimental/apps-mcp/templates/appkit/template/{{.project_name}}/CLAUDE.md

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TypeScript full-stack template powered by **Databricks AppKit** with tRPC for ad
88
## NPM Scripts
99

1010
### Development
11-
- `npm run dev` - Start dev server with hot reload (use during active development)
12-
- `npm start` - Start production server (requires `npm run build` first)
11+
- `npm run dev` - Start dev server with hot reload (**ALWAYS use this during development**)
12+
- `npm start` - Start production server (**NEVER use during development - production only!**)
1313

1414
### Build
1515
- `npm run build` - Full build (server + client) - use before deployment
@@ -35,7 +35,152 @@ TypeScript full-stack template powered by **Databricks AppKit** with tRPC for ad
3535
**Common workflows:**
3636
- Development: `npm run dev` → make changes → `npm run typecheck``npm run lint:fix`
3737
- Pre-commit: `npm run typecheck && npm run lint:fix && npm run format:fix && npm test`
38-
- Pre-deploy: `npm run build && npm start` (test locally) → `npm test`
38+
- Pre-deploy: Validate with `databricks experimental apps-mcp tools validate .`
39+
40+
**CRITICAL - npm run dev vs npm start:**
41+
```
42+
┌─────────────────────────────────────────────────────┐
43+
│ DURING DEVELOPMENT: ALWAYS use `npm run dev` │
44+
│ - Hot reload enabled │
45+
│ - Fast iteration │
46+
│ - Runs on localhost:8000 │
47+
│ │
48+
│ NEVER use `npm start` during development! │
49+
│ - npm start is for production deployment only │
50+
│ - No hot reload │
51+
│ - Requires build step first │
52+
└─────────────────────────────────────────────────────┘
53+
```
54+
55+
## Deployment Procedures
56+
57+
**CRITICAL**: Deployment is a significant action that affects live environments. NEVER deploy without explicit user confirmation.
58+
59+
### Before Deploying
60+
61+
**ALWAYS** confirm with the user first by asking: "Ready to deploy to [environment]?"
62+
63+
Pre-deployment checklist:
64+
1. ✅ App validated successfully (`databricks experimental apps-mcp tools validate .`)
65+
2. ✅ Local testing completed (`npm run dev` and manual verification)
66+
3. ✅ User explicitly approved deployment
67+
4. ✅ Code committed to git (recommended)
68+
69+
### Deployment Commands
70+
71+
```bash
72+
databricks bundle deploy # Deploy app infrastructure
73+
databricks bundle run app # Start the app
74+
databricks bundle summary # Get deployed app URL
75+
```
76+
77+
Or use the all-in-one command:
78+
```bash
79+
databricks experimental apps-mcp tools deploy # Validates, deploys, and runs
80+
```
81+
82+
**DO NOT** run deployment commands unless the user explicitly requests it or confirms when asked.
83+
84+
## Local Development vs Deployed Apps
85+
86+
**CRITICAL**: Understand the difference between local development and deployed environments.
87+
88+
### During Development (Before Deployment)
89+
90+
When the user asks to "open the app", "see the app", "view the app", or "open a dev copy":
91+
92+
-**Use localhost**: `http://localhost:8000`
93+
-**Requires**: `npm run dev` must be running
94+
-**Purpose**: Hot reload, fast iteration, debugging
95+
96+
**DO NOT** suggest deployed URLs (staging/production) during active development!
97+
98+
### After Deployment
99+
100+
Only after running `databricks bundle deploy && databricks bundle run app`:
101+
102+
-**Use deployed URL**: Get from `databricks bundle summary`
103+
-**Purpose**: Production/staging environment, sharing with others
104+
105+
### Decision Tree
106+
107+
```
108+
User asks to "open the app" or "see the app"
109+
110+
├─ Has the app been deployed in this session?
111+
│ ├─ No → Use http://localhost:8000 (start with `npm run dev` if needed)
112+
│ └─ Yes → Ask user which environment they want:
113+
│ • localhost (development)
114+
│ • deployed URL (production/staging)
115+
116+
└─ User explicitly says "localhost" or "local"
117+
→ Always use http://localhost:8000
118+
```
119+
120+
## Deployment Procedures
121+
122+
**CRITICAL**: Deployment is a significant action that affects live environments. NEVER deploy without explicit user confirmation.
123+
124+
### Before Deploying
125+
126+
**ALWAYS** confirm with the user first by asking: "Ready to deploy to [environment]?"
127+
128+
Pre-deployment checklist:
129+
1. ✅ App validated successfully (`databricks experimental apps-mcp tools validate .`)
130+
2. ✅ Local testing completed (`npm run dev` and manual verification)
131+
3. ✅ User explicitly approved deployment
132+
4. ✅ Code committed to git (recommended)
133+
134+
### Deployment Commands
135+
136+
```bash
137+
databricks bundle deploy # Deploy app infrastructure
138+
databricks bundle run app # Start the app
139+
databricks bundle summary # Get deployed app URL
140+
```
141+
142+
Or use the all-in-one command:
143+
```bash
144+
databricks experimental apps-mcp tools deploy # Validates, deploys, and runs
145+
```
146+
147+
**DO NOT** run deployment commands unless the user explicitly requests it or confirms when asked.
148+
149+
## Local Development vs Deployed Apps
150+
151+
**CRITICAL**: Understand the difference between local development and deployed environments.
152+
153+
### During Development (Before Deployment)
154+
155+
When the user asks to "open the app", "see the app", "view the app", or "open a dev copy":
156+
157+
-**Use localhost**: `http://localhost:8000`
158+
-**Requires**: `npm run dev` must be running
159+
-**Purpose**: Hot reload, fast iteration, debugging
160+
161+
**DO NOT** suggest deployed URLs (staging/production) during active development!
162+
163+
### After Deployment
164+
165+
Only after running `databricks bundle deploy && databricks bundle run app`:
166+
167+
-**Use deployed URL**: Get from `databricks bundle summary`
168+
-**Purpose**: Production/staging environment, sharing with others
169+
170+
### Decision Tree
171+
172+
```
173+
User asks to "open the app" or "see the app"
174+
175+
├─ Has the app been deployed in this session?
176+
│ ├─ No → Use http://localhost:8000 (start with `npm run dev` if needed)
177+
│ └─ Yes → Ask user which environment they want:
178+
│ • localhost (development)
179+
│ • deployed URL (production/staging)
180+
181+
└─ User explicitly says "localhost" or "local"
182+
→ Always use http://localhost:8000
183+
```
39184

40185
## App Naming Constraints
41186

0 commit comments

Comments
 (0)