@eliya-oss/agent-diff 0.1.0-alpha.35 → 0.1.0-alpha.36
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 +6 -0
- package/dist/main.js +91 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A review belongs to the branch it describes, the worktree list names the repository it opened and marks where you are, and the pull request opens from the list.
|
|
8
|
+
|
|
3
9
|
## 0.1.0-alpha.35
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -7737,7 +7737,7 @@ var init_run = __esmMin((() => {
|
|
|
7737
7737
|
}));
|
|
7738
7738
|
//#endregion
|
|
7739
7739
|
//#region src/service/git/service.ts
|
|
7740
|
-
var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, splitLines, absent, readText, shape, GitLive;
|
|
7740
|
+
var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, splitLines, absent, readText, settled, shape, GitLive;
|
|
7741
7741
|
var init_service$2 = __esmMin((() => {
|
|
7742
7742
|
init_dist();
|
|
7743
7743
|
init_error$3();
|
|
@@ -7829,6 +7829,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
7829
7829
|
})
|
|
7830
7830
|
}).pipe(map(some), catchTag("FileUnreadable", () => absent));
|
|
7831
7831
|
});
|
|
7832
|
+
settled = (path) => promise(() => realpath(path).catch(() => resolve(path)));
|
|
7832
7833
|
shape = {
|
|
7833
7834
|
worktrees: fn("Git.worktrees")(function* (repo) {
|
|
7834
7835
|
const porcelain = yield* gitOrEmpty(repo, [
|
|
@@ -7838,8 +7839,12 @@ var init_service$2 = __esmMin((() => {
|
|
|
7838
7839
|
]);
|
|
7839
7840
|
const base = yield* defaultBranch(repo);
|
|
7840
7841
|
const entries = readEntries(porcelain);
|
|
7842
|
+
const opened = yield* settled(repo);
|
|
7841
7843
|
const found = [];
|
|
7842
|
-
for (const
|
|
7844
|
+
for (const entry of entries) {
|
|
7845
|
+
const path = yield* settled(entry.path);
|
|
7846
|
+
found.push(yield* toWorktree(entry, base, path === opened));
|
|
7847
|
+
}
|
|
7843
7848
|
return found;
|
|
7844
7849
|
}),
|
|
7845
7850
|
diff: fn("Git.diff")(function* (worktree, context) {
|
|
@@ -8029,7 +8034,7 @@ var init_paths = __esmMin((() => {
|
|
|
8029
8034
|
settingsPath = (root) => join(root, "settings.json");
|
|
8030
8035
|
reportsDir = (root) => join(root, "reports");
|
|
8031
8036
|
reportPath = (root, stamp) => join(reportsDir(root), `${stamp}.md`);
|
|
8032
|
-
})), Store, ensureDir, readOptional, missing, damaged, jsonOf, decoded, asSettings, asBatch, asAnswer, asState, asLayers, linesOf, readLines, parseSettings, parseState, parseLayers, cursorOps, settingsOps, reportOps, answerOps, layersOps, inboxOps, stateOps, makeStore, storeAt;
|
|
8037
|
+
})), Store, ensureDir, readOptional, missing, damaged, jsonOf, decoded, asSettings, asBatch, asAnswer, asState, asLayers, linesOf, readLines, parseSettings, parseState, parseLayers, cursorOps, settingsOps, reportOps, HEAD_REF, headOf$1, keyOf$2, answerOps, layersOps, inboxOps, stateOps, makeStore, storeAt;
|
|
8033
8038
|
var init_service$1 = __esmMin((() => {
|
|
8034
8039
|
init_dist();
|
|
8035
8040
|
init_error$2();
|
|
@@ -8173,11 +8178,21 @@ var init_service$1 = __esmMin((() => {
|
|
|
8173
8178
|
});
|
|
8174
8179
|
return path;
|
|
8175
8180
|
});
|
|
8181
|
+
HEAD_REF = /^ref:\s*refs\/heads\/(.+)$/;
|
|
8182
|
+
headOf$1 = (worktreePath) => readFile(join(worktreePath, ".git"), "utf8").then((raw) => {
|
|
8183
|
+
const linked = raw.match(/^gitdir:\s*(.+)$/m);
|
|
8184
|
+
return linked?.[1] === void 0 ? join(worktreePath, ".git") : linked[1].trim();
|
|
8185
|
+
}).catch(() => join(worktreePath, ".git")).then((dir) => readFile(join(dir, "HEAD"), "utf8")).then((raw) => {
|
|
8186
|
+
const named = raw.trim().match(HEAD_REF);
|
|
8187
|
+
return named?.[1] === void 0 ? raw.trim() : named[1];
|
|
8188
|
+
}).catch(() => "");
|
|
8189
|
+
keyOf$2 = (worktreePath) => promise(() => headOf$1(worktreePath).then((head) => `${worktreePath}#${head}`));
|
|
8176
8190
|
answerOps = (root) => {
|
|
8177
8191
|
return {
|
|
8178
8192
|
answer: fn("Store.answer")(function* (worktreePath, entry) {
|
|
8179
|
-
const
|
|
8180
|
-
|
|
8193
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8194
|
+
const path = outboxPath(root, key);
|
|
8195
|
+
yield* ensureDir(branchDir(root, key));
|
|
8181
8196
|
yield* tryPromise({
|
|
8182
8197
|
try: () => appendFile(path, `${JSON.stringify(entry)}\n`, "utf8"),
|
|
8183
8198
|
catch: (cause) => new StoreUnwritable({
|
|
@@ -8187,7 +8202,8 @@ var init_service$1 = __esmMin((() => {
|
|
|
8187
8202
|
});
|
|
8188
8203
|
}),
|
|
8189
8204
|
answers: fn("Store.answers")(function* (worktreePath) {
|
|
8190
|
-
const
|
|
8205
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8206
|
+
const path = outboxPath(root, key);
|
|
8191
8207
|
const raw = yield* readOptional(path);
|
|
8192
8208
|
return yield* match$3(raw, {
|
|
8193
8209
|
onNone: () => succeed([]),
|
|
@@ -8199,14 +8215,16 @@ var init_service$1 = __esmMin((() => {
|
|
|
8199
8215
|
layersOps = (root) => {
|
|
8200
8216
|
return {
|
|
8201
8217
|
layers: fn("Store.layers")(function* (worktreePath) {
|
|
8202
|
-
const
|
|
8218
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8219
|
+
const path = layersPath(root, key);
|
|
8203
8220
|
const raw = yield* readOptional(path);
|
|
8204
8221
|
if (isNone(raw)) return none();
|
|
8205
8222
|
return some(yield* parseLayers(path, raw.value));
|
|
8206
8223
|
}),
|
|
8207
8224
|
saveLayers: fn("Store.saveLayers")(function* (worktreePath, next) {
|
|
8208
|
-
const
|
|
8209
|
-
|
|
8225
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8226
|
+
const path = layersPath(root, key);
|
|
8227
|
+
yield* ensureDir(branchDir(root, key));
|
|
8210
8228
|
yield* tryPromise({
|
|
8211
8229
|
try: () => writeFile(path, JSON.stringify(next, void 0, 2), "utf8"),
|
|
8212
8230
|
catch: (cause) => new StoreUnwritable({
|
|
@@ -8220,8 +8238,9 @@ var init_service$1 = __esmMin((() => {
|
|
|
8220
8238
|
inboxOps = (root) => {
|
|
8221
8239
|
return {
|
|
8222
8240
|
submit: fn("Store.submit")(function* (worktreePath, batch) {
|
|
8223
|
-
const
|
|
8224
|
-
|
|
8241
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8242
|
+
const path = inboxPath(root, key);
|
|
8243
|
+
yield* ensureDir(branchDir(root, key));
|
|
8225
8244
|
yield* tryPromise({
|
|
8226
8245
|
try: () => appendFile(path, `${JSON.stringify(batch)}\n`, "utf8"),
|
|
8227
8246
|
catch: (cause) => new StoreUnwritable({
|
|
@@ -8231,7 +8250,8 @@ var init_service$1 = __esmMin((() => {
|
|
|
8231
8250
|
});
|
|
8232
8251
|
}),
|
|
8233
8252
|
inbox: fn("Store.inbox")(function* (worktreePath) {
|
|
8234
|
-
const
|
|
8253
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8254
|
+
const path = inboxPath(root, key);
|
|
8235
8255
|
const raw = yield* readOptional(path);
|
|
8236
8256
|
return yield* match$3(raw, {
|
|
8237
8257
|
onNone: () => succeed([]),
|
|
@@ -8243,7 +8263,8 @@ var init_service$1 = __esmMin((() => {
|
|
|
8243
8263
|
stateOps = (root) => {
|
|
8244
8264
|
return {
|
|
8245
8265
|
state: fn("Store.state")(function* (worktreePath) {
|
|
8246
|
-
const
|
|
8266
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8267
|
+
const path = statePath(root, key);
|
|
8247
8268
|
const raw = yield* readOptional(path);
|
|
8248
8269
|
return yield* match$3(raw, {
|
|
8249
8270
|
onNone: () => succeed(emptyBranchState),
|
|
@@ -8251,8 +8272,9 @@ var init_service$1 = __esmMin((() => {
|
|
|
8251
8272
|
});
|
|
8252
8273
|
}),
|
|
8253
8274
|
saveState: fn("Store.saveState")(function* (worktreePath, next) {
|
|
8254
|
-
const
|
|
8255
|
-
|
|
8275
|
+
const key = yield* keyOf$2(worktreePath);
|
|
8276
|
+
const path = statePath(root, key);
|
|
8277
|
+
yield* ensureDir(branchDir(root, key));
|
|
8256
8278
|
yield* tryPromise({
|
|
8257
8279
|
try: () => writeFile(path, JSON.stringify(next, void 0, 2), "utf8"),
|
|
8258
8280
|
catch: (cause) => new StoreUnwritable({
|
|
@@ -9884,7 +9906,7 @@ var init_error = __esmMin((() => {
|
|
|
9884
9906
|
}));
|
|
9885
9907
|
//#endregion
|
|
9886
9908
|
//#region src/service/forge/service.ts
|
|
9887
|
-
var Forge, LIMIT, TIMEOUT_MS, FIELDS, Row, decode, stateOf, ask, read, pulls, ForgeLive;
|
|
9909
|
+
var Forge, LIMIT, TIMEOUT_MS, FIELDS, Row, decode, stateOf, ask, show, read, pulls, openPull, ForgeLive;
|
|
9888
9910
|
var init_service = __esmMin((() => {
|
|
9889
9911
|
init_dist();
|
|
9890
9912
|
init_error();
|
|
@@ -9926,6 +9948,24 @@ var init_service = __esmMin((() => {
|
|
|
9926
9948
|
})));
|
|
9927
9949
|
});
|
|
9928
9950
|
});
|
|
9951
|
+
show = (repo, branch) => callback$1((resume) => {
|
|
9952
|
+
execFile("gh", [
|
|
9953
|
+
"pr",
|
|
9954
|
+
"view",
|
|
9955
|
+
branch,
|
|
9956
|
+
"--web"
|
|
9957
|
+
], {
|
|
9958
|
+
cwd: repo,
|
|
9959
|
+
timeout: TIMEOUT_MS,
|
|
9960
|
+
encoding: "utf8"
|
|
9961
|
+
}, (error) => {
|
|
9962
|
+
if (error === null) return resume(void_);
|
|
9963
|
+
resume(fail(new ForgeUnavailable({
|
|
9964
|
+
repo,
|
|
9965
|
+
reason: error.message
|
|
9966
|
+
})));
|
|
9967
|
+
});
|
|
9968
|
+
});
|
|
9929
9969
|
read = fn("Forge.read")(function* (repo, raw) {
|
|
9930
9970
|
const parsed = yield* try_({
|
|
9931
9971
|
try: () => JSON.parse(raw),
|
|
@@ -9946,7 +9986,13 @@ var init_service = __esmMin((() => {
|
|
|
9946
9986
|
const raw = yield* ask(repo);
|
|
9947
9987
|
return yield* read(repo, raw);
|
|
9948
9988
|
});
|
|
9949
|
-
|
|
9989
|
+
openPull = fn("Forge.openPull")(function* (repo, branch) {
|
|
9990
|
+
yield* show(repo, branch);
|
|
9991
|
+
});
|
|
9992
|
+
ForgeLive = succeed$1(Forge)({
|
|
9993
|
+
pulls,
|
|
9994
|
+
openPull
|
|
9995
|
+
});
|
|
9950
9996
|
}));
|
|
9951
9997
|
//#endregion
|
|
9952
9998
|
//#region src/service/forge/index.ts
|
|
@@ -10713,6 +10759,7 @@ var init_command = __esmMin((() => {
|
|
|
10713
10759
|
whenStaged: false,
|
|
10714
10760
|
counted: false,
|
|
10715
10761
|
whenLayers: false,
|
|
10762
|
+
whenThread: false,
|
|
10716
10763
|
...input
|
|
10717
10764
|
});
|
|
10718
10765
|
commands = [
|
|
@@ -10739,6 +10786,14 @@ var init_command = __esmMin((() => {
|
|
|
10739
10786
|
screens: ["branches"],
|
|
10740
10787
|
hint: "review"
|
|
10741
10788
|
}),
|
|
10789
|
+
command({
|
|
10790
|
+
action: "branch.pull",
|
|
10791
|
+
title: "Open the pull request in a browser",
|
|
10792
|
+
category: "Branches",
|
|
10793
|
+
keys: ["p"],
|
|
10794
|
+
screens: ["branches"],
|
|
10795
|
+
hint: "pull request"
|
|
10796
|
+
}),
|
|
10742
10797
|
command({
|
|
10743
10798
|
action: "cursor.next",
|
|
10744
10799
|
title: "Next line",
|
|
@@ -10941,7 +10996,8 @@ var init_command = __esmMin((() => {
|
|
|
10941
10996
|
category: "Review",
|
|
10942
10997
|
keys: ["d"],
|
|
10943
10998
|
screens: ["review"],
|
|
10944
|
-
hint: "settle"
|
|
10999
|
+
hint: "settle",
|
|
11000
|
+
whenThread: true
|
|
10945
11001
|
}),
|
|
10946
11002
|
command({
|
|
10947
11003
|
action: "thread.remove",
|
|
@@ -11157,7 +11213,7 @@ var init_command = __esmMin((() => {
|
|
|
11157
11213
|
if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
|
|
11158
11214
|
return GLYPHS[key] ?? key;
|
|
11159
11215
|
};
|
|
11160
|
-
hintsFor = (screen, staged, layers = 0) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || staged > 0).filter((entry) => !entry.whenLayers || layers > 0).map((entry) => ({
|
|
11216
|
+
hintsFor = (screen, staged, layers = 0, onThread = false) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || staged > 0).filter((entry) => !entry.whenLayers || layers > 0).filter((entry) => !entry.whenThread || onThread).map((entry) => ({
|
|
11161
11217
|
key: displayKey(entry.keys[0] ?? ""),
|
|
11162
11218
|
hint: entry.counted ? `${entry.hint} ${staged}` : entry.hint,
|
|
11163
11219
|
press: entry.keys[0] ?? ""
|
|
@@ -11466,6 +11522,7 @@ var init_reduce = __esmMin((() => {
|
|
|
11466
11522
|
"branch.next": (state) => moveBranch(state, 1),
|
|
11467
11523
|
"branch.prev": (state) => moveBranch(state, -1),
|
|
11468
11524
|
"branch.open": (state) => state,
|
|
11525
|
+
"branch.pull": (state) => state,
|
|
11469
11526
|
"cursor.next": (state) => layerDown(state, 1),
|
|
11470
11527
|
"cursor.top": (state) => atRow(state, 0),
|
|
11471
11528
|
"cursor.bottom": (state) => atRow(state, lastRow(selectedPatch(state))),
|
|
@@ -12901,7 +12958,7 @@ var init_render = __esmMin((() => {
|
|
|
12901
12958
|
}
|
|
12902
12959
|
update(state) {
|
|
12903
12960
|
this.shown = state;
|
|
12904
|
-
this.chips = hintsFor(state.screen, state.staged, state.layers.length);
|
|
12961
|
+
this.chips = hintsFor(state.screen, state.staged, state.layers.length, state.stop > 0);
|
|
12905
12962
|
this.header.content = this.headerText(state);
|
|
12906
12963
|
this.footer.content = this.footerText(state);
|
|
12907
12964
|
this.list.content = this.listText(state);
|
|
@@ -13576,6 +13633,7 @@ var init_app = __esmMin((() => {
|
|
|
13576
13633
|
return {
|
|
13577
13634
|
quit: () => sync(() => this.renderer.destroy()),
|
|
13578
13635
|
"branch.open": () => this.openBranch(),
|
|
13636
|
+
"branch.pull": () => this.showPull(),
|
|
13579
13637
|
"compose.submit": () => this.send(),
|
|
13580
13638
|
"compose.stage": () => this.stage(),
|
|
13581
13639
|
"palette.run": () => this.runChoice(),
|
|
@@ -13916,6 +13974,19 @@ var init_app = __esmMin((() => {
|
|
|
13916
13974
|
loadSent(branch) {
|
|
13917
13975
|
return listSent(this.repo, branch);
|
|
13918
13976
|
}
|
|
13977
|
+
showPull() {
|
|
13978
|
+
return gen({ self: this }, function* () {
|
|
13979
|
+
const branch = selectedBranch(this.state);
|
|
13980
|
+
if (branch === void 0) return;
|
|
13981
|
+
const state = this.state.pulls[branch.branch];
|
|
13982
|
+
if (state === void 0) {
|
|
13983
|
+
this.commit(withNoticeHere(this.state, "no pull request for this branch"));
|
|
13984
|
+
return;
|
|
13985
|
+
}
|
|
13986
|
+
const said = (yield* (yield* map(Forge, (service) => service)).openPull(this.repo, branch.branch).pipe(as(true), catchTag("ForgeUnavailable", () => succeed(false)))) ? `opened the ${state} pull request` : "could not reach the pull request";
|
|
13987
|
+
this.commit(withNoticeHere(this.state, said));
|
|
13988
|
+
});
|
|
13989
|
+
}
|
|
13919
13990
|
loadPulls() {
|
|
13920
13991
|
return gen({ self: this }, function* () {
|
|
13921
13992
|
const pulls = yield* (yield* map(Forge, (service) => service)).pulls(this.repo).pipe(catchTag("ForgeUnavailable", () => succeed([])));
|
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.36",
|
|
27
27
|
"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.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|