MCPcopy Index your code
hub / github.com/inkeep/open-knowledge / annotateIssuesWithSource

Function annotateIssuesWithSource

packages/cli/src/config/loader.ts:75–101  ·  view source on GitHub ↗
(
  zodIssues: ReadonlyArray<{ path: PropertyKey[]; message: string; code: string }>,
  projectFile: LoadedYamlFile,
)

Source from the content-addressed store, hash-verified

73}
74
75function annotateIssuesWithSource(
76 zodIssues: ReadonlyArray<{ path: PropertyKey[]; message: string; code: string }>,
77 projectFile: LoadedYamlFile,
78): ConfigIssue[] {
79 return zodIssues.map((issue) => {
80 const path = issue.path.map((seg) =>
81 typeof seg === 'symbol' ? String(seg) : (seg as string | number),
82 );
83 const base: ConfigIssue = {
84 path,
85 message: issue.message,
86 issueCode: issue.code,
87 };
88 if (projectFile.doc !== null && projectFile.source !== null) {
89 const located = locateIssue({
90 file: projectFile.path,
91 source: projectFile.source,
92 doc: projectFile.doc,
93 path,
94 });
95 if (located !== undefined) {
96 return { ...base, source: located };
97 }
98 }
99 return base;
100 });
101}
102
103export function loadConfig(cwd?: string): LoadConfigResult {
104 const workingDir = cwd ?? process.cwd();

Callers 1

loadConfigFunction · 0.85

Calls 2

locateIssueFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected