(deps: Partial<DoctorDeps> | DoctorDeps | undefined)
| 113 | } |
| 114 | |
| 115 | function resolveDeps(deps: Partial<DoctorDeps> | DoctorDeps | undefined): ResolvedDoctorDeps { |
| 116 | let configRpc = deps?.configRpc; |
| 117 | const getConfigRpc = (): KimiConfigRpc => { |
| 118 | configRpc ??= createKimiConfigRpc(); |
| 119 | return configRpc; |
| 120 | }; |
| 121 | |
| 122 | return { |
| 123 | cwd: deps?.cwd ?? (() => process.cwd()), |
| 124 | defaultConfigPath: deps?.defaultConfigPath ?? (() => getConfigRpc().resolveConfigPath()), |
| 125 | defaultTuiConfigPath: deps?.defaultTuiConfigPath ?? getTuiConfigPath, |
| 126 | stdout: deps?.stdout ?? process.stdout, |
| 127 | stderr: deps?.stderr ?? process.stderr, |
| 128 | exit: deps?.exit ?? ((code) => process.exit(code)), |
| 129 | fileExists: deps?.fileExists ?? existsSync, |
| 130 | readTextFile: deps?.readTextFile ?? ((path) => readFile(path, 'utf-8')), |
| 131 | validateConfigToml: |
| 132 | deps?.validateConfigToml ?? |
| 133 | ((text, filePath) => getConfigRpc().validateConfigToml({ text, filePath })), |
| 134 | }; |
| 135 | } |
| 136 | |
| 137 | async function buildCheckSpecs( |
| 138 | deps: ResolvedDoctorDeps, |
no test coverage detected