refactor: consolidate shared analysis boundaries (#10293)

This commit is contained in:
morluto authored and GitHub committed 2026-11-12 22:05:32 -05:00
1 parent 6878a84796
commit c836f57b7d
70 files changed
+1240 -1131

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
import { err, ok, type Result } from "../domain/result.js";
import { safeParseJson } from "../domain/safeJson.js";
/** Decode one named CLI option before using the selected inputs. */
export const parseCliJsonOption = (
operation: string,
name: string,
text: string | undefined,
message: string,
): Result<unknown, AnalysisInputError> => {
if (text === undefined) return ok(undefined);
const parsed = safeParseJson(text);
return parsed.ok
? parsed
: err(
new AnalysisInputError(operation, { cause: parsed.cause }, [
{ path: [name], reason: "invalid_format", message },
]),
);
};