feat: 修复 update 跨平台资产探测并新增 version 版本查询命令#431
feat: 修复 update 跨平台资产探测并新增 version 版本查询命令#431phantom5099 merged 8 commits into1024XEngineer:mainfrom
Conversation
- 将 updater 从“精确资产名过滤”调整为基于 os/arch/ext 的语义匹配 - 兼容资产命名大小写、分隔符与扩展名变体,避免“有资产却命不中” - 在无候选/多候选场景输出可诊断错误信息(os、arch、expected-pattern、available-assets-count、candidate-assets) - 新增 neocode version 命令,输出当前版本、远端版本与比较结果 - 默认仅比较稳定版,--prerelease 才纳入预发布版本比较 - 抽取统一版本探测入口,version 命令跳过静默检查,避免二次探测 - 补充 updater/cli 回归测试,并更新更新指南与 README 说明
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| // newAssetDiagnosticError 生成包含平台与候选信息的可执行诊断错误。 | ||
| func newAssetDiagnosticError(message string, target assetTarget, probe probeResult) error { | ||
| return fmt.Errorf( | ||
| `%s (os=%s arch=%s expected-pattern="%s" available-assets-count=%d candidate-assets=%v)`, |
There was a problem hiding this comment.
Severity: Medium (security hardening)
newAssetDiagnosticError embeds remote-controlled asset names (candidate-assets) directly into error text. These strings can contain ANSI control sequences and are later surfaced by CLI errors, which can lead to terminal escape injection/log pollution.
Please sanitize diagnostic fields before formatting (reuse sanitizeVersionForTerminal-style filtering or equivalent), or encode/unquote non-printable bytes in diagnostics.
|
@xgopilot 请你帮我将codecov/patch覆盖率提升至百分之九十五以上! |
完成情况已针对 本次改动
本地验证
提交信息
建议等待 Codecov 重新计算 patch 覆盖率;按本次覆盖补齐,目标 |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
@xgopilot 批判性review整个PR,分析所有潜在风险点,找出所有漏洞,确保每个地方的修改不是退步的,方案上的设计也不能碎片化,更不能妥协式兼容或兜底旧代码,不许输出正向表扬 |
审查结论(仅问题)
复核范围
|
|
@xgopilot 请你帮我解决review提到的问题! |
处理结果已根据上次 review 的 4 个问题完成修复,并已推送到当前 PR 分支 已完成修复
测试
未完成项
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
@xgopilot 请你帮我解决冲突问题! |
已完成冲突修复已处理当前 PR 与 本次处理:
未完成项:无。 |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
@xgopilot 请你帮我解决文件冲突问题! |
冲突处理结果已完成本次“文件冲突”处理,并将修复提交推送到当前 PR 分支
未完成项:无。 |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
@xgopilot 审查一轮目标是否完成、是否引入新问题,并评估是否可以合并 |
审查结论(仅问题)
目标完成度与可合并性
复核与验证
|
|
@xgopilot 请你解决review中的问题! |
|
已完成你提出的两项修复,并推送到当前分支。 结果摘要
测试
提交与推送
未完成项:无。 |
…lign docs Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
fix: resolve version fallback messaging and align update docs
变更背景
当前存在两个核心问题:
neocode update在部分场景会误报no release asset found for current platform,即使 release 里存在对应平台资产。version子命令,用户无法先确认“当前版本 / 远端版本 / 是否需要升级”。本 PR 目标是补齐版本可观测闭环:先查版本,再执行升级,失败可诊断。
Closes #426
主要改动
updater资产匹配策略升级_/-、扩展名组合)osarchexpected-patternavailable-assets-countcandidate-assetsneocode version子命令--prerelease才纳入预发布version命令跳过静默检查,避免同次命令二次网络探测docs/guides/update.md与README.mdversion命令场景测试(有更新/无更新/失败/预发布/非 semver)行为变化
neocode versionneocode version --prereleaseupdate在资产探测失败时会输出更可执行的诊断信息测试结果
go test ./internal/updater ./internal/cligo test ./...在当前环境失败于既有用例:internal/config包TestFsyncDirectoryNonWindowsSucceedsForExistingDirectory(Access is denied)该失败与本 PR 修改范围无直接关联。
风险与回滚
Checklist
--prerelease