Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-kings-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---

Tasks history support
15 changes: 15 additions & 0 deletions cli/src/commands/__tests__/clear.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ describe("clearCommand", () => {
balanceData: null,
profileLoading: false,
balanceLoading: false,
refreshTerminal: vi.fn().mockResolvedValue(undefined),
taskHistoryData: null,
taskHistoryFilters: {
workspace: "current",
sort: "newest",
favoritesOnly: false,
},
taskHistoryLoading: false,
taskHistoryError: null,
fetchTaskHistory: vi.fn().mockResolvedValue(undefined),
updateTaskHistoryFilters: vi.fn().mockResolvedValue(null),
changeTaskHistoryPage: vi.fn().mockResolvedValue(null),
nextTaskHistoryPage: vi.fn().mockResolvedValue(null),
previousTaskHistoryPage: vi.fn().mockResolvedValue(null),
sendWebviewMessage: vi.fn().mockResolvedValue(undefined),
}
})

Expand Down
27 changes: 24 additions & 3 deletions cli/src/commands/__tests__/new.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,39 @@ describe("/new command", () => {
input: "/new",
args: [],
options: {},
sendMessage: vi.fn(),
sendMessage: vi.fn().mockResolvedValue(undefined),
addMessage: vi.fn(),
clearMessages: vi.fn(),
replaceMessages: vi.fn(),
setMessageCutoffTimestamp: vi.fn(),
clearTask: vi.fn().mockResolvedValue(undefined),
setMode: vi.fn(),
exit: vi.fn(),
routerModels: null,
currentProvider: null,
kilocodeDefaultModel: "",
updateProviderModel: vi.fn(),
refreshRouterModels: vi.fn(),
updateProviderModel: vi.fn().mockResolvedValue(undefined),
refreshRouterModels: vi.fn().mockResolvedValue(undefined),
updateProvider: vi.fn().mockResolvedValue(undefined),
profileData: null,
balanceData: null,
profileLoading: false,
balanceLoading: false,
refreshTerminal: vi.fn().mockResolvedValue(undefined),
taskHistoryData: null,
taskHistoryFilters: {
workspace: "current",
sort: "newest",
favoritesOnly: false,
},
taskHistoryLoading: false,
taskHistoryError: null,
fetchTaskHistory: vi.fn().mockResolvedValue(undefined),
updateTaskHistoryFilters: vi.fn().mockResolvedValue(null),
changeTaskHistoryPage: vi.fn().mockResolvedValue(null),
nextTaskHistoryPage: vi.fn().mockResolvedValue(null),
previousTaskHistoryPage: vi.fn().mockResolvedValue(null),
sendWebviewMessage: vi.fn().mockResolvedValue(undefined),
}
})

Expand Down
4 changes: 3 additions & 1 deletion cli/src/commands/clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const clearCommand: Command = {
category: "system",
priority: 8,
handler: async (context) => {
const { setMessageCutoffTimestamp, addMessage } = context
const { setMessageCutoffTimestamp, addMessage, refreshTerminal } = context
const now = Date.now()
setMessageCutoffTimestamp(now)
// Add Spacer message
Expand All @@ -23,5 +23,7 @@ export const clearCommand: Command = {
content: "",
ts: now + 1,
})
// Refresh terminal to clear screen
await refreshTerminal()
},
}
14 changes: 14 additions & 0 deletions cli/src/commands/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import type { RouterModels } from "../../types/messages.js"
import type { ProviderConfig } from "../../config/types.js"
import type { ProfileData, BalanceData } from "../../state/atoms/profile.js"
import type { TaskHistoryData, TaskHistoryFilters } from "../../state/atoms/taskHistory.js"

export interface Command {
name: string
Expand Down Expand Up @@ -55,6 +56,18 @@ export interface CommandContext {
balanceData: BalanceData | null
profileLoading: boolean
balanceLoading: boolean
// Task history context
taskHistoryData: TaskHistoryData | null
taskHistoryFilters: TaskHistoryFilters
taskHistoryLoading: boolean
taskHistoryError: string | null
fetchTaskHistory: () => Promise<void>
updateTaskHistoryFilters: (filters: Partial<TaskHistoryFilters>) => Promise<TaskHistoryData>
changeTaskHistoryPage: (pageIndex: number) => Promise<TaskHistoryData>
nextTaskHistoryPage: () => Promise<TaskHistoryData>
previousTaskHistoryPage: () => Promise<TaskHistoryData>
sendWebviewMessage: (message: any) => Promise<void>
refreshTerminal: () => Promise<void>
}

export type CommandHandler = (context: CommandContext) => Promise<void> | void
Expand Down Expand Up @@ -115,6 +128,7 @@ export interface ArgumentProviderContext {
profileLoading: boolean
updateProviderModel: (modelId: string) => Promise<void>
refreshRouterModels: () => Promise<void>
taskHistoryData: TaskHistoryData | null
}
}

Expand Down
2 changes: 2 additions & 0 deletions cli/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { modelCommand } from "./model.js"
import { profileCommand } from "./profile.js"
import { teamsCommand } from "./teams.js"
import { configCommand } from "./config.js"
import { tasksCommand } from "./tasks.js"

/**
* Initialize all commands
Expand All @@ -31,4 +32,5 @@ export function initializeCommands(): void {
commandRegistry.register(profileCommand)
commandRegistry.register(teamsCommand)
commandRegistry.register(configCommand)
commandRegistry.register(tasksCommand)
}
5 changes: 4 additions & 1 deletion cli/src/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const newCommand: Command = {
category: "system",
priority: 9,
handler: async (context) => {
const { clearTask, replaceMessages } = context
const { clearTask, replaceMessages, refreshTerminal } = context

// Clear the extension task state (this also clears extension messages)
await clearTask()
Expand All @@ -32,5 +32,8 @@ export const newCommand: Command = {
],
}),
])

// Force terminal refresh to clear screen
await refreshTerminal()
},
}
Loading