Archon onboarding, README updates, and MCP/global rule expansion for more coding assistants

This commit is contained in:
Cole Medin
2025-08-13 18:36:36 -05:00
parent 8d189b9946
commit bb64af9e7a
19 changed files with 808 additions and 180 deletions

View File

@@ -1,6 +1,13 @@
import { render, screen } from '@testing-library/react'
import { describe, test, expect } from 'vitest'
import { describe, test, expect, vi } from 'vitest'
import React from 'react'
import { isLmConfigured } from '../src/utils/onboarding'
import type { NormalizedCredential } from '../src/utils/onboarding'
// Mock useNavigate for onboarding page test
vi.mock('react-router-dom', () => ({
useNavigate: () => vi.fn()
}))
describe('Page Load Tests', () => {
test('simple page component renders', () => {
@@ -42,4 +49,68 @@ describe('Page Load Tests', () => {
expect(screen.getByText('In Progress')).toBeInTheDocument()
expect(screen.getByText('Done')).toBeInTheDocument()
})
test('onboarding page renders', () => {
const MockOnboardingPage = () => <h1>Welcome to Archon</h1>
render(<MockOnboardingPage />)
expect(screen.getByText('Welcome to Archon')).toBeInTheDocument()
})
})
describe('Onboarding Detection Tests', () => {
test('isLmConfigured returns true when provider is openai and OPENAI_API_KEY exists', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', value: 'sk-test123', category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns true when provider is openai and OPENAI_API_KEY is encrypted', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', is_encrypted: true, category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns false when provider is openai and no OPENAI_API_KEY', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'openai', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(false)
})
test('isLmConfigured returns true when provider is ollama regardless of API keys', () => {
const ragCreds: NormalizedCredential[] = [
{ key: 'LLM_PROVIDER', value: 'ollama', category: 'rag_strategy' }
]
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns true when no provider but OPENAI_API_KEY exists', () => {
const ragCreds: NormalizedCredential[] = []
const apiKeyCreds: NormalizedCredential[] = [
{ key: 'OPENAI_API_KEY', value: 'sk-test123', category: 'api_keys' }
]
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(true)
})
test('isLmConfigured returns false when no provider and no OPENAI_API_KEY', () => {
const ragCreds: NormalizedCredential[] = []
const apiKeyCreds: NormalizedCredential[] = []
expect(isLmConfigured(ragCreds, apiKeyCreds)).toBe(false)
})
})