What problem does this solve?
Several validated CLI concepts remain primitive strings or numbers after validation. For example, labelMode is validated against add/overwrite but remains typed as string. Priority and estimate are parsed as numbers but their validated meaning is not carried by the type.
Proposed solution
Introduce parser functions that return narrowed domain types.
Examples:
export type LabelMode = "add" | "overwrite";
export function parseLabelMode(value: string | undefined): LabelMode | undefined {
if (value === undefined) return undefined;
if (value === "add" || value === "overwrite") return value;
throw invalidParameterError("--label-mode", "must be either 'add' or 'overwrite'");
}
export type IssuePriority = 0 | 1 | 2 | 3 | 4;
Acceptance criteria:
- labelMode is narrowed to "add" | "overwrite" after parsing.
- Priority parsing returns a constrained type or documented validated number.
- Commands avoid repeated raw string checks after parsing.
- Behavior remains unchanged.
Alternatives considered
Keep primitive string/number types after validation. This is simple but loses useful type information immediately after parsing.
Primary use case
LLM agent integration
What problem does this solve?
Several validated CLI concepts remain primitive strings or numbers after validation. For example, labelMode is validated against add/overwrite but remains typed as string. Priority and estimate are parsed as numbers but their validated meaning is not carried by the type.
Proposed solution
Introduce parser functions that return narrowed domain types.
Examples:
Acceptance criteria:
Alternatives considered
Keep primitive string/number types after validation. This is simple but loses useful type information immediately after parsing.
Primary use case
LLM agent integration