MCPcopy
hub / github.com/inkeep/open-knowledge / resolveConfigPath

Function resolveConfigPath

packages/core/src/config/write-config-patch.ts:52–66  ·  view source on GitHub ↗
(
  scope: WriteScope,
  cwd: string,
  homedirOverride?: string,
)

Source from the content-addressed store, hash-verified

50export type WriteConfigPatchResult = Result<WriteConfigPatchSuccess, ConfigValidationError>;
51
52export function resolveConfigPath(
53 scope: WriteScope,
54 cwd: string,
55 homedirOverride?: string,
56): string {
57 if (scope === 'user') {
58 const home = homedirOverride ?? homedir();
59 return resolve(home, OK_DIR, USER_CONFIG_FILENAME);
60 }
61 const absCwd = isAbsolute(cwd) ? cwd : resolve(cwd);
62 if (scope === 'project-local') {
63 return resolve(absCwd, OK_DIR, LOCAL_DIR, CONFIG_FILENAME);
64 }
65 return resolve(absCwd, OK_DIR, CONFIG_FILENAME);
66}
67
68function err(error: ConfigValidationError): Err<ConfigValidationError> {
69 return { ok: false, error };

Callers 15

readJsonForScopeFunction · 0.90
resolveRootAutoSyncFunction · 0.85
writeRawFunction · 0.85
isTerminalConsentedFunction · 0.85
writeConfigPatchInnerFunction · 0.85
resolveLocalSinkBlockFunction · 0.85
runMigrateFunction · 0.85
loadConfigFunction · 0.85
resolveLocalSinkConfigFunction · 0.85

Calls

no outgoing calls

Tested by 1

writeRawFunction · 0.68