|
19 | 19 |
|
20 | 20 | import path from "node:path"; |
21 | 21 | import type { SentryContext } from "../context.js"; |
22 | | -import { looksLikePath, parseOrgProjectArg } from "../lib/arg-parsing.js"; |
| 22 | +import { |
| 23 | + looksLikePath, |
| 24 | + normalizeSlug, |
| 25 | + parseOrgProjectArg, |
| 26 | +} from "../lib/arg-parsing.js"; |
23 | 27 | import { buildCommand } from "../lib/command.js"; |
24 | 28 | import { ContextError } from "../lib/errors.js"; |
25 | 29 | import { warmOrgDetection } from "../lib/init/prefetch.js"; |
@@ -240,15 +244,17 @@ export const initCommand = buildCommand< |
240 | 244 |
|
241 | 245 | // 5. Merge --org flag with target-derived org. |
242 | 246 | // --org is an alternative to the positional <org>/ syntax. |
243 | | - if (flags.org) { |
244 | | - validateResourceId(flags.org, "organization slug"); |
| 247 | + // Normalize underscores → dashes to match how the positional target is parsed. |
| 248 | + const orgFlag = flags.org ? normalizeSlug(flags.org).slug : undefined; |
| 249 | + if (orgFlag) { |
| 250 | + validateResourceId(orgFlag, "organization slug"); |
245 | 251 | } |
246 | | - if (flags.org && explicitOrg && flags.org !== explicitOrg) { |
| 252 | + if (orgFlag && explicitOrg && orgFlag !== explicitOrg) { |
247 | 253 | throw new ContextError("Arguments", USAGE_HINT, [ |
248 | | - `--org "${flags.org}" conflicts with target org "${explicitOrg}"`, |
| 254 | + `--org "${orgFlag}" conflicts with target org "${explicitOrg}"`, |
249 | 255 | ]); |
250 | 256 | } |
251 | | - const resolvedOrg = explicitOrg ?? flags.org; |
| 257 | + const resolvedOrg = explicitOrg ?? orgFlag; |
252 | 258 |
|
253 | 259 | // 6. Start background org detection when org is not yet known. |
254 | 260 | // The prefetch runs concurrently with the preamble, the wizard startup, |
|
0 commit comments