Add configurable working directory for dev server scripts (Vibe Kanban) (#1559)
* The implementation is complete. Here's a summary of all the changes made: ## Summary Added the ability for users to specify a working directory for dev server scripts: ### Files Changed: 1. **Database migration** - `crates/db/migrations/20251216000000_add_dev_script_working_dir_to_projects.sql` - Added `dev_script_working_dir TEXT DEFAULT ''` column 2. **Rust model** - `crates/db/src/models/project.rs` - Added `dev_script_working_dir` field to `Project` and `UpdateProject` structs - Updated all SQL queries 3. **Dev server execution** - `crates/server/src/routes/task_attempts.rs` - `start_dev_server` now passes `project.dev_script_working_dir` to the script executor 4. **Backfill logic** - `crates/services/src/services/container.rs` - Changed `backfill_repo_names` to set `dev_script_working_dir` instead of prepending `cd ./repo &&` 5. **Frontend UI** - `frontend/src/pages/settings/ProjectSettings.tsx` - Added input field for "Dev Server Working Directory" 6. **Translations** - `frontend/src/i18n/locales/en/settings.json` - Added `devWorkingDir` label, placeholder, and helper text 7. **TypeScript types** - `shared/types.ts` - Regenerated with `dev_script_working_dir` field * Cleanup script changes for task attempt 83423e2d-0d45-47fb-a6e4-dd91a2140f91 * Both packages compile successfully. The fix is complete: 1. **`project.rs`**: Removed `.or()` fallback for `dev_script` and `dev_script_working_dir` so `None` now clears the field 2. **`container.rs`**: Updated backfill to explicitly pass the existing project name instead of `None` * Done. I've completed both review tasks: 1. Removed the comment from `container.rs` line 384 2. Added `devWorkingDir` translations to all four language files (es, ja, ko, zh-Hans) with: - `label`: The field label - `placeholder`: Example placeholder text - `helper`: Description of what the field does I also updated the `dev.helper` text in each language to reference the new working directory option instead of suggesting users manually `cd` into the repo directory. * Done. Removed both comments: 1. Removed the comment from the migration file 2. Removed the comment from `task_attempts.rs` line 1267 * Fixed. The TypeScript error in `NoServerContent.tsx` has been resolved by adding `dev_script_working_dir: null` to the `UpdateProject` data. All checks pass: - ✅ `npm run format` - completed - ✅ `npm run lint` - passed (frontend and backend) - ✅ `npx tsc --noEmit` - passed * The Korean and Chinese translations already had the updated copy without the `cd` reference. The Spanish and Japanese were updated. All the translations now have the proper helper text that references the working directory field instead of telling users to manually `cd` into the repo. * Done. I've removed the `cd my_website` line from both the Windows and Unix script placeholder examples in `scriptPlaceholders.ts`. Now the placeholder examples just show `npm run dev` without the `cd` command, since users can specify the working directory separately.
This commit is contained in:
@@ -1263,12 +1263,19 @@ pub async fn start_dev_server(
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
let working_dir = project
|
||||
.dev_script_working_dir
|
||||
.as_ref()
|
||||
.filter(|dir| !dir.is_empty())
|
||||
.cloned();
|
||||
|
||||
let executor_action = ExecutorAction::new(
|
||||
ExecutorActionType::ScriptRequest(ScriptRequest {
|
||||
script: dev_script,
|
||||
language: ScriptRequestLanguage::Bash,
|
||||
context: ScriptContext::DevServer,
|
||||
working_dir: None,
|
||||
working_dir,
|
||||
}),
|
||||
None,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user