mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 07:36:10 +00:00
* feat(tooling): add tsgo typecheck lane for scripts/** * fix(scripts): burn down scripts type debt surfaced by the new lane Typing-only except bugs the lane surfaced: gh-read timeout race, Discord Headers spread dropping entries, undefined allowedHeadBranches match, plugin-boundary matchAll crash. Deletes retired config keys from fixtures/benches (prompt snapshots regenerated, config dump only) and the orphaned non-runnable sync-moonshot-docs script. Adds full-surface .d.mts declarations for existing .mjs boundaries.
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
type FlagArgs = Record<string, unknown>;
|
|
type FlagSpec<T extends FlagArgs> = {
|
|
consume(
|
|
argv: readonly string[],
|
|
index: number,
|
|
args: T,
|
|
): {
|
|
flag: string;
|
|
nextIndex: number;
|
|
repeatable: boolean;
|
|
apply(target: T): void;
|
|
} | null;
|
|
};
|
|
|
|
export function readFlagValue(args: readonly string[], name: string): string | undefined;
|
|
export function stripLeadingPackageManagerSeparator(argv: string[]): string[];
|
|
export function stringFlag<T extends FlagArgs>(
|
|
flag: string,
|
|
key: string,
|
|
options?: { rejectShortOptions?: boolean },
|
|
): FlagSpec<T>;
|
|
export function stringListFlag<T extends FlagArgs>(
|
|
flag: string,
|
|
key: string,
|
|
options?: { rejectShortOptions?: boolean },
|
|
): FlagSpec<T>;
|
|
export function intFlag<T extends FlagArgs>(
|
|
flag: string,
|
|
key: string,
|
|
options?: { min?: number },
|
|
): FlagSpec<T>;
|
|
export function floatFlag<T extends FlagArgs>(
|
|
flag: string,
|
|
key: string,
|
|
options?: { includeMin?: boolean; min?: number },
|
|
): FlagSpec<T>;
|
|
export function booleanFlag<T extends FlagArgs>(
|
|
flag: string,
|
|
key: string,
|
|
value?: unknown,
|
|
): FlagSpec<T>;
|
|
export function parseFlagArgs<T extends FlagArgs>(
|
|
argv: readonly string[],
|
|
args: T,
|
|
specs: readonly FlagSpec<T>[],
|
|
options?: {
|
|
allowUnknownOptions?: boolean;
|
|
ignoreDoubleDash?: boolean;
|
|
onUnhandledArg?: (arg: string, args: T) => "handled" | void;
|
|
},
|
|
): T;
|