-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: implement stable project ID feature (Sprint 1) #6688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add project ID utility functions (getProjectId, generateProjectId, hasProjectId) - Include project ID in task history metadata - Update getTaskWithId to support searching by project ID - Add "Generate Project ID" VSCode command - Add comprehensive unit tests This implements the core functionality for stable project IDs that persist across different project locations. Users can now generate a unique project ID that will be stored in a .rooprojectid file. Part of #6618
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed my own code and found it surprisingly coherent. Must be a bug in the review process.
| vscode.window.showInformationMessage(t("projectId.generated")) | ||
| } catch (error) { | ||
| outputChannel.appendLine(`Error generating project ID: ${error}`) | ||
| vscode.window.showErrorMessage(t("projectId.generateError", { error: String(error) })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding telemetry or metrics here to track how often project ID generation fails. This could help identify common issues users face.
|
|
||
| // If not found by ID and the ID looks like a project ID (UUID format), | ||
| // try to find by project ID | ||
| if (!historyItem && id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This UUID regex pattern appears twice in this file (lines 1376 and 1376). Consider extracting it to a constant like for reusability and consistency.
| expect(fileExistsAtPath).toHaveBeenCalledWith(projectIdPath) | ||
| }) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding test cases for:
- Concurrent project ID generation attempts
- File system permission errors
- Race conditions when multiple VSCode instances try to create the same project ID
| import { v4 as uuidv4 } from "uuid" | ||
| import { fileExistsAtPath } from "./fs" | ||
|
|
||
| const PROJECT_ID_FILENAME = ".rooprojectid" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file format and purpose could be documented in a README or contributing guide. Also, consider adding a comment here indicating that migration logic will be added in Sprint 2.
|
The issue hasn't been approved or scoped yet, closing for now |
This PR implements the core functionality for stable project IDs that persist across different project locations.
What this PR does
Sprint 1: Core Project ID Logic & Foundational Commands
Task 1.1: Implement Project ID Utility
src/utils/projectId.tswith three core functions:getProjectId()- Reads project ID from.rooprojectidfilegenerateProjectId()- Generates and saves a new UUID project IDhasProjectId()- Checks if a project has an ID fileTask 1.2: Modify History Key Generation
src/core/task-persistence/taskMetadata.tsto include project ID in history itemssrc/core/webview/ClineProvider.tsto support searching tasks by project IDHistoryItemtype inpackages/types/src/history.tsto include optionalprojectIdfieldTask 1.3: Create "Generate Project ID" Command
generateProjectIdto the command list inpackages/types/src/vscode.tssrc/activate/registerCommands.tssrc/package.jsonandsrc/package.nls.jsonsrc/i18n/locales/en/common.jsonTesting
src/utils/__tests__/projectId.spec.tsHow to test
.rooprojectidfile is created in the project rootNext steps
This is Sprint 1 of 3. Future sprints will add:
Fixes #6618
Important
Implement stable project ID feature with utility functions, command, and task history integration.
getProjectId(),generateProjectId(), andhasProjectId()insrc/utils/projectId.tsto manage project IDs.taskMetadata()intaskMetadata.tsto includeprojectIdinHistoryItem.ClineProviderinClineProvider.tsto search tasks byprojectId.generateProjectIdcommand inregisterCommands.tsandpackage.json.registerCommands.ts.projectId.spec.tsfor project ID utilities.common.json.This description was created by
for 72e6abf. You can customize this summary. It will automatically update as commits are pushed.