Tidy up the Cline class a bit (#3100)

* Tidy up the Cline class a bit

* Clean up more comments
This commit is contained in:
Chris Estreich 2025-05-05 09:11:47 -07:00 committed by GitHub
parent 11ed7d7d46
commit bf38b830b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 522 additions and 441 deletions

File diff suppressed because it is too large Load diff

View file

@ -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")