Skip to content

Commit 914a980

Browse files
committed
fix: respect runtime sentry disable and simplify init policy flow
1 parent 2240e70 commit 914a980

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/cli/commands/init.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@ function enforceInstallPolicy(
669669
return { allowedTargets: targets, skippedClients: [] };
670670
}
671671

672+
if (clientFlag === 'claude' || selectionMode === 'interactive') {
673+
return { allowedTargets: targets, skippedClients: [] };
674+
}
675+
672676
const allowedTargets: ClientInfo[] = [];
673677
const skippedClients: Array<{ client: string; reason: string }> = [];
674678

@@ -683,9 +687,5 @@ function enforceInstallPolicy(
683687
allowedTargets.push(target);
684688
}
685689

686-
if (clientFlag === 'claude' || selectionMode === 'interactive') {
687-
return { allowedTargets: targets, skippedClients: [] };
688-
}
689-
690690
return { allowedTargets, skippedClients };
691691
}

src/utils/logger.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function isSentryDisabledFromEnv(): boolean {
2727
);
2828
}
2929

30-
const sentryEnabled = !isSentryDisabledFromEnv();
30+
function isSentryEnabled(): boolean {
31+
return !isSentryDisabledFromEnv();
32+
}
3133

3234
// Log levels in order of severity (lower number = more severe)
3335
const LOG_LEVELS = {
@@ -78,7 +80,7 @@ const require = createRequire(
7880
let cachedSentry: SentryModule | null = null;
7981

8082
function loadSentrySync(): SentryModule | null {
81-
if (!sentryEnabled || isTestEnv()) {
83+
if (!isSentryEnabled() || isTestEnv()) {
8284
return null;
8385
}
8486
if (cachedSentry) {
@@ -237,7 +239,7 @@ export function log(level: string, message: string, context?: LogContext): void
237239
const timestamp = new Date().toISOString();
238240
const logMessage = `[${timestamp}] [${level.toUpperCase()}] ${message}`;
239241

240-
const captureToSentry = sentryEnabled && __shouldCaptureToSentryForTests(context);
242+
const captureToSentry = isSentryEnabled() && __shouldCaptureToSentryForTests(context);
241243

242244
if (captureToSentry) {
243245
withSentry((s) => {

0 commit comments

Comments
 (0)