Skip to content

Commit bbe4405

Browse files
committed
PR feedback
1 parent 5d693ab commit bbe4405

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/utils/migrateSettings.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { fileExistsAtPath } from "./fs"
55
import { GlobalFileNames } from "../shared/globalFileNames"
66
import * as yaml from "yaml"
77

8+
const deprecatedCustomModesJSONFilename = "custom_modes.json"
9+
810
/**
911
* Migrates old settings files to new file names
1012
*
@@ -16,9 +18,9 @@ export async function migrateSettings(
1618
): Promise<void> {
1719
// Legacy file names that need to be migrated to the new names in GlobalFileNames
1820
const fileMigrations = [
19-
{ oldName: "cline_custom_modes.json", newName: GlobalFileNames.mcpSettings },
20-
{ oldName: "cline_mcp_settings.json", newName: GlobalFileNames.mcpSettings },
2121
// custom_modes.json to custom_modes.yaml is handled separately below
22+
{ oldName: "cline_custom_modes.json", newName: deprecatedCustomModesJSONFilename },
23+
{ oldName: "cline_mcp_settings.json", newName: GlobalFileNames.mcpSettings },
2224
]
2325

2426
try {
@@ -65,7 +67,7 @@ export async function migrateSettings(
6567
* Special migration function to convert custom_modes.json to YAML format
6668
*/
6769
async function migrateCustomModesToYaml(settingsDir: string, outputChannel: vscode.OutputChannel): Promise<void> {
68-
const oldJsonPath = path.join(settingsDir, "custom_modes.json")
70+
const oldJsonPath = path.join(settingsDir, deprecatedCustomModesJSONFilename)
6971
const newYamlPath = path.join(settingsDir, GlobalFileNames.customModes)
7072

7173
// Only proceed if JSON exists and YAML doesn't
@@ -88,7 +90,7 @@ async function migrateCustomModesToYaml(settingsDir: string, outputChannel: vsco
8890

8991
try {
9092
// Parse JSON to object
91-
const customModesData = JSON.parse(jsonContent)
93+
const customModesData = yaml.parse(jsonContent)
9294

9395
// Convert to YAML
9496
const yamlContent = yaml.stringify(customModesData)

0 commit comments

Comments
 (0)