Skip to content

Commit dfb2677

Browse files
committed
Add changeset
1 parent 3d0fc3c commit dfb2677

File tree

8 files changed

+184
-192
lines changed

8 files changed

+184
-192
lines changed

.changeset/great-mice-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Remove redundant zod schemas

src/core/config/CustomModesManager.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from "vscode"
22
import * as path from "path"
33
import * as fs from "fs/promises"
4-
import { CustomModesSettingsSchema } from "./CustomModesSchema"
4+
import { customModesSettingsSchema } from "../../schemas"
55
import { ModeConfig } from "../../shared/modes"
66
import { fileExistsAtPath } from "../../utils/fs"
77
import { arePathsEqual, getWorkspacePath } from "../../utils/path"
@@ -62,7 +62,7 @@ export class CustomModesManager {
6262
try {
6363
const content = await fs.readFile(filePath, "utf-8")
6464
const settings = JSON.parse(content)
65-
const result = CustomModesSettingsSchema.safeParse(settings)
65+
const result = customModesSettingsSchema.safeParse(settings)
6666
if (!result.success) {
6767
return []
6868
}
@@ -144,7 +144,8 @@ export class CustomModesManager {
144144
return
145145
}
146146

147-
const result = CustomModesSettingsSchema.safeParse(config)
147+
const result = customModesSettingsSchema.safeParse(config)
148+
148149
if (!result.success) {
149150
vscode.window.showErrorMessage(errorMessage)
150151
return

src/core/config/CustomModesSchema.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

src/core/config/__tests__/CustomModesSettings.test.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { CustomModesSettingsSchema } from "../CustomModesSchema"
1+
// npx jest src/core/config/__tests__/CustomModesSettings.test.ts
2+
3+
import { customModesSettingsSchema } from "../../../schemas"
24
import { ModeConfig } from "../../../shared/modes"
35
import { ZodError } from "zod"
46

@@ -17,7 +19,7 @@ describe("CustomModesSettings", () => {
1719
}
1820

1921
expect(() => {
20-
CustomModesSettingsSchema.parse(validSettings)
22+
customModesSettingsSchema.parse(validSettings)
2123
}).not.toThrow()
2224
})
2325

@@ -27,7 +29,7 @@ describe("CustomModesSettings", () => {
2729
}
2830

2931
expect(() => {
30-
CustomModesSettingsSchema.parse(validSettings)
32+
customModesSettingsSchema.parse(validSettings)
3133
}).not.toThrow()
3234
})
3335

@@ -44,15 +46,15 @@ describe("CustomModesSettings", () => {
4446
}
4547

4648
expect(() => {
47-
CustomModesSettingsSchema.parse(validSettings)
49+
customModesSettingsSchema.parse(validSettings)
4850
}).not.toThrow()
4951
})
5052

5153
test("rejects missing customModes field", () => {
5254
const invalidSettings = {} as any
5355

5456
expect(() => {
55-
CustomModesSettingsSchema.parse(invalidSettings)
57+
customModesSettingsSchema.parse(invalidSettings)
5658
}).toThrow(ZodError)
5759
})
5860

@@ -68,10 +70,10 @@ describe("CustomModesSettings", () => {
6870
}
6971

7072
expect(() => {
71-
CustomModesSettingsSchema.parse(invalidSettings)
73+
customModesSettingsSchema.parse(invalidSettings)
7274
}).toThrow(ZodError)
7375
expect(() => {
74-
CustomModesSettingsSchema.parse(invalidSettings)
76+
customModesSettingsSchema.parse(invalidSettings)
7577
}).toThrow("Slug must contain only letters numbers and dashes")
7678
})
7779

@@ -81,17 +83,17 @@ describe("CustomModesSettings", () => {
8183
}
8284

8385
expect(() => {
84-
CustomModesSettingsSchema.parse(invalidSettings)
86+
customModesSettingsSchema.parse(invalidSettings)
8587
}).toThrow(ZodError)
8688
})
8789

8890
test("rejects null or undefined", () => {
8991
expect(() => {
90-
CustomModesSettingsSchema.parse(null)
92+
customModesSettingsSchema.parse(null)
9193
}).toThrow(ZodError)
9294

9395
expect(() => {
94-
CustomModesSettingsSchema.parse(undefined)
96+
customModesSettingsSchema.parse(undefined)
9597
}).toThrow(ZodError)
9698
})
9799

@@ -104,7 +106,7 @@ describe("CustomModesSettings", () => {
104106
}
105107

106108
expect(() => {
107-
CustomModesSettingsSchema.parse(duplicateSettings)
109+
customModesSettingsSchema.parse(duplicateSettings)
108110
}).toThrow("Duplicate mode slugs are not allowed")
109111
})
110112

@@ -119,7 +121,7 @@ describe("CustomModesSettings", () => {
119121
}
120122

121123
expect(() => {
122-
CustomModesSettingsSchema.parse(invalidSettings)
124+
customModesSettingsSchema.parse(invalidSettings)
123125
}).toThrow(ZodError)
124126
})
125127

@@ -134,7 +136,7 @@ describe("CustomModesSettings", () => {
134136
}
135137

136138
expect(() => {
137-
CustomModesSettingsSchema.parse(validSettings)
139+
customModesSettingsSchema.parse(validSettings)
138140
}).not.toThrow()
139141
})
140142
})

src/core/config/__tests__/GroupConfigSchema.test.ts

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)