/** Parent options accept --flag=value. Tokens after -- belong to the child. */ export function normalizeParentArgv(input: readonly string[]): { args: string[]; runtimeArgs: string[]; } { const boundary = input.indexOf("--"); const runtimeArgs = input .slice(0, boundary < 0 ? undefined : boundary) .flatMap((arg) => { const split = arg.startsWith("--") ? arg.indexOf("=") : -1; return split > 2 ? [arg.slice(0, split), arg.slice(split + 1)] : [arg]; }); return { runtimeArgs, args: boundary < 0 ? [...runtimeArgs] : [...runtimeArgs, ...input.slice(boundary)], }; }