Skip to content

Commit 245008a

Browse files
committed
Some cleanup
1 parent 511586d commit 245008a

18 files changed

+239
-573
lines changed

apps/cli/src/__tests__/globalCommands.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { describe, it, expect } from "vitest"
21
import {
2+
type GlobalCommand,
3+
type GlobalCommandAction,
34
GLOBAL_COMMANDS,
45
getGlobalCommand,
56
getGlobalCommandsForAutocomplete,
6-
type GlobalCommand,
7-
type GlobalCommandAction,
87
} from "../globalCommands.js"
98

109
describe("globalCommands", () => {

apps/cli/src/__tests__/store.test.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { describe, it, expect, beforeEach } from "vitest"
21
import { useCLIStore } from "../ui/store.js"
32

43
describe("useCLIStore", () => {
@@ -43,8 +42,8 @@ describe("useCLIStore", () => {
4342
const store = useCLIStore.getState()
4443
store.addMessage({ id: "1", role: "user", content: "test" })
4544
store.setTaskHistory([{ id: "task1", task: "test", workspace: "/test", ts: Date.now() }])
46-
store.setAvailableModes([{ slug: "code", name: "Code" }])
47-
store.setAllSlashCommands([{ name: "test", source: "global" as const }])
45+
store.setAvailableModes([{ key: "code", slug: "code", name: "Code" }])
46+
store.setAllSlashCommands([{ key: "test", name: "test", source: "global" as const }])
4847
store.setIsResumingTask(true)
4948
store.setLoading(true)
5049
store.setHasStartedTask(true)
@@ -115,8 +114,8 @@ describe("useCLIStore", () => {
115114

116115
it("should PRESERVE availableModes", () => {
117116
const modes = [
118-
{ slug: "code", name: "Code", description: "Code mode" },
119-
{ slug: "architect", name: "Architect", description: "Architect mode" },
117+
{ key: "code", slug: "code", name: "Code", description: "Code mode" },
118+
{ key: "architect", slug: "architect", name: "Architect", description: "Architect mode" },
120119
]
121120
useCLIStore.getState().setAvailableModes(modes)
122121

@@ -127,8 +126,8 @@ describe("useCLIStore", () => {
127126

128127
it("should PRESERVE allSlashCommands", () => {
129128
const commands = [
130-
{ name: "new", description: "New task", source: "global" as const },
131-
{ name: "help", description: "Get help", source: "built-in" as const },
129+
{ key: "new", name: "new", description: "New task", source: "global" as const },
130+
{ key: "help", name: "help", description: "Get help", source: "built-in" as const },
132131
]
133132
useCLIStore.getState().setAllSlashCommands(commands)
134133

@@ -139,8 +138,8 @@ describe("useCLIStore", () => {
139138

140139
it("should PRESERVE fileSearchResults", () => {
141140
const results = [
142-
{ path: "file1.ts", type: "file" as const },
143-
{ path: "file2.ts", type: "file" as const },
141+
{ key: "file1", path: "file1.ts", type: "file" as const },
142+
{ key: "file2", path: "file2.ts", type: "file" as const },
144143
]
145144
useCLIStore.getState().setFileSearchResults(results)
146145

@@ -184,8 +183,8 @@ describe("useCLIStore", () => {
184183

185184
// Step 1: Initial state with task history and modes from webviewDidLaunch
186185
store().setTaskHistory([{ id: "task1", task: "Previous task", workspace: "/test", ts: Date.now() }])
187-
store().setAvailableModes([{ slug: "code", name: "Code" }])
188-
store().setAllSlashCommands([{ name: "new", source: "global" as const }])
186+
store().setAvailableModes([{ key: "code", slug: "code", name: "Code" }])
187+
store().setAllSlashCommands([{ key: "new", name: "new", source: "global" as const }])
189188

190189
// Step 2: User starts a new task
191190
store().setHasStartedTask(true)
@@ -255,7 +254,7 @@ describe("useCLIStore", () => {
255254
// Set up both task-specific and global state
256255
store().addMessage({ id: "1", role: "user", content: "test" })
257256
store().setTaskHistory([{ id: "t1", task: "task", workspace: "/", ts: Date.now() }])
258-
store().setAvailableModes([{ slug: "code", name: "Code" }])
257+
store().setAvailableModes([{ key: "code", slug: "code", name: "Code" }])
259258

260259
// Use resetForTaskSwitch
261260
store().resetForTaskSwitch()

0 commit comments

Comments
 (0)