Skip to content

[T-224] ocagent upload/download/clean/suicide 補上 --help 說明文字 - #509

Open
8thEdition wants to merge 2 commits into
mainfrom
t-224/ocagent-subcommand-help
Open

8thEdition wants to merge 2 commits into
mainfrom
t-224/ocagent-subcommand-help

Conversation

@8thEdition

Copy link
Copy Markdown
Collaborator

為什麼

開機文件教成員用 ocagent <subcommand> --help 查用法,並點名 upload/download,但整個 ocagent 只有 diff 有說明文字,其他子命令只印出旗標列表或空白。

做了什麼

  • 照 diff 既有寫法(xxxUsage 函式+fs.Usage)替 upload、download、clean、suicide 補說明:用途、參數、輸出、結束碼、常見錯誤。每句對照程式碼查證,不寫死由伺服器決定的上限。
  • 不補:listen(開機程序固定寫法)、context-report(statusLine 呼叫)、guard-bash/guard-permission(hook)、version(不解析參數,補了要改輸出)。
  • TestRealMain 擴充 5 個子測試,經由 realMain 實跑各子命令 --help 斷言手寫字面值。

行為變化

只有 <subcommand> --help 與旗標解析錯誤時 stdout 印的內容變了;結束碼、stderr、各子命令的一般輸出都不變(獨立審查以 main 與候選各 build 一顆、31 組輸入比對確認)。

驗證

  • ocagent 套件通過;拿掉 upload 的說明,測試紅且指名。
  • 獨立審查第一輪抓到 3 處說明與程式不符(clean 的 agents home 預設、suicide 的結束碼、upload 的型別判斷),已修並以審查者的重現指令複驗。
  • drift 8 條、lint go-fmt/go-vet/go-naming/uplink-contract 通過。

已知限制

說明文字與實際結束碼之間沒有測試綁定,行為改了而說明沒改不會變紅。

🤖 Generated with Claude Code

8thEdition and others added 2 commits September 15, 2026 17:09
…-224)

Only diff set a FlagSet Usage, so `ocagent upload --help` and the other
subcommands printed the bare stdlib flag list while the boot docs tell
members to read `ocagent <subcommand> --help`. Each text sits beside its
implementation, like diffUsage, and TestRealMain pins it through dispatch.

listen, context-report, guard-bash and guard-permission are launched by
wiring, and version takes no flags; they are left as they were.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
clean: the agents home falls back to ~/.officraft/agents (or
~/.officraft-<ns>/agents), so an unset OC_AGENT_HOME is not an rc-2 case;
list the real rc-2 causes and the rc-1 and missing-identity stdout lines.
suicide: --help and any other flag parse error exit 2, not 0.
upload: without --mime the server recognises four image formats by bytes
and only .json by name; everything else is application/octet-stream.
download: default dir is the current directory; a 404 may mean OC_BASE
points at the wrong station. rc-2 rows now name --help and flag errors.

Like the previous commit, this changes only what `<subcommand> --help`
and a flag-parse error print to stdout. Exit codes, stderr and the normal
output of every subcommand are unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant