mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
feat(auth): improve authentication error handling for Claude SDK
- Enhanced error messages in FeatureExecutor and ClaudeProvider to provide clearer guidance on missing authentication. - Added checks for Claude CLI installation status to inform users if they need to authenticate via CLI or set environment variables. - Improved fallback error messages to ensure users receive relevant instructions regardless of the authentication method. These changes enhance user experience by providing more informative feedback regarding authentication issues.
This commit is contained in:
@@ -369,8 +369,19 @@ class FeatureExecutor {
|
||||
// Ensure provider auth is available (especially for Claude SDK)
|
||||
const provider = this.getProvider(feature);
|
||||
if (provider?.ensureAuthEnv && !provider.ensureAuthEnv()) {
|
||||
const authMsg =
|
||||
"Missing Anthropic auth. Set ANTHROPIC_API_KEY or run `claude login` so ~/.claude/config.json contains oauth_token.";
|
||||
// Check if CLI is installed to provide better error message
|
||||
let authMsg = "Missing Anthropic auth. Set ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN environment variable.";
|
||||
try {
|
||||
const claudeCliDetector = require('./claude-cli-detector');
|
||||
const detection = claudeCliDetector.detectClaudeInstallation();
|
||||
if (detection.installed && detection.method === 'cli') {
|
||||
authMsg = "Claude CLI is installed but not authenticated. Run `claude login` to authenticate, or set ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN environment variable.";
|
||||
} else {
|
||||
authMsg = "Missing Anthropic auth. Set ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN, or install Claude CLI and run `claude login`.";
|
||||
}
|
||||
} catch (err) {
|
||||
// Fallback to default message
|
||||
}
|
||||
console.error(`[FeatureExecutor] ${authMsg}`);
|
||||
throw new Error(authMsg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user