Skip to content

Commit 28e9c84

Browse files
betegonclaude
andcommitted
fix(init): normalize --org slug (underscores → dashes) before conflict check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c1bbdd8 commit 28e9c84

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/commands/init.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
import path from "node:path";
2121
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";
2327
import { buildCommand } from "../lib/command.js";
2428
import { ContextError } from "../lib/errors.js";
2529
import { warmOrgDetection } from "../lib/init/prefetch.js";
@@ -240,15 +244,17 @@ export const initCommand = buildCommand<
240244

241245
// 5. Merge --org flag with target-derived org.
242246
// --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");
245251
}
246-
if (flags.org && explicitOrg && flags.org !== explicitOrg) {
252+
if (orgFlag && explicitOrg && orgFlag !== explicitOrg) {
247253
throw new ContextError("Arguments", USAGE_HINT, [
248-
`--org "${flags.org}" conflicts with target org "${explicitOrg}"`,
254+
`--org "${orgFlag}" conflicts with target org "${explicitOrg}"`,
249255
]);
250256
}
251-
const resolvedOrg = explicitOrg ?? flags.org;
257+
const resolvedOrg = explicitOrg ?? orgFlag;
252258

253259
// 6. Start background org detection when org is not yet known.
254260
// The prefetch runs concurrently with the preamble, the wizard startup,

0 commit comments

Comments
 (0)