mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-16 21:53:07 +00:00
fix: address PR #747 review comments
- Fix warning box path lines being 2 chars too wide (BOX_CONTENT_WIDTH - 4) - Wrap getClaudeAuthIndicators in try/catch to prevent 500 on auth success - Convert dynamic import to static import for @automaker/platform - Simplify verbose debug logging to log objects directly - Remove unnecessary truthy checks on always-populated path strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -148,42 +148,10 @@ const BOX_CONTENT_WIDTH = 67;
|
||||
const indicators = cliAuthIndicators;
|
||||
|
||||
// Log detailed credential detection results
|
||||
logger.debug('[CREDENTIAL_CHECK] Claude CLI auth indicators:', {
|
||||
hasCredentialsFile: indicators.hasCredentialsFile,
|
||||
hasSettingsFile: indicators.hasSettingsFile,
|
||||
hasStatsCacheWithActivity: indicators.hasStatsCacheWithActivity,
|
||||
hasProjectsSessions: indicators.hasProjectsSessions,
|
||||
credentials: indicators.credentials,
|
||||
});
|
||||
const { checks, ...indicatorSummary } = indicators;
|
||||
logger.debug('[CREDENTIAL_CHECK] Claude CLI auth indicators:', indicatorSummary);
|
||||
|
||||
logger.debug('[CREDENTIAL_CHECK] File check details:', {
|
||||
settingsFile: {
|
||||
path: indicators.checks.settingsFile.path,
|
||||
exists: indicators.checks.settingsFile.exists,
|
||||
readable: indicators.checks.settingsFile.readable,
|
||||
error: indicators.checks.settingsFile.error,
|
||||
},
|
||||
statsCache: {
|
||||
path: indicators.checks.statsCache.path,
|
||||
exists: indicators.checks.statsCache.exists,
|
||||
readable: indicators.checks.statsCache.readable,
|
||||
hasDailyActivity: indicators.checks.statsCache.hasDailyActivity,
|
||||
error: indicators.checks.statsCache.error,
|
||||
},
|
||||
projectsDir: {
|
||||
path: indicators.checks.projectsDir.path,
|
||||
exists: indicators.checks.projectsDir.exists,
|
||||
readable: indicators.checks.projectsDir.readable,
|
||||
entryCount: indicators.checks.projectsDir.entryCount,
|
||||
error: indicators.checks.projectsDir.error,
|
||||
},
|
||||
credentialFiles: indicators.checks.credentialFiles.map((cf) => ({
|
||||
path: cf.path,
|
||||
exists: cf.exists,
|
||||
readable: cf.readable,
|
||||
error: cf.error,
|
||||
})),
|
||||
});
|
||||
logger.debug('[CREDENTIAL_CHECK] File check details:', checks);
|
||||
|
||||
const hasCliAuth =
|
||||
indicators.hasStatsCacheWithActivity ||
|
||||
@@ -231,16 +199,10 @@ const BOX_CONTENT_WIDTH = 67;
|
||||
if (cliAuthIndicators) {
|
||||
const pathsChecked: string[] = [];
|
||||
|
||||
// Collect paths that were checked
|
||||
if (cliAuthIndicators.checks.settingsFile.path) {
|
||||
pathsChecked.push(`Settings: ${cliAuthIndicators.checks.settingsFile.path}`);
|
||||
}
|
||||
if (cliAuthIndicators.checks.statsCache.path) {
|
||||
pathsChecked.push(`Stats cache: ${cliAuthIndicators.checks.statsCache.path}`);
|
||||
}
|
||||
if (cliAuthIndicators.checks.projectsDir.path) {
|
||||
pathsChecked.push(`Projects dir: ${cliAuthIndicators.checks.projectsDir.path}`);
|
||||
}
|
||||
// Collect paths that were checked (paths are always populated strings)
|
||||
pathsChecked.push(`Settings: ${cliAuthIndicators.checks.settingsFile.path}`);
|
||||
pathsChecked.push(`Stats cache: ${cliAuthIndicators.checks.statsCache.path}`);
|
||||
pathsChecked.push(`Projects dir: ${cliAuthIndicators.checks.projectsDir.path}`);
|
||||
for (const credFile of cliAuthIndicators.checks.credentialFiles) {
|
||||
pathsChecked.push(`Credentials: ${credFile.path}`);
|
||||
}
|
||||
@@ -249,7 +211,7 @@ const BOX_CONTENT_WIDTH = 67;
|
||||
pathsCheckedInfo = `
|
||||
║ ║
|
||||
║ ${'Paths checked:'.padEnd(BOX_CONTENT_WIDTH)}║
|
||||
${pathsChecked.map((p) => `║ ${p.substring(0, BOX_CONTENT_WIDTH - 2).padEnd(BOX_CONTENT_WIDTH - 2)} ║`).join('\n')}`;
|
||||
${pathsChecked.map((p) => `║ ${p.substring(0, BOX_CONTENT_WIDTH - 4).padEnd(BOX_CONTENT_WIDTH - 4)} ║`).join('\n')}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import type { Request, Response } from 'express';
|
||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||
import { createLogger } from '@automaker/utils';
|
||||
import { getClaudeAuthIndicators } from '@automaker/platform';
|
||||
import { getApiKey } from '../common.js';
|
||||
import {
|
||||
createSecureAuthEnv,
|
||||
@@ -327,12 +328,11 @@ export function createVerifyClaudeAuthHandler() {
|
||||
authType = 'api_key';
|
||||
} else if (authMethod === 'cli') {
|
||||
// Check if CLI auth is via OAuth (Claude Code subscription) or generic CLI
|
||||
// OAuth tokens are stored in the credentials file by the Claude CLI
|
||||
const { getClaudeAuthIndicators } = await import('@automaker/platform');
|
||||
const indicators = await getClaudeAuthIndicators();
|
||||
if (indicators.credentials?.hasOAuthToken) {
|
||||
authType = 'oauth';
|
||||
} else {
|
||||
try {
|
||||
const indicators = await getClaudeAuthIndicators();
|
||||
authType = indicators.credentials?.hasOAuthToken ? 'oauth' : 'cli';
|
||||
} catch {
|
||||
// Fall back to generic CLI if credential check fails
|
||||
authType = 'cli';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user