Skip to content

feat: [EPIC-GW-02A] 统一网关入口至 neocode 子命令体系 (Single Binary 收敛)#284

Merged
phantom5099 merged 2 commits into
1024XEngineer:mainfrom
pionxe:main
Apr 14, 2026
Merged

feat: [EPIC-GW-02A] 统一网关入口至 neocode 子命令体系 (Single Binary 收敛)#284
phantom5099 merged 2 commits into
1024XEngineer:mainfrom
pionxe:main

Conversation

@pionxe

@pionxe pionxe commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

🎯 目标 (Motivation & Context)

本 PR 实现了网关重构计划的前置任务 [EPIC-GW-02A],旨在将网关层的相关入口统一收敛至 neocode 子命令体系中。 此举严格对齐了 [#249] 中确立的 Single Binary Architecture 原则,彻底消除多二进制散落的问题,为后续的 URL Scheme 唤醒分发(EPIC-GW-02)及网络面拓展打下标准化的拓扑基座。

Closes #283 , Relates to #250 and #249

✨ 主要变更 (Key Changes)

1. 新增子命令体系

  • neocode 根命令下新增了 gatewayurl-dispatch 两个子命令。
  • 无子命令时,默认行为保持不变(平滑降级走原 TUI 主链路)。

2. gateway 子命令落地

  • 完整平移复用了原 cmd/neocode-gateway 的 Bootstrap 启动逻辑,未重复造轮子。
  • 支持原有参数:--listen 端口绑定、--log-level 级别设置,并完整保留了信号优雅退出机制。

3. url-dispatch 唤醒分发器骨架

  • 完成了基础命令树构造,支持 --url 参数或位置参数 URL 兜底。
  • 加入了严格的参数校验(缺 URL 时返回稳定错误)。
  • 当前状态:骨架阶段。正常执行后会按预期返回未实现错误:planned in EPIC-GW-02

4. 🧹 架构清理 (Break Change / Cleanup)

  • 注意:经过考量,未保留旧的独立二进制入口兼容壳,直接执行了硬删除。
  • 移除了 cmd/neocode-gateway/main.go 及相关测试文件,实现代码物理层面的绝对收敛。

5. 文档同步

  • 更新了 README.md 中的网关启动指引(替换为 go run ./cmd/neocode gateway)。
  • 补充了 url-dispatch 骨架的示例及后续规划说明。

✅ 验收标准清单 (Acceptance Criteria)

  • neocode gateway --helpneocode url-dispatch --help 均可正常输出帮助文档。
  • 旧的 neocode 主链路命令行为未发生回归。
  • 所有测试用例(go test ./...)全量通过。
  • url-dispatch 接收到 mock URL 时,按预期返回待实现提示。

🧪 测试与验证结果 (Verification)

在本地已执行并通过以下验证:

# 单元测试全绿
$ go test ./internal/cli

# 帮助文档可用性检查
$ go run ./cmd/neocode --help
$ go run ./cmd/neocode gateway --help
$ go run ./cmd/neocode url-dispatch --help

# URL 调度骨架拦截测试(符合预期)
$ go run ./cmd/neocode url-dispatch --url "neocode://review?path=README.md"
# 输出: planned in EPIC-GW-02

@pionxe

pionxe commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator Author

@xgopilot /review

@codecov

codecov Bot commented Apr 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

fennoai[bot]

This comment was marked as outdated.

@pionxe

pionxe commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the PR diff across code quality, performance, security, and documentation accuracy.

No actionable issues found.

Comment thread README.md

```bash
go run ./cmd/neocode-gateway
go run ./cmd/neocode gateway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Command migration docs are consistent with the implemented neocode gateway subcommand and url-dispatch skeleton behavior.

@phantom5099 phantom5099 merged commit 743f998 into 1024XEngineer:main Apr 14, 2026
2 checks passed
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.

[EPIC-GW-02A] 单一二进制命令拓扑收敛(gateway/url-dispatch 子命令)

2 participants