coduck 0.15.1__py3-none-any.whl
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.
- coduck/SKILL.md +309 -0
- coduck/__init__.py +1 -0
- coduck/__main__.py +3 -0
- coduck/cli.py +517 -0
- coduck/driver.py +221 -0
- coduck/git.py +547 -0
- coduck/gitattributes +53 -0
- coduck/migrations.py +188 -0
- coduck/page/actions.js +459 -0
- coduck/page/app.js +785 -0
- coduck/page/blocks.js +844 -0
- coduck/page/core.js +821 -0
- coduck/page/dialogs.css +425 -0
- coduck/page/edits.js +205 -0
- coduck/page/favicon.svg +2 -0
- coduck/page/files.css +725 -0
- coduck/page/files.js +693 -0
- coduck/page/index.html +37 -0
- coduck/page/list.css +937 -0
- coduck/page/list.js +535 -0
- coduck/page/picker.js +426 -0
- coduck/page/review.js +882 -0
- coduck/page/runs.css +938 -0
- coduck/page/runs.js +1089 -0
- coduck/page/state.js +293 -0
- coduck/page/style.css +845 -0
- coduck/page/tasks.css +698 -0
- coduck/page/tasks.js +508 -0
- coduck/page/tasktab.js +481 -0
- coduck/page/threads.css +972 -0
- coduck/page/threads.js +648 -0
- coduck/page/vendor/highlight.js.LICENSE +29 -0
- coduck/page/vendor/highlight.min.js +1244 -0
- coduck/page/vendor/hljs-github.min.css +10 -0
- coduck/page/vendor/markdown-it.LICENSE +22 -0
- coduck/page/vendor/markdown-it.min.js +2 -0
- coduck/page/vendor/mermaid.LICENSE +21 -0
- coduck/page/vendor/mermaid.min.js +2811 -0
- coduck/review.py +2559 -0
- coduck/runs.py +1303 -0
- coduck/schema/1/edit.schema.json +32 -0
- coduck/schema/1/event.schema.json +241 -0
- coduck/schema/1/review.schema.json +86 -0
- coduck/schema/2/edit.schema.json +32 -0
- coduck/schema/2/event.schema.json +118 -0
- coduck/schema/2/review.schema.json +94 -0
- coduck/schema/3/edit.schema.json +32 -0
- coduck/schema/3/event.schema.json +129 -0
- coduck/schema/3/note.schema.json +36 -0
- coduck/schema/3/review.schema.json +92 -0
- coduck/schema/4/edit.schema.json +32 -0
- coduck/schema/4/event.schema.json +138 -0
- coduck/schema/4/note.schema.json +36 -0
- coduck/schema/4/review.schema.json +92 -0
- coduck/schema/5/edit.schema.json +32 -0
- coduck/schema/5/event.schema.json +138 -0
- coduck/schema/5/note.schema.json +36 -0
- coduck/schema/5/review.schema.json +92 -0
- coduck/schema/5/spec.schema.json +55 -0
- coduck/schema/6/edit.schema.json +32 -0
- coduck/schema/6/event.schema.json +138 -0
- coduck/schema/6/note.schema.json +36 -0
- coduck/schema/6/review.schema.json +92 -0
- coduck/schema/6/spec.schema.json +55 -0
- coduck/server.py +335 -0
- coduck/tasks.py +380 -0
- coduck-0.15.1.dist-info/METADATA +1406 -0
- coduck-0.15.1.dist-info/RECORD +74 -0
- coduck-0.15.1.dist-info/WHEEL +4 -0
- coduck-0.15.1.dist-info/entry_points.txt +3 -0
- coduck-0.15.1.dist-info/licenses/LICENSE +21 -0
- coduck-0.15.1.dist-info/licenses/src/coduck/page/vendor/highlight.js.LICENSE +29 -0
- coduck-0.15.1.dist-info/licenses/src/coduck/page/vendor/markdown-it.LICENSE +22 -0
- coduck-0.15.1.dist-info/licenses/src/coduck/page/vendor/mermaid.LICENSE +21 -0
coduck/SKILL.md
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coduck
|
|
3
|
+
description: Work with local code reviews in CoDuck, which keeps each review of a branch in a git ref of its repo and shows it to the reviewer in a web page served on localhost. Use when you are asked for a review of a branch in CoDuck, or your instructions say an effort's work is reviewed there; covers the name you write under, opening the review and writing its description, the loop of reading what waits on you, answering and waiting, posting a message for the reviewer when they tell you to, taking in the reviewer's edits with coduck pull and committing them, changing the base and the project, writing and checking epic and task files, the states of a review, what an approval means and the ready signal you give after it, notes, how a review ends with Done, and what you never do.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Work with a CoDuck review
|
|
7
|
+
|
|
8
|
+
CoDuck keeps a review of a branch in the branch's repo, under its own ref, and the reviewer reads it in the page
|
|
9
|
+
that CoDuck's server serves at `http://localhost:PORT/r/REPO/N`: PORT is the server's port, 8090 unless you are
|
|
10
|
+
told otherwise, REPO the repo's name and N the review's number. The reviewer comments on lines, edits Markdown files
|
|
11
|
+
and the description, applies suggestions and approves, all in the page, and marks the review done once its work has
|
|
12
|
+
landed or is dropped; CoDuck does not merge. You, the author, open the review, answer the reviewer and take their
|
|
13
|
+
edits in, all with the `coduck` command, run in the worktree that has the branch checked out; `-r N` names review N
|
|
14
|
+
of the repo the command runs in, since each repo numbers its reviews from 1. From another folder, start the command
|
|
15
|
+
as `coduck -n NAME -C DIR COMMAND`, which runs it as if it was started in DIR, or name the review as `-r REPO/N`,
|
|
16
|
+
the form `coduck list` prints. `pull` takes edits into the worktree it runs in, so from elsewhere point it at that
|
|
17
|
+
worktree with `-C`. Every command has `-h`.
|
|
18
|
+
|
|
19
|
+
## The name you write under
|
|
20
|
+
|
|
21
|
+
Pass `-n NAME` on every coduck command that works on a review, before the command's name, with the name under
|
|
22
|
+
which the user, the person who directs your session and may be the reviewer too, and other sessions find your
|
|
23
|
+
session: `coduck -n NAME show -u`. Use the same name throughout a review, since `wait` and `show -u` tell your own
|
|
24
|
+
writes from news by it. The reviewer sees the name on your messages and on the other events you add to the threads
|
|
25
|
+
and the conversation; a description you replace still shows the name the review was opened under, and so does the
|
|
26
|
+
review's row in the list. Leave `-n` out when your session has no such name: every command then writes under the
|
|
27
|
+
git setting `coduck.cliuser`, `agent` unless set, which other sessions may share. Do not set `coduck.cliuser` to
|
|
28
|
+
your session's name: the setting belongs to the repo, the user or the machine, and every session that passes no
|
|
29
|
+
`-n` writes under it. The page writes under the reviewer's name, the git setting `coduck.webuser`, and a command
|
|
30
|
+
refuses that name with `-n`. Where an example shows `-n NAME`, put your session's name in its place.
|
|
31
|
+
|
|
32
|
+
## Opening a review
|
|
33
|
+
|
|
34
|
+
Open a review when you are asked for a review of a branch in CoDuck, or when your instructions say the effort's
|
|
35
|
+
work is reviewed there. Commit the work first, as your rules for commits allow, then write the description to a file
|
|
36
|
+
and open the review:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
coduck -n NAME open description.md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
It prints `opened review N of BRANCH in REPO`. Tell the reviewer the review is open, with the address of its page,
|
|
43
|
+
`http://localhost:PORT/r/REPO/N`. A branch has one open review at a time; once that review is done, a new one gets a
|
|
44
|
+
new number.
|
|
45
|
+
|
|
46
|
+
When your instructions give the effort a name, pass it as the review's project with `-p`, so that the reviewer finds
|
|
47
|
+
the review in the project's view of the list, beside the effort's reviews in other repos:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
coduck -n NAME open -p coduck-list description.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
A project name is lowercase letters and digits in words joined by single hyphens, at most 64 characters.
|
|
54
|
+
|
|
55
|
+
The review is against the branch origin's `HEAD` names when that names an existing branch (a `HEAD` that names none
|
|
56
|
+
counts as no `HEAD`), otherwise `main`, otherwise `master`. Name another base with `-b`: a local branch
|
|
57
|
+
(`-b feature-x`) or a remote tracking branch (`-b origin/main`). A branch stacked on another branch under review is
|
|
58
|
+
opened against that branch.
|
|
59
|
+
|
|
60
|
+
The description is Markdown. Its first line that is not empty, without its leading `#` marks, is the review's title:
|
|
61
|
+
start the file with `# <title>`, a few words in the imperative that name the change, at most 60 characters. Write
|
|
62
|
+
the rest for a reviewer who has a minute: what the branch changes and why, and what to look at first. The file is
|
|
63
|
+
plain Markdown, with no outer fence. The reviewer may edit the description in the page, so read it with `coduck -n
|
|
64
|
+
NAME show` before you replace it with `coduck -n NAME describe FILE`.
|
|
65
|
+
|
|
66
|
+
## The loop
|
|
67
|
+
|
|
68
|
+
1. `coduck -n NAME show -u` prints only what waits on you: every thread that is open, the conversation among them,
|
|
69
|
+
whose last word is another name's (a message, a reopen, an applied suggestion or a verdict; a change of base or
|
|
70
|
+
of project is no one's word), and the pending edits. A resolved thread is not open. Its last line is
|
|
71
|
+
`version: <id>`; keep that id. Without `-u`, `show` prints the review's title, branches and state, its
|
|
72
|
+
description, every thread and the pending edits; `-j` prints JSON with the version as a field.
|
|
73
|
+
2. Act on each item: answer every thread that waits on you, change what was asked, and take pending edits in with
|
|
74
|
+
`coduck -n NAME pull` (below).
|
|
75
|
+
3. Wait with the version from step 1, not a later one:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
coduck -n NAME wait -s <id>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Run it so that you are told when it ends, for example as a background command. Where nothing can tell you, give
|
|
82
|
+
it a time limit with `-t SECONDS`, and when it ends without news, go back to step 1 and wait again. It never
|
|
83
|
+
reads standard input. It returns as soon as someone writing under a name other than yours, the reviewer or
|
|
84
|
+
another session, has added something after that version (a message, a resolve, an edit, a new description, a
|
|
85
|
+
change of base or of project, the ready signal), or anyone has marked the review done, prints what arrived, and
|
|
86
|
+
exits 0. A note, a run specification and a migration of the review are no news. Because it counts from the
|
|
87
|
+
version `show` printed,
|
|
88
|
+
nothing that arrived while you acted is missed. Then go back to step 1.
|
|
89
|
+
|
|
90
|
+
Without `-t`, `wait` has no time limit: leave it running for as long as the reviewer takes, and do not poll `show`
|
|
91
|
+
in a loop instead. It exits 1 when the time that `-t` gives runs out, or when it was refused, with a message that
|
|
92
|
+
says why. If your session has to stop while the review is open, say in your last message the state of review N, as
|
|
93
|
+
`coduck list` or `show` prints it, and what you leave unfinished on it.
|
|
94
|
+
|
|
95
|
+
What another session writes on your review, under another name, is news for you as the reviewer's is, a note
|
|
96
|
+
and a run specification left out: `wait` wakes on it, and `show -u` lists a thread where it has the last word. Answer what is asked of you, and leave what is asked
|
|
97
|
+
of someone else.
|
|
98
|
+
|
|
99
|
+
## Answering
|
|
100
|
+
|
|
101
|
+
- `coduck -n NAME reply THREAD FILE` adds a message to a thread; `-` reads it from standard input, so a heredoc
|
|
102
|
+
works. The general conversation is the thread `conversation`. Answer each thread that waits on you, also when the
|
|
103
|
+
answer is only what you changed and in which commit.
|
|
104
|
+
- A thread whose lines changed after it was written is outdated: `show` prints `outdated` and the lines it was
|
|
105
|
+
written on, and, where git's diff from that commit to the head put those lines, their place, as
|
|
106
|
+
`outdated, placed at lines 18 to 19`. The place is where those lines went: on the lines that replaced them, or,
|
|
107
|
+
when they were removed, on the line before them, or on line 1 when nothing is before them; so it can be wider or
|
|
108
|
+
narrower than the thread was. The reviewer sees the thread there too. An outdated thread stays open until it is
|
|
109
|
+
resolved: answer it as any other, saying what became of its lines.
|
|
110
|
+
- `coduck -n NAME comment PATH:N-M FILE`, or `PATH:N` for one line, starts a thread on those lines of the branch
|
|
111
|
+
head, for a question to the reviewer; the word `old` before FILE puts it on the lines of the merge base.
|
|
112
|
+
- A question for the reviewer about this branch goes into its review: on the lines it concerns with
|
|
113
|
+
`coduck -n NAME comment`, or in the conversation when it concerns no line. The reviewer reads it with the code
|
|
114
|
+
beside it, and the answer wakes your `wait`. Say what is to decide, the options with what each costs, and your
|
|
115
|
+
recommendation. A question that blocks all your work, or is about no branch, goes where your instructions for
|
|
116
|
+
questions say.
|
|
117
|
+
- A thread is named by its review, `REPO/N`, and its id, and a comment by its number in the thread, counted from
|
|
118
|
+
1; the reviewer's page has an address for each, `/r/REPO/N/thread/ID` and `/r/REPO/N/thread/ID/K`, which you can
|
|
119
|
+
give to the reviewer or to another session.
|
|
120
|
+
- `coduck -n NAME reply -w THREAD FILE` and `coduck -n NAME comment -w PATH:N FILE` post a message for the
|
|
121
|
+
reviewer: it is the reviewer's message, under the reviewer's name and on their side, and it records your name as
|
|
122
|
+
the one it came through. Post for the reviewer only when the reviewer told you to, in your own session, and only
|
|
123
|
+
what they confirmed: it is their word in the review, under your name as its carrier. It is news for every other
|
|
124
|
+
name and none for yours, so post for the reviewer under a name of your own, never under the name of a session
|
|
125
|
+
that waits on the review, which would then not wake. Only messages can be posted so: `-w` exists on `reply` and
|
|
126
|
+
`comment` alone.
|
|
127
|
+
- Leave resolving to the reviewer unless you are asked to resolve a thread (`coduck -n NAME resolve THREAD`, and
|
|
128
|
+
`coduck -n NAME reopen THREAD`).
|
|
129
|
+
- A suggestion in a message of the reviewer's is theirs to apply in the page. Once applied, it reaches you as a
|
|
130
|
+
pending edit.
|
|
131
|
+
|
|
132
|
+
## Taking in the reviewer's edits
|
|
133
|
+
|
|
134
|
+
The reviewer's edits of files wait in the review as pending edits; the page never moves your branch.
|
|
135
|
+
`coduck -n NAME pull` applies them to your worktree and its index, in the order they were made, and marks them
|
|
136
|
+
taken; it commits nothing. It prints each edit with the name of its author after `by`, which is the reviewer's name
|
|
137
|
+
in the page. It needs the review's branch checked out in your worktree, no uncommitted change to a tracked file
|
|
138
|
+
(untracked files are fine, staged ones are not), and no merge, cherry pick, revert or rebase in progress.
|
|
139
|
+
|
|
140
|
+
Then commit what it applied with `git commit`, as your rules for commits allow, in a message that starts with that
|
|
141
|
+
name in square brackets: for a reviewer called Ada, `[Ada] Shorter troubleshooting paragraph`. Commit at once: an
|
|
142
|
+
edit counts as taken as soon as pull applies it, but only the commit puts it on the branch. Until the commit, the
|
|
143
|
+
page also takes no further change from the reviewer to a file whose edit you pulled. When your rules do not let you
|
|
144
|
+
commit what pull applied, say so in the conversation, since the reviewer cannot change that file again until the
|
|
145
|
+
change is committed.
|
|
146
|
+
|
|
147
|
+
- An edit can add a file or remove one, and pull stages it as such. The reviewer's changes on the review's Tasks
|
|
148
|
+
tab arrive this way: a new task is a new file and a line more in its epic.
|
|
149
|
+
- A later edit of a file that the reviewer made on top of an earlier pending one replaces it. An edit is the whole
|
|
150
|
+
text of the file, so the later one holds the earlier one's change: the earlier one is withdrawn and never
|
|
151
|
+
applied, and pull applies the later one. Its line ends with `; it replaces edit <id>`, or with
|
|
152
|
+
`; it replaces edits <id> and <id>` when it replaced more, oldest first, also those that the edits it replaced
|
|
153
|
+
had replaced in turn; the line of an edit that clashes ends the same way.
|
|
154
|
+
- An edit that clashes with the branch leaves git's conflict markers in the file, counts as taken and ends the
|
|
155
|
+
pull. Resolve the markers, stage the file and commit as above, then pull again for the edits after it.
|
|
156
|
+
- An edit git cannot apply at all stays pending, and pull says why. Tell the reviewer in the thread or the
|
|
157
|
+
conversation.
|
|
158
|
+
- Pull exits 1 in both cases, and 0 when every edit was taken.
|
|
159
|
+
- A pull that stops halfway leaves its edit staged and still pending. Committing the staged change and pulling
|
|
160
|
+
again marks the edit taken; discarding it and pulling again applies it again.
|
|
161
|
+
|
|
162
|
+
Take edits in soon after they arrive: an edit still pending when the review is marked done is never taken in.
|
|
163
|
+
Before you give the ready signal, or tell the reviewer the branch is worth another look, run `coduck -n NAME pull`
|
|
164
|
+
and commit what it applied, so that no edit of theirs still waits.
|
|
165
|
+
|
|
166
|
+
## Code and what it printed
|
|
167
|
+
|
|
168
|
+
To show Python or SQL together with what it printed, in a comment, the description, a note or a Markdown file, write
|
|
169
|
+
a runnable block and an output block after it. You run the code yourself, in your shell; the page runs nothing for
|
|
170
|
+
you, and the output block records what the code printed and what it ran on.
|
|
171
|
+
|
|
172
|
+
- **The block.** Open its fence with `sql run` or `python run`. Blocks of one kind in one text that carry the same
|
|
173
|
+
file name after `run`, as `python run invoice.py`, are the parts of one script, run in order as one file; a
|
|
174
|
+
`sql run` and a `python run` block of one name are two scripts. Name only blocks that share state, and run them
|
|
175
|
+
together as one script. A name holds letters a to z in either case, digits, dots, hyphens and underscores, at
|
|
176
|
+
most 64 characters, and names no folder: `.` and `..` are no names.
|
|
177
|
+
- **The output.** Right after the block, with a blank line between, one fenced block per configuration you ran it
|
|
178
|
+
on: `output v1`, the header lines, one empty line, and the text as it was printed, errors included. You may edit
|
|
179
|
+
an output as you may edit the code; CoDuck reads it as you leave it.
|
|
180
|
+
|
|
181
|
+
````markdown
|
|
182
|
+
```output v1
|
|
183
|
+
duckdb: 2.0.1 (8d78114e90)
|
|
184
|
+
|
|
185
|
+
the text as printed
|
|
186
|
+
```
|
|
187
|
+
````
|
|
188
|
+
|
|
189
|
+
- **The header lines.** Every line is optional: write those that say something, and with none the block starts with
|
|
190
|
+
the empty line. `duckdb`: the version and source id, as `duckdb -version` prints them (`v2.0.1 (Cyanoptera)
|
|
191
|
+
8d78114e90` will do as it is). `python`: the interpreter's version. `packages`: the packages the code loaded
|
|
192
|
+
besides duckdb, as `pandas 2.2.3, numpy 2.1.0`. `extensions`: the DuckDB extensions it loaded, those built in
|
|
193
|
+
left out. `exit`: the exit status, when it is not 0. `stopped`: why the run ended before the code did, as
|
|
194
|
+
`time limit 60 s`, or why the later parts of a script did not run.
|
|
195
|
+
- **Tables.** Run SQL in DuckDB's command line program with its default output, so that the page reads its tables
|
|
196
|
+
into cells; with DuckDB 2.0 or later pass `-no-agent`, since in an agent's shell it prints another form otherwise.
|
|
197
|
+
- A text that holds a line of three backticks needs a longer fence around its output block, four or more.
|
|
198
|
+
- An output belongs to the block right above it. When you change the code, run it again and replace its outputs,
|
|
199
|
+
or remove them: CoDuck does not tell an output that is out of date from one that is not.
|
|
200
|
+
|
|
201
|
+
## Epic and task files
|
|
202
|
+
|
|
203
|
+
An epic is a Markdown file whose name ends in `.epic.md`, and a task one whose name ends in `.task.md`, in any
|
|
204
|
+
folder of any repo. The reviewer reads and changes them on the Tasks tab of a review, where each change becomes a
|
|
205
|
+
pending edit for you to take in, so write them in the form the page reads:
|
|
206
|
+
|
|
207
|
+
- **The header.** A task file opens with a header: a line of three hyphens, its fields, and a second line of three
|
|
208
|
+
hyphens. A field is `key: value`, or `key:` followed by lines ` - item`, or `key: [item, item]`. Every value is
|
|
209
|
+
text. The header takes no comment, no empty line and no value inside a value.
|
|
210
|
+
- **A task's fields.** `state`, which every task has: `todo`, `in progress`, `paused`, `complete` or `cancelled`.
|
|
211
|
+
`waits-for`, the task files it waits for, each as a plain path from the task's own folder. `pull-requests`, each as
|
|
212
|
+
`owner/repo#N`, never a bare `#N`. Any other field is kept and shown as written.
|
|
213
|
+
- **A task's title** is its first level one heading.
|
|
214
|
+
- **An epic's tasks.** A list item of the epic whose first line is a marker and then a link to a task file, as
|
|
215
|
+
`- [Title](tasks/name.task.md)`, is one of its tasks, in the order of the text. What the item holds after its first
|
|
216
|
+
paragraph, indented under it, is the task's summary in the epic. A link to a task file anywhere else is only a
|
|
217
|
+
mention.
|
|
218
|
+
- **An epic's header** is optional. Its `project` field is the project name that reviews carry (the `-p` of
|
|
219
|
+
`coduck -n NAME open`), and the page lists the project's other open reviews beside the epic.
|
|
220
|
+
|
|
221
|
+
Before you commit a change to an epic or a task file, run `coduck check` in the worktree. It reads every such file
|
|
222
|
+
below the current folder that git tracks or would add, or the files and folders you name, and prints each problem as
|
|
223
|
+
`path:line: problem`: a header it cannot read, a missing or unknown state, a path in `waits-for` that names no task
|
|
224
|
+
file, tasks that wait for each other in a circle, a pull request in another form, a project that is no project name.
|
|
225
|
+
It reads headers, not an epic's list: that every task item's file exists is for you to see to, and the Tasks tab
|
|
226
|
+
shows where one does not. It exits 0 when there is no problem, 1 when there is one, and 2 for a path it cannot check;
|
|
227
|
+
it needs no review and writes nothing.
|
|
228
|
+
|
|
229
|
+
## Changing the base
|
|
230
|
+
|
|
231
|
+
When the branch your review is stacked on lands, for example once it is merged into `main`, point your review at the
|
|
232
|
+
new base with `coduck -n NAME base main`, and merge or rebase `main` into your branch as your rules allow. The
|
|
233
|
+
change is one more commit on the review, which the reviewer sees in the conversation; threads on your lines follow
|
|
234
|
+
them through a rebase. A review whose base is gone shows no changes until its base is changed. The
|
|
235
|
+
reviewer can change the base in the page too.
|
|
236
|
+
|
|
237
|
+
## Changing the project
|
|
238
|
+
|
|
239
|
+
`coduck -n NAME project PROJECT` puts the review in another project, and `coduck -n NAME project -d` takes it out
|
|
240
|
+
of its project; naming the project it has already changes nothing. Use it when you opened the review without `-p`,
|
|
241
|
+
or when you are asked to. The reviewer can change the project in the page too. When `wait` wakes on a change of
|
|
242
|
+
project, it added nothing for you to answer: act on what `show -u` shows, and wait again when that is nothing.
|
|
243
|
+
|
|
244
|
+
## The state of the review
|
|
245
|
+
|
|
246
|
+
An open review needs input, is approved, or is ready; `coduck list` and `coduck -n NAME show` print the state. It
|
|
247
|
+
is approved while the reviewer's latest verdict is an approval and nothing changed since. A change is another head
|
|
248
|
+
of the branch than the one the approval saw (a new commit, and also a reset, a rebase or a deleted branch), a new
|
|
249
|
+
description or base, a message by either side (a reply, a new thread, a message in the conversation), or a thread
|
|
250
|
+
opened again; a change takes an approved or ready review back to needs input. A note, a run specification, `pull`,
|
|
251
|
+
a resolve, a change of project and the ready signal are no change.
|
|
252
|
+
|
|
253
|
+
## When the reviewer approves
|
|
254
|
+
|
|
255
|
+
An approval means the reviewer is satisfied with the branch as it stands. An approval is no permission to push,
|
|
256
|
+
merge or commit elsewhere, which keep their own rules. Go on with what your instructions say comes after a review.
|
|
257
|
+
After an approval, finish what you have in flight, add the notes the reviewer needs for the next step (such as a
|
|
258
|
+
link that opens the pull request), then say `coduck -n NAME ready` last. What you write or commit after that and
|
|
259
|
+
is a change takes the review back to needs input, so say in plain words what happened and why, for a reader who did
|
|
260
|
+
not see what you saw. `ready` is refused unless the review is approved with no change since, and changes nothing on
|
|
261
|
+
a review that is ready already. The reviewer sees the ready signal as new until they write or you write again; once
|
|
262
|
+
the next step has happened (the pull request exists, the branch was merged), write the note that says where the work
|
|
263
|
+
went, which also takes that mark away. Keep waiting: the review is still open, so that later changes, such as a fix
|
|
264
|
+
for a check that fails upstream, come back to the reviewer in the same review.
|
|
265
|
+
|
|
266
|
+
## Notes
|
|
267
|
+
|
|
268
|
+
A note is a fact about the review that nobody needs to answer, such as where its pull request is or which review
|
|
269
|
+
it waits for. Use notes sparingly. A note is no log of what happened, and what needs the reviewer's attention is a
|
|
270
|
+
message: a failed check is a message or a commit, never a note. A note changes no state and wakes nobody.
|
|
271
|
+
|
|
272
|
+
- `coduck -n NAME note FILE` adds a note, the Markdown of FILE or `-` for standard input, and prints its id.
|
|
273
|
+
- `coduck -n NAME note -e ID FILE` changes note ID, and `coduck -n NAME note -d ID` removes it.
|
|
274
|
+
|
|
275
|
+
Change or remove only notes you added. `show` lists the notes with their ids and who wrote them.
|
|
276
|
+
|
|
277
|
+
## When the review is done
|
|
278
|
+
|
|
279
|
+
Done ends a review, once its work has landed or is dropped. `wait` reports it, also when you marked it done
|
|
280
|
+
yourself; stop waiting then, and clean up as after any finished work. A done review takes messages, in its threads
|
|
281
|
+
and its conversation, notes, run specifications, which only the page writes, and a change of project, and refuses
|
|
282
|
+
every other change, as do reviews that an older
|
|
283
|
+
CoDuck merged or closed. Its branch is free for a new review. Run `coduck -n NAME done` only when the reviewer
|
|
284
|
+
asks. Done takes no note: where the work landed goes into a note, in which the page shows a pull request written as
|
|
285
|
+
`owner/repo#N`, and an `http://` or `https://` address, as a link.
|
|
286
|
+
|
|
287
|
+
## What you never do
|
|
288
|
+
|
|
289
|
+
- CoDuck does not merge: merging a branch into its base or another branch is ordinary git work under your own
|
|
290
|
+
rules for commits and pushes, which CoDuck neither does nor stands in the way of. After a branch landed, a note
|
|
291
|
+
says where it went, and the review is marked done when the reviewer asks.
|
|
292
|
+
- Mark the review done, unless the reviewer asks you to.
|
|
293
|
+
- Run `coduck push`, which sends a repo's reviews to an archive, unless you are asked to.
|
|
294
|
+
- Run `coduck key`, or start, read or stop a run of a code block. The key it prints lets whoever holds it run code
|
|
295
|
+
as the user, and it is the reviewer's, for the page alone. A run happens only when the reviewer presses Run in the
|
|
296
|
+
page.
|
|
297
|
+
|
|
298
|
+
## Other commands
|
|
299
|
+
|
|
300
|
+
`coduck list` shows the open reviews of every registered repo, each with its state, a registered repo being one on
|
|
301
|
+
the server's list, to which `coduck open` adds its repo. `coduck version` prints the version of CoDuck
|
|
302
|
+
that is installed, as `coduck X.Y.Z`, for a report about CoDuck. `coduck bundle FILE` writes a repo's review refs
|
|
303
|
+
to a git bundle, and `coduck register` lists a repo whose review refs came back from one; a backup and a restore
|
|
304
|
+
use them, and you do not need to. Reviews that come back from a bundle made before their format changed need
|
|
305
|
+
`coduck migrate` after `register`. `coduck migrate` brings the reviews of every registered repo to the format the
|
|
306
|
+
installed CoDuck reads. When a command refuses a review as being in an older format, tell the user so, and run
|
|
307
|
+
`coduck migrate` only when asked, since it changes every review in an older format, in every registered repo.
|
|
308
|
+
A review that a version named redline wrote is in an older format too: it sits under `refs/redline/<number>` until
|
|
309
|
+
the migration moves it to `refs/coduck/<number>`.
|
coduck/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""A local review tool that keeps code reviews in git refs."""
|
coduck/__main__.py
ADDED