diff --git a/.changeset/bitter-maps-leave.md b/.changeset/bitter-maps-leave.md new file mode 100644 index 00000000..6c7ae95d --- /dev/null +++ b/.changeset/bitter-maps-leave.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Added getCwdHash proto diff --git a/proto/cline/checkpoints.proto b/proto/cline/checkpoints.proto index 45c1ed9c..6a5b7905 100644 --- a/proto/cline/checkpoints.proto +++ b/proto/cline/checkpoints.proto @@ -9,6 +9,7 @@ option java_multiple_files = true; service CheckpointsService { rpc checkpointDiff(Int64Request) returns (Empty); rpc checkpointRestore(CheckpointRestoreRequest) returns (Empty); + rpc getCwdHash(StringArrayRequest) returns (PathHashMap); } message CheckpointRestoreRequest { @@ -17,3 +18,7 @@ message CheckpointRestoreRequest { string restore_type = 3; optional int64 offset = 4; } + +message PathHashMap { + map path_hash = 1; +} diff --git a/src/core/controller/checkpoints/getCwdHash.ts b/src/core/controller/checkpoints/getCwdHash.ts new file mode 100644 index 00000000..42faa4d0 --- /dev/null +++ b/src/core/controller/checkpoints/getCwdHash.ts @@ -0,0 +1,18 @@ +import { PathHashMap } from "@shared/proto/cline/checkpoints" +import { StringArrayRequest } from "@shared/proto/cline/common" +import { hashWorkingDir } from "@/integrations/checkpoints/CheckpointUtils" +import { Controller } from ".." + +export async function getCwdHash(_controller: Controller, request: StringArrayRequest): Promise { + const pathHash: Record = {} + + for (const path of request.value) { + try { + pathHash[path] = hashWorkingDir(path) + } catch { + pathHash[path] = "" + } + } + + return PathHashMap.create({ pathHash }) +}