Skip to content

fix: 补齐全局简写参数并重构 Adapter 命令架构#615

Open
pionxe wants to merge 3 commits into1024XEngineer:mainfrom
pionxe:main
Open

fix: 补齐全局简写参数并重构 Adapter 命令架构#615
pionxe wants to merge 3 commits into1024XEngineer:mainfrom
pionxe:main

Conversation

@pionxe
Copy link
Copy Markdown
Collaborator

@pionxe pionxe commented May 10, 2026

变更背景

本 PR 针对 NeoCode CLI 在高频使用场景中的体验断层进行优化,目标是统一用户肌肉记忆、提升命令架构一致性,并为后续多平台适配器扩展预留标准入口。
Closes #549

主要改动

1. 重构适配器命令架构(Breaking Change)

  • 新增顶层命令组:adapter
  • 飞书适配器命令从:
    • neocode feishu-adapter
      迁移为:
    • neocode adapter feishu
  • 保留旧命令占位并给出迁移提示,降低升级后的排障成本

2. 补齐全局版本查询习惯

  • 在 root 层增加 -v / --version 支持
  • 复用 version 子命令核心输出逻辑,保证行为与退出语义一致

3. 补齐高频参数短别名

  • 全局工作目录参数:
    • --workdir 新增短别名 -w
  • use 命令模型参数:
    • --model 新增短别名 -m

4. 文档同步

  • 更新 README.md / README.en.md
  • 更新 docs/guideswww 站点文档中的命令示例:
    • feishu-adapter -> adapter feishu
    • 高频启动示例补充/替换为 -w-m 写法

测试与验证

已新增/更新 CLI 回归测试,覆盖:

  • adapter feishu 命令挂载与行为
  • 旧命令迁移提示
  • -v / --version 全局入口
  • -w / -m 参数解析

本地验证:

  • go test ./internal/cli/... 通过

兼容性说明

  • 本次包含命令重命名的破坏性变更:
    • neocode feishu-adapter 不再作为可执行主路径
  • 如存量脚本依赖旧命令,请迁移为:
    • neocode adapter feishu

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

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

Found 1 noteworthy issue after code quality, performance, security, and documentation-accuracy passes.

Comment thread internal/cli/root.go
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
flags.Version = settings.GetBool("version")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-v/--version is wired in RunE, which means the root PersistentPreRunE has already run by the time this shortcut executes. As a result, neocode -v no longer matches neocode version: it still performs global preload, starts the background silent update check, and then runVersionCommand probes releases again. That makes the shortcut observable slower, can fail on preload paths that version intentionally skips, and contradicts the PR goal of keeping the same behavior/exit semantics. This needs to short-circuit before PersistentPreRunE, or the pre-run logic needs to explicitly skip when the root version flag is set.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

RFC: NeoCode 命令行体验 (CLI UX) 重新设计

1 participant