Skip to content

feat: rebuild neocode as a local coding agent MVP#66

Merged
minorcell merged 7 commits into1024XEngineer:mainfrom
pionxe:factor-neocode
Mar 27, 2026
Merged

feat: rebuild neocode as a local coding agent MVP#66
minorcell merged 7 commits into1024XEngineer:mainfrom
pionxe:factor-neocode

Conversation

@pionxe
Copy link
Copy Markdown
Collaborator

@pionxe pionxe commented Mar 26, 2026

概要

本次 PR 将 NeoCode 重构为一个基于 Go + Bubble Tea 的本地化 Coding Agent MVP。

它用“本地优先”的 Agent 架构替代了此前偏服务端的结构,并打通了完整的 MVP 闭环:

用户输入 → Provider 对话 → 工具调用 → 工具执行 → 持续推理 → TUI 渲染

变更内容

  • 围绕 cmd/neocode 重建了应用启动流程与 CLI 入口

  • 新增配置模块,包含:

    • YAML 配置加载与保存
    • 使用 RWMutex 保护的 ConfigManager
    • 通过 godotenv 加载 .env
    • 支持运行时更新 provider URL / API key / model
  • 新增 Provider 防腐层(anti-corruption layer),包含:

    • 清晰的内部 message / tool-call 类型定义
    • provider 接口与流式事件
    • OpenAI 流式 SSE 适配器
    • Anthropic / Gemini 的脚手架实现
  • 新增运行时核心模块,包含:

    • ReAct 循环
    • runtime 事件总线
    • 会话持久化(存储在 ~/.neocode/sessions
    • 基于当前配置动态构建 provider
  • 新增工具层,包含:

    • registry 与 specs
    • filesystem_read_file
    • filesystem_write_file
    • bash
    • webfetch
  • 将 TUI 重构为更沉浸式的瀑布流编码代理界面,包含:

    • 会话侧边栏
    • 流式对话记录
    • 内联工具 / 错误事件展示
    • Slash Commands
    • 交互式模型选择器

体验改进

  • 新增 /set url <url>
  • 新增 /set key <key>
  • 新增 /model 交互式选择器
  • 仍然保留内部支持 /set model <model>
  • 在对话记录中提供内联执行反馈
  • Bubble Tea / Lipgloss 的界面呈现更加简洁清晰

破坏性 / 结构性变更

  • 移除了旧的 internal/server/... 目录结构
  • 移除了旧的多切片 TUI 实现
  • 用新的本地 Agent 应用流程替换了旧入口

验证方式

  • go test ./...

说明

  • MVP 阶段已完成 OpenAI 流程实现
  • Anthropic / Gemini Provider 已搭好脚手架,可作为下一步继续扩展
  • 该 PR 有意偏重架构设计,因为它为 NeoCode 建立了新的基础基线
image

Copy link
Copy Markdown
Collaborator

@minorcell minorcell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pionxe 此外,补充单元测试哦

用飞龙老师说的那个方法,试试看。

Comment thread docs/Config 配置管理模块的详细设计.md Outdated
Comment thread docs/Config 配置管理模块的详细设计.md Outdated
Comment thread docs/Config 配置管理模块的详细设计.md Outdated
Comment thread docs/Config 配置管理模块的详细设计.md Outdated
Comment thread docs/Config 配置管理模块的详细设计.md Outdated
Comment thread docs/module-tools-tui.md Outdated
Comment thread docs/neocode-coding-agent-mvp-architecture.md
Comment thread internal/tools/filesystem/read_file.go
Comment thread internal/tui/app.go
Comment thread README.md Outdated
@1024XEngineer 1024XEngineer deleted a comment from pionxe Mar 26, 2026
pionxe added 6 commits March 27, 2026 08:56
- docs: 文件名统一使用 kebab-case,正文全面中文化,并严格按官方规范重写 agents.md。
- refactor(tui): 拆分臃肿的 app.go (分为 app, update, view, commands),将所有交互统一收敛至 slash command (/)。
- feat(tools): 文件系统新增 grep, glob 和 edit 工具,其中 edit 包含严格的防歧义替换拦截机制。
- test: 为 config, registry 和 openai 补充表驱动测试(引入 httptest 模拟 SSE 流),核心模块覆盖率达 80%+。
- chore: 清除全局硬编码配置,并移除 Markdown 文档中无意义的空行。
@minorcell minorcell merged commit 0482a16 into 1024XEngineer:main Mar 27, 2026
2 checks passed
phantom5099 added a commit that referenced this pull request May 3, 2026
test(rules): improve coverage for rule loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants