@eliya-oss/agent-diff 0.1.0-alpha.27 → 0.1.0-alpha.29
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.
- package/CHANGELOG.md +12 -0
- package/dist/main.js +156 -28
- package/package.json +1 -1
- package/skills/adiff/SKILL.md +24 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- First contact teaches the loop, an empty collection says what to do next, and a worktree error explains the path.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.28
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- An agent can open the review in a split pane beside the conversation.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.27
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/main.js
CHANGED
|
@@ -13714,7 +13714,7 @@ const make$6 = (value) => {
|
|
|
13714
13714
|
* @category general
|
|
13715
13715
|
* @since 2.0.0
|
|
13716
13716
|
*/
|
|
13717
|
-
const set$
|
|
13717
|
+
const set$2 = /*#__PURE__*/ dual(2, (self, value) => {
|
|
13718
13718
|
self.current = value;
|
|
13719
13719
|
return self;
|
|
13720
13720
|
});
|
|
@@ -13922,7 +13922,7 @@ const subscribe = (self) => uninterruptible(contextWith((services) => {
|
|
|
13922
13922
|
return addFinalizer(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
|
|
13923
13923
|
}));
|
|
13924
13924
|
const unsubscribe = (self) => uninterruptible(withFiber((state) => {
|
|
13925
|
-
set$
|
|
13925
|
+
set$2(self.shutdownFlag, true);
|
|
13926
13926
|
return forEach(takeAll$2(self.pollers), (d) => interruptWith(d, state.id), {
|
|
13927
13927
|
discard: true,
|
|
13928
13928
|
concurrency: "unbounded"
|
|
@@ -16256,7 +16256,7 @@ const setUnsafe = (self, value) => {
|
|
|
16256
16256
|
* @category setters
|
|
16257
16257
|
* @since 2.0.0
|
|
16258
16258
|
*/
|
|
16259
|
-
const set = /*#__PURE__*/ dual(2, (self, value) => self.semaphore.withPermit(sync(() => setUnsafe(self, value))));
|
|
16259
|
+
const set$1 = /*#__PURE__*/ dual(2, (self, value) => self.semaphore.withPermit(sync(() => setUnsafe(self, value))));
|
|
16260
16260
|
String$1.pipe(brand("@adiff/Blob"));
|
|
16261
16261
|
String$1.pipe(brand("@adiff/FilePath"));
|
|
16262
16262
|
const lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
|
|
@@ -17245,6 +17245,100 @@ const initRepository = fn("Cli.initRepository")(function* (request) {
|
|
|
17245
17245
|
};
|
|
17246
17246
|
});
|
|
17247
17247
|
//#endregion
|
|
17248
|
+
//#region src/cli/pane.ts
|
|
17249
|
+
const TIMEOUT_MS$1 = 5e3;
|
|
17250
|
+
const set = (name) => (process.env[name] ?? "").length > 0;
|
|
17251
|
+
const splitters = [
|
|
17252
|
+
{
|
|
17253
|
+
pane: "tmux",
|
|
17254
|
+
binary: "tmux",
|
|
17255
|
+
present: () => set("TMUX"),
|
|
17256
|
+
args: (repo, run) => [
|
|
17257
|
+
"split-window",
|
|
17258
|
+
"-h",
|
|
17259
|
+
"-c",
|
|
17260
|
+
repo,
|
|
17261
|
+
...run
|
|
17262
|
+
]
|
|
17263
|
+
},
|
|
17264
|
+
{
|
|
17265
|
+
pane: "zellij",
|
|
17266
|
+
binary: "zellij",
|
|
17267
|
+
present: () => set("ZELLIJ"),
|
|
17268
|
+
args: (repo, run) => [
|
|
17269
|
+
"action",
|
|
17270
|
+
"new-pane",
|
|
17271
|
+
"-d",
|
|
17272
|
+
"right",
|
|
17273
|
+
"--cwd",
|
|
17274
|
+
repo,
|
|
17275
|
+
"--",
|
|
17276
|
+
...run
|
|
17277
|
+
]
|
|
17278
|
+
},
|
|
17279
|
+
{
|
|
17280
|
+
pane: "wezterm",
|
|
17281
|
+
binary: "wezterm",
|
|
17282
|
+
present: () => set("WEZTERM_PANE"),
|
|
17283
|
+
args: (repo, run) => [
|
|
17284
|
+
"cli",
|
|
17285
|
+
"split-pane",
|
|
17286
|
+
"--right",
|
|
17287
|
+
"--cwd",
|
|
17288
|
+
repo,
|
|
17289
|
+
"--",
|
|
17290
|
+
...run
|
|
17291
|
+
]
|
|
17292
|
+
},
|
|
17293
|
+
{
|
|
17294
|
+
pane: "kitty",
|
|
17295
|
+
binary: "kitten",
|
|
17296
|
+
present: () => set("KITTY_LISTEN_ON"),
|
|
17297
|
+
args: (repo, run) => [
|
|
17298
|
+
"@",
|
|
17299
|
+
"launch",
|
|
17300
|
+
"--type=window",
|
|
17301
|
+
"--cwd",
|
|
17302
|
+
repo,
|
|
17303
|
+
...run
|
|
17304
|
+
]
|
|
17305
|
+
}
|
|
17306
|
+
];
|
|
17307
|
+
const selfInvocation = (repo) => {
|
|
17308
|
+
const entry = process.argv[1];
|
|
17309
|
+
return [
|
|
17310
|
+
...entry === void 0 ? ["adiff"] : [
|
|
17311
|
+
process.execPath,
|
|
17312
|
+
...process.execArgv,
|
|
17313
|
+
entry
|
|
17314
|
+
],
|
|
17315
|
+
"review",
|
|
17316
|
+
"open",
|
|
17317
|
+
"--repo",
|
|
17318
|
+
repo
|
|
17319
|
+
];
|
|
17320
|
+
};
|
|
17321
|
+
const ran = (binary, args) => callback$1((resume) => {
|
|
17322
|
+
execFile(binary, [...args], { timeout: TIMEOUT_MS$1 }, (cause) => resume(succeed(cause === null)));
|
|
17323
|
+
});
|
|
17324
|
+
const split = fn("Cli.split")(function* (chosen, repo) {
|
|
17325
|
+
return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo)));
|
|
17326
|
+
});
|
|
17327
|
+
const openPane = fn("Cli.openPane")(function* (repo) {
|
|
17328
|
+
const command = `adiff review open --repo ${repo}`;
|
|
17329
|
+
const chosen = splitters.find((candidate) => candidate.present());
|
|
17330
|
+
if (chosen === void 0) return {
|
|
17331
|
+
opened: false,
|
|
17332
|
+
pane: "none",
|
|
17333
|
+
command
|
|
17334
|
+
};
|
|
17335
|
+
return {
|
|
17336
|
+
opened: yield* split(chosen, repo),
|
|
17337
|
+
pane: chosen.pane,
|
|
17338
|
+
command
|
|
17339
|
+
};
|
|
17340
|
+
});
|
|
17341
|
+
//#endregion
|
|
17248
17342
|
//#region src/cli/search.ts
|
|
17249
17343
|
const HIT = /^(.+?):(\d+):(.*)$/;
|
|
17250
17344
|
const NEAR = /^(.+?)-(\d+)-(.*)$/;
|
|
@@ -17917,7 +18011,7 @@ const catalog = [
|
|
|
17917
18011
|
name: "json",
|
|
17918
18012
|
required: true,
|
|
17919
18013
|
value: "file|-",
|
|
17920
|
-
about: "The
|
|
18014
|
+
about: "The document, as a file path or - to read stdin: {\"summary\":\"…\",\"layers\":[{\"title\":\"…\",\"note\":\"…\",\"spans\":[{\"path\":\"…\",\"start\":1,\"end\":9}]}]}. A layer may carry blocks instead of spans, interleaving {\"kind\":\"prose\",\"markdown\":\"…\"} with {\"kind\":\"code\",\"path\":\"…\",\"start\":1,\"end\":9}"
|
|
17921
18015
|
}],
|
|
17922
18016
|
dataKey: "layers",
|
|
17923
18017
|
example: "adiff layers set --worktree . --json -"
|
|
@@ -17943,6 +18037,14 @@ const catalog = [
|
|
|
17943
18037
|
dataKey: "",
|
|
17944
18038
|
example: "adiff review open --repo ."
|
|
17945
18039
|
},
|
|
18040
|
+
{
|
|
18041
|
+
name: "review pane",
|
|
18042
|
+
about: "Open the review beside the conversation, in whichever multiplexer is running. Answers with the command when none is",
|
|
18043
|
+
safety: "read",
|
|
18044
|
+
options: [repo],
|
|
18045
|
+
dataKey: "pane",
|
|
18046
|
+
example: "adiff review pane --repo ."
|
|
18047
|
+
},
|
|
17946
18048
|
{
|
|
17947
18049
|
name: "init",
|
|
17948
18050
|
about: "Write the review loop into this repository's agent instructions, so an agent finds it unprompted",
|
|
@@ -18014,7 +18116,7 @@ const ADVICE = {
|
|
|
18014
18116
|
},
|
|
18015
18117
|
UnknownWorktree: {
|
|
18016
18118
|
exit: 3,
|
|
18017
|
-
suggestion: "
|
|
18119
|
+
suggestion: "--worktree takes the path of a worktree of the repository under review. The error lists the ones that exist; pass one of those, or run the command from inside it with `--worktree .`.",
|
|
18018
18120
|
retriable: false
|
|
18019
18121
|
},
|
|
18020
18122
|
MalformedLayers: {
|
|
@@ -18097,10 +18199,20 @@ const banner = () => [
|
|
|
18097
18199
|
"",
|
|
18098
18200
|
"Review the work an agent did in a git worktree, and hand your comments back.",
|
|
18099
18201
|
"",
|
|
18100
|
-
"
|
|
18101
|
-
" adiff comment take --worktree . collect the comments left for you",
|
|
18202
|
+
"A reviewer opens the terminal:",
|
|
18102
18203
|
"",
|
|
18103
|
-
"adiff
|
|
18204
|
+
" adiff review open --repo . read the diff, select lines, write comments",
|
|
18205
|
+
"",
|
|
18206
|
+
"An agent working in that worktree answers them:",
|
|
18207
|
+
"",
|
|
18208
|
+
" adiff comment take --worktree . --wait 300 block until a comment arrives",
|
|
18209
|
+
" adiff comment answer --worktree . --id <id> --body '…'",
|
|
18210
|
+
" adiff layers set --worktree . --json - publish the reading order",
|
|
18211
|
+
"",
|
|
18212
|
+
"Every comment carries an id, and an answer goes back to the reviewer under it.",
|
|
18213
|
+
"",
|
|
18214
|
+
"adiff --help lists every command. adiff describe answers the same as JSON,",
|
|
18215
|
+
"and describe --command 'comment take' answers for one."
|
|
18104
18216
|
].join("\n");
|
|
18105
18217
|
const help = () => [
|
|
18106
18218
|
"adiff, for reviewing an agent's work in a worktree",
|
|
@@ -21641,7 +21753,7 @@ var App = class {
|
|
|
21641
21753
|
return getUnsafe(this.held);
|
|
21642
21754
|
}
|
|
21643
21755
|
write(next) {
|
|
21644
|
-
runSync(set(this.held, next));
|
|
21756
|
+
runSync(set$1(this.held, next));
|
|
21645
21757
|
}
|
|
21646
21758
|
commit(next) {
|
|
21647
21759
|
const appeared = next.notice.length > 0 && next.notice !== this.state.notice;
|
|
@@ -22209,11 +22321,16 @@ const commentAdd = fn("Main.commentAdd")(function* (options) {
|
|
|
22209
22321
|
});
|
|
22210
22322
|
yield* answer(options, { batch });
|
|
22211
22323
|
});
|
|
22324
|
+
const NOTHING_WAITING = "No comment is waiting. Pass --wait <seconds> to block until one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
|
|
22212
22325
|
const commentTake = fn("Main.commentTake")(function* (options) {
|
|
22213
22326
|
const worktree = yield* required(options, "worktree");
|
|
22214
22327
|
const wait = Number(options["wait"] ?? 0);
|
|
22215
22328
|
const comments = wait > 0 ? yield* awaitComments(worktree, Date.now() + wait * WAIT_UNIT) : yield* takeComments(worktree);
|
|
22216
|
-
|
|
22329
|
+
const hint = comments.length === 0 ? { hint: NOTHING_WAITING } : {};
|
|
22330
|
+
yield* answer(options, {
|
|
22331
|
+
comments,
|
|
22332
|
+
...hint
|
|
22333
|
+
});
|
|
22217
22334
|
});
|
|
22218
22335
|
const commentAnswer = fn("Main.commentAnswer")(function* (options) {
|
|
22219
22336
|
const report = yield* answerComment({
|
|
@@ -22289,6 +22406,26 @@ const documentAt = fn("Main.documentAt")(function* (source) {
|
|
|
22289
22406
|
catch: (cause) => new MalformedLayers({ reason: String(cause) })
|
|
22290
22407
|
});
|
|
22291
22408
|
});
|
|
22409
|
+
const layersSet = fn("Main.layersSet")(function* (options) {
|
|
22410
|
+
const document = yield* documentAt(yield* required(options, "json"));
|
|
22411
|
+
const layers = yield* setLayers(yield* required(options, "worktree"), document, options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
22412
|
+
yield* answer(options, { layers });
|
|
22413
|
+
});
|
|
22414
|
+
const layersShow = fn("Main.layersShow")(function* (options) {
|
|
22415
|
+
const layers = yield* showLayers(yield* required(options, "worktree"));
|
|
22416
|
+
yield* answer(options, { layers });
|
|
22417
|
+
});
|
|
22418
|
+
const init = fn("Main.init")(function* (options) {
|
|
22419
|
+
const report = yield* initRepository({
|
|
22420
|
+
repo: yield* required(options, "repo"),
|
|
22421
|
+
write: options["write"] !== void 0,
|
|
22422
|
+
skill: options["skill"] !== void 0
|
|
22423
|
+
});
|
|
22424
|
+
yield* answer(options, {
|
|
22425
|
+
wrote: report.wrote,
|
|
22426
|
+
changes: report.changes
|
|
22427
|
+
});
|
|
22428
|
+
});
|
|
22292
22429
|
const routes = {
|
|
22293
22430
|
"branch list": branchList,
|
|
22294
22431
|
"comment add": commentAdd,
|
|
@@ -22300,27 +22437,18 @@ const routes = {
|
|
|
22300
22437
|
"comment threads": commentThreads,
|
|
22301
22438
|
"comment resolve": commentResolve,
|
|
22302
22439
|
"review submit": reviewSubmit,
|
|
22303
|
-
"review
|
|
22304
|
-
|
|
22305
|
-
const document = yield* documentAt(yield* required(options, "json"));
|
|
22306
|
-
const layers = yield* setLayers(yield* required(options, "worktree"), document, options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
22307
|
-
yield* answer(options, { layers });
|
|
22308
|
-
}),
|
|
22309
|
-
"layers show": fn("Main.layersShow")(function* (options) {
|
|
22310
|
-
const layers = yield* showLayers(yield* required(options, "worktree"));
|
|
22311
|
-
yield* answer(options, { layers });
|
|
22312
|
-
}),
|
|
22313
|
-
init: fn("Main.init")(function* (options) {
|
|
22314
|
-
const report = yield* initRepository({
|
|
22315
|
-
repo: yield* required(options, "repo"),
|
|
22316
|
-
write: options["write"] !== void 0,
|
|
22317
|
-
skill: options["skill"] !== void 0
|
|
22318
|
-
});
|
|
22440
|
+
"review pane": fn("Main.reviewPane")(function* (options) {
|
|
22441
|
+
const report = yield* openPane(yield* required(options, "repo"));
|
|
22319
22442
|
yield* answer(options, {
|
|
22320
|
-
|
|
22321
|
-
|
|
22443
|
+
opened: report.opened,
|
|
22444
|
+
pane: report.pane,
|
|
22445
|
+
command: report.command
|
|
22322
22446
|
});
|
|
22323
22447
|
}),
|
|
22448
|
+
"review progress": reviewStatus,
|
|
22449
|
+
"layers set": layersSet,
|
|
22450
|
+
"layers show": layersShow,
|
|
22451
|
+
init,
|
|
22324
22452
|
describe: fn("Main.describe")(function* (options) {
|
|
22325
22453
|
const wanted = options["command"];
|
|
22326
22454
|
const asked = wanted === void 0 || wanted === "true" ? void 0 : wanted;
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"adiff": "./bin/adiff.js"
|
|
25
25
|
},
|
|
26
|
-
"version": "0.1.0-alpha.
|
|
26
|
+
"version": "0.1.0-alpha.29",
|
|
27
27
|
"description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|
package/skills/adiff/SKILL.md
CHANGED
|
@@ -156,11 +156,32 @@ Setting a layers again supersedes the previous one and bumps `version`; the laye
|
|
|
156
156
|
it was written for, and adiff reports it as `stale` once the branch moves past that commit. After
|
|
157
157
|
you address a review, write the layers again.
|
|
158
158
|
|
|
159
|
+
## Put the review in front of them
|
|
160
|
+
|
|
161
|
+
When someone asks you for a review, open it rather than describing how:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
adiff review pane --repo <repo>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
It splits the pane they are already looking at, so their next move is to look right rather than to
|
|
168
|
+
type. The answer says what happened:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
|
|
175
|
+
WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
|
|
176
|
+
line and let them run it.
|
|
177
|
+
|
|
178
|
+
Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
|
|
179
|
+
someone's screen uninvited is worse than a line they have to copy.
|
|
180
|
+
|
|
159
181
|
## Tell the reviewer how to read it
|
|
160
182
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
worktree belongs to:
|
|
183
|
+
Whether or not a pane opened, say what to do with it. Name the repository they should point at,
|
|
184
|
+
which is the repository the worktree belongs to:
|
|
164
185
|
|
|
165
186
|
> Open it with `adiff review open --repo <repo>`, then press `enter` on this branch. The sidebar
|
|
166
187
|
> lists the layers in reading order; `j` and `k` move between them and the diff follows. Inside a
|