(text: string, filepath: string)
| 628 | } |
| 629 | |
| 630 | function parseJson(text: string, filepath: string): any | undefined { |
| 631 | try { |
| 632 | return JSON.parse(text) |
| 633 | } catch { |
| 634 | const errors: JsoncParseError[] = [] |
| 635 | const data = parseJsonc(text, errors, { allowTrailingComma: true }) |
| 636 | if (errors.length > 0) { |
| 637 | const msg = errors.map((err) => printParseErrorCode(err.error)).join(", ") |
| 638 | log.warn("failed to parse jsonc", { path: filepath, errors: msg }) |
| 639 | return undefined |
| 640 | } |
| 641 | return data |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | async function importClaudeMcpServers(servers: Record<string, any>, targetConfigPath: string) { |
| 646 | const targetDir = path.dirname(targetConfigPath) |
no outgoing calls
no test coverage detected