refactor: simplify doctor and error projections

This commit is contained in:
morluto
2026-07-18 04:50:21 +00:00
parent 4851449f71
commit 37f4ac6d70
5 changed files with 635 additions and 484 deletions
+10 -12
View File
@@ -41,16 +41,19 @@ export class NativeCommandFailure extends Error {
}
}
/** Bounds and cancellation applied to one allowlisted native command. */
export interface NativeCommandOptions {
readonly signal?: AbortSignal;
readonly timeoutMs: number;
readonly maxOutputBytes: number;
readonly acceptNonZero?: boolean;
}
export interface NativeCommandRunner {
run(
tool: string,
arguments_: readonly string[],
options: {
readonly signal?: AbortSignal;
readonly timeoutMs: number;
readonly maxOutputBytes: number;
readonly acceptNonZero?: boolean;
},
options: NativeCommandOptions,
): Promise<Result<NativeCommandCapture, NativeCommandFailure>>;
}
@@ -74,12 +77,7 @@ export class XcrunCommandRunner implements NativeCommandRunner {
run(
tool: string,
arguments_: readonly string[],
options: {
readonly signal?: AbortSignal;
readonly timeoutMs: number;
readonly maxOutputBytes: number;
readonly acceptNonZero?: boolean;
},
options: NativeCommandOptions,
): Promise<Result<NativeCommandCapture, NativeCommandFailure>> {
if (!ALLOWED_TOOLS.has(tool))
return Promise.resolve(