@botiverse/stamp-cli 0.3.3 → 0.3.7
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/README.md +14 -0
- package/lib/agent-login.mjs +10 -1
- package/lib/auth.mjs +45 -2
- package/lib/client.mjs +67 -10
- package/lib/commands/changelog.mjs +58 -0
- package/lib/commands/identity.mjs +12 -0
- package/lib/commands/key.mjs +58 -0
- package/lib/commands/knownhosts.mjs +144 -0
- package/lib/commands/pr.mjs +189 -0
- package/lib/commands/receipt.mjs +16 -0
- package/lib/commands/repo.mjs +78 -0
- package/lib/commands/session.mjs +52 -0
- package/lib/commands/subscribe.mjs +35 -0
- package/lib/errors.mjs +11 -37
- package/lib/expiry.mjs +27 -0
- package/lib/flags.mjs +26 -0
- package/lib/locale.mjs +167 -17
- package/lib/main.mjs +43 -302
- package/lib/{pr-comment.mjs → pr/comment.mjs} +10 -5
- package/lib/{pull-request.mjs → pr/create.mjs} +1 -1
- package/lib/{pr-read.mjs → pr/read.mjs} +29 -5
- package/lib/pr/review.mjs +81 -0
- package/lib/pr/write.mjs +82 -0
- package/lib/{repo-clone.mjs → repo/clone.mjs} +15 -0
- package/lib/repo/identities.mjs +43 -0
- package/lib/repo/ssh.mjs +227 -0
- package/package.json +1 -1
package/lib/locale.mjs
CHANGED
|
@@ -2,11 +2,30 @@
|
|
|
2
2
|
export const messages = {
|
|
3
3
|
en: {
|
|
4
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> [arguments]",
|
|
6
|
-
|
|
5
|
+
usagePrRead: "usage: {cli} pr <list|view|review|diff|checks|comment|approve|merge> [arguments]",
|
|
6
|
+
usagePrReview: "usage: {cli} pr review <number|URL> [--repo OWNER/REPO] — the exact head to pin, base, merge-base, checks, and the diff/patch-id commands against the merge-base",
|
|
7
|
+
prReviewExactHead: "Exact head",
|
|
8
|
+
prReviewBase: "Base",
|
|
9
|
+
prReviewMergeBase: "Merge-base",
|
|
10
|
+
prReviewMergeBaseRule: "log, stat, diff and patch-id against the merge-base, never against the current base: the base branch may have advanced since this branch forked, and those commits would show up as the PR's",
|
|
11
|
+
prReviewCommands: "Local review (after cloning through Stamp)",
|
|
12
|
+
prReviewVerdict: "Verdict to post",
|
|
13
|
+
usagePrApprove: "usage: {cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT] (human GitHub identity required)",
|
|
14
|
+
usagePrMerge: "usage: {cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase] (human GitHub identity required)",
|
|
15
|
+
prApproved: "Approved {repository}#{number} as {actor}",
|
|
16
|
+
prMerged: "Merged {repository}#{number} as {actor} ({sha})",
|
|
17
|
+
prApproveRejected: "Approve was rejected. Check your human session, GitHub binding, repository access, and --head/--base.",
|
|
18
|
+
prMergeRejected: "Merge was rejected. Check your human session, GitHub binding, repository access, --head/--base, and mergeability.",
|
|
19
|
+
prApproveOutcomeUnknown: "Approve outcome is unknown. Re-read the PR reviews before sending again; do not automatically resend.",
|
|
20
|
+
prMergeOutcomeUnknown: "Merge outcome is unknown. Re-read the PR before sending again; do not automatically resend.",
|
|
21
|
+
apiHumanPrincipal: "Agents cannot approve or merge. Use a human STAMP_TOKEN session.",
|
|
22
|
+
apiWriteCoords: "Re-read the PR and retry with both --head and --base.",
|
|
23
|
+
apiGitHubBinding: "Bind your GitHub account in Stamp settings, then retry.",
|
|
24
|
+
usagePrComment: "usage: {cli} pr comment <NUMBER -R OWNER/REPO|PR_URL> (--body TEXT|--body-file FILE|-) [--expected-head SHA] (a human posts as their bound GitHub identity; an agent posts as the Stamp App with an attribution line naming the agent; with --expected-head the comment is refused if the pull request has moved)",
|
|
25
|
+
prCommentExpectedHeadInvalid: "--expected-head must be the full 40-character commit SHA you reviewed.",
|
|
7
26
|
prCommentBodyInvalid: "Comment must be nonempty and at most 64 KiB of UTF-8 text.",
|
|
8
27
|
prCommentCreated: "Comment posted as {actor}: {url}",
|
|
9
|
-
prCommentRejected: "Comment request was rejected. Check your
|
|
28
|
+
prCommentRejected: "Comment request was rejected. Check your session, GitHub binding (humans), repository access and input.",
|
|
10
29
|
prCommentOutcomeUnknown: "Comment outcome is unknown. Check the PR comments before sending again; do not automatically resend.",
|
|
11
30
|
usagePrList: "usage: {cli} pr list",
|
|
12
31
|
usagePrView: "usage: {cli} pr view <number|URL> [--repo OWNER/REPO]",
|
|
@@ -24,6 +43,9 @@ export const messages = {
|
|
|
24
43
|
prDiffUnavailable: "patch unavailable",
|
|
25
44
|
prDiffEmpty: "No changed files reported.",
|
|
26
45
|
prChecksEmpty: "No checks reported.",
|
|
46
|
+
prChecksUnreadable: "Checks could not be read for this pull request, so this is not \"no checks\" — the gateway was refused by GitHub (most often a missing Checks permission on the app). Treat CI as unknown.",
|
|
47
|
+
prCIUnreadable: "unreadable",
|
|
48
|
+
prVerdictCIUnreadable: "CI unreadable — not evidence of green",
|
|
27
49
|
prReadNotFound: "Check the repository and PR number, and confirm this Agent created the PR through Stamp.",
|
|
28
50
|
prReadHeadMoved: "The PR head changed while Stamp read the diff; rerun the command and review the new head.",
|
|
29
51
|
prReadDiffIncomplete: "GitHub did not return the complete PR diff; retry later instead of relying on partial files.",
|
|
@@ -66,14 +88,20 @@ export const messages = {
|
|
|
66
88
|
{cli} whoami who the gateway thinks you are
|
|
67
89
|
{cli} migration-help old manifest actions → CLI mapping
|
|
68
90
|
{cli} key enroll [--public-key FILE|-] bind this agent's SSH public key (default ~/.ssh/id_ed25519.pub)
|
|
91
|
+
{cli} key list list this agent's enrolled SSH keys
|
|
92
|
+
{cli} key revoke KEY_ID revoke one of this agent's enrolled keys
|
|
93
|
+
{cli} known-hosts refresh re-pin this instance's SSH host key from /.well-known
|
|
69
94
|
{cli} identity bind --email ADDR bind commit-author email (DCO)
|
|
70
95
|
{cli} receipt get <id> gateway acceptance + GitHub publication status
|
|
96
|
+
{cli} changelog [--limit N] [--all] release history: CLI/API changes per version (--all: everything)
|
|
71
97
|
{cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
|
|
72
98
|
{cli} pr list
|
|
73
99
|
{cli} pr view <number|URL> --repo OWNER/REPO
|
|
74
100
|
{cli} pr diff <number|URL> --repo OWNER/REPO [--name-only]
|
|
75
101
|
{cli} pr checks <number|URL> --repo OWNER/REPO
|
|
76
102
|
{cli} pr comment <number|URL> --repo OWNER/REPO --body-file FILE|- (human)
|
|
103
|
+
{cli} pr approve <number|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (human)
|
|
104
|
+
{cli} pr merge <number|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (human)
|
|
77
105
|
{cli} repo clone <repository> [<directory>] [-- <gitflags>...]
|
|
78
106
|
|
|
79
107
|
{cli} follow <owner/repo> --kind issue|pull --number N
|
|
@@ -87,20 +115,55 @@ export const messages = {
|
|
|
87
115
|
git push ssh://git@ssh.staging.stamp.build:443/org/repo.git HEAD:refs/heads/agent/…
|
|
88
116
|
|
|
89
117
|
flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance), STAMP_SERVICE, STAMP_LANG`,
|
|
90
|
-
usageRepoClone: "usage: {cli} repo clone <repository> [<directory>] [-- <gitflags>...]",
|
|
118
|
+
usageRepoClone: "usage: {cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
|
|
91
119
|
cloned: "Cloned {repository} from {url}",
|
|
120
|
+
cloneCommitTrailers: "Every commit you push here must end with these trailers, as one block at the very end with no blank line between them (GitHub only reads the last contiguous block):",
|
|
92
121
|
cloneFailed: "clone of {repository} via the Stamp gateway failed",
|
|
122
|
+
networkUnreachable: "could not reach {base} ({cause}); check the instance address (STAMP_URL) and your network, then retry",
|
|
123
|
+
networkHostUnresolved: "{base} does not resolve ({cause}); check the instance address (STAMP_URL) and DNS, then retry",
|
|
124
|
+
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",
|
|
125
|
+
cloneEnrolledIdentityMissing: "the key `{cli} key enroll` recorded for {origin} is not at {path} on this machine: run `{cli} key enroll` here, or point at the key with --identity FILE",
|
|
126
|
+
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",
|
|
127
|
+
cloneKnownHostsInvalid: "{url} did not return a usable known_hosts line; refusing to pin it — check the instance, or pass --known-hosts FILE",
|
|
128
|
+
usageKnownHostsRefresh: "usage: known-hosts refresh [--known-hosts FILE]",
|
|
129
|
+
knownHostsRefreshed: "pinned {pattern} in {path}\n{fingerprint}",
|
|
130
|
+
knownHostsRepoAligned: "this repository reads that file\n note: a GIT_SSH_COMMAND set in the environment you push from overrides this and cannot be seen from here, so this does not vouch for the next push",
|
|
131
|
+
knownHostsRepoUnchecked: "could not confirm whether this repository reads the file that was just refreshed\n refreshed: {written}\n {reason}\nthis is not a failure and not a confirmation: treat the repository as unchecked",
|
|
132
|
+
knownHostsUncheckedNoRepo: "not inside a git repository, so there is no repository configuration to ask",
|
|
133
|
+
knownHostsUncheckedExplicitPath: "--known-hosts named this file explicitly, so no repository was checked against it",
|
|
134
|
+
knownHostsUncheckedProbe: "the repository's ssh command could not be run, so its effective known_hosts is unknown",
|
|
135
|
+
knownHostsRepoElsewhere: "this repository does not read the file that was just refreshed\n refreshed: {written}\n this repository reads: {effective}\nuntil they agree, refreshing does nothing for pushes from here; set core.sshCommand in this repository:\n git config core.sshCommand \"{sshCommand}\"",
|
|
136
|
+
knownHostsRepoUnconfigured: "this repository has no core.sshCommand, so it does not read the file that was just refreshed\n refreshed: {written}\n this repository reads: {effective}\nit connects through ssh's own configuration, or through a GIT_SSH_COMMAND set for each push, which this command cannot see and cannot vouch for; set core.sshCommand in this repository:\n git config core.sshCommand \"{sshCommand}\"",
|
|
137
|
+
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}`",
|
|
138
|
+
cloneIdentityPinned: "pinned the Stamp SSH identity for {directory} (git config core.sshCommand)",
|
|
139
|
+
cloneIdentityPinFailed: "could not write the SSH identity into {directory}; run it yourself: git -C {directory} config --local core.sshCommand \"{command}\"",
|
|
93
140
|
loginHumanIntro: "Not a managed Raft agent. Humans and CI use STAMP_TOKEN:",
|
|
94
141
|
loginHumanBrowser: " browser: {url}/login (reuse the session cookie value as STAMP_TOKEN)",
|
|
95
142
|
loginHumanCI: " CI: a narrowly scoped deploy token",
|
|
96
|
-
loginAgentReady: "Agent login ready ({service} @ {url}); access token valid until {expires}",
|
|
143
|
+
loginAgentReady: "Agent login ready ({service} @ {url}); access token valid until {expires} ({remaining})",
|
|
144
|
+
loginTokenExpired: "Agent logged in ({service} @ {url}), but the access token expired at {expires} ({remaining}); the next command refreshes it",
|
|
97
145
|
logoutForgot: "forgot agent session {path}",
|
|
98
146
|
logoutNothing: "nothing stored (human/CI lane uses STAMP_TOKEN)",
|
|
99
147
|
enrolled: "enrolled {fingerprint} ({keyId})",
|
|
148
|
+
enrolledIdentityRecorded: "`{cli} repo clone` on this machine will use {path}",
|
|
149
|
+
enrolledIdentityNotRecorded: "the private key {path} is not on this machine, so `{cli} repo clone` here will need --identity FILE",
|
|
100
150
|
bound: "bound {email}",
|
|
101
151
|
usageKeyEnroll: "usage: {cli} key enroll [--public-key FILE|-]",
|
|
152
|
+
usageKeyList: "usage: {cli} key list",
|
|
153
|
+
usageKeyRevoke: "usage: {cli} key revoke KEY_ID",
|
|
154
|
+
keyListEmpty: "no enrolled keys",
|
|
155
|
+
keyRevoked: "revoked {keyId}",
|
|
102
156
|
usageIdentityBind: "usage: {cli} identity bind --email ADDR",
|
|
103
157
|
usageReceiptGet: "usage: {cli} receipt get <receipt-id>",
|
|
158
|
+
usageChangelog: "usage: {cli} changelog [--limit N] [--all]",
|
|
159
|
+
changelogScopeAgent: "Showing CLI and API changes; --all shows everything.",
|
|
160
|
+
changelogScopeAll: "Showing every change, including the web app and internal work.",
|
|
161
|
+
changelogNoneForAgents: "no CLI or API changes in this release ({hidden} other; --all shows them)",
|
|
162
|
+
changelogHiddenCount: "({hidden} other change(s) hidden; --all shows them)",
|
|
163
|
+
changelogBuild: "Gateway build {version} ({commit})",
|
|
164
|
+
changelogEmpty: "No releases recorded in this build.",
|
|
165
|
+
changelogNoEntries: "no pull requests recorded",
|
|
166
|
+
changelogCurrentMark: "<- running",
|
|
104
167
|
usageFollow: "usage: {cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
|
|
105
168
|
usageSubscription: "usage: {cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
|
|
106
169
|
usageWatch: "usage: {cli} {cmd} <owner/repo> --event TYPE",
|
|
@@ -110,9 +173,14 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
110
173
|
checkToken: "{cli}: check STAMP_TOKEN",
|
|
111
174
|
notLoggedIn: "not logged in: run `{cli} login` (managed agent)",
|
|
112
175
|
sessionOriginMismatch: "the stored session was issued for {stored}, not {target} — run `{cli} login` again",
|
|
176
|
+
sessionOriginMismatchSibling: "the stored session was issued for {stored}, not {target} — {stored} is served by `{other}`; run that binary instead of `{cli}`",
|
|
113
177
|
pair_mismatch: "refusing a mismatched instance pair: {origin} belongs to service {owner}, not {service} (task #439)",
|
|
114
178
|
stampTokenMissing: "STAMP_TOKEN is not set (session or deploy token); inside a managed agent run `{cli} login`",
|
|
115
|
-
|
|
179
|
+
admissionPartial: "refusing to run: partial managed-agent environment ({reason}); not falling back to STAMP_TOKEN",
|
|
180
|
+
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",
|
|
181
|
+
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",
|
|
182
|
+
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",
|
|
183
|
+
keyPublicKeyMissing: "no SSH public key at {path}: create one with `ssh-keygen -t ed25519 -f {private}`, or pass --public-key FILE",
|
|
116
184
|
invoke_not_json: "agent-login: `raft integration invoke` did not return JSON",
|
|
117
185
|
invoke_not_object: "agent-login: invoke output is not an object",
|
|
118
186
|
invoke_failed: "agent-login: invoke did not succeed",
|
|
@@ -141,7 +209,7 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
141
209
|
session_refresh_expired: "agent-login: session refresh token is already expired",
|
|
142
210
|
token_size_limit: "agent-login: token response exceeds the size limit",
|
|
143
211
|
token_deadline: "agent-login: token endpoint exceeded the deadline",
|
|
144
|
-
invoke_exit: "agent-login: raft invoke
|
|
212
|
+
invoke_exit: "agent-login: raft invoke failed ({status}): {diagnostic}",
|
|
145
213
|
exchange_redirect: "agent-login: grant exchange rejected redirect (HTTP {status})",
|
|
146
214
|
exchange_failed: "agent-login: grant exchange failed (HTTP {status})",
|
|
147
215
|
exchange_not_json: "agent-login: exchange response was not JSON",
|
|
@@ -154,11 +222,30 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
154
222
|
},
|
|
155
223
|
"zh-CN": {
|
|
156
224
|
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]",
|
|
157
|
-
usagePrRead: "用法:{cli} pr <list|view|diff|checks|comment> [参数]",
|
|
158
|
-
|
|
225
|
+
usagePrRead: "用法:{cli} pr <list|view|review|diff|checks|comment|approve|merge> [参数]",
|
|
226
|
+
usagePrReview: "用法:{cli} pr review <编号|URL> [--repo OWNER/REPO] —— 要钉的 exact head、base、merge-base、检查,以及对 merge-base 做 diff/patch-id 的命令",
|
|
227
|
+
prReviewExactHead: "Exact head",
|
|
228
|
+
prReviewBase: "Base",
|
|
229
|
+
prReviewMergeBase: "Merge-base",
|
|
230
|
+
prReviewMergeBaseRule: "log/stat/diff/patch-id 一律对 merge-base,不要对当前 base:base 分支可能在分叉后已前进,那些提交会被当成这张 PR 的",
|
|
231
|
+
prReviewCommands: "本地复核(经 Stamp clone 之后)",
|
|
232
|
+
prReviewVerdict: "要贴的判词",
|
|
233
|
+
usagePrApprove: "用法:{cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT](需要本人 GitHub 身份)",
|
|
234
|
+
usagePrMerge: "用法:{cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase](需要本人 GitHub 身份)",
|
|
235
|
+
prApproved: "已以 {actor} 身份批准 {repository}#{number}",
|
|
236
|
+
prMerged: "已以 {actor} 身份合并 {repository}#{number}({sha})",
|
|
237
|
+
prApproveRejected: "批准被拒绝。请检查人类会话、GitHub 绑定、仓库权限,以及 --head/--base。",
|
|
238
|
+
prMergeRejected: "合并被拒绝。请检查人类会话、GitHub 绑定、仓库权限、--head/--base 和可合并性。",
|
|
239
|
+
prApproveOutcomeUnknown: "批准结果不明。请先重读 PR 的 reviews,不要自动重发。",
|
|
240
|
+
prMergeOutcomeUnknown: "合并结果不明。请先重读 PR,不要自动重发。",
|
|
241
|
+
apiHumanPrincipal: "Agent 不能批准或合并。请使用绑定了 GitHub 的人类 STAMP_TOKEN 会话。",
|
|
242
|
+
apiWriteCoords: "请重读 PR,带上当前的 --head 和 --base 再试。",
|
|
243
|
+
apiGitHubBinding: "请先在 Stamp 设置里绑定 GitHub,再重试。",
|
|
244
|
+
usagePrComment: "用法:{cli} pr comment <NUMBER -R OWNER/REPO|PR_URL> (--body TEXT|--body-file FILE|-) [--expected-head SHA](人类以本人绑定的 GitHub 身份发表;agent 以 Stamp App 身份发表并附带署名行;带 --expected-head 时 PR 的 head 变了就拒绝发表)",
|
|
245
|
+
prCommentExpectedHeadInvalid: "--expected-head 必须是你复核过的完整 40 位 commit SHA。",
|
|
159
246
|
prCommentBodyInvalid: "评论不能为空,UTF-8 文本最多 64 KiB。",
|
|
160
247
|
prCommentCreated: "已以 {actor} 身份发表评论:{url}",
|
|
161
|
-
prCommentRejected: "
|
|
248
|
+
prCommentRejected: "评论请求被拒绝,请检查会话、GitHub 绑定(人类)、仓库权限和输入。",
|
|
162
249
|
prCommentOutcomeUnknown: "评论结果不明。请先查看 PR 评论,不要自动重发。",
|
|
163
250
|
usagePrList: "用法:{cli} pr list",
|
|
164
251
|
usagePrView: "用法:{cli} pr view <编号|URL> [--repo OWNER/REPO]",
|
|
@@ -176,6 +263,9 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
176
263
|
prDiffUnavailable: "patch 不可用",
|
|
177
264
|
prDiffEmpty: "没有变更文件。",
|
|
178
265
|
prChecksEmpty: "没有检查记录。",
|
|
266
|
+
prChecksUnreadable: "无法读取这个 PR 的检查结果,所以这不是\"没有检查\"——网关被 GitHub 拒绝了(通常是 App 缺少 Checks 权限)。请把 CI 当作未知。",
|
|
267
|
+
prCIUnreadable: "无法读取",
|
|
268
|
+
prVerdictCIUnreadable: "CI 无法读取——不能当作已通过",
|
|
179
269
|
prReadNotFound: "请检查仓库和 PR 编号,并确认该 PR 是此 Agent 通过 Stamp 创建的。",
|
|
180
270
|
prReadHeadMoved: "Stamp 读取 diff 时 PR head 已变化;请重新运行命令并审阅新的 head。",
|
|
181
271
|
prReadDiffIncomplete: "GitHub 未返回完整的 PR diff;请稍后重试,不要依赖部分文件。",
|
|
@@ -218,14 +308,20 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
218
308
|
{cli} whoami 网关认为你是谁
|
|
219
309
|
{cli} migration-help 旧 manifest action → CLI 对照
|
|
220
310
|
{cli} key enroll [--public-key FILE|-] 绑定此 Agent 的 SSH 公钥(默认 ~/.ssh/id_ed25519.pub)
|
|
311
|
+
{cli} key list 列出此 Agent 已登记的 SSH 公钥
|
|
312
|
+
{cli} key revoke KEY_ID 撤销此 Agent 的一把已登记公钥
|
|
313
|
+
{cli} known-hosts refresh 从 /.well-known 重新钉住本实例的 SSH 主机公钥
|
|
221
314
|
{cli} identity bind --email ADDR 绑定提交作者邮箱(DCO)
|
|
222
315
|
{cli} receipt get <id> 网关接受与 GitHub 发表状态
|
|
316
|
+
{cli} changelog [--limit N] [--all] 更新日志:每个版本的命令行/接口变化(--all 看全部)
|
|
223
317
|
{cli} pr create --receipt ID --repo OWNER/REPO --head BRANCH --sha SHA --base BRANCH --title TITLE (--body TEXT|--body-file FILE|-) [--idempotency-key KEY]
|
|
224
318
|
{cli} pr list
|
|
225
319
|
{cli} pr view <编号|URL> --repo OWNER/REPO
|
|
226
320
|
{cli} pr diff <编号|URL> --repo OWNER/REPO [--name-only]
|
|
227
321
|
{cli} pr checks <编号|URL> --repo OWNER/REPO
|
|
228
322
|
{cli} pr comment <编号|URL> --repo OWNER/REPO --body-file FILE|- (本人 GitHub 身份)
|
|
323
|
+
{cli} pr approve <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (本人 GitHub 身份)
|
|
324
|
+
{cli} pr merge <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (本人 GitHub 身份)
|
|
229
325
|
{cli} repo clone <repository> [<directory>] [-- <gitflags>...]
|
|
230
326
|
|
|
231
327
|
{cli} follow <owner/repo> --kind issue|pull --number N
|
|
@@ -239,20 +335,55 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
239
335
|
git push ssh://git@ssh.staging.stamp.build:443/org/repo.git HEAD:refs/heads/agent/…
|
|
240
336
|
|
|
241
337
|
flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、STAMP_SERVICE、STAMP_LANG`,
|
|
242
|
-
usageRepoClone: "用法:{cli} repo clone <repository> [<directory>] [-- <gitflags>...]",
|
|
338
|
+
usageRepoClone: "用法:{cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
|
|
243
339
|
cloned: "已从 {url} 克隆 {repository}",
|
|
340
|
+
cloneCommitTrailers: "推到这里的每个 commit 末尾都要带这两行 trailer(连成一块放在最末尾,中间不要空行;GitHub 只认最后一个连续块):",
|
|
244
341
|
cloneFailed: "经 Stamp 网关克隆 {repository} 失败",
|
|
342
|
+
networkUnreachable: "无法连接 {base}({cause});检查实例地址(STAMP_URL)和网络后重试",
|
|
343
|
+
networkHostUnresolved: "{base} 解析不了({cause});检查实例地址(STAMP_URL)和 DNS 后重试",
|
|
344
|
+
cloneIdentityMissing: "{path} 没有 SSH 私钥:用 `{cli} key enroll` 登记一把(它读 {path}.pub),或用 --identity FILE 指到已有私钥",
|
|
345
|
+
cloneEnrolledIdentityMissing: "`{cli} key enroll` 为 {origin} 记录的私钥在这台机器上不在 {path}:在这里重新 `{cli} key enroll`,或用 --identity FILE 指到那把钥",
|
|
346
|
+
cloneKnownHostsUnavailable: "{url} 返回 HTTP {status}:这个实例没有发布自己的 SSH 主机公钥,没有可钉的东西——用 --known-hosts FILE 指定,或设 STAMP_KNOWN_HOSTS",
|
|
347
|
+
cloneKnownHostsInvalid: "{url} 返回的不是可用的 known_hosts 行;拒绝钉它——检查实例,或用 --known-hosts FILE",
|
|
348
|
+
usageKnownHostsRefresh: "用法:known-hosts refresh [--known-hosts FILE]",
|
|
349
|
+
knownHostsRefreshed: "已在 {path} 中钉住 {pattern}\n{fingerprint}",
|
|
350
|
+
knownHostsRepoAligned: "这个仓库会读取该文件\n 注意:推送所在环境里设置的 GIT_SSH_COMMAND 会覆盖它,而本命令看不到,因此这不能为下一次推送背书",
|
|
351
|
+
knownHostsRepoUnchecked: "未能确认这个仓库是否会读取刚刚刷新的那个文件\n 已刷新:{written}\n {reason}\n这既不是失败也不是确认:请把该仓库当作未检查",
|
|
352
|
+
knownHostsUncheckedNoRepo: "不在 git 仓库内,没有仓库配置可问",
|
|
353
|
+
knownHostsUncheckedExplicitPath: "--known-hosts 显式指定了这个文件,因此没有拿任何仓库去核对它",
|
|
354
|
+
knownHostsUncheckedProbe: "无法运行该仓库的 ssh 命令,因此它实际使用的 known_hosts 未知",
|
|
355
|
+
knownHostsRepoElsewhere: "这个仓库不会读取刚刚刷新的那个文件\n 已刷新:{written}\n 本仓库实际读取:{effective}\n两者不一致时,刷新对从这里发起的推送没有任何作用;请为本仓库设置 core.sshCommand:\n git config core.sshCommand \"{sshCommand}\"",
|
|
356
|
+
knownHostsRepoUnconfigured: "这个仓库没有设置 core.sshCommand,因此不会读取刚刚刷新的那个文件\n 已刷新:{written}\n 本仓库实际读取:{effective}\n它通过 ssh 自己的配置连接,或依赖每次推送临时设置的 GIT_SSH_COMMAND——后者本命令看不到,也无法为它背书;请为本仓库设置 core.sshCommand:\n git config core.sshCommand \"{sshCommand}\"",
|
|
357
|
+
clonePublicKeyRejected: "网关拒绝了 {path} 这把钥(publickey)。如果它还没登记,先登记它的公钥:`{cli} key enroll --public-key {publicKey}`",
|
|
358
|
+
cloneIdentityPinned: "已把 Stamp 的 SSH 身份钉到 {directory}(git config core.sshCommand)",
|
|
359
|
+
cloneIdentityPinFailed: "无法把 SSH 身份写入 {directory};可手动执行:git -C {directory} config --local core.sshCommand \"{command}\"",
|
|
245
360
|
loginHumanIntro: "当前不是受管 Raft Agent。人类和 CI 使用 STAMP_TOKEN:",
|
|
246
361
|
loginHumanBrowser: " 浏览器:{url}/login (把会话 cookie 值设为 STAMP_TOKEN)",
|
|
247
362
|
loginHumanCI: " CI: 由负责人签发的窄范围部署令牌",
|
|
248
|
-
loginAgentReady: "Agent 登录就绪({service} @ {url});访问令牌有效至 {expires}",
|
|
363
|
+
loginAgentReady: "Agent 登录就绪({service} @ {url});访问令牌有效至 {expires}({remaining})",
|
|
364
|
+
loginTokenExpired: "Agent 已登录({service} @ {url}),但访问令牌已于 {expires} 过期({remaining});下一条命令会自动刷新",
|
|
249
365
|
logoutForgot: "已忘记 Agent 会话 {path}",
|
|
250
366
|
logoutNothing: "没有本地会话(人类/CI 通道使用 STAMP_TOKEN)",
|
|
251
367
|
enrolled: "已登记 {fingerprint}({keyId})",
|
|
368
|
+
enrolledIdentityRecorded: "这台机器上的 `{cli} repo clone` 会使用 {path}",
|
|
369
|
+
enrolledIdentityNotRecorded: "私钥 {path} 不在这台机器上,这里的 `{cli} repo clone` 需要 --identity FILE",
|
|
252
370
|
bound: "已绑定 {email}",
|
|
253
371
|
usageKeyEnroll: "用法:{cli} key enroll [--public-key FILE|-]",
|
|
372
|
+
usageKeyList: "用法:{cli} key list",
|
|
373
|
+
usageKeyRevoke: "用法:{cli} key revoke KEY_ID",
|
|
374
|
+
keyListEmpty: "没有已登记的公钥",
|
|
375
|
+
keyRevoked: "已撤销 {keyId}",
|
|
254
376
|
usageIdentityBind: "用法:{cli} identity bind --email ADDR",
|
|
255
377
|
usageReceiptGet: "用法:{cli} receipt get <receipt-id>",
|
|
378
|
+
usageChangelog: "用法:{cli} changelog [--limit N] [--all]",
|
|
379
|
+
changelogScopeAgent: "只显示命令行和接口的变化;--all 看全部。",
|
|
380
|
+
changelogScopeAll: "显示全部变化,包括网页端和内部改动。",
|
|
381
|
+
changelogNoneForAgents: "这个版本没有命令行或接口的变化(另有 {hidden} 项;--all 可看)",
|
|
382
|
+
changelogHiddenCount: "(隐藏了 {hidden} 项其他改动;--all 可看)",
|
|
383
|
+
changelogBuild: "网关构建 {version}({commit})",
|
|
384
|
+
changelogEmpty: "这个构建里没有版本记录。",
|
|
385
|
+
changelogNoEntries: "没有记录到 PR",
|
|
386
|
+
changelogCurrentMark: "<- 当前运行",
|
|
256
387
|
usageFollow: "用法:{cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
|
|
257
388
|
usageSubscription: "用法:{cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
|
|
258
389
|
usageWatch: "用法:{cli} {cmd} <owner/repo> --event TYPE",
|
|
@@ -262,9 +393,14 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、ST
|
|
|
262
393
|
checkToken: "{cli}: 请检查 STAMP_TOKEN",
|
|
263
394
|
notLoggedIn: "尚未登录:请运行 `{cli} login`(受管 Agent)",
|
|
264
395
|
sessionOriginMismatch: "已存会话是给 {stored} 签发的,不是 {target}——请重新运行 `{cli} login`",
|
|
396
|
+
sessionOriginMismatchSibling: "已存会话是给 {stored} 签发的,不是 {target}——{stored} 对应的是 `{other}`,请改用它,而不是 `{cli}`",
|
|
265
397
|
pair_mismatch: "拒绝不匹配的实例配对:{origin} 属于服务 {owner},而非 {service}(task #439)",
|
|
266
398
|
stampTokenMissing: "未设置 STAMP_TOKEN(会话或部署令牌);在受管 Agent 内请运行 `{cli} login`",
|
|
267
|
-
|
|
399
|
+
admissionPartial: "拒绝运行:受管 Agent 环境不完整({reason});不会回退到 STAMP_TOKEN",
|
|
400
|
+
admissionMissingVars: "拒绝运行:受管 Agent 环境不完整——{missing} 未设置,但 {present} 已设置;这不是人类/CI 环境,不会回退到 STAMP_TOKEN",
|
|
401
|
+
admissionInvalidAgentID: "拒绝运行:SLOCK_AGENT_ID={value} 不是合法的 agent id;请修好受管 Agent 环境——不会回退到 STAMP_TOKEN",
|
|
402
|
+
admissionRaftWrapper: "拒绝运行:受管 Agent 的 raft 包装脚本缺失或不可执行({path});请修好受管 Agent 环境——不会回退到 STAMP_TOKEN",
|
|
403
|
+
keyPublicKeyMissing: "{path} 没有 SSH 公钥:用 `ssh-keygen -t ed25519 -f {private}` 生成一把,或用 --public-key FILE 指定",
|
|
268
404
|
invoke_not_json: "agent-login: `raft integration invoke` 没有返回 JSON",
|
|
269
405
|
invoke_not_object: "agent-login: invoke 输出不是对象",
|
|
270
406
|
invoke_failed: "agent-login: invoke 未成功",
|
|
@@ -293,7 +429,7 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、ST
|
|
|
293
429
|
session_refresh_expired: "agent-login: 会话刷新令牌已经过期",
|
|
294
430
|
token_size_limit: "agent-login: 令牌响应超过大小限制",
|
|
295
431
|
token_deadline: "agent-login: 令牌端点超过时限",
|
|
296
|
-
invoke_exit: "agent-login: raft invoke
|
|
432
|
+
invoke_exit: "agent-login: raft invoke 失败({status}):{diagnostic}",
|
|
297
433
|
exchange_redirect: "agent-login: 授权兑换拒绝跟随重定向(HTTP {status})",
|
|
298
434
|
exchange_failed: "agent-login: 授权兑换失败(HTTP {status})",
|
|
299
435
|
exchange_not_json: "agent-login: 兑换响应不是 JSON",
|
|
@@ -317,23 +453,37 @@ export function selectLocale(env = process.env, explicit) {
|
|
|
317
453
|
// the binary the reader actually invoked — a staging user must never be told to
|
|
318
454
|
// run `stamp` (@phage: the error surface reaches users before the docs).
|
|
319
455
|
// Product names ("Stamp"), the package id and historical facts are NOT `{cli}`.
|
|
320
|
-
|
|
456
|
+
//
|
|
457
|
+
// FAIL-LOUD (@Tenny): the value starts UNSET. A silent `"stamp"` default would
|
|
458
|
+
// mean that if the entry never set the name, a staging user would quietly be
|
|
459
|
+
// shown the PRODUCTION binary — the exact defect shape this task fixes. An unset
|
|
460
|
+
// name renders as a conspicuous marker (and prefix() throws in a test), so a
|
|
461
|
+
// broken parameter chain is a VISIBLE failure, never a plausible wrong value.
|
|
462
|
+
let cliName = null;
|
|
321
463
|
|
|
322
464
|
export function setCliName(name) {
|
|
323
465
|
if (typeof name === "string" && name.length > 0) cliName = name;
|
|
324
466
|
}
|
|
325
467
|
|
|
468
|
+
/** For tests/diagnostics: the resolved entry binary, or null if never set. */
|
|
469
|
+
export function currentCliName() {
|
|
470
|
+
return cliName;
|
|
471
|
+
}
|
|
472
|
+
|
|
326
473
|
/** The `<binary>:` banner that prefixes user-facing diagnostics. It names the
|
|
327
474
|
* binary the user actually ran, so a staging user sees `stamp-staging:` and not
|
|
328
475
|
* the production name (task #444 / #439). */
|
|
329
476
|
export function prefix() {
|
|
330
|
-
|
|
477
|
+
// An unset name is a programming error: fail loudly rather than printing a
|
|
478
|
+
// plausible-but-wrong production banner on a staging entry.
|
|
479
|
+
const name = cliName ?? "<cli-unset>";
|
|
480
|
+
return `${name}: `;
|
|
331
481
|
}
|
|
332
482
|
|
|
333
483
|
export function t(locale, key, vars = {}) {
|
|
334
484
|
const table = messages[locale] || messages.en;
|
|
335
485
|
let s = table[key] || messages.en[key] || key;
|
|
336
|
-
const all = { cli: cliName, ...vars };
|
|
486
|
+
const all = { cli: cliName ?? "<cli-unset>", ...vars };
|
|
337
487
|
for (const [k, v] of Object.entries(all)) s = s.replaceAll(`{${k}}`, String(v));
|
|
338
488
|
return s;
|
|
339
489
|
}
|