GeezerVison is showing github.com — refactor(platform): pure-platform debt cleanup — internal/common sink, dead-code removal, PrintJSON→pkg/ui by Episkey-G · Pull Request #4 · Episkey-G/ucloud-cli
Conversation
概要
纯平台债清理(不依赖任何产品迁移),执行计划 docs/superpowers/plans/2026-06-25-pure-platform-debt.md。把 base 里产品会用到的 stdlib-only 纯工具下沉到 internal/common、删 base 死代码、把纯渲染函数 PrintJSON 挪到 pkg/ui、删 pkg/cli 死字段 Context.biz。net −46 行,无行为变化。
改动(9 commits, base=8ff3ad0)
- A1–A3: 新增并下沉
common.FormatDate / common.IsBase64Encoded,cmd 调用方切换,删 base 原件
- A4–A5: 完成
FormatDateTime / GetFileList 去重(common 已有副本),切 cmd 调用方,删 base 原件(保留 base.GetHomePath)
- A6: 删 base 死代码
WriteJSONFile/AppendToFile/LineInFile + 冗余 DateTimeLayout
- B1: 新增
ui.PrintJSON,Context.PrintJSON 改委托 ui(保留 base.PrintJSON)
- B2: 删死字段
Context.biz(全仓从未被读)
- 收尾: 去掉
encoding.go 与 format.go 重复的 package doc 注释;(本地)删 out/ 旧产物
不变量(本地已验证)
go build ./... / go vet ./... 绿;go test 全绿(除已知 live-integration cmd.TestUhost,配额 RetCode 8357,非回归)
- 命令树/补全 golden 不变:
go test ./hack/snapshot/ 全 PASS,testdata/*.golden 未变
internal/common 保持 stdlib-only;pkg/ui 不 import base/ux;无新增 pkg/cli→ux 边
base.PrintJSON / GetHomePath / BizClient 等该留的都在,逐字行为一致
边界(本计划明确不做)
不动 .gitignore;不处理 ToQueryMap(会把 SDK 拖进 common,破坏 stdlib-only);不动 HandleError/Poller/serviceclient(留 C2 ux 重写)。pkg/ 属 protected path → scope-gate 预期标记「需 platform review」。
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
format.go holds the canonical // Package common doc; encoding.go's first
line is now a plain file comment to avoid a duplicate package comment.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ge doc
7ce2ef5 retyped encoding.go's leading comment to silence the duplicate
'// Package common' (staticcheck ST1000), but with no blank line before the
package clause Go still parsed it as a package doc — so 'go doc ./internal/common'
printed the encoding.go line ahead of the canonical doc in format.go.
Insert a blank line so the comment is a plain file comment; format.go is now
the sole package doc. go doc shows only the canonical text; build/vet, tests,
and command-tree/completion golden snapshots stay green. No behavior change.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…omePath
base.GetHomePath was a byte-identical duplicate of common.GetHomePath
(the latter added so internal/common's GetFileList stays self-contained &
stdlib-only). Point base's only callers — GetLogFileDir/GetLogFilePath in
log.go and GetConfigDir in util.go — at common.GetHomePath, delete the base
copy, and establish the correct base -> internal/common layering edge.
Drop the now-redundant base TestGetHomePath (internal/common/common_test.go
already covers it).
No behavior change: common.GetHomePath is verbatim-identical; common stays
zero-ucloud-dep so no import cycle. go build/vet, full test suite, and the
command-tree/completion golden snapshots are all green; binary smoke
(config list -> GetConfigDir -> common.GetHomePath) resolves ~/.ucloud OK.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|