Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Feb 12, 2025

Description

This is Cline's checkpoints implementation and it uses a clever git feature to create a checkpoint system. It works by:

  1. Creating a separate "shadow" git repository in a different location (e.g., in VSCode's storage)
  2. Configuring this shadow repository to use the VSCode workspace as its working tree by setting core.worktree
  3. Using this setup to track workspace changes without interfering with any existing git repository

The checkpoint mechanism is straightforward:

  • Creating a checkpoint: git add . && git commit in the shadow repository captures the workspace state
  • Restoring a checkpoint: git reset --hard <sha> in the shadow repository restores the workspace files

This approach separates checkpoint history from any existing git repository in the workspace, while still leveraging git's powerful version control capabilities.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Introduces shadow repository checkpoints using Git, with UI updates and tests for managing and displaying checkpoint data.

  • Core Functionality:
    • Introduces ShadowCheckpointService and LocalCheckpointService for managing checkpoints using shadow and local strategies respectively.
    • Implements CheckpointServiceFactory to create checkpoint services based on strategy.
    • Updates Cline.ts to integrate checkpoint services and handle task directory size.
  • UI Components:
    • Updates ChatRow.tsx, TaskHeader.tsx, and CheckpointMenu.tsx to display checkpoint information and actions.
    • Adds pretty-bytes for formatting file sizes in UI.
  • Testing:
    • Adds tests for LocalCheckpointService and ShadowCheckpointService in their respective test files.
    • Updates HistoryView.test.tsx to test new UI functionalities.
  • Miscellaneous:
    • Updates package.json to include get-folder-size and pretty-bytes dependencies.
    • Refactors and renames files related to checkpoint services.

This description was created by Ellipsis for 90b019f. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2025

⚠️ No Changeset found

Latest commit: 90b019f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cte cte force-pushed the cte/shadow-repo-checkpoints branch from 49819e9 to 90b019f Compare February 12, 2025 21:17
@cte cte merged commit 97ed646 into main Feb 12, 2025
5 of 6 checks passed
@cte cte deleted the cte/shadow-repo-checkpoints branch February 12, 2025 21:21
.map((line) => line.split(" ")[0].trim())
}
} catch (error) {
console.warn(`Failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging and error handling: Consider using structured logging (or our logging utility) instead of console.warn, to align with our structured logging standards.

Suggested change
console.warn(`Failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`)
this.log(`Failed to read .gitattributes: ${error instanceof Error ? error.message : String(error)}`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants