(paramId: string)
| 899 | * Formats parameter IDs into human-readable labels |
| 900 | */ |
| 901 | export function formatParameterLabel(paramId: string): string { |
| 902 | // Special cases |
| 903 | if (paramId === 'apiKey') return 'API Key' |
| 904 | if (paramId === 'apiVersion') return 'API Version' |
| 905 | if (paramId === 'accessToken') return 'Access Token' |
| 906 | if (paramId === 'refreshToken') return 'Refresh Token' |
| 907 | if (paramId === 'botToken') return 'Bot Token' |
| 908 | |
| 909 | // Handle underscore and hyphen separated words |
| 910 | if (paramId.includes('_') || paramId.includes('-')) { |
| 911 | return paramId |
| 912 | .split(/[-_]/) |
| 913 | .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) |
| 914 | .join(' ') |
| 915 | } |
| 916 | |
| 917 | // Handle single character parameters |
| 918 | if (paramId.length === 1) return paramId.toUpperCase() |
| 919 | |
| 920 | // Handle camelCase |
| 921 | if (/[A-Z]/.test(paramId)) { |
| 922 | const result = paramId.replace(/([A-Z])/g, ' $1') |
| 923 | return ( |
| 924 | result.charAt(0).toUpperCase() + |
| 925 | result |
| 926 | .slice(1) |
| 927 | .replace(/ Api/g, ' API') |
| 928 | .replace(/ Id/g, ' ID') |
| 929 | .replace(/ Url/g, ' URL') |
| 930 | .replace(/ Uri/g, ' URI') |
| 931 | .replace(/ Ui/g, ' UI') |
| 932 | ) |
| 933 | } |
| 934 | |
| 935 | // Simple case - just capitalize first letter |
| 936 | return paramId.charAt(0).toUpperCase() + paramId.slice(1) |
| 937 | } |
| 938 | |
| 939 | /** |
| 940 | * SubBlock IDs that control tool routing, not user-facing parameters. |
no test coverage detected