chore: apply requested changes

This commit is contained in:
Ralph Khreish
2025-12-03 21:47:46 +01:00
parent 0b7f24ba42
commit e05180bacd
5 changed files with 10 additions and 9 deletions

View File

@@ -10,6 +10,7 @@
import { join } from 'node:path';
import { AuthManager, findProjectRoot } from '@tm/core';
import { setSuppressConfigWarnings } from './modules/config-manager.js';
import dotenv from 'dotenv';
import { initializeSentry } from '../src/telemetry/sentry.js';
@@ -42,9 +43,10 @@ try {
const authManager = AuthManager.getInstance();
const hasValidSession = await authManager.hasValidSession();
if (hasValidSession) {
global._tmSuppressConfigWarnings = true;
setSuppressConfigWarnings(true);
}
} catch {
setSuppressConfigWarnings(false);
// Auth check failed, continue without suppressing
}

View File

@@ -163,15 +163,13 @@ function isConnectedToHamster() {
// Fallback: Check if storage type is 'api' (user selected Hamster during init)
// Suppress warnings during this check since we're detecting API mode
setSuppressConfigWarnings(true);
try {
setSuppressConfigWarnings(true);
const config = getConfig(null, false, { storageType: 'api' });
setSuppressConfigWarnings(false);
if (config?.storage?.type === 'api') {
return true;
}
} catch {
setSuppressConfigWarnings(false);
// Config check failed, continue
} finally {
setSuppressConfigWarnings(false);

View File

@@ -85,7 +85,7 @@ export function setSuppressConfigWarnings(suppress) {
* Check if config warnings are currently suppressed
* @returns {boolean}
*/
function isConfigWarningSuppressed() {
export function isConfigWarningSuppressed() {
return global._tmSuppressConfigWarnings === true;
}

View File

@@ -44,10 +44,9 @@ export function initializeSentry(options = {}) {
// This applies to local storage users only
// Hamster users don't use local config (API storage), so this check doesn't affect them
// Suppress config warnings during this check to avoid noisy output at startup
setSuppressConfigWarnings(true);
try {
setSuppressConfigWarnings(true);
const telemetryEnabled = getAnonymousTelemetryEnabled(options.projectRoot);
setSuppressConfigWarnings(false);
if (!telemetryEnabled) {
console.log(
@@ -59,6 +58,7 @@ export function initializeSentry(options = {}) {
} catch (error) {
// If there's an error checking telemetry preferences (e.g., config not available yet),
// default to enabled. This ensures telemetry works during initialization.
} finally {
setSuppressConfigWarnings(false);
}

View File

@@ -23,6 +23,7 @@ import {
TASKMASTER_TASKS_FILE
} from '../constants/paths.js';
import { getLoggerOrDefault } from './logger-utils.js';
import { isConfigWarningSuppressed } from '../../scripts/modules/config-manager.js';
/**
* Normalize project root to ensure it doesn't end with .taskmaster
@@ -455,8 +456,8 @@ export function findConfigPath(explicitPath = null, args = null, log = null) {
// Only warn once per command execution to prevent spam during init
// Skip warning if:
// Global suppress flag is set (during API mode detection)
const isWarningSuppressed = global._tmSuppressConfigWarnings === true;
const shouldSkipWarning = isWarningSuppressed || args?.storageType === 'api';
const shouldSkipWarning =
isConfigWarningSuppressed() || args?.storageType === 'api';
if (!shouldSkipWarning) {
const warningKey = `config_warning_${projectRoot}`;