( callback: (config: SerializedContinueConfig) => SerializedContinueConfig, )
| 249 | } |
| 250 | |
| 251 | function editConfigJson( |
| 252 | callback: (config: SerializedContinueConfig) => SerializedContinueConfig, |
| 253 | ): void { |
| 254 | const config = fs.readFileSync(getConfigJsonPath(), "utf8"); |
| 255 | let configJson = JSONC.parse(config); |
| 256 | // Check if it's an object |
| 257 | if (typeof configJson === "object" && configJson !== null) { |
| 258 | configJson = callback(configJson as any) as any; |
| 259 | fs.writeFileSync(getConfigJsonPath(), JSONC.stringify(configJson, null, 2)); |
| 260 | } else { |
| 261 | console.warn("config.json is not a valid object"); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | function editConfigYaml(callback: (config: ConfigYaml) => ConfigYaml): void { |
| 266 | const configPath = getConfigYamlPath(); |
no test coverage detected