pr-shepherd 0.34.0 → 0.35.0
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/.claude-plugin/plugin.json +3 -2
- package/.grok-plugin/marketplace.json +17 -0
- package/README.md +56 -39
- package/bin/api.d.mts +80 -0
- package/bin/api.mjs +236 -0
- package/bin/checks/classify.d.mts +41 -0
- package/bin/checks/startup-failures.d.mts +2 -0
- package/bin/checks/superseded.d.mts +21 -0
- package/bin/checks/triage.d.mts +4 -0
- package/bin/classify/apply.d.mts +18 -0
- package/bin/classify/apply.mjs +4 -0
- package/bin/classify/loader.d.mts +10 -0
- package/bin/classify/types.d.mts +35 -0
- package/bin/cli/args.d.mts +18 -0
- package/bin/cli/clean-formatter.d.mts +2 -0
- package/bin/cli/default-poll.d.mts +2 -0
- package/bin/cli/duration-flag.d.mts +2 -0
- package/bin/cli/duration.d.mts +13 -0
- package/bin/cli/fence.d.mts +1 -0
- package/bin/cli/fix-formatter-extra.d.mts +3 -0
- package/bin/cli/fix-formatter.d.mts +2 -0
- package/bin/cli/fix-formatter.mjs +6 -6
- package/bin/cli/formatters.d.mts +7 -0
- package/bin/cli/handlers.d.mts +4 -0
- package/bin/cli/handlers.mjs +11 -10
- package/bin/cli/help-command-pages.d.mts +231 -0
- package/bin/cli/help-command-pages.mjs +106 -1
- package/bin/cli/help-iterate-poll-pages.d.mts +4 -0
- package/bin/cli/help-iterate-poll-pages.mjs +4 -2
- package/bin/cli/help-log-file-page.d.mts +1 -0
- package/bin/cli/help-top-page.d.mts +1 -0
- package/bin/cli/help-top-page.mjs +14 -15
- package/bin/cli/help.d.mts +236 -0
- package/bin/cli/help.mjs +17 -0
- package/bin/cli/iterate-emitter.d.mts +8 -0
- package/bin/cli/iterate-flags.d.mts +11 -0
- package/bin/cli/iterate-formatter.d.mts +19 -0
- package/bin/cli/iterate-instructions.d.mts +6 -0
- package/bin/cli/iterate-lean.d.mts +12 -0
- package/bin/cli/journal-formatter.d.mts +2 -0
- package/bin/cli/journal-formatter.mjs +15 -0
- package/bin/cli/journal-handler.d.mts +1 -0
- package/bin/cli/journal-handler.mjs +7 -20
- package/bin/cli/list-formatters.d.mts +76 -0
- package/bin/cli/list-formatters.mjs +9 -9
- package/bin/cli/mark-files-as-viewed-flags.d.mts +11 -0
- package/bin/cli/mark-files-as-viewed-formatter.d.mts +2 -0
- package/bin/cli/mutate-formatter.d.mts +2 -0
- package/bin/cli/poll-handler.d.mts +1 -0
- package/bin/cli/poll-handler.mjs +2 -2
- package/bin/cli/resolve-validators.d.mts +3 -0
- package/bin/cli/resolve-validators.mjs +3 -3
- package/bin/cli/runner.d.mts +7 -0
- package/bin/cli/suggestion-renderer.d.mts +3 -0
- package/bin/cli/validate-default-args.d.mts +6 -0
- package/bin/cli-parser.d.mts +2 -0
- package/bin/cli-parser.mjs +72 -16
- package/bin/commands/check-annotations.d.mts +5 -0
- package/bin/commands/check-status.d.mts +3 -0
- package/bin/commands/check-terminal-report.d.mts +5 -0
- package/bin/commands/check.d.mts +6 -0
- package/bin/commands/check.mjs +2 -1
- package/bin/commands/clean.d.mts +21 -0
- package/bin/commands/commit-suggestion-instruction.d.mts +8 -0
- package/bin/commands/commit-suggestion-instruction.mjs +3 -3
- package/bin/commands/commit-suggestion.d.mts +8 -0
- package/bin/commands/commit-suggestion.mjs +11 -10
- package/bin/commands/iterate/check-instructions.d.mts +16 -0
- package/bin/commands/iterate/check-instructions.mjs +3 -3
- package/bin/commands/iterate/classify.d.mts +18 -0
- package/bin/commands/iterate/classify.mjs +4 -4
- package/bin/commands/iterate/escalate.d.mts +31 -0
- package/bin/commands/iterate/escalate.mjs +7 -4
- package/bin/commands/iterate/fix-code.d.mts +25 -0
- package/bin/commands/iterate/helpers.d.mts +13 -0
- package/bin/commands/iterate/helpers.mjs +4 -1
- package/bin/commands/iterate/index.d.mts +2 -0
- package/bin/commands/iterate/index.mjs +5 -2
- package/bin/commands/iterate/render.d.mts +5 -0
- package/bin/commands/iterate/render.mjs +8 -6
- package/bin/commands/iterate/reruns.d.mts +20 -0
- package/bin/commands/iterate/stall.d.mts +6 -0
- package/bin/commands/journal/index.d.mts +14 -0
- package/bin/commands/journal/index.mjs +1 -0
- package/bin/commands/journal/transform.d.mts +22 -0
- package/bin/commands/log-file.d.mts +5 -0
- package/bin/commands/mark-files-as-viewed.d.mts +26 -0
- package/bin/commands/mark-files-as-viewed.mjs +1 -0
- package/bin/commands/poll.d.mts +10 -0
- package/bin/commands/poll.mjs +1 -0
- package/bin/commands/ready-delay.d.mts +29 -0
- package/bin/commands/ready-mergeability.d.mts +15 -0
- package/bin/commands/resolve-mutate.d.mts +4 -0
- package/bin/commands/resolve-mutate.mjs +1 -0
- package/bin/commands/resolve.d.mts +4 -0
- package/bin/commands/shepherd-journal.d.mts +7 -0
- package/bin/commands/shepherd-journal.mjs +2 -2
- package/bin/comments/authors.d.mts +14 -0
- package/bin/comments/marker.d.mts +2 -0
- package/bin/comments/minimize-policy.d.mts +4 -0
- package/bin/comments/pending-ops.d.mts +15 -0
- package/bin/comments/rate-limit.d.mts +18 -0
- package/bin/comments/resolve.d.mts +34 -0
- package/bin/comments/resolve.mjs +1 -0
- package/bin/comments/review-thread-markers.d.mts +8 -0
- package/bin/comments/review-visibility.d.mts +28 -0
- package/bin/comments/sha-poll.d.mts +2 -0
- package/bin/comments/thread-visibility.d.mts +11 -0
- package/bin/comments/visible-comments.d.mts +11 -0
- package/bin/config/load.d.mts +60 -0
- package/bin/config/load.mjs +72 -1
- package/bin/config.json +0 -2
- package/bin/execution-context.d.mts +9 -0
- package/bin/execution-context.mjs +19 -0
- package/bin/exit-codes.d.mts +51 -0
- package/bin/github/activity.d.mts +3 -0
- package/bin/github/activity.mjs +7 -0
- package/bin/github/batch-parser-helpers.d.mts +22 -0
- package/bin/github/batch-parsers.d.mts +3 -0
- package/bin/github/batch-parsers.mjs +6 -0
- package/bin/github/batch-raw-types.d.mts +207 -0
- package/bin/github/batch-response.d.mts +4 -0
- package/bin/github/batch.d.mts +22 -0
- package/bin/github/branch-protection.d.mts +3 -0
- package/bin/github/check-annotations.d.mts +2 -0
- package/bin/github/client.d.mts +46 -0
- package/bin/github/client.mjs +7 -2
- package/bin/github/errors.d.mts +25 -0
- package/bin/github/gql/batch-pr.gql +5 -0
- package/bin/github/gql/review-thread-comments.gql +1 -0
- package/bin/github/graphql-http.d.mts +19 -0
- package/bin/github/graphql-response.d.mts +7 -0
- package/bin/github/http-auth.d.mts +4 -0
- package/bin/github/http-request.d.mts +7 -0
- package/bin/github/http-utils.d.mts +11 -0
- package/bin/github/http.d.mts +5 -0
- package/bin/github/pagination.d.mts +45 -0
- package/bin/github/queries.d.mts +24 -0
- package/bin/github/rest-http.d.mts +2 -0
- package/bin/github/thread-comments.d.mts +2 -0
- package/bin/index.d.mts +10 -0
- package/bin/index.mjs +1 -1
- package/bin/log/log-file.d.mts +28 -0
- package/bin/log/session.d.mts +31 -0
- package/bin/log/setup.d.mts +6 -0
- package/bin/mcp/index.d.mts +5 -0
- package/bin/mcp/index.mjs +8 -0
- package/bin/mcp/server.d.mts +8 -0
- package/bin/mcp/server.mjs +157 -0
- package/bin/mcp-stdio.d.mts +2 -0
- package/bin/mcp-stdio.mjs +7 -0
- package/bin/merge-status/derive.d.mts +19 -0
- package/bin/reporters/agent.d.mts +23 -0
- package/bin/reporters/agent.mjs +3 -0
- package/bin/state/base.d.mts +1 -0
- package/bin/state/bot-cr-seen.d.mts +51 -0
- package/bin/state/bot-cr-seen.mjs +1 -1
- package/bin/state/fix-attempts.d.mts +27 -0
- package/bin/state/iterate-stall.d.mts +27 -0
- package/bin/state/seen-comments.d.mts +62 -0
- package/bin/suggestions/extract.d.mts +8 -0
- package/bin/suggestions/parse.d.mts +48 -0
- package/bin/suggestions/patch.d.mts +14 -0
- package/bin/threads/transcript.d.mts +14 -0
- package/bin/threads/transcript.mjs +4 -0
- package/bin/types/activity.d.mts +30 -0
- package/bin/types/agent-thread.d.mts +9 -0
- package/bin/types/check-annotations.d.mts +14 -0
- package/bin/types/check-classification.d.mts +19 -0
- package/bin/types/github.d.mts +139 -0
- package/bin/types/iterate.d.mts +157 -0
- package/bin/types/protected-run.d.mts +6 -0
- package/bin/types/report.d.mts +176 -0
- package/bin/types/review-thread.d.mts +12 -0
- package/bin/types.d.mts +9 -0
- package/bin/util/markdown.d.mts +1 -0
- package/bin/util/path-segment.d.mts +2 -0
- package/bin/util/sleep.d.mts +1 -0
- package/bin/util/worktree.d.mts +9 -0
- package/bin/util/worktree.mjs +4 -1
- package/package.json +51 -37
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +3 -2
- package/plugins/pr-shepherd/.codex.mcp.json +8 -0
- package/plugins/pr-shepherd/.mcp.json +6 -0
- package/plugins/pr-shepherd/skills/mark-files-as-viewed/SKILL.md +5 -19
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +6 -15
- package/src/classify/types.mts +12 -0
|
@@ -7,24 +7,23 @@ Usage:
|
|
|
7
7
|
pr-shepherd --help | -h
|
|
8
8
|
pr-shepherd [PR] [poll-flags] [iterate-flags]
|
|
9
9
|
pr-shepherd iterate [PR] [iterate-flags]
|
|
10
|
-
pr-shepherd
|
|
11
|
-
pr-shepherd
|
|
12
|
-
pr-shepherd
|
|
13
|
-
pr-shepherd
|
|
14
|
-
pr-shepherd
|
|
15
|
-
pr-shepherd
|
|
16
|
-
pr-shepherd log-file [--format text|json]
|
|
10
|
+
pr-shepherd apply review [PR] [review-flags]
|
|
11
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
12
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
13
|
+
pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG [flags]
|
|
14
|
+
pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
|
|
15
|
+
pr-shepherd admin log-file [--format text|json]
|
|
17
16
|
|
|
18
17
|
Commands:
|
|
19
18
|
[PR] Poll until non-WAIT or timeout. This is the default command.
|
|
20
19
|
iterate Run one iterate tick (single-tick alias).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
clean
|
|
27
|
-
log-file
|
|
20
|
+
apply review Apply review-state mutations after fixes.
|
|
21
|
+
apply files Mark changed files as viewed in GitHub.
|
|
22
|
+
apply journal Append a list item to the ## Shepherd Journal section of a PR body.
|
|
23
|
+
build-suggestion-patch
|
|
24
|
+
Convert one GitHub suggestion thread into a patch and commit instructions.
|
|
25
|
+
admin clean Remove pr-shepherd state files.
|
|
26
|
+
admin log-file Print the per-worktree debug log path.
|
|
28
27
|
|
|
29
28
|
PR argument:
|
|
30
29
|
PR may be a number such as 42 or a GitHub pull request URL.
|
|
@@ -41,7 +40,7 @@ Iterate flags:
|
|
|
41
40
|
--no-auto-mark-ready Do not convert draft PRs to ready for review.
|
|
42
41
|
--no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
Polling flags:
|
|
45
44
|
--interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: 60s.
|
|
46
45
|
--timeout <duration> Poll wall-clock cap. Bare number = seconds. Default: 4.5m.
|
|
47
46
|
--quiet-status During WAIT polling, print only changed status snapshots.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
export declare const USAGE: {
|
|
2
|
+
readonly default: string;
|
|
3
|
+
readonly apply: `pr-shepherd apply
|
|
4
|
+
|
|
5
|
+
Apply a review mutation, mark changed files as viewed, or append a PR journal item.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
pr-shepherd apply review [PR] [review-flags]
|
|
9
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
10
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
11
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
12
|
+
|
|
13
|
+
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
14
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
|
+
readonly "apply review": `pr-shepherd apply review
|
|
16
|
+
|
|
17
|
+
Apply GitHub review-state mutations after fixes.
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
21
|
+
pr-shepherd apply review [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
|
|
22
|
+
[--dismiss-review-ids Q] [--message MSG]
|
|
23
|
+
[--require-sha SHA] [--format text|json]
|
|
24
|
+
|
|
25
|
+
Flags:
|
|
26
|
+
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
27
|
+
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
28
|
+
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
29
|
+
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
30
|
+
--dismiss-review-ids <ids> Comma-separated CHANGES_REQUESTED review IDs to dismiss.
|
|
31
|
+
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
32
|
+
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
33
|
+
--format text|json Output format. Default: text.
|
|
34
|
+
|
|
35
|
+
At least one action flag is required.
|
|
36
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
37
|
+
readonly "apply files": `pr-shepherd apply files
|
|
38
|
+
|
|
39
|
+
Mark changed files as viewed in the GitHub pull request diff.
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
43
|
+
[--format text|json]
|
|
44
|
+
|
|
45
|
+
Selectors:
|
|
46
|
+
files... Exact changed-file paths from the PR diff.
|
|
47
|
+
--tests Select changed test files.
|
|
48
|
+
--match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
|
|
49
|
+
May be repeated.
|
|
50
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
51
|
+
readonly "apply journal": `pr-shepherd apply journal
|
|
52
|
+
|
|
53
|
+
Append a list item to the ## Shepherd Journal section of a PR body.
|
|
54
|
+
|
|
55
|
+
Usage:
|
|
56
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
57
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
58
|
+
pr-shepherd apply journal [PR] --file - [--dry-run] [--format text|json]
|
|
59
|
+
|
|
60
|
+
PR may be a number or GitHub pull request URL. An item must start with '- ' followed by text.
|
|
61
|
+
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
62
|
+
is required. --dry-run previews the resulting body without writing it.
|
|
63
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
64
|
+
readonly "build-suggestion-patch": `pr-shepherd build-suggestion-patch
|
|
65
|
+
|
|
66
|
+
Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
|
|
67
|
+
The command does not edit files or mutate git history.
|
|
68
|
+
|
|
69
|
+
Usage:
|
|
70
|
+
pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG
|
|
71
|
+
[--description DESC] [--format text|json]
|
|
72
|
+
|
|
73
|
+
Flags:
|
|
74
|
+
--thread-id <id> Review thread containing exactly one suggestion block. Required.
|
|
75
|
+
--message <text> Suggested commit subject. Required and non-empty.
|
|
76
|
+
--description <text> Optional longer commit body.
|
|
77
|
+
--format text|json Output format. Default: text.
|
|
78
|
+
|
|
79
|
+
The current branch must match the PR head ref and local HEAD must match the PR head SHA.
|
|
80
|
+
--help, -h Print this help and exit before GitHub, git, config, or log I/O.`;
|
|
81
|
+
readonly admin: `pr-shepherd admin
|
|
82
|
+
|
|
83
|
+
Administrative state and diagnostics commands.
|
|
84
|
+
|
|
85
|
+
Usage:
|
|
86
|
+
pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
|
|
87
|
+
pr-shepherd admin log-file [--format text|json]
|
|
88
|
+
|
|
89
|
+
Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
|
|
90
|
+
--help, -h Print this help and exit before any I/O.`;
|
|
91
|
+
readonly "admin clean": `pr-shepherd admin clean
|
|
92
|
+
|
|
93
|
+
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
94
|
+
|
|
95
|
+
Usage:
|
|
96
|
+
pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
|
|
97
|
+
pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
|
|
98
|
+
pr-shepherd admin clean current [--dry-run] [--format text|json]
|
|
99
|
+
pr-shepherd admin clean repo [--dry-run] [--format text|json]
|
|
100
|
+
pr-shepherd admin clean all [--dry-run] [--format text|json]
|
|
101
|
+
|
|
102
|
+
Variants remove state for one PR, branch, current branch, repository, or all repositories.
|
|
103
|
+
Use --dry-run to preview paths without removing them.
|
|
104
|
+
--help, -h Print this help and exit before any cleanup.`;
|
|
105
|
+
readonly "admin log-file": string;
|
|
106
|
+
readonly resolve: `pr-shepherd resolve
|
|
107
|
+
|
|
108
|
+
Apply GitHub review-state mutations after fixes.
|
|
109
|
+
|
|
110
|
+
Usage:
|
|
111
|
+
pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
|
|
112
|
+
pr-shepherd resolve [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
|
|
113
|
+
[--dismiss-review-ids Q] [--message MSG]
|
|
114
|
+
[--require-sha SHA] [--format text|json]
|
|
115
|
+
|
|
116
|
+
Flags:
|
|
117
|
+
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
118
|
+
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
119
|
+
Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
|
|
120
|
+
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
121
|
+
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
122
|
+
--dismiss-review-ids <ids> Comma-separated CHANGES_REQUESTED review IDs to dismiss.
|
|
123
|
+
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
124
|
+
or --dismiss-review-ids.
|
|
125
|
+
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
126
|
+
Must be a full 40-character lowercase hex SHA. Use $(git rev-parse HEAD).
|
|
127
|
+
--format text|json Output format. Default: text.
|
|
128
|
+
--help, -h Print this help and exit before GitHub I/O.
|
|
129
|
+
|
|
130
|
+
At least one non-empty action flag is required:
|
|
131
|
+
--reply-thread-ids, --resolve-thread-ids, --minimize-comment-ids, or --dismiss-review-ids.
|
|
132
|
+
|
|
133
|
+
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
134
|
+
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
135
|
+
readonly "commit-suggestion": `pr-shepherd commit-suggestion
|
|
136
|
+
|
|
137
|
+
Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
|
|
138
|
+
The command does not edit files or mutate git history.
|
|
139
|
+
|
|
140
|
+
Usage:
|
|
141
|
+
pr-shepherd commit-suggestion [PR] --thread-id ID --message MSG
|
|
142
|
+
[--description DESC] [--format text|json]
|
|
143
|
+
|
|
144
|
+
Flags:
|
|
145
|
+
--thread-id <id> Review thread ID containing exactly one suggestion to apply. Required.
|
|
146
|
+
--message <text> Suggested commit subject. Required and must be non-empty.
|
|
147
|
+
--description <text> Optional longer commit body.
|
|
148
|
+
--format text|json Output format. Default: text.
|
|
149
|
+
--help, -h Print this help and exit before GitHub, git, config, or log I/O.
|
|
150
|
+
|
|
151
|
+
Preconditions:
|
|
152
|
+
The current branch must match the PR head ref, and local HEAD must match the PR head SHA.
|
|
153
|
+
|
|
154
|
+
Exit codes:
|
|
155
|
+
0 suggestion patch and instructions produced
|
|
156
|
+
64 usage error (missing/invalid flag)
|
|
157
|
+
69 precondition unmet (thread ineligible, branch/SHA mismatch, no open PR)
|
|
158
|
+
See docs/exit-codes.md for the full sysexits.h table.`;
|
|
159
|
+
readonly "mark-files-as-viewed": `pr-shepherd mark-files-as-viewed
|
|
160
|
+
|
|
161
|
+
Mark changed files as viewed in the GitHub pull request diff.
|
|
162
|
+
|
|
163
|
+
Usage:
|
|
164
|
+
pr-shepherd mark-files-as-viewed [PR] [files...] [--tests] [--match REGEX]
|
|
165
|
+
[--format text|json]
|
|
166
|
+
|
|
167
|
+
Selectors:
|
|
168
|
+
files... Exact changed-file paths from the PR diff.
|
|
169
|
+
--tests Select changed test files.
|
|
170
|
+
--match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
|
|
171
|
+
May be repeated.
|
|
172
|
+
|
|
173
|
+
Flags:
|
|
174
|
+
--format text|json Output format. Default: text.
|
|
175
|
+
--help, -h Print this help and exit before GitHub I/O.
|
|
176
|
+
|
|
177
|
+
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
178
|
+
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
179
|
+
readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
180
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly while the action is WAIT. Print only the final tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, FIX_CODE, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. With --until-terminal, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR] [poll-flags] [iterate-flags]\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Maximum wall-clock wait. Bare number = seconds. Default: 4.5m.\n --quiet-status During WAIT polling, print only changed status snapshots.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
181
|
+
readonly clean: `pr-shepherd clean
|
|
182
|
+
|
|
183
|
+
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
184
|
+
|
|
185
|
+
Usage:
|
|
186
|
+
pr-shepherd clean pr [number] [--dry-run] [--format text|json]
|
|
187
|
+
pr-shepherd clean branch [name] [--dry-run] [--format text|json]
|
|
188
|
+
pr-shepherd clean current [--dry-run] [--format text|json]
|
|
189
|
+
pr-shepherd clean repo [--dry-run] [--format text|json]
|
|
190
|
+
pr-shepherd clean all [--dry-run] [--format text|json]
|
|
191
|
+
|
|
192
|
+
Variants:
|
|
193
|
+
pr [number] Remove state for one PR. Defaults to current branch PR.
|
|
194
|
+
branch [name] Resolve a branch to its open PR, then remove that PR's state.
|
|
195
|
+
Defaults to current branch.
|
|
196
|
+
current Alias for branch against the current branch.
|
|
197
|
+
repo Remove all state for the current repository, including worktree logs.
|
|
198
|
+
all Remove all pr-shepherd state.
|
|
199
|
+
|
|
200
|
+
Flags:
|
|
201
|
+
--dry-run Preview paths without removing them.
|
|
202
|
+
--format text|json Output format. Default: text.
|
|
203
|
+
--help, -h Print this help and exit before any cleanup.
|
|
204
|
+
|
|
205
|
+
Exit code: 0 on success (including a no-op --dry-run on a nonexistent target); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
206
|
+
readonly journal: `pr-shepherd journal
|
|
207
|
+
|
|
208
|
+
Append a list item to the ## Shepherd Journal section of a PR body.
|
|
209
|
+
Creates the section at the end if absent. Idempotent — duplicate items are skipped.
|
|
210
|
+
|
|
211
|
+
Usage:
|
|
212
|
+
pr-shepherd journal [PR] <item> [--dry-run] [--format text|json]
|
|
213
|
+
pr-shepherd journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
214
|
+
pr-shepherd journal [PR] --file - [--dry-run] [--format text|json]
|
|
215
|
+
|
|
216
|
+
PR PR number or GitHub pull request URL. Defaults to current branch PR.
|
|
217
|
+
item Markdown list item: must start with "- " followed by non-whitespace text.
|
|
218
|
+
Example: '- Rejected suggestion: kept existing pattern for consistency.'
|
|
219
|
+
Provide it as a positional argument, or via --file to avoid shell-escaping
|
|
220
|
+
backticks and multi-line Markdown. Exactly one of the two is required.
|
|
221
|
+
|
|
222
|
+
Flags:
|
|
223
|
+
--file <path> Read the entry from a file instead of a positional argument.
|
|
224
|
+
Pass --file - to read from stdin.
|
|
225
|
+
--dry-run Preview the new PR body without writing it to GitHub.
|
|
226
|
+
--format text|json Output format. Default: text.
|
|
227
|
+
--help, -h Print this help and exit before any GitHub I/O.
|
|
228
|
+
|
|
229
|
+
Exit code: 0 on success (including no-change no-op); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
230
|
+
readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
|
|
231
|
+
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG [flags]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR] Poll until non-WAIT or timeout. This is the default command.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files Mark changed files as viewed in GitHub.\n apply journal Append a list item to the ## Shepherd Journal section of a PR body.\n build-suggestion-patch\n Convert one GitHub suggestion thread into a patch and commit instructions.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number such as 42 or a GitHub pull request URL.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Poll wall-clock cap. Bare number = seconds. Default: 4.5m.\n --quiet-status During WAIT polling, print only changed status snapshots.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
232
|
+
};
|
|
233
|
+
/** Resolve help keys for nested public commands before any command I/O. */
|
|
234
|
+
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
|
235
|
+
/** Prints usage for `key` to stdout and returns true if `--help` or `-h` is in args. */
|
|
236
|
+
export declare function maybePrintHelp(args: string[], key: keyof typeof USAGE): boolean;
|
package/bin/cli/help.mjs
CHANGED
|
@@ -5,6 +5,23 @@ export const USAGE = {
|
|
|
5
5
|
top: TOP_USAGE,
|
|
6
6
|
...COMMAND_USAGE,
|
|
7
7
|
};
|
|
8
|
+
/** Resolve help keys for nested public commands before any command I/O. */
|
|
9
|
+
export function helpKeyForArgs(args) {
|
|
10
|
+
if (args[0] === "apply" && args[1] === "review")
|
|
11
|
+
return "apply review";
|
|
12
|
+
if (args[0] === "apply" && args[1] === "files")
|
|
13
|
+
return "apply files";
|
|
14
|
+
if (args[0] === "apply" && args[1] === "journal")
|
|
15
|
+
return "apply journal";
|
|
16
|
+
if (args[0] === "admin" && args[1] === "clean")
|
|
17
|
+
return "admin clean";
|
|
18
|
+
if (args[0] === "admin" && args[1] === "log-file")
|
|
19
|
+
return "admin log-file";
|
|
20
|
+
if (args[0] != null && args[0] in USAGE) {
|
|
21
|
+
return args[0];
|
|
22
|
+
}
|
|
23
|
+
return "top";
|
|
24
|
+
}
|
|
8
25
|
/** Prints usage for `key` to stdout and returns true if `--help` or `-h` is in args. */
|
|
9
26
|
export function maybePrintHelp(args, key) {
|
|
10
27
|
if (!hasFlag(args, "--help") && !hasFlag(args, "-h"))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IterateResult } from "../types.mts";
|
|
2
|
+
interface EmitIterateResultOpts {
|
|
3
|
+
format: "text" | "json";
|
|
4
|
+
verbose: boolean;
|
|
5
|
+
readyDelaySuffix?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function emitIterateResult(result: IterateResult, opts: EmitIterateResultOpts): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { loadConfig } from "../config/load.mts";
|
|
2
|
+
interface IterateFlags {
|
|
3
|
+
readyDelaySuffix: string | undefined | null;
|
|
4
|
+
readyDelaySeconds: number;
|
|
5
|
+
stallTimeoutSuffix: string | undefined | null;
|
|
6
|
+
stallTimeoutSeconds: number;
|
|
7
|
+
noAutoMarkReady: boolean;
|
|
8
|
+
noAutoCancelActionable: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseIterateFlags(extra: string[], cfg: ReturnType<typeof loadConfig>): IterateFlags;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IterateResult } from "../types.mts";
|
|
2
|
+
/**
|
|
3
|
+
* Format an IterateResult as human-readable Markdown.
|
|
4
|
+
*
|
|
5
|
+
* Load-bearing conventions the iterate skill relies on:
|
|
6
|
+
* 1. The H1 heading on line 1 contains `[<ACTION>]` — the action tag identifies
|
|
7
|
+
* the output for logging and validation. Behavior is driven by `## Instructions`,
|
|
8
|
+
* not by dispatching on the tag.
|
|
9
|
+
* 2. `[FIX_CODE]` wraps the `resolve` command under `## Post-fix push` in
|
|
10
|
+
* backticks — the skill extracts the backticked content for execution.
|
|
11
|
+
* 3. Every action ends with a `## Instructions` section — numbered `1.`, `2.`, … —
|
|
12
|
+
* that tells the agent exactly what to do with this output. The section is
|
|
13
|
+
* unconditional: every action, every variant, always emits at least one step.
|
|
14
|
+
* The skill simply follows those steps; it does not need its own dispatch table.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatIterateResult(result: IterateResult, opts?: {
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
readyDelaySuffix?: string;
|
|
19
|
+
}): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IterateResult } from "../types.mts";
|
|
2
|
+
export declare function buildSimpleIterateInstructions(result: Exclude<IterateResult, {
|
|
3
|
+
action: "fix_code";
|
|
4
|
+
}>): string[];
|
|
5
|
+
export declare function adaptIterateLog(log: string): string;
|
|
6
|
+
export declare function numberInstructions(instructions: string[]): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IterateResult } from "../types.mts";
|
|
2
|
+
interface IterateProjectionOptions {
|
|
3
|
+
readyDelaySuffix?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Project an IterateResult to a lean JSON shape for the default (non-verbose) output.
|
|
7
|
+
* Omits fields that are the trivial default (false, 0, empty) or state-gated fields
|
|
8
|
+
* outside the state where they are meaningful.
|
|
9
|
+
*/
|
|
10
|
+
export declare function projectIterateLean(result: IterateResult, opts?: IterateProjectionOptions): unknown;
|
|
11
|
+
export declare function projectIterateVerbose(result: IterateResult, opts?: IterateProjectionOptions): unknown;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function formatJournalResult(result) {
|
|
2
|
+
if (result.dryRun) {
|
|
3
|
+
const lines = ["Dry run — no body change written."];
|
|
4
|
+
if (result.previewBody !== undefined) {
|
|
5
|
+
lines.push("", result.previewBody);
|
|
6
|
+
}
|
|
7
|
+
return lines.join("\n");
|
|
8
|
+
}
|
|
9
|
+
if (!result.mutated)
|
|
10
|
+
return "No change — entry already present.";
|
|
11
|
+
if (!result.sectionExisted) {
|
|
12
|
+
return `Created ## Shepherd Journal section in PR #${result.prNumber}.`;
|
|
13
|
+
}
|
|
14
|
+
return `Appended to ## Shepherd Journal in PR #${result.prNumber}.`;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleJournal(args: string[], command?: "apply journal" | "journal"): Promise<void>;
|
|
@@ -3,7 +3,8 @@ import { EXIT, errorToExitCode } from "../exit-codes.mjs";
|
|
|
3
3
|
import { runJournal } from "../commands/journal/index.mjs";
|
|
4
4
|
import { getFlag, parsePrNumber } from "./args.mjs";
|
|
5
5
|
import { USAGE } from "./help.mjs";
|
|
6
|
-
|
|
6
|
+
import { formatJournalResult } from "./journal-formatter.mjs";
|
|
7
|
+
export async function handleJournal(args, command = "apply journal") {
|
|
7
8
|
for (const a of args) {
|
|
8
9
|
if (!a.startsWith("--"))
|
|
9
10
|
continue;
|
|
@@ -11,14 +12,14 @@ export async function handleJournal(args) {
|
|
|
11
12
|
continue;
|
|
12
13
|
if (a === "--file" || a.startsWith("--file="))
|
|
13
14
|
continue;
|
|
14
|
-
process.stderr.write(`pr-shepherd:
|
|
15
|
+
process.stderr.write(`pr-shepherd: ${command}: unknown flag: "${a}"\n`);
|
|
15
16
|
process.exitCode = EXIT.USAGE;
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
const { prNumber, extra } = parseJournalArgs(args);
|
|
19
20
|
const filePath = getFlag(args, "--file");
|
|
20
21
|
if (filePath !== null && extra[0]) {
|
|
21
|
-
process.stderr.write(`pr-shepherd:
|
|
22
|
+
process.stderr.write(`pr-shepherd: ${command}: provide the entry as a positional argument or via --file, not both\n`);
|
|
22
23
|
process.exitCode = EXIT.USAGE;
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
@@ -27,12 +28,12 @@ export async function handleJournal(args) {
|
|
|
27
28
|
rawItem = filePath !== null ? await readItemSource(filePath) : extra[0];
|
|
28
29
|
}
|
|
29
30
|
catch (e) {
|
|
30
|
-
process.stderr.write(`pr-shepherd:
|
|
31
|
+
process.stderr.write(`pr-shepherd: ${command}: ${String(e)}\n`);
|
|
31
32
|
process.exitCode = EXIT.NOINPUT;
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
if (rawItem === undefined) {
|
|
35
|
-
process.stderr.write(`${USAGE
|
|
36
|
+
process.stderr.write(`${USAGE[command]}\n`);
|
|
36
37
|
process.exitCode = EXIT.USAGE;
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
@@ -49,7 +50,7 @@ export async function handleJournal(args) {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
catch (e) {
|
|
52
|
-
process.stderr.write(`pr-shepherd:
|
|
53
|
+
process.stderr.write(`pr-shepherd: ${command}: ${String(e)}\n`);
|
|
53
54
|
process.exitCode = errorToExitCode(e);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -96,17 +97,3 @@ function parseJournalArgs(args) {
|
|
|
96
97
|
}
|
|
97
98
|
return { prNumber, extra };
|
|
98
99
|
}
|
|
99
|
-
function formatJournalResult(result) {
|
|
100
|
-
if (result.dryRun) {
|
|
101
|
-
const lines = ["Dry run — no body change written."];
|
|
102
|
-
if (result.previewBody !== undefined) {
|
|
103
|
-
lines.push("", result.previewBody);
|
|
104
|
-
}
|
|
105
|
-
return lines.join("\n");
|
|
106
|
-
}
|
|
107
|
-
if (!result.mutated)
|
|
108
|
-
return "No change — entry already present.";
|
|
109
|
-
if (!result.sectionExisted)
|
|
110
|
-
return `Created ## Shepherd Journal section in PR #${result.prNumber}.`;
|
|
111
|
-
return `Appended to ## Shepherd Journal in PR #${result.prNumber}.`;
|
|
112
|
-
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { AuthorType, CommentAuthorAssociation, SuggestionBlock } from "../types.mts";
|
|
2
|
+
import type { FirstLookThread, FirstLookComment } from "../types/report.mts";
|
|
3
|
+
export declare function renderAuthor(author: string, authorType?: AuthorType, authorAssociation?: CommentAuthorAssociation): string;
|
|
4
|
+
export declare function renderBodyPreview(body: string): string;
|
|
5
|
+
export declare function renderThreadResolutionStatusTag(t: {
|
|
6
|
+
isOutdated?: boolean;
|
|
7
|
+
isMinimized?: boolean;
|
|
8
|
+
}): string;
|
|
9
|
+
interface ThreadBulletInput {
|
|
10
|
+
id: string;
|
|
11
|
+
reviewId?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
path?: string | null;
|
|
14
|
+
startLine?: number | null;
|
|
15
|
+
line?: number | null;
|
|
16
|
+
author: string;
|
|
17
|
+
authorType?: AuthorType;
|
|
18
|
+
authorAssociation?: CommentAuthorAssociation;
|
|
19
|
+
body: string;
|
|
20
|
+
comments?: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
author: string;
|
|
23
|
+
authorType?: AuthorType;
|
|
24
|
+
authorAssociation?: CommentAuthorAssociation;
|
|
25
|
+
body: string;
|
|
26
|
+
url: string;
|
|
27
|
+
}>;
|
|
28
|
+
suggestion?: SuggestionBlock;
|
|
29
|
+
edited?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function renderThreadBullet(t: ThreadBulletInput, opts?: {
|
|
32
|
+
statusTag?: string;
|
|
33
|
+
renderSuggestion?: boolean;
|
|
34
|
+
noBody?: boolean;
|
|
35
|
+
suppressEditedMarker?: boolean;
|
|
36
|
+
}): string;
|
|
37
|
+
export declare function renderThreadConversation(t: ThreadBulletInput): string;
|
|
38
|
+
export declare function blockquote(body: string): string;
|
|
39
|
+
export declare function renderCommentBullet(c: {
|
|
40
|
+
id: string;
|
|
41
|
+
url?: string;
|
|
42
|
+
author: string;
|
|
43
|
+
authorType?: AuthorType;
|
|
44
|
+
authorAssociation?: CommentAuthorAssociation;
|
|
45
|
+
body: string;
|
|
46
|
+
}, opts?: {
|
|
47
|
+
statusTag?: string;
|
|
48
|
+
}): string;
|
|
49
|
+
export declare function renderEditedCommentTag(c: {
|
|
50
|
+
edited?: boolean;
|
|
51
|
+
}): string | undefined;
|
|
52
|
+
export declare function renderReviewBullet(r: {
|
|
53
|
+
id: string;
|
|
54
|
+
author: string;
|
|
55
|
+
authorType?: AuthorType;
|
|
56
|
+
authorAssociation?: CommentAuthorAssociation;
|
|
57
|
+
body?: string;
|
|
58
|
+
staleBotCr?: boolean;
|
|
59
|
+
staleReview?: boolean;
|
|
60
|
+
}, opts?: {
|
|
61
|
+
includeBody?: boolean;
|
|
62
|
+
}): string;
|
|
63
|
+
export declare function renderReviewListSection(heading: string, items: {
|
|
64
|
+
id: string;
|
|
65
|
+
author: string;
|
|
66
|
+
authorType?: AuthorType;
|
|
67
|
+
authorAssociation?: CommentAuthorAssociation;
|
|
68
|
+
body?: string;
|
|
69
|
+
}[]): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Build bullet strings for the `## First-look items` section.
|
|
72
|
+
* Threads that also appear in resolutionOnlyIds have their body suppressed
|
|
73
|
+
* (already shown in `## Review threads to resolve`).
|
|
74
|
+
*/
|
|
75
|
+
export declare function buildFirstLookBullets(firstLookThreads: FirstLookThread[], resolutionOnlyIds: Set<string>, firstLookComments: FirstLookComment[]): string[];
|
|
76
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { renderLineRange, renderSuggestionBlock } from "./suggestion-renderer.mjs";
|
|
2
2
|
import { threadComments } from "../threads/transcript.mjs";
|
|
3
3
|
const BODY_PREVIEW_MAX = 100;
|
|
4
|
-
export function renderAuthor(author, authorType) {
|
|
5
|
-
return
|
|
4
|
+
export function renderAuthor(author, authorType, authorAssociation) {
|
|
5
|
+
return [`@${author}`, authorType, authorAssociation].filter(Boolean).join(" · ");
|
|
6
6
|
}
|
|
7
7
|
export function renderBodyPreview(body) {
|
|
8
8
|
const normalizedBody = body.replace(/\r\n?/g, "\n");
|
|
@@ -30,7 +30,7 @@ export function renderThreadBullet(t, opts = {}) {
|
|
|
30
30
|
const editedMarker = t.edited && !opts.suppressEditedMarker ? " [edited since first look]" : "";
|
|
31
31
|
const reviewMarker = t.reviewId ? ` [reviewId=${t.reviewId}]` : "";
|
|
32
32
|
const statusSuffix = opts.statusTag ? ` ${opts.statusTag}` : "";
|
|
33
|
-
const bulletLine = `- \`threadId=${t.id}\`${link} ${loc} (${renderAuthor(t.author, t.authorType)})${reviewMarker}${suggestionMarker}${editedMarker}${statusSuffix}`;
|
|
33
|
+
const bulletLine = `- \`threadId=${t.id}\`${link} ${loc} (${renderAuthor(t.author, t.authorType, t.authorAssociation)})${reviewMarker}${suggestionMarker}${editedMarker}${statusSuffix}`;
|
|
34
34
|
if (!opts.noBody && (!t.comments || t.comments.length === 0)) {
|
|
35
35
|
const legacyLine = `${bulletLine}: ${renderBodyPreview(t.body)}`;
|
|
36
36
|
return t.suggestion && opts.renderSuggestion
|
|
@@ -53,9 +53,9 @@ export function renderThreadConversation(t) {
|
|
|
53
53
|
.map((c) => {
|
|
54
54
|
const heading = c.id
|
|
55
55
|
? c.url
|
|
56
|
-
? `#### [commentId=${c.id}](${c.url}) (${renderAuthor(c.author, c.authorType)})`
|
|
57
|
-
: `#### \`commentId=${c.id}\` (${renderAuthor(c.author, c.authorType)})`
|
|
58
|
-
: `#### (${renderAuthor(c.author, c.authorType)})`;
|
|
56
|
+
? `#### [commentId=${c.id}](${c.url}) (${renderAuthor(c.author, c.authorType, c.authorAssociation)})`
|
|
57
|
+
: `#### \`commentId=${c.id}\` (${renderAuthor(c.author, c.authorType, c.authorAssociation)})`
|
|
58
|
+
: `#### (${renderAuthor(c.author, c.authorType, c.authorAssociation)})`;
|
|
59
59
|
return `${heading}\n\n${blockquote(c.body)}`;
|
|
60
60
|
})
|
|
61
61
|
.join("\n\n");
|
|
@@ -73,7 +73,7 @@ function renderThreadCommentBullets(t) {
|
|
|
73
73
|
const link = c.url ? ` [↗](${c.url})` : "";
|
|
74
74
|
const id = c.id ? `\`commentId=${c.id}\`` : "comment";
|
|
75
75
|
return [
|
|
76
|
-
` - ${id}${link} (${renderAuthor(c.author, c.authorType)})`,
|
|
76
|
+
` - ${id}${link} (${renderAuthor(c.author, c.authorType, c.authorAssociation)})`,
|
|
77
77
|
indentBlockquote(c.body, " "),
|
|
78
78
|
].join("\n");
|
|
79
79
|
})
|
|
@@ -88,13 +88,13 @@ function indentBlockquote(body, indent) {
|
|
|
88
88
|
export function renderCommentBullet(c, opts = {}) {
|
|
89
89
|
const link = c.url ? ` [↗](${c.url})` : "";
|
|
90
90
|
const statusSuffix = opts.statusTag ? ` ${opts.statusTag}` : "";
|
|
91
|
-
return `- \`commentId=${c.id}\`${link} (${renderAuthor(c.author, c.authorType)})${statusSuffix}: ${renderBodyPreview(c.body)}`;
|
|
91
|
+
return `- \`commentId=${c.id}\`${link} (${renderAuthor(c.author, c.authorType, c.authorAssociation)})${statusSuffix}: ${renderBodyPreview(c.body)}`;
|
|
92
92
|
}
|
|
93
93
|
export function renderEditedCommentTag(c) {
|
|
94
94
|
return c.edited ? "[edited since first look]" : undefined;
|
|
95
95
|
}
|
|
96
96
|
export function renderReviewBullet(r, opts = {}) {
|
|
97
|
-
const base = `- \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType)})`;
|
|
97
|
+
const base = `- \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`;
|
|
98
98
|
const staleTag = r.staleReview
|
|
99
99
|
? " [stale — review is on an old commit, all threads resolved]"
|
|
100
100
|
: "";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ParseMarkFilesAsViewedResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
files: string[];
|
|
4
|
+
tests: boolean;
|
|
5
|
+
matchPatterns: string[];
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseMarkFilesAsViewedArgs(args: string[]): ParseMarkFilesAsViewedResult;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handlePoll(args: string[]): Promise<void>;
|