-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Summary
Extend the "Launch App" feature from Node.js-only to support all major programming languages and frameworks, with proper process tracking and cleanup capabilities.
Problem
The current Launch App implementation (#1313) has several limitations:
- Node.js Only: Only detects
package.jsonand npm/pnpm/yarn commands - No Process Tracking: Spawned dev servers are "fire and forget" - no way to stop them
- Port Conflicts: Multiple launches can pile up on ports 5173, 5174, etc.
- No Stop Button: Users must manually find and kill processes
- Stale Processes: Closing Auto-Claude doesn't terminate spawned dev servers
- Single-Instance Conflicts: Apps with mutex locks (like Pyloid) fail if old instance exists
Proposed Solution
Phase 1: Process Tracking (P0)
Track all spawned processes per task/worktree to enable clean shutdown.
interface TrackedProcess {
pid: number;
taskId: string;
worktreePath: string;
command: string;
startedAt: Date;
port?: number;
type: 'node' | 'python' | 'rust' | 'go' | 'java' | 'dotnet' | 'other';
}
// In-memory registry with optional persistence
const processRegistry: Map<string, TrackedProcess[]> = new Map();Features:
- Register PIDs when launching
- Unregister when processes terminate
- Query processes by task/worktree
- Persist to file for crash recovery
Phase 2: Stop App Button (P1)
Add UI to terminate running dev servers.
UI Changes:
- "Stop App" button appears when dev server is running for the task
- Confirmation dialog for safety
- Loading state during termination
- Toast notification on success/failure
Backend:
TASK_WORKTREE_STOP_APPIPC handler- Graceful shutdown (SIGTERM) with fallback to force kill (SIGKILL)
- Clean up process registry
Phase 3: Multi-Language Project Detection (P1-P2)
Detect project type from files and use appropriate commands.
| Project Type | Detection Files | Install Command | Launch Command |
|---|---|---|---|
| Node.js | package.json |
npm/pnpm/yarn install |
npm run dev/start |
| Python (uv) | pyproject.toml + uv.lock |
uv sync |
uv run python main.py |
| Python (pip) | requirements.txt |
pip install -r requirements.txt |
python main.py / flask run / uvicorn |
| Python (poetry) | pyproject.toml + poetry.lock |
poetry install |
poetry run python main.py |
| Rust | Cargo.toml |
cargo build |
cargo run |
| Go | go.mod |
go mod download |
go run . |
| Java (Maven) | pom.xml |
mvn install |
mvn spring-boot:run / mvn exec:java |
| Java (Gradle) | build.gradle |
gradle build |
gradle bootRun / gradle run |
| .NET | *.csproj / *.sln |
dotnet restore |
dotnet run |
| Ruby | Gemfile |
bundle install |
rails server / ruby app.rb |
| PHP | composer.json |
composer install |
php artisan serve / php -S |
Implementation:
interface ProjectConfig {
type: ProjectType;
packageManager: string | null;
installCommand: string | null;
launchCommand: string | null;
launchScript?: string; // For Node.js: 'dev', 'start', etc.
processPatterns: string[]; // Regex patterns for cleanup
ports: number[]; // Default ports to check
}
function detectProjectType(worktreePath: string): ProjectConfig {
// Check files in priority order
// Return first match with full config
}Phase 4: System-Wide Cleanup (P2)
Nuclear option to kill all Auto-Claude-spawned processes.
Features:
- "Kill All Dev Servers" button in settings or toolbar
- Cleans up all tracked processes across all tasks
- Useful when switching contexts or debugging port issues
- Optional: Run on Auto-Claude startup to clean stale processes
Implementation:
- Persist process registry to
~/.auto-claude/process-registry.json - On startup: check if registered PIDs are still running, clean stale entries
- On quit: optionally terminate all tracked processes
Phase 5: UI Enhancements (P3)
Running Indicator:
- Green dot or badge on tasks with active dev servers
- Hover shows: command, port, uptime
Port Display:
- Show which port the dev server is running on
- Click to open in browser
Logs Panel (stretch goal):
- Stream dev server stdout/stderr in UI
- Collapsible panel below workspace status
- Search/filter capabilities
Implementation Plan
Milestone 1: Core Process Tracking
- Create
ProcessRegistryclass with CRUD operations - Persist registry to file with debounced writes
- Register processes on launch
- Add
TASK_WORKTREE_STOP_APPIPC handler - Add "Stop App" button to WorkspaceStatus
Milestone 2: Python Support
- Add Python project detection (uv, pip, poetry)
- Detect Python launch commands from
pyproject.toml - Handle virtual environment activation
- Test with Pyloid apps (VoiceFlow)
Milestone 3: Additional Languages
- Rust detection and launch
- Go detection and launch
- Java/Gradle/Maven detection
- .NET detection
Milestone 4: Polish
- Running indicator on task cards
- Port display in UI
- System-wide cleanup button
- Startup cleanup of stale processes
Acceptance Criteria
- Can launch Node.js, Python, Rust, and Go projects
- "Stop App" button terminates the dev server
- Launching twice kills the first instance automatically
- Closing Auto-Claude cleans up spawned processes
- Process registry survives app restart
- UI shows which tasks have running dev servers
Related Issues/PRs
- feat(launch-app): Add auto-install dependencies with full UI feedback #1313 - Launch App with dependency handling (Node.js only)
- feat(task): add Launch App button for Human Review tasks #1120 - Original Launch App button
- Human Review should have 'Launch App' button and automated E2E testing #1119 - Launch App feature request
Technical Notes
Cross-Platform Considerations
Windows:
- Use
taskkill /F /PIDfor force kill - Process tree may need
/Tflag - PowerShell for process queries
macOS/Linux:
- Use
kill -TERMthenkill -9as fallback - May need to kill process group with
-prefix - Use
pgrep/pkillfor pattern matching
Process Groups
When spawning terminal windows, the actual dev server runs as a child of the terminal. We may need to:
- Track the terminal PID
- Find child processes of that PID
- Kill the entire process tree
Port Detection
For showing ports in UI:
- Parse stdout for "listening on port X" patterns
- Or query
netstat/lsoffiltered by PID - Store detected port in process registry
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Projects
Status