@botiverse/stamp-cli 0.3.4 → 0.3.8
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 +69 -2
- package/lib/commands/changelog.mjs +58 -0
- package/lib/commands/key.mjs +38 -1
- package/lib/commands/knownhosts.mjs +150 -0
- package/lib/commands/pr.mjs +89 -4
- package/lib/commands/receipt.mjs +24 -1
- package/lib/commands/repo.mjs +16 -4
- package/lib/locale.mjs +212 -22
- package/lib/main.mjs +5 -1
- package/lib/pr/close.mjs +25 -0
- package/lib/pr/comment.mjs +8 -3
- package/lib/pr/create.mjs +2 -0
- package/lib/pr/edit.mjs +53 -0
- package/lib/pr/queue.mjs +32 -0
- package/lib/pr/read.mjs +27 -2
- package/lib/pr/review.mjs +88 -0
- package/lib/pr/verdict.mjs +46 -0
- package/lib/pr/write.mjs +97 -3
- package/lib/receipt/list.mjs +54 -0
- package/lib/repo/identities.mjs +43 -0
- package/lib/repo/ssh.mjs +136 -5
- package/package.json +1 -1
package/lib/locale.mjs
CHANGED
|
@@ -1,24 +1,58 @@
|
|
|
1
1
|
/** User-visible copy. Machine protocol fields and stable error codes stay English. */
|
|
2
2
|
export const messages = {
|
|
3
3
|
en: {
|
|
4
|
+
usagePrQueue: "usage: {cli} pr queue <enqueue|status|withdraw> <NUMBER -R OWNER/REPO|PR_URL> --request-id ID [--head SHA --base SHA (enqueue only)]; ID: 16–128 letters/digits/underscore/hyphen, first alphanumeric; choose it before sending and retain it",
|
|
5
|
+
prQueueOutcomeUnknown: "Queue outcome is unknown. Read pr queue status with the same PR and --request-id before another write; do not generate a new ID or automatically resend.",
|
|
6
|
+
prQueueReceipt: "Queue {repository}#{number}, request {id}: {state}; reason: {reason}; landing: {landing}; terminal notification queued: {queued} (not delivery confirmation)",
|
|
4
7
|
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
|
-
|
|
7
|
-
|
|
8
|
+
usagePrRead: "usage: {cli} pr <list|view|review|diff|checks|comment|edit|approve|unapprove|merge|queue> [arguments]",
|
|
9
|
+
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",
|
|
10
|
+
prReviewExactHead: "Exact head",
|
|
11
|
+
prReviewBase: "Base",
|
|
12
|
+
prReviewMergeBase: "Merge-base",
|
|
13
|
+
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",
|
|
14
|
+
prReviewCommands: "Local review (after cloning through Stamp)",
|
|
15
|
+
prReviewVerdict: "Verdict to post",
|
|
16
|
+
usagePrApprove: "usage: {cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT] (human: GitHub review; agent: recorded by Stamp, no --body)",
|
|
17
|
+
usagePrUnapprove: "usage: {cli} pr unapprove <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA (agent: withdraws your Stamp-recorded approval of that head)",
|
|
18
|
+
usagePrMerge: "usage: {cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase] (human: as your GitHub identity; agent: as the Stamp App, once someone other than the author approved that exact head)\n {cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --auto --head SHA --base SHA [--method ...] | --auto --cancel --head SHA --base SHA | --auto --status (author agent: let Stamp merge once someone else approves that head and the verdict is READY)",
|
|
8
19
|
prApproved: "Approved {repository}#{number} as {actor}",
|
|
20
|
+
prApprovedByStamp: "Approved {repository}#{number} at {head} as {actor} (recorded by Stamp)",
|
|
21
|
+
prUnapproved: "Withdrew approval of {repository}#{number} at {head} as {actor} (recorded by Stamp)",
|
|
9
22
|
prMerged: "Merged {repository}#{number} as {actor} ({sha})",
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
prMergedByApp: "Merged {repository}#{number} at {head} as the Stamp App for {actor} ({sha})",
|
|
24
|
+
prAutoMerge_ARMED: "{repository}#{number} will be merged by Stamp ({method}) at head {head} once someone other than the author approves it and the verdict is READY",
|
|
25
|
+
prAutoMerge_VOID: "{repository}#{number}: the auto-merge registration was for head {head}, which the PR no longer has; register again for the current head",
|
|
26
|
+
prAutoMerge_CANCELLED: "{repository}#{number}: auto-merge withdrawn",
|
|
27
|
+
prAutoMerge_NONE: "{repository}#{number}: not registered for auto-merge",
|
|
28
|
+
prAutoMerge_CLOSED: "{repository}#{number} is closed or merged; the auto-merge registration has nothing left to do",
|
|
29
|
+
prAutoMerge_EXPIRED: "{repository}#{number}: the auto-merge registration expired (registered more than 14 days ago); register again",
|
|
30
|
+
prAutoMergeUnchanged: "(nothing changed)",
|
|
31
|
+
prApproveRejected: "Approve was rejected. Check your session, repository access, and --head/--base (a human also needs a GitHub binding; an agent cannot approve a PR it opened).",
|
|
32
|
+
prMergeRejected: "Merge was rejected. Check your session, repository access, --head/--base, the approval (an agent merge needs an approval of that exact head from someone other than the author), and mergeability (a human also needs a GitHub binding).",
|
|
12
33
|
prApproveOutcomeUnknown: "Approve outcome is unknown. Re-read the PR reviews before sending again; do not automatically resend.",
|
|
34
|
+
prUnapproveRejected: "Unapprove was rejected. Check your agent session, repository access, and --head/--base.",
|
|
35
|
+
prUnapproveOutcomeUnknown: "Unapprove outcome is unknown. Retry the same command; it is idempotent.",
|
|
13
36
|
prMergeOutcomeUnknown: "Merge outcome is unknown. Re-read the PR before sending again; do not automatically resend.",
|
|
14
|
-
apiHumanPrincipal: "
|
|
37
|
+
apiHumanPrincipal: "This action needs a human STAMP_TOKEN session.",
|
|
15
38
|
apiWriteCoords: "Re-read the PR and retry with both --head and --base.",
|
|
16
39
|
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
|
|
40
|
+
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)",
|
|
41
|
+
prCommentExpectedHeadInvalid: "--expected-head must be the full 40-character commit SHA you reviewed.",
|
|
18
42
|
prCommentBodyInvalid: "Comment must be nonempty and at most 64 KiB of UTF-8 text.",
|
|
19
43
|
prCommentCreated: "Comment posted as {actor}: {url}",
|
|
20
|
-
prCommentRejected: "Comment request was rejected. Check your
|
|
44
|
+
prCommentRejected: "Comment request was rejected. Check your session, GitHub binding (humans), repository access and input.",
|
|
21
45
|
prCommentOutcomeUnknown: "Comment outcome is unknown. Check the PR comments before sending again; do not automatically resend.",
|
|
46
|
+
usagePrEdit: "usage: {cli} pr edit <NUMBER -R OWNER/REPO|PR_URL> [--title TITLE] [--body TEXT|--body-file FILE|-] (only the agent recorded on Stamp's creation receipt may edit; provide title, body, or both)",
|
|
47
|
+
usagePrClose: "usage: {cli} pr close <NUMBER -R OWNER/REPO|PR_URL> (only the agent recorded on Stamp's creation receipt may close)",
|
|
48
|
+
prClosed: "Closed {repository}#{number}: {url}",
|
|
49
|
+
prCloseRejected: "PR close was rejected. Confirm this agent created the PR through Stamp and still has repository access.",
|
|
50
|
+
prCloseOutcomeUnknown: "PR close outcome is unknown. Re-read the PR before deciding whether to send the close again; do not automatically resend.",
|
|
51
|
+
prEditTitleInvalid: "PR title must be nonempty and at most 256 bytes of UTF-8 text.",
|
|
52
|
+
prEditBodyInvalid: "PR description must be nonempty and at most 64 KiB of UTF-8 text.",
|
|
53
|
+
prEdited: "Updated {repository}#{number}: {url}",
|
|
54
|
+
prEditRejected: "PR edit was rejected. Confirm this agent created the PR through Stamp and still has repository access.",
|
|
55
|
+
prEditOutcomeUnknown: "PR edit outcome is unknown. Re-read the PR before deciding whether to send the edit again; do not automatically resend.",
|
|
22
56
|
usagePrList: "usage: {cli} pr list",
|
|
23
57
|
usagePrView: "usage: {cli} pr view <number|URL> [--repo OWNER/REPO]",
|
|
24
58
|
usagePrDiff: "usage: {cli} pr diff <number|URL> [--repo OWNER/REPO] [--name-only]",
|
|
@@ -35,6 +69,26 @@ export const messages = {
|
|
|
35
69
|
prDiffUnavailable: "patch unavailable",
|
|
36
70
|
prDiffEmpty: "No changed files reported.",
|
|
37
71
|
prChecksEmpty: "No checks reported.",
|
|
72
|
+
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.",
|
|
73
|
+
prCIUnreadable: "unreadable",
|
|
74
|
+
prVerdictCIUnreadable: "CI unreadable — not evidence of green",
|
|
75
|
+
prVerdictLabel: "Stamp verdict",
|
|
76
|
+
verdict_READY: "can land now",
|
|
77
|
+
verdict_MERGED: "already merged",
|
|
78
|
+
verdict_CLOSED: "closed",
|
|
79
|
+
verdict_DRAFT: "draft",
|
|
80
|
+
verdict_CONFLICT: "conflicts with the base",
|
|
81
|
+
verdict_CI_UNREADABLE: "CI cannot be read — not evidence of green",
|
|
82
|
+
verdict_CI_FAILING: "a required check failed",
|
|
83
|
+
verdict_CI_NOT_EXECUTED: "a required check did not run",
|
|
84
|
+
verdict_CI_PENDING: "required checks still running",
|
|
85
|
+
verdict_REVIEW_UNREADABLE: "the approval state cannot be read",
|
|
86
|
+
verdict_CHANGES_REQUESTED: "changes requested",
|
|
87
|
+
verdict_STALE_REVIEW: "approvals are for another head or base",
|
|
88
|
+
verdict_NEEDS_REVIEW: "needs a non-author approval at this head",
|
|
89
|
+
verdict_BEHIND: "behind the base",
|
|
90
|
+
verdict_BLOCKED: "GitHub blocks the merge for a reason Stamp cannot see",
|
|
91
|
+
verdict_UNCONFIRMED: "GitHub does not confirm a clean merge (a check is not passing, or it is still computing)",
|
|
38
92
|
prReadNotFound: "Check the repository and PR number, and confirm this Agent created the PR through Stamp.",
|
|
39
93
|
prReadHeadMoved: "The PR head changed while Stamp read the diff; rerun the command and review the new head.",
|
|
40
94
|
prReadDiffIncomplete: "GitHub did not return the complete PR diff; retry later instead of relying on partial files.",
|
|
@@ -63,6 +117,7 @@ export const messages = {
|
|
|
63
117
|
prWaitPublished: "Check {cli} receipt get <id>; use your own receipt after its status becomes PUBLISHED.",
|
|
64
118
|
prCheckReceipt: "Read the receipt again and check --repo, --head and --sha against the exact published commit.",
|
|
65
119
|
prCheckAccess: "Check repository access and the authorized base branch with the repository administrator.",
|
|
120
|
+
prCheckBase: "The base branch does not exist on GitHub. Pass --base as an existing branch of the repository.",
|
|
66
121
|
prCheckExisting: "Check the existing PR and keep the same receipt, title, body and idempotency key when retrying.",
|
|
67
122
|
prRetry: "Check the receipt and service status, then retry the identical command; its idempotency key stays unchanged.",
|
|
68
123
|
apiBindIdentity: "Bind this agent first with `{cli} identity bind --email <agent-email>`, then retry the command.",
|
|
@@ -77,16 +132,26 @@ export const messages = {
|
|
|
77
132
|
{cli} whoami who the gateway thinks you are
|
|
78
133
|
{cli} migration-help old manifest actions → CLI mapping
|
|
79
134
|
{cli} key enroll [--public-key FILE|-] bind this agent's SSH public key (default ~/.ssh/id_ed25519.pub)
|
|
135
|
+
{cli} key list list this agent's enrolled SSH keys
|
|
136
|
+
{cli} key revoke KEY_ID revoke one of this agent's enrolled keys
|
|
137
|
+
{cli} known-hosts refresh re-pin this instance's SSH host key from /.well-known
|
|
80
138
|
{cli} identity bind --email ADDR bind commit-author email (DCO)
|
|
81
139
|
{cli} receipt get <id> gateway acceptance + GitHub publication status
|
|
140
|
+
{cli} receipt list [--repo OWNER/REPO] [--limit N] [--cursor CURSOR]
|
|
141
|
+
list your own push receipts (newest first)
|
|
142
|
+
{cli} changelog [--limit N] [--all] release history: CLI/API changes per version (--all: everything)
|
|
82
143
|
{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
144
|
{cli} pr list
|
|
84
145
|
{cli} pr view <number|URL> --repo OWNER/REPO
|
|
85
146
|
{cli} pr diff <number|URL> --repo OWNER/REPO [--name-only]
|
|
86
147
|
{cli} pr checks <number|URL> --repo OWNER/REPO
|
|
87
|
-
{cli} pr comment <number|URL> --repo OWNER/REPO --body-file FILE|- (human)
|
|
88
|
-
{cli} pr
|
|
89
|
-
{cli} pr
|
|
148
|
+
{cli} pr comment <number|URL> --repo OWNER/REPO --body-file FILE|- (human; agent posts as the Stamp App)
|
|
149
|
+
{cli} pr edit <number|URL> --repo OWNER/REPO [--title TITLE] [--body-file FILE|-] (creating agent only)
|
|
150
|
+
{cli} pr approve <number|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (human; agent without --body)
|
|
151
|
+
{cli} pr unapprove <number|URL> --repo OWNER/REPO --head SHA --base SHA (agent)
|
|
152
|
+
{cli} pr merge <number|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (human; agent once approved by another)
|
|
153
|
+
{cli} pr merge <number|URL> --repo OWNER/REPO --auto --head SHA --base SHA (author agent: merge once someone else approves)
|
|
154
|
+
{cli} pr queue enqueue|status|withdraw <number|URL> --repo OWNER/REPO --request-id ID [--head SHA --base SHA] (agent; coordinates required for enqueue)
|
|
90
155
|
{cli} repo clone <repository> [<directory>] [-- <gitflags>...]
|
|
91
156
|
|
|
92
157
|
{cli} follow <owner/repo> --kind issue|pull --number N
|
|
@@ -102,12 +167,23 @@ export const messages = {
|
|
|
102
167
|
flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance), STAMP_SERVICE, STAMP_LANG`,
|
|
103
168
|
usageRepoClone: "usage: {cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
|
|
104
169
|
cloned: "Cloned {repository} from {url}",
|
|
170
|
+
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):",
|
|
105
171
|
cloneFailed: "clone of {repository} via the Stamp gateway failed",
|
|
106
172
|
networkUnreachable: "could not reach {base} ({cause}); check the instance address (STAMP_URL) and your network, then retry",
|
|
107
173
|
networkHostUnresolved: "{base} does not resolve ({cause}); check the instance address (STAMP_URL) and DNS, then retry",
|
|
108
174
|
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",
|
|
175
|
+
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",
|
|
109
176
|
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
177
|
cloneKnownHostsInvalid: "{url} did not return a usable known_hosts line; refusing to pin it — check the instance, or pass --known-hosts FILE",
|
|
178
|
+
usageKnownHostsRefresh: "usage: known-hosts refresh [--known-hosts FILE]",
|
|
179
|
+
knownHostsRefreshed: "pinned {pattern} in {path}\n{fingerprint}",
|
|
180
|
+
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",
|
|
181
|
+
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",
|
|
182
|
+
knownHostsUncheckedNoRepo: "not inside a git repository, so there is no repository configuration to ask",
|
|
183
|
+
knownHostsUncheckedExplicitPath: "--known-hosts named this file explicitly, so no repository was checked against it",
|
|
184
|
+
knownHostsUncheckedProbe: "the repository's ssh command could not be run, so its effective known_hosts is unknown",
|
|
185
|
+
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}\"",
|
|
186
|
+
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}\"",
|
|
111
187
|
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
188
|
cloneIdentityPinned: "pinned the Stamp SSH identity for {directory} (git config core.sshCommand)",
|
|
113
189
|
cloneIdentityPinFailed: "could not write the SSH identity into {directory}; run it yourself: git -C {directory} config --local core.sshCommand \"{command}\"",
|
|
@@ -119,10 +195,29 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
119
195
|
logoutForgot: "forgot agent session {path}",
|
|
120
196
|
logoutNothing: "nothing stored (human/CI lane uses STAMP_TOKEN)",
|
|
121
197
|
enrolled: "enrolled {fingerprint} ({keyId})",
|
|
198
|
+
enrolledIdentityRecorded: "`{cli} repo clone` on this machine will use {path}",
|
|
199
|
+
enrolledIdentityNotRecorded: "the private key {path} is not on this machine, so `{cli} repo clone` here will need --identity FILE",
|
|
122
200
|
bound: "bound {email}",
|
|
123
201
|
usageKeyEnroll: "usage: {cli} key enroll [--public-key FILE|-]",
|
|
202
|
+
usageKeyList: "usage: {cli} key list",
|
|
203
|
+
usageKeyRevoke: "usage: {cli} key revoke KEY_ID",
|
|
204
|
+
keyListEmpty: "no enrolled keys",
|
|
205
|
+
keyRevoked: "revoked {keyId}",
|
|
124
206
|
usageIdentityBind: "usage: {cli} identity bind --email ADDR",
|
|
125
207
|
usageReceiptGet: "usage: {cli} receipt get <receipt-id>",
|
|
208
|
+
usageReceiptList: "usage: {cli} receipt list [--repo OWNER/REPO] [--limit N] [--cursor CURSOR]",
|
|
209
|
+
receiptListEmpty: "no receipts",
|
|
210
|
+
receiptListMore: "More receipts; rerun with --limit and --cursor {cursor}.",
|
|
211
|
+
receiptListBadResponse: "Unexpected receipt list response; check {cli} and gateway versions, then retry.",
|
|
212
|
+
usageChangelog: "usage: {cli} changelog [--limit N] [--all]",
|
|
213
|
+
changelogScopeAgent: "Showing CLI and API changes; --all shows everything.",
|
|
214
|
+
changelogScopeAll: "Showing every change, including the web app and internal work.",
|
|
215
|
+
changelogNoneForAgents: "no CLI or API changes in this release ({hidden} other; --all shows them)",
|
|
216
|
+
changelogHiddenCount: "({hidden} other change(s) hidden; --all shows them)",
|
|
217
|
+
changelogBuild: "Gateway build {version} ({commit})",
|
|
218
|
+
changelogEmpty: "No releases recorded in this build.",
|
|
219
|
+
changelogNoEntries: "no pull requests recorded",
|
|
220
|
+
changelogCurrentMark: "<- running",
|
|
126
221
|
usageFollow: "usage: {cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
|
|
127
222
|
usageSubscription: "usage: {cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
|
|
128
223
|
usageWatch: "usage: {cli} {cmd} <owner/repo> --event TYPE",
|
|
@@ -180,24 +275,58 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
180
275
|
refresh_wait_timeout: "agent-login: timed out waiting for a concurrent token refresh",
|
|
181
276
|
},
|
|
182
277
|
"zh-CN": {
|
|
278
|
+
usagePrQueue: "用法:{cli} pr queue <enqueue|status|withdraw> <NUMBER -R OWNER/REPO|PR_URL> --request-id ID [--head SHA --base SHA(仅 enqueue)];ID 为 16–128 位字母、数字、下划线或连字符,首位为字母或数字;发送前选定并保留",
|
|
279
|
+
prQueueOutcomeUnknown: "队列操作结果未知。再次写入前,用同一 PR 和 --request-id 执行 pr queue status;不要生成新 ID 或自动重发。",
|
|
280
|
+
prQueueReceipt: "队列 {repository}#{number},请求 {id}:{state};原因:{reason};落地:{landing};终态通知已入队:{queued}(不代表送达)",
|
|
183
281
|
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
|
-
|
|
186
|
-
|
|
282
|
+
usagePrRead: "用法:{cli} pr <list|view|review|diff|checks|comment|edit|approve|unapprove|merge|queue> [参数]",
|
|
283
|
+
usagePrReview: "用法:{cli} pr review <编号|URL> [--repo OWNER/REPO] —— 要钉的 exact head、base、merge-base、检查,以及对 merge-base 做 diff/patch-id 的命令",
|
|
284
|
+
prReviewExactHead: "Exact head",
|
|
285
|
+
prReviewBase: "Base",
|
|
286
|
+
prReviewMergeBase: "Merge-base",
|
|
287
|
+
prReviewMergeBaseRule: "log/stat/diff/patch-id 一律对 merge-base,不要对当前 base:base 分支可能在分叉后已前进,那些提交会被当成这张 PR 的",
|
|
288
|
+
prReviewCommands: "本地复核(经 Stamp clone 之后)",
|
|
289
|
+
prReviewVerdict: "要贴的判词",
|
|
290
|
+
usagePrApprove: "用法:{cli} pr approve <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--body TEXT](人类:GitHub review;Agent:由 Stamp 记录,不带 --body)",
|
|
291
|
+
usagePrUnapprove: "用法:{cli} pr unapprove <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA(Agent:撤回你在该 head 上由 Stamp 记录的批准)",
|
|
292
|
+
usagePrMerge: "用法:{cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --head SHA --base SHA [--method merge|squash|rebase](人类:以本人 GitHub 身份;agent:以 Stamp App 身份,前提是作者以外的人已批准该 exact head)\n {cli} pr merge <NUMBER -R OWNER/REPO|PR_URL> --auto --head SHA --base SHA [--method ...] | --auto --cancel --head SHA --base SHA | --auto --status (作者 agent:别人批准该 head 且判定为 READY 后由 Stamp 自动合入)",
|
|
187
293
|
prApproved: "已以 {actor} 身份批准 {repository}#{number}",
|
|
294
|
+
prApprovedByStamp: "已以 {actor} 身份批准 {repository}#{number} 的 {head}(由 Stamp 记录)",
|
|
295
|
+
prUnapproved: "已以 {actor} 身份撤回对 {repository}#{number} 的 {head} 的批准(由 Stamp 记录)",
|
|
188
296
|
prMerged: "已以 {actor} 身份合并 {repository}#{number}({sha})",
|
|
189
|
-
|
|
190
|
-
|
|
297
|
+
prMergedByApp: "已代 {actor} 以 Stamp App 身份合并 {repository}#{number},head {head}({sha})",
|
|
298
|
+
prAutoMerge_ARMED: "{repository}#{number} 已登记:一旦作者以外的人批准 head {head} 且判定为 READY,Stamp 就以 {method} 方式合入",
|
|
299
|
+
prAutoMerge_VOID: "{repository}#{number}:自动合入登记针对的是 head {head},PR 已经不在这个 head 上了;请对当前 head 重新登记",
|
|
300
|
+
prAutoMerge_CANCELLED: "{repository}#{number}:自动合入已撤销",
|
|
301
|
+
prAutoMerge_NONE: "{repository}#{number}:没有登记自动合入",
|
|
302
|
+
prAutoMerge_CLOSED: "{repository}#{number} 已关闭或已合入,自动合入登记无事可做",
|
|
303
|
+
prAutoMerge_EXPIRED: "{repository}#{number}:自动合入登记已过期(超过 14 天),请重新登记",
|
|
304
|
+
prAutoMergeUnchanged: "(没有变化)",
|
|
305
|
+
prApproveRejected: "批准被拒绝。请检查会话、仓库权限,以及 --head/--base(人类还需要绑定 GitHub;Agent 不能批准自己开的 PR)。",
|
|
306
|
+
prMergeRejected: "合并被拒绝。请检查会话、仓库权限、--head/--base、批准(agent 合并需要作者以外的人批准该 exact head)和可合并性(人类还需要 GitHub 绑定)。",
|
|
191
307
|
prApproveOutcomeUnknown: "批准结果不明。请先重读 PR 的 reviews,不要自动重发。",
|
|
308
|
+
prUnapproveRejected: "撤回批准被拒绝。请检查 Agent 会话、仓库权限,以及 --head/--base。",
|
|
309
|
+
prUnapproveOutcomeUnknown: "撤回批准结果不明。可以原样重试,该操作是幂等的。",
|
|
192
310
|
prMergeOutcomeUnknown: "合并结果不明。请先重读 PR,不要自动重发。",
|
|
193
|
-
apiHumanPrincipal: "
|
|
311
|
+
apiHumanPrincipal: "此操作需要人类 STAMP_TOKEN 会话。",
|
|
194
312
|
apiWriteCoords: "请重读 PR,带上当前的 --head 和 --base 再试。",
|
|
195
313
|
apiGitHubBinding: "请先在 Stamp 设置里绑定 GitHub,再重试。",
|
|
196
|
-
usagePrComment: "用法:{cli} pr comment <NUMBER -R OWNER/REPO|PR_URL> (--body TEXT|--body-file FILE|-)
|
|
314
|
+
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 变了就拒绝发表)",
|
|
315
|
+
prCommentExpectedHeadInvalid: "--expected-head 必须是你复核过的完整 40 位 commit SHA。",
|
|
197
316
|
prCommentBodyInvalid: "评论不能为空,UTF-8 文本最多 64 KiB。",
|
|
198
317
|
prCommentCreated: "已以 {actor} 身份发表评论:{url}",
|
|
199
|
-
prCommentRejected: "
|
|
318
|
+
prCommentRejected: "评论请求被拒绝,请检查会话、GitHub 绑定(人类)、仓库权限和输入。",
|
|
200
319
|
prCommentOutcomeUnknown: "评论结果不明。请先查看 PR 评论,不要自动重发。",
|
|
320
|
+
usagePrEdit: "用法:{cli} pr edit <NUMBER -R OWNER/REPO|PR_URL> [--title TITLE] [--body TEXT|--body-file FILE|-](仅 Stamp 创建回执记录的 Agent 可改;标题、描述至少提供一项)",
|
|
321
|
+
usagePrClose: "用法:{cli} pr close <NUMBER -R OWNER/REPO|PR_URL>(仅 Stamp 创建回执记录的 Agent 可关闭)",
|
|
322
|
+
prClosed: "已关闭 {repository}#{number}:{url}",
|
|
323
|
+
prCloseRejected: "PR 关闭被拒绝。请确认该 PR 由此 Agent 经 Stamp 创建,且此 Agent 仍有仓库权限。",
|
|
324
|
+
prCloseOutcomeUnknown: "PR 关闭结果不明。请先重读 PR,再决定是否重发;不要自动重试。",
|
|
325
|
+
prEditTitleInvalid: "PR 标题不能为空,UTF-8 文本最多 256 字节。",
|
|
326
|
+
prEditBodyInvalid: "PR 描述不能为空,UTF-8 文本最多 64 KiB。",
|
|
327
|
+
prEdited: "已更新 {repository}#{number}:{url}",
|
|
328
|
+
prEditRejected: "PR 编辑被拒绝。请确认该 PR 由此 Agent 经 Stamp 创建,且此 Agent 仍有仓库权限。",
|
|
329
|
+
prEditOutcomeUnknown: "PR 编辑结果不明。请先重读 PR,再决定是否重发;不要自动重试。",
|
|
201
330
|
usagePrList: "用法:{cli} pr list",
|
|
202
331
|
usagePrView: "用法:{cli} pr view <编号|URL> [--repo OWNER/REPO]",
|
|
203
332
|
usagePrDiff: "用法:{cli} pr diff <编号|URL> [--repo OWNER/REPO] [--name-only]",
|
|
@@ -214,6 +343,26 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
214
343
|
prDiffUnavailable: "patch 不可用",
|
|
215
344
|
prDiffEmpty: "没有变更文件。",
|
|
216
345
|
prChecksEmpty: "没有检查记录。",
|
|
346
|
+
prChecksUnreadable: "无法读取这个 PR 的检查结果,所以这不是\"没有检查\"——网关被 GitHub 拒绝了(通常是 App 缺少 Checks 权限)。请把 CI 当作未知。",
|
|
347
|
+
prCIUnreadable: "无法读取",
|
|
348
|
+
prVerdictCIUnreadable: "CI 无法读取——不能当作已通过",
|
|
349
|
+
prVerdictLabel: "Stamp 判定",
|
|
350
|
+
verdict_READY: "现在可以合入",
|
|
351
|
+
verdict_MERGED: "已合入",
|
|
352
|
+
verdict_CLOSED: "已关闭",
|
|
353
|
+
verdict_DRAFT: "草稿",
|
|
354
|
+
verdict_CONFLICT: "与 base 有冲突",
|
|
355
|
+
verdict_CI_UNREADABLE: "CI 无法读取——不能当作已通过",
|
|
356
|
+
verdict_CI_FAILING: "有 required 检查失败",
|
|
357
|
+
verdict_CI_NOT_EXECUTED: "有 required 检查没有运行",
|
|
358
|
+
verdict_CI_PENDING: "required 检查仍在运行",
|
|
359
|
+
verdict_REVIEW_UNREADABLE: "批准状态无法读取",
|
|
360
|
+
verdict_CHANGES_REQUESTED: "有人要求修改",
|
|
361
|
+
verdict_STALE_REVIEW: "现有批准针对的是别的 head 或 base",
|
|
362
|
+
verdict_NEEDS_REVIEW: "需要非作者在这个 head 上批准",
|
|
363
|
+
verdict_BEHIND: "落后于 base",
|
|
364
|
+
verdict_BLOCKED: "GitHub 阻止合入,原因 Stamp 看不到",
|
|
365
|
+
verdict_UNCONFIRMED: "GitHub 没有确认可以干净合入(有检查未通过,或还在计算)",
|
|
217
366
|
prReadNotFound: "请检查仓库和 PR 编号,并确认该 PR 是此 Agent 通过 Stamp 创建的。",
|
|
218
367
|
prReadHeadMoved: "Stamp 读取 diff 时 PR head 已变化;请重新运行命令并审阅新的 head。",
|
|
219
368
|
prReadDiffIncomplete: "GitHub 未返回完整的 PR diff;请稍后重试,不要依赖部分文件。",
|
|
@@ -242,6 +391,7 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
242
391
|
prWaitPublished: "请用 {cli} receipt get <id> 检查;只使用自己状态为 PUBLISHED 的 receipt。",
|
|
243
392
|
prCheckReceipt: "请重新读取 receipt,并核对 --repo、--head 和 --sha 是否与已发表提交一致。",
|
|
244
393
|
prCheckAccess: "请与仓库管理员核对仓库权限和允许的目标分支。",
|
|
394
|
+
prCheckBase: "目标分支在 GitHub 上不存在;请用 --base 指定仓库里已存在的分支。",
|
|
245
395
|
prCheckExisting: "请检查已有 PR;重试时保持 receipt、标题、正文和幂等键不变。",
|
|
246
396
|
prRetry: "请检查 receipt 和服务状态,再原样重试命令;幂等键会保持不变。",
|
|
247
397
|
apiBindIdentity: "请先运行 `{cli} identity bind --email <agent-email>` 绑定此 Agent,再重试命令。",
|
|
@@ -256,16 +406,26 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
256
406
|
{cli} whoami 网关认为你是谁
|
|
257
407
|
{cli} migration-help 旧 manifest action → CLI 对照
|
|
258
408
|
{cli} key enroll [--public-key FILE|-] 绑定此 Agent 的 SSH 公钥(默认 ~/.ssh/id_ed25519.pub)
|
|
409
|
+
{cli} key list 列出此 Agent 已登记的 SSH 公钥
|
|
410
|
+
{cli} key revoke KEY_ID 撤销此 Agent 的一把已登记公钥
|
|
411
|
+
{cli} known-hosts refresh 从 /.well-known 重新钉住本实例的 SSH 主机公钥
|
|
259
412
|
{cli} identity bind --email ADDR 绑定提交作者邮箱(DCO)
|
|
260
413
|
{cli} receipt get <id> 网关接受与 GitHub 发表状态
|
|
414
|
+
{cli} receipt list [--repo OWNER/REPO] [--limit N] [--cursor CURSOR]
|
|
415
|
+
列出你自己的推送回执(新的在前)
|
|
416
|
+
{cli} changelog [--limit N] [--all] 更新日志:每个版本的命令行/接口变化(--all 看全部)
|
|
261
417
|
{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
418
|
{cli} pr list
|
|
263
419
|
{cli} pr view <编号|URL> --repo OWNER/REPO
|
|
264
420
|
{cli} pr diff <编号|URL> --repo OWNER/REPO [--name-only]
|
|
265
421
|
{cli} pr checks <编号|URL> --repo OWNER/REPO
|
|
266
|
-
{cli} pr comment <编号|URL> --repo OWNER/REPO --body-file FILE|-
|
|
267
|
-
{cli} pr
|
|
268
|
-
{cli} pr
|
|
422
|
+
{cli} pr comment <编号|URL> --repo OWNER/REPO --body-file FILE|- (人类用本人 GitHub 身份;agent 以 Stamp App 身份)
|
|
423
|
+
{cli} pr edit <编号|URL> --repo OWNER/REPO [--title 标题] [--body-file 文件|-] (仅创建它的 Agent)
|
|
424
|
+
{cli} pr approve <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--body TEXT] (本人 GitHub 身份;Agent 不带 --body)
|
|
425
|
+
{cli} pr unapprove <编号|URL> --repo OWNER/REPO --head SHA --base SHA (Agent)
|
|
426
|
+
{cli} pr merge <编号|URL> --repo OWNER/REPO --head SHA --base SHA [--method squash] (本人 GitHub 身份;agent 需他人批准)
|
|
427
|
+
{cli} pr merge <编号|URL> --repo OWNER/REPO --auto --head SHA --base SHA (作者 agent:他人批准后自动合入)
|
|
428
|
+
{cli} pr queue enqueue|status|withdraw <编号|URL> --repo OWNER/REPO --request-id ID [--head SHA --base SHA] (agent;入队需 head/base)
|
|
269
429
|
{cli} repo clone <repository> [<directory>] [-- <gitflags>...]
|
|
270
430
|
|
|
271
431
|
{cli} follow <owner/repo> --kind issue|pull --number N
|
|
@@ -281,12 +441,23 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN (human/CI), STAMP_URL (instance
|
|
|
281
441
|
flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、STAMP_SERVICE、STAMP_LANG`,
|
|
282
442
|
usageRepoClone: "用法:{cli} repo clone <repository> [<directory>] [--identity FILE] [--known-hosts FILE] [-- <gitflags>...]",
|
|
283
443
|
cloned: "已从 {url} 克隆 {repository}",
|
|
444
|
+
cloneCommitTrailers: "推到这里的每个 commit 末尾都要带这两行 trailer(连成一块放在最末尾,中间不要空行;GitHub 只认最后一个连续块):",
|
|
284
445
|
cloneFailed: "经 Stamp 网关克隆 {repository} 失败",
|
|
285
446
|
networkUnreachable: "无法连接 {base}({cause});检查实例地址(STAMP_URL)和网络后重试",
|
|
286
447
|
networkHostUnresolved: "{base} 解析不了({cause});检查实例地址(STAMP_URL)和 DNS 后重试",
|
|
287
448
|
cloneIdentityMissing: "{path} 没有 SSH 私钥:用 `{cli} key enroll` 登记一把(它读 {path}.pub),或用 --identity FILE 指到已有私钥",
|
|
449
|
+
cloneEnrolledIdentityMissing: "`{cli} key enroll` 为 {origin} 记录的私钥在这台机器上不在 {path}:在这里重新 `{cli} key enroll`,或用 --identity FILE 指到那把钥",
|
|
288
450
|
cloneKnownHostsUnavailable: "{url} 返回 HTTP {status}:这个实例没有发布自己的 SSH 主机公钥,没有可钉的东西——用 --known-hosts FILE 指定,或设 STAMP_KNOWN_HOSTS",
|
|
289
451
|
cloneKnownHostsInvalid: "{url} 返回的不是可用的 known_hosts 行;拒绝钉它——检查实例,或用 --known-hosts FILE",
|
|
452
|
+
usageKnownHostsRefresh: "用法:known-hosts refresh [--known-hosts FILE]",
|
|
453
|
+
knownHostsRefreshed: "已在 {path} 中钉住 {pattern}\n{fingerprint}",
|
|
454
|
+
knownHostsRepoAligned: "这个仓库会读取该文件\n 注意:推送所在环境里设置的 GIT_SSH_COMMAND 会覆盖它,而本命令看不到,因此这不能为下一次推送背书",
|
|
455
|
+
knownHostsRepoUnchecked: "未能确认这个仓库是否会读取刚刚刷新的那个文件\n 已刷新:{written}\n {reason}\n这既不是失败也不是确认:请把该仓库当作未检查",
|
|
456
|
+
knownHostsUncheckedNoRepo: "不在 git 仓库内,没有仓库配置可问",
|
|
457
|
+
knownHostsUncheckedExplicitPath: "--known-hosts 显式指定了这个文件,因此没有拿任何仓库去核对它",
|
|
458
|
+
knownHostsUncheckedProbe: "无法运行该仓库的 ssh 命令,因此它实际使用的 known_hosts 未知",
|
|
459
|
+
knownHostsRepoElsewhere: "这个仓库不会读取刚刚刷新的那个文件\n 已刷新:{written}\n 本仓库实际读取:{effective}\n两者不一致时,刷新对从这里发起的推送没有任何作用;请为本仓库设置 core.sshCommand:\n git config core.sshCommand \"{sshCommand}\"",
|
|
460
|
+
knownHostsRepoUnconfigured: "这个仓库没有设置 core.sshCommand,因此不会读取刚刚刷新的那个文件\n 已刷新:{written}\n 本仓库实际读取:{effective}\n它通过 ssh 自己的配置连接,或依赖每次推送临时设置的 GIT_SSH_COMMAND——后者本命令看不到,也无法为它背书;请为本仓库设置 core.sshCommand:\n git config core.sshCommand \"{sshCommand}\"",
|
|
290
461
|
clonePublicKeyRejected: "网关拒绝了 {path} 这把钥(publickey)。如果它还没登记,先登记它的公钥:`{cli} key enroll --public-key {publicKey}`",
|
|
291
462
|
cloneIdentityPinned: "已把 Stamp 的 SSH 身份钉到 {directory}(git config core.sshCommand)",
|
|
292
463
|
cloneIdentityPinFailed: "无法把 SSH 身份写入 {directory};可手动执行:git -C {directory} config --local core.sshCommand \"{command}\"",
|
|
@@ -298,10 +469,29 @@ flags: --json --lang en|zh-CN env: STAMP_TOKEN(人类/CI)、STAMP_URL、ST
|
|
|
298
469
|
logoutForgot: "已忘记 Agent 会话 {path}",
|
|
299
470
|
logoutNothing: "没有本地会话(人类/CI 通道使用 STAMP_TOKEN)",
|
|
300
471
|
enrolled: "已登记 {fingerprint}({keyId})",
|
|
472
|
+
enrolledIdentityRecorded: "这台机器上的 `{cli} repo clone` 会使用 {path}",
|
|
473
|
+
enrolledIdentityNotRecorded: "私钥 {path} 不在这台机器上,这里的 `{cli} repo clone` 需要 --identity FILE",
|
|
301
474
|
bound: "已绑定 {email}",
|
|
302
475
|
usageKeyEnroll: "用法:{cli} key enroll [--public-key FILE|-]",
|
|
476
|
+
usageKeyList: "用法:{cli} key list",
|
|
477
|
+
usageKeyRevoke: "用法:{cli} key revoke KEY_ID",
|
|
478
|
+
keyListEmpty: "没有已登记的公钥",
|
|
479
|
+
keyRevoked: "已撤销 {keyId}",
|
|
303
480
|
usageIdentityBind: "用法:{cli} identity bind --email ADDR",
|
|
304
481
|
usageReceiptGet: "用法:{cli} receipt get <receipt-id>",
|
|
482
|
+
usageReceiptList: "用法:{cli} receipt list [--repo OWNER/REPO] [--limit N] [--cursor CURSOR]",
|
|
483
|
+
receiptListEmpty: "没有回执",
|
|
484
|
+
receiptListMore: "还有更多回执;用 --limit 与 --cursor {cursor} 继续翻页。",
|
|
485
|
+
receiptListBadResponse: "回执列表响应异常;请检查 {cli} 与网关版本后重试。",
|
|
486
|
+
usageChangelog: "用法:{cli} changelog [--limit N] [--all]",
|
|
487
|
+
changelogScopeAgent: "只显示命令行和接口的变化;--all 看全部。",
|
|
488
|
+
changelogScopeAll: "显示全部变化,包括网页端和内部改动。",
|
|
489
|
+
changelogNoneForAgents: "这个版本没有命令行或接口的变化(另有 {hidden} 项;--all 可看)",
|
|
490
|
+
changelogHiddenCount: "(隐藏了 {hidden} 项其他改动;--all 可看)",
|
|
491
|
+
changelogBuild: "网关构建 {version}({commit})",
|
|
492
|
+
changelogEmpty: "这个构建里没有版本记录。",
|
|
493
|
+
changelogNoEntries: "没有记录到 PR",
|
|
494
|
+
changelogCurrentMark: "<- 当前运行",
|
|
305
495
|
usageFollow: "用法:{cli} <follow|unfollow|subscription …> <owner/repo> --kind issue|pull --number N",
|
|
306
496
|
usageSubscription: "用法:{cli} subscription pause|resume <owner/repo> --kind issue|pull --number N",
|
|
307
497
|
usageWatch: "用法:{cli} {cmd} <owner/repo> --event TYPE",
|
package/lib/main.mjs
CHANGED
|
@@ -6,11 +6,13 @@ import { selectLocale, t, setCliName, prefix } from "./locale.mjs";
|
|
|
6
6
|
import { presentError, printGatewayError } from "./errors.mjs";
|
|
7
7
|
import * as session from "./commands/session.mjs";
|
|
8
8
|
import * as key from "./commands/key.mjs";
|
|
9
|
+
import * as knownhosts from "./commands/knownhosts.mjs";
|
|
9
10
|
import * as identity from "./commands/identity.mjs";
|
|
10
11
|
import * as receipt from "./commands/receipt.mjs";
|
|
11
12
|
import * as repo from "./commands/repo.mjs";
|
|
12
13
|
import * as pr from "./commands/pr.mjs";
|
|
13
14
|
import * as subscribe from "./commands/subscribe.mjs";
|
|
15
|
+
import * as changelog from "./commands/changelog.mjs";
|
|
14
16
|
|
|
15
17
|
const require = createRequire(import.meta.url);
|
|
16
18
|
const pkg = require("../package.json");
|
|
@@ -21,6 +23,7 @@ const commands = {
|
|
|
21
23
|
whoami: session.whoami,
|
|
22
24
|
"migration-help": session.migrationHelp,
|
|
23
25
|
key: key.run,
|
|
26
|
+
"known-hosts": knownhosts.run,
|
|
24
27
|
identity: identity.run,
|
|
25
28
|
receipt: receipt.run,
|
|
26
29
|
repo: repo.run,
|
|
@@ -31,6 +34,7 @@ const commands = {
|
|
|
31
34
|
subscriptions: subscribe.subscriptions,
|
|
32
35
|
watch: subscribe.watch,
|
|
33
36
|
unwatch: subscribe.watch,
|
|
37
|
+
changelog: changelog.run,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
export async function main(argv, opts) {
|
|
@@ -39,7 +43,7 @@ export async function main(argv, opts) {
|
|
|
39
43
|
const err = opts.stderr ?? ((s) => console.error(s));
|
|
40
44
|
const env = opts.env ?? process.env;
|
|
41
45
|
const exit = opts.exit ?? ((code) => process.exit(code));
|
|
42
|
-
const localValues = new Set(["--public-key", "--email", "--identity", "--known-hosts", "--kind", "--number", "--event", "--receipt", "--repo", "--head", "--sha", "--base", "--title", "--body", "--body-file", "--idempotency-key", "--method", "-b", "-F", "-R"]);
|
|
46
|
+
const localValues = new Set(["--limit", "--public-key", "--email", "--identity", "--known-hosts", "--kind", "--number", "--event", "--receipt", "--repo", "--head", "--sha", "--base", "--title", "--body", "--body-file", "--idempotency-key", "--method", "-b", "-F", "-R"]);
|
|
43
47
|
let json = false, langFlag, help = false, version = false;
|
|
44
48
|
const commandArgs = [];
|
|
45
49
|
for (let i = 0; i < args.length; i++) {
|
package/lib/pr/close.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AgentError } from "../errors.mjs";
|
|
2
|
+
import { parsePRTargetArgs } from "./read.mjs";
|
|
3
|
+
|
|
4
|
+
// Task #622: `stamp pr close` mirrors `pr edit`'s contract — only the agent
|
|
5
|
+
// recorded on the creation receipt may close, and the result must echo back
|
|
6
|
+
// the exact target in state "closed" or the outcome is reported unknown.
|
|
7
|
+
export function parsePRCloseArgs(input) {
|
|
8
|
+
const target = parsePRTargetArgs(input, "usagePrClose");
|
|
9
|
+
return {
|
|
10
|
+
target,
|
|
11
|
+
method: "POST",
|
|
12
|
+
path: `/v1/repositories/${encodeURIComponent(target.owner)}/${encodeURIComponent(target.repo)}/pulls/${target.number}/close`,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function validatePRCloseResult(value, target) {
|
|
17
|
+
const repository = `${target.owner}/${target.repo}`;
|
|
18
|
+
const valid = value && typeof value === "object" && !Array.isArray(value)
|
|
19
|
+
&& typeof value.repository === "string" && value.repository.toLowerCase() === repository.toLowerCase()
|
|
20
|
+
&& value.number === target.number
|
|
21
|
+
&& typeof value.url === "string" && value.url.toLowerCase() === `https://github.com/${repository}/pull/${target.number}`.toLowerCase()
|
|
22
|
+
&& value.state === "closed";
|
|
23
|
+
if (!valid) throw new AgentError("prCloseOutcomeUnknown");
|
|
24
|
+
return value;
|
|
25
|
+
}
|
package/lib/pr/comment.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export function parsePRCommentArgs(input) {
|
|
|
6
6
|
const targetArgs = [], flags = new Map();
|
|
7
7
|
for (let i = 0; i < input.length; i++) {
|
|
8
8
|
const arg = input[i];
|
|
9
|
-
const match = arg.match(/^(--body|--body-file)(?:=(.*))?$/s);
|
|
9
|
+
const match = arg.match(/^(--body|--body-file|--expected-head)(?:=(.*))?$/s);
|
|
10
10
|
const name = match?.[1] ?? ({ "-b": "--body", "-F": "--body-file" })[arg];
|
|
11
11
|
if (!name) { targetArgs.push(arg); continue; }
|
|
12
12
|
if (flags.has(name)) throw new AgentError("usagePrComment");
|
|
@@ -15,7 +15,10 @@ export function parsePRCommentArgs(input) {
|
|
|
15
15
|
flags.set(name, value);
|
|
16
16
|
}
|
|
17
17
|
const target = parsePRTargetArgs(targetArgs, "usagePrComment");
|
|
18
|
+
const expectedHead = flags.get("--expected-head");
|
|
19
|
+
flags.delete("--expected-head");
|
|
18
20
|
if (flags.size !== 1) throw new AgentError("usagePrComment");
|
|
21
|
+
if (expectedHead !== undefined && !/^[0-9a-fA-F]{40}$/.test(expectedHead)) throw new AgentError("prCommentExpectedHeadInvalid");
|
|
19
22
|
let body = flags.get("--body");
|
|
20
23
|
if (flags.has("--body-file")) {
|
|
21
24
|
const file = flags.get("--body-file");
|
|
@@ -23,7 +26,9 @@ export function parsePRCommentArgs(input) {
|
|
|
23
26
|
catch { throw new AgentError("prBodyRead"); }
|
|
24
27
|
}
|
|
25
28
|
if (!body?.trim() || Buffer.byteLength(body, "utf8") > 65536) throw new AgentError("prCommentBodyInvalid");
|
|
26
|
-
|
|
29
|
+
const request = { body };
|
|
30
|
+
if (expectedHead !== undefined) request.expectedHead = expectedHead.toLowerCase();
|
|
31
|
+
return { target, path: `${prDetailPath(target)}/comments`, body: request };
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export function validatePRCommentResult(result, target) {
|
|
@@ -31,7 +36,7 @@ export function validatePRCommentResult(result, target) {
|
|
|
31
36
|
const valid = result && typeof result === "object" && !Array.isArray(result)
|
|
32
37
|
&& typeof result.repository === "string" && result.repository.toLowerCase() === expectedRepo.toLowerCase()
|
|
33
38
|
&& result.number === target.number && Number.isSafeInteger(result.commentId) && result.commentId > 0
|
|
34
|
-
&& typeof result.actorLogin === "string" && /^[A-Za-z0-9-]
|
|
39
|
+
&& typeof result.actorLogin === "string" && /^[A-Za-z0-9-]+(\[bot\])?$/.test(result.actorLogin)
|
|
35
40
|
&& typeof result.url === "string"
|
|
36
41
|
&& result.url.toLowerCase() === `https://github.com/${expectedRepo}/pull/${target.number}#issuecomment-${result.commentId}`.toLowerCase();
|
|
37
42
|
if (!valid) throw new AgentError("prCommentOutcomeUnknown");
|
package/lib/pr/create.mjs
CHANGED
|
@@ -52,7 +52,9 @@ export function pullRequestRecovery(code) {
|
|
|
52
52
|
case "PUBLISHED_RECEIPT_BINDING_MISMATCH":
|
|
53
53
|
case "GITHUB_HEAD_DRIFT": return "prCheckReceipt";
|
|
54
54
|
case "REPOSITORY_NOT_AUTHORIZED":
|
|
55
|
+
// Gateways before v0.1.38 still answer this for any non-default base.
|
|
55
56
|
case "BASE_REF_NOT_AUTHORIZED": return "prCheckAccess";
|
|
57
|
+
case "BASE_REF_NOT_FOUND": return "prCheckBase";
|
|
56
58
|
case "IDEMPOTENCY_CONFLICT":
|
|
57
59
|
case "PUSH_RECEIPT_ALREADY_BOUND":
|
|
58
60
|
case "GITHUB_PULL_REQUEST_CONFLICT": return "prCheckExisting";
|
package/lib/pr/edit.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { AgentError } from "../errors.mjs";
|
|
3
|
+
import { parsePRTargetArgs } from "./read.mjs";
|
|
4
|
+
|
|
5
|
+
export function parsePREditArgs(input) {
|
|
6
|
+
const targetArgs = [], flags = new Map();
|
|
7
|
+
for (let i = 0; i < input.length; i++) {
|
|
8
|
+
const arg = input[i];
|
|
9
|
+
const match = arg.match(/^(--title|--body|--body-file)(?:=(.*))?$/s);
|
|
10
|
+
const name = match?.[1] ?? ({ "-b": "--body", "-F": "--body-file" })[arg];
|
|
11
|
+
if (!name) { targetArgs.push(arg); continue; }
|
|
12
|
+
if (flags.has(name)) throw new AgentError("usagePrEdit");
|
|
13
|
+
const value = match?.[2] ?? input[++i];
|
|
14
|
+
if (value === undefined) throw new AgentError("usagePrEdit");
|
|
15
|
+
flags.set(name, value);
|
|
16
|
+
}
|
|
17
|
+
if (flags.has("--body") && flags.has("--body-file")) throw new AgentError("prBodyConflict");
|
|
18
|
+
const target = parsePRTargetArgs(targetArgs, "usagePrEdit");
|
|
19
|
+
const body = {};
|
|
20
|
+
if (flags.has("--title")) {
|
|
21
|
+
const title = flags.get("--title").trim();
|
|
22
|
+
if (!title || Buffer.byteLength(title, "utf8") > 256) throw new AgentError("prEditTitleInvalid");
|
|
23
|
+
body.title = title;
|
|
24
|
+
}
|
|
25
|
+
if (flags.has("--body") || flags.has("--body-file")) {
|
|
26
|
+
let text = flags.get("--body");
|
|
27
|
+
if (flags.has("--body-file")) {
|
|
28
|
+
const file = flags.get("--body-file");
|
|
29
|
+
try { text = readFileSync(file === "-" ? 0 : file, "utf8"); }
|
|
30
|
+
catch { throw new AgentError("prBodyRead"); }
|
|
31
|
+
}
|
|
32
|
+
if (!text?.trim() || Buffer.byteLength(text, "utf8") > 65536) throw new AgentError("prEditBodyInvalid");
|
|
33
|
+
body.body = text;
|
|
34
|
+
}
|
|
35
|
+
if (!("title" in body) && !("body" in body)) throw new AgentError("usagePrEdit");
|
|
36
|
+
return {
|
|
37
|
+
target,
|
|
38
|
+
path: `/v1/repositories/${encodeURIComponent(target.owner)}/${encodeURIComponent(target.repo)}/pulls/${target.number}`,
|
|
39
|
+
body,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function validatePREditResult(value, target) {
|
|
44
|
+
const repository = `${target.owner}/${target.repo}`;
|
|
45
|
+
const valid = value && typeof value === "object" && !Array.isArray(value)
|
|
46
|
+
&& typeof value.repository === "string" && value.repository.toLowerCase() === repository.toLowerCase()
|
|
47
|
+
&& value.number === target.number
|
|
48
|
+
&& typeof value.url === "string" && value.url.toLowerCase() === `https://github.com/${repository}/pull/${target.number}`.toLowerCase()
|
|
49
|
+
&& typeof value.title === "string" && value.title.trim().length > 0
|
|
50
|
+
&& typeof value.body === "string";
|
|
51
|
+
if (!valid) throw new AgentError("prEditOutcomeUnknown");
|
|
52
|
+
return value;
|
|
53
|
+
}
|
package/lib/pr/queue.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AgentError } from "../errors.mjs";
|
|
2
|
+
import { parsePRTargetArgs, prDetailPath, takeNamedFlag } from "./read.mjs";
|
|
3
|
+
const sha = /^[0-9a-f]{40}$/;
|
|
4
|
+
const id = /^[a-zA-Z0-9][a-zA-Z0-9_-]{15,127}$/;
|
|
5
|
+
const states = new Set(["queued", "preparing", "testing", "publishing", "merged", "verified", "failed", "stale", "canceled"]);
|
|
6
|
+
|
|
7
|
+
export function parsePRQueueArgs(input) {
|
|
8
|
+
const args = [...input];
|
|
9
|
+
const action = args.shift();
|
|
10
|
+
const usage = "usagePrQueue";
|
|
11
|
+
if (!["enqueue", "status", "withdraw"].includes(action)) throw new AgentError(usage);
|
|
12
|
+
const requestID = takeNamedFlag(args, "request-id", undefined, usage);
|
|
13
|
+
const head = takeNamedFlag(args, "head", undefined, usage);
|
|
14
|
+
const base = takeNamedFlag(args, "base", undefined, usage);
|
|
15
|
+
if (typeof requestID !== "string" || !id.test(requestID)) throw new AgentError(usage);
|
|
16
|
+
if (action === "enqueue" ? !sha.test(head ?? "") || !sha.test(base ?? "") : head !== undefined || base !== undefined) throw new AgentError(usage);
|
|
17
|
+
const target = parsePRTargetArgs(args, usage);
|
|
18
|
+
return { action, requestID, target, path: `${prDetailPath(target)}/queue/${requestID}`, method: { enqueue: "PUT", status: "GET", withdraw: "DELETE" }[action], ...(action === "enqueue" ? { body: { expectedHead: head, expectedBase: base } } : {}) };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function validatePRQueueResult(d, input) {
|
|
22
|
+
const r = d?.receipt;
|
|
23
|
+
const m = r?.member;
|
|
24
|
+
if (!d || typeof d.repository !== "string" || d.repository.toLowerCase() !== `${input.target.owner}/${input.target.repo}`.toLowerCase()
|
|
25
|
+
|| d.number !== input.target.number || d.requestId !== input.requestID
|
|
26
|
+
|| m?.number !== input.target.number || m?.requestId !== input.requestID || !sha.test(m?.head ?? "")
|
|
27
|
+
|| !states.has(r?.state) || typeof r?.notificationQueued !== "boolean"
|
|
28
|
+
|| !sha.test(r?.expectedBase ?? "")
|
|
29
|
+
|| (input.body && (m.head !== input.body.expectedHead || r.expectedBase !== input.body.expectedBase))
|
|
30
|
+
|| (r.state === "merged" && !sha.test(r.landingSha ?? ""))) throw new AgentError("prQueueOutcomeUnknown");
|
|
31
|
+
return d;
|
|
32
|
+
}
|