reslop 0.1.6 → 0.1.8

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/README.md +33 -19
  3. package/bin/reslop.js +3 -1
  4. package/lib/ansi.js +1 -0
  5. package/lib/capabilities.js +106 -0
  6. package/lib/cli.js +18 -14
  7. package/lib/deps/changes.js +331 -0
  8. package/lib/deps/items.js +131 -0
  9. package/lib/deps/manifest.js +145 -0
  10. package/lib/deps/merge.js +120 -0
  11. package/lib/deps/proposals.js +164 -0
  12. package/lib/deps/reports.js +180 -0
  13. package/lib/deps/rows.js +177 -0
  14. package/lib/deps/scan.js +138 -0
  15. package/lib/deps/usage.js +68 -0
  16. package/lib/deps/versions.js +119 -0
  17. package/lib/deps.js +65 -1348
  18. package/lib/diff/align.js +226 -0
  19. package/lib/diff/display.js +101 -0
  20. package/lib/diff/edit.js +47 -0
  21. package/lib/diff/inline.js +300 -0
  22. package/lib/diff/items.js +101 -0
  23. package/lib/diff/parse.js +156 -0
  24. package/lib/diff/patch.js +103 -0
  25. package/lib/diff.js +13 -932
  26. package/lib/editor.js +37 -0
  27. package/lib/files.js +121 -7
  28. package/lib/git/branches.js +291 -0
  29. package/lib/git/changes.js +164 -0
  30. package/lib/git/dependencies.js +489 -0
  31. package/lib/git/proc.js +162 -0
  32. package/lib/git/read.js +253 -0
  33. package/lib/git/run.js +100 -0
  34. package/lib/git.js +82 -1152
  35. package/lib/github.js +92 -222
  36. package/lib/gitlab.js +72 -216
  37. package/lib/highlight/bash.js +5 -9
  38. package/lib/highlight/core.js +1 -1
  39. package/lib/highlight/css.js +1 -3
  40. package/lib/highlight/csv.js +1 -3
  41. package/lib/highlight/dart.js +6 -20
  42. package/lib/highlight/dot.js +13 -13
  43. package/lib/highlight/html.js +1 -5
  44. package/lib/highlight/js.js +151 -115
  45. package/lib/highlight/json.js +1 -3
  46. package/lib/highlight/log.js +1 -3
  47. package/lib/highlight/txt.js +5 -10
  48. package/lib/highlight.js +4 -4
  49. package/lib/keys.js +63 -142
  50. package/lib/npm/commands.js +100 -0
  51. package/lib/remote/changes.js +37 -0
  52. package/lib/remote/headers.js +36 -0
  53. package/lib/remote/http.js +122 -0
  54. package/lib/remote/notes.js +94 -0
  55. package/lib/render/branches.js +218 -0
  56. package/lib/render/chrome.js +575 -0
  57. package/lib/render/diff.js +307 -0
  58. package/lib/render/files.js +166 -0
  59. package/lib/render/frame.js +197 -0
  60. package/lib/render/notes.js +201 -0
  61. package/lib/render/present.js +25 -0
  62. package/lib/render/primitives.js +200 -0
  63. package/lib/render.js +14 -1565
  64. package/lib/review/format.js +434 -0
  65. package/lib/review/storage.js +150 -0
  66. package/lib/review/store.js +178 -0
  67. package/lib/review/templates.js +49 -0
  68. package/lib/review.js +14 -804
  69. package/lib/select.js +3 -5
  70. package/lib/session/accessors.js +25 -0
  71. package/lib/session/actions.js +275 -0
  72. package/lib/session/branches.js +304 -0
  73. package/lib/session/change-actions.js +320 -0
  74. package/lib/session/commit.js +124 -0
  75. package/lib/session/compose.js +540 -0
  76. package/lib/session/dispatch.js +105 -0
  77. package/lib/session/files-pane.js +234 -0
  78. package/lib/session/items.js +177 -0
  79. package/lib/session/lifecycle.js +476 -0
  80. package/lib/session/load.js +85 -0
  81. package/lib/session/navigation.js +93 -0
  82. package/lib/session/ops.js +110 -0
  83. package/lib/session/origins.js +7 -0
  84. package/lib/session/pointer.js +154 -0
  85. package/lib/session/progress.js +29 -0
  86. package/lib/session/review.js +88 -0
  87. package/lib/session/templates.js +64 -0
  88. package/lib/session/terminal.js +169 -0
  89. package/lib/session/todos.js +269 -0
  90. package/lib/session/update.js +125 -0
  91. package/lib/session/view.js +129 -0
  92. package/lib/session/watch.js +219 -0
  93. package/lib/session.js +579 -2213
  94. package/lib/source.js +11 -11
  95. package/lib/sys.js +25 -4
  96. package/lib/wrap.js +4 -2
  97. package/package.json +2 -2
package/lib/source.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const { parseGithubPrUrl } = require('./github.js');
4
4
  const { parseGitlabMrUrl } = require('./gitlab.js');
5
+ const { capabilitiesFor, attachCapabilities } = require('./capabilities.js');
5
6
 
6
7
  const selectChangeSource = (paths) => {
7
8
  if (!paths.length) return { kind: 'local', paths };
@@ -13,19 +14,18 @@ const selectChangeSource = (paths) => {
13
14
  return { kind: 'local', paths };
14
15
  };
15
16
 
16
- const nop = () => {};
17
-
18
- const createLoadedSource = (loaded) => ({
19
- load: () => {
17
+ const createLoadedSource = (loaded, kind = 'github-pr', extra = {}) => {
18
+ const load = () => {
20
19
  const items = loaded.items ?? [];
21
20
  return { ...loaded, items: [...items] };
22
- },
23
- add: nop,
24
- unstage: nop,
25
- revert: nop,
26
- revertFile: nop,
27
- resolveRev: () => null,
28
- });
21
+ };
22
+ const impl = {
23
+ load,
24
+ resolveRev: () => null,
25
+ };
26
+ if (extra.loadAsync) impl.loadAsync = extra.loadAsync;
27
+ return attachCapabilities(impl, capabilitiesFor(kind));
28
+ };
29
29
 
30
30
  module.exports = {
31
31
  selectChangeSource,
package/lib/sys.js CHANGED
@@ -25,15 +25,35 @@ const clipTools = (platform = process.platform) => {
25
25
  return UNIX_CLIP;
26
26
  };
27
27
 
28
+ const listen = (emitter, event, handler) => {
29
+ if (!emitter || typeof emitter.on !== 'function') return () => {};
30
+ emitter.on(event, handler);
31
+ return () => {
32
+ if (typeof emitter.removeListener === 'function') {
33
+ emitter.removeListener(event, handler);
34
+ return;
35
+ }
36
+ if (typeof emitter.off === 'function') emitter.off(event, handler);
37
+ };
38
+ };
39
+
28
40
  const watchResize = (stdout, proc, onResize, signal) => {
29
- if (stdout && typeof stdout.on === 'function') {
30
- stdout.on('resize', onResize, { signal });
31
- }
41
+ const stopStdout = listen(stdout, 'resize', onResize);
42
+ let stopProc = () => {};
32
43
  try {
33
- proc.on('SIGWINCH', onResize, { signal });
44
+ stopProc = listen(proc, 'SIGWINCH', onResize);
34
45
  } catch {
35
46
  // SIGWINCH is not available on Windows
36
47
  }
48
+ const stop = () => {
49
+ stopStdout();
50
+ stopProc();
51
+ };
52
+ if (signal) {
53
+ if (signal.aborted) stop();
54
+ else signal.addEventListener('abort', stop, { once: true });
55
+ }
56
+ return stop;
37
57
  };
38
58
 
39
59
  const canonPath = (value) => {
@@ -58,6 +78,7 @@ module.exports = {
58
78
  spawnBase,
59
79
  npmOpts,
60
80
  clipTools,
81
+ listen,
61
82
  watchResize,
62
83
  samePath,
63
84
  };
package/lib/wrap.js CHANGED
@@ -100,9 +100,11 @@ const indexAtWrapCol = (row, col, limit) => {
100
100
  const wrapMove = (text, cursor, width, delta, wantCol) => {
101
101
  const rows = wrapDoc(text, width);
102
102
  const pos = cursorInWrap(text, cursor, width);
103
- const next = pos.row + delta;
103
+ let next = pos.row + delta;
104
+ if (next < 0) next = 0;
105
+ if (next >= rows.length) next = rows.length - 1;
104
106
  const col = wantCol ?? pos.col;
105
- if (next < 0 || next >= rows.length) return { cursor, col };
107
+ if (next === pos.row) return { cursor, col };
106
108
  const row = rows[next];
107
109
  let limit = text.length + 1;
108
110
  if (next + 1 < rows.length) limit = rows[next + 1].start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reslop",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Interactive code review and repair planning for AI-assisted changes",
5
5
  "keywords": [
6
6
  "code-review",
@@ -59,7 +59,7 @@
59
59
  "eslint": "^9.39.4",
60
60
  "eslint-config-metarhia": "^9.1.9",
61
61
  "metaskills": "^1.0.5",
62
- "prettier": "^3.8.4"
62
+ "prettier": "^3.9.7"
63
63
  },
64
64
  "dependencies": {
65
65
  "metautil": "^5.5.2"