Compare commits

..
Author SHA1 Message Date
abeatrix e262d4fb57 update 2025-09-04 14:35:32 -07:00
abeatrix acc0750970 Merge branch 'fix/taskHistory-migration-across-dev-and-prod' of https://github.com/cline/cline into fix/taskHistory-migration-across-dev-and-prod 2025-09-04 14:21:47 -07:00
abeatrix 3098c040c6 Simplify the migration function
Simplify the migration function by consolidating conditional logic,
removing redundant logging, and using concurrent operations for
better performance. The logic now handles both empty and populated
destination scenarios more clearly.
2025-09-04 14:21:02 -07:00
Arafatkatze 9ebb1c2b38 Adding Multi root algo 2025-09-04 14:19:58 -07:00
Arafatkatze f73fe56474 Adding Multi root algo 2025-09-04 14:18:10 -07:00
AraandBee a81cfdb56e Update src/core/storage/state-migrations.ts
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
2025-09-04 14:15:00 -07:00
AraandBee 917e66f18c Update src/core/storage/state-migrations.ts
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
2025-09-04 14:14:53 -07:00
AraandBee 97382e9749 Update src/core/storage/state-migrations.ts
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
2025-09-04 14:14:46 -07:00
AraandBee 164bd4e393 Update src/core/storage/state-migrations.ts
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
2025-09-04 14:14:24 -07:00
AraandBee 7ce4943fdc Update src/core/storage/state-migrations.ts
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
2025-09-04 14:14:17 -07:00
celestial-vault a198adb9e8 fix taskHistory migration when run across main and the prod version which use the old and the new location 2025-09-04 12:14:35 -07:00
Bee d69fb10cfd fix: only focus chat input when in chat view (#5991)
* fix: only focus chat input when in chat view

- Only focus chat input when chat view is visible, not when hidden (in other view)
- Wrap onDone callback in arrow function for consistency
- Replace inline styles with Tailwind classes for button container

* update gap value
2025-09-04 10:39:09 -07:00
celestial-vault 0f6eab2bfe make proto objects not optional by default (#5985) 2025-09-03 19:47:14 -07:00
11 changed files with 78 additions and 46 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Fix issue where editor panel gets reset to chat view on each chat input focus event
-6
View File
@@ -8,19 +8,16 @@ message Metadata {
}
message EmptyRequest {
Metadata metadata = 1;
}
message Empty {
}
message StringRequest {
Metadata metadata = 1;
string value = 2;
}
message StringArrayRequest {
Metadata metadata = 1;
repeated string value = 2;
}
@@ -29,7 +26,6 @@ message String {
}
message Int64Request {
Metadata metadata = 1;
int64 value = 2;
}
@@ -38,7 +34,6 @@ message Int64 {
}
message BytesRequest {
Metadata metadata = 1;
bytes value = 2;
}
@@ -47,7 +42,6 @@ message Bytes {
}
message BooleanRequest {
Metadata metadata = 1;
bool value = 2;
}
-4
View File
@@ -4,8 +4,6 @@ package host;
option java_package = "bot.cline.host.proto";
option java_multiple_files = true;
import "cline/common.proto";
// Provides methods for working with IDE windows and editors.
service WindowService {
// Opens a text document in the IDE editor and returns editor information.
@@ -40,7 +38,6 @@ service WindowService {
}
message ShowTextDocumentRequest {
cline.Metadata metadata = 1;
string path = 2;
optional ShowTextDocumentOptions options = 3;
}
@@ -59,7 +56,6 @@ message TextEditorInfo {
}
message ShowOpenDialogueRequest {
cline.Metadata metadata = 1;
optional bool can_select_many = 2;
optional string open_label = 3;
optional ShowOpenDialogueFilterOption filters = 4;
+1 -1
View File
@@ -31,7 +31,7 @@ const TS_PROTO_OPTIONS = [
"esModuleInterop=true",
"outputServices=generic-definitions", // output generic ServiceDefinitions
"outputIndex=true", // output an index file for each package which exports all protos in the package.
"useOptionals=messages", // Message fields are optional, scalars are not.
"useOptionals=none", // scalar and message fields are required unless they are marked as optional.
"useDate=false", // Timestamp fields will not be automatically converted to Date.
]
+1 -3
View File
@@ -27,9 +27,7 @@ import { getLatestAnnouncementId } from "./utils/announcements"
*/
export async function initialize(context: vscode.ExtensionContext): Promise<WebviewProvider> {
// Set the distinct ID for logging and telemetry
const distinctId = await initializeDistinctId(context)
context.globalState.update("distinctId", distinctId)
await initializeDistinctId(context)
// Initialize PostHog client provider
PostHogClientProvider.getInstance()
+30 -12
View File
@@ -1,6 +1,7 @@
import fs from "fs/promises"
import path from "path"
import * as vscode from "vscode"
import { HistoryItem } from "@/shared/HistoryItem"
import { ensureRulesDirectoryExists, readTaskHistoryFromState, writeTaskHistoryToState } from "./disk"
import { StateManager } from "./StateManager"
@@ -68,20 +69,37 @@ export async function migrateWorkspaceToGlobalStorage(context: vscode.ExtensionC
export async function migrateTaskHistoryToFile(context: vscode.ExtensionContext) {
try {
// If the old taskHistory vs code global state is undefined, do nothing
const vscodeGlobalStateTaskHistory = await context.globalState.get("taskHistory")
if (vscodeGlobalStateTaskHistory === undefined) {
// Get data from old location
const vscodeGlobalStateTaskHistory = context.globalState.get<HistoryItem[] | undefined>("taskHistory")
// Normalize old location data to array (empty array if undefined/null/not-array)
const oldLocationData = Array.isArray(vscodeGlobalStateTaskHistory) ? vscodeGlobalStateTaskHistory : []
// Early return if no migration needed
if (oldLocationData.length === 0) {
console.log("[Storage Migration] No task history to migrate")
return
}
// Read legacy from VS Code globalState, default to []
console.log("[Storage Migration] taskHistory from vscode global state: ", vscodeGlobalStateTaskHistory)
// Always create the file, even when empty
await writeTaskHistoryToState(context, Array.isArray(vscodeGlobalStateTaskHistory) ? vscodeGlobalStateTaskHistory : [])
// Don't remove the old taskHistory yet, while this version is not in production, for better dev experience.
// This is because the old version of the code (still in prod) is still reading taskHistory from the vs code global state, so it will appear as if all the user's tasks have been deleted.
// await context.globalState.update("taskHistory", undefined)
console.log("[Storage Migration] taskHistory file in new location: ", await readTaskHistoryFromState(context))
console.log("[Storage Migration] old vscode global state: ", await context.globalState.get("taskHistory"))
let finalData: HistoryItem[]
let migrationAction: string
const newLocationData = await readTaskHistoryFromState(context)
if (newLocationData.length === 0) {
// Move old data to new location
finalData = oldLocationData
migrationAction = "Migrated task history from old location to new location"
} else {
// Merge old data (more recent) with new data
finalData = [...newLocationData, ...oldLocationData]
migrationAction = "Merged task history from old and new locations"
}
// Perform migration operations sequentially - only clear old data if write succeeds
await writeTaskHistoryToState(context, finalData)
void context.globalState.update("taskHistory", undefined)
console.log(`[Storage Migration] ${migrationAction}`)
} catch (error) {
console.error("[Storage Migration] Failed to migrate task history to file:", error)
}
@@ -47,6 +47,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_ERROR,
message: "Error in file1",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -114,6 +118,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_ERROR,
message: "Error in file1",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -125,6 +133,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_ERROR,
message: "Error in file1",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -134,6 +146,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_ERROR,
message: "Error in file2",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -198,6 +214,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_WARNING,
message: "Warning message",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -240,6 +260,10 @@ describe("Diagnostics Tests", () => {
{
severity: DiagnosticSeverity.DIAGNOSTIC_ERROR,
message: "File-level error",
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 },
},
},
],
},
@@ -248,7 +272,7 @@ describe("Diagnostics Tests", () => {
const result = await diagnosticsToProblemsString(diagnostics, severities)
expect(result).to.equal("src/file1.ts\n- [Error] Line : File-level error")
expect(result).to.equal("src/file1.ts\n- [Error] Line 1: File-level error")
})
it("should handle diagnostics with missing start property in range", async () => {
-2
View File
@@ -25,8 +25,6 @@ export async function initializeDistinctId(context: ExtensionContext, uuid: () =
if (process.env.IS_DEV) {
console.log("Telemetry distinct ID initialized:", distinctId)
}
return distinctId
}
/*
@@ -188,6 +188,15 @@ export function convertClineMessageToProto(message: AppClineMessage): ProtoCline
endIndex: message.conversationHistoryDeletedRange[1],
}
: undefined,
// Additional optional fields for specific ask/say types
sayTool: undefined,
sayBrowserAction: undefined,
browserActionResult: undefined,
askUseMcpServer: undefined,
planModeResponse: undefined,
askQuestion: undefined,
askNewTask: undefined,
apiReqInfo: undefined,
}
return protoMessage
+3 -3
View File
@@ -238,10 +238,10 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
// Listen for local focusChatInput event
useEffect(() => {
const handleFocusChatInput = () => {
if (isHidden) {
navigateToChat()
// Only focus chat input box if user is currently viewing the chat (not hidden).
if (!isHidden) {
textAreaRef.current?.focus()
}
textAreaRef.current?.focus()
}
window.addEventListener("focusChatInput", handleFocusChatInput)
@@ -324,7 +324,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
}}>
History
</h3>
<VSCodeButton onClick={onDone}>Done</VSCodeButton>
<VSCodeButton onClick={() => onDone()}>Done</VSCodeButton>
</div>
<div style={{ padding: "5px 17px 6px 17px" }}>
<div
@@ -393,19 +393,9 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
/>
</VSCodeRadioGroup>
<div style={{ display: "flex", justifyContent: "flex-end", gap: "10px" }}>
<VSCodeButton
onClick={() => {
handleBatchHistorySelect(true)
}}>
Select All
</VSCodeButton>
<VSCodeButton
onClick={() => {
handleBatchHistorySelect(false)
}}>
Select None
</VSCodeButton>
<div className="flex justify-end gap-2.5">
<VSCodeButton onClick={() => handleBatchHistorySelect(true)}>Select All</VSCodeButton>
<VSCodeButton onClick={() => handleBatchHistorySelect(false)}>Select None</VSCodeButton>
</div>
</div>
</div>