MCPcopy
hub / github.com/Doorman11991/smallcode / validateSingleFile

Function validateSingleFile

src/compiled/cognition/validate.js:225–234  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

223 return validateTypeScriptString(value);
224}
225async function validateSingleFile(f) {
226 if (typeof f.content !== "string" || f.content.trim().length === 0) {
227 (0, metrics_1.counter)("cognition.validate.failed", { mode: "ast_compiles", kind: "empty_file" });
228 return { ok: false, issues: [`${f.path}: content must be a non-empty TypeScript string`] };
229 }
230 const inner = await validateTypeScriptString(f.content);
231 if (inner.ok)
232 return inner;
233 return { ok: false, issues: inner.issues.map(i => `${f.path}: ${i}`) };
234}
235async function validateFileList(files) {
236 if (files.length === 0) {
237 (0, metrics_1.counter)("cognition.validate.failed", { mode: "ast_compiles", kind: "empty_list" });

Callers 2

validateAstCompilesFunction · 0.70
validateFileListFunction · 0.70

Calls 1

validateTypeScriptStringFunction · 0.70

Tested by

no test coverage detected