CoDuck
CoDuck is a code review tool for one machine. The author of a branch, usually an agent, opens a review with the
coduck command; the reviewer reads it in a web page served on localhost, comments on lines, edits Markdown
files and approves. Every review lives in the repo of its branch as a git ref of its own, refs/coduck/<number>,
and changes only by a new commit on that ref. CoDuck never merges, never fetches and never moves a branch.
This file is the user documentation: a quickstart first, then every feature in detail. Every command also
explains itself with -h, and coduck skill prints the instructions for agents that ship with the installed
version.
Quickstart
You need git, Python 3.12 or newer, and uv. CoDuck is developed and run on Linux. It is not tested on macOS, where the limits on a run's memory and processes do not exist. It does not run on Windows, which lacks the file locks and process groups it uses.
-
Install the command from PyPI:
uv tool install coduck coduck -h
Or from a release tag of a clone of CoDuck's repository, the newest tag in place of
v0.16.0. An install from a tag, not from the working files, keeps a running server on code that does not change under it.git clone <the URL of CoDuck's repository> coduck uv tool install "git+file://$PWD/coduck@v0.16.0"
-
Start the server and leave it running. It serves every registered repo, on 127.0.0.1 only; opening a review registers its repo.
coduck serveIt prints
listening on http://127.0.0.1:8090/. To run it as a service that survives a logout, and to reach it from another machine through an ssh port forward, see deploy/install.md. -
Open a review, as the author, in the worktree that has the branch checked out. Commit the work first, write the description to a Markdown file whose first line is the title, a few words that name the change in at most 60 characters, and run:
coduck -n docs-session open description.md
It prints
opened review 1 of feature in myrepo. The review is against the default branch of the repo; name another base with-b.-ngives the name the command writes under, heredocs-session; see Names. -
Review it, as the reviewer, at
http://localhost:8090/. The list shows the review under "Open", marked as new for you. Open it, read the description on the Overview tab and the diffs on the Files changed tab, and click a line number to comment. In Scratch mode, the default, your comments and edits are drafts until you press Post all. -
Answer, as the author, under the same name.
show -uprints what waits on you and ends with the review's version;waitreturns when the reviewer, or another session under another name, has added something other than a note after that version.coduck -n docs-session show -u coduck -n docs-session reply 0f5f6ffc answer.md coduck -n docs-session wait -s <version>
When the reviewer edited a file in the page, take the edit into your worktree and commit it, here for a reviewer called Ada:
coduck -n docs-session pull git commit -m "[Ada] Shorter troubleshooting paragraph"
-
Finish. When the reviewer is satisfied they approve, which keeps the review open for later changes. The author finishes what is still in flight, such as a push for a pull request, and then says so:
coduck -n docs-session ready
Once the branch has landed, by a pull request or an ordinary
git mergeoutside CoDuck, or the work is dropped, the reviewer presses Done. The review leaves the open sections of the list and its branch is free for a new review.
Concepts
- Review. A branch of a repo, offered for review against a base branch. A branch has at most one open review.
Reviews are numbered from 1 in each repo, and a review is named
<repo>/<number>, the repo being the folder name of its main worktree. Two registered repos cannot share that name:coduck openandcoduck registerrefuse a repo whose name another registered repo has. - Base. The branch the review is against: a local branch or a remote tracking branch. The page shows the changes from the merge base of the two to the head of the branch. CoDuck never fetches, so a remote tracking base is as the last fetch left it.
- Thread. A conversation on lines of a file, on lines of the description, or the general conversation of the
review, whose id is
conversation. Other threads have an id of eight hex digits. - Outdated. A thread whose lines changed since it was written. It stays visible with the lines it was written on and counts as open until it is resolved. The page shows it where the diff that outdated it put those lines, its place, or at the top of its file when it has none; see Threads.
- Draft. Something the reviewer did in Scratch mode that is not posted yet. Drafts are not in git and the author never sees them.
- Pending edit. A change the reviewer made to a file of the branch, kept in the review until the author takes
it in with
coduck pull. - Version. The commit the review's ref points at. Every write to a review makes a new version, and
coduck waitcounts news from one. - State. An open review needs input, is approved, or is ready; see The state of a review. A finished review has no such state.
- New for you. What happened in a review since the reviewer last wrote in it; see What is new for you.
- Note. A fact about a review that nobody is asked to answer, such as where its pull request is; see Notes.
- Run specification. A named Python version and list of requirements, kept in a review, that its Python blocks can run on; see Run specifications.
- Names and sides. A command writes under the name its
-ngives, or else under one shared name,agentunless set otherwise, and the page writes as the reviewer's name. Every write also records its side: what the page writes is the reviewer's, what a command writes an author's, except a message that a command posts for the reviewer with-w, which is the reviewer's and also records the session that posted it. That side, not the name, is how CoDuck tells what is new for the reviewer and who gave the ready signal. See Names, Posting for the reviewer and Settings.
The page
The review list
http://localhost:8090/ lists the reviews of every registered repo in three sections, by their
state:
- Open, the reviews that need input or are approved, the latest activity first.
- Ready, the approved reviews whose author has said that nothing more is in flight, the latest activity first.
- Done, the reviews finished in the last 14 days, the latest first, with a switch for 30 days, 90 days and all.
A review's activity is the latest of its last write, its branch head's commit and the reviewer's newest draft.
A row shows the state as a chip, "Needs input", "Approved" or "Ready", or how the review finished, then the title and number, the repo, the author (the name the review was opened under), the project, the branch and its base, and the counts of open threads, drafts and pending edits. A review that is new for you carries a mark with its first reason and how long it has been new, such as "New commits, 3h", in Open or Ready; its tooltip names every reason. A row also shows the first line of the review's newest note, with its links, an idle mark on an open review with no activity for 7 days, and a dot with "N new" for what arrived since this browser last showed the review.
Two or more reviews of one project in a section stand together as a group. Its heading shows the project, a link to the project view, how many reviews the group holds and, when any of them are new for you, how many, such as "2 new for you". Under it are the group's rows, set in a little, each as above but without the project, which the heading carries. A group stands where its most recently active review would stand, in Done its most recently finished, and its rows keep that order. A project with one review in a section, and a review without a project, is a row of its own; a project's reviews in two sections form a group in each section that holds two or more of them.
Above the sections are a text filter, matched word by word against title, number, author, branch, repo and project, a repo filter and a project filter. The text filter also finds finished reviews of any age. The filters live in the address, so a reload or a link keeps them. A click on a project opens the project view: the same list for the reviews of one project across repos, where the rows keep their project and form no groups. A group holds the rows that match the filters, and is a group while two or more of them do.
The list follows changes without a reload. The "N new" count, the times, the marks of what is new and a group's count of them update in place; when the rows themselves would change, as when a review changes its state, its place in the order or its project, a bar "The list changed. Show" appears at the bottom instead of moving rows under your pointer. A badge in the top bar of every page, "New for you", counts the reviews that are new for you, and so does the list's title.
A repo that is no longer at its registered path shows as missing above the sections, with a Remove button.
The reviews menu
The button of three lines at the left of the top bar of every page, Reviews, opens a panel over the left edge of the
page with the list's Open and Ready sections in short, in the list's order. Each section says how many reviews it
holds, or that it holds none. Two or more reviews of one project in a section stand together under the project's name
in small type, as they do in the list. A row is one line: the mark of what is new for you, an "Approved" chip on an
approved review, the title, and the review's name, such as myrepo/1, which a long repo name cuts with an ellipsis.
A click on a row opens that review; the row of the review the page shows is marked and does nothing. All reviews,
under the sections, goes to the list. The panel closes on Esc, on a click outside it, on a second click on the button
and when the page goes to a row's review; a row opened in another tab, with the middle button or with Ctrl or Cmd,
leaves it open. It shows the list the page already follows, and changes with it while it is open, its marks aging
with the minute; until the page has read the list for the first time, it says "Loading the reviews".
A review
The top bar holds the repo and the title of the review, the base and the branch, the comment mode and Post all. The title takes the width of 32 characters at most, cut with an ellipsis; its tooltip holds it whole. In a narrow window the bar gives way in this order: the title down to 12 characters, the word Comments, the repo and the branch names down to 8 characters each, cut with an ellipsis and whole in their tooltips, the words of the "New for you" badge, which keeps its count, and then the rest of the title. The mode switch and Post all stay whole, inside any window 900 wide or wider. Below the top bar the header shows the title, the state as a chip ("Needs input", "Approved" or "Ready" for an open review, and how it finished for one that is not), the project, and the counts of commits, changed files, open threads and drafts, and the review has three tabs:
- Overview: the description, the general conversation and Done, with a side column that shows the notes, the mode, the number of drafts that wait with Post all, the open threads, the commits of the branch, oldest first, and the changed files.
- Files changed: a file tree and one card per changed file, and one per file that holds a comment although the review does not change it (see Threads), in one list by path. A card shows the diff as Unified or Side by side, with the changes only or the full file. A binary file is named and not shown. In the tree, a balloon beside a file holds the number of its open and drafted threads.
- Tasks: the epic and task files of the branch, see Epic and task files.
The page checks the review every three seconds and shows new replies and commits without a reload, keeping the text you are reading in place.
In a card that shows the changes only, each change has three unchanged lines around it and the other unchanged lines are folded. A fold says how many lines it hides and opens twenty lines at a time from either side, or whole. Its controls name what they show by the lines' new numbers, in this order: "Show lines 551 to 570", the twenty just below what comes before the fold, "Show all 63 lines", and "Show lines 594 to 613", the twenty just above what follows it. A fold at the top of the file has nothing over it and so no step under it, one at its end has nothing under it and so no step over it, and one of twenty lines or fewer opens only whole. The control you click stays where it was on the screen, so you can click it again for the next twenty. A thread, a drafted thread and a comment you are writing have their lines and three on each side shown, as a change has, wherever they sit: in a fold, on a change's own lines around it, or running from one into the other; the rest of a fold stays folded before and after them, and such lines that meet other shown lines join them. The lines you open are remembered by their numbers in the base of the review, which a commit on the branch does not move, so they stay the same lines when the agent adds, moves or takes back a change, and they stay open while the page is open, also when the thread or comment that sat beside them goes. A comment you cancel folds its lines again unless you had opened them.
The row above each change names its line numbers and what git finds the change is in, by git's own rules for the
file's language: the method in Python or Java, the function in Rust, the nearest heading in Markdown. CoDuck ships
an attributes file that assigns git's built-in rules by file extension and gives it to git for the diff the page
shows, in place of your own attributes file; no other git command that CoDuck runs reads it, so coduck pull
keeps your attributes. .m files get no rules, being both MATLAB and Objective C. A repo's own attributes come
first: its .git/info/attributes and the .gitattributes files in the index of its main worktree, so a repo that
names other rules, or none, for a file gets those. The .gitattributes files of the branch under review count
only as far as the main worktree has them, and a .gitattributes in the folder the server runs in never counts.
Without rules git names the nearest line above the change that starts in the first column, such as the class
around a method. The rules change only that text, never which lines a change holds: every diff CoDuck makes uses
git's default algorithm whatever git's settings say, so for someone whose settings name another algorithm for one
of git's rule sets, threads may sit elsewhere than under an earlier version. The row is the fold nearest above its
change, and stays above the change while lines open under it; once the whole stretch of unchanged lines above the
change is open, the lines run on without it.
The arrow at the left of a card's head folds the file. When you had scrolled into the file, so that its head stood at the top of the column, the page then shows that head at the top, with the next file under it.
Comment modes and Post all
The mode switch in the top bar reads Comments: Scratch or Direct. The browser remembers the choice.
- Scratch holds comments and edits back. New threads, replies, resolves and reopens, applied suggestions, file edits and their withdrawals, and description edits are drafts, marked as such, that you can change or delete. Post all opens the dialog "Post your review", which lists the drafts and takes an optional summary and a verdict, Comment or Approve, and writes all drafts in one commit, so that a waiting author wakes once. On a review that is approved or ready the dialog has a third choice, Comment and mark not ready: it posts as Comment does, with the mark needs input that ends the approval (see The state of a review), and like Comment it needs drafts or a summary to post. When you choose Approve while threads are not resolved, the dialog says how many, lists each with a link to it, and its button reads "Approve anyway". A thread counts as the review will hold it once the drafts are posted: a drafted resolve resolves it, and a drafted reopen and a drafted new thread are not resolved. When a write still on its way brings a thread the dialog did not name, Post review asks again before it posts. Approving with open threads is allowed.
- Direct posts each action at once. On a review that is approved or ready, a composer of a comment, a reply or a message in the conversation has a second button beside its submit, Comment and mark not ready, which posts the message with the mark needs input. Ctrl or Cmd with Enter posts it without the mark.
A change of base, a change of project, a note and Done act at once in both modes. Drafts are kept on the server's disk, outside git, and survive a reload and a restart.
Threads
Click a line number in a diff to comment on that line; shift click another line to take the lines between too. Or press a line number and drag, up or down, over the numbers of the lines you want, and let go: the lines between are marked as you go, and the comment opens on them, wherever a click on a line number starts a comment: both layouts of the diff, the full file and the source of the split view, though not rendered text. A drag stays on the side it started on, the old or the new, and on the old side it starts only on a removed line, as a click does. Once it is under way only the pointer's height counts: the line taken is the one of that side at that height, wherever the pointer is from left to right, over the code, over the other side's numbers or beside the file, and where that side has no line at that height, or the pointer is above or below the file's rows, the nearest line of that side. Near the top or bottom of the window the page scrolls, or the split view's source does, and the lines taken follow. Escape gives the drag up, and so do a second press and the window losing focus; none of them opens a comment. A comment already open on the file moves to the lines you took, with what you typed in it. A drag that starts on the code itself selects text to copy, as before. In rendered text, the description included, the + beside a block starts a thread on the source lines of that block. Ctrl or Cmd with Enter submits what you typed. Comments are Markdown. A thread can be on the new text of the branch, on removed lines of the old text, or on lines of the description.
A thread follows its lines through later commits, also through a rebase, as long as git's line diff keeps every one of its lines unchanged and puts no line between them. Any change to a line of the thread, a change of indentation or a rewrap included, a line inserted between its lines, or the removal or rename of its file, makes the thread outdated. A thread on removed lines stays current only while the merge base is the commit it was written against and the branch still removes those lines, so a change of base or a rebase onto a newer base outdates it. Nothing is matched by likeness.
An outdated thread on the new text or on the description still has a place, read from the same diff that outdated it: a line the diff keeps sits at its new number, a line it replaces sits on the lines that replaced it, and a line it deletes sits on the line the deletion follows, or on line 1 when the deletion starts the file. The place runs from where the thread's first line went to where its last line went, so a thread on one line of a block that was rewritten sits on the whole new block. The page shows the thread there among the lines, as it shows a current thread, in every view of a file and in the description: its header names the lines it sits on now, beside the Outdated label, and below the header are the lines it was written on. A thread on removed lines has no place, and neither has one whose commit is no longer in the repo, or whose file was removed, renamed or emptied, or is no plain file, such as a link, at the thread's commit or at the head: such a thread is listed at the top of its file, under "On lines that have changed since". A place is not a position: a suggestion on an outdated thread cannot be applied, wherever the thread sits.
A file at the head of the branch that the review does not change, whether it never did or no longer does, has a card of its own while it holds a thread, open or resolved, a drafted thread, a pending or drafted edit, or a drafted withdraw of an edit. Its card stands among the others by path, and in the tree too, where it shows a plain file icon in place of the letter of its status; its head says "Not changed" in place of the counts, and it is not counted among the changed files, in the header, on the tab, in the Overview's list and in the title of the tree. The card shows the file in one column of line numbers: its threads sit on their lines, with three lines around each as around a change, the rest is folded, and the folds open as in a diff. A comment starts there on a line as anywhere else, and a Markdown file has its Rendered and Split views and its Edit button. A card without changed lines, as of a file whose mode alone changed, says "No lines changed." above the same rows, with its threads on their lines. A binary file lists its threads under "Threads on this file". The threads and edits of a file that is not at the head of the branch, such as one the branch removed or renamed, are listed at the end, under "Threads and edits on files that are not at the head of the branch", and so are a comment you are writing and a file editor you left open on a file that has no card. While the review has no changes to show, because its branch or its base is gone or the two share no history, no file has a card: every thread and edit on a file is listed at the end, under "Threads and edits, while there are no changes to show", and a thread there that is not outdated shows the lines it is on, numbered where they are now.
A comment you are still writing sits where its thread would sit. When the branch, its base or the description changes while it is open, the page asks the server, once for each comment and each new head or description, where a thread on its lines would sit in what the page is about to show, and draws the comment there: beside the same lines at their new numbers while they are unchanged, at their place when they changed, and under "On lines that have changed since" only when a thread there would have no place. While its lines are unchanged the comment moves with them: it names them at their new numbers on the head shown, as it says above what you type, and that is what posting records, so a comment written across a commit, or across a rebase that kept its lines, is posted on the head. A comment whose lines changed keeps the commit and the lines you opened it on. The page draws what it read only once it has those answers for every comment open then, unless a request for one fails or names a head that was rebased away before any write recorded it, when that comment waits under the heading until the next read; so a comment does not jump away from lines that stayed as they were, and what you typed, the caret and the focus stay as they were, in every view. A shift click on another line widens a comment from where it sits now, while its lines are unchanged; one whose lines changed opens on the clicked line alone, with what you typed. A drafted thread sits at its place in the same way.
Every thread has an address, /r/<repo>/<number>/thread/<id> on the server, and every comment in it one of its
own, /r/<repo>/<number>/thread/<id>/<k> for the k-th, counted from 1 in the order the page shows them, with at
most six digits; in the conversation, whose id is conversation, the summary of a Post all counts as a comment.
Copy link in a thread's header copies the thread's whole address, and a click on a comment's time copies the
comment's; the page says "Link copied", and where the browser refuses the clipboard it shows the address in a field
to copy by hand. Opening an address shows the review where the thread is, unfolds it when it is resolved, and marks
the thread or the comment until your next click or key. For a thread the review does not hold, the page stays where
it is and says so; for a comment a thread does not hold, it shows the thread and says so.
In comments, notes and the description, an address of a thread or a comment on this server, under either of its
names, localhost or 127.0.0.1, or written as a path from /r/, is a link to it, and a bare one shows short, as
myrepo/1 thread 0f5f6ffc, comment 2. A click on one of the review shown moves there without loading the page
again, as a step in the browser's history: the address bar shows it, and Back returns to where you were, the tab and
the place in it, also when Back comes from another page. One of another review opens in a new tab, and so does any
of them in a preview or in the dialog of a file opened read only, so that what it holds stays.
A message that a session posted for you, with -w (see Posting for the reviewer), is
yours: it shows under your name and without the Agent label, with "through NAME" in small type beside the name,
NAME being the session that posted it, and it is not marked as new. Your drafts never carry such a name.
Resolve closes a thread and Reopen opens it again. The general conversation cannot be resolved.
Suggestions
In a comment on new lines of a file, Suggest change inserts a fenced code block marked suggestion, the word
after the three backticks that open it, which holds the thread's lines. Change them to what you propose. Apply
appears on a posted message that holds exactly one such block, outside any list or quote, that changes the lines,
while the review is open and the thread is not outdated. It turns the suggestion into a pending edit of those
lines, for the author to take in, and works once per message. In Scratch mode an Apply is a draft like any other
action. A suggestion can be made on any text file. It never runs, also when a block in it is marked run: see
Running a block in the page.
Editing files and the description
The Edit button on the card of a Markdown file opens the whole file in an editor with a preview. Saving makes a
pending edit: the branch does not change until the author runs coduck pull and commits the result. The file's card
shows each pending edit, which waits for coduck pull, with a Withdraw button that takes it back before the author
takes it in, and each drafted edit, held until you post. Once coduck pull has taken an edit into the worktree, the
page takes no further change to that file until the result is committed, and says so when you try.
An edit made on top of an earlier pending edit of the same file replaces it. Outside the Tasks tab the page edits Markdown files only; for other files, make a suggestion.
The description has an Edit button too. A change to it takes effect as soon as it is posted, since the description is part of the review and not a file of the branch.
Markdown views
A Markdown file can be read three ways: Diff, the source lines; Rendered, the rendered text with changed blocks marked; and Split, the source and the rendered text side by side, scrolling together by source line. In the split view the threads sit in the source, and badges on the rendered side open them. Fenced blocks of code are highlighted and Mermaid diagrams are drawn: in the description, in a Markdown file's rendered and split views, in a file opened read only, and in the epic and a task on the Tasks tab, with the comments that stand inside the description or a rendered file. A comment under Conversation, a note and a preview show a Mermaid block as its source. A click on a drawn diagram, or on the control that shows in its corner on hover or keyboard focus, opens it large in a dialog, scaled to fit; a click that ends a selection of its text opens nothing. There the wheel or a pinch zooms around the pointer, from the whole diagram up to eight times that, a drag moves it, and Fit shows the whole diagram again. Tab stays among the dialog's controls. Esc, a click that begins and ends outside the diagram's frame, the close button and Back close the dialog, and the focus returns to the diagram's control. A click on a diagram starts no comment: the plus beside its block does, on its source lines. Blocks of Python and SQL marked to run, and their outputs, show as Runnable blocks and their outputs says, wherever Markdown is rendered, and a comment on their lines sits after the block and its outputs.
Links in rendered Markdown stay inside the review where they can. A relative link is resolved against the folder
of its document, and against the root of the repo in the description and the conversation. A link to a file that has
a card opens that card on the Files changed tab; a link to any other file of the repo opens it read only at the head
of the branch. Headings get the anchors GitHub gives them. A reference in the form owner/repo#12
links to GitHub, and a link that leaves the repo by a relative path is shown as plain text.
What is new since you last looked
Each browser remembers the version and the branch head it last showed of each review. From that the list shows "N new" on a row, the new commits and the new actions on the author's side, notes left out, and a review shows a dot on threads with new messages from that side, a "New" mark on those messages, and a divider "New since you last looked" in the commit list. When the branch moves while you have the review open, a notice names the review's author, says how many commits were pushed and takes you to them. A browser that has not shown a review before marks every commit and everything the author's side wrote in it as new, notes left out.
Keys
nandp: the next and the previous change, on the Files changed tab.jandk: the next and the previous thread that is not resolved, drafted threads included, on the Overview and Files changed tabs.Esc: close a dialog, a menu or the task panel.- Ctrl or Cmd with
Enter: submit the comment being typed. ShiftwithEnterin the text of a comment being written: run the runnable block the caret is in; elsewhere in the text it makes a line break, as it always did. See Running a block in the page.
Base and project
Change base, beside the branches in the top bar, reviews the branch against another base, for example main once
the branch that this one was stacked on has landed. A review whose base no longer exists, or shares no history
with the branch, shows its description and conversation and no changes until its base is changed.
A review can carry a project: the name of an effort that can span repos, written as lowercase letters and digits in words joined by single hyphens, at most 64 characters. The button beside the project in the header, Change or Set project, picks a project in use, takes a new name, or drops the project.
The state of a review
An open review is in one of three states, read from what the review holds:
- Approved: the reviewer approved the branch with a Post all, the branch's head is still the head that Post all saw, and nothing since ended the approval. A Post all that saw no head, because the branch was gone or the review was written before writes recorded heads, approves nothing.
- Ready: approved, and the author gave the ready signal,
coduck ready, after that Post all: nothing more is in flight. - Needs input: every other open review.
An approval, and the ready signal with it, ends when:
- the branch's head is another than the one the approving Post all saw: every write records the head it saw, so a new commit, a reset, a rebase and a deleted branch all count, whatever the commits' times;
- the description or the base is another than the one the approving Post all left, by either side, a description drafted in Scratch mode and posted with Post all included; what that Post all wrote itself is part of the approval, and a description or a base changed back to what it was ends nothing;
- a message is posted with the mark needs input, by either side: in the page with Comment and mark not ready, a
second button beside the submit of a comment, a reply or a message in the conversation in Direct mode, or the
third choice of Post all; with the command,
coduck reply -iorcoduck comment -i, also together with-w.
A message without the mark ends nothing, whoever writes it: a reply, a new thread, a message in the conversation,
a Post all with the verdict Comment. Nor does any of these: a resolve or a reopen, a note, the author taking in
edits with coduck pull, a change of project, an edit or a suggestion applied by the reviewer and its withdrawal,
a migration, an approval, the ready signal, a commit on the base. What is new for the reviewer
does not depend on the mark: every message is new for them as What is new for you says,
with the mark or without it. A finished review has no state.
The mark is for a message that asks something of the other side or reports something that needs their action, such
as a check that failed upstream; an acknowledgement, or a report that needs nothing, goes without it. It is recorded
as an event needs-input at the end of the conversation, in the commit of its message, under the writer's name and
on their side, and the conversation shows it as a line, "NAME marked the review as needing input". The page offers
it only on a review that is approved or ready. A command takes -i on any open review, where it changes the state
only of an approved or ready one, and a finished review refuses it. The mark is no one's word in the conversation:
which threads coduck show -u lists does not depend on it.
Approve, a verdict of Post all, says the reviewer is satisfied with the branch as it stands. The review stays open, so that later changes, such as a fix for a check that fails upstream, come back in the same review, and the review needs input again. The page has no control for the ready signal: it is the author's.
What is new for you
A review is new for you, the reviewer, when something happened in it since your last write on it: any write of yours except a note and a change of project, a resolve and an approval included. A message that a session posted for you (see Posting for the reviewer) is your word and no look at the review: it answers the author's messages before it, and leaves every other reason as it was. The reasons, in this order:
- Not reviewed yet: you have not written in it yourself. Until you do, this stands for everything the author did, and only your drafts can be new beside it.
- New messages: the author's side wrote a message, started a thread or opened one again, whatever the thread's state.
- New commits: the branch's head is another than the one your last write saw; it is new since the first commit at or after that write, or since the write when the head moved without one, as after a reset.
- New description or base: the author's side changed the description or the base.
- Said ready: the author's side gave the ready signal after your last write, and has written nothing since. Your next write takes it away, as it takes every reason, and so does the author's next write, such as the note that says where the work went: that is what ends it when your next step, such as opening a pull request, happens outside CoDuck. The review stays ready.
- Your drafts: you have drafts on the review.
A look that writes nothing leaves the mark; a reply, a resolve or a verdict takes it away. An open thread whose last
word is the author's is no reason by itself: once you have written anywhere in the review, it is not new. This is
read from the review alone, so coduck list and other tools see the same; what this browser last showed is the
row's own "N new".
A message with the mark needs input (see The state of a review) counts here as any message does: the mark changes none of these reasons.
Notes
A note is a fact about a review that nobody is asked to answer, such as where its pull request is or which review it waits for. It is no comment and no log of what happened: what needs someone's attention is a message. A note is Markdown of any number of lines, at most 10,000 characters. Either side adds one, and either side can change or remove any note; a review of any state takes notes, a finished one too.
A note changes no state, is not new for you and does not count in "N new", and wakes no waiting author, but it does move the review's activity, by which the list sorts. In both comment modes it is written at once.
The Overview's side column starts with the notes, the oldest first, each a card with its rendered Markdown and who
added or last changed it and when. A note longer than about seven lines folds, with "Show all". Add, and the pencil
on a card, open a dialog with the Markdown and its preview side by side and the button "Save note"; the bin on a
card removes the note after you confirm. In the Markdown, as in comments, owner/repo#N links to that number on
GitHub, and an address links to itself; links to other sites open in a new tab. The list's row shows the first line
of the review's newest note, the one added or changed last, with its links working; a click on such a link does not
open the review. Notes do not show on the Files changed tab.
Done
Done, under the conversation on the Overview tab, ends a review once its work has landed or is dropped. It takes no note: add a note at any time, also after Done, to say where the work landed. Done is refused while the reviewer has drafts, and held back while text is typed and not saved, so that nothing written is lost. Pending edits do not stop it, and the dialog says how many will never be taken in. A done review takes only messages, in its threads and its conversation, notes, run specifications and a change of project; it cannot be opened again. Its branch is free for a new review, which gets a new number. It keeps showing the changes it covered after its branch is deleted.
CoDuck does not merge. How a branch lands is ordinary git work outside it.
The command
Run coduck in a worktree of the repo. A command that works on a review takes the open review of the branch
that is checked out, or review N of the repo it runs in with -r N. -r REPO/N, the form coduck list prints,
names review N of the repo registered under the name REPO from any folder, and the command then reads the screen
names from that repo; a REPO that is not registered, or whose folder is gone, is refused. coduck -C DIR COMMAND
runs any command as if CoDuck was started in DIR: the repo, the worktree and every FILE that is not absolute are
found from DIR, and a DIR that is no folder is refused. coduck -n NAME COMMAND runs any command under NAME, see
Names. Where a command reads text from FILE, - reads standard input. There are no long options: help
is -h, on coduck and on every command. A refused command prints the reason on standard error and exits 1; a
usage error exits 2.
Names
-n NAME, before the command's name like -C, gives the name the command writes under: the author of every event
it adds and of the commit on the review's ref, and the review's author when it opens one. With -w, reply and
comment write under the reviewer's name instead and record NAME as the name they were posted through (see
Posting for the reviewer). NAME is also the caller's name, for wait and show -u,
which count what NAME wrote or posted as the caller's own and what any other name wrote as news. Without -n the
name is the setting coduck.cliuser. NAME follows the rule of every name (see
Settings) and must differ from the reviewer's name, ignoring case; both refusals exit 1 before
anything is written. Every command that reads names checks NAME, also one that writes nothing, such as show;
skill, check, version, list and migrate leave it unread.
Give each session its own name, the one under which the reviewer and other sessions find it, and use it on every command of a review:
coduck -n docs-session show -u
coduck -n docs-session wait -s <version>
Whatever the name, a command writes on the author's side and the page on the reviewer's; the one exception is a
message that a command posts for the reviewer with -w, which is on the reviewer's side. The review records the
side of every write: what is new for the reviewer, the ready signal and the Agent label on messages read that side.
Two sessions under two names can work on one review, and each one's writes, notes left out, are news for the other.
Opening and describing
coduck open [-b BASE] [-p PROJECT] FILEopens a review of the current branch with FILE as its description, and adds the repo to the server's list. The title is the first line of the description that is not empty, without its leading#marks; a description without one is refused. Keep the title to a few words that name the change, at most 60 characters: a longer one is not refused, but the page cuts it in its top bar. Without-bthe base is the branch that origin'sHEADnames, elsemain, elsemaster. BASE is a local branch (-b feature-x) or a remote tracking branch (-b origin/main). A branch with an open review, a branch with no commits, the base itself and a detachedHEADare refused.coduck describe [-r [REPO/]N] FILEreplaces the description, and with it the title. The reviewer can edit the description too, so read it withshowfirst.coduck base [-r [REPO/]N] BASEchanges the base. The change shows in the conversation.coduck project [-r [REPO/]N] PROJECTsets the project, andcoduck project [-r [REPO/]N] -ddrops it.
Reading and waiting
coduck show [-r [REPO/]N] [-u] [-j]prints the title, the branches and the state, withneeds-input,approvedorreadyafteropen(andstatusin its JSON), the description, the notes with their ids, oldest first, every thread and the pending edits, and last the lineversion: <id>. A note's first line isnote <id> by NAME at TIME, with, changed by NAME at TIMEonce it was changed, and its Markdown follows, indented. A message that a session posted for the reviewer shows its author asREVIEWER (through NAME), NAME being that session. The conversation shows the ready signal asNAME gave the ready signal at TIMEand the mark needs input asNAME marked the review as needing input at TIME. With-uit prints only what waits on the caller, the name-ngives or elsecoduck.cliuser: the open threads whose last word is another name's, and the pending edits; a message the caller posted for the reviewer is the caller's own word. Each thread's first line says where its lines are now, asnow lines 23 to 24, or that it is outdated, with its place when it has one, asoutdated, placed at line 18. With-jit prints JSON, in which each thread hasposition, where its lines are while it is current, andplace, where it sits, the two equal for a current thread, an event that a session posted for the reviewer hasthrough,notesholds the notes andspecsthe run specifications.coduck wait [-r [REPO/]N] [-s VERSION] [-t SECONDS]returns as soon as a name other than the caller's has written to the review after VERSION (a message, a verdict, a resolve or reopen, an edit or its withdrawal, a new description, a change of base or of project, the ready signal), or anyone has marked it done, the caller included, since two sessions can share a name. A message that a session posted for the reviewer was written by that session's name: it is news for every other name and none for that session. A note, a run specification and a migration are no news. It prints what arrived and the new version and exits 0. Without-tit has no time limit; with-t, after SECONDS it printsno news on review N since <id>and exits 1. VERSION is the full id of one of the review's versions, asshowprints it. Without-s, wait counts from the caller's own last change, or from the opening when the caller made none. It never reads standard input, so it can run in the background. When the repo is gone from the path it had when the wait started, as after its folder was moved, the wait says so with that path and exits 1: start it again where the repo is now. Any other failure of git ends it with git's own message.coduck listprints the open reviews of every registered repo, one line each with the review asREPO/N, its state (needs-input,approvedorready), its branch and base, its project and its title, and a line for each repo that is missing or holds reviews this version cannot read.
The author's loop is coduck -n NAME show -u, act on each item, then coduck -n NAME wait -s with the version
that show printed, under the same NAME throughout. Counting from that version means nothing that arrived in
between is missed, from the reviewer or from another session under another name.
Answering
coduck reply [-r [REPO/]N] [-w] [-i] THREAD FILEadds a message to a thread; THREAD is a thread id orconversation.coduck comment [-r [REPO/]N] [-w] [-i] PATH:N[-M] [old] FILEstarts a thread on lines N to M of a file at the head of the branch, or with the wordoldon the lines of the merge base.-i, on either, posts the message with the mark needs input, also together with-w: on an approved or ready review it ends the approval and the ready signal; see The state of a review. It is taken on any open review and refused, with exit 1 and nothing written, on a finished one.coduck resolve [-r [REPO/]N] THREADandcoduck reopen [-r [REPO/]N] THREAD.
Posting for the reviewer
With -w, reply and comment post the message for the reviewer, as when the reviewer worked out an answer with a
session and asked it to post the outcome. The message is the reviewer's: its events and its commit are written
under the reviewer's name, the setting coduck.webuser or else user.name of the review's repo as the command
reads it when it runs, on the reviewer's side, and both also record the name the command runs under, the one -n
gives or else coduck.cliuser: each event as through, and the commit in a trailer Through. A new thread
records it on its opening as well as on its message. A Through trailer counts only beside Role: reviewer.
It is the reviewer's word: with -i it carries the mark needs input on the reviewer's side, recorded with the
same through, and ends an approval as the reviewer's own mark does; the page shows it under the reviewer's name,
and it answers what the author's side wrote before it, so that those messages are no longer new
for the reviewer. It is no look at the review: commits, a new description or base and the
ready signal that were new for the reviewer stay new, and a review the reviewer has not written in themselves stays
not reviewed yet. For wait and show -u it is the posting session's own: it is news for every other name and
none for that session, and a thread whose last word it is waits on every other name and not on that session. Two
sessions under one name take each other's writes for their own, so a session that posts for the reviewer runs
under a name of its own, never under the name of a session that waits on the review: that session would not wake.
Only a message can be posted for the reviewer: -w exists on reply and comment and on no other command, so a
session cannot approve, resolve, reopen, describe, change the base or the project, add a note, give the ready
signal or mark a review done for the reviewer. -w is refused, and exits 1 before anything is written, in a repo
where git sets neither coduck.webuser nor user.name, as the server is; and a name from -n that is the
reviewer's is refused with -w as without it. The page never posts through a name, so a draft carries none.
Taking in edits
coduck pull [-r [REPO/]N] applies the pending edits to the worktree and its index, in the order they were made,
marks them taken, and commits nothing. Commit what it applied at once; only the commit puts the change on the
branch. The convention is a commit message that starts with the editor's name in square brackets.
Pull runs in a worktree of the review's repo that has the review's branch checked out, so with -r REPO/N from
another folder, point it at that worktree with -C; anywhere else, a folder in no repo and a worktree of another
repo included, it is refused and says where it runs. It needs no uncommitted change to a tracked file, and no merge,
cherry pick, revert or rebase in progress. It prints one line per edit and exits 0 when every edit was taken, 1
otherwise:
- An edit that clashes with the branch leaves git's conflict markers in the file, counts as taken and ends the pull. Resolve the markers, commit, and pull again for the edits after it.
- An edit that git cannot apply at all stays pending, and pull says why.
- An edit can add or remove a file, and pull stages it as such.
- An edit that the reviewer replaced with a later edit of the same file is withdrawn, and pull does not apply it.
The line of the later edit names the edits it replaced, oldest first, also those that they had replaced in turn:
took edit C of PATH by NAME into the worktree and its index; it replaces edits A and B, oredit Afor one. The line of such an edit that clashes ends the same way. - An edit that the reviewer withdraws while pull applies it stays in the worktree; pull says so and exits 1. Undo that change before you commit, if the withdrawal stands.
- A pull that stops halfway leaves its edit staged and still pending. Commit it and pull again to mark it taken, or discard it and pull again to apply it again.
- With no pending edits, pull says so and exits 0.
An edit still pending when the review is marked done is never taken in.
Saying it is ready
coduck ready [-r [REPO/]N] gives the ready signal on an approved review: nothing more is in flight. It writes a
ready event in the conversation, in one commit named ready, and prints review N is ready. It is given on a
review that is approved, as The state of a review has it, and refused, with exit 1, on any
other, so also after a message with the mark needs input until the reviewer approves again; on a review that is
ready already it writes nothing and exits 0. It is news for the reviewer and ends nothing. After it, another head
of the branch, a new description or base, or a message with the mark needs input takes the review back to needs
input; a message without the mark, by either side, leaves it ready.
Notes
coduck note [-r [REPO/]N] FILEadds a note, the Markdown of FILE, and printsadded note ID to review N.coduck note [-r [REPO/]N] -e ID FILEchanges note ID to the Markdown of FILE.coduck note [-r [REPO/]N] -d IDremoves note ID.
A note that holds only white space or more than 10,000 characters is refused, and so is an ID the review has no note
under; each exits 1. Each write is one commit named note. See Notes for what a note is.
Finishing
coduck done [-r [REPO/]N] ends the review. It does what the Done button does, and takes no note.
Checking epic and task files
coduck check [PATH ...] checks the headers of epic and task files in the worktree; see
coduck check.
Server, backup, skill and version
coduck serve [-p PORT]runs the server on 127.0.0.1, port 8090 unless given;-p 0picks a free port. The first line it prints islistening on http://127.0.0.1:<port>/. It runs a code block only when someone asks for it in the page (Running code blocks), and when it stops, on Ctrl-C or SIGTERM, it stops the runs still going first.coduck registeradds the current repo to the server's list without opening a review.coduck bundle FILEwrites every review ref of the current repo to a git bundle.coduck push REPOSITORYpushes the reviews of the current repo to an archive repository.coduck skillprints the instructions for agents that ship with this version, for the folder an agent reads its skills from:coduck skill > <folder>/coduck/SKILL.md.coduck versionprints the version of CoDuck that is installed, ascoduck X.Y.Z. Likeskill, it reads no repo and no setting. Run from its source without an installed package, it is refused and says so.coduck keyprints the key that every request about runs carries, for you to give the page the first time you run a block in a browser. The server makes it when it first starts; before that, and when the key file is a link, no plain file, or readable by other users, the command is refused and says why. It reads no repo and no setting. It is yours alone: an agent never runs it.coduck migratebrings every review of every registered repo to the format this version reads; see How a review is stored.
Runnable blocks and their outputs
A fenced block of Python or SQL can be marked as runnable, and what it printed is kept right after it in an output block. Both are plain Markdown, which reads as code wherever Markdown is shown, and both can be written by hand: for code you ran in a shell, the output block is the record of what it printed and what it ran on. CoDuck never marks an output as current or stale; an author may change the code and its outputs freely.
A runnable block
A fenced block whose first line goes on, after its backticks, with python run or sql run is a runnable block; the
first word is read in any case, so Python run runs too. A block marked python or sql alone is only coloured, so
that code that shows something never runs.
A third word is the name of a file the block is a part of: python run invoice.py, sql run prices.sql. A name holds
letters a to z in either case, digits, dots, hyphens and underscores, at most 64 characters, and names no folder:
. and .. are no names.
Within one text (a comment, the description, a note, a Markdown file, a task) the blocks of one kind that carry one
name are the parts of one script, in the order they stand: a later part sees what an earlier one made. A block
without a name is a script of its own, and SQL and Python never share anything.
Anything else after run, as a second name or a name with a slash, and run after another word than python or
sql, as mermaid run, makes the block a plain block, coloured or drawn as it would be without run, and the page
says why above it.
An output block
Right after a runnable block, with blank lines only between, comes one output block per configuration the code ran on. A SQL block that ran on DuckDB 2.0.1:
```sql run
SELECT p::DOUBLE AS price, round(price, 2) AS cents FROM (VALUES (2.675), (0.125), (1.005), (0.015)) t(p);
```
```output v1
duckdb: 2.0.1 (8d78114e90)
┌────────┬────────┐
│ price │ cents │
│ double │ double │
├────────┼────────┤
│ 2.675 │ 2.67 │
│ 0.125 │ 0.13 │
│ 1.005 │ 1.0 │
│ 0.015 │ 0.01 │
└────────┴────────┘
```
The block opens with output v1, v1 being the version of this form. Then come the header lines, one empty line,
and the text exactly as it was printed, line by line: a carriage return ends a line as a line feed does, and a NUL
character reads as the replacement character, as Markdown reads them. A header line is a name, a colon and a value:
duckdb: the version and, in brackets, the source id, asPRAGMA versiongives them:duckdb: 2.0.1 (8d78114e90).python: the interpreter's version, for a Python block:python: 3.14.0.packages: the name and version of each package the code loaded, apart from duckdb and Python's own, separated by commas:packages: pandas 2.2.3, numpy 2.1.0.extensions: the DuckDB extensions loaded beyond those built in, separated by commas:extensions: tpch.exit: the program's exit status, when it is not 0:exit: 1.stopped: why the run was stopped, or why later parts did not run:stopped: time limit 60 s.
Leave out a line that has nothing to say; a line with an empty value says nothing, as if it were not there, and a value holds no line break. The header may be empty: the block then starts with the empty line. A Python block's output looks like this:
```output v1
python: 3.14.0
duckdb: 2.0.1 (8d78114e90)
packages: pandas 2.2.3, numpy 2.1.0
(2.675, 2.67)
```
duckdb -version prints what the duckdb line needs, as v2.0.1 (Cyanoptera) 8d78114e90, and that line will do as
it is: the page reads the first version number in the value, and ten hexadecimal digits anywhere in it as the source
id. In Python, sys.version and duckdb.sql("PRAGMA version").fetchall() give the same.
How the page reads an output block, so that one written by hand works:
- The names are read in any case and in any order, and so is the word
output;v1may be left out:outputalone is read asv1. - A line is a header line only when it starts with one of the six names and a colon. A block whose first line is
neither a header line nor empty has no header and is all text, and the page says that it does not say what it ran
on. So an output whose first line is
total: 2.81is not taken for a header. - Without the empty line, the header ends at the first line that is no header line, and the page says it read the header leniently.
- A name given twice is shown twice.
- An output block of another version, as
output v2, is not read: the page shows it as a plain block and says so, and does the same for an output block that follows no runnable block. - A text that itself holds a line of three backticks needs a longer fence around the output block: four backticks, or one more than the longest run of backticks in the text.
What the page shows
Wherever the page renders Markdown (the description, comments, notes, previews, a Markdown file's rendered and split
views, a file opened read only, the epic and the tasks), a runnable block has a head: its kind; its file name, with
"part 2 of 3" and arrows to the part before and after when the script has several parts; what each of its outputs
ran on, as the DuckDB version, as the Python version (python 3.14.0) for an output that names Python and no DuckDB,
or as "not said"; and Run, with the control beside it that chooses what it runs on: see
Running a block in the page.
Its outputs follow it. One output shows its header as chips (the DuckDB version and source id, the Python version, the packages, an exit status, why it stopped) and then its text. Several are compared with the first: a line says whether they are the same or how many different outputs there are, and they show side by side, one under another, or as a diff of their lines. Side by side and one under another mark what differs from the first output, except in an output that ended otherwise than the first, by an exit status or a stop, where marking every line would only be noise. The view you choose, Table or Text, and an output shown in full stay while the page is open, for the few hundred blocks you chose on last, and blocks of the same text share them.
Where an output is a table that DuckDB's command line program drew, the page reads it back into cells and shows a
table: the column names, their types, the rows, NULL set apart, numbers to the right, the line of dots where DuckDB
left rows out, the column of dots where it left columns out, and the lines it printed under the table, as
1000 rows (40 shown). Lines of dots are rows left out only when those lines say that fewer rows are shown than there
are; otherwise, as for a value that is a dot, they are rows. Compared outputs mark the cells that differ: rows are
paired by their text first, so that a row that came or went is marked whole and the rows after it are not. The diff
compares a table row by row, cell by cell, so that a column that grew wider changes no line. Text shows the output as it is stored, and the copy button
beside it copies it as stored. Text around a table, such as an error, stays text. A table of another program stays
text too, and so does a table one of whose values holds the line DuckDB draws between cells. A value that DuckDB
wrapped over several lines shows as several rows, one per line.
An output of more than 30 lines is folded, and so is a diff of more than 30 lines, with Show all to open it; a folded output still scrolls sideways. The page builds only what a fold shows, so the browser's find does not see the folded part of an output until Show all opens it. Choosing a view, Table or Text, or a fold draws that block's outputs again and nothing else. A comment on a block's lines, or on an output's, sits after the block and its outputs; the plus beside the code comments on the code, and the one beside an output on that output, or in the Diff view beside the diff on the outputs together. In the Split view the badge of a thread stands beside the code or the output it is on.
Epic and task files
An epic is a Markdown file whose name ends in .epic.md, and a task one whose name ends in .task.md, in any
folder of any repo. They are plain Markdown that reads well without CoDuck. The Tasks tab of a review shows them
with controls, and every change made there is an edit of the review like any other: a draft in Scratch mode, a
pending edit once posted, taken in with coduck pull.
The files
A task file opens with a header: a line of exactly three hyphens, the fields, and a second line of three hyphens.
Between them, a field is key: value, or key: followed by lines - item, or key: [item, item]:
state: in progress
waits-for:
- read-header.task.md
pull-requests: [example/coduck#12]
Every value is text. The header takes no comment, no empty line and no value inside a value, and a file with Windows line endings has no header.
stateis required:todo,in progress,paused,completeorcancelled.waits-forlists the task files this task waits for, each as a path from the task's own folder, or from the root of the repo with a leading slash.pull-requestslists pull requests asowner/repo#N.- Any other field is kept and shown as written.
A task's title is its first heading of level one, or without one its file name without the suffix.
An epic lists its tasks in its text. A list item whose first line is the list marker and then a link to a task file is a task of the epic, in the order of the text, and what the item holds after its first paragraph is the task's summary. A link to a task file anywhere else is only a mention.
# Task files in the page
- [Read the header](tasks/read-header.task.md)
Both the page and the command read it, from one table of cases.
- [Render the header as a table](tasks/render-header.task.md)
An epic's header is optional. Its project field names the project that reviews carry, and the Tasks tab lists
the project's other open reviews beside the epic.
In every Markdown file the page shows, a readable header renders as a table of its fields, and a list item that
starts with [ ] or [x] renders with a checkbox.
The Tasks tab
The tab shows an epic as its own rendered text, where each task item carries:
- the task's state as a button that changes it;
- a handle and arrows that move the item within its list;
- the tasks it waits for, its pull requests and its ticked checkboxes;
- a pencil that edits the summary;
- a mark for what waits: a draft, an edit waiting for
coduck pull, or an edit taken in and not committed yet.
Below the last task a field adds a task: a title and a path. The new file starts with state: todo and the title,
and the epic gains an item for it. A click on a task opens a panel with its state, the tasks it waits for, its
pull requests, its other fields, its problems, and its text with checkboxes that can be ticked, and with Edit text
and Delete task. Delete removes the file and its items in the epic, and names the tasks that wait for it.
With no epic on the branch the tab offers New epic; with several it lists them. A side column shows the open reviews of the epic's project, the count of tasks per state, and the task files that are no task of the epic. A finished review shows the tab without controls.
coduck check
coduck check [PATH ...] reads the epic and task files below the current folder that git tracks or would add,
or the files and folders named, and prints each problem as path:line: problem: a header it cannot read, a
missing or unknown state, a path in waits-for that names no task file, tasks that wait for each other in a
circle, a pull request in another form, a project that is no project name. It exits 0 with no problem, 1 with
problems and 2 for a path it cannot check. It needs no review and writes nothing. It reads headers, not an epic's
list: a task item whose file does not exist shows on the Tasks tab only.
Running code blocks
A sql run or python run block runs only when someone presses Run on it in the page: reading a review, in the
page or with a command, runs nothing, and no command runs a block. The server does the running, with the
permissions of the user it runs as.
Every request about runs, to start, read or stop one, carries the key: the header X-Coduck-Key with what
coduck key prints, 64 hex digits of 32 random bytes that the server makes at its first start in key in the
state folder, readable by the user alone. The page asks for it once in each browser, the first time someone runs a
block there, and keeps it in the browser's storage. The guard of every other write, the Host header and
X-Coduck: 1, stops a page of another site; it stops no program on the machine, and running code is what any
account on a shared machine, or an agent kept from the user's files but free to reach localhost, must not be able
to make the server do for it. A request without the key, or with another, is refused with 403. A program that runs
as the user can read the key as it can read anything of the user's; agents are told never to run coduck key or
start a run.
Running a block in the page
Run is in the head of every runnable block, wherever the page shows one. It runs the block's script: the block alone, or for a block with a file name every block of its text of the same kind with that name, from the first. It runs once for each configuration chosen in the block's picker, the control beside Run, and Run names what it runs on: "Run on 2.0.1", "Run on this branch" for the branch's build or .venv, "Run on NAME" for a run specification, "Run on 2" for two. The choice holds for every part of the script while the page is open. Before you choose, a SQL block runs on the DuckDB versions its outputs say they ran on, where they can run here; otherwise, and for Python, on what you last ran a block of the kind on; else on the newest DuckDB installed, the branch's build or the newest release for SQL, and on the branch's .venv or the first run specification for Python. The server takes two runs at once, of all its reviews: the page starts two and queues the rest, which say that they wait for their turn, and a run that finds both places taken by others waits until one ends and says so.
The picker lists what the server finds, as What a block runs on says: for SQL the DuckDB programs installed on this machine and those built in the branch's worktree, which run at once, the releases, newest first, which uv fetches the first time, and a field for a version typed by hand; for Python the branch's .venv, which may build first when its duckdb is an editable install, and the review's run specifications, which uv fetches the first time. It says the limits a run of the review has, once the page knows the key, and where no scope holds a run's memory, that DuckDB's own memory setting is its limit. New run specification from this block opens a dialog with a name, a Python version and the requirements, one per line, filled in from the block: the newest Python uv has, duckdb pinned to the newest release, and the packages the block imports, Python's own left out. Save keeps the specification in the review, for everyone in it, and checks it in the picker; Save and run also runs on it. Change, beside a specification, opens the same dialog, with Remove. Without uv a specification is listed as one that cannot run, and why. Where nothing can run (no DuckDB installed or built and no uv for SQL, no .venv and no uv for Python) or where runs are off, the picker says why and what to install, Run says so when you point at it, and Look again asks the server once more. A Run with nothing to run on starts nothing and says why.
While a run goes, the block shows under its code, for each configuration, its phase in words (waiting for its turn, fetching through uv, building the branch's duckdb, running, stopping), how long it has taken, the last lines that part has printed so far, and Cancel. Cancel asks the server to stop the run, and the run shows as stopping until the server says it ended, which can take ten seconds, five for the script to end and five to learn what it ran on, and thirty while a build prepares. A run that could not start, or that failed while it prepared, says why, with what it printed while it prepared, folded when that is long. When the server refuses to say how a run goes, as after a restart with runs off, the run ends in the page with the server's words; while the server does not answer, the run says so and the page goes on asking, and a read or a Cancel that has no answer within six seconds counts as not answered. A start is never sent twice, since the server starts a run before it answers: when its answer takes more than six seconds, the run says that the server has not answered yet and the page waits for that answer, and a Cancel pressed meanwhile is sent once the answer names the run. A run that waits for a place ends with the server's words when the server refuses to list the runs, and one refused as the place freed is tried again. A Cancel refused for the key is sent again once the key is given. Run on a block whose script runs does nothing. Runs of the review that this page did not start, as in another tab or before a reload, show under the review's title, with Cancel.
When the runs of one Run have all ended, each part of the script gets one output for each run, in the order of the
picker, written from the header and the text the server gives. Of what a run prints the page keeps text: terminal
escape sequences, as the colours DuckDB's command line program prints in some cases even into a pipe, after .once,
in their two byte and their one byte forms and also cut off, and every control character but the tab and the line
ends, are taken out before an output is shown or written; an escape character that begins no sequence goes alone.
The header values a run reports are cleaned the same way. A run in which no part ran, as one cancelled while it
prepared or one that failed to start, gives no output and says why. Where the outputs go depends on where the block
stands:
- In a text being written (a comment, a reply, the summary of Post all, the description or a file in its editor, a note in its editor, a task's summary): into the text, after each part of the script, in place of every output that stood there, in the line ends the text uses. They go to the block at the place the run started from, and only while its code is what ran: when the code changed while it ran, the text stays as it is and the page says so. A part that did not run gets an output whose header says why, as the server reports it. Saving, posting or closing the text while its block runs, Post all included, stops the run, and the page says that its outputs were not written.
- On a posted comment, a draft, the description, a note, an epic or a task: to you alone, under the block, with
Discard. An output of yours that ran on what a stored output of the block ran on, the same
duckdbandpython, says whether it is the same as that one, the same text that ended the same way (exitandstopped). Otherwise it says what differs in how the two ended, if anything, and stands compared with it: in the views the stored outputs have where the texts differ, and one under the other where only the end does. Under a comment of a thread or of the conversation, Post as a reply writes a reply, a draft in Scratch mode, that holds a line saying whose block it ran, every part of the script as a runnable block, and your outputs after each, so that the reply stands on its own. Post as a reply and Discard stand once for a run, under its first part. A run whose text leaves the page while it goes, as a draft posted with Post all or deleted, or a note removed, here or in another tab, is stopped, and the page says so. - In a rendered Markdown file: to you alone, with Keep as a suggested edit, which makes an edit of the file as the file editor would, from the text that editor would open on, with your outputs after the block in place of those that stood there, in the file's own line ends. The page never writes a file.
Outputs that are yours alone live in the page's memory and are gone when you reload; the page says so beside them.
In the Write tab of a comment, Shift with Enter runs the block the caret is in, and its runs show under the text,
since the blocks are drawn only in Preview; elsewhere in the text the keys make a line break. As soon as the text of a
comment holds a runnable block, its foot says that Shift with Enter runs the block the caret is in, and in the
Write tab the strip under the text has Run for that block, with the picker beside it, named for what it runs on as
Run is everywhere else. It runs the block as the keys do, the same question, key and queue included. With the caret
outside every block the strip says to put the caret in one, and a text without a runnable block shows neither. The
SQL and Python buttons above the text put an empty runnable block at the caret, with the caret inside it. The picker,
the question below and the one for the key open over a dialog that is open, as the note editor or the file editor,
and give it back as it was: its text, its caret and where it was scrolled.
A new comment on lines of the branch's side of a Markdown text, a file in its Diff, Rendered or Split view or the
description, offers Run this code above its text when those lines are a fenced python or sql block, plain or
marked run, or lie inside one; the editor of such a comment drafted offers it too. Removed lines are the merge
base's, so a comment on them offers no copy. Run this code puts a copy of the block's code into the comment, after
what the comment already says and outside a fence it leaves open, as a runnable block of the same kind without a file
name, with the caret in it, so that Shift with Enter runs it there. When the comment holds such a block with that
code already, it puts the caret in that one instead. The copy is in the comment only: the file or the description
does not change.
A comment of yours that starts a thread on a Markdown file or the description, as you write it, in its draft and once
posted, holds the review author's code in every block whose kind and code are those of a fenced block that the text
holds now on the branch, one whose first word is python or sql whatever follows it, as every text of the branch is
the author's. Such a block asks before its first run as the block of the text would, wherever the comment's lines are
and whether or not they have changed since; every other block of the comment is yours and asks nothing, a copy whose
code you changed among them, and so are your replies. A copy asks as long as the text still holds a block with that
code. On a Markdown file that did not load, every block of such a comment asks, until the file loads.
A suggestion is a change of lines and never runs, also when a block in it is marked run, since the page shows it as
lines that change and not as Markdown; a comment that holds such a block in a suggestion says so, and names Run this
code where the comment offers it.
Before the first run of a block that someone else wrote (an agent's comment or note, a file of the branch, the
description, the epic or a task), the page asks, shows the code, and says that it runs on this machine as you, with
your own permissions. Code in the branch's own texts, its files, the description, the epic and tasks, counts as the
review's author's, whoever committed it, so the branch takes one question in a review. Such a text opened for
editing, in the file editor, the description editor, the note editor or a task's summary, holds that author's code
until you change it: a block whose code differs from every block of the text the editor was opened on is yours,
and a block that is as one of them stays the code of whoever the text was by when the editor opened. Both hold
whatever became of the text in the review since: changed by someone else, by you in another tab, or removed. A
draft of the description, shown under it, holds that author's code where a block is as one of the description as
it is now. The answer holds for that author in that review and is kept in the browser's storage, and it runs the
code the question showed: when the block changed while the question was open, it is asked again for what is there
now. The first run in a browser asks for the key that coduck key prints and keeps it in the browser's storage,
in small letters however it was typed; a key the server refuses asks again. Until a run asks for it, nothing of the
page needs the key.
What a block runs on
The page offers what the server finds for the review. CoDuck installs nothing and keeps no environment of its own:
- SQL on each DuckDB command line program installed as
~/.duckdb/cli/VERSION/duckdb. - SQL on a released version from 1.5.0 on, or on a version typed by hand, which uv fetches as the PyPI package
duckdb-clithe first time it is used and keeps in its cache, whenuvis on the server's path. - SQL on each
duckdbprogram built in a folder underbuild/of the worktree that has the review's branch checked out, such asbuild/release/duckdb. - Python in that worktree's
.venv, when it has one. Its duckdb is imported once before the script runs, so that an editable install that rebuilds the client on import builds while the run prepares. - Python on one of the review's run specifications, through uv.
Without uv only what is installed or built is offered to run on; the picker still lists the review's run
specifications, as ones that cannot run without it. DuckDB extensions are not managed: a block says INSTALL and
LOAD itself.
Run specifications
A run specification is a name, a Python version and a list of requirements as pip reads them, such as
duckdb==2.0.1 and pandas>=2. Anyone in the review makes, changes and removes one in the page; no command writes
one. Its name is how the page lists it where one runs, and it never appears in an output. It is a file of its own
in the review, written like a note, but it moves nothing: it changes no state, is new for no one, wakes no waiting
author and does not move the review's activity. coduck show -j carries the review's specifications as specs.
- The name is one line of at most 64 characters, and not all white space.
- The Python version is
MAJOR.MINORorMAJOR.MINOR.PATCH, such as3.12or3.12.3. - At most 50 requirements, each a line of at most 200 characters without white space at either end; an option,
which starts with
-, and a comment, which starts with#, are refused.
A run on a specification has uv make the environment from a script whose header names the Python version and the requirements (PEP 723). uv keeps it in its cache, and fetches what its cache lacks.
How a run goes
A run is one script: a block alone, or the blocks of one Markdown text that are of one kind, SQL or Python, and carry
the same file name, in the order they stand. First it prepares, without a limit, since a build needs the machine's
resources: a release or a specification is fetched through uv, and the branch's .venv imports duckdb once. Before
the script, CoDuck asks a DuckDB program for its help, to learn whether it knows -no-agent; after it, where the
run could not measure them, for its version, or the interpreter for its own. Each such question, like every step of
preparing, is a process group of its own, and a question has 30 seconds. Cancel stops a question before the script.
The question after it is asked also after a Cancel, so that a cancelled run says what it ran on as one a limit
stopped does. After a Cancel it has five seconds, from the Cancel or from its own start when the Cancel came first,
and is killed when they are over; it changes neither the time nor the reason of the stop. Then the script runs:
- In a new folder of its own as its working directory, removed when the run ends. The folders of runs are in the
state folder, under
runs/, which the server makes for the user alone, and not in the machine's shared temporary folder, where another account could plant a link that the removal would follow into the user's own folders, and where on some machines what a query writes would take memory. Each server keeps the folders of its runs in a folder of its own beside a lock that it holds while it lives; when a server starts, it removes what no living server holds and any link it finds there. Whenruns/cannot be made, or is no folder of the user's that nobody else can enter, or the key cannot be had, runs are off:runtimessays why, every request about runs is refused with that reason, and the review server serves all the same. The server looks at the folder and the key when it starts, so a fix, as achmod, takes effect when it starts again, and the reason says so. - With a small environment:
HOME,PATHand the localeC.UTF-8, and nothing else of the server's, so that no variable around the server changes what a program prints. DuckDB 2.0's command line program prints for an AI agent when it sees an agent's variables; it is also started with-no-agent, which a program that knows that option gets. - With the user's permissions and the network as it is: a block can read and write every file the user can, run programs and reach the network. The limits guard a shared machine against accidents, not against a block written to do harm.
- Within limits that hold for its whole process group: the time limit
coduck.runseconds(60 seconds), the memory limitcoduck.runmemory(4G), 4 GB of what it writes into its folder, counted as the blocks allocated to it, links not followed, and looked at twice a second, since DuckDB puts there what does not fit in its memory, at most 256 processes and threads, and 64 KiB of output kept per part; the rest of the output is counted and dropped, and the output says how many bytes. Where systemd runs a manager for the user, the script runs in a scope of the user's own (systemd-run) with that memory, those processes and four CPUs, from which DuckDB takes its own memory limit and number of threads. The end of a run kills whatever is left in the scope, also a process that left its process group or ignores being asked to end, so a run always ends and gives its place back. Elsewhere the time, disk and output limits hold, and DuckDB's own memory setting is the limit. A program that crashes writes no core dump. - A run that a limit ended says which one in the part it stopped:
time limit 60 s,memory limit 4 GB, when the scope says the kernel killed it for its memory, ordisk limit 4 GB; Cancel sayscancelled at 8 s, the time since the script started. Cancel and a limit ask the whole process group, and the scope, to end, and kill them after a grace period of five seconds, thirty while a.venvbuilds, that holds until the last process of the group has ended, not only the first. A program that closes its outputs is watched all the same until it ends.
SQL runs in one process of the DuckDB program, with the whole script as its input at once, the parts in order, as
if they were typed one after the other. After each part CoDuck adds a line that ends a statement the part left
open, and lines that have the program print a line of CoDuck's own to tell the parts' outputs apart; only a whole
line that is exactly that line counts, and the line break before it is CoDuck's too. CoDuck parses no SQL, and
reads how the parts went from those lines alone. A part ends inside a string or a comment, and so swallows the
lines after it, until the string or comment ends: when a later line of CoDuck's comes, what came until it is shown
under the first of the parts that swallowed theirs, and each part between says that its output could not be told
apart. When the program ends and no later line of CoDuck's came, the parts after the last one it reached say not run, the program ended in part N: so it is after .quit, .exit N or an error after .bail on, and also when a
string or a comment that a part opened swallowed everything to the end of the input. The program goes on after an
error, as it does with piped input, and its exit status is that of the whole input. Measuring first sets the
program's output back to its standard output, so that a part that leaves .output FILE or .once FILE on never
gets CoDuck's own lines as its output.
Python runs in a driver that ships with CoDuck, in the interpreter of the .venv or of the specification's
environment. The script is written into the run's folder under its file name, block.py for a block alone, and
runs as the module __main__ with __file__ naming it, as python FILE would run it: a function defined in it
can be pickled, multiprocessing can start processes from it, and tracebacks show its lines. The file is parsed
once as a whole, so a syntax error anywhere keeps it from running; each part then runs the statements that start in
it, compiled with the file's own from __future__ imports, and line numbers count through the file. An exception
that is not caught ends the file, so the parts after it are not run and say so. Each part's standard output and
error go to a pipe of the part's own, so nothing is guessed: output goes under the part during which it is written,
so a thread that part 1 started and that prints during part 2 prints under part 2, and what the program prints
after its last part, at its exit and from its threads, goes under the last part that ran.
After the last part the run measures what it ran on: for SQL PRAGMA version and the extensions loaded beyond
the built in ones, for Python the interpreter's version, duckdb's version and source id when the script loaded it,
and the packages the script loaded. Where the script swallowed the measuring lines or ended before them, the
program's own -version, or the interpreter's version, stands in. A failure while measuring is the run's error
and leaves the parts' outputs and headers as they were.
At most two runs go at once; a third is refused, and so is a run while the server stops. A run lives in the server's memory and nowhere else: nothing of it is written to git, and its folder is removed when it ends. The server keeps the last twenty runs that ended for the page to read, until it stops; a server that restarts forgets the runs that were going and those it kept. A server that stops, on Ctrl-C or when its service stops, first stops every run it has.
Settings
CoDuck has four settings, all git configuration keys, read with git's own layering, so that each can be set for one repo, for a user or for a machine. A setting made for a single worktree is not read, so that a repo's commands and its server read the same names. CoDuck reads no environment variables of its own.
coduck.webuser: the name the page writes as. It defaults to git'suser.name, and the server refuses to start when neither is set.coduck.cliuser: the name a command writes as when its-ngives none. It defaults toagent.coduck.runseconds: how long the running phase of a run may take, in whole seconds from 1 to 86400. It defaults to 60.coduck.runmemory: how much memory a run may take: a number of bytes, or a number followed byK,M,GorT(powers of 1024). ABmay end either form, and the letters may be small or capital, as in4G,512m,2048KBor1073741824. The number has one to twelve digits and is not 0. It defaults to4G, and holds where a scope holds the run.
The server reads the two limits from the configuration of the repo whose review runs a block, at each run, and refuses a run while either holds something else than it takes.
git config coduck.webuser Ada
A name is one line that git stores as given: not empty, no < or >, and no white space, control character or
one of ,:;"'\ at either end; a name that -n gives too. The two names must differ, ignoring case: the server and
every command but skill, check, version, key, list and migrate, which read no names (migrate reads
them for a review in format 1 alone), refuse to run when they are equal, since one thread could then show the same name on both sides. For the same reason a command
refuses a name from -n that is the reviewer's.
A review records the side of every write, so a change of coduck.webuser changes nothing in the reviews that
exist: what the reviewer wrote under the old name stays the reviewer's, and what the page writes from then on
carries the new name.
How a review is stored
A review is the ref refs/coduck/<number> in the repo of its branch, a chain of commits. The tree of each commit
holds review.json, the record of the review, PR.md, the description, a log per thread under threads/, one
event per line, the pending edits under edits/, and a file per note under notes/: its author and side, when it
was added, its place in the order the notes were added, its Markdown and, once it was changed, who changed it, on
which side and when, and a file per run specification under specs/: its name, Python version and requirements,
who made it, when and in which place of their order, and once it was changed, who changed it and when. The
conversation's log also holds the ready signals and the marks needs input. Each commit's message names the action
on its first line, and as trailers below it the branch head and merge base the review compared then (Head,
Merge-Base), the side that wrote it (Role, reviewer or agent), for a message a command posted for the
reviewer the name it was posted through (Through), and the version of CoDuck that wrote it (Coduck; Redline on
a commit written through format 5, when CoDuck had that name). Each event records its author and its side as
author and role, and a message, the opening of a thread and the mark needs input that a command posted for the
reviewer the name they were posted through as through.
review.json holds format, the number of the form the review is stored in; a review without it is in format 1,
everything written before version 0.9.0, format 2 what 0.9.0 and 0.10.0 wrote, and format 3 what 0.11.0 and 0.12.0
wrote, which added the ready signal and notes, format 4 what 0.13.0 to 0.14.3 wrote, which added through, and
format 5 what the last version named redline wrote, which was never released and added run specifications. Through
format 5 CoDuck was named redline, and a review was the ref refs/redline/<number>. Format 6, what 0.15.0 and 0.15.1
wrote, is format 5 under the ref refs/coduck/<number>. This version writes and reads format 7, which adds the mark
needs input, an event of the conversation. The package ships a JSON Schema (draft 2020-12) for each format, under
coduck/schema/<format>/ in the installed package and src/coduck/schema/ in its source: review.schema.json for
review.json, event.schema.json for one line of a thread's log, edit.schema.json for the record of an edit,
from format 3 note.schema.json for a note, and from format 5 spec.schema.json for a run specification. The
schemas of formats 6 and 7 are strict: they name every field and allow no other, and allow through only beside the
role reviewer. Format 1's say what earlier versions could write.
A version reads one format. A review in an older one is refused wherever it is read, by every command and by the
server, with review N of REPO is in format F; run coduck migrate, and one in a newer format with written by a newer CoDuck. The list shows such a repo as one line that says so, without its reviews, and coduck register
says so too. A review still under refs/redline/ is in an older format and is refused the same way; while a repo
holds one, none of its reviews is listed and none is opened.
coduck migrate brings every review of every registered repo that is present to the current format, open and
finished alike, with one commit per step of the format on each review that needs it, named migrate and written
as coduck, on neither side. It prints per repo how many reviews it migrated, names a repo it cannot migrate
with the reason and goes on with the others, and exits 1 when it refused one. A migration commit is no news for a
waiting author and nothing new in the page. The step to format 2 records the reviewer's name in reviewers, as
the setting coduck.webuser (or git's user.name) gives it when the migration runs, so that every older write
whose author has that name counts as the reviewer's and every other as an author's; it is refused for a repo with
no such name. It also records, for a finished review that lacks it, when it finished, as the time of the commit
that finished it, and for a closed review without the span it covered, the span it has at the migration. The step
to format 3 turns the note that a done review was marked done with into a note, added under the name and on the
side of the commit that marked it done, at the time it finished, and takes the note out of review.json; it
changes nothing else. The steps to format 4 and to format 5 change nothing but the format.
The step to format 6 moves the review to the ref it is kept under now. It adds its commit, as every step does, and
then one git transaction, for all the reviews of the repo together, creates each refs/coduck/<number> at that
commit and deletes each refs/redline/<number>: every review is under one of the two names whatever happens in
between, nothing of its history is rewritten, and a repo that is refused keeps every review where it was. A number
that names a ref under both is refused, with both names; delete the ref that is not the review and migrate again.
Before it reads the list of repos, coduck migrate also takes over the state folder of those versions,
~/.local/state/redline/, and says so: its registered repos join the list, each file of drafts moves, and the folder
is removed. A repo whose name the new list holds for another path, and a file of drafts whose name the new folder
holds, give way, each named in a line that starts with left behind. Its key is not taken over, and neither is
what the browser kept for the page under the old name: paste the key that coduck key prints once more, and
every review shows as unread once. The settings are not taken over either: set coduck.webuser and
coduck.cliuser where redline.webuser and redline.cliuser were set.
The step to format 7 changes nothing but the format. The state of a review is read by the rule of this version whatever format its past was written in: an open review whose approval only messages without the mark followed is approved again after the migration, and ready when the ready signal came after that approval.
On an upgrade, stop the server, install the new version, run coduck migrate, and start the server again, so that
no server of the older version writes into a review of the new format.
Where things are kept
- In the repo: each review is the ref
refs/coduck/<number>. Its commits hold the description, one log of events per thread, the pending edits, the notes and the run specifications; each commit carries the name of whoever acted as its author, and records the branch head and merge base it covered. Refs outsiderefs/headsare not pushed or fetched unless asked for, so reviews stay out of ordinary pushes. - On the server's disk, under
~/.local/state/coduck/, or$XDG_STATE_HOME/coduck/when that is set: the list of registered repos (repos), the reviewer's drafts (drafts/), the key that running code needs (key), and the folders of runs (runs/), each server's in a folder of its own with its lock beside it, which hold a run's folder while it goes. - In the browser: the comment mode, what the browser last showed of each review, the key, once the page asked for it, and for each review the authors whose code you said may run. The outputs of a run that are yours alone live in the page's memory and are gone when you reload it.
- In the server's memory: the runs of code blocks that go, and the last twenty that ended, until it stops; a restart forgets them.
The server keeps no database, log or queue. The page and coduck wait read the review refs, so a restart or an
upgrade loses nothing but the runs: those that were going and what it kept of those that ended.
The server
One server shows every registered repo. coduck open registers its repo; coduck register does so without
opening a review. The server listens on 127.0.0.1 only, refuses a request whose Host header does not name
localhost or 127.0.0.1 with its own port, and refuses a write without the header X-Coduck: 1, so that a page
of another site in the same browser cannot reach it. For that reason a port forward from another machine must use
the same port number on both ends. Besides git, it starts programs only to run a code block that someone asked for
in the page, with the key that coduck key prints, and to say what a block can run on: it asks uv, with the
network off, which Pythons it has, and systemd once whether it can make a scope of the user's own; neither runs
anything of a review. CoDuck itself reaches the network only through uv, which fetches what a run needs while it
prepares; what a block's script does on the network, as a SQL block's INSTALL of an extension, is the script's
own. See Running code blocks.
deploy/install.md has the steps for running the server as a user service, upgrading it, and setting the names.
The HTTP API
The page reads and writes through a JSON API under /api/, behind the guard above: every request names this
server in its Host header, and every request but a GET carries X-Coduck: 1. A refused request is answered with
{"error": REASON} and 400 for a malformed request, 404 for what is not there, 409 for what CoDuck refuses and
413 for a body of more than 64 MiB. These are the routes of run specifications and runs. The four routes about
runs, to start, list, read and stop them, also carry X-Coduck-Key, the key that coduck key prints, and are
refused with 403 without it or with another, in words that say how to get it, also while runs are off; with the
key, while runs are off, they are refused with 409 and the reason. While the server has no key, as when it could
not make or read its key file, runs are off: a request about runs whose X-Coduck-Key is any 64 hex digits is
refused with 409 and that reason, and one without such a value with 403. The others need no key:
-
POST /api/reviews/REPO/N/specswith{"name", "python", "requirements"}makes a run specification and answers{"version", "spec"}, the review's new version and the specification's id.PUT /api/reviews/REPO/N/specs/IDwith the same three fields changes it, andDELETE /api/reviews/REPO/N/specs/IDremoves it; both answer{"version"}, and a change to what the specification holds already writes nothing. The review's data (GET /api/reviews/REPO/N) has them asspecs, in the order they were made, each with itsid, the three fields,author,role,at,seqand, once changed,changedBy,changedRoleandchangedAt. -
GET /api/reviews/REPO/N/runtimesanswers what the review's blocks can run on, found as What a block runs on says:off: null while runs can go, else the reason they are off, such as a folder of runs that is a link or that other users can enter, or a key that others can read. Every request about runs is then refused with it.home: the server's home folder, under which the page shows a path as~/....worktree: the folder of the worktree that has the branch checked out, or null.uv: whetheruvis on the server's path.sql:installed, each withversionandpath;releases, the versions uv can fetch from 1.5.0 on; andbuilds, each withbuild, the folder's name underbuild/, andpath.python:venv, null orpath,python(its version, or null when itspyvenv.cfgdoes not say it),duckdb(the version of the duckdb it holds, or null) andeditable(whether that duckdb is an editable install, whose import may build);pythons, the Python versions uv has, each withversionandimplementation, empty without uv; andspecs, as in the review's data.
It starts no program but uv, which it asks with the network off which Pythons it has.
-
POST /api/reviews/REPO/N/runsasks for a run with{"kind", "file", "parts", "on"}, and answers at once with{"run": ID}:kind:sqlorpython.file: the file name of the blocks, or null for a block alone.parts: the code of each part, in order: 1 to 100 texts without NUL, of at most 1,048,576 characters together.on: what to run on, for SQL{"source": "installed", "version": "2.0.1"},{"source": "release", "version": "1.5.3"}or{"source": "build", "build": "release"}, for Python{"source": "venv"}or{"source": "spec", "spec": ID}.
It refuses with 404 a program, build,
.venvor specification that is not there, and with 409 a release or a specification whileuvis not on the path, a limit that its setting does not give, a third run, a run while the server stops, and every run while runs are off. -
GET /api/reviews/REPO/N/runsanswers the runs that go for the review, so that a page that did not start one, as after a reload or in another tab, can show it and stop it:runs, the oldest first, each withid,kind,file,onandphase;going, how many runs go on the server, for every review;most, how many it takes at once; andlimits, as a run's view has them, or null while their settings are wrong. -
GET /api/runs/IDanswers the run as it is now:id,review({"repo", "number"}),kind,fileandon: the run as it was asked for.phase:preparing,runningordone. While it prepares,preparingsaysfetching(through uv) orbuilding(the.venv's first import), else it is null;prepareTextholds the last 64 KiB of what preparing printed, also once the run is done.stopping: whether a stop was asked and the run has not ended;seconds: how long it has run, or ran, from the start of its script, null before.outcome, once done:finished, when the script ended by itself, with any exit status;stopped, by Cancel or a limit, also while it prepared;failed, when it could not prepare, start or be watched, as when something wrote to the driver's own pipe, with the reason inerror. A finished run whose measuring failed says so inerrortoo.limits:seconds,memoryas its setting gives it, andscope, whether a scope holds them.configuration: what the run measured, as the header fields below.parts, one for each part, in order:text, what it printed so far;dropped, how many bytes the output limit dropped;done;ran, whether it started;joined, the number of the part whose text holds its output when the two could not be told apart, or null; andheaderonce the run is done, else null.
-
DELETE /api/runs/IDstops a run: its whole process group and its scope are asked to end, and are killed when the group has not ended five seconds later, thirty while the.venv's import builds; the question after the script, of what the run ran on, then has five seconds. It answers asGETdoes, at once, and changes nothing of a run that ended. A run the server no longer keeps, past the last twenty that ended, answers 404.
A part's header holds the header fields of its output block, each only where it applies, for the page to write
the block from: duckdb, the version and source id, as 2.0.1 (8d78114e90); python, the interpreter's version;
packages, as pandas 2.2.3, numpy 2.1.0; extensions, as httpfs v1.5.6, spatial; exit, the exit status
when it is not 0, or killed by SIGKILL when a signal ended the program; and stopped, as time limit 60 s,
memory limit 4 GB, disk limit 4 GB, cancelled at 8 s, or why the part did not run: not run, part 2 raised ValueError, not run, part 2 does not compile, not run, the program ended in part 2, not run, the time limit stopped part 2, not run, the memory limit stopped part 2, not run, the disk limit stopped part 2, not run, cancelled in part 2 or not run, cancelled while preparing. A limit or a Cancel that came after the last part
ended says so in the last part's stopped. A program's exit status goes on the part during which it ended,
the last part when it ended after them all. Once the run is done, the text of a part that dropped output ends
with a line that says how many bytes, and the text of a part whose output could not be told apart is a line that
names the part whose text holds it; both lines are in square brackets.
Backup and archive
coduck bundle FILEwrites all review refs of the current repo to a git bundle. A fetch from the bundle into a repo with no review refs brings every review back, andcoduck registerthen lists the repo again; reviews from a bundle made before their format changed needcoduck migrateafter that. A bundle made before format 6 holds its reviews underrefs/redline/: fetch them to the same names, and the migration moves them.coduck push REPOSITORYpushes every review of the current repo to an archive repository, named by URL or path; the name of a remote is refused. A review goes torefs/coduck/<repo>/<opened>-<number>-<title>: the time it was opened, in UTC as20261124T092712Z, its number, and the words of its first title in lowercase joined by hyphens, at most 60 characters. The name never changes. The push only fast forwards and never deletes, and it sends the reviews alone, never the commits of the reviewed branches.
Both copy review refs as they are, whatever their format and also where a review is still under refs/redline/,
so that a backup goes on before a migration; a bundle or
the archive can hold reviews in an older format, which coduck migrate brings to the current one once they are
back in a registered repo. A migrated review is a descendant of the one archived before, so its next push is a fast
forward.
Neither runs by itself: a scheduled script calls them. deploy/install.md describes
deploy/backup.sh, a script that does both for every registered repo and that a timer can run, the archive, and
how to restore.
Never configure a fetch that writes into refs/coduck/ in a clone that opens reviews: with pruning on, such a
fetch deletes every review the remote lacks.
What CoDuck does not do
- It does not merge, push or fetch branches, and it never writes to a branch or a worktree, except for
coduck pull, which writes the worktree it runs in. - It has one reviewer and no accounts: whoever reaches the page writes as
coduck.webuser. - It reviews branches of repos on the machine the server runs on.
- It runs a code block only when someone asks for it in the page, never for a command and never on reading; it installs nothing for a run and keeps no environment of its own.
Licence
CoDuck is released under the MIT licence; see LICENSE. The page ships three libraries, unchanged, under
src/coduck/page/vendor/, each with its licence beside it: Highlight.js with its GitHub theme (BSD 3-Clause),
markdown-it (MIT) and Mermaid (MIT). The Mermaid file holds the code of the projects it is built from, and lists
their licences at its end.
Metadata
Release files for coduck 0.16.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coduck-0.16.0.tar.gz | 1.2 MB | With provenance | Details for coduck-0.16.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coduck-0.16.0-py3-none-any.whl | Python 3 | none | any | Details for coduck-0.16.0-py3-none-any.whl |
Total release size: 2.5 MB
Release files / coduck-0.16.0.tar.gz
| Download URL | coduck-0.16.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6de094a412a27698ff49afc842d71cfe298d6c3439b02c722956bde0dba9a6c
|
|
BLAKE2b-256 checksum How to use checksums |
2b94b9ca2c551b7210024f2b1b707d1410de7c31faff81805ef426fda113d296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logRelease files / coduck-0.16.0-py3-none-any.whl
| Download URL | coduck-0.16.0-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
949a5587a01ecf189a06983bbc6d82216ab603a39a0fd7ac0a5018cdf44f6a0b
|
|
BLAKE2b-256 checksum How to use checksums |
ea43da9438d161015c30aa4d9d0c20a04c090186fa812f1bf2990feb699f2563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logSecurity for coduck 0.16.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for coduck-0.16.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.