(value: string)
| 8 | const isScriptRunCommand = Schema.is(SCRIPT_RUN_COMMAND_PATTERN); |
| 9 | |
| 10 | function normalizeScriptId(value: string): string { |
| 11 | const cleaned = value |
| 12 | .trim() |
| 13 | .toLowerCase() |
| 14 | .replace(/[^a-z0-9]+/g, "-") |
| 15 | .replace(/^-+|-+$/g, ""); |
| 16 | if (cleaned.length === 0) { |
| 17 | return "script"; |
| 18 | } |
| 19 | if (cleaned.length <= MAX_SCRIPT_ID_LENGTH) { |
| 20 | return cleaned; |
| 21 | } |
| 22 | return cleaned.slice(0, MAX_SCRIPT_ID_LENGTH).replace(/-+$/g, "") || "script"; |
| 23 | } |
| 24 | |
| 25 | export const commandForProjectScript = (scriptId: string): KeybindingCommand => |
| 26 | SCRIPT_RUN_COMMAND_PATTERN.make(`script.${scriptId}.run`); |
no outgoing calls
no test coverage detected