diffdesk

v0.3.0
io.github.ysBach/diffdesk Checked 4 hours ago Published 3 days ago

Local review desk for agent commits: add review subjects, read verdicts, comments and edits

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

init_review Create the review root

Create the review root, as 'diffdesk init' does: diffdesk.toml, the subjects folder, the edits folder and a .gitignore that makes git ignore the cache folder. If no review root is found from project_dir, the new root is the folder review in the top folder of the git work tree that holds project_dir, else in project_dir; never in the home folder or a filesystem root. If the root is inside a git repository that has a commit, and the root has no subject yet, it also writes one example subject for the first commit. Existing files are kept, so it is safe to call again. Returns root and created (the…

ParameterTypeDescription
project_dirstringAbsolute path of your project folder. Always give it. diffdesk checks this folder and each parent folder up to the top folder of its git work tree: a folder with diffdesk.toml is the review root, else…

add_subject Add a review subject

Write a review subject for one git commit or a commit range, so that a person can review the change in diffdesk. Make the commit first. diffdesk reads the full commit IDs, the work tree path and the changed files from git, checks the subject against the schema and writes <review root>/subjects/<package>/<id>.json. Returns the file path and the subject. By default the diff is HEAD^..HEAD. An existing subject is not replaced unless force is true. Always give project_dir.

ParameterTypeDescription
id *stringSubject ID, unique inside its package. Letters, digits, '.', '_' and '-'; starts with a letter or digit; no '..'. Example: FIX-12.
repo *stringAbsolute path of a folder inside the git work tree that holds the commit.
title *stringOne-line title of the change.
answersarrayThe older subjects whose review this commit answers, as PACKAGE/ID, for example ["mypkg/FIX-1"]. A bare ID names a subject in the package of the new subject. Give it for every commit that acts on a re…
basestringOld side of a commit range. Give head too.
branchstringBranch name for the review tree. Default: none.
commitstringCommit to review against its first parent. Default: HEAD. Do not give it together with base and head.
forcebooleanReplace an existing subject with the same package and ID, for example after a rebase or an amend. Default: false.
headstringNew side of a commit range. Give base too.
packagestringPackage name, same rules as id. Default: the name of the work tree folder.
prioritystringFor example P1, P2 or P3.
project_dirstringAbsolute path of your project folder. Always give it. diffdesk checks this folder and each parent folder up to the top folder of its git work tree: a folder with diffdesk.toml is the review root, else…
recommendedstringSuggested verdict: accept, reject or user-decision.
summarystringOne sentence: what is wrong and what the change does.
tagsarrayFree labels.
whystringReasons for the change, in Markdown, with the headings that get_agent_guide gives: Problem, Evidence, Fix logic, Test, Tradeoffs.

list_reviews List reviews and edits

Read the review state of the subjects, in the order of the review tree. Each item has id, package, title, status (pending, accepted, rejected or change), agent_state (waiting, sent, answered or null), the last verdict, comment and time, history_count, sent_at, answered_by, repo, base, head, edits: [{path, edit_file}], and line_comments: [{path, side, line, line_text, commit, text, at}]. An edit file holds the full new content of one file as the person changed it, not a patch: compare it with that file at the subject's head commit. A line comment is about one line of path on side base or head,…

ParameterTypeDescription
idstringKeep only subjects with this ID.
packagestringKeep only subjects of this package.
project_dirstringAbsolute path of your project folder. Always give it. diffdesk checks this folder and each parent folder up to the top folder of its git work tree: a folder with diffdesk.toml is the review root, else…
statusesarrayKeep only subjects with one of these statuses. Default: all.
waitingbooleantrue: keep only subjects that wait for you (agent_state waiting or sent). Default: false.

get_agent_guide Get the agent guide

Return the diffdesk guide for coding agents, in Markdown: the steps, how to write 'why', the fields of each review and the subject fields. Read it once before the first add_subject call. The guide shows shell commands; these tools do the same work: 'diffdesk init' is init_review, 'diffdesk add' is add_subject, 'diffdesk reviews' is list_reviews and 'diffdesk validate' is validate_subjects. This tool ignores project_dir.

ParameterTypeDescription
project_dirstringAbsolute path of your project folder. Always give it. diffdesk checks this folder and each parent folder up to the top folder of its git work tree: a folder with diffdesk.toml is the review root, else…

validate_subjects Validate all subjects

Check every subject file of the review root against the subject schema, and check that no two files hold the same package and ID. Returns root, files (the number of subject files), problems and warnings. Each problem starts with the file path relative to the root. Problems do not make this call fail. Always give project_dir.

ParameterTypeDescription
project_dirstringAbsolute path of your project folder. Always give it. diffdesk checks this folder and each parent folder up to the top folder of its git work tree: a folder with diffdesk.toml is the review root, else…