@botiverse/stamp-cli 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/locale.mjs CHANGED
@@ -1,12 +1,28 @@
1
1
  /** User-visible copy. Machine protocol fields and stable error codes stay English. */
2
2
  export const messages = {
3
3
  en: {
4
- usagePrCreate: "usage: stamp pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]",
5
- usagePrRead: "usage: stamp pr <list|view|diff|checks> [arguments]",
6
- usagePrList: "usage: stamp pr list",
7
- usagePrView: "usage: stamp pr view <number|URL> [--repo OWNER/REPO]",
8
- usagePrDiff: "usage: stamp pr diff <number|URL> [--repo OWNER/REPO] [--name-only]",
9
- usagePrChecks: "usage: stamp pr checks <number|URL> [--repo OWNER/REPO]",
4
+ usagePrCreate: "usage: {cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]",
5
+ usagePrRead: "usage: {cli} pr <list|view|diff|checks|comment|approve|merge> [arguments]",
6
+ usagePrApprove: "usage: {cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT] (human GitHub identity required)",
7
+ usagePrMerge: "usage: {cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase] (human GitHub identity required)",
8
+ prApproved: "Approved {repository}#{number} as {actor}",
9
+ prMerged: "Merged {repository}#{number} as {actor} ({sha})",
10
+ prApproveRejected: "Approve was rejected. Check your human session, GitHub binding, repository access, and --head/--base.",
11
+ prMergeRejected: "Merge was rejected. Check your human session, GitHub binding, repository access, --head/--base, and mergeability.",
12
+ prApproveOutcomeUnknown: "Approve outcome is unknown. Re-read the PR reviews before sending again; do not automatically resend.",
13
+ prMergeOutcomeUnknown: "Merge outcome is unknown. Re-read the PR before sending again; do not automatically resend.",
14
+ apiHumanPrincipal: "Agents cannot approve or merge. Use a human STAMP_TOKEN session.",
15
+ apiWriteCoords: "Re-read the PR and retry with both --head and --base.",
16
+ apiGitHubBinding: "Bind your GitHub account in Stamp settings, then retry.",
17
+ usagePrComment: "usage: {cli} pr comment <NUMBER -R OWNER/REPO|PR_URL> (--body TEXT|--body-file FILE|-) (human GitHub identity required)",
18
+ prCommentBodyInvalid: "Comment must be nonempty and at most 64 KiB of UTF-8 text.",
19
+ prCommentCreated: "Comment posted as {actor}: {url}",
20
+ prCommentRejected: "Comment request was rejected. Check your human session, GitHub binding, repository access and input.",
21
+ prCommentOutcomeUnknown: "Comment outcome is unknown. Check the PR comments before sending again; do not automatically resend.",
22
+ usagePrList: "usage: {cli} pr list",
23
+ usagePrView: "usage: {cli} pr view <number|URL> [--repo OWNER/REPO]",
24
+ usagePrDiff: "usage: {cli} pr diff <number|URL> [--repo OWNER/REPO] [--name-only]",
25
+ usagePrChecks: "usage: {cli} pr checks <number|URL> [--repo OWNER/REPO]",
10
26
  prReadInvalidResponse: "Stamp returned an invalid PR read response; retry after checking the service version.",
11
27
  prReadCoordinateMismatch: "Stamp returned PR coordinates different from the requested repository or number; refusing to display them.",
12
28
  prListEmpty: "No Stamp-created pull requests found.",
@@ -23,78 +39,107 @@ export const messages = {
23
39
  prReadHeadMoved: "The PR head changed while Stamp read the diff; rerun the command and review the new head.",
24
40
  prReadDiffIncomplete: "GitHub did not return the complete PR diff; retry later instead of relying on partial files.",
25
41
  prReadUnavailable: "The PR read is temporarily unavailable; retry after checking Stamp service status.",
26
- prRequired: "Missing {flag}; use stamp receipt get <id> to obtain the published coordinates.",
42
+ prListMore: "More results available; rerun with --limit and --cursor {cursor}.",
43
+ prSection_drafts: "Drafts",
44
+ prSection_changes: "Changes requested",
45
+ prSection_approved: "Approved",
46
+ prSection_approvals: "Has approvals",
47
+ prSection_waiting: "Waiting for review",
48
+ prSection_history: "History",
49
+ prSection_unavailable: "Status unavailable",
50
+ prCursorScope: "This cursor does not belong to the current identity or scope; rerun {cli} pr list from the start.",
51
+ prCursorInvalid: "The cursor is invalid or expired; rerun {cli} pr list from the start.",
52
+ prRequired: "Missing {flag}; use {cli} receipt get <id> to obtain the published coordinates.",
27
53
  prRepository: "--repo must be OWNER/REPO.",
28
54
  prSHA: "--sha must be the exact 40-character lowercase published commit SHA.",
29
55
  prBodyRequired: "Provide a non-empty PR description with --body or --body-file (use - for stdin).",
30
- prCheckArguments: "Check the PR arguments with stamp pr create --help; correct invalid or empty values before retrying.",
56
+ prCheckArguments: "Check the PR arguments with {cli} pr create --help; correct invalid or empty values before retrying.",
31
57
  prCheckConfiguration: "Ask the service administrator to repair the GitHub App configuration before retrying.",
32
58
  prBodyConflict: "Use either --body or --body-file, not both.",
33
59
  prBodyRead: "Cannot read --body-file; check the file path or pass - for stdin.",
34
60
  prIdempotency: "--idempotency-key must contain 16–128 letters, digits, dots, underscores, colons, or hyphens.",
35
61
  prCreated: "Created PR #{number}: {url}",
36
62
  prExisting: "Existing PR #{number}: {url}",
37
- prWaitPublished: "Check stamp receipt get <id>; use your own receipt after its status becomes PUBLISHED.",
63
+ prWaitPublished: "Check {cli} receipt get <id>; use your own receipt after its status becomes PUBLISHED.",
38
64
  prCheckReceipt: "Read the receipt again and check --repo, --head and --sha against the exact published commit.",
39
65
  prCheckAccess: "Check repository access and the authorized base branch with the repository administrator.",
40
66
  prCheckExisting: "Check the existing PR and keep the same receipt, title, body and idempotency key when retrying.",
41
67
  prRetry: "Check the receipt and service status, then retry the identical command; its idempotency key stays unchanged.",
42
- apiBindIdentity: "Bind this agent first with `stamp identity bind --email <agent-email>`, then retry the command.",
68
+ apiBindIdentity: "Bind this agent first with `{cli} identity bind --email <agent-email>`, then retry the command.",
43
69
  apiRepositoryNotInstalled: "Check OWNER/REPO spelling, or ask a server owner to install the Stamp GitHub App on that repository, then retry.",
44
70
  apiContributionDenied: "Ask a server owner to grant this agent an active Write-or-higher repository role, then retry.",
45
71
  apiRepositoryNotAuthorized: "Ask a server owner to verify the Stamp GitHub App installation and this agent's identity binding, then retry.",
46
72
 
47
- usage: `stamp {version} — Agent Git gateway CLI (future origin stamp.build)
73
+ usage: `{cli} {version} — Agent Git gateway CLI
48
74
 
49
- stamp login agent: PKCE login via raft (no browser); human: how to set STAMP_TOKEN
50
- stamp logout agent: forget the stored session
51
- stamp whoami who the gateway thinks you are
52
- stamp migration-help old manifest actions → CLI mapping
53
- stamp key enroll [--public-key FILE|-] bind this agent's SSH public key (default ~/.ssh/id_ed25519.pub)
54
- stamp identity bind --email ADDR bind commit-author email (DCO)
55
- stamp receipt get <id> gateway acceptance + GitHub publication status
56
- stamp pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
57
- stamp pr list
58
- stamp pr view <number|URL> --repo OWNER/REPO
59
- stamp pr diff <number|URL> --repo OWNER/REPO [--name-only]
60
- stamp pr checks <number|URL> --repo OWNER/REPO
61
- stamp repo clone <repository> [<directory>] [-- <gitflags>...]
75
+ {cli} login agent: PKCE login via raft (no browser); human: how to set STAMP_TOKEN
76
+ {cli} logout agent: forget the stored session
77
+ {cli} whoami who the gateway thinks you are
78
+ {cli} migration-help old manifest actions → CLI mapping
79
+ {cli} key enroll [--public-key FILE|-] bind this agent's SSH public key (default ~/.ssh/id_ed25519.pub)
80
+ {cli} identity bind --email ADDR bind commit-author email (DCO)
81
+ {cli} receipt get <id> gateway acceptance + GitHub publication status
82
+ {cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
83
+ {cli} pr list
84
+ {cli} pr view <number|URL> --repo OWNER/REPO
85
+ {cli} pr diff <number|URL> --repo OWNER/REPO [--name-only]
86
+ {cli} pr checks <number|URL> --repo OWNER/REPO
87
+ {cli} pr comment <number|URL> --repo OWNER/REPO --body-file FILE|- (human)
88
+ {cli} pr approve <number|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (human)
89
+ {cli} pr merge <number|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (human)
90
+ {cli} repo clone <repository> [<directory>] [-- <gitflags>...]
62
91
 
63
- stamp follow <owner/repo> --kind issue|pull --number N
64
- stamp unfollow <owner/repo> --kind issue|pull --number N
65
- stamp subscription pause|resume <owner/repo> --kind issue|pull --number N
66
- stamp subscriptions
67
- stamp watch <owner/repo> --event TYPE
68
- stamp unwatch <owner/repo> --event TYPE
92
+ {cli} follow <owner/repo> --kind issue|pull --number N
93
+ {cli} unfollow <owner/repo> --kind issue|pull --number N
94
+ {cli} subscription pause|resume <owner/repo> --kind issue|pull --number N
95
+ {cli} subscriptions
96
+ {cli} watch <owner/repo> --event TYPE
97
+ {cli} unwatch <owner/repo> --event TYPE
69
98
 
70
99
  git clone ssh://git@ssh.staging.stamp.build:443/org/repo.git
71
100
  git push ssh://git@ssh.staging.stamp.build:443/org/repo.git HEAD:refs/heads/agent/…
72
101
 
73
102
  flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance), STAMP_SERVICE, STAMP_LANG`,
74
- usageRepoClone: "usage: stamp repo clone <repository> [<directory>] [-- <gitflags>...]",
103
+ usageRepoClone: "usage: {cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
75
104
  cloned: "Cloned {repository} from {url}",
76
105
  cloneFailed: "clone of {repository} via the Stamp gateway failed",
106
+ networkUnreachable: "could not reach {base} ({cause}); check the instance address (STAMP_URL) and your network, then retry",
107
+ networkHostUnresolved: "{base} does not resolve ({cause}); check the instance address (STAMP_URL) and DNS, then retry",
108
+ cloneIdentityMissing: "no SSH private key at {path}: enroll one with `{cli} key enroll` (it reads {path}.pub), or point at an existing key with --identity FILE",
109
+ cloneKnownHostsUnavailable: "{url} returned HTTP {status}: this instance does not publish its SSH host key, so there is nothing to pin — pass --known-hosts FILE, or set STAMP_KNOWN_HOSTS",
110
+ cloneKnownHostsInvalid: "{url} did not return a usable known_hosts line; refusing to pin it — check the instance, or pass --known-hosts FILE",
111
+ clonePublicKeyRejected: "the gateway rejected the key at {path} (publickey). If it is not enrolled yet, enroll its public half: `{cli} key enroll --public-key {publicKey}`",
112
+ cloneIdentityPinned: "pinned the Stamp SSH identity for {directory} (git config core.sshCommand)",
113
+ cloneIdentityPinFailed: "could not write the SSH identity into {directory}; run it yourself: git -C {directory} config --local core.sshCommand \"{command}\"",
77
114
  loginHumanIntro: "Not a managed Raft agent. Humans and CI use STAMP_TOKEN:",
78
115
  loginHumanBrowser: " browser: {url}/login (reuse the session cookie value as STAMP_TOKEN)",
79
116
  loginHumanCI: " CI: a narrowly scoped deploy token",
80
- loginAgentReady: "Agent login ready ({service} @ {url}); access token valid until {expires}",
117
+ loginAgentReady: "Agent login ready ({service} @ {url}); access token valid until {expires} ({remaining})",
118
+ loginTokenExpired: "Agent logged in ({service} @ {url}), but the access token expired at {expires} ({remaining}); the next command refreshes it",
81
119
  logoutForgot: "forgot agent session {path}",
82
120
  logoutNothing: "nothing stored (human/CI lane uses STAMP_TOKEN)",
83
121
  enrolled: "enrolled {fingerprint} ({keyId})",
84
122
  bound: "bound {email}",
85
- usageKeyEnroll: "usage: stamp key enroll [--public-key FILE|-]",
86
- usageIdentityBind: "usage: stamp identity bind --email ADDR",
87
- usageReceiptGet: "usage: stamp receipt get <receipt-id>",
88
- usageFollow: "usage: stamp <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
89
- usageSubscription: "usage: stamp subscription pause|resume <owner/repo> --kind issue|pull --number N",
90
- usageWatch: "usage: stamp {cmd} <owner/repo> --event TYPE",
123
+ usageKeyEnroll: "usage: {cli} key enroll [--public-key FILE|-]",
124
+ usageIdentityBind: "usage: {cli} identity bind --email ADDR",
125
+ usageReceiptGet: "usage: {cli} receipt get <receipt-id>",
126
+ usageFollow: "usage: {cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
127
+ usageSubscription: "usage: {cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
128
+ usageWatch: "usage: {cli} {cmd} <owner/repo> --event TYPE",
91
129
  helpInstall: "install: {cmds}",
92
130
  helpAgentLogin: "agent login: {text}",
93
- sessionRejected: "stamp: session rejected — run `stamp login`",
94
- checkToken: "stamp: check STAMP_TOKEN",
95
- notLoggedIn: "not logged in: run `stamp login` (managed agent)",
96
- stampTokenMissing: "STAMP_TOKEN is not set (session or deploy token); inside a managed agent run `stamp login`",
97
- admission_partial: "refusing to run: partial managed-agent environment ({reason}); not falling back to STAMP_TOKEN",
131
+ sessionRejected: "{cli}: session rejected — run `{cli} login`",
132
+ checkToken: "{cli}: check STAMP_TOKEN",
133
+ notLoggedIn: "not logged in: run `{cli} login` (managed agent)",
134
+ sessionOriginMismatch: "the stored session was issued for {stored}, not {target} — run `{cli} login` again",
135
+ sessionOriginMismatchSibling: "the stored session was issued for {stored}, not {target} — {stored} is served by `{other}`; run that binary instead of `{cli}`",
136
+ pair_mismatch: "refusing a mismatched instance pair: {origin} belongs to service {owner}, not {service} (task #439)",
137
+ stampTokenMissing: "STAMP_TOKEN is not set (session or deploy token); inside a managed agent run `{cli} login`",
138
+ admissionPartial: "refusing to run: partial managed-agent environment ({reason}); not falling back to STAMP_TOKEN",
139
+ admissionMissingVars: "refusing to run: the managed-agent environment is incomplete — {missing} unset while {present} set; this is not a human/CI shell, so STAMP_TOKEN will not be used",
140
+ admissionInvalidAgentID: "refusing to run: SLOCK_AGENT_ID={value} is not a valid agent id; fix the managed-agent environment — STAMP_TOKEN will not be used",
141
+ admissionRaftWrapper: "refusing to run: the managed-agent raft wrapper is missing or not executable at {path}; fix the managed-agent environment — STAMP_TOKEN will not be used",
142
+ keyPublicKeyMissing: "no SSH public key at {path}: create one with `ssh-keygen -t ed25519 -f {private}`, or pass --public-key FILE",
98
143
  invoke_not_json: "agent-login: `raft integration invoke` did not return JSON",
99
144
  invoke_not_object: "agent-login: invoke output is not an object",
100
145
  invoke_failed: "agent-login: invoke did not succeed",
@@ -123,7 +168,7 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
123
168
  session_refresh_expired: "agent-login: session refresh token is already expired",
124
169
  token_size_limit: "agent-login: token response exceeds the size limit",
125
170
  token_deadline: "agent-login: token endpoint exceeded the deadline",
126
- invoke_exit: "agent-login: raft invoke exited with a non-zero status ({status})",
171
+ invoke_exit: "agent-login: raft invoke failed ({status}): {diagnostic}",
127
172
  exchange_redirect: "agent-login: grant exchange rejected redirect (HTTP {status})",
128
173
  exchange_failed: "agent-login: grant exchange failed (HTTP {status})",
129
174
  exchange_not_json: "agent-login: exchange response was not JSON",
@@ -135,12 +180,28 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
135
180
  refresh_wait_timeout: "agent-login: timed out waiting for a concurrent token refresh",
136
181
  },
137
182
  "zh-CN": {
138
- usagePrCreate: "用法:stamp pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]",
139
- usagePrRead: "用法:stamp pr <list|view|diff|checks> [参数]",
140
- usagePrList: "用法:stamp pr list",
141
- usagePrView: "用法:stamp pr view <编号|URL> [--repo OWNER/REPO]",
142
- usagePrDiff: "用法:stamp pr diff <编号|URL> [--repo OWNER/REPO] [--name-only]",
143
- usagePrChecks: "用法:stamp pr checks <编号|URL> [--repo OWNER/REPO]",
183
+ usagePrCreate: "用法:{cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]",
184
+ usagePrRead: "用法:{cli} pr <list|view|diff|checks|comment|approve|merge> [参数]",
185
+ usagePrApprove: "用法:{cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT](需要本人 GitHub 身份)",
186
+ usagePrMerge: "用法:{cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase](需要本人 GitHub 身份)",
187
+ prApproved: "已以 {actor} 身份批准 {repository}#{number}",
188
+ prMerged: "已以 {actor} 身份合并 {repository}#{number}({sha})",
189
+ prApproveRejected: "批准被拒绝。请检查人类会话、GitHub 绑定、仓库权限,以及 --head/--base。",
190
+ prMergeRejected: "合并被拒绝。请检查人类会话、GitHub 绑定、仓库权限、--head/--base 和可合并性。",
191
+ prApproveOutcomeUnknown: "批准结果不明。请先重读 PR 的 reviews,不要自动重发。",
192
+ prMergeOutcomeUnknown: "合并结果不明。请先重读 PR,不要自动重发。",
193
+ apiHumanPrincipal: "Agent 不能批准或合并。请使用绑定了 GitHub 的人类 STAMP_TOKEN 会话。",
194
+ apiWriteCoords: "请重读 PR,带上当前的 --head 和 --base 再试。",
195
+ apiGitHubBinding: "请先在 Stamp 设置里绑定 GitHub,再重试。",
196
+ usagePrComment: "用法:{cli} pr comment <NUMBER -R OWNER/REPO|PR_URL> (--body TEXT|--body-file FILE|-)(需要本人 GitHub 身份)",
197
+ prCommentBodyInvalid: "评论不能为空,UTF-8 文本最多 64 KiB。",
198
+ prCommentCreated: "已以 {actor} 身份发表评论:{url}",
199
+ prCommentRejected: "评论请求被拒绝,请检查人类会话、GitHub 绑定、仓库权限和输入。",
200
+ prCommentOutcomeUnknown: "评论结果不明。请先查看 PR 评论,不要自动重发。",
201
+ usagePrList: "用法:{cli} pr list",
202
+ usagePrView: "用法:{cli} pr view <编号|URL> [--repo OWNER/REPO]",
203
+ usagePrDiff: "用法:{cli} pr diff <编号|URL> [--repo OWNER/REPO] [--name-only]",
204
+ usagePrChecks: "用法:{cli} pr checks <编号|URL> [--repo OWNER/REPO]",
144
205
  prReadInvalidResponse: "Stamp 返回了无效的 PR 读取响应;请检查服务版本后重试。",
145
206
  prReadCoordinateMismatch: "Stamp 返回的 PR 坐标与请求的仓库或编号不一致;已拒绝显示。",
146
207
  prListEmpty: "没有找到通过 Stamp 创建的 Pull Request。",
@@ -157,78 +218,107 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
157
218
  prReadHeadMoved: "Stamp 读取 diff 时 PR head 已变化;请重新运行命令并审阅新的 head。",
158
219
  prReadDiffIncomplete: "GitHub 未返回完整的 PR diff;请稍后重试,不要依赖部分文件。",
159
220
  prReadUnavailable: "PR 读取暂时不可用;请检查 Stamp 服务状态后重试。",
160
- prRequired: "缺少 {flag};用 stamp receipt get <id> 获取已发表提交的信息。",
221
+ prListMore: "还有更多结果;用 --limit 与 --cursor {cursor} 继续翻页。",
222
+ prSection_drafts: "草稿",
223
+ prSection_changes: "需修改",
224
+ prSection_approved: "已批准",
225
+ prSection_approvals: "有批准",
226
+ prSection_waiting: "等待评审",
227
+ prSection_history: "历史",
228
+ prSection_unavailable: "状态暂不可用",
229
+ prCursorScope: "该 cursor 不属于当前身份或范围;请从头重新运行 {cli} pr list。",
230
+ prCursorInvalid: "cursor 无效或已过期;请从头重新运行 {cli} pr list。",
231
+ prRequired: "缺少 {flag};用 {cli} receipt get <id> 获取已发表提交的信息。",
161
232
  prRepository: "--repo 必须为 OWNER/REPO。",
162
233
  prSHA: "--sha 必须是已发表提交的精确 40 位小写 SHA。",
163
234
  prBodyRequired: "请用 --body 或 --body-file 提供非空 PR 正文(用 - 从标准输入读取)。",
164
- prCheckArguments: "请用 stamp pr create --help 检查参数,修正无效或空值后再重试。",
235
+ prCheckArguments: "请用 {cli} pr create --help 检查参数,修正无效或空值后再重试。",
165
236
  prCheckConfiguration: "请先联系服务管理员修复 GitHub App 配置,再重试。",
166
237
  prBodyConflict: "--body 与 --body-file 只能选一个。",
167
238
  prBodyRead: "无法读取 --body-file;请检查路径,或用 - 从标准输入读取。",
168
239
  prIdempotency: "--idempotency-key 必须为 16–128 位字母、数字、点、下划线、冒号或连字符。",
169
240
  prCreated: "已创建 PR #{number}:{url}",
170
241
  prExisting: "已有 PR #{number}:{url}",
171
- prWaitPublished: "请用 stamp receipt get <id> 检查;只使用自己状态为 PUBLISHED 的 receipt。",
242
+ prWaitPublished: "请用 {cli} receipt get <id> 检查;只使用自己状态为 PUBLISHED 的 receipt。",
172
243
  prCheckReceipt: "请重新读取 receipt,并核对 --repo、--head 和 --sha 是否与已发表提交一致。",
173
244
  prCheckAccess: "请与仓库管理员核对仓库权限和允许的目标分支。",
174
245
  prCheckExisting: "请检查已有 PR;重试时保持 receipt、标题、正文和幂等键不变。",
175
246
  prRetry: "请检查 receipt 和服务状态,再原样重试命令;幂等键会保持不变。",
176
- apiBindIdentity: "请先运行 `stamp identity bind --email <agent-email>` 绑定此 Agent,再重试命令。",
247
+ apiBindIdentity: "请先运行 `{cli} identity bind --email <agent-email>` 绑定此 Agent,再重试命令。",
177
248
  apiRepositoryNotInstalled: "请检查 OWNER/REPO 拼写,或请 Server Owner 为该仓库安装 Stamp GitHub App,再重试。",
178
249
  apiContributionDenied: "请让 Server Owner 为此 Agent 授予有效的 Write 或更高仓库角色,再重试。",
179
250
  apiRepositoryNotAuthorized: "请让 Server Owner 核对 Stamp GitHub App 安装与此 Agent 的身份绑定,再重试。",
180
251
 
181
- usage: `stamp {version} — Agent Git 网关 CLI(未来域名 stamp.build)
252
+ usage: `{cli} {version} — Agent Git 网关 CLI
182
253
 
183
- stamp login Agent:经 raft 做 PKCE 登录(无浏览器);人类:如何设置 STAMP_TOKEN
184
- stamp logout Agent:忘掉已存会话
185
- stamp whoami 网关认为你是谁
186
- stamp migration-help 旧 manifest action → CLI 对照
187
- stamp key enroll [--public-key FILE|-] 绑定此 Agent 的 SSH 公钥(默认 ~/.ssh/id_ed25519.pub)
188
- stamp identity bind --email ADDR 绑定提交作者邮箱(DCO)
189
- stamp receipt get <id> 网关接受与 GitHub 发表状态
190
- stamp pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
191
- stamp pr list
192
- stamp pr view <编号|URL> --repo OWNER/REPO
193
- stamp pr diff <编号|URL> --repo OWNER/REPO [--name-only]
194
- stamp pr checks <编号|URL> --repo OWNER/REPO
195
- stamp repo clone <repository> [<directory>] [-- <gitflags>...]
254
+ {cli} login Agent:经 raft 做 PKCE 登录(无浏览器);人类:如何设置 STAMP_TOKEN
255
+ {cli} logout Agent:忘掉已存会话
256
+ {cli} whoami 网关认为你是谁
257
+ {cli} migration-help 旧 manifest action → CLI 对照
258
+ {cli} key enroll [--public-key FILE|-] 绑定此 Agent 的 SSH 公钥(默认 ~/.ssh/id_ed25519.pub)
259
+ {cli} identity bind --email ADDR 绑定提交作者邮箱(DCO)
260
+ {cli} receipt get <id> 网关接受与 GitHub 发表状态
261
+ {cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
262
+ {cli} pr list
263
+ {cli} pr view <编号|URL> --repo OWNER/REPO
264
+ {cli} pr diff <编号|URL> --repo OWNER/REPO [--name-only]
265
+ {cli} pr checks <编号|URL> --repo OWNER/REPO
266
+ {cli} pr comment <编号|URL> --repo OWNER/REPO --body-file FILE|- (本人 GitHub 身份)
267
+ {cli} pr approve <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (本人 GitHub 身份)
268
+ {cli} pr merge <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (本人 GitHub 身份)
269
+ {cli} repo clone <repository> [<directory>] [-- <gitflags>...]
196
270
 
197
- stamp follow <owner/repo> --kind issue|pull --number N
198
- stamp unfollow <owner/repo> --kind issue|pull --number N
199
- stamp subscription pause|resume <owner/repo> --kind issue|pull --number N
200
- stamp subscriptions
201
- stamp watch <owner/repo> --event TYPE
202
- stamp unwatch <owner/repo> --event TYPE
271
+ {cli} follow <owner/repo> --kind issue|pull --number N
272
+ {cli} unfollow <owner/repo> --kind issue|pull --number N
273
+ {cli} subscription pause|resume <owner/repo> --kind issue|pull --number N
274
+ {cli} subscriptions
275
+ {cli} watch <owner/repo> --event TYPE
276
+ {cli} unwatch <owner/repo> --event TYPE
203
277
 
204
278
  git clone ssh://git@ssh.staging.stamp.build:443/org/repo.git
205
279
  git push ssh://git@ssh.staging.stamp.build:443/org/repo.git HEAD:refs/heads/agent/…
206
280
 
207
281
  flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、STAMP_SERVICE、STAMP_LANG`,
208
- usageRepoClone: "用法:stamp repo clone <repository> [<directory>] [-- <gitflags>...]",
282
+ usageRepoClone: "用法:{cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
209
283
  cloned: "已从 {url} 克隆 {repository}",
210
284
  cloneFailed: "经 Stamp 网关克隆 {repository} 失败",
285
+ networkUnreachable: "无法连接 {base}({cause});检查实例地址(STAMP_URL)和网络后重试",
286
+ networkHostUnresolved: "{base} 解析不了({cause});检查实例地址(STAMP_URL)和 DNS 后重试",
287
+ cloneIdentityMissing: "{path} 没有 SSH 私钥:用 `{cli} key enroll` 登记一把(它读 {path}.pub),或用 --identity FILE 指到已有私钥",
288
+ cloneKnownHostsUnavailable: "{url} 返回 HTTP {status}:这个实例没有发布自己的 SSH 主机公钥,没有可钉的东西——用 --known-hosts FILE 指定,或设 STAMP_KNOWN_HOSTS",
289
+ cloneKnownHostsInvalid: "{url} 返回的不是可用的 known_hosts 行;拒绝钉它——检查实例,或用 --known-hosts FILE",
290
+ clonePublicKeyRejected: "网关拒绝了 {path} 这把钥(publickey)。如果它还没登记,先登记它的公钥:`{cli} key enroll --public-key {publicKey}`",
291
+ cloneIdentityPinned: "已把 Stamp 的 SSH 身份钉到 {directory}(git config core.sshCommand)",
292
+ cloneIdentityPinFailed: "无法把 SSH 身份写入 {directory};可手动执行:git -C {directory} config --local core.sshCommand \"{command}\"",
211
293
  loginHumanIntro: "当前不是受管 Raft Agent。人类和 CI 使用 STAMP_TOKEN:",
212
294
  loginHumanBrowser: " 浏览器:{url}/login (把会话 cookie 值设为 STAMP_TOKEN)",
213
295
  loginHumanCI: " CI: 由负责人签发的窄范围部署令牌",
214
- loginAgentReady: "Agent 登录就绪({service} @ {url});访问令牌有效至 {expires}",
296
+ loginAgentReady: "Agent 登录就绪({service} @ {url});访问令牌有效至 {expires}({remaining})",
297
+ loginTokenExpired: "Agent 已登录({service} @ {url}),但访问令牌已于 {expires} 过期({remaining});下一条命令会自动刷新",
215
298
  logoutForgot: "已忘记 Agent 会话 {path}",
216
299
  logoutNothing: "没有本地会话(人类/CI 通道使用 STAMP_TOKEN)",
217
300
  enrolled: "已登记 {fingerprint}({keyId})",
218
301
  bound: "已绑定 {email}",
219
- usageKeyEnroll: "用法:stamp key enroll [--public-key FILE|-]",
220
- usageIdentityBind: "用法:stamp identity bind --email ADDR",
221
- usageReceiptGet: "用法:stamp receipt get <receipt-id>",
222
- usageFollow: "用法:stamp <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
223
- usageSubscription: "用法:stamp subscription pause|resume <owner/repo> --kind issue|pull --number N",
224
- usageWatch: "用法:stamp {cmd} <owner/repo> --event TYPE",
302
+ usageKeyEnroll: "用法:{cli} key enroll [--public-key FILE|-]",
303
+ usageIdentityBind: "用法:{cli} identity bind --email ADDR",
304
+ usageReceiptGet: "用法:{cli} receipt get <receipt-id>",
305
+ usageFollow: "用法:{cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
306
+ usageSubscription: "用法:{cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
307
+ usageWatch: "用法:{cli} {cmd} <owner/repo> --event TYPE",
225
308
  helpInstall: "安装:{cmds}",
226
309
  helpAgentLogin: "Agent 登录:{text}",
227
- sessionRejected: "stamp: 会话被拒绝 — 请运行 `stamp login`",
228
- checkToken: "stamp: 请检查 STAMP_TOKEN",
229
- notLoggedIn: "尚未登录:请运行 `stamp login`(受管 Agent)",
230
- stampTokenMissing: "未设置 STAMP_TOKEN(会话或部署令牌);在受管 Agent 内请运行 `stamp login`",
231
- admission_partial: "拒绝运行:受管 Agent 环境不完整({reason});不会回退到 STAMP_TOKEN",
310
+ sessionRejected: "{cli}: 会话被拒绝 — 请运行 `{cli} login`",
311
+ checkToken: "{cli}: 请检查 STAMP_TOKEN",
312
+ notLoggedIn: "尚未登录:请运行 `{cli} login`(受管 Agent)",
313
+ sessionOriginMismatch: "已存会话是给 {stored} 签发的,不是 {target}——请重新运行 `{cli} login`",
314
+ sessionOriginMismatchSibling: "已存会话是给 {stored} 签发的,不是 {target}——{stored} 对应的是 `{other}`,请改用它,而不是 `{cli}`",
315
+ pair_mismatch: "拒绝不匹配的实例配对:{origin} 属于服务 {owner},而非 {service}(task #439)",
316
+ stampTokenMissing: "未设置 STAMP_TOKEN(会话或部署令牌);在受管 Agent 内请运行 `{cli} login`",
317
+ admissionPartial: "拒绝运行:受管 Agent 环境不完整({reason});不会回退到 STAMP_TOKEN",
318
+ admissionMissingVars: "拒绝运行:受管 Agent 环境不完整——{missing} 未设置,但 {present} 已设置;这不是人类/CI 环境,不会回退到 STAMP_TOKEN",
319
+ admissionInvalidAgentID: "拒绝运行:SLOCK_AGENT_ID={value} 不是合法的 agent id;请修好受管 Agent 环境——不会回退到 STAMP_TOKEN",
320
+ admissionRaftWrapper: "拒绝运行:受管 Agent 的 raft 包装脚本缺失或不可执行({path});请修好受管 Agent 环境——不会回退到 STAMP_TOKEN",
321
+ keyPublicKeyMissing: "{path} 没有 SSH 公钥:用 `ssh-keygen -t ed25519 -f {private}` 生成一把,或用 --public-key FILE 指定",
232
322
  invoke_not_json: "agent-login: `raft integration invoke` 没有返回 JSON",
233
323
  invoke_not_object: "agent-login: invoke 输出不是对象",
234
324
  invoke_failed: "agent-login: invoke 未成功",
@@ -257,7 +347,7 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、ST
257
347
  session_refresh_expired: "agent-login: 会话刷新令牌已经过期",
258
348
  token_size_limit: "agent-login: 令牌响应超过大小限制",
259
349
  token_deadline: "agent-login: 令牌端点超过时限",
260
- invoke_exit: "agent-login: raft invoke 以非零状态退出({status})",
350
+ invoke_exit: "agent-login: raft invoke 失败({status}):{diagnostic}",
261
351
  exchange_redirect: "agent-login: 授权兑换拒绝跟随重定向(HTTP {status})",
262
352
  exchange_failed: "agent-login: 授权兑换失败(HTTP {status})",
263
353
  exchange_not_json: "agent-login: 兑换响应不是 JSON",
@@ -276,9 +366,42 @@ export function selectLocale(env = process.env, explicit) {
276
366
  return "en";
277
367
  }
278
368
 
369
+ // The binary that targets THIS instance. Set once by the entry point (main());
370
+ // every command reference in the tables uses `{cli}` so user-visible copy names
371
+ // the binary the reader actually invoked — a staging user must never be told to
372
+ // run `stamp` (@phage: the error surface reaches users before the docs).
373
+ // Product names ("Stamp"), the package id and historical facts are NOT `{cli}`.
374
+ //
375
+ // FAIL-LOUD (@Tenny): the value starts UNSET. A silent `"stamp"` default would
376
+ // mean that if the entry never set the name, a staging user would quietly be
377
+ // shown the PRODUCTION binary — the exact defect shape this task fixes. An unset
378
+ // name renders as a conspicuous marker (and prefix() throws in a test), so a
379
+ // broken parameter chain is a VISIBLE failure, never a plausible wrong value.
380
+ let cliName = null;
381
+
382
+ export function setCliName(name) {
383
+ if (typeof name === "string" && name.length > 0) cliName = name;
384
+ }
385
+
386
+ /** For tests/diagnostics: the resolved entry binary, or null if never set. */
387
+ export function currentCliName() {
388
+ return cliName;
389
+ }
390
+
391
+ /** The `<binary>:` banner that prefixes user-facing diagnostics. It names the
392
+ * binary the user actually ran, so a staging user sees `stamp-staging:` and not
393
+ * the production name (task #444 / #439). */
394
+ export function prefix() {
395
+ // An unset name is a programming error: fail loudly rather than printing a
396
+ // plausible-but-wrong production banner on a staging entry.
397
+ const name = cliName ?? "<cli-unset>";
398
+ return `${name}: `;
399
+ }
400
+
279
401
  export function t(locale, key, vars = {}) {
280
402
  const table = messages[locale] || messages.en;
281
403
  let s = table[key] || messages.en[key] || key;
282
- for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v));
404
+ const all = { cli: cliName ?? "<cli-unset>", ...vars };
405
+ for (const [k, v] of Object.entries(all)) s = s.replaceAll(`{${k}}`, String(v));
283
406
  return s;
284
407
  }