reslop 0.1.2 → 0.1.4
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 +18 -1
- package/README.md +38 -36
- package/lib/api.js +3 -0
- package/lib/cli.js +53 -16
- package/lib/clipboard.js +11 -11
- package/lib/detect.js +2 -0
- package/lib/files.js +36 -12
- package/lib/git.js +335 -65
- package/lib/gitlab.js +520 -0
- package/lib/highlight.js +160 -5
- package/lib/keys.js +8 -2
- package/lib/render.js +87 -30
- package/lib/session.js +227 -44
- package/lib/source.js +5 -2
- package/lib/sys.js +59 -0
- package/package.json +2 -2
package/lib/sys.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const IS_WIN = process.platform === 'win32';
|
|
7
|
+
|
|
8
|
+
const UNIX_CLIP = [
|
|
9
|
+
{ cmd: 'wl-copy', args: [] },
|
|
10
|
+
{ cmd: 'xclip', args: ['-selection', 'clipboard'] },
|
|
11
|
+
{ cmd: 'xsel', args: ['--clipboard', '--input'] },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const npmBin = (platform = process.platform) =>
|
|
15
|
+
platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
16
|
+
|
|
17
|
+
const spawnBase = (extra = {}) => ({ windowsHide: true, ...extra });
|
|
18
|
+
|
|
19
|
+
const clipTools = (platform = process.platform) => {
|
|
20
|
+
if (platform === 'win32') return [{ cmd: 'clip', args: [] }];
|
|
21
|
+
if (platform === 'darwin') return [{ cmd: 'pbcopy', args: [] }];
|
|
22
|
+
return UNIX_CLIP;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const watchResize = (stdout, proc, onResize, signal) => {
|
|
26
|
+
if (stdout && typeof stdout.on === 'function') {
|
|
27
|
+
stdout.on('resize', onResize, { signal });
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
proc.on('SIGWINCH', onResize, { signal });
|
|
31
|
+
} catch {
|
|
32
|
+
// SIGWINCH is not available on Windows
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const canonPath = (value) => {
|
|
37
|
+
try {
|
|
38
|
+
return fs.realpathSync.native(value);
|
|
39
|
+
} catch {
|
|
40
|
+
return path.resolve(value);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const samePath = (left, right) => {
|
|
45
|
+
if (left === right) return true;
|
|
46
|
+
const a = canonPath(left);
|
|
47
|
+
const b = canonPath(right);
|
|
48
|
+
if (a === b) return true;
|
|
49
|
+
return IS_WIN && a.toLowerCase() === b.toLowerCase();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
IS_WIN,
|
|
54
|
+
npmBin,
|
|
55
|
+
spawnBase,
|
|
56
|
+
clipTools,
|
|
57
|
+
watchResize,
|
|
58
|
+
samePath,
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reslop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Interactive code review and repair planning for AI-assisted changes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-review",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"disable": "node scripts/disable.js",
|
|
54
54
|
"lint": "eslint . && prettier -c \"**/*.js\" \"**/*.json\" \"**/*.md\"",
|
|
55
55
|
"fix": "eslint . --fix && prettier --write \"**/*.js\" \"**/*.json\" \"**/*.md\"",
|
|
56
|
-
"test": "npm run -s lint && node --test
|
|
56
|
+
"test": "npm run -s lint && node --test"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"eslint": "^9.39.4",
|