diffdesk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffdesk-0.1.0/.gitignore +11 -0
- diffdesk-0.1.0/CHANGELOG.md +25 -0
- diffdesk-0.1.0/LICENSE +21 -0
- diffdesk-0.1.0/PKG-INFO +520 -0
- diffdesk-0.1.0/README.md +491 -0
- diffdesk-0.1.0/pyproject.toml +75 -0
- diffdesk-0.1.0/src/diffdesk/__init__.py +3 -0
- diffdesk-0.1.0/src/diffdesk/agent.py +414 -0
- diffdesk-0.1.0/src/diffdesk/agent_guide.md +112 -0
- diffdesk-0.1.0/src/diffdesk/cli.py +329 -0
- diffdesk-0.1.0/src/diffdesk/config.py +130 -0
- diffdesk-0.1.0/src/diffdesk/gitio.py +391 -0
- diffdesk-0.1.0/src/diffdesk/index.py +635 -0
- diffdesk-0.1.0/src/diffdesk/mcp.py +472 -0
- diffdesk-0.1.0/src/diffdesk/server.py +750 -0
- diffdesk-0.1.0/src/diffdesk/static/app.js +402 -0
- diffdesk-0.1.0/src/diffdesk/static/index.html +129 -0
- diffdesk-0.1.0/src/diffdesk/static/js/api.js +58 -0
- diffdesk-0.1.0/src/diffdesk/static/js/boot.js +12 -0
- diffdesk-0.1.0/src/diffdesk/static/js/diffview.js +359 -0
- diffdesk-0.1.0/src/diffdesk/static/js/dom.js +82 -0
- diffdesk-0.1.0/src/diffdesk/static/js/editor-cm.js +225 -0
- diffdesk-0.1.0/src/diffdesk/static/js/editor-monaco.js +116 -0
- diffdesk-0.1.0/src/diffdesk/static/js/flow.js +227 -0
- diffdesk-0.1.0/src/diffdesk/static/js/hunks.js +40 -0
- diffdesk-0.1.0/src/diffdesk/static/js/markdown.js +102 -0
- diffdesk-0.1.0/src/diffdesk/static/js/settings.js +228 -0
- diffdesk-0.1.0/src/diffdesk/static/js/subject.js +127 -0
- diffdesk-0.1.0/src/diffdesk/static/js/tree.js +492 -0
- diffdesk-0.1.0/src/diffdesk/static/js/treemap.js +217 -0
- diffdesk-0.1.0/src/diffdesk/static/style.css +508 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/LICENSES.txt +603 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/codemirror.js +24 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Main-Bold.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Main-Italic.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Main-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Math-Italic.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Script-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/fonts/OFL.txt +102 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/katex.css +2 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/katex.js +258 -0
- diffdesk-0.1.0/src/diffdesk/static/vendor/marked.js +72 -0
- diffdesk-0.1.0/src/diffdesk/subject.schema.json +59 -0
- diffdesk-0.1.0/tests/conftest.py +248 -0
- diffdesk-0.1.0/tests/test_agent.py +330 -0
- diffdesk-0.1.0/tests/test_api.py +422 -0
- diffdesk-0.1.0/tests/test_cli.py +215 -0
- diffdesk-0.1.0/tests/test_gitio.py +69 -0
- diffdesk-0.1.0/tests/test_index.py +195 -0
- diffdesk-0.1.0/tests/test_mcp.py +342 -0
- diffdesk-0.1.0/vendor-src/OFL.txt +102 -0
- diffdesk-0.1.0/vendor-src/build.mjs +171 -0
- diffdesk-0.1.0/vendor-src/package-lock.json +886 -0
- diffdesk-0.1.0/vendor-src/package.json +22 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-26)
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `diffdesk serve`, `diffdesk init` and `diffdesk validate` commands.
|
|
10
|
+
- `diffdesk add`, `diffdesk reviews` and `diffdesk guide` commands for coding agents.
|
|
11
|
+
- `diffdesk mcp`: MCP server on standard input and output with the tools
|
|
12
|
+
`add_subject`, `list_reviews`, `get_agent_guide` and `validate_subjects`.
|
|
13
|
+
It supports MCP revisions 2026-07-28, 2025-11-25 and 2025-06-18.
|
|
14
|
+
- Commands that take a review root find it in this order: the folder argument
|
|
15
|
+
(`--root` for `diffdesk mcp`), the environment variable `DIFFDESK_ROOT`, the
|
|
16
|
+
current folder.
|
|
17
|
+
- HTTP API version 1: `/api/meta`, `/api/tree`, `/api/subjects`, `/api/subject`,
|
|
18
|
+
`/api/flow`, `/api/treemap`, `/api/diff`, `POST /api/review`, `POST /api/edit`.
|
|
19
|
+
- Subject index cached by file modification time, line counts cached in
|
|
20
|
+
`<cache>/numstat.json`.
|
|
21
|
+
- `subject.schema.json` (JSON Schema draft 2020-12) for subject files.
|
|
22
|
+
- Browser app: tree, flow and treemap views, CodeMirror 6 (bundled) and Monaco
|
|
23
|
+
diff editors, hunk mode for large files, and a settings panel with themes.
|
|
24
|
+
- Setup steps for AI coding tools in the README.
|
|
25
|
+
- Release to PyPI and to the MCP Registry (`server.json`) from GitHub Actions.
|
diffdesk-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ysBach
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
diffdesk-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: diffdesk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local, file-based review desk for commits made by agents or people
|
|
5
|
+
Project-URL: Homepage, https://github.com/ysBach/diffdesk
|
|
6
|
+
Project-URL: Issues, https://github.com/ysBach/diffdesk/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/ysBach/diffdesk/blob/main/CHANGELOG.md
|
|
8
|
+
License-Expression: MIT AND OFL-1.1
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: src/diffdesk/static/vendor/LICENSES.txt
|
|
11
|
+
License-File: src/diffdesk/static/vendor/fonts/OFL.txt
|
|
12
|
+
Keywords: code review,coding agents,diff,git,mcp,review
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
25
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
26
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# diffdesk
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: io.github.ysBach/diffdesk -->
|
|
33
|
+
|
|
34
|
+
A local, file-based review desk for commits made by coding agents or by people.
|
|
35
|
+
|
|
36
|
+
## What it is
|
|
37
|
+
|
|
38
|
+
An agent writes one JSON file, a *subject*, per change: a commit range plus the
|
|
39
|
+
reasons for the change. You open diffdesk in the browser, read the reasons, look
|
|
40
|
+
at the diff, and accept, reject or ask for a change. You can also write a comment
|
|
41
|
+
or edit the new side of a file. Verdicts and edits are plain files in the review
|
|
42
|
+
folder, so agents can read them back.
|
|
43
|
+
|
|
44
|
+
- Server: Python standard library only (Python 3.11 or newer), no runtime dependencies.
|
|
45
|
+
- Data: plain JSON files and git. No database, no background threads, no polling.
|
|
46
|
+
- Network: binds 127.0.0.1 by default and accepts only requests addressed to it.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv tool install diffdesk # install the command with uv
|
|
52
|
+
pipx install diffdesk # or with pipx
|
|
53
|
+
uvx diffdesk serve review # or run it without installing
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To install the newest code from GitHub instead:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uv tool install git+https://github.com/ysBach/diffdesk
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quick start
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd my-project
|
|
66
|
+
diffdesk init review # creates review/diffdesk.toml, review/subjects/, review/edits/
|
|
67
|
+
diffdesk validate review # checks every subject file
|
|
68
|
+
diffdesk serve review --open # opens http://127.0.0.1:8765/
|
|
69
|
+
diffdesk add review --id FIX-1 --title "Fix the pager" # subject for the last commit
|
|
70
|
+
diffdesk reviews review # verdicts and edits as JSON
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If `review/` is inside a git repository that has at least one commit, `init`
|
|
74
|
+
also writes `review/subjects/example/EXAMPLE-1.json`, which shows the first
|
|
75
|
+
commit of that repository. Delete it when you add real subjects.
|
|
76
|
+
|
|
77
|
+
## Review root
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
review/
|
|
81
|
+
diffdesk.toml optional settings
|
|
82
|
+
subjects/<package>/<ID>.json written by agents (diffdesk add)
|
|
83
|
+
reviews.json written by diffdesk: every verdict, oldest first
|
|
84
|
+
edits/<package>/<ID>/<path> written by diffdesk: your edited new side of a file
|
|
85
|
+
.diffdesk-cache/ written by diffdesk: line counts (safe to delete)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Commands that take a review root (`serve`, `init`, `validate`, `add`, `reviews`
|
|
89
|
+
and `mcp`) find it in this order: the folder on the command line (`--root PATH`
|
|
90
|
+
for `mcp`), the environment variable `DIFFDESK_ROOT`, the current folder.
|
|
91
|
+
|
|
92
|
+
## Subject JSON fields
|
|
93
|
+
|
|
94
|
+
Only `id` and `title` are required. `subject.schema.json` (JSON Schema draft
|
|
95
|
+
2020-12, inside the package) describes every field. Unknown fields are kept and
|
|
96
|
+
shown in the "More" table.
|
|
97
|
+
|
|
98
|
+
| Field | Type | Meaning |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `id` | string | Letters, digits, `.`, `_`, `-`; starts with a letter or digit; no `..`. Unique inside its package. |
|
|
101
|
+
| `title` | string | One-line title. |
|
|
102
|
+
| `package` | string | Same rules as `id`. Default: the first folder below `subjects/` (`default` for a file directly in it). |
|
|
103
|
+
| `priority`, `origin`, `recommended` | string | For example `P1`; `new`; `accept`, `reject` or `user-decision`. |
|
|
104
|
+
| `decisions`, `refs`, `tags` | list of strings | Decision IDs, supporting documents, free labels. |
|
|
105
|
+
| `summary` | string | One sentence: what is wrong and what the change does. |
|
|
106
|
+
| `why` | string | Markdown. LaTeX in `$...$` is allowed. |
|
|
107
|
+
| `repo` | string or null | Absolute path of the git work tree. |
|
|
108
|
+
| `base`, `head` | string or null | Old and new side of the diff (commit IDs, or any revision without `:`, `..` or white space). Both null: the subject has no diff. |
|
|
109
|
+
| `files` | list of strings | Paths relative to `repo` to review. Empty: every file changed between `base` and `head`. |
|
|
110
|
+
| `tests` | string | Test command and result. |
|
|
111
|
+
| `senior_verdict` | string | Verdict of a second reviewer. |
|
|
112
|
+
| `branch` | string | Branch name for the tree view. Default: the branch checked out in `repo` (`HEAD` if detached, `(no repo)` without a repo). |
|
|
113
|
+
| `order` | number | Position in the branch when commit order cannot decide. |
|
|
114
|
+
| `depends_on` | list of strings | IDs of subjects (or package names) this subject depends on. |
|
|
115
|
+
|
|
116
|
+
Order inside a branch: subjects whose `head` is a commit come first, in
|
|
117
|
+
`git rev-list --reverse --topo-order` order (parents before children). Then
|
|
118
|
+
subjects with `order`, by `order`. Then the rest. Ties use the same rule, and at
|
|
119
|
+
the end the ID in natural order (`SB-2` before `SB-12`).
|
|
120
|
+
|
|
121
|
+
## Configuration
|
|
122
|
+
|
|
123
|
+
`diffdesk.toml` in the review root. Every value is optional. Paths are relative
|
|
124
|
+
to the root and must not contain `..`. diffdesk reads the file at start; restart
|
|
125
|
+
after you change it.
|
|
126
|
+
|
|
127
|
+
```toml
|
|
128
|
+
title = "Package review" # default: the name of the root folder
|
|
129
|
+
[paths]
|
|
130
|
+
subjects = "subjects"
|
|
131
|
+
reviews = "reviews.json"
|
|
132
|
+
edits = "edits"
|
|
133
|
+
cache = ".diffdesk-cache"
|
|
134
|
+
[packages.webapp] # used by the flow view
|
|
135
|
+
depends_on = ["core", "utils"]
|
|
136
|
+
[ui] # defaults for the settings panel
|
|
137
|
+
theme = "system"
|
|
138
|
+
editor = "codemirror"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## HTTP API (version 1)
|
|
142
|
+
|
|
143
|
+
All responses are JSON. A body larger than 1 KB is gzip-compressed when the
|
|
144
|
+
client sends `Accept-Encoding: gzip`. GET responses carry an `ETag` and
|
|
145
|
+
`Cache-Control: no-cache`, and a matching `If-None-Match` gives 304. Errors are
|
|
146
|
+
`{"error": "..."}` with status 400 (bad input), 403 (host or origin), 404, 409,
|
|
147
|
+
415 or 500.
|
|
148
|
+
|
|
149
|
+
A subject is named by `id`. If two packages use the same ID, add `package`
|
|
150
|
+
(query parameter or body field); without it the server answers 400.
|
|
151
|
+
`diffdesk validate` warns about such IDs.
|
|
152
|
+
|
|
153
|
+
| Request | Response |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `GET /api/meta` | `{name, version, title, root, packages: {name: {depends_on}}, ui_defaults, counts: {total, by_status}}` |
|
|
156
|
+
| `GET /api/tree` | `[{package, total, reviewed, by_status, branches: [{name, repo, total, reviewed, by_status}]}]` |
|
|
157
|
+
| `GET /api/subjects?package=&branch=&repo=&q=&status=&offset=0&limit=200` | `{total, items: [light subject]}` |
|
|
158
|
+
| `GET /api/subject?id=&package=` | the subject file, plus `package`, `branch`, `status`, `edited`, `review: {verdict, comment, at, history_count}`, and `files: [{path, lines_added, lines_deleted, size_base, size_head, lines_base, lines_head, edited}]` |
|
|
159
|
+
| `GET /api/flow` | `{nodes: [{package, total, reviewed, by_status}], edges: [[package, dependency], ...]}` |
|
|
160
|
+
| `GET /api/treemap?package=` | `[{id, package, branch, title, status, lines_added, lines_deleted}]` |
|
|
161
|
+
| `GET /api/diff?id=&package=&path=&mode=full` | `{base, head, edit, language, binary}` |
|
|
162
|
+
| `GET /api/diff?id=&package=&path=&mode=hunks&context=3&ignore_ws=0` | `{hunks: [{old_start, old_lines, new_start, new_lines, lines}], binary}` |
|
|
163
|
+
| `POST /api/review` `{id, package?, verdict, comment?}` | the stored record plus `status` |
|
|
164
|
+
| `POST /api/edit` `{id, package?, path, content}` | `{id, package, path, saved}`; `content: null` removes the edit and `saved` is null |
|
|
165
|
+
|
|
166
|
+
Details:
|
|
167
|
+
|
|
168
|
+
- **Status** of a subject: the last verdict, as `accepted`, `rejected` or
|
|
169
|
+
`change`, else `pending`. `by_status` always has these 4 keys. `reviewed` =
|
|
170
|
+
`total` minus `pending`. `edited` is a separate flag: at least one saved edit.
|
|
171
|
+
- **Light subject**: `{id, package, branch, title, priority, origin, recommended,
|
|
172
|
+
senior_verdict, status, edited, order, files_count, lines_added, lines_deleted}`.
|
|
173
|
+
`order` is the subject's own `order` field. Line counts cover only the listed
|
|
174
|
+
`files`, if the subject lists any. A subject without a diff has 0 lines. Counts
|
|
175
|
+
are null if git cannot compute them.
|
|
176
|
+
- **Filters**: `package`, `branch` and `repo` match exactly. `status` takes one
|
|
177
|
+
or more statuses separated by commas. `q` matches subjects whose ID, title,
|
|
178
|
+
summary and tags contain every word of `q` (case is ignored).
|
|
179
|
+
- **Sizes**: `size_base` and `size_head` are bytes. `lines_base` and
|
|
180
|
+
`lines_head` are line counts. All four are null where the file is absent.
|
|
181
|
+
- **Diff, full mode**: `base` or `head` is null where the file is absent. For a
|
|
182
|
+
binary file (a NUL byte in either side) both are null and `binary` is true.
|
|
183
|
+
`edit` is the saved edit or null. `language` is an editor language name from
|
|
184
|
+
the file extension, or null.
|
|
185
|
+
- **Diff, hunks mode**: from `git diff -U<context>`. Each line starts with `+`,
|
|
186
|
+
`-`, a space, or `\` (git's "No newline at end of file" note). `ignore_ws=1`
|
|
187
|
+
passes `-w`.
|
|
188
|
+
- **Diff caching**: add `base` and `head` (the commit IDs from `/api/subject`)
|
|
189
|
+
to the query to pin the request. A pinned hunks response for full commit IDs
|
|
190
|
+
is sent with `Cache-Control: max-age=31536000, immutable`. Full mode is never
|
|
191
|
+
immutable, because it holds the saved edit; it is revalidated with its ETag.
|
|
192
|
+
If the subject now points at other commits, a pinned request gets 409.
|
|
193
|
+
- A subject with no diff gives 404 on `/api/diff` and 400 on `/api/edit`.
|
|
194
|
+
- **Review records** in `reviews.json`: `{id, package, verdict, comment, at}`,
|
|
195
|
+
with `verdict` one of `accept`, `reject`, `change` and `at` an ISO 8601 time. A
|
|
196
|
+
record without `package` applies to every subject with that ID.
|
|
197
|
+
- **Edits** are stored at `edits/<package>/<id>/<path>`. Only files of the
|
|
198
|
+
subject can be edited.
|
|
199
|
+
|
|
200
|
+
Security: the `Host` header must be `127.0.0.1:<port>`, `localhost:<port>`,
|
|
201
|
+
`[::1]:<port>`, or the `--host` value with the port (except `0.0.0.0` and `::`). POST requests need
|
|
202
|
+
`Content-Type: application/json`, an `Origin` (if sent) of the same host, and no
|
|
203
|
+
cross-site `Sec-Fetch-Site`. IDs, packages, revisions and paths are validated
|
|
204
|
+
(no `..`, no absolute paths, only listed files), git runs with a list of
|
|
205
|
+
arguments and no shell, and writes go only to `reviews.json` and `edits/`
|
|
206
|
+
(and the cache folder).
|
|
207
|
+
|
|
208
|
+
## Settings
|
|
209
|
+
|
|
210
|
+
Server values (fixed in the code):
|
|
211
|
+
|
|
212
|
+
| Setting | Default | Note |
|
|
213
|
+
| --- | --- | --- |
|
|
214
|
+
| Port | 8765 | arbitrary; `--port 0` picks a free port |
|
|
215
|
+
| Git timeout | 60 s | arbitrary |
|
|
216
|
+
| Gzip threshold | 1 KB | arbitrary |
|
|
217
|
+
| Gzip level | 6 | zlib's own default |
|
|
218
|
+
| Page size (`limit`) | 200 | arbitrary |
|
|
219
|
+
| Diff context | 3 lines | git's own default |
|
|
220
|
+
|
|
221
|
+
Settings panel (stored in the browser; defaults from `[ui]`). A value chosen in
|
|
222
|
+
the browser wins over `[ui]`, and `[ui]` wins over the built-in default. A `[ui]`
|
|
223
|
+
value of the wrong type, or not in the list of values, is ignored. "Reset to
|
|
224
|
+
defaults" removes the values chosen in the browser.
|
|
225
|
+
|
|
226
|
+
| `[ui]` key | Values | Default | Note |
|
|
227
|
+
| --- | --- | --- | --- |
|
|
228
|
+
| `theme` | `system`, `light`, `dark`, `contrast` | `system` | `system` follows the light or dark mode of the operating system. `contrast` is high contrast. |
|
|
229
|
+
| `accent` | `""` or a CSS colour, for example `"#0a66c2"` | `""` | `""` uses the accent colour of the theme. |
|
|
230
|
+
| `ui_font_size` | integer, 1 or more (px) | `13` | |
|
|
231
|
+
| `code_font` | CSS `font-family` list | `ui-monospace, SFMono-Regular, Menlo, Consolas, monospace` | |
|
|
232
|
+
| `code_font_size` | integer, 1 or more (px) | `12` | |
|
|
233
|
+
| `editor` | `codemirror`, `monaco` | `codemirror` | CodeMirror is bundled and works offline. Monaco loads from `cdn.jsdelivr.net` when you choose it. |
|
|
234
|
+
| `layout` | `side-by-side`, `inline` | `side-by-side` | |
|
|
235
|
+
| `word_wrap` | `true`, `false` | `false` | |
|
|
236
|
+
| `ignore_whitespace` | `true`, `false` | `false` | Full diffs ignore spaces and tabs at the start and end of lines. Hunk mode uses `git diff -w`. |
|
|
237
|
+
| `collapse_unchanged` | `true`, `false` | `false` | Full diffs only. Folds unchanged lines and keeps `context_lines` lines around each change. |
|
|
238
|
+
| `context_lines` | integer, 0 or more | `3` | git's own default. Used in hunk mode and when unchanged lines are folded. |
|
|
239
|
+
| `full_diff_limit` | integer, 1 or more (lines) | `20000` | arbitrary. A file with more lines than this (base or head, whichever is longer) opens in hunk mode. "Load full file" shows the full file. |
|
|
240
|
+
| `reduced_motion` | `system`, `reduce`, `allow` | `system` | `system` follows the reduced-motion setting of the operating system. |
|
|
241
|
+
|
|
242
|
+
## Keyboard keys
|
|
243
|
+
|
|
244
|
+
| Key | Where | Action |
|
|
245
|
+
| --- | --- | --- |
|
|
246
|
+
| `j` / `k` | Outside text fields and editors | Open the next / previous subject in the tree |
|
|
247
|
+
| Up / Down | Tree | Move one row |
|
|
248
|
+
| Page Up / Page Down | Tree | Move one page |
|
|
249
|
+
| Home / End | Tree | Move to the first / last row |
|
|
250
|
+
| Right / Left | Tree | Expand / collapse a row. Left on a collapsed row moves to its parent. |
|
|
251
|
+
| Enter or Space | Tree | Open the subject or file, or expand / collapse the row |
|
|
252
|
+
| Cmd+S or Ctrl+S | Editor | Save the edit |
|
|
253
|
+
| Cmd+F or Ctrl+F | Editor | Search in the editor |
|
|
254
|
+
| Escape, then Tab | CodeMirror editor | Move the focus out of the editor |
|
|
255
|
+
|
|
256
|
+
## How agents use it
|
|
257
|
+
|
|
258
|
+
Any agent that can run shell commands can use diffdesk. `diffdesk guide` prints
|
|
259
|
+
a short guide for agents. Tell the agent to run it, or paste its output into the
|
|
260
|
+
agent's instructions. Agents that support MCP can use the MCP server instead
|
|
261
|
+
(see "Use with AI tools").
|
|
262
|
+
|
|
263
|
+
1. The agent commits one change and runs `diffdesk add` to write a subject for it.
|
|
264
|
+
2. You review the subjects in the browser (`diffdesk serve`).
|
|
265
|
+
3. The agent runs `diffdesk reviews --status change --status rejected` to read
|
|
266
|
+
your verdicts, comments and edits.
|
|
267
|
+
4. An edit file holds the full new content of a file, as you changed it. The
|
|
268
|
+
agent compares it with the file at the subject's `head`.
|
|
269
|
+
|
|
270
|
+
If the agent rewrites a commit (rebase or amend), it runs `diffdesk add` again
|
|
271
|
+
with the same `--id` and `--force`, so that the subject points at the new commit.
|
|
272
|
+
|
|
273
|
+
### `diffdesk add [ROOT]`
|
|
274
|
+
|
|
275
|
+
Writes `<subjects>/<package>/<ID>.json` for one commit or a commit range. The
|
|
276
|
+
command gets these fields from git: `repo` (absolute path of the top folder of
|
|
277
|
+
the work tree), `base` and `head` (full commit IDs), and `files` (every path
|
|
278
|
+
changed between `base` and `head`). The diff has no rename detection, so a
|
|
279
|
+
renamed file is listed with its old and new path, and a deleted file with its
|
|
280
|
+
old path. The command checks the subject against `subject.schema.json` and
|
|
281
|
+
writes the file atomically.
|
|
282
|
+
|
|
283
|
+
| Option | Meaning |
|
|
284
|
+
| --- | --- |
|
|
285
|
+
| `--id ID` | Required. Subject ID (same rules as the `id` field). |
|
|
286
|
+
| `--title TEXT` | Required. One-line title. |
|
|
287
|
+
| `--repo PATH` | A folder inside the git work tree. Default: the current folder. |
|
|
288
|
+
| `--commit REV` | Commit to review against its first parent. Default: `HEAD`. A commit without a parent is compared with the empty tree. |
|
|
289
|
+
| `--base REV --head REV` | A commit range, instead of `--commit`. |
|
|
290
|
+
| `--package NAME` | Default: the name of the work tree folder. |
|
|
291
|
+
| `--summary`, `--priority`, `--recommended`, `--branch` | Subject fields of the same name. |
|
|
292
|
+
| `--why TEXT` or `--why-file PATH` | Reasons in Markdown. `--why-file -` reads standard input (UTF-8). |
|
|
293
|
+
| `--tag TEXT` | Free label. Repeatable. |
|
|
294
|
+
| `--force` | Replace an existing subject file. |
|
|
295
|
+
| `--json` | Print the written subject as JSON. |
|
|
296
|
+
|
|
297
|
+
The command refuses to write if the subject file exists (without `--force`), if
|
|
298
|
+
another file holds a subject with the same package and ID, if the file would be
|
|
299
|
+
outside the review root, or if the review root does not exist.
|
|
300
|
+
|
|
301
|
+
### `diffdesk reviews [ROOT]`
|
|
302
|
+
|
|
303
|
+
Prints a JSON list with one object for each subject, in the order of the tree:
|
|
304
|
+
|
|
305
|
+
| Field | Meaning |
|
|
306
|
+
| --- | --- |
|
|
307
|
+
| `id`, `package`, `title` | The subject. |
|
|
308
|
+
| `status` | `pending`, `accepted`, `rejected` or `change`. |
|
|
309
|
+
| `verdict`, `comment`, `at` | The last review record (`at` is read from `time` in old records). Null if there is no record. |
|
|
310
|
+
| `history_count` | Number of review records for the subject. |
|
|
311
|
+
| `repo`, `head` | Work tree and new-side commit of the subject. |
|
|
312
|
+
| `edits` | `[{path, edit_file}]`: the file path in the repository and the absolute path of the saved edit. |
|
|
313
|
+
|
|
314
|
+
Filters: `--status STATUS` (repeatable), `--package NAME`, `--id ID`.
|
|
315
|
+
`--format text` prints a short table instead of JSON.
|
|
316
|
+
|
|
317
|
+
### `diffdesk guide`
|
|
318
|
+
|
|
319
|
+
Prints the guide for agents. The text is `agent_guide.md` inside the package.
|
|
320
|
+
|
|
321
|
+
Exit codes of all commands: 0 on success, 1 if the command fails (the message
|
|
322
|
+
goes to standard error), 2 if `diffdesk.toml` or the command line is not valid.
|
|
323
|
+
`diffdesk validate` also gives 1 if a subject file has a problem.
|
|
324
|
+
|
|
325
|
+
## Use with AI tools
|
|
326
|
+
|
|
327
|
+
diffdesk works with a coding agent in one of two ways:
|
|
328
|
+
|
|
329
|
+
1. **Commands.** An agent that can run shell commands uses `diffdesk add`,
|
|
330
|
+
`diffdesk reviews` and `diffdesk guide` (see "How agents use it").
|
|
331
|
+
2. **MCP server.** `diffdesk mcp [--root PATH]` runs an MCP server on standard
|
|
332
|
+
input and output (stdio). Its tools do the work of the commands:
|
|
333
|
+
|
|
334
|
+
| Tool | Same as |
|
|
335
|
+
| --- | --- |
|
|
336
|
+
| `add_subject` | `diffdesk add` |
|
|
337
|
+
| `list_reviews` | `diffdesk reviews` |
|
|
338
|
+
| `get_agent_guide` | `diffdesk guide` |
|
|
339
|
+
| `validate_subjects` | `diffdesk validate` |
|
|
340
|
+
|
|
341
|
+
The MCP server uses the review root given by `--root`, else the environment
|
|
342
|
+
variable `DIFFDESK_ROOT`, else the folder in which the tool starts the server.
|
|
343
|
+
If the tool starts it in another folder, add `"--root", "/absolute/path/to/review"`
|
|
344
|
+
after `"mcp"` in the arguments. The server speaks MCP revisions 2026-07-28,
|
|
345
|
+
2025-11-25 and 2025-06-18.
|
|
346
|
+
|
|
347
|
+
If diffdesk is not installed, use `uvx` as the command and `diffdesk mcp` as its
|
|
348
|
+
arguments: `"command": "uvx", "args": ["diffdesk", "mcp"]`.
|
|
349
|
+
|
|
350
|
+
Each setup below follows the documentation of the tool (read in November 2026).
|
|
351
|
+
The label after each tool name says whether the setup was run with diffdesk.
|
|
352
|
+
|
|
353
|
+
### Tested with
|
|
354
|
+
|
|
355
|
+
The tests on 2026-11-25 and 2026-11-26 used a small git repository with one
|
|
356
|
+
bug and one failing test. Round 1: the agent fixed the bug, made a commit and
|
|
357
|
+
wrote a subject.
|
|
358
|
+
Then a person asked for a change, with a comment and an edit of the fixed file.
|
|
359
|
+
Round 2: the agent read the review, made a new commit and wrote a new subject.
|
|
360
|
+
|
|
361
|
+
| Tool | Version | Model | MCP result | CLI result |
|
|
362
|
+
| --- | --- | --- | --- | --- |
|
|
363
|
+
| Claude Code | 2.1.308 | claude-opus-5-5 | Round 1 and round 2 passed (MCP revision 2026-07-28). | Round 1 passed (`diffdesk add`). |
|
|
364
|
+
| Codex CLI | 0.162.1 | gpt-6-luna | Round 1 and round 2 passed (MCP revision 2025-06-18). | Round 1 passed (`diffdesk guide`, then `diffdesk add`). |
|
|
365
|
+
| A Gemini model through shell commands (not Gemini CLI) | - | gemini-3.8-flash | Not run. | Round 1 and round 2 passed. |
|
|
366
|
+
| opencode | 1.19.4 | none | The server connected (MCP revision 2025-11-25). Model runs did not finish because of model service errors. | Not run. |
|
|
367
|
+
|
|
368
|
+
### Claude Code (tested 2026-11-26, Claude Code 2.1.308, claude-opus-5-5)
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
claude mcp add --transport stdio --scope project diffdesk -- diffdesk mcp
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
`--scope project` stores the server in `.mcp.json` in the project. You can also
|
|
375
|
+
write that file yourself:
|
|
376
|
+
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"mcpServers": {
|
|
380
|
+
"diffdesk": { "command": "diffdesk", "args": ["mcp"] }
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Codex CLI (tested 2026-11-25, Codex CLI 0.162.1, gpt-6-luna)
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
codex mcp add diffdesk -- diffdesk mcp
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Or add this to `~/.codex/config.toml` (or `.codex/config.toml` in a trusted
|
|
392
|
+
project):
|
|
393
|
+
|
|
394
|
+
```toml
|
|
395
|
+
[mcp_servers.diffdesk]
|
|
396
|
+
command = "diffdesk"
|
|
397
|
+
args = ["mcp"]
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Gemini CLI (set up per docs, not run)
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
gemini mcp add -s project diffdesk diffdesk mcp
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Or add this to `.gemini/settings.json` in the project (or
|
|
407
|
+
`~/.gemini/settings.json`):
|
|
408
|
+
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"mcpServers": {
|
|
412
|
+
"diffdesk": { "command": "diffdesk", "args": ["mcp"] }
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Cursor (set up per docs, not run)
|
|
418
|
+
|
|
419
|
+
Add this to `.cursor/mcp.json` in the project (or `~/.cursor/mcp.json` for every
|
|
420
|
+
project). The Cursor CLI (`agent`) reads the same file.
|
|
421
|
+
|
|
422
|
+
```json
|
|
423
|
+
{
|
|
424
|
+
"mcpServers": {
|
|
425
|
+
"diffdesk": { "type": "stdio", "command": "diffdesk", "args": ["mcp"] }
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### opencode (MCP connection tested 2026-11-25, opencode 1.19.4, model runs not completed)
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
opencode mcp add diffdesk -- diffdesk mcp
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Or add this to `opencode.json` in the project (or
|
|
437
|
+
`~/.config/opencode/opencode.json`):
|
|
438
|
+
|
|
439
|
+
```json
|
|
440
|
+
{
|
|
441
|
+
"$schema": "https://opencode.ai/config.json",
|
|
442
|
+
"mcp": {
|
|
443
|
+
"servers": {
|
|
444
|
+
"diffdesk": { "type": "local", "command": ["diffdesk", "mcp"] }
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
This is the opencode V2 format. In V1, the server goes directly under `"mcp"`,
|
|
451
|
+
without `"servers"`.
|
|
452
|
+
|
|
453
|
+
### VS Code with GitHub Copilot (set up per docs, not run)
|
|
454
|
+
|
|
455
|
+
Add this to `.mcp.json` at the root of the workspace (or
|
|
456
|
+
`~/.copilot/mcp-config.json` for every workspace):
|
|
457
|
+
|
|
458
|
+
```json
|
|
459
|
+
{
|
|
460
|
+
"mcpServers": {
|
|
461
|
+
"diffdesk": { "type": "stdio", "command": "diffdesk", "args": ["mcp"], "tools": ["*"] }
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
For new Copilot setups, VS Code marks the older `.vscode/mcp.json` file (with
|
|
467
|
+
`"servers"` in place of `"mcpServers"`) as deprecated.
|
|
468
|
+
|
|
469
|
+
### Devin Desktop, formerly Windsurf (set up per docs, not run)
|
|
470
|
+
|
|
471
|
+
With the Devin CLI:
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
devin mcp add -s project diffdesk -- diffdesk mcp
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Or add this to `.devin/mcp_config.json` in the project (or
|
|
478
|
+
`~/.config/devin/mcp_config.json`):
|
|
479
|
+
|
|
480
|
+
```json
|
|
481
|
+
{
|
|
482
|
+
"mcpServers": {
|
|
483
|
+
"diffdesk": { "command": "diffdesk", "args": ["mcp"] }
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Grok Build (set up per docs, not run)
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
grok mcp add --scope project diffdesk -- diffdesk mcp
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Or add this to `.grok/config.toml` in the project (or `~/.grok/config.toml`):
|
|
495
|
+
|
|
496
|
+
```toml
|
|
497
|
+
[mcp_servers.diffdesk]
|
|
498
|
+
command = "diffdesk"
|
|
499
|
+
args = ["mcp"]
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Grok Build also reads a project `.mcp.json` in the Claude Code format above.
|
|
503
|
+
|
|
504
|
+
### Agents without MCP
|
|
505
|
+
|
|
506
|
+
Add this line to the instruction file of the agent (`AGENTS.md`, `CLAUDE.md` or
|
|
507
|
+
`GEMINI.md`):
|
|
508
|
+
|
|
509
|
+
```text
|
|
510
|
+
For every change you commit, follow the steps that `diffdesk guide` prints.
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Codex, Cursor, opencode, VS Code with Copilot, Devin and Grok Build read
|
|
514
|
+
`AGENTS.md`. Claude Code reads `CLAUDE.md`. Gemini CLI reads `GEMINI.md`.
|
|
515
|
+
|
|
516
|
+
## License
|
|
517
|
+
|
|
518
|
+
MIT. See `LICENSE`. The bundled CodeMirror, marked and KaTeX code keep their own
|
|
519
|
+
license texts in `src/diffdesk/static/vendor/LICENSES.txt`. The KaTeX fonts are
|
|
520
|
+
under the SIL Open Font License 1.1, see `src/diffdesk/static/vendor/fonts/OFL.txt`.
|