mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-03-18 03:13:08 +00:00
feat: add project reset functionality with quick and full reset options
Add the ability to reset a project to its initial state with two options:
- Quick Reset: Clears features.db, assistant.db, and settings files while
preserving app spec and prompts
- Full Reset: Deletes everything including prompts directory, triggering
the setup wizard for project reconfiguration
Backend changes:
- Add POST /{name}/reset endpoint to projects router with full_reset query param
- Validate agent lock file to prevent reset while agent is running (409 Conflict)
- Dispose database engines before deleting files to release Windows file locks
- Add engine caching to api/database.py for better connection management
- Add dispose_engine() functions to both database modules
- Delete WAL mode journal files (*.db-wal, *.db-shm) during reset
Frontend changes:
- Add ResetProjectModal component with toggle between Quick/Full reset modes
- Add ProjectSetupRequired component shown when has_spec is false
- Add resetProject API function and useResetProject React Query hook
- Integrate reset button in header (disabled when agent running)
- Add 'R' keyboard shortcut to open reset modal
- Show ProjectSetupRequired when project needs setup after full reset
This implements the feature from PR #4 directly on master to avoid merge
conflicts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,23 @@ export async function updateProjectSettings(
|
||||
})
|
||||
}
|
||||
|
||||
export interface ResetProjectResponse {
|
||||
success: boolean
|
||||
reset_type: 'quick' | 'full'
|
||||
deleted_files: string[]
|
||||
message: string
|
||||
}
|
||||
|
||||
export async function resetProject(
|
||||
name: string,
|
||||
fullReset: boolean = false
|
||||
): Promise<ResetProjectResponse> {
|
||||
const params = fullReset ? '?full_reset=true' : ''
|
||||
return fetchJSON(`/projects/${encodeURIComponent(name)}/reset${params}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Features API
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user