feat: enhance project import functionality and add comprehensive tests#47
feat: enhance project import functionality and add comprehensive tests#47Yashh56 merged 7 commits intoRelwave:developfrom
Conversation
…ct ID and manage databaseId in local config
There was a problem hiding this comment.
Pull request overview
This pull request introduces a comprehensive "Import Project" feature that enables users to import projects from cloned repository directories. The implementation spans the full stack from backend storage logic to UI components, with a strong focus on maintaining git cleanliness by avoiding modifications to tracked files.
Changes:
- Added backend support for scanning and importing projects from cloned repositories, with machine-specific data stored in git-ignored local config files
- Implemented new React components and hooks for the import workflow, including folder selection, metadata preview, and database connection setup
- Added comprehensive test coverage (800 lines) for import functionality, including edge cases and file immutability guarantees
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/project.ts | Added sourcePath field and new types (ScanImportResult, ImportProjectParams) for import operations |
| src/services/bridgeApi.ts | Added scanImportSource, importProject, and linkProjectDatabase API methods with validation |
| src/hooks/useProjectQueries.ts | Added useImportProject hook with cache invalidation |
| src/pages/Projects.tsx | Integrated import dialog with state management and cache invalidation on completion |
| src/components/project/ProjectList.tsx | Added Import button to project list header |
| src/components/project/ImportProjectDialog.tsx | Comprehensive 425-line dialog component handling multi-step import workflow |
| src/components/project/index.ts | Exported ImportProjectDialog component |
| bridge/src/services/projectStore.ts | Core import logic with sourcePath caching, .env parsing, and git-safe file operations |
| bridge/src/handlers/projectHandlers.ts | Added RPC handlers for scanImport, importProject, and linkDatabase |
| bridge/src/jsonRpcHandler.ts | Registered new RPC handlers |
| bridge/tests/importProject.test.ts | Comprehensive test suite with 800 lines covering parsing, scanning, importing, and linking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ructions and environment variable references
…llback on failure
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ance project update handling for imported projects
This pull request introduces a new "Import Project" feature, allowing users to import projects from a cloned repository directory. The changes span backend handler support, API integration, React hooks, UI dialogs, and type definitions. The most important changes are grouped below:
Backend and API Enhancements
projectHandlers.tsand registered them in the JSON-RPC handler. These handlers interact with theprojectStoreInstanceto perform the necessary operations. [1] [2]bridgeApiservice withscanImportSource,importProject, andlinkProjectDatabasemethods to provide frontend access to the new backend endpoints.React Hooks and Type Definitions
useImportProjecthook inuseProjectQueries.tsto manage project imports via React Query.ImportProjectParamsandScanImportResult, and updatedProjectMetadataandProjectSummaryto include thesourcePathfield. [1] [2]UI and Dialog Integration
ProjectListcomponent and introduced theImportProjectDialogcomponent for the import workflow. The dialog is wired into theProjectspage, including cache invalidation and UI updates upon completion. [1] [2] [3]State and Cache Management
Projectspage to handle the import dialog's state and to invalidate project and database queries when an import completes, ensuring UI consistency.These changes collectively enable a smooth workflow for importing projects from cloned repositories, including metadata preview, database connection, and UI feedback.