mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-21 11:23: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;
|
const indicators = cliAuthIndicators;
|
||||||
|
|
||||||
// Log detailed credential detection results
|
// Log detailed credential detection results
|
||||||
logger.debug('[CREDENTIAL_CHECK] Claude CLI auth indicators:', {
|
const { checks, ...indicatorSummary } = indicators;
|
||||||
hasCredentialsFile: indicators.hasCredentialsFile,
|
logger.debug('[CREDENTIAL_CHECK] Claude CLI auth indicators:', indicatorSummary);
|
||||||
hasSettingsFile: indicators.hasSettingsFile,
|
|
||||||
hasStatsCacheWithActivity: indicators.hasStatsCacheWithActivity,
|
|
||||||
hasProjectsSessions: indicators.hasProjectsSessions,
|
|
||||||
credentials: indicators.credentials,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug('[CREDENTIAL_CHECK] File check details:', {
|
logger.debug('[CREDENTIAL_CHECK] File check details:', checks);
|
||||||
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,
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
|
|
||||||
const hasCliAuth =
|
const hasCliAuth =
|
||||||
indicators.hasStatsCacheWithActivity ||
|
indicators.hasStatsCacheWithActivity ||
|
||||||
@@ -231,16 +199,10 @@ const BOX_CONTENT_WIDTH = 67;
|
|||||||
if (cliAuthIndicators) {
|
if (cliAuthIndicators) {
|
||||||
const pathsChecked: string[] = [];
|
const pathsChecked: string[] = [];
|
||||||
|
|
||||||
// Collect paths that were checked
|
// Collect paths that were checked (paths are always populated strings)
|
||||||
if (cliAuthIndicators.checks.settingsFile.path) {
|
pathsChecked.push(`Settings: ${cliAuthIndicators.checks.settingsFile.path}`);
|
||||||
pathsChecked.push(`Settings: ${cliAuthIndicators.checks.settingsFile.path}`);
|
pathsChecked.push(`Stats cache: ${cliAuthIndicators.checks.statsCache.path}`);
|
||||||
}
|
pathsChecked.push(`Projects dir: ${cliAuthIndicators.checks.projectsDir.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}`);
|
|
||||||
}
|
|
||||||
for (const credFile of cliAuthIndicators.checks.credentialFiles) {
|
for (const credFile of cliAuthIndicators.checks.credentialFiles) {
|
||||||
pathsChecked.push(`Credentials: ${credFile.path}`);
|
pathsChecked.push(`Credentials: ${credFile.path}`);
|
||||||
}
|
}
|
||||||
@@ -249,7 +211,7 @@ const BOX_CONTENT_WIDTH = 67;
|
|||||||
pathsCheckedInfo = `
|
pathsCheckedInfo = `
|
||||||
║ ║
|
║ ║
|
||||||
║ ${'Paths checked:'.padEnd(BOX_CONTENT_WIDTH)}║
|
║ ${'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 type { Request, Response } from 'express';
|
||||||
import { query } from '@anthropic-ai/claude-agent-sdk';
|
import { query } from '@anthropic-ai/claude-agent-sdk';
|
||||||
import { createLogger } from '@automaker/utils';
|
import { createLogger } from '@automaker/utils';
|
||||||
|
import { getClaudeAuthIndicators } from '@automaker/platform';
|
||||||
import { getApiKey } from '../common.js';
|
import { getApiKey } from '../common.js';
|
||||||
import {
|
import {
|
||||||
createSecureAuthEnv,
|
createSecureAuthEnv,
|
||||||
@@ -327,12 +328,11 @@ export function createVerifyClaudeAuthHandler() {
|
|||||||
authType = 'api_key';
|
authType = 'api_key';
|
||||||
} else if (authMethod === 'cli') {
|
} else if (authMethod === 'cli') {
|
||||||
// Check if CLI auth is via OAuth (Claude Code subscription) or generic 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
|
try {
|
||||||
const { getClaudeAuthIndicators } = await import('@automaker/platform');
|
const indicators = await getClaudeAuthIndicators();
|
||||||
const indicators = await getClaudeAuthIndicators();
|
authType = indicators.credentials?.hasOAuthToken ? 'oauth' : 'cli';
|
||||||
if (indicators.credentials?.hasOAuthToken) {
|
} catch {
|
||||||
authType = 'oauth';
|
// Fall back to generic CLI if credential check fails
|
||||||
} else {
|
|
||||||
authType = 'cli';
|
authType = 'cli';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user