reslop 0.2.3 → 0.2.5
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 +27 -1
- package/README.md +8 -4
- package/bin/reslop.js +4 -2
- package/lib/api.js +2 -1
- package/lib/capabilities.js +0 -4
- package/lib/cli.js +19 -10
- package/lib/clipboard.js +45 -4
- package/lib/deps-diff.js +61 -118
- package/lib/deps.js +166 -235
- package/lib/detect.js +4 -2
- package/lib/diff/align.js +2 -1
- package/lib/diff/diff.js +6 -3
- package/lib/diff/display.js +2 -1
- package/lib/diff/inline.js +68 -2
- package/lib/diff/patch.js +2 -1
- package/lib/diff/unit.js +15 -30
- package/lib/editor.js +91 -13
- package/lib/files.js +54 -27
- package/lib/git-branches.js +107 -154
- package/lib/git-deps.js +78 -155
- package/lib/git-worktree.js +508 -0
- package/lib/git.js +23 -580
- package/lib/github.js +9 -8
- package/lib/gitlab.js +5 -4
- package/lib/highlight/bash.js +2 -1
- package/lib/highlight/core.js +11 -0
- package/lib/highlight/css.js +2 -1
- package/lib/highlight/csv.js +2 -1
- package/lib/highlight/dot.js +3 -12
- package/lib/highlight/html.js +2 -1
- package/lib/highlight/json.js +2 -1
- package/lib/highlight/log.js +5 -11
- package/lib/highlight/txt.js +3 -12
- package/lib/highlight.js +2 -1
- package/lib/keys.js +22 -12
- package/lib/manifest.js +4 -6
- package/lib/npm-commands.js +82 -24
- package/lib/remote.js +21 -20
- package/lib/render/branches.js +9 -27
- package/lib/render/chrome.js +109 -35
- package/lib/render/commits.js +216 -216
- package/lib/render/diff.js +160 -47
- package/lib/render/files.js +9 -26
- package/lib/render/frame.js +97 -118
- package/lib/render/notes.js +74 -26
- package/lib/render/npm.js +104 -30
- package/lib/render/present.js +2 -1
- package/lib/render/primitives.js +128 -52
- package/lib/render/render.js +2 -1
- package/lib/render/unit.js +17 -11
- package/lib/report-model.js +6 -4
- package/lib/report-parse.js +8 -14
- package/lib/report-render.js +38 -21
- package/lib/report-run.js +12 -11
- package/lib/report-test.js +45 -51
- package/lib/report-tools.js +44 -25
- package/lib/review-merge.js +102 -131
- package/lib/review.js +69 -78
- package/lib/select.js +52 -0
- package/lib/session/actions.js +72 -87
- package/lib/session/branches.js +18 -52
- package/lib/session/change-actions.js +175 -147
- package/lib/session/commit.js +65 -61
- package/lib/session/compose.js +152 -83
- package/lib/session/dispatch.js +53 -46
- package/lib/session/edit-click.js +57 -0
- package/lib/session/files-pane.js +30 -51
- package/lib/session/items.js +73 -90
- package/lib/session/lifecycle.js +37 -98
- package/lib/session/load.js +52 -57
- package/lib/session/navigation.js +105 -95
- package/lib/session/npm.js +205 -71
- package/lib/session/ops.js +200 -45
- package/lib/session/pointer.js +33 -8
- package/lib/session/progress.js +9 -6
- package/lib/session/review.js +35 -53
- package/lib/session/tasks.js +292 -0
- package/lib/session/terminal.js +17 -19
- package/lib/session/unit.js +3 -4
- package/lib/session/update.js +76 -96
- package/lib/session/view.js +45 -16
- package/lib/session/watch.js +47 -27
- package/lib/session.js +66 -97
- package/lib/source.js +6 -3
- package/lib/update.js +5 -13
- package/lib/utilities.js +25 -3
- package/lib/wrap.js +18 -1
- package/package.json +1 -1
- package/lib/session/todos.js +0 -293
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased][unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.5][] - 2026-09-30
|
|
6
|
+
|
|
7
|
+
- Remove UI and filesystem polling timers, refresh on events
|
|
8
|
+
- Refresh the commits list when HEAD changes outside reslop
|
|
9
|
+
- Update stage/unstage immediately, git/npm in the background
|
|
10
|
+
- Add editor hotkeys Ctrl+X, Ctrl+C, and Ctrl+V
|
|
11
|
+
- Improve diff calculation
|
|
12
|
+
- Improve npm command and test edit/run
|
|
13
|
+
- Refactor internals: simplify and add classes
|
|
14
|
+
- Hothey "i" add to ignore lists: .gitignore, .npmignore
|
|
15
|
+
- Rename TODO to tasks and improve TUI/TUX
|
|
16
|
+
|
|
17
|
+
## [0.2.4][] - 2026-09-28
|
|
18
|
+
|
|
19
|
+
- Add AI instructions to run `npm t` or `reslop t -- node --test`
|
|
20
|
+
- Cleanup old logs (older than 5 days)
|
|
21
|
+
- Rename TODO list to Project Backlog and Issues
|
|
22
|
+
- Word wrap in view and horizontal scrolling in edit mode
|
|
23
|
+
- Return to uncommitted changes when viewing history in read-only mode
|
|
24
|
+
- Improve TUI/TUX for commits and npm commands
|
|
25
|
+
- Remove circular dependencies between Git modules
|
|
26
|
+
- Unify list rendering and keyboard navigation
|
|
27
|
+
- Simplify dependency transformations and remove redundant wrappers
|
|
28
|
+
|
|
5
29
|
## [0.2.3][] - 2026-09-27
|
|
6
30
|
|
|
7
31
|
- Add brief and full commit lists, toggled with `v`
|
|
@@ -129,7 +153,9 @@
|
|
|
129
153
|
- Feedback and todos that produce a repair plan for an agent
|
|
130
154
|
- Intra-line highlighting in unified, mixed, and side-by-side layouts
|
|
131
155
|
|
|
132
|
-
[unreleased]: https://github.com/tshemsedinov/reslop/compare/v0.2.
|
|
156
|
+
[unreleased]: https://github.com/tshemsedinov/reslop/compare/v0.2.5...HEAD
|
|
157
|
+
[0.2.5]: https://github.com/tshemsedinov/reslop/compare/v0.2.4...v0.2.5
|
|
158
|
+
[0.2.4]: https://github.com/tshemsedinov/reslop/compare/v0.2.3...v0.2.4
|
|
133
159
|
[0.2.3]: https://github.com/tshemsedinov/reslop/compare/v0.2.1...v0.2.3
|
|
134
160
|
[0.2.1]: https://github.com/tshemsedinov/reslop/compare/v0.2.0...v0.2.1
|
|
135
161
|
[0.2.0]: https://github.com/tshemsedinov/reslop/compare/v0.1.9...v0.2.0
|
package/README.md
CHANGED
|
@@ -11,21 +11,23 @@
|
|
|
11
11
|
|
|
12
12
|
> Turn generated changes into owned changes
|
|
13
13
|
|
|
14
|
-
Open a change, leave findings and
|
|
15
|
-
for the agent.
|
|
14
|
+
Open a change, leave findings and a backlog, and prepare a repair plan for the agent.
|
|
16
15
|
|
|
17
16
|
```text
|
|
18
17
|
Review → Plan → Repair → Verify
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
- Leave feedback,
|
|
20
|
+
- Leave feedback, a project backlog, and in-place code proposals as a repair plan
|
|
22
21
|
- Review uncommitted git diffs, a given commit, a GitHub PR, or a GitLab MR
|
|
23
22
|
- File-scope review mode: not just diffs, with editor mode
|
|
24
23
|
- Stage, unstage, or revert each contiguous block of diff lines
|
|
25
24
|
- Auto-reload local diffs when files change, keeping the current screen
|
|
26
25
|
- Import GitHub PR and GitLab MR review comments into the local plan for AI
|
|
27
|
-
- Commits list: commit, amend, fixup, reword, drop, pull, and push
|
|
26
|
+
- Commits list: brief and full, view a commit's diff, commit, amend, fixup, reword, drop, pull, and push
|
|
28
27
|
- Branches: checkout, create, rebase, drop, pull, and push
|
|
28
|
+
- npm scripts and bins: run, edit, and reorder; double-click to run; clean logs older than 5 days
|
|
29
|
+
- Long lines wrap in the diff view; the editor scrolls horizontally
|
|
30
|
+
- Reduced test and lint output for agents: failures and a short summary, not passing noise
|
|
29
31
|
- Review each npm dependency once across `package.json` and the lockfile
|
|
30
32
|
- Propose unused removals, npm audit fixes, and outdated updates as diffs
|
|
31
33
|
- Code highlighting and intra-line diffs: unified, mixed, and side-by-side
|
|
@@ -61,6 +63,8 @@ Prefix each program in an npm script with `reslop t --`. Keep `&&` between those
|
|
|
61
63
|
|
|
62
64
|
The report is Markdown: failures, diagnostics, and a short summary. Passing results are omitted and similar problems are grouped. The same text is saved under `.log/`. Set `RESLOP_OUTPUT=raw` to pass the command through unchanged. The review screen runs scripts in raw mode and applies its own filter once.
|
|
63
65
|
|
|
66
|
+
Run the full check with `npm t`. Run one or more test files with `reslop t -- node --test <files>`. New reviews include those two commands in the agent instructions.
|
|
67
|
+
|
|
64
68
|
Reviews go in `.review/YYYY-MM-DD-NN.md` with frontmatter `status`:
|
|
65
69
|
|
|
66
70
|
- `editing`: still writing the review in reslop
|
package/bin/reslop.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
const {
|
|
4
|
+
const cli = require('../lib/cli.js');
|
|
5
|
+
const { run, errorMessage } = cli;
|
|
6
|
+
const session = require('../lib/session.js');
|
|
7
|
+
const { LEAVE_TERM } = session;
|
|
6
8
|
|
|
7
9
|
const fail = (reason) => {
|
|
8
10
|
try {
|
package/lib/api.js
CHANGED
|
@@ -10,7 +10,8 @@ const detect = require('./detect.js');
|
|
|
10
10
|
const github = require('./github.js');
|
|
11
11
|
const gitlab = require('./gitlab.js');
|
|
12
12
|
const source = require('./source.js');
|
|
13
|
-
const
|
|
13
|
+
const session = require('./session.js');
|
|
14
|
+
const { Session } = session;
|
|
14
15
|
const cli = require('./cli.js');
|
|
15
16
|
|
|
16
17
|
module.exports = {
|
package/lib/capabilities.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -2,16 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
10
|
-
const
|
|
11
|
-
const {
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
14
|
-
const
|
|
5
|
+
const metautil = require('metautil');
|
|
6
|
+
const { exists } = metautil;
|
|
7
|
+
|
|
8
|
+
const git = require('./git.js');
|
|
9
|
+
const { createGitRepo } = git;
|
|
10
|
+
const github = require('./github.js');
|
|
11
|
+
const { githubToken, loadPullRequest } = github;
|
|
12
|
+
const gitlab = require('./gitlab.js');
|
|
13
|
+
const { gitlabToken, loadMergeRequest } = gitlab;
|
|
14
|
+
const source = require('./source.js');
|
|
15
|
+
const { selectChangeSource, createLoadedSource } = source;
|
|
16
|
+
const session = require('./session.js');
|
|
17
|
+
const { Session } = session;
|
|
18
|
+
const capabilities = require('./capabilities.js');
|
|
19
|
+
const { capabilitiesFor, attachCapabilities } = capabilities;
|
|
20
|
+
const ansi = require('./ansi.js');
|
|
21
|
+
const { setTheme } = ansi;
|
|
22
|
+
const reportRun = require('./report-run.js');
|
|
23
|
+
const { runCapture } = reportRun;
|
|
15
24
|
|
|
16
25
|
const HEX_REV = /^[0-9a-f]{4,40}$/i;
|
|
17
26
|
const HEAD_REV = /^HEAD([~^].*)?$/i;
|
package/lib/clipboard.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const childProcess = require('node:child_process');
|
|
4
|
+
const { spawnSync } = childProcess;
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
6
|
+
const ansi = require('./ansi.js');
|
|
7
|
+
const { ESC } = ansi;
|
|
8
|
+
const utilities = require('./utilities.js');
|
|
9
|
+
const { clipTools, spawnBase } = utilities;
|
|
7
10
|
|
|
8
11
|
const CLIP_TIMEOUT_MS = 1000;
|
|
9
12
|
|
|
@@ -26,8 +29,44 @@ const runClip = (cmd, args, text) => {
|
|
|
26
29
|
return result.status === 0;
|
|
27
30
|
};
|
|
28
31
|
|
|
32
|
+
const UNIX_PASTE = [
|
|
33
|
+
{ cmd: 'wl-paste', args: ['--no-newline'] },
|
|
34
|
+
{ cmd: 'xclip', args: ['-selection', 'clipboard', '-o'] },
|
|
35
|
+
{ cmd: 'xsel', args: ['--clipboard', '--output'] },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
let copied = '';
|
|
39
|
+
|
|
40
|
+
const pasteTools = (platform = process.platform) => {
|
|
41
|
+
if (platform === 'win32') {
|
|
42
|
+
const args = ['-NoProfile', '-Command', 'Get-Clipboard'];
|
|
43
|
+
return [{ cmd: 'powershell', args }];
|
|
44
|
+
}
|
|
45
|
+
if (platform === 'darwin') return [{ cmd: 'pbpaste', args: [] }];
|
|
46
|
+
return UNIX_PASTE;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const readPaste = (cmd, args) => {
|
|
50
|
+
const result = spawnSync(
|
|
51
|
+
cmd,
|
|
52
|
+
args,
|
|
53
|
+
spawnBase({ encoding: 'utf8', timeout: CLIP_TIMEOUT_MS }),
|
|
54
|
+
);
|
|
55
|
+
if (result.error || result.status !== 0) return '';
|
|
56
|
+
return result.stdout || '';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const systemPaste = () => {
|
|
60
|
+
for (const tool of pasteTools()) {
|
|
61
|
+
const text = readPaste(tool.cmd, tool.args);
|
|
62
|
+
if (text) return text;
|
|
63
|
+
}
|
|
64
|
+
return '';
|
|
65
|
+
};
|
|
66
|
+
|
|
29
67
|
const copyText = (text, stdout) => {
|
|
30
68
|
if (!text) return false;
|
|
69
|
+
copied = text;
|
|
31
70
|
let ok = false;
|
|
32
71
|
if (stdout && stdout.write) {
|
|
33
72
|
stdout.write(osc52(text));
|
|
@@ -39,4 +78,6 @@ const copyText = (text, stdout) => {
|
|
|
39
78
|
return ok;
|
|
40
79
|
};
|
|
41
80
|
|
|
42
|
-
|
|
81
|
+
const pasteText = () => systemPaste() || copied;
|
|
82
|
+
|
|
83
|
+
module.exports = { osc52, copyText, pasteText };
|
package/lib/deps-diff.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { isCtxType } =
|
|
3
|
+
const metautil = require('metautil');
|
|
4
|
+
const { jsonParse } = metautil;
|
|
5
|
+
const files = require('./files.js');
|
|
6
|
+
const { itemPath } = files;
|
|
7
|
+
const patch = require('./diff/patch.js');
|
|
8
|
+
const { countSides, formatHunkHeader, formatPatch } = patch;
|
|
9
|
+
const diff = require('./diff/diff.js');
|
|
10
|
+
const { isCtxType } = diff;
|
|
11
11
|
const manifest = require('./manifest.js');
|
|
12
12
|
const { MANIFEST, LOCKFILE, SECTION_KEYS, depFileMeta, relOf } = manifest;
|
|
13
13
|
const { listFilePath, readSections, emptySectionMaps } = manifest;
|
|
@@ -37,14 +37,8 @@ const diffMaps = (oldMap, newMap, section) => {
|
|
|
37
37
|
return changes;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const diffSections = (oldMaps, newMaps) =>
|
|
41
|
-
|
|
42
|
-
for (const key of SECTION_KEYS) {
|
|
43
|
-
const found = diffMaps(oldMaps[key], newMaps[key], key);
|
|
44
|
-
for (const change of found) changes.push(change);
|
|
45
|
-
}
|
|
46
|
-
return changes;
|
|
47
|
-
};
|
|
40
|
+
const diffSections = (oldMaps, newMaps) =>
|
|
41
|
+
SECTION_KEYS.flatMap((key) => diffMaps(oldMaps[key], newMaps[key], key));
|
|
48
42
|
|
|
49
43
|
const fieldText = (value) => {
|
|
50
44
|
if (value === undefined) return '';
|
|
@@ -263,15 +257,8 @@ const compareChangeOrder = (left, right) => {
|
|
|
263
257
|
|
|
264
258
|
const orderedChanges = (changes) => [...changes].sort(compareChangeOrder);
|
|
265
259
|
|
|
266
|
-
const kindItems = (items, kind) =>
|
|
267
|
-
|
|
268
|
-
for (const item of items) {
|
|
269
|
-
const rel = itemPath(item);
|
|
270
|
-
const meta = depFileMeta(rel);
|
|
271
|
-
if (meta && meta.kind === kind) matched.push(item);
|
|
272
|
-
}
|
|
273
|
-
return matched;
|
|
274
|
-
};
|
|
260
|
+
const kindItems = (items, kind) =>
|
|
261
|
+
items.filter((item) => depFileMeta(itemPath(item))?.kind === kind);
|
|
275
262
|
|
|
276
263
|
const readGroupSnapshot = (group, readSides) => {
|
|
277
264
|
const origin = group.origin;
|
|
@@ -457,26 +444,10 @@ const entryText = (change, side) => {
|
|
|
457
444
|
return `"${change.name}": "${version}"`;
|
|
458
445
|
};
|
|
459
446
|
|
|
460
|
-
const ctxLine = (text) => {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
const warnLine = (text) => {
|
|
466
|
-
const type = 'warn';
|
|
467
|
-
return { type, text };
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
const noteLine = (text) => {
|
|
471
|
-
const type = 'note';
|
|
472
|
-
return { type, text };
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
const noteSepLine = () => {
|
|
476
|
-
const type = 'noteSep';
|
|
477
|
-
const text = '';
|
|
478
|
-
return { type, text };
|
|
479
|
-
};
|
|
447
|
+
const ctxLine = (text) => ({ type: 'ctx', text });
|
|
448
|
+
const warnLine = (text) => ({ type: 'warn', text });
|
|
449
|
+
const noteLine = (text) => ({ type: 'note', text });
|
|
450
|
+
const noteSepLine = () => ({ type: 'noteSep', text: '' });
|
|
480
451
|
|
|
481
452
|
const changeLine = (type, change, side) => {
|
|
482
453
|
const text = entryText(change, side);
|
|
@@ -522,12 +493,7 @@ const auditNoteTexts = (audit) => {
|
|
|
522
493
|
}
|
|
523
494
|
const severity = audit.severity;
|
|
524
495
|
if (!notes.length) return [`npm audit ${severity}`];
|
|
525
|
-
|
|
526
|
-
const texts = new Array(length);
|
|
527
|
-
for (let i = 0; i < length; i++) {
|
|
528
|
-
texts[i] = `npm audit ${severity} ${notes[i]}`;
|
|
529
|
-
}
|
|
530
|
-
return texts;
|
|
496
|
+
return notes.map((note) => `npm audit ${severity} ${note}`);
|
|
531
497
|
};
|
|
532
498
|
|
|
533
499
|
const pushAuditNotes = (rows, audit) => {
|
|
@@ -562,13 +528,12 @@ const buildRows = (change, oldCount, newCount) => {
|
|
|
562
528
|
return rows;
|
|
563
529
|
};
|
|
564
530
|
|
|
565
|
-
const toHunkLine = (row, blockId) => {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
};
|
|
531
|
+
const toHunkLine = (row, blockId) => ({
|
|
532
|
+
type: row.type,
|
|
533
|
+
text: row.text,
|
|
534
|
+
noNl: false,
|
|
535
|
+
blockId: isCtxType(row.type) ? null : blockId,
|
|
536
|
+
});
|
|
572
537
|
|
|
573
538
|
const makeHunk = (rows, blockId) => {
|
|
574
539
|
const lines = rows.map((row) => toHunkLine(row, blockId));
|
|
@@ -600,21 +565,13 @@ const filesForChange = (change, files) => {
|
|
|
600
565
|
if (meta.kind === 'manifest') manifest.push(rel);
|
|
601
566
|
else lockfile.push(rel);
|
|
602
567
|
}
|
|
603
|
-
if (change.section === '
|
|
604
|
-
|
|
605
|
-
return files;
|
|
606
|
-
}
|
|
607
|
-
if (change.section === 'resolved') {
|
|
608
|
-
if (lockfile.length) return lockfile;
|
|
609
|
-
return files;
|
|
610
|
-
}
|
|
611
|
-
if (change.propose) {
|
|
612
|
-
if (manifest.length) return manifest;
|
|
613
|
-
return files;
|
|
568
|
+
if (change.section === 'resolved') return lockfile.length ? lockfile : files;
|
|
569
|
+
if (change.section === 'field' || change.propose) {
|
|
570
|
+
return manifest.length ? manifest : files;
|
|
614
571
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
572
|
+
return manifest.length || lockfile.length
|
|
573
|
+
? [...manifest, ...lockfile]
|
|
574
|
+
: files;
|
|
618
575
|
};
|
|
619
576
|
|
|
620
577
|
const pickPrimary = (items) => {
|
|
@@ -630,36 +587,28 @@ const makeDepItem = (origin, fileItems, hidden, change, extra, blockId) => {
|
|
|
630
587
|
const allFiles = uniquePaths(fileItems);
|
|
631
588
|
const files = change ? filesForChange(change, allFiles) : allFiles;
|
|
632
589
|
const primary = pickPrimary(fileItems);
|
|
633
|
-
const
|
|
634
|
-
const
|
|
635
|
-
const
|
|
636
|
-
const isDeleted = fileItems.every((item) => item.file && item.file.isDeleted);
|
|
637
|
-
let oldCount = 0;
|
|
638
|
-
let newCount = 0;
|
|
639
|
-
if (!change) {
|
|
640
|
-
oldCount = extra.oldCount ?? 0;
|
|
641
|
-
newCount = extra.newCount ?? 0;
|
|
642
|
-
}
|
|
643
|
-
const rows = buildRows(change, oldCount, newCount);
|
|
590
|
+
const rel = listFilePath(itemPath(primary));
|
|
591
|
+
const counts = change ? {} : extra;
|
|
592
|
+
const rows = buildRows(change, counts.oldCount ?? 0, counts.newCount ?? 0);
|
|
644
593
|
const hunk = makeHunk(rows, blockId);
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
594
|
+
return {
|
|
595
|
+
origin,
|
|
596
|
+
file: {
|
|
597
|
+
oldPath: rel,
|
|
598
|
+
newPath: rel,
|
|
599
|
+
isNew: fileItems.some((item) => item.file?.isNew),
|
|
600
|
+
isDeleted: fileItems.every((item) => item.file?.isDeleted),
|
|
601
|
+
isBinary: false,
|
|
602
|
+
preamble: [],
|
|
603
|
+
hunks: [hunk],
|
|
604
|
+
},
|
|
605
|
+
hunk,
|
|
606
|
+
blockId,
|
|
607
|
+
patchAdd: '',
|
|
608
|
+
patchRevert: '',
|
|
609
|
+
dep: { files, items: hidden, change },
|
|
610
|
+
reload: !!change?.propose,
|
|
656
611
|
};
|
|
657
|
-
const patchAdd = '';
|
|
658
|
-
const patchRevert = '';
|
|
659
|
-
const items = hidden;
|
|
660
|
-
const dep = { files, items, change };
|
|
661
|
-
const reload = !!(change && change.propose);
|
|
662
|
-
return { origin, file, hunk, blockId, patchAdd, patchRevert, dep, reload };
|
|
663
612
|
};
|
|
664
613
|
|
|
665
614
|
const makeDepItems = (origin, fileItems, hidden, summary) => {
|
|
@@ -670,16 +619,14 @@ const makeDepItems = (origin, fileItems, hidden, summary) => {
|
|
|
670
619
|
if (oldCount === newCount) return [];
|
|
671
620
|
return [makeDepItem(origin, fileItems, hidden, null, summary, 0)];
|
|
672
621
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
items[i] = makeDepItem(origin, fileItems, hidden, ordered[i], summary, i);
|
|
677
|
-
}
|
|
678
|
-
return items;
|
|
622
|
+
return ordered.map((change, index) =>
|
|
623
|
+
makeDepItem(origin, fileItems, hidden, change, summary, index),
|
|
624
|
+
);
|
|
679
625
|
};
|
|
680
626
|
|
|
681
|
-
const stubFileItem = (rel, origin) => {
|
|
682
|
-
|
|
627
|
+
const stubFileItem = (rel, origin) => ({
|
|
628
|
+
origin,
|
|
629
|
+
file: {
|
|
683
630
|
oldPath: rel,
|
|
684
631
|
newPath: rel,
|
|
685
632
|
isNew: false,
|
|
@@ -687,26 +634,22 @@ const stubFileItem = (rel, origin) => {
|
|
|
687
634
|
isBinary: false,
|
|
688
635
|
preamble: [],
|
|
689
636
|
hunks: [],
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
};
|
|
637
|
+
},
|
|
638
|
+
hunk: null,
|
|
639
|
+
blockId: 0,
|
|
640
|
+
patchAdd: '',
|
|
641
|
+
patchRevert: '',
|
|
642
|
+
});
|
|
697
643
|
|
|
698
644
|
module.exports = {
|
|
699
645
|
DEP_CAPTION,
|
|
700
646
|
diffSections,
|
|
701
647
|
mergeResolved,
|
|
702
|
-
orderedChanges,
|
|
703
648
|
summarizeGroup,
|
|
704
649
|
collectGroups,
|
|
705
650
|
takeManifestItems,
|
|
706
651
|
foldedDepNames,
|
|
707
652
|
stripFoldedDepItem,
|
|
708
|
-
buildRows,
|
|
709
|
-
makeHunk,
|
|
710
653
|
makeDepItems,
|
|
711
654
|
stubFileItem,
|
|
712
655
|
};
|