allErrors.ts
utils/settings/allErrors.ts
No strong subsystem tag
33
Lines
1257
Bytes
1
Exports
3
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 33 lines, 3 detected imports, and 1 detected exports.
Important relationships
Detected exports
getSettingsWithAllErrors
Keywords
errorssettingsconfiggetsettingswitherrorsvalidationresultscopecirculardependencygetmcpconfigsbyscope
Detected imports
../../services/mcp/config.js./settings.js./validation.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* Combines settings validation errors with MCP configuration errors.
*
* This module exists to break a circular dependency:
* settings.ts → mcp/config.ts → settings.ts
*
* By moving the MCP error aggregation here (a leaf that imports both
* settings.ts and mcp/config.ts, but is imported by neither), the cycle
* is eliminated.
*/
import { getMcpConfigsByScope } from '../../services/mcp/config.js'
import { getSettingsWithErrors } from './settings.js'
import type { SettingsWithErrors } from './validation.js'
/**
* Get merged settings with all validation errors, including MCP config errors.
*
* Use this instead of getSettingsWithErrors() when you need the full set of
* errors (settings + MCP). The underlying getSettingsWithErrors() no longer
* includes MCP errors to avoid the circular dependency.
*/
export function getSettingsWithAllErrors(): SettingsWithErrors {
const result = getSettingsWithErrors()
// 'dynamic' scope does not have errors returned; it throws and is set on cli startup
const scopes = ['user', 'project', 'local'] as const
const mcpErrors = scopes.flatMap(scope => getMcpConfigsByScope(scope).errors)
return {
settings: result.settings,
errors: [...result.errors, ...mcpErrors],
}
}