Browse Source

Tidy up the Cline class a bit (#3100)

* Tidy up the Cline class a bit

* Clean up more comments
Chris Estreich 8 months ago
parent
commit
bf38b830b8
2 changed files with 999 additions and 924 deletions
  1. 994 916
      src/core/Cline.ts
  2. 5 8
      src/core/__tests__/Cline.test.ts

File diff suppressed because it is too large
+ 994 - 916
src/core/Cline.ts


+ 5 - 8
src/core/__tests__/Cline.test.ts

@@ -424,7 +424,7 @@ describe("Cline", () => {
 				jest.spyOn(cline as any, "getEnvironmentDetails").mockResolvedValue("")
 
 				// Mock loadContext to return unmodified content.
-				jest.spyOn(cline as any, "loadContext").mockImplementation(async (content) => [content, ""])
+				jest.spyOn(cline as any, "parseUserContent").mockImplementation(async (content) => [content, ""])
 
 				// Add test message to conversation history.
 				cline.apiConversationHistory = [
@@ -577,11 +577,8 @@ describe("Cline", () => {
 				// Mock environment details and context loading
 				jest.spyOn(clineWithImages as any, "getEnvironmentDetails").mockResolvedValue("")
 				jest.spyOn(clineWithoutImages as any, "getEnvironmentDetails").mockResolvedValue("")
-				jest.spyOn(clineWithImages as any, "loadContext").mockImplementation(async (content) => [content, ""])
-				jest.spyOn(clineWithoutImages as any, "loadContext").mockImplementation(async (content) => [
-					content,
-					"",
-				])
+				jest.spyOn(clineWithImages as any, "parseUserContent").mockImplementation(async (content) => content)
+				jest.spyOn(clineWithoutImages as any, "parseUserContent").mockImplementation(async (content) => content)
 
 				// Set up mock streams
 				const mockStreamWithImages = (async function* () {
@@ -885,7 +882,7 @@ describe("Cline", () => {
 				await task.catch(() => {})
 			})
 
-			describe("loadContext", () => {
+			describe("parseUserContent", () => {
 				it("should process mentions in task and feedback tags", async () => {
 					const [cline, task] = Cline.create({
 						provider: mockProvider,
@@ -929,7 +926,7 @@ describe("Cline", () => {
 					]
 
 					// Process the content
-					const [processedContent] = await cline["loadContext"](userContent)
+					const processedContent = await cline.parseUserContent(userContent)
 
 					// Regular text should not be processed
 					expect((processedContent[0] as Anthropic.TextBlockParam).text).toBe("Regular text with @/some/path")

Some files were not shown because too many files changed in this diff