Skip to content

Commit acf047c

Browse files
committed
"Add Cline class documentation and implement BabyCline subclass with logging functionality"
1 parent 891a55d commit acf047c

File tree

3 files changed

+357
-66
lines changed

3 files changed

+357
-66
lines changed

src/core/Cline.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ export type ClineEvents = {
9494
taskCompleted: [taskId: string, usage: TokenUsage]
9595
taskTokenUsageUpdated: [taskId: string, usage: TokenUsage]
9696
}
97+
/**
98+
* Cline is a class that represents a single task instance in the CLINE system.
99+
* It manages the conversation between the user and the AI, and provides an interface for the AI to interact with the user.
100+
* It also provides a way to manage the state of the task, such as whether it is paused or completed.
101+
*/
97102

98103
export type ClineOptions = {
99104
provider: ClineProvider

src/core/babyCline.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Cline, ClineOptions } from "./Cline"
2+
import fs from "fs"
3+
4+
// create a function that appends messages to a .log file
5+
function appendLog(message: string) {
6+
fs.appendFileSync("roo-code.log", message + "\n")
7+
}
8+
9+
export class BabyCline extends Cline {
10+
constructor({
11+
provider,
12+
apiConfiguration,
13+
customInstructions,
14+
enableDiff,
15+
enableCheckpoints = true,
16+
checkpointStorage = "task",
17+
fuzzyMatchThreshold,
18+
task,
19+
images,
20+
historyItem,
21+
experiments,
22+
startTask = true,
23+
rootTask,
24+
parentTask,
25+
taskNumber,
26+
}: ClineOptions) {
27+
if (startTask) {
28+
appendLog("start task is true for BabyCline")
29+
appendLog("task: " + task)
30+
appendLog("images: " + images)
31+
appendLog("historyItem: " + historyItem)
32+
}
33+
super({
34+
provider,
35+
apiConfiguration,
36+
customInstructions,
37+
enableDiff,
38+
enableCheckpoints,
39+
checkpointStorage,
40+
fuzzyMatchThreshold,
41+
task,
42+
images,
43+
historyItem,
44+
experiments,
45+
startTask,
46+
rootTask,
47+
parentTask,
48+
taskNumber,
49+
})
50+
}
51+
}

0 commit comments

Comments
 (0)