* Encode a parameter string for the Coder CLI's --parameter flag. * The CLI uses CSV parsing, so values containing quotes or commas need escaping: * - Wrap the entire string in double quotes * - Escape internal double quotes as ""
(nameValue: string)
| 803 | * - Escape internal double quotes as "" |
| 804 | */ |
| 805 | private encodeParameterValue(nameValue: string): string { |
| 806 | if (!nameValue.includes('"') && !nameValue.includes(",")) { |
| 807 | return nameValue; |
| 808 | } |
| 809 | // CSV quoting: wrap in quotes, escape internal quotes as "" |
| 810 | return `"${nameValue.replace(/"/g, '""')}"`; |
| 811 | } |
| 812 | |
| 813 | /** |
| 814 | * Compute extra --parameter flags needed for workspace creation. |