reslop 0.1.1 → 0.1.2
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 +13 -6
- package/README.md +11 -9
- package/bin/reslop.js +2 -2
- package/lib/ansi.js +0 -1
- package/lib/cli.js +44 -43
- package/lib/clipboard.js +1 -1
- package/lib/deps.js +1440 -0
- package/lib/detect.js +4 -4
- package/lib/diff.js +31 -55
- package/lib/editor.js +1 -1
- package/lib/files.js +22 -3
- package/lib/git.js +360 -36
- package/lib/github.js +28 -34
- package/lib/highlight.js +126 -140
- package/lib/keys.js +29 -39
- package/lib/render.js +172 -129
- package/lib/review.js +22 -42
- package/lib/select.js +16 -18
- package/lib/session.js +97 -208
- package/lib/source.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased][unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.2][] - 2026-09-11
|
|
6
|
+
|
|
7
|
+
- Review each dependency once across package.json and package-lock
|
|
8
|
+
- Mark unused npm dependencies that are not imported or used
|
|
9
|
+
- Propose unused dependency removals and run npm uninstall
|
|
10
|
+
- Mark dependency review items and show npm audit findings
|
|
11
|
+
- Show npm outdated and npm audit updates as proposed diffs
|
|
12
|
+
- Propose a lockfile version bump for transitive dependencies
|
|
13
|
+
|
|
5
14
|
## [0.1.1][] - 2026-09-10
|
|
6
15
|
|
|
7
16
|
- Open a GitHub pull request by URL and review its diff
|
|
8
17
|
- Import GitHub pull request review comments into the local review
|
|
9
18
|
- Improve TUI navigation and hotkeys
|
|
10
19
|
- CLI simplification and optimisation
|
|
11
|
-
-
|
|
20
|
+
- Fix diff highlighting for snake_case identifier changes
|
|
12
21
|
- Updated package metadata and README
|
|
13
22
|
|
|
14
23
|
## [0.1.0][] - 2026-09-07
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- Interactive terminal review of uncommitted git diffs with stage, unstage,
|
|
19
|
-
revert, and skip
|
|
25
|
+
- Interactive review of uncommitted git diffs with stage, unstage, revert
|
|
20
26
|
- Feedback and todos that produce a repair plan for an agent
|
|
21
27
|
- Intra-line highlighting in unified, mixed, and side-by-side layouts
|
|
22
28
|
|
|
23
|
-
[unreleased]: https://github.com/tshemsedinov/reslop/compare/v0.1.
|
|
29
|
+
[unreleased]: https://github.com/tshemsedinov/reslop/compare/v0.1.2...HEAD
|
|
30
|
+
[0.1.2]: https://github.com/tshemsedinov/reslop/compare/v0.1.1...v0.1.2
|
|
24
31
|
[0.1.1]: https://github.com/tshemsedinov/reslop/compare/v0.1.0...v0.1.1
|
|
25
32
|
[0.1.0]: https://github.com/tshemsedinov/reslop/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
> Turn generated changes into owned changes
|
|
4
4
|
|
|
5
|
+
Open a change, leave findings and todos, and prepare a repair plan
|
|
6
|
+
for the agent.
|
|
7
|
+
|
|
5
8
|
```text
|
|
6
9
|
Review → Plan → Repair → Verify
|
|
7
10
|
```
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- Review uncommitted git diffs, a given commit, or a GitHub pull request.
|
|
13
|
+
- Stage, unstage, or revert each contiguous block of diff lines.
|
|
14
|
+
- Leave feedback and todos that become a repair plan for the agent.
|
|
15
|
+
- Import GitHub pull request review comments into the local plan for AI.
|
|
16
|
+
- Review each npm dependency once across `package.json` and the lockfile.
|
|
17
|
+
- Propose unused removals, npm audit fixes, and outdated updates as diffs.
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
add review and todos. Commit and pull request review is read-only.
|
|
19
|
+
Commit and pull request review is read-only. Applying a dependency
|
|
20
|
+
proposal stages the files and runs `npm i` or `npm uninstall`.
|
|
19
21
|
|
|
20
22
|
Intra-line highlighting paints the words that actually changed in a
|
|
21
23
|
stronger red/green. A close edit inside one word still marks only
|
package/bin/reslop.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const { run,
|
|
4
|
+
const { run, failLine } = require('../lib/cli.js');
|
|
5
5
|
const { LEAVE_TERM } = require('../lib/session.js');
|
|
6
6
|
|
|
7
7
|
const fail = (reason) => {
|
|
8
8
|
try {
|
|
9
9
|
process.stdout.write(LEAVE_TERM);
|
|
10
10
|
} catch {}
|
|
11
|
-
process.stderr.write(
|
|
11
|
+
process.stderr.write(failLine(reason));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
};
|
|
14
14
|
|
package/lib/ansi.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -21,8 +21,10 @@ const errorMessage = (reason) => {
|
|
|
21
21
|
return `${reason}`;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const failLine = (reason) => `reslop: ${errorMessage(reason)}\n`;
|
|
25
|
+
|
|
24
26
|
const fail = (stderr, reason) => {
|
|
25
|
-
stderr.write(
|
|
27
|
+
stderr.write(failLine(reason));
|
|
26
28
|
return 1;
|
|
27
29
|
};
|
|
28
30
|
|
|
@@ -70,7 +72,7 @@ const resolveScope = (cwd, paths, repo, statSync = fs.statSync) => {
|
|
|
70
72
|
if (pathExists(cwd, first, statSync)) {
|
|
71
73
|
return { rev: null, paths };
|
|
72
74
|
}
|
|
73
|
-
const resolved = repo.resolveRev
|
|
75
|
+
const resolved = repo.resolveRev(cwd, first);
|
|
74
76
|
if (resolved) {
|
|
75
77
|
if (paths.length > 1) {
|
|
76
78
|
throw new Error('use a commit or a path, not both');
|
|
@@ -85,30 +87,39 @@ const resolveScope = (cwd, paths, repo, statSync = fs.statSync) => {
|
|
|
85
87
|
|
|
86
88
|
const isColorEnabled = (stdout, env) => stdout.isTTY === true && !env.NO_COLOR;
|
|
87
89
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
getSize: deps.getSize,
|
|
103
|
-
startPane: 'files',
|
|
104
|
-
newReview: args.newReview,
|
|
105
|
-
});
|
|
90
|
+
const sessionOptions = (proc, deps, args, env, extra) => ({
|
|
91
|
+
cwd: deps.cwd ?? proc.cwd(),
|
|
92
|
+
stdin: proc.stdin,
|
|
93
|
+
stdout: proc.stdout,
|
|
94
|
+
color: isColorEnabled(proc.stdout, env),
|
|
95
|
+
getSize: deps.getSize,
|
|
96
|
+
startPane: 'files',
|
|
97
|
+
newReview: args.newReview,
|
|
98
|
+
audit: true,
|
|
99
|
+
...extra,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const startSession = (options) => {
|
|
103
|
+
const session = new Session(options);
|
|
106
104
|
session.load();
|
|
107
105
|
return session;
|
|
108
106
|
};
|
|
109
107
|
|
|
108
|
+
const openLocalSession = (proc, deps, args, selected, env) => {
|
|
109
|
+
const cwd = deps.cwd ?? proc.cwd();
|
|
110
|
+
const repo = deps.repo ?? createGitRepo();
|
|
111
|
+
const statSync = deps.statSync ?? fs.statSync;
|
|
112
|
+
const scope = resolveScope(cwd, selected.paths, repo, statSync);
|
|
113
|
+
return startSession(
|
|
114
|
+
sessionOptions(proc, deps, args, env, {
|
|
115
|
+
repo,
|
|
116
|
+
paths: scope.paths,
|
|
117
|
+
rev: scope.rev,
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
110
122
|
const openPullRequestSession = async (proc, deps, args, selected, env) => {
|
|
111
|
-
const stdout = proc.stdout;
|
|
112
123
|
const cwd = deps.cwd ?? proc.cwd();
|
|
113
124
|
const loader = deps.loadPullRequest ?? loadPullRequest;
|
|
114
125
|
const token = githubToken(env);
|
|
@@ -117,27 +128,19 @@ const openPullRequestSession = async (proc, deps, args, selected, env) => {
|
|
|
117
128
|
paths: selected.paths,
|
|
118
129
|
token,
|
|
119
130
|
fetch: deps.fetch,
|
|
120
|
-
env,
|
|
121
131
|
});
|
|
122
132
|
const change = loaded.change ?? null;
|
|
123
133
|
const repository = change ? change.repository : '';
|
|
124
134
|
const repo = deps.repo ?? createLoadedSource(loaded);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
newReview: args.newReview,
|
|
135
|
-
repoName: repository,
|
|
136
|
-
sourceLabel: loaded.sourceLabel,
|
|
137
|
-
change,
|
|
138
|
-
});
|
|
139
|
-
session.load();
|
|
140
|
-
return session;
|
|
135
|
+
return startSession(
|
|
136
|
+
sessionOptions(proc, deps, args, env, {
|
|
137
|
+
repo,
|
|
138
|
+
paths: selected.paths,
|
|
139
|
+
repoName: repository,
|
|
140
|
+
sourceLabel: loaded.sourceLabel,
|
|
141
|
+
change,
|
|
142
|
+
}),
|
|
143
|
+
);
|
|
141
144
|
};
|
|
142
145
|
|
|
143
146
|
const loadSession = async (proc, deps, args) => {
|
|
@@ -146,7 +149,7 @@ const loadSession = async (proc, deps, args) => {
|
|
|
146
149
|
if (selected.kind === 'github-pr') {
|
|
147
150
|
return openPullRequestSession(proc, deps, args, selected, env);
|
|
148
151
|
}
|
|
149
|
-
return openLocalSession(proc, deps, args, env);
|
|
152
|
+
return openLocalSession(proc, deps, args, selected, env);
|
|
150
153
|
};
|
|
151
154
|
|
|
152
155
|
const run = async (proc, deps = {}) => {
|
|
@@ -176,10 +179,8 @@ const run = async (proc, deps = {}) => {
|
|
|
176
179
|
};
|
|
177
180
|
|
|
178
181
|
module.exports = {
|
|
179
|
-
|
|
182
|
+
failLine,
|
|
180
183
|
parseArgv,
|
|
181
184
|
resolveScope,
|
|
182
|
-
|
|
183
|
-
selectChangeSource,
|
|
184
|
-
errorMessage,
|
|
185
|
+
run,
|
|
185
186
|
};
|
package/lib/clipboard.js
CHANGED