Louis Knight-Webb 32c689dfc5 Run setup or cleanup scripts (vibe-kanban) (#1428)
* I've successfully implemented the two new API endpoints for running setup and cleanup scripts on task attempts. Here's a summary of the changes:

## Summary

### Files Modified

1. **`crates/server/src/routes/task_attempts.rs`**
   - Added `RunScriptError` enum type for error handling when no script is configured
   - Added `run_setup_script` handler - POST endpoint to run a project's setup script
   - Added `run_cleanup_script` handler - POST endpoint to run a project's cleanup script
   - Registered both routes: `/run-setup-script` and `/run-cleanup-script`

2. **`crates/server/src/bin/generate_types.rs`**
   - Added `RunScriptError` to the list of types to export to TypeScript

3. **`shared/types.ts`** (auto-generated)
   - Now includes the `RunScriptError` TypeScript type

### New Endpoints

- **`POST /api/task-attempts/{id}/run-setup-script`** - Runs the project's setup script in the task attempt's worktree
- **`POST /api/task-attempts/{id}/run-cleanup-script`** - Runs the project's cleanup script in the task attempt's worktree

Both endpoints:
- Return `ExecutionProcess` on success with the created execution process
- Return `RunScriptError::NoScriptConfigured` if the project doesn't have the respective script configured
- Track analytics events (`setup_script_executed` / `cleanup_script_executed`)
- Use the existing `ScriptContext::SetupScript` / `ScriptContext::CleanupScript` and `ExecutionProcessRunReason::SetupScript` / `ExecutionProcessRunReason::CleanupScript` patterns

* Done! I've added the running process check to both `run_setup_script` and `run_cleanup_script` endpoints. Here's a summary of the changes:

## Summary

### Files Modified

1. **`crates/db/src/models/execution_process.rs`**
   - Added `has_running_non_dev_server_processes` method that checks if any running processes (excluding dev servers) exist for a task attempt

2. **`crates/server/src/routes/task_attempts.rs`**
   - Added `ProcessAlreadyRunning` variant to `RunScriptError` enum
   - Added check at the start of both `run_setup_script` and `run_cleanup_script` handlers to return an error if non-dev-server processes are already running

3. **`shared/types.ts`** (auto-generated)
   - `RunScriptError` now includes both `no_script_configured` and `process_already_running` variants

### Behavior

Both endpoints now:
1. First check if any non-dev-server processes (coding agents, setup/cleanup scripts) are running on the task attempt
2. If running processes exist, return `RunScriptError::ProcessAlreadyRunning`
3. Otherwise proceed with script execution as before

* Cleanup script changes for task attempt cdb9cbd9-a6e7-4936-8e75-6dd837c634f3

* Done! I've implemented the frontend changes for the setup/cleanup script dropdown. Here's a summary:

## Summary of Frontend Changes

### Files Modified

1. **`frontend/src/lib/api.ts`**
   - Added `RunScriptError` to imports from shared types
   - Added `runSetupScript` and `runCleanupScript` methods to `attemptsApi`

2. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`**
   - Added imports for `Terminal` icon, `DropdownMenu`, and `Tooltip` components
   - Added `attemptsApi` import
   - Updated `useProject()` to also get `project` data
   - Added computed values: `hasSetupScript`, `hasCleanupScript`, `hasAnyScript`
   - Added handlers: `handleRunSetupScript`, `handleRunCleanupScript`
   - Added dropdown button with Terminal icon after the Attach button
   - Dropdown only shows if project has at least one script configured
   - Menu items are disabled with tooltips when scripts are not configured
   - Button is disabled when `isAttemptRunning` is true

3. **`frontend/src/i18n/locales/en/tasks.json`**
   - Added translation strings for the dropdown menu items and tooltips

### Behavior

- **Dropdown visibility**: Only shown if project has `setup_script` or `cleanup_script` configured
- **Button disabled state**: When `isAttemptRunning` is true (tooltip explains why)
- **Menu item disabled states**:
  - "Run setup script" disabled if no `setup_script` (tooltip explains)
  - "Run cleanup script" disabled if no `cleanup_script` (tooltip explains)
- **After clicking**: Script starts executing and `isAttemptRunning` becomes true automatically, preventing further interactions

* Done! I've added translations for all languages:

- **Spanish (es)**:
  - "Ejecutar script de configuración" / "Ejecutar script de limpieza"
  - Tooltips in Spanish

- **Japanese (ja)**:
  - "セットアップスクリプトを実行" / "クリーンアップスクリプトを実行"
  - Tooltips in Japanese

- **Korean (ko)**:
  - "설정 스크립트 실행" / "정리 스크립트 실행"
  - Tooltips in Korean

* Done! I've removed all the fallback strings from the `t()` calls. All 5 translation calls now use just the key:

- `{t('followUp.scriptsDisabledWhileRunning')}`
- `{t('followUp.runSetupScript')}`
- `{t('followUp.noSetupScript')}`
- `{t('followUp.runCleanupScript')}`
- `{t('followUp.noCleanupScript')}`
2025-12-04 17:57:43 +00:00
2025-11-14 15:37:56 +00:00
2025-12-04 16:50:51 +00:00
2025-08-08 13:53:27 +01:00
2025-11-14 15:37:56 +00:00
2025-12-04 17:31:57 +00:00
2025-11-14 15:37:56 +00:00
2025-11-14 15:37:56 +00:00
2025-11-14 15:37:56 +00:00
2025-11-14 15:37:56 +00:00
2025-12-04 17:31:57 +00:00
2025-11-14 15:37:56 +00:00
2025-11-14 15:37:56 +00:00
2025-07-11 15:57:30 +01:00
2025-10-20 13:24:04 +01:00
2025-07-11 16:31:08 +01:00
2025-12-04 17:31:57 +00:00
2025-11-14 15:37:56 +00:00
2025-06-25 09:27:29 +01:00

Vibe Kanban Logo

Get 10X more out of Claude Code, Gemini CLI, Codex, Amp and other coding agents...

npm Build status Ask DeepWiki

We're hiring!

Overview

AI coding agents are increasingly writing the world's code and human engineers now spend the majority of their time planning, reviewing, and orchestrating tasks. Vibe Kanban streamlines this process, enabling you to:

  • Easily switch between different coding agents
  • Orchestrate the execution of multiple coding agents in parallel or in sequence
  • Quickly review work and start dev servers
  • Track the status of tasks that your coding agents are working on
  • Centralise configuration of coding agent MCP configs
  • Open projects remotely via SSH when running Vibe Kanban on a remote server

You can watch a video overview here.

Installation

Make sure you have authenticated with your favourite coding agent. A full list of supported coding agents can be found in the docs. Then in your terminal run:

npx vibe-kanban

Documentation

Please head to the website for the latest documentation and user guides.

Support

We use GitHub Discussions for feature requests. Please open a discussion to create a feature request. For bugs please open an issue on this repo.

Contributing

We would prefer that ideas and changes are first raised with the core team via GitHub Discussions or Discord, where we can discuss implementation details and alignment with the existing roadmap. Please do not open PRs without first discussing your proposal with the team.

Development

Prerequisites

Additional development tools:

cargo install cargo-watch
cargo install sqlx-cli

Install dependencies:

pnpm i

Running the dev server

pnpm run dev

This will start the backend. A blank DB will be copied from the dev_assets_seed folder.

Building the frontend

To build just the frontend:

cd frontend
pnpm build

Build from source

  1. Run build-npm-package.sh
  2. In the npx-cli folder run npm pack
  3. You can run your build with npx [GENERATED FILE].tgz

Environment Variables

The following environment variables can be configured at build time or runtime:

Variable Type Default Description
POSTHOG_API_KEY Build-time Empty PostHog analytics API key (disables analytics if empty)
POSTHOG_API_ENDPOINT Build-time Empty PostHog analytics endpoint (disables analytics if empty)
BACKEND_PORT Runtime 0 (auto-assign) Backend server port
FRONTEND_PORT Runtime 3000 Frontend development server port
HOST Runtime 127.0.0.1 Backend server host
DISABLE_WORKTREE_ORPHAN_CLEANUP Runtime Not set Disable git worktree cleanup (for debugging)

Build-time variables must be set when running pnpm run build. Runtime variables are read when the application starts.

Remote Deployment

When running Vibe Kanban on a remote server (e.g., via systemctl, Docker, or cloud hosting), you can configure your editor to open projects via SSH:

  1. Access via tunnel: Use Cloudflare Tunnel, ngrok, or similar to expose the web UI
  2. Configure remote SSH in Settings → Editor Integration:
    • Set Remote SSH Host to your server hostname or IP
    • Set Remote SSH User to your SSH username (optional)
  3. Prerequisites:
    • SSH access from your local machine to the remote server
    • SSH keys configured (passwordless authentication)
    • VSCode Remote-SSH extension

When configured, the "Open in VSCode" buttons will generate URLs like vscode://vscode-remote/ssh-remote+user@host/path that open your local editor and connect to the remote server.

See the documentation for detailed setup instructions.

Description
Get 10X more out of Claude Code, Codex or any coding agent
https://www.vibekanban.com/
Readme Apache-2.0 48 MiB
Languages
Rust 51.1%
TypeScript 46.6%
CSS 1.1%
JavaScript 0.7%
PLpgSQL 0.2%
Other 0.2%