初始化模版工程

This commit is contained in:
Cloud Bot
2026-03-20 07:33:46 +00:00
commit 23717e0ecd
386 changed files with 51675 additions and 0 deletions

38
app/api/nova-config.ts Normal file
View File

@@ -0,0 +1,38 @@
import { readFileSync } from 'fs'
import { join } from 'path'
interface NovaAgent {
agent_id: string
agent_name: string
agent_description: string
}
interface NovaConfig {
agents: NovaAgent[]
}
let _config: NovaConfig | null = null
export function getNovaConfig(): NovaConfig {
if (!_config) {
const configPath = join(process.cwd(), '.nova', 'config.json')
_config = JSON.parse(readFileSync(configPath, 'utf-8'))
}
return _config!
}
export function getDefaultAgentId(): string {
const config = getNovaConfig()
if (!config.agents.length) {
throw new Error('No agents configured in .nova/config.json')
}
return config.agents[0].agent_id
}
export function getDefaultAgentName(): string {
const config = getNovaConfig()
if (!config.agents.length) {
throw new Error('No agents configured in .nova/config.json')
}
return config.agents[0].agent_name
}