diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 83cdabd466..58be39a11b 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -143,7 +143,7 @@ export class Cline { this.fuzzyMatchThreshold = fuzzyMatchThreshold ?? 1.0 this.providerRef = new WeakRef(provider) this.diffViewProvider = new DiffViewProvider(cwd) - this.checkpointsEnabled = enableCheckpoints ?? false + this.checkpointsEnabled = process.platform !== "win32" && !!enableCheckpoints if (historyItem) { this.taskId = historyItem.id @@ -3240,6 +3240,7 @@ export class Cline { this.checkpointService = await CheckpointService.create({ taskId: this.taskId, baseDir: vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? "", + log: (message) => this.providerRef.deref()?.log(message), }) } diff --git a/src/services/checkpoints/CheckpointService.ts b/src/services/checkpoints/CheckpointService.ts index cf27b5a33a..672edfd0cc 100644 --- a/src/services/checkpoints/CheckpointService.ts +++ b/src/services/checkpoints/CheckpointService.ts @@ -2,7 +2,6 @@ import fs from "fs/promises" import { existsSync } from "fs" import path from "path" -import debug from "debug" import simpleGit, { SimpleGit, CleanOptions } from "simple-git" export type CheckpointServiceOptions = { @@ -246,15 +245,11 @@ export class CheckpointService { } public static async create({ taskId, git, baseDir, log = console.log }: CheckpointServiceOptions) { - git = - git || - simpleGit({ - baseDir, - binary: "git", - maxConcurrentProcesses: 1, - config: [], - trimmed: true, - }) + if (process.platform === "win32") { + throw new Error("Checkpoints are not supported on Windows.") + } + + git = git || simpleGit({ baseDir }) const version = await git.version() diff --git a/src/services/checkpoints/__tests__/CheckpointService.test.ts b/src/services/checkpoints/__tests__/CheckpointService.test.ts index 9165da332a..caa0952fa1 100644 --- a/src/services/checkpoints/__tests__/CheckpointService.test.ts +++ b/src/services/checkpoints/__tests__/CheckpointService.test.ts @@ -14,6 +14,7 @@ describe("CheckpointService", () => { let git: SimpleGit let testFile: string let service: CheckpointService + let originalPlatform: string const initRepo = async ({ baseDir, @@ -48,6 +49,19 @@ describe("CheckpointService", () => { return { git, testFile } } + beforeAll(() => { + originalPlatform = process.platform + Object.defineProperty(process, "platform", { + value: "darwin", + }) + }) + + afterAll(() => { + Object.defineProperty(process, "platform", { + value: originalPlatform, + }) + }) + beforeEach(async () => { const baseDir = path.join(os.tmpdir(), `checkpoint-service-test-${Date.now()}`) const repo = await initRepo({ baseDir }) diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 307ac250da..c60bbfd136 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -701,27 +701,29 @@ const SettingsView = ({ onDone }: SettingsViewProps) => { )} -
- Enable experimental checkpoints - + When enabled, Roo will save a checkpoint whenever a file in the workspace is + modified, added or deleted, letting you easily revert to a previous state. +
- When enabled, Roo will save a checkpoint whenever a file in the workspace is modified, - added or deleted, letting you easily revert to a previous state. -
-