Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 4, 2025

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

    • Created src/utils/projectId.ts with three core functions:
      • getProjectId() - Reads project ID from .rooprojectid file
      • generateProjectId() - Generates and saves a new UUID project ID
      • hasProjectId() - Checks if a project has an ID file
  • Task 1.2: Modify History Key Generation

    • Updated src/core/task-persistence/taskMetadata.ts to include project ID in history items
    • Modified src/core/webview/ClineProvider.ts to support searching tasks by project ID
    • Updated the HistoryItem type in packages/types/src/history.ts to include optional projectId field
  • Task 1.3: Create "Generate Project ID" Command

    • Added generateProjectId to the command list in packages/types/src/vscode.ts
    • Implemented the command handler in src/activate/registerCommands.ts
    • Added the command to src/package.json and src/package.nls.json
    • Added i18n translations in src/i18n/locales/en/common.json

Testing

  • Created comprehensive unit tests in src/utils/__tests__/projectId.spec.ts
  • All tests are passing ✅

How to test

  1. Open a project in VSCode with Roo Code
  2. Run the "Generate Project ID" command from the command palette
  3. Check that a .rooprojectid file is created in the project root
  4. Create a new task - the task history will now include the project ID
  5. Move the project to a different location and the task history should still be accessible

Next steps

This is Sprint 1 of 3. Future sprints will add:

  • Sprint 2: User-facing features like automatic ID generation and history migration
  • Sprint 3: Handling moved and copied projects with user prompts

Fixes #6618


Important

Implement stable project ID feature with utility functions, command, and task history integration.

  • Core Functionality:
    • Added getProjectId(), generateProjectId(), and hasProjectId() in src/utils/projectId.ts to manage project IDs.
    • Updated taskMetadata() in taskMetadata.ts to include projectId in HistoryItem.
    • Modified ClineProvider in ClineProvider.ts to search tasks by projectId.
  • Commands:
    • Added generateProjectId command in registerCommands.ts and package.json.
    • Implemented command handler in registerCommands.ts.
  • Testing:
    • Added unit tests in projectId.spec.ts for project ID utilities.
  • Localization:
    • Added i18n strings for project ID messages in common.json.

This description was created by Ellipsis for 72e6abf. You can customize this summary. It will automatically update as commits are pushed.

- 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
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 4, 2025 21:51
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 4, 2025
Copy link
Contributor Author

@roomote roomote bot left a 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) }))
Copy link
Contributor Author

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)) {
Copy link
Contributor Author

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)
})
})
})
Copy link
Contributor Author

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"
Copy link
Contributor Author

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.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 4, 2025
@daniel-lxs
Copy link
Member

The issue hasn't been approved or scoped yet, closing for now

@daniel-lxs daniel-lxs closed this Aug 6, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 6, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Feature Request: Stable Project IDs to Preserve Chat History Across Different Locations

4 participants