@eliya-oss/agent-diff 0.1.0-alpha.208 → 0.1.0-alpha.209

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.
@@ -19,6 +19,7 @@ the way it is, why it is tested the way it is. ADRs explain choices that outlive
19
19
  | [ADR-006](ADR-006-the-terminal-runs-on-effect.md) | The terminal runs on Effect |
20
20
  | [ADR-007](ADR-007-model-with-effect-not-only-run-on-it.md) | Model with Effect, not only run on it |
21
21
  | [ADR-008](ADR-008-adiff-speaks-mcp.md) | adiff speaks MCP, on the official SDK |
22
+ | [ADR-009](ADR-009-the-page-lives-in-this-repository.md) | The page lives in this repository, with its own toolchain |
22
23
 
23
24
  ## Writing one
24
25
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.209
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(page): the `adiff-web` skill installs with `--skill adiff-web` and teaches an agent to hand a review over in the browser.
8
+
9
+ feat(upgrade): `adiff upgrade` names both skills, `adiff` and `adiff-web`, in the command that updates them.
10
+
3
11
  ## 0.1.0-alpha.208
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -7,7 +7,7 @@ you comment on the lines in a terminal, the agent that wrote them answers under
7
7
  point stays open until you settle it.
8
8
 
9
9
  <pre align="center">brew install Newbie012/tap/adiff</pre>
10
- <pre align="center">npx skills add Newbie012/agent-diff --skill adiff -g</pre>
10
+ <pre align="center">npx skills add Newbie012/agent-diff --skill adiff --skill adiff-web -g</pre>
11
11
 
12
12
  <p align="center"><a href="docs/install.md">Other ways to install</a></p>
13
13
 
package/dist/main.js CHANGED
@@ -10116,7 +10116,7 @@ var init_config = __esmMin((() => {
10116
10116
  //#region package.json
10117
10117
  init_pane();
10118
10118
  init_config();
10119
- var version$2 = "0.1.0-alpha.208";
10119
+ var version$2 = "0.1.0-alpha.209";
10120
10120
  //#endregion
10121
10121
  //#region src/cli/error.ts
10122
10122
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, RemovedOption, UnexpectedArgument, SeveralIds, IdGivenTwice, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -10316,7 +10316,7 @@ var init_upgrade$1 = __esmMin((() => {
10316
10316
  if (found.latest === void 0) return `Ran \`${found.command}\`. Run \`adiff --version\` to see which build you have now.`;
10317
10317
  return `Ran \`${found.command}\`, and adiff ${found.latest} is installed now.`;
10318
10318
  };
10319
- SAY_SKILL_TOO = "Run `npx skills update adiff` to bring the skill up with it.";
10319
+ SAY_SKILL_TOO = "Run `npx skills update adiff adiff-web` to bring both skills up with it.";
10320
10320
  upgradeReport = (found, ran, check) => {
10321
10321
  const note = found.current === true ? statusOf$1(found) : willUpgrade(found, check) ? `${statusOf$1(found)} ${attempted(found, ran)}` : `${statusOf$1(found)} ${NOTES[found.route]} Run \`${found.command}\` to upgrade.`;
10322
10322
  return {
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "bin": {
26
26
  "adiff": "./bin/adiff.js"
27
27
  },
28
- "version": "0.1.0-alpha.208",
28
+ "version": "0.1.0-alpha.209",
29
29
  "description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
30
30
  "license": "MIT",
31
31
  "repository": {
@@ -42,10 +42,11 @@
42
42
  "access": "public"
43
43
  },
44
44
  "scripts": {
45
- "check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm test",
45
+ "check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm run check:web && pnpm test",
46
+ "check:web": "pnpm --filter adiff-web run check && pnpm --filter adiff-web run build",
46
47
  "build": "rolldown -c rolldown.config.ts",
47
48
  "typecheck": "tsc --noEmit",
48
- "lint": "oxlint && node scripts/check-rules.ts && node scripts/check-film.ts && node scripts/check-public.ts",
49
+ "lint": "oxlint --disable-nested-config && node scripts/check-rules.ts && node scripts/check-film.ts && node scripts/check-public.ts",
49
50
  "check-body": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/check-public.ts",
50
51
  "test": "NODE_OPTIONS=--experimental-ffi vitest run",
51
52
  "test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: adiff-web
3
+ description: The adiff review page in the browser. Use when the user wants to review a worktree's diff in the browser instead of the adiff terminal, when you hand work over for review and want to give them a link, when the page is down or slow, or when the user asks for a headless agent (Claude Code, Codex, OpenCode, Cursor, Gemini, Amp) to answer a review nobody is listening to.
4
+ ---
5
+
6
+ # adiff-web
7
+
8
+ The page shows a branch's review in the browser the way the adiff terminal does: the file tree on
9
+ the left, the open file's diff on the right, and line comments that reach you through
10
+ `adiff comment take`. It reads everything through `adiff`, so the terminal and the page show one
11
+ review. Collect and answer comments as the `adiff` skill says.
12
+
13
+ ## The page's address
14
+
15
+ The address is `$ADIFF_WEB_URL`, and `http://localhost:4317` when that is not set. Read it once and
16
+ use it everywhere below:
17
+
18
+ ```bash
19
+ PAGE="${ADIFF_WEB_URL:-http://localhost:4317}"
20
+ ```
21
+
22
+ ## Start the page
23
+
24
+ Check whether it already runs, and never start a second one:
25
+
26
+ ```bash
27
+ curl -s -o /dev/null -w '%{http_code}\n' "$PAGE/" # 200 when it is up
28
+ ```
29
+
30
+ The page ships in the adiff repository, in `web/`. From a checkout of
31
+ `https://github.com/Newbie012/agent-diff`:
32
+
33
+ ```bash
34
+ pnpm install
35
+ pnpm --filter adiff-web dev # serves http://localhost:4317
36
+ PORT=5000 pnpm --filter adiff-web dev # another port
37
+ ```
38
+
39
+ Ask the user to start it in a terminal of their own. A page started inside your session passes your
40
+ session's environment to the headless agents it starts, and stops when your session does.
41
+
42
+ The page needs `adiff` on its `PATH`. `ADIFF_BIN` names another one.
43
+
44
+ ## Hand a review over
45
+
46
+ Give the user this link, with the worktree's absolute path:
47
+
48
+ ```bash
49
+ echo "$PAGE/review?worktree=$(pwd)"
50
+ ```
51
+
52
+ Add `&base=<ref>` to pick the base the diff is read against. Then listen for comments as the `adiff`
53
+ skill says: one plain `adiff comment take --worktree .`, then
54
+ `adiff comment take --worktree . --wait 6900` in the background.
55
+
56
+ A link may only name a repository under `REVIEW_REPO_ROOTS`, a colon-separated list that defaults to
57
+ the user's home directory. The page refuses any other path and names the list.
58
+
59
+ ## When the page does not work
60
+
61
+ - **Nothing answers at the address.** The page is not running, or it runs on another port. Ask the
62
+ user which address they open, and set `ADIFF_WEB_URL` to it.
63
+ - **Every review says the adiff it found is too old.** The message names the path and the version
64
+ it needs. Run `adiff upgrade`, or point `ADIFF_BIN` at a newer adiff. The page reads the version
65
+ again within 30 seconds, with no restart.
66
+ - **"This review cannot open".** The line under it says why: the path is outside
67
+ `REVIEW_REPO_ROOTS`, the worktree does not exist, or the branch is not checked out anywhere.
68
+ - **The page is slow on a large branch.** It loads each file's rows when the file is opened, so the
69
+ first open of a file costs one read. If every action is slow, `adiff serve` is not starting and
70
+ the page starts one adiff per question: run `adiff serve < /dev/null` and read what it prints.
71
+ - **A comment the user wrote never reaches you.** Check that you listen in the worktree the link
72
+ names: `adiff comment list --worktree .` lists what is filed there.
73
+
74
+ ## Who is listening, and the headless agent
75
+
76
+ The review's header says whether an agent is listening. An agent counts as listening for 5 seconds
77
+ after it looks for comments, and `comment take --wait` looks twice a second, so one waiting agent
78
+ keeps the header on "listening". While a comment taken in the last 30 minutes has no answer, the
79
+ header says **An agent is working on N comments**.
80
+
81
+ When nobody is listening, the header offers **Start a headless <agent>** for the agent the user
82
+ chose, and the menu beside it offers:
83
+
84
+ - **Start a headless …** for every other agent installed.
85
+ - **Copy a prompt for your agent**: a prompt to paste into an agent session that is already open.
86
+ It tells that agent to listen with `adiff comment take` and answer by id.
87
+ - **Copy a terminal command for …**: a command that opens the chosen agent in a terminal, already
88
+ listening.
89
+ - **Agent settings…**: choose the agent and edit its commands.
90
+
91
+ A headless run starts the agent's command in the review's worktree, in the user's interactive shell,
92
+ with a prompt to take comments, act on each, answer each by id, and stop after three empty waits
93
+ with nothing owed. The header shows its last line, **Log** opens its last lines, and **Stop** ends
94
+ it. The page never starts one by itself, and refuses a second while one runs or an agent listens.
95
+
96
+ The page knows Claude Code, Codex, OpenCode, Cursor Agent, Gemini CLI and Amp, and offers the ones
97
+ it finds on the user's `PATH`. The default headless commands, with the prompt added last:
98
+
99
+ | Agent | Headless command |
100
+ | ------------ | -------------------------------------------------------------------------------------------------------------- |
101
+ | Claude Code | `claude -p --allowedTools 'Bash(adiff:*)' --permission-mode acceptEdits --output-format stream-json --verbose` |
102
+ | Codex | `codex exec --json --sandbox workspace-write --add-dir ~/.adiff --skip-git-repo-check` |
103
+ | OpenCode | `opencode run --format json` |
104
+ | Cursor Agent | `cursor-agent -p --force --output-format stream-json` |
105
+ | Gemini CLI | `gemini --yolo --output-format stream-json -p` |
106
+ | Amp | `amp --dangerously-allow-all --stream-json -x` |
107
+
108
+ Codex needs `--add-dir ~/.adiff` because adiff writes there and the sandbox lets it write only in
109
+ the worktree. A command the user edits must still take the prompt as its last argument, so it
110
+ cannot end in a flag that takes several values.
111
+
112
+ Two variables move the page's own files:
113
+
114
+ - `ADIFF_WEB_CONFIG`: the settings file, `~/.config/adiff-web/config.json` by default. It holds
115
+ the chosen agent and any command the user changed.
116
+ - `ADIFF_WEB_RUNS`: where each headless run's record and log go, `.runs/` under the folder the
117
+ page was started in by default.