@eliya-oss/agent-diff 0.1.0-alpha.43 → 0.1.0-alpha.45
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 +120 -50
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Use the room a wide terminal has: panels keep a whole command title and a whole match, a tall screen lists more keys, and a long worktree name is read to its end.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.44
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- A file buried deep in a nested tree can be read: the file list keeps both ends of a name that does not fit, so two files whose names end the same way no longer draw as one row, and the header names the file you are on instead of letting the path run off the edge of the terminal.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.43
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -9199,7 +9199,7 @@ var init_pane = __esmMin((() => {
|
|
|
9199
9199
|
init_commands();
|
|
9200
9200
|
init_init();
|
|
9201
9201
|
init_pane();
|
|
9202
|
-
var version$1 = "0.1.0-alpha.
|
|
9202
|
+
var version$1 = "0.1.0-alpha.45";
|
|
9203
9203
|
//#endregion
|
|
9204
9204
|
//#region src/cli/upgrade.ts
|
|
9205
9205
|
var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, ran, here, statusOf$1, ranLine, failedLine, noteFor, offerFor, restOf, sayUpgrade, upgradeAdiff;
|
|
@@ -10848,7 +10848,7 @@ var init_tree = __esmMin((() => {
|
|
|
10848
10848
|
return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
|
|
10849
10849
|
};
|
|
10850
10850
|
crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
|
|
10851
|
-
})), initialState, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, treeOf, treeRows, crowdedOf, directoryOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
|
|
10851
|
+
})), initialState, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, treeRows, crowdedOf, directoryOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
|
|
10852
10852
|
var init_model = __esmMin((() => {
|
|
10853
10853
|
init_dist();
|
|
10854
10854
|
init_patch();
|
|
@@ -10891,6 +10891,7 @@ var init_model = __esmMin((() => {
|
|
|
10891
10891
|
layers: [],
|
|
10892
10892
|
layersStale: false,
|
|
10893
10893
|
pulls: {},
|
|
10894
|
+
forge: "asking",
|
|
10894
10895
|
layerIndex: 0,
|
|
10895
10896
|
openLayers: [],
|
|
10896
10897
|
term: "",
|
|
@@ -11006,6 +11007,8 @@ var init_model = __esmMin((() => {
|
|
|
11006
11007
|
};
|
|
11007
11008
|
selectedBranch = (state) => state.branches[state.branchIndex];
|
|
11008
11009
|
selectedPatch = (state) => shownOf(state)?.patch;
|
|
11010
|
+
pullHere = (state) => state.pulls[selectedBranch(state)?.branch ?? ""] ?? "";
|
|
11011
|
+
knownToHaveNoPull = (state) => state.forge === "answered" && pullHere(state).length === 0;
|
|
11009
11012
|
treeOf = (state) => buildTree(state.patches.map((patch) => patch.path));
|
|
11010
11013
|
treeRows = (state) => {
|
|
11011
11014
|
const tree = treeOf(state);
|
|
@@ -11136,11 +11139,11 @@ var init_model = __esmMin((() => {
|
|
|
11136
11139
|
"never"
|
|
11137
11140
|
]);
|
|
11138
11141
|
NAME = /[A-Za-z_$][\w$]*/g;
|
|
11139
|
-
longestName = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
|
|
11142
|
+
longestName$1 = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
|
|
11140
11143
|
searchTerm = (state) => {
|
|
11141
11144
|
const line = selectedLines(state).map((text) => text.trim()).find((text) => text.length > 0);
|
|
11142
11145
|
if (line === void 0) return "";
|
|
11143
|
-
return longestName(line) ?? line;
|
|
11146
|
+
return longestName$1(line) ?? line;
|
|
11144
11147
|
};
|
|
11145
11148
|
matchHere = (state) => state.matches[state.matchIndex];
|
|
11146
11149
|
selectionReadout = (state) => {
|
|
@@ -11341,6 +11344,7 @@ var init_command = __esmMin((() => {
|
|
|
11341
11344
|
counted: false,
|
|
11342
11345
|
whenLayers: false,
|
|
11343
11346
|
whenThread: false,
|
|
11347
|
+
whenPull: false,
|
|
11344
11348
|
rank: 0,
|
|
11345
11349
|
...input
|
|
11346
11350
|
});
|
|
@@ -11376,7 +11380,19 @@ var init_command = __esmMin((() => {
|
|
|
11376
11380
|
category: "Branches",
|
|
11377
11381
|
keys: ["p"],
|
|
11378
11382
|
screens: ["branches"],
|
|
11379
|
-
hint: "pull request"
|
|
11383
|
+
hint: "pull request",
|
|
11384
|
+
whenPull: true,
|
|
11385
|
+
rank: 4
|
|
11386
|
+
}),
|
|
11387
|
+
command({
|
|
11388
|
+
action: "branch.pull",
|
|
11389
|
+
title: "Open the pull request in a browser",
|
|
11390
|
+
category: "Review",
|
|
11391
|
+
keys: ["p"],
|
|
11392
|
+
screens: ["review"],
|
|
11393
|
+
hint: "pull request",
|
|
11394
|
+
whenPull: true,
|
|
11395
|
+
rank: 5
|
|
11380
11396
|
}),
|
|
11381
11397
|
command({
|
|
11382
11398
|
action: "cursor.next",
|
|
@@ -11842,9 +11858,9 @@ var init_command = __esmMin((() => {
|
|
|
11842
11858
|
if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
|
|
11843
11859
|
return GLYPHS[key] ?? key;
|
|
11844
11860
|
};
|
|
11845
|
-
hintsFor = (screen,
|
|
11861
|
+
hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || offered.staged > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenPull || offered.pull).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
|
|
11846
11862
|
key: displayKey(entry.keys[0] ?? ""),
|
|
11847
|
-
hint: entry.counted ? `${entry.hint} ${staged}` : entry.hint,
|
|
11863
|
+
hint: entry.counted ? `${entry.hint} ${offered.staged}` : entry.hint,
|
|
11848
11864
|
press: entry.keys[0] ?? ""
|
|
11849
11865
|
}));
|
|
11850
11866
|
}));
|
|
@@ -11875,7 +11891,7 @@ var init_match = __esmMin((() => {
|
|
|
11875
11891
|
}));
|
|
11876
11892
|
//#endregion
|
|
11877
11893
|
//#region src/tui/reduce.ts
|
|
11878
|
-
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, layerDown, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withLayers, withPulls, withBranches, withSource, withVouched, restoredTo, withPatches, typed, backspaced, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
|
|
11894
|
+
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, layerDown, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, withPatches, typed, backspaced, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
|
|
11879
11895
|
var init_reduce = __esmMin((() => {
|
|
11880
11896
|
init_dist();
|
|
11881
11897
|
init_patch();
|
|
@@ -12321,7 +12337,12 @@ var init_reduce = __esmMin((() => {
|
|
|
12321
12337
|
};
|
|
12322
12338
|
withPulls = (state, pulls) => ({
|
|
12323
12339
|
...state,
|
|
12324
|
-
pulls
|
|
12340
|
+
pulls,
|
|
12341
|
+
forge: "answered"
|
|
12342
|
+
});
|
|
12343
|
+
withSilentForge = (state) => ({
|
|
12344
|
+
...state,
|
|
12345
|
+
forge: "silent"
|
|
12325
12346
|
});
|
|
12326
12347
|
withBranches = (state, branches) => ({
|
|
12327
12348
|
...state,
|
|
@@ -13012,7 +13033,7 @@ var init_diffview = __esmMin((() => {
|
|
|
13012
13033
|
}));
|
|
13013
13034
|
//#endregion
|
|
13014
13035
|
//#region src/tui/render.ts
|
|
13015
|
-
var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP,
|
|
13036
|
+
var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, BODY_BORDER, PANE_CHROME, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, bodyRoom, treeWidth, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, Screen;
|
|
13016
13037
|
var init_render = __esmMin((() => {
|
|
13017
13038
|
init_command();
|
|
13018
13039
|
init_patch();
|
|
@@ -13036,12 +13057,17 @@ var init_render = __esmMin((() => {
|
|
|
13036
13057
|
actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^a")} ${fg(palette.muted)("add to review")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("comment now")}`;
|
|
13037
13058
|
SNIPPET_LINES = 4;
|
|
13038
13059
|
PALETTE_KEY = 7;
|
|
13039
|
-
PALETTE_TITLE =
|
|
13060
|
+
PALETTE_TITLE = 60;
|
|
13040
13061
|
PALETTE_GAP = 2;
|
|
13041
|
-
PALETTE_MAX = 18;
|
|
13042
13062
|
PALETTE_CHROME = 4;
|
|
13043
13063
|
PENDING_CHROME = 3;
|
|
13044
13064
|
PALETTE_WIDTH = 76;
|
|
13065
|
+
PANEL_SHARE = .62;
|
|
13066
|
+
PANEL_MAX = 120;
|
|
13067
|
+
PANEL_FLOOR = 6;
|
|
13068
|
+
PANEL_FOOT = 2;
|
|
13069
|
+
PANEL_QUARTER = 4;
|
|
13070
|
+
PANEL_FIFTH = 5;
|
|
13045
13071
|
TREE_MAX = 34;
|
|
13046
13072
|
TREE_MIN = 18;
|
|
13047
13073
|
TREE_SHARE = .3;
|
|
@@ -13049,7 +13075,6 @@ var init_render = __esmMin((() => {
|
|
|
13049
13075
|
BODY_BORDER = 2;
|
|
13050
13076
|
PANE_CHROME = 3;
|
|
13051
13077
|
BRANCH_WIDTH = 82;
|
|
13052
|
-
BRANCH_NAME = 44;
|
|
13053
13078
|
BRANCH_NAME_MIN = 12;
|
|
13054
13079
|
BRANCH_TAIL = 45;
|
|
13055
13080
|
EMPTY_LIST = " nothing to review. No worktree differs from the branch it started from.";
|
|
@@ -13060,13 +13085,18 @@ var init_render = __esmMin((() => {
|
|
|
13060
13085
|
const wanted = Math.min(TREE_MAX, Math.max(TREE_MIN, Math.floor(room * TREE_SHARE)));
|
|
13061
13086
|
return Math.max(0, Math.min(wanted, room - DIFF_MIN));
|
|
13062
13087
|
};
|
|
13063
|
-
|
|
13088
|
+
shareOf = (width, least) => Math.max(least, Math.min(PANEL_MAX, Math.floor(width * PANEL_SHARE)));
|
|
13089
|
+
homeWidth = (width, longest) => Math.max(0, Math.min(width - 2, Math.min(PANEL_MAX, Math.max(BRANCH_WIDTH, longest + BRANCH_TAIL))));
|
|
13090
|
+
longestName = (state) => Math.max(0, ...state.branches.map((branch) => branch.branch.length));
|
|
13064
13091
|
commandRow = (entry, room) => {
|
|
13065
13092
|
const key = clip(displayKey(entry.keys[0] ?? ""), 5).padEnd(PALETTE_KEY);
|
|
13066
13093
|
const left = Math.max(1, Math.min(PALETTE_TITLE, room - PALETTE_KEY - entry.category.length - PALETTE_GAP));
|
|
13067
13094
|
return `${key}${clip(entry.title, left - PALETTE_GAP).padEnd(left)}${entry.category}`;
|
|
13068
13095
|
};
|
|
13069
13096
|
modalWidth = (width, wanted) => Math.max(0, Math.min(wanted, width - MODAL_MARGIN));
|
|
13097
|
+
panelWidth = (width) => modalWidth(width, shareOf(width, PALETTE_WIDTH));
|
|
13098
|
+
panelTop = (height, part) => Math.max(2, Math.floor(height / part));
|
|
13099
|
+
panelRows = (height, part) => Math.max(PANEL_FLOOR, height - panelTop(height, part) - PANEL_FOOT);
|
|
13070
13100
|
composeRoom = (width) => {
|
|
13071
13101
|
const box = modalWidth(width, COMPOSE_WIDTH);
|
|
13072
13102
|
return {
|
|
@@ -13185,7 +13215,7 @@ var init_render = __esmMin((() => {
|
|
|
13185
13215
|
makePalette = (renderer) => {
|
|
13186
13216
|
const box = makeCompose(renderer);
|
|
13187
13217
|
box.id = "palette";
|
|
13188
|
-
box.height =
|
|
13218
|
+
box.height = PANEL_FLOOR;
|
|
13189
13219
|
box.width = PALETTE_WIDTH;
|
|
13190
13220
|
return box;
|
|
13191
13221
|
};
|
|
@@ -13340,6 +13370,12 @@ var init_render = __esmMin((() => {
|
|
|
13340
13370
|
});
|
|
13341
13371
|
clip = (label, room) => label.length > room ? `${label.slice(0, Math.max(0, room - 1))}…` : label;
|
|
13342
13372
|
clipHead = (label, room) => label.length > room ? `…${label.slice(label.length - Math.max(0, room - 1))}` : label;
|
|
13373
|
+
clipMiddle = (label, room) => {
|
|
13374
|
+
if (label.length <= room) return label;
|
|
13375
|
+
const kept = Math.max(0, room - 1);
|
|
13376
|
+
const front = Math.floor(kept / 2);
|
|
13377
|
+
return `${label.slice(0, front)}…${label.slice(label.length - (kept - front))}`;
|
|
13378
|
+
};
|
|
13343
13379
|
clipPath = (label, room) => {
|
|
13344
13380
|
if (label.length <= room) return label;
|
|
13345
13381
|
const segments = label.split("/");
|
|
@@ -13353,7 +13389,7 @@ var init_render = __esmMin((() => {
|
|
|
13353
13389
|
const indent = " ".repeat(row.depth);
|
|
13354
13390
|
if (row.kind === "file") {
|
|
13355
13391
|
const lead = `${indent} ${marks().file} `;
|
|
13356
|
-
return `${lead}${
|
|
13392
|
+
return `${lead}${clipMiddle(row.name, Math.max(4, room - lead.length))}`;
|
|
13357
13393
|
}
|
|
13358
13394
|
const shut = state.closed.includes(row.path);
|
|
13359
13395
|
const lead = `${indent}${shut ? "▸" : "▾"} ${shut ? marks().folder : marks().folderOpen} `;
|
|
@@ -13403,17 +13439,23 @@ var init_render = __esmMin((() => {
|
|
|
13403
13439
|
elide = (path, room) => {
|
|
13404
13440
|
if (path.length <= room) return path;
|
|
13405
13441
|
const parts = path.split("/").filter((part) => part.length > 0);
|
|
13406
|
-
const
|
|
13442
|
+
const first = parts[0] ?? "";
|
|
13443
|
+
const name = parts.at(-1) ?? path;
|
|
13407
13444
|
const tail = parts.slice(-2).join("/");
|
|
13408
|
-
|
|
13409
|
-
|
|
13445
|
+
return [
|
|
13446
|
+
`${path.startsWith("/") ? `/${first}` : path.startsWith("~") ? "~" : first}/…/${tail}`,
|
|
13447
|
+
`…/${tail}`,
|
|
13448
|
+
`…/${name}`
|
|
13449
|
+
].find((option) => option.length <= room) ?? clipMiddle(name, room);
|
|
13410
13450
|
};
|
|
13411
13451
|
contextLabel = (context) => {
|
|
13412
13452
|
if (context === 3) return "";
|
|
13413
13453
|
return context >= 1e5 ? "whole file" : `±${context}`;
|
|
13414
13454
|
};
|
|
13415
|
-
nameRoom = (pane) => Math.max(BRANCH_NAME_MIN,
|
|
13455
|
+
nameRoom = (pane) => Math.max(BRANCH_NAME_MIN, pane - BRANCH_TAIL);
|
|
13416
13456
|
columns = (cells, room) => `${clip(cells.name, room).padEnd(room)}${cells.files.padStart(5)}${cells.added.padStart(8)}${cells.gone.padStart(8)} ${cells.layers.padStart(8)} ${cells.state}`;
|
|
13457
|
+
FORGE_SILENT = " could not find out which of these have a pull request";
|
|
13458
|
+
unaskedForge = (state) => state.forge === "silent" ? [fg(palette.faint)(`\n${FORGE_SILENT}`)] : [];
|
|
13417
13459
|
branchHeading = (room) => ` ${columns({
|
|
13418
13460
|
name: "WORKTREE",
|
|
13419
13461
|
files: "FILES",
|
|
@@ -13434,7 +13476,7 @@ var init_render = __esmMin((() => {
|
|
|
13434
13476
|
].filter((part) => part.length > 0).join(" ");
|
|
13435
13477
|
branchCells = (branch, here, room) => ({
|
|
13436
13478
|
lead: `${here ? marks().cursor : " "} `,
|
|
13437
|
-
name:
|
|
13479
|
+
name: clipMiddle(branch.branch, room).padEnd(room),
|
|
13438
13480
|
files: `${branch.files}`.padStart(5),
|
|
13439
13481
|
added: `+${branch.added}`.padStart(8),
|
|
13440
13482
|
gone: `-${branch.removed}`.padStart(8),
|
|
@@ -13445,12 +13487,23 @@ var init_render = __esmMin((() => {
|
|
|
13445
13487
|
branch,
|
|
13446
13488
|
path,
|
|
13447
13489
|
state.patches.length === 0 ? "nothing to read" : `${state.patchIndex + 1}/${state.patches.length}`,
|
|
13490
|
+
pullHere(state).length === 0 ? "" : `${pullHere(state)} pull request`,
|
|
13448
13491
|
state.vouched.length === 0 ? "" : reviewedCount(state),
|
|
13449
13492
|
state.staged === 0 ? "" : `${state.staged} staged`,
|
|
13450
13493
|
contextLabel(state.context),
|
|
13451
13494
|
hiddenLines(state) === 0 ? "" : `⋯ ${hiddenLines(state)} lines hidden`,
|
|
13452
13495
|
pan === 0 ? "" : `→ ${pan} columns`
|
|
13453
13496
|
];
|
|
13497
|
+
HEADER_GAP = 2;
|
|
13498
|
+
HEADER_PATH_MIN = 20;
|
|
13499
|
+
headerRoom = (width) => Math.max(0, width - 2 - 4);
|
|
13500
|
+
headerFitted = (parts, path, room) => {
|
|
13501
|
+
const gaps = HEADER_GAP * Math.max(0, parts.length - 1);
|
|
13502
|
+
const spent = parts.reduce((total, part) => total + part.length, gaps);
|
|
13503
|
+
if (path.length === 0 || spent <= room) return parts;
|
|
13504
|
+
const left = Math.max(HEADER_PATH_MIN, path.length - (spent - room));
|
|
13505
|
+
return parts.map((part) => part === path ? elide(path, left) : part);
|
|
13506
|
+
};
|
|
13454
13507
|
fallbackScope = (state, top) => {
|
|
13455
13508
|
const scope = (selectedPatch(state)?.hunks.findLast((hunk) => hunk.startRow < top))?.scope ?? "";
|
|
13456
13509
|
return scope.length === 0 ? [] : [scope];
|
|
@@ -13623,12 +13676,17 @@ var init_render = __esmMin((() => {
|
|
|
13623
13676
|
}
|
|
13624
13677
|
update(state) {
|
|
13625
13678
|
this.shown = state;
|
|
13626
|
-
this.chips = hintsFor(state.screen,
|
|
13679
|
+
this.chips = hintsFor(state.screen, {
|
|
13680
|
+
staged: state.staged,
|
|
13681
|
+
layers: state.layers.length,
|
|
13682
|
+
onThread: state.stop > 0,
|
|
13683
|
+
pull: pullHere(state).length > 0
|
|
13684
|
+
});
|
|
13627
13685
|
this.header.content = this.headerText(state);
|
|
13628
13686
|
this.footer.content = this.footerText(state);
|
|
13629
13687
|
this.list.content = this.listText(state);
|
|
13630
13688
|
const many = state.branches.length === 1 ? "1 worktree" : `${state.branches.length} worktrees`;
|
|
13631
|
-
const pane =
|
|
13689
|
+
const pane = this.homeRoom(state);
|
|
13632
13690
|
const room = Math.max(HOME_PATH_MIN, pane - many.length - HOME_PATH_CHROME);
|
|
13633
13691
|
this.landing.content = `${elide(shortPath(this.repo), room)} · ${many}`;
|
|
13634
13692
|
this.landingKeys.content = this.homeKeys(state);
|
|
@@ -13654,17 +13712,17 @@ var init_render = __esmMin((() => {
|
|
|
13654
13712
|
const matches = paletteMatches(state);
|
|
13655
13713
|
this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
|
|
13656
13714
|
this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
|
|
13657
|
-
const room =
|
|
13715
|
+
const room = panelWidth(this.renderer.width);
|
|
13658
13716
|
this.paletteChoices.options = matches.map((entry) => ({
|
|
13659
13717
|
name: commandRow(entry, room - MODAL_ROOM),
|
|
13660
13718
|
description: "",
|
|
13661
13719
|
value: entry.action
|
|
13662
13720
|
}));
|
|
13663
13721
|
this.paletteChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, matches.length - 1));
|
|
13664
|
-
this.palette.height = Math.min(
|
|
13722
|
+
this.palette.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
|
|
13665
13723
|
this.palette.width = room;
|
|
13666
13724
|
this.palette.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
13667
|
-
this.palette.top =
|
|
13725
|
+
this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
|
|
13668
13726
|
}
|
|
13669
13727
|
paintKeys(state) {
|
|
13670
13728
|
this.keys.visible = state.screen === "keys";
|
|
@@ -13674,7 +13732,7 @@ var init_render = __esmMin((() => {
|
|
|
13674
13732
|
return;
|
|
13675
13733
|
}
|
|
13676
13734
|
const rows = glossaryFor(state.returnTo);
|
|
13677
|
-
const room =
|
|
13735
|
+
const room = panelWidth(this.renderer.width);
|
|
13678
13736
|
this.keysTitle.content = `Every key here, ${rows.length} of them`;
|
|
13679
13737
|
this.keysChoices.options = rows.map((entry) => ({
|
|
13680
13738
|
name: commandRow(entry, room - MODAL_ROOM),
|
|
@@ -13682,16 +13740,17 @@ var init_render = __esmMin((() => {
|
|
|
13682
13740
|
value: entry.action
|
|
13683
13741
|
}));
|
|
13684
13742
|
this.keysChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, rows.length - 1));
|
|
13685
|
-
this.keys.height = Math.min(
|
|
13743
|
+
this.keys.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
|
|
13686
13744
|
this.keys.width = room;
|
|
13687
13745
|
this.keys.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
13688
|
-
this.keys.top =
|
|
13746
|
+
this.keys.top = panelTop(this.renderer.height, PANEL_QUARTER);
|
|
13689
13747
|
}
|
|
13690
13748
|
headerText(state) {
|
|
13691
13749
|
const branch = selectedBranch(state);
|
|
13692
13750
|
if (atHome(state)) return t`${fg(palette.faint)("")}`;
|
|
13693
|
-
const
|
|
13694
|
-
const
|
|
13751
|
+
const path = selectedPatch(state)?.path ?? "";
|
|
13752
|
+
const parts = headerParts(state, branch?.branch ?? "", path, Math.min(state.pan, this.view.panLimit())).filter((part) => part.length > 0);
|
|
13753
|
+
const [name = "", ...rest] = headerFitted(parts, path, headerRoom(this.renderer.width));
|
|
13695
13754
|
return t`${fg(palette.ink)(name)} ${fg(palette.muted)(rest.join(" "))}`;
|
|
13696
13755
|
}
|
|
13697
13756
|
footerText(state) {
|
|
@@ -13760,7 +13819,7 @@ var init_render = __esmMin((() => {
|
|
|
13760
13819
|
return;
|
|
13761
13820
|
}
|
|
13762
13821
|
const count = state.pending.length;
|
|
13763
|
-
const room =
|
|
13822
|
+
const room = panelWidth(this.renderer.width);
|
|
13764
13823
|
this.pendingTitle.content = `Send ${count} comment${count === 1 ? "" : "s"} as one review, waking the agent once`;
|
|
13765
13824
|
this.pendingChoices.options = state.pending.map((entry) => ({
|
|
13766
13825
|
name: clip(`${entry.file}:${entry.start}-${entry.end} ${entry.body.split("\n")[0] ?? ""}`, Math.max(1, room - MODAL_ROOM)),
|
|
@@ -13768,10 +13827,10 @@ var init_render = __esmMin((() => {
|
|
|
13768
13827
|
value: entry.file
|
|
13769
13828
|
}));
|
|
13770
13829
|
this.pendingChoices.selectedIndex = state.pendingIndex;
|
|
13771
|
-
this.pending.height = Math.min(
|
|
13830
|
+
this.pending.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), state.pending.length + PENDING_CHROME);
|
|
13772
13831
|
this.pending.width = room;
|
|
13773
13832
|
this.pending.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
13774
|
-
this.pending.top =
|
|
13833
|
+
this.pending.top = panelTop(this.renderer.height, PANEL_QUARTER);
|
|
13775
13834
|
}
|
|
13776
13835
|
assemble(renderer) {
|
|
13777
13836
|
this.diffScroll.add(this.view.node());
|
|
@@ -13819,7 +13878,7 @@ var init_render = __esmMin((() => {
|
|
|
13819
13878
|
};
|
|
13820
13879
|
}
|
|
13821
13880
|
branchTable(state) {
|
|
13822
|
-
const room = nameRoom(
|
|
13881
|
+
const room = nameRoom(this.homeRoom(state));
|
|
13823
13882
|
if (state.branches.length === 0) return new StyledText([fg(palette.muted)(EMPTY_LIST)]);
|
|
13824
13883
|
const heading = [fg(palette.faint)(`${branchHeading(room)}\n\n`)];
|
|
13825
13884
|
const rows = state.branches.flatMap((branch, index) => {
|
|
@@ -13835,7 +13894,11 @@ var init_render = __esmMin((() => {
|
|
|
13835
13894
|
fg(palette.attention)(` ${stateCell(state, branch)}\n`)
|
|
13836
13895
|
];
|
|
13837
13896
|
});
|
|
13838
|
-
return new StyledText([
|
|
13897
|
+
return new StyledText([
|
|
13898
|
+
...heading,
|
|
13899
|
+
...rows,
|
|
13900
|
+
...unaskedForge(state)
|
|
13901
|
+
]);
|
|
13839
13902
|
}
|
|
13840
13903
|
hover(x) {
|
|
13841
13904
|
let at = 0;
|
|
@@ -13850,10 +13913,13 @@ var init_render = __esmMin((() => {
|
|
|
13850
13913
|
this.landingKeys.content = this.chipRow();
|
|
13851
13914
|
if (this.shown !== void 0) this.footer.content = this.footerText(this.shown);
|
|
13852
13915
|
}
|
|
13916
|
+
homeRoom(state) {
|
|
13917
|
+
return homeWidth(this.renderer.width, longestName(state));
|
|
13918
|
+
}
|
|
13853
13919
|
homeKeys(state) {
|
|
13854
13920
|
const said = state.notice.length === 0 ? state.waiting : state.notice;
|
|
13855
13921
|
const tail = said.length === 0 ? "" : ` ${said}`;
|
|
13856
|
-
const room = Math.max(0,
|
|
13922
|
+
const room = Math.max(0, this.homeRoom(state) - tail.length);
|
|
13857
13923
|
const chips = keptWithin(this.chipRow().chunks, room);
|
|
13858
13924
|
if (tail.length === 0) return new StyledText([...chips]);
|
|
13859
13925
|
const colour = state.notice.length === 0 ? palette.accent : palette.attention;
|
|
@@ -13874,7 +13940,7 @@ var init_render = __esmMin((() => {
|
|
|
13874
13940
|
paintPane(state) {
|
|
13875
13941
|
const onBranches = atHome(state);
|
|
13876
13942
|
const inset = onBranches ? 0 : 1;
|
|
13877
|
-
this.listPane.width = onBranches ?
|
|
13943
|
+
this.listPane.width = onBranches ? this.homeRoom(state) : this.paneRoom();
|
|
13878
13944
|
this.listPane.visible = onBranches || state.navOpen;
|
|
13879
13945
|
this.listPane.border = onBranches ? [] : ["right"];
|
|
13880
13946
|
this.listPane.paddingLeft = inset;
|
|
@@ -13907,7 +13973,7 @@ var init_render = __esmMin((() => {
|
|
|
13907
13973
|
this.foundChoices.options = [];
|
|
13908
13974
|
return;
|
|
13909
13975
|
}
|
|
13910
|
-
const room =
|
|
13976
|
+
const room = panelWidth(this.renderer.width);
|
|
13911
13977
|
const here = matchHere(state);
|
|
13912
13978
|
this.foundTitle.content = `${state.term} · ${state.matches.length} elsewhere`;
|
|
13913
13979
|
this.foundChoices.options = state.matches.map((match) => ({
|
|
@@ -13919,10 +13985,10 @@ var init_render = __esmMin((() => {
|
|
|
13919
13985
|
this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
|
|
13920
13986
|
const peekRows = here?.around.length ?? 0;
|
|
13921
13987
|
this.foundPeek.height = peekRows;
|
|
13922
|
-
this.found.height = Math.min(
|
|
13988
|
+
this.found.height = Math.min(panelRows(this.renderer.height, PANEL_FIFTH), state.matches.length + peekRows + PALETTE_CHROME);
|
|
13923
13989
|
this.found.width = room;
|
|
13924
13990
|
this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
13925
|
-
this.found.top =
|
|
13991
|
+
this.found.top = panelTop(this.renderer.height, PANEL_FIFTH);
|
|
13926
13992
|
}
|
|
13927
13993
|
paintReport(state) {
|
|
13928
13994
|
this.compose.visible = state.screen === "compose" || state.screen === "report";
|
|
@@ -14101,7 +14167,7 @@ var init_upgrade = __esmMin((() => {
|
|
|
14101
14167
|
return due ? `adiff ${latest} is out · adiff upgrade` : "";
|
|
14102
14168
|
}).pipe(withSpan("Tui.upgradeHint"));
|
|
14103
14169
|
upgradeHint = worded.pipe(orElseSucceed(() => ""));
|
|
14104
|
-
})), PRINTABLE, KEY_HISTORY, copyToClipboard, asKey, keyName, App, settledPath, launch, told, untilDestroyed, runOn, runTui;
|
|
14170
|
+
})), PRINTABLE, KEY_HISTORY, copyToClipboard, asKey, openedPull, keyName, App, settledPath, launch, told, untilDestroyed, runOn, runTui;
|
|
14105
14171
|
var init_app = __esmMin((() => {
|
|
14106
14172
|
init_dist();
|
|
14107
14173
|
init_report();
|
|
@@ -14135,6 +14201,10 @@ var init_app = __esmMin((() => {
|
|
|
14135
14201
|
ctrl: false,
|
|
14136
14202
|
shift: false
|
|
14137
14203
|
};
|
|
14204
|
+
openedPull = (state, opened) => {
|
|
14205
|
+
if (!opened) return "could not reach the pull request";
|
|
14206
|
+
return state.length === 0 ? "opened the pull request" : `opened the ${state} pull request`;
|
|
14207
|
+
};
|
|
14138
14208
|
keyName = (key) => {
|
|
14139
14209
|
const base = key.shift && key.name.length === 1 ? key.name.toUpperCase() : key.name;
|
|
14140
14210
|
return key.ctrl ? `ctrl+${base}` : base;
|
|
@@ -14708,21 +14778,21 @@ var init_app = __esmMin((() => {
|
|
|
14708
14778
|
return gen({ self: this }, function* () {
|
|
14709
14779
|
const branch = selectedBranch(this.state);
|
|
14710
14780
|
if (branch === void 0) return;
|
|
14711
|
-
|
|
14712
|
-
if (state === void 0) {
|
|
14781
|
+
if (knownToHaveNoPull(this.state)) {
|
|
14713
14782
|
this.commit(withNoticeHere(this.state, "no pull request for this branch"));
|
|
14714
14783
|
return;
|
|
14715
14784
|
}
|
|
14716
|
-
const
|
|
14717
|
-
this.commit(withNoticeHere(this.state,
|
|
14785
|
+
const opened = yield* (yield* map(Forge, (service) => service)).openPull(this.repo, branch.branch).pipe(as(true), catchTag("ForgeUnavailable", () => succeed(false)));
|
|
14786
|
+
this.commit(withNoticeHere(this.state, openedPull(pullHere(this.state), opened)));
|
|
14718
14787
|
});
|
|
14719
14788
|
}
|
|
14720
14789
|
loadPulls() {
|
|
14721
14790
|
return gen({ self: this }, function* () {
|
|
14722
|
-
const
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14791
|
+
const answered = yield* (yield* map(Forge, (service) => service)).pulls(this.repo).pipe(map(some), catchTag("ForgeUnavailable", () => succeed(none())));
|
|
14792
|
+
this.commit(match$3(answered, {
|
|
14793
|
+
onNone: () => withSilentForge(this.state),
|
|
14794
|
+
onSome: (pulls) => withPulls(this.state, Object.fromEntries(pulls.map((pull) => [pull.branch, pull.state])))
|
|
14795
|
+
}));
|
|
14726
14796
|
});
|
|
14727
14797
|
}
|
|
14728
14798
|
loadSource() {
|
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.45",
|
|
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": {
|