Merge branch 'main' into fix/update-nanoclaw-skill-v2
This commit is contained in:
@@ -84,21 +84,28 @@ describe('credentials detection', () => {
|
|||||||
const content =
|
const content =
|
||||||
'SOME_KEY=value\nANTHROPIC_API_KEY=sk-ant-test123\nOTHER=foo';
|
'SOME_KEY=value\nANTHROPIC_API_KEY=sk-ant-test123\nOTHER=foo';
|
||||||
const hasCredentials =
|
const hasCredentials =
|
||||||
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY)=/m.test(content);
|
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|ONECLI_URL)=/m.test(content);
|
||||||
expect(hasCredentials).toBe(true);
|
expect(hasCredentials).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('detects CLAUDE_CODE_OAUTH_TOKEN in env content', () => {
|
it('detects CLAUDE_CODE_OAUTH_TOKEN in env content', () => {
|
||||||
const content = 'CLAUDE_CODE_OAUTH_TOKEN=token123';
|
const content = 'CLAUDE_CODE_OAUTH_TOKEN=token123';
|
||||||
const hasCredentials =
|
const hasCredentials =
|
||||||
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY)=/m.test(content);
|
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|ONECLI_URL)=/m.test(content);
|
||||||
|
expect(hasCredentials).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('detects ANTHROPIC_AUTH_TOKEN in env content', () => {
|
||||||
|
const content = 'ANTHROPIC_AUTH_TOKEN=token123\nANTHROPIC_BASE_URL=http://localhost:8080';
|
||||||
|
const hasCredentials =
|
||||||
|
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|ONECLI_URL)=/m.test(content);
|
||||||
expect(hasCredentials).toBe(true);
|
expect(hasCredentials).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns false when no credentials', () => {
|
it('returns false when no credentials', () => {
|
||||||
const content = 'ASSISTANT_NAME="Andy"\nOTHER=foo';
|
const content = 'ASSISTANT_NAME="Andy"\nOTHER=foo';
|
||||||
const hasCredentials =
|
const hasCredentials =
|
||||||
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY)=/m.test(content);
|
/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|ONECLI_URL)=/m.test(content);
|
||||||
expect(hasCredentials).toBe(false);
|
expect(hasCredentials).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export async function run(_args: string[]): Promise<void> {
|
|||||||
const envFile = path.join(projectRoot, '.env');
|
const envFile = path.join(projectRoot, '.env');
|
||||||
if (fs.existsSync(envFile)) {
|
if (fs.existsSync(envFile)) {
|
||||||
const envContent = fs.readFileSync(envFile, 'utf-8');
|
const envContent = fs.readFileSync(envFile, 'utf-8');
|
||||||
if (/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ONECLI_URL)=/m.test(envContent)) {
|
if (/^(CLAUDE_CODE_OAUTH_TOKEN|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|ONECLI_URL)=/m.test(envContent)) {
|
||||||
credentials = 'configured';
|
credentials = 'configured';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user