@in-the-loop-labs/pair-review 5.3.4 → 5.3.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.
Files changed (49) hide show
  1. package/README.md +7 -1
  2. package/bin/git-diff-lines +2 -1
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json +1 -1
  5. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  6. package/plugin-code-critic/skills/analyze/scripts/git-diff-lines +104 -25
  7. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  8. package/public/css/pr.css +162 -46
  9. package/public/css/styles.css +0 -12
  10. package/public/js/components/AIPanel.js +3 -2
  11. package/public/js/components/AnalysisConfigModal.js +4 -1
  12. package/public/js/components/ChatPanel.js +15 -8
  13. package/public/js/components/PanelGroup.js +115 -21
  14. package/public/js/components/SuggestionNavigator.js +16 -3
  15. package/public/js/local.js +7 -12
  16. package/public/js/modules/diff-renderer.js +13 -0
  17. package/public/js/modules/file-comment-manager.js +19 -10
  18. package/public/js/modules/hunk-parser.js +39 -2
  19. package/public/js/modules/panel-resizer.js +41 -3
  20. package/public/js/modules/pierre-bridge.js +11 -2
  21. package/public/js/modules/suggestion-manager.js +128 -33
  22. package/public/js/pr.js +132 -29
  23. package/public/js/repo-settings.js +35 -19
  24. package/public/js/utils/git-paths.js +140 -0
  25. package/public/js/utils/smart-truncate.js +88 -0
  26. package/public/local.html +6 -0
  27. package/public/pr.html +6 -0
  28. package/src/ai/analyzer.js +15 -13
  29. package/src/ai/antigravity-provider.js +44 -24
  30. package/src/ai/cursor-agent-provider.js +4 -4
  31. package/src/ai/muse-provider.js +68 -3
  32. package/src/ai/summary-generator.js +8 -5
  33. package/src/git/diff-flags.js +26 -12
  34. package/src/git/worktree.js +21 -43
  35. package/src/github/client.js +0 -88
  36. package/src/github/impl/graphql/pending-review-comments.js +5 -1
  37. package/src/github/submit-pr-context.js +56 -0
  38. package/src/local-review.js +34 -17
  39. package/src/main.js +80 -106
  40. package/src/routes/executable-analysis.js +14 -15
  41. package/src/routes/local.js +3 -5
  42. package/src/routes/pr.js +18 -105
  43. package/src/setup/pr-setup.js +1 -1
  44. package/src/setup/stack-setup.js +1 -1
  45. package/src/utils/diff-annotator.js +175 -25
  46. package/src/utils/diff-file-content.js +4 -26
  47. package/src/utils/diff-file-list.js +178 -42
  48. package/src/utils/git-paths.js +77 -0
  49. package/src/utils/paths.js +1 -25
@@ -0,0 +1,77 @@
1
+ // Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Git path spelling helpers for the server.
4
+ *
5
+ * Every git command that prints paths runs with core.quotePath=false (see
6
+ * GIT_PATH_CONFIG in src/git/diff-flags.js), and path lists are read with -z,
7
+ * so names arrive verbatim. What is left to decode is the diff text itself:
8
+ * git still C-quotes a header path containing a control character, `"` or
9
+ * `\`, and diffs cached by older versions quote non-ASCII names too.
10
+ *
11
+ * The decoder is shared with the browser (public/js/utils/git-paths.js) so
12
+ * both sides spell every path the same way.
13
+ */
14
+ const { decodeGitPath, parseDiffGitPaths, parsePatchPaths } = require('../../public/js/utils/git-paths');
15
+
16
+ const QUOTE_ESCAPES = { 0x07: 'a', 0x08: 'b', 0x09: 't', 0x0a: 'n', 0x0b: 'v', 0x0c: 'f', 0x0d: 'r', 0x22: '"', 0x5c: '\\' };
17
+
18
+ /**
19
+ * Quote a path the way git does with core.quotePath=false, so a header we
20
+ * synthesize is spelled like one git would print. Only control characters,
21
+ * DEL, `"` and `\` force quoting; non-ASCII stays verbatim. Paths that need no
22
+ * quoting are returned unchanged.
23
+ * @param {string} value - Real path (may include an `a/` or `b/` prefix)
24
+ * @returns {string} Git-spelled path
25
+ */
26
+ function quoteGitPath(value) {
27
+ let needsQuote = false;
28
+ let out = '';
29
+ for (const char of value) {
30
+ const code = char.codePointAt(0);
31
+ if (QUOTE_ESCAPES[code] !== undefined) {
32
+ out += `\\${QUOTE_ESCAPES[code]}`;
33
+ needsQuote = true;
34
+ } else if (code < 0x20 || code === 0x7f) {
35
+ out += `\\${code.toString(8).padStart(3, '0')}`;
36
+ needsQuote = true;
37
+ } else {
38
+ out += char;
39
+ }
40
+ }
41
+ return needsQuote ? `"${out}"` : value;
42
+ }
43
+
44
+ /**
45
+ * Decode the path in a `--- ` / `+++ ` file line or a `rename from` /
46
+ * `rename to` extended header. Git ends a `---`/`+++` path that contains a
47
+ * space with a tab; a tab inside a real name is always C-quoted, so one
48
+ * trailing raw tab is never part of the path.
49
+ * @param {string} value - Text after `--- `, `+++ `, `rename from ` or `rename to `
50
+ * @param {string} [prefix] - Prefix to strip from the decoded path (`a/` or `b/`)
51
+ * @returns {string|null} Decoded path, or null for `/dev/null`
52
+ */
53
+ function decodeDiffLinePath(value, prefix = '') {
54
+ const raw = value.endsWith('\t') ? value.slice(0, -1) : value;
55
+ if (raw === '/dev/null') return null;
56
+ const decoded = decodeGitPath(raw);
57
+ return prefix && decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded;
58
+ }
59
+
60
+ /**
61
+ * Split NUL-terminated git output (`--name-only -z`, `ls-files -z`) into
62
+ * paths. Paths are verbatim: no trimming, no unquoting.
63
+ * @param {string} stdout - Raw command output
64
+ * @returns {string[]} Non-empty paths
65
+ */
66
+ function splitNulPaths(stdout) {
67
+ return (stdout || '').split('\0').filter(path => path.length > 0);
68
+ }
69
+
70
+ module.exports = {
71
+ decodeGitPath,
72
+ parseDiffGitPaths,
73
+ parsePatchPaths,
74
+ quoteGitPath,
75
+ decodeDiffLinePath,
76
+ splitNulPaths
77
+ };
@@ -179,35 +179,11 @@ function resolveRenamedFile(fileName) {
179
179
  return fileName.replace(/\{[^}]*\s*=>\s*([^}]*)\}/, '$1').replace(/\/+/g, '/').replace(/^\//, '');
180
180
  }
181
181
 
182
- /**
183
- * Resolve git rename syntax to extract the OLD filename.
184
- *
185
- * Git represents renames with curly-brace syntax:
186
- * "tests/{old.js => new.js}" → "tests/old.js"
187
- * "{old-dir => new-dir}/file.js" → "old-dir/file.js"
188
- * "a/{b => c}/d.js" → "a/b/d.js"
189
- *
190
- * @param {string} fileName - File name possibly containing rename syntax
191
- * @returns {string} Resolved file name with the old path, or original if no rename syntax
192
- *
193
- * @example
194
- * resolveRenamedFileOld('tests/{old.js => new.js}') // => 'tests/old.js'
195
- * resolveRenamedFileOld('{old-dir => new-dir}/file.js') // => 'old-dir/file.js'
196
- * resolveRenamedFileOld('a/{b => c}/d.js') // => 'a/b/d.js'
197
- * resolveRenamedFileOld('src/foo.js') // => 'src/foo.js'
198
- * resolveRenamedFileOld(null) // => null
199
- */
200
- function resolveRenamedFileOld(fileName) {
201
- if (!fileName) return fileName;
202
- return fileName.replace(/\{([^}]*?)\s*=>\s*[^}]*\}/, '$1').replace(/\/+/g, '/').replace(/^\//, '');
203
- }
204
-
205
182
  module.exports = {
206
183
  normalizePath,
207
184
  pathsEqual,
208
185
  pathExistsInList,
209
186
  pathExistsInSet,
210
187
  normalizeRepository,
211
- resolveRenamedFile,
212
- resolveRenamedFileOld
188
+ resolveRenamedFile
213
189
  };