(value: string)
| 4 | export type StringFieldCustomValidateFn = (value: string) => string | true |
| 5 | |
| 6 | export function stringPortValidate(value: string): string | true { |
| 7 | // Allow empty string — optional port fields skip validation when left blank |
| 8 | if (!value.trim()) { |
| 9 | return true |
| 10 | } |
| 11 | const port = z.coerce.number().safeParse(value) |
| 12 | if (!port.success) { |
| 13 | return 'Invalid value, expected a number' |
| 14 | } |
| 15 | if (port.data < 1 || port.data > 65535) { |
| 16 | return 'Port must be between 1 and 65535' |
| 17 | } |
| 18 | return true |
| 19 | } |
| 20 | |
| 21 | export async function promptForStringField({ |
| 22 | label, |
nothing calls this directly
no outgoing calls
no test coverage detected