feat: Phase1 项目骨架 - Maven项目结构、核心AgentLoop、6个工具、命令系统、控制台渲染、REPL会话

实现内容:
- pom.xml: JDK25 + Spring AI 2.0.0-M4 + JLine3 + Picocli
- core/AgentLoop: 基于ChatModel的显式工具循环(非ChatClient)
- tool/: Tool接口 + ToolRegistry + ToolCallbackAdapter(适配Spring AI)
- tool/impl/: BashTool, FileReadTool, FileWriteTool, FileEditTool, GlobTool, GrepTool
- command/: SlashCommand接口 + CommandRegistry + /help, /clear, /exit
- console/: AnsiStyle, BannerPrinter, ToolStatusRenderer, ThinkingRenderer, SpinnerAnimation, MarkdownRenderer
- context/: SystemPromptBuilder, ClaudeMdLoader(多级CLAUDE.md加载)
- repl/ReplSession: REPL主循环(Scanner降级方案)
- config/AppConfig: Spring Bean装配
- application.yml: Anthropic/OpenAI双模型配置

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liuzh
2026-04-01 19:22:04 +08:00
co-authored by Copilot
parent 2a565d314d
commit d67f41358d
33 changed files with 2456 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
spring:
# 主配置:使用 Anthropic 原生 API
ai:
anthropic:
api-key: ${ANTHROPIC_API_KEY:}
chat:
options:
model: ${AI_MODEL:claude-sonnet-4-20250514}
max-tokens: ${AI_MAX_TOKENS:8096}
temperature: 0.7
# 备选:兼容 OpenAI 格式的 API(如自建代理)
openai:
api-key: ${AI_API_KEY:}
base-url: ${AI_BASE_URL:https://api.openai.com}
chat:
options:
model: ${AI_OPENAI_MODEL:}
# 不启动 Web 服务器(纯 CLI 模式)
main:
web-application-type: none
# 虚拟线程
threads:
virtual:
enabled: true
# 日志
logging:
level:
com.claudecode: INFO
org.springframework.ai: WARN
org.springframework.boot.autoconfigure: WARN