@in-the-loop-labs/pair-review 5.1.0 → 5.2.0
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/README.md +14 -4
- package/package.json +3 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/plugin-pair-loop/skills/loop/SKILL.md +21 -6
- package/public/css/pr.css +2 -2
- package/public/index.html +5 -2
- package/public/js/index.js +106 -9
- package/src/ai/analyzer.js +191 -27
- package/src/ai/index.js +1 -0
- package/src/ai/omp/review-config.yml +13 -0
- package/src/ai/omp-provider.js +279 -0
- package/src/ai/pi-format.js +535 -0
- package/src/ai/pi-provider.js +38 -963
- package/src/ai/pi-style-provider.js +526 -0
- package/src/ai/provider.js +2 -0
- package/src/chat/chat-providers.js +34 -11
- package/src/chat/omp-bridge.js +111 -0
- package/src/chat/pi-bridge.js +42 -34
- package/src/chat/session-manager.js +30 -4
- package/src/config.js +32 -3
- package/src/links/host-names.js +200 -0
- package/src/local-review.js +7 -3
- package/src/main.js +21 -1
- package/src/review-config.js +81 -5
- package/src/routes/analyses.js +6 -2
- package/src/routes/config.js +16 -0
- package/src/routes/local.js +7 -6
- package/src/routes/mcp.js +5 -2
- package/src/routes/pr.js +8 -5
- package/src/routes/setup.js +1 -1
- package/src/routes/shared.js +27 -0
- package/src/routes/stack-analysis.js +4 -1
- package/src/settings/registry.js +1 -1
- package/src/setup/local-setup.js +5 -3
- package/src/single-port.js +1 -1
- package/src/utils/json-extractor.js +162 -41
- package/src/utils/local-path-input.js +64 -8
package/README.md
CHANGED
|
@@ -516,7 +516,7 @@ For advanced configuration with custom providers and models, see [AI Provider Co
|
|
|
516
516
|
|-----|---------|-------------|
|
|
517
517
|
| `external_comments` | `false` | Opt-in: set to `true` to fetch and display GitHub PR review comments inline. Enables the **External** segment, the refresh button, and `/api/reviews/*/external-comments*` routes. |
|
|
518
518
|
| `enable_chat` | `true` | Enables the chat panel feature (uses `chat_provider`). |
|
|
519
|
-
| `enable_graphite` | `false` | Show Graphite links alongside GitHub links. |
|
|
519
|
+
| `enable_graphite` | `false` | Show Graphite links alongside GitHub links, and name Graphite in the PR URL prompts and errors. Graphite PR URLs are accepted either way. |
|
|
520
520
|
| `skip_update_notifier` | `false` | Suppress the "update available" notification on exit. |
|
|
521
521
|
|
|
522
522
|
### Configuration Files
|
|
@@ -578,6 +578,7 @@ pair-review supports several environment variables for customizing behavior:
|
|
|
578
578
|
| `PAIR_REVIEW_OPENCODE_CMD` | Custom command to invoke OpenCode CLI | `opencode` |
|
|
579
579
|
| `PAIR_REVIEW_CURSOR_AGENT_CMD` | Custom command to invoke Cursor Agent CLI | `agent` |
|
|
580
580
|
| `PAIR_REVIEW_PI_CMD` | Custom command to invoke Pi CLI | `pi` |
|
|
581
|
+
| `PAIR_REVIEW_OMP_CMD` | Custom command to invoke OMP (Oh My Pi) CLI | `omp` |
|
|
581
582
|
| `PAIR_REVIEW_MUSE_CMD` | Custom command to invoke Muse Code CLI | `muse` |
|
|
582
583
|
|
|
583
584
|
**Note:** `GITHUB_TOKEN` is the standard environment variable used by many GitHub tools (gh CLI, GitHub Actions, etc.). When set, it takes precedence over the `github_token` field in the config file.
|
|
@@ -636,13 +637,14 @@ pair-review integrates with AI providers via their CLI tools:
|
|
|
636
637
|
- **OpenCode**: Uses OpenCode CLI (requires model configuration)
|
|
637
638
|
- **Cursor**: Uses Cursor Agent CLI (streaming output with sandbox mode)
|
|
638
639
|
- **Pi**: Uses Pi coding agent CLI (requires model configuration)
|
|
640
|
+
- **OMP**: Uses the [Oh My Pi](https://github.com/can1357/oh-my-pi) CLI (`omp`), a fork of the Pi coding agent. Install it with `npm install -g @oh-my-pi/pi-coding-agent`. Works out of the box: the built-in `default` mode uses whatever model your OMP configuration selects, and you can add specific models via `providers.omp.models` (run `omp models` to list the catalog). OMP's advisor runtime — which passively reviews each turn and injects notes — is disabled during reviews by default for deterministic, lower-cost analysis; set `"advisor": true` in `providers.omp` to opt back in.
|
|
639
641
|
- **Muse**: Uses Meta's Muse Code CLI (`muse`), a terminal coding agent released in beta in August 2026 and powered by the Muse Spark 1.2 model. Install it with the single shell command from Meta's Muse Code install instructions (macOS/Linux), then authenticate once with `muse login` (credentials are stored in `~/.config/muse/auth.json`). pair-review drives it headlessly via `muse exec --json`. Within pair-review, Muse is analysis-only: the CLI exposes no ACP server mode, so there is no Muse chat provider.
|
|
640
642
|
|
|
641
643
|
You can select your preferred provider and model in the repository settings UI.
|
|
642
644
|
|
|
643
645
|
#### Built-in vs. Configurable Providers
|
|
644
646
|
|
|
645
|
-
Most providers (Claude, Antigravity, Codex, Copilot, Muse) come with built-in model definitions. **OpenCode and Pi are different** - they have no built-in models and require you to configure which models to use.
|
|
647
|
+
Most providers (Claude, Antigravity, Codex, Copilot, Muse) come with built-in model definitions. **OpenCode and Pi are different** - they have no built-in models and require you to configure which models to use. **OMP** sits in between: it ships a single `default` mode that delegates to your OMP configuration (`~/.omp/agent/config.yml`), so it works without any pair-review model configuration, and you can add specific models via `providers.omp.models`. OMP model `id`s are passed to `omp --model` verbatim, which fuzzy-matches (`"opus"`, `"gpt-5.2"`) and accepts full `provider/model` strings (`"anthropic/claude-opus-5"`).
|
|
646
648
|
|
|
647
649
|
##### Muse models and the contributor tradeoff
|
|
648
650
|
|
|
@@ -718,7 +720,8 @@ You can override provider settings and define custom models in your config file.
|
|
|
718
720
|
| `env` | Environment variables to set when running the CLI |
|
|
719
721
|
| `installInstructions` | Custom installation instructions shown in UI |
|
|
720
722
|
| `availability_timeout_seconds` | Seconds to allow for the startup availability probe before the provider is reported unavailable (default `10`). Raise it for providers whose check runs a slow build/compile step. Also supported per chat provider under `chat_providers.<id>`. |
|
|
721
|
-
| `availability_command` | Command run to decide availability. Executable providers default to always-available when omitted; chat providers fall back to `<command> --version` (or, for the built-in Pi, the cached AI-provider status). Pair with `availability_timeout_seconds` when the probe runs a slow build. |
|
|
723
|
+
| `availability_command` | Command run to decide availability. Executable providers default to always-available when omitted; chat providers fall back to `<command> --version` (or, for the built-in Pi and OMP, the cached AI-provider status). Pair with `availability_timeout_seconds` when the probe runs a slow build. |
|
|
724
|
+
| `advisor` | OMP only. Set to `true` to enable OMP's advisor runtime during analysis (`--advisor`). Defaults to `false`: pair-review disables the advisor via a bundled config overlay, even when it is enabled in your global OMP configuration. |
|
|
722
725
|
| `models` | Array of model definitions (see below) |
|
|
723
726
|
| `default_model` | Model `id` to use as the provider's default (in the picker and when no model is specified). Preferred over the per-model `default: true` flag. If it names an unknown or disabled model, the provider falls back to automatic selection. |
|
|
724
727
|
| `disabled_models` | Array of model selectors to hide, matched by model `id` or alias. Disabled models disappear from the model picker for that provider. Works on built-in models too, so you can remove a built-in option without redefining the rest. A list that would hide *every* model is ignored. |
|
|
@@ -831,6 +834,8 @@ npm install -g @mariozechner/pi-coding-agent
|
|
|
831
834
|
|
|
832
835
|
Configure your preferred models in `providers.pi.models` — see [AI Provider Configuration](#ai-provider-configuration) for details. Everything else in pair-review works without Pi installed.
|
|
833
836
|
|
|
837
|
+
[OMP (Oh My Pi)](https://github.com/can1357/oh-my-pi), a fork of Pi, is also available as a chat provider (`omp`) — it speaks the same RPC protocol through the `omp` CLI (`npm install -g @oh-my-pi/pi-coding-agent`) and uses whatever model your OMP configuration selects (set a chat model via `chat_providers.omp.model`; values are passed to `omp --model`, which fuzzy-matches). Unlike Pi chat, OMP chat does not load pair-review's task extension for subagent delegation.
|
|
838
|
+
|
|
834
839
|
**Chat provider command overrides:** To customize CLI commands for chat providers (e.g., to use a wrapper script), use the `chat_providers` config key:
|
|
835
840
|
|
|
836
841
|
```json
|
|
@@ -843,7 +848,7 @@ Configure your preferred models in `providers.pi.models` — see [AI Provider Co
|
|
|
843
848
|
}
|
|
844
849
|
```
|
|
845
850
|
|
|
846
|
-
Available chat provider IDs: `pi`, `claude`, `codex`, `copilot-acp`, `opencode-acp`, `cursor-acp`. Each supports `command`, `args` (replaces defaults), `extra_args` (appends), and `env` overrides. Codex chat also supports `sandbox`: use `workspace-write` by default, or `read-only` for discussion-only sessions. (Antigravity and Muse are analysis-only providers — neither CLI has an ACP mode, so there are no Antigravity or Muse chat providers.)
|
|
851
|
+
Available chat provider IDs: `pi`, `omp`, `claude`, `codex`, `copilot-acp`, `opencode-acp`, `cursor-acp`. Each supports `command`, `args` (replaces defaults; for `pi` and `omp` there are no default args — supplied args are appended after the generated RPC flags, so use a multi-word `command` like `"devx omp"` for wrappers rather than `args`), `extra_args` (appends), and `env` overrides. Codex chat also supports `sandbox`: use `workspace-write` by default, or `read-only` for discussion-only sessions. (Antigravity and Muse are analysis-only providers — neither CLI has an ACP mode, so there are no Antigravity or Muse chat providers.)
|
|
847
852
|
|
|
848
853
|
**Keyboard shortcut:** Press `p` then `c` to toggle the chat panel.
|
|
849
854
|
|
|
@@ -988,6 +993,8 @@ An implement→review→fix loop with pair-review as the review oracle. The agen
|
|
|
988
993
|
|-------|-------------|
|
|
989
994
|
| `/pair-loop:loop` | Implement, review with pair-review councils, triage, fix, and repeat until clean |
|
|
990
995
|
|
|
996
|
+
**Run the loop in your agent's main session — do not delegate it to a subagent.** Each council round is a 15–40 minute external process owned by the session that started it, so a subagent's exit kills the round mid-flight and the work is discarded. Delegating the implementation or fix work *within* a round is fine; delegating the loop itself is not.
|
|
997
|
+
|
|
991
998
|
### code-critic — Standalone Analysis
|
|
992
999
|
|
|
993
1000
|
AI-powered code review analysis that works without any server or MCP dependency. Install this plugin for three-level AI analysis directly in your coding agent.
|
|
@@ -1203,6 +1210,9 @@ A: OpenCode has no built-in models, so you must configure them in your `~/.pair-
|
|
|
1203
1210
|
**Q: How do I use Pi as my AI provider?**
|
|
1204
1211
|
A: Like OpenCode, Pi has no built-in models. Configure them in your `~/.pair-review/config.json` by adding a `providers.pi.models` array with at least one model definition. Pi supports many providers (Google, Anthropic, OpenAI, etc.) via its `--provider` and `--model` flags. See the [AI Provider Configuration](#ai-provider-configuration) section and `config.example.json` for examples.
|
|
1205
1212
|
|
|
1213
|
+
**Q: How do I use OMP (Oh My Pi) as my AI provider?**
|
|
1214
|
+
A: OMP works out of the box: the built-in `default` mode uses whatever model your OMP configuration (`~/.omp/agent/config.yml`) selects. To pin specific models, add a `providers.omp.models` array — each model's `cli_model` is passed to `omp --model` verbatim, which fuzzy-matches and accepts `provider/model` strings (run `omp models` to list the catalog). During reviews pair-review disables OMP's advisor runtime by default (it injects notes into each turn, adding cost and nondeterminism); set `"advisor": true` under `providers.omp` to enable it.
|
|
1215
|
+
|
|
1206
1216
|
**Q: Why does chat use Pi instead of Claude or other providers?**
|
|
1207
1217
|
A: Pi provides persistent interactive sessions with a full agent — it can read files and run commands in the context of the codebase. Pi is model-agnostic and uses your existing provider subscriptions — no separate API keys needed.
|
|
1208
1218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@in-the-loop-labs/pair-review",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Your AI-powered code review partner - Close the feedback loop with AI coding agents",
|
|
5
5
|
"main": "src/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"copilot",
|
|
53
53
|
"codex",
|
|
54
54
|
"antigravity",
|
|
55
|
-
"muse"
|
|
55
|
+
"muse",
|
|
56
|
+
"oh-my-pi"
|
|
56
57
|
],
|
|
57
58
|
"author": "Tim Perkins",
|
|
58
59
|
"license": "Apache-2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-review",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-loop",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Agent-orchestrated review loop — implement, review with pair-review multi-model councils via the headless CLI, triage, fix, and repeat until a final review returns no blockers. MCP-independent.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
|
@@ -49,11 +49,19 @@ These are not judgment calls:
|
|
|
49
49
|
3. **Sequence strictly: fix → write triage back → then run the next round.**
|
|
50
50
|
4. **One review at a time.** Never run two reviews concurrently for the same
|
|
51
51
|
repo.
|
|
52
|
-
5. **
|
|
52
|
+
5. **Drive the loop from the session that owns it — never delegate a review
|
|
53
|
+
round to a subagent.** A round is a 15–40 minute external process, and a
|
|
54
|
+
background process is killed when the session that spawned it ends. A
|
|
55
|
+
subagent's session ends the moment it returns, so a round launched inside
|
|
56
|
+
one dies mid-flight and the run is lost. If you are reading this from
|
|
57
|
+
inside a subagent, do not start a round — hand the loop back to the main
|
|
58
|
+
session. (Subagents are still fine for work that *finishes inside the
|
|
59
|
+
agent*: implementing the objective, applying a batch of fixes.)
|
|
60
|
+
6. **Do not commit or push.** Leave changes in the working tree. New
|
|
53
61
|
(untracked) files are included automatically whenever the review scope ends
|
|
54
62
|
at `untracked` — which the default scope (`unstaged..untracked`) does — so
|
|
55
63
|
no `git add -N` (intent-to-add) is needed.
|
|
56
|
-
|
|
64
|
+
7. **Report failures faithfully.** A failed run (`"ok": false`, non-zero
|
|
57
65
|
exit) is reported as what it is — never papered over as "no findings".
|
|
58
66
|
|
|
59
67
|
## Phase: Setup
|
|
@@ -69,8 +77,10 @@ These are not judgment calls:
|
|
|
69
77
|
call. An unknown handle → show the available names and ask the user.
|
|
70
78
|
4. If an objective was given and the working tree has no relevant changes
|
|
71
79
|
yet, implement the objective first (directly or via a Task agent — your
|
|
72
|
-
call based on size
|
|
73
|
-
before
|
|
80
|
+
call based on size; delegation is safe here because the agent's work
|
|
81
|
+
finishes before it returns, unlike a review round — hard rule 5). Verify
|
|
82
|
+
with `git status --short` that changes exist before the first review
|
|
83
|
+
round; if none, tell the user and stop.
|
|
74
84
|
|
|
75
85
|
## Running a review round
|
|
76
86
|
|
|
@@ -94,6 +104,10 @@ pair-review --local --headless --json --council <handle> [--scope <range>] --ins
|
|
|
94
104
|
Run the command in the background (or with a timeout of at least 45
|
|
95
105
|
minutes) and wait for it to exit. Do not abandon or kill it early; do not
|
|
96
106
|
start a second review while one is running (hard rule 4).
|
|
107
|
+
- **Launch it from the loop's own session, not from a subagent.** The
|
|
108
|
+
background process belongs to the session that spawned it, so a round
|
|
109
|
+
started inside a subagent is killed the moment that agent returns — the
|
|
110
|
+
council work is thrown away and the JSON never arrives (hard rule 5).
|
|
97
111
|
- stdout is exactly one JSON document (logs go to stderr):
|
|
98
112
|
- success: `{"ok": true, "mode": "local", "run": {...}, "suggestions":
|
|
99
113
|
[...], "count": N}` — exit code 0. **Zero suggestions is still
|
|
@@ -141,8 +155,9 @@ fresh.
|
|
|
141
155
|
## Fix
|
|
142
156
|
|
|
143
157
|
Apply the fixes (directly or via a Task agent for large batches — your
|
|
144
|
-
call
|
|
145
|
-
|
|
158
|
+
call; delegation is safe here for the same reason as in Setup — the agent's
|
|
159
|
+
edits and test runs complete before it returns). Run the project's relevant
|
|
160
|
+
tests for the changed code. A fix that breaks tests is not a fix.
|
|
146
161
|
|
|
147
162
|
## Write triage back (optional, needs the server)
|
|
148
163
|
|
package/public/css/pr.css
CHANGED
|
@@ -5225,8 +5225,8 @@ div.external-comment-row {
|
|
|
5225
5225
|
border: 1px solid #d1d9e0;
|
|
5226
5226
|
border-radius: 6px;
|
|
5227
5227
|
resize: vertical;
|
|
5228
|
-
min-height:
|
|
5229
|
-
max-height:
|
|
5228
|
+
min-height: 90px;
|
|
5229
|
+
max-height: 60vh;
|
|
5230
5230
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
5231
5231
|
}
|
|
5232
5232
|
|
package/public/index.html
CHANGED
|
@@ -1394,11 +1394,14 @@
|
|
|
1394
1394
|
<div class="tab-pane active" id="pr-tab">
|
|
1395
1395
|
<div class="start-review-section">
|
|
1396
1396
|
<form class="start-review-form" id="start-review-form">
|
|
1397
|
+
<!-- The placeholder is host-neutral until /api/config
|
|
1398
|
+
resolves; index.js rewrites it to name the configured
|
|
1399
|
+
hosts (GitHub, Graphite when enabled, any alt hosts). -->
|
|
1397
1400
|
<input
|
|
1398
1401
|
type="text"
|
|
1399
1402
|
class="start-review-input"
|
|
1400
1403
|
id="pr-url-input"
|
|
1401
|
-
placeholder="Enter
|
|
1404
|
+
placeholder="Enter PR URL"
|
|
1402
1405
|
autocomplete="off"
|
|
1403
1406
|
spellcheck="false"
|
|
1404
1407
|
>
|
|
@@ -1532,7 +1535,7 @@
|
|
|
1532
1535
|
<pre><code class="cmd-example" data-args="123"></code></pre>
|
|
1533
1536
|
|
|
1534
1537
|
<h3>Review a PR by URL</h3>
|
|
1535
|
-
<p>From anywhere, using a full GitHub
|
|
1538
|
+
<p>From anywhere, using a full <span data-pr-host-list>GitHub</span> URL:</p>
|
|
1536
1539
|
<pre><code class="cmd-example" data-args="https://github.com/owner/repo/pull/123"></code></pre>
|
|
1537
1540
|
|
|
1538
1541
|
<h3>Review Local Changes</h3>
|
package/public/js/index.js
CHANGED
|
@@ -116,14 +116,94 @@
|
|
|
116
116
|
// (window.encodeBase64Utf8 / window.getRepoStorageKey), shared with pr.js so the
|
|
117
117
|
// per-repo keys this page writes stay byte-identical to those the PR page reads.
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
// Hosts named in URL copy, from /api/config's `pr_host_list`, which the
|
|
120
|
+
// SERVER formats (GitHub always; Graphite only when enable_graphite; each alt
|
|
121
|
+
// host's links.external.name). Taking the pre-joined string rather than the
|
|
122
|
+
// array keeps the Oxford-comma formatting in exactly one place —
|
|
123
|
+
// src/links/host-names.js — so this copy cannot drift from the
|
|
124
|
+
// identically-worded server-side errors.
|
|
125
|
+
//
|
|
126
|
+
// null until /api/config resolves. The copy then reads host-neutral rather
|
|
127
|
+
// than naming the built-ins, which would claim an alt host's URLs are
|
|
128
|
+
// unsupported when they are accepted (matching localReviewPathUrlError() in
|
|
129
|
+
// src/utils/local-path-input.js for its config-free callers).
|
|
130
|
+
let prHostList = null;
|
|
131
|
+
|
|
132
|
+
// Hostnames recognised as scheme-less PR URLs. Seeded with the built-ins and
|
|
133
|
+
// replaced from /api/config's `pr_url_hostnames`, which adds every
|
|
134
|
+
// configured alt host. Mirrors resolveUrlLikeHostnames() server-side.
|
|
135
|
+
let prUrlHostnames = ['github.com', 'app.graphite.dev', 'app.graphite.com'];
|
|
136
|
+
|
|
137
|
+
/** "GitHub " / "GitHub or Graphite " while the host list is known, else "". */
|
|
138
|
+
function prHostPrefix() {
|
|
139
|
+
return prHostList ? prHostList + ' ' : '';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function localReviewPathUrlError() {
|
|
143
|
+
return 'Local reviews require a filesystem path, not a URL. '
|
|
144
|
+
+ 'Pass ' + (prHostList ? prHostList + ' URLs' : 'PR URLs')
|
|
145
|
+
+ ' as PR review inputs instead.';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Adopt the server-formatted host list and refresh the copy that names it.
|
|
150
|
+
*
|
|
151
|
+
* Called once /api/config resolves. The static markup ships host-neutral
|
|
152
|
+
* ("Enter PR URL", "a GitHub URL") so nothing flashes a host list that the
|
|
153
|
+
* installation does not actually support.
|
|
154
|
+
*
|
|
155
|
+
* @param {Object} config - /api/config payload
|
|
156
|
+
*/
|
|
157
|
+
function applyPrHostList(config) {
|
|
158
|
+
if (!config) return;
|
|
159
|
+
if (Array.isArray(config.pr_url_hostnames) && config.pr_url_hostnames.length > 0) {
|
|
160
|
+
prUrlHostnames = config.pr_url_hostnames;
|
|
161
|
+
}
|
|
162
|
+
if (typeof config.pr_host_list !== 'string' || !config.pr_host_list) return;
|
|
163
|
+
prHostList = config.pr_host_list;
|
|
164
|
+
|
|
165
|
+
const urlInput = document.getElementById('pr-url-input');
|
|
166
|
+
if (urlInput) urlInput.placeholder = 'Enter ' + prHostList + ' PR URL';
|
|
167
|
+
|
|
168
|
+
document.querySelectorAll('[data-pr-host-list]').forEach(el => {
|
|
169
|
+
el.textContent = prHostList;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Drop the "this element is showing the URL error" marker.
|
|
175
|
+
*
|
|
176
|
+
* Called from every writer that replaces or hides the message, so the flag
|
|
177
|
+
* cannot outlive the message it describes — otherwise an unrelated error
|
|
178
|
+
* (e.g. a failed directory picker) would be dismissed by the next keystroke.
|
|
179
|
+
*
|
|
180
|
+
* @param {HTMLElement} errorEl
|
|
181
|
+
*/
|
|
182
|
+
function clearLocalPathUrlErrorFlag(errorEl) {
|
|
183
|
+
if (errorEl) delete errorEl.dataset.localPathUrlError;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Show the "that's a URL, not a path" error and mark the element so
|
|
188
|
+
* handleLocalPathInput can clear it without comparing message text.
|
|
189
|
+
*/
|
|
190
|
+
function showLocalPathUrlError() {
|
|
191
|
+
// showError() clears the flag first, so setting it AFTER is what makes it
|
|
192
|
+
// describe THIS message rather than a previous one.
|
|
193
|
+
showError('local', localReviewPathUrlError());
|
|
194
|
+
const errorEl = document.getElementById('start-review-error-local');
|
|
195
|
+
if (errorEl) errorEl.dataset.localPathUrlError = 'true';
|
|
196
|
+
}
|
|
120
197
|
|
|
121
198
|
function isUrlLikeLocalReviewPath(value) {
|
|
122
199
|
if (!value || typeof value !== 'string') return false;
|
|
123
200
|
const trimmed = value.trim();
|
|
124
201
|
if (!trimmed) return false;
|
|
125
202
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) return true;
|
|
126
|
-
|
|
203
|
+
// Require a path separator so a bare hostname-shaped directory name is
|
|
204
|
+
// not mistaken for a URL.
|
|
205
|
+
const lower = trimmed.toLowerCase();
|
|
206
|
+
if (prUrlHostnames.some(hostname => lower.startsWith(hostname + '/'))) return true;
|
|
127
207
|
// Keep this aligned with src/utils/local-path-input.js: only a leading
|
|
128
208
|
// user@host:path token is treated as an SSH-style remote.
|
|
129
209
|
if (/^[^@/\\\s]+@[^:/\\\s]+:[^\s]+$/.test(trimmed)) return true;
|
|
@@ -172,6 +252,7 @@
|
|
|
172
252
|
const elId = tab === 'pr' ? 'start-review-error-pr' : 'start-review-error-local';
|
|
173
253
|
const errorEl = document.getElementById(elId);
|
|
174
254
|
if (errorEl) {
|
|
255
|
+
clearLocalPathUrlErrorFlag(errorEl);
|
|
175
256
|
errorEl.textContent = message;
|
|
176
257
|
errorEl.classList.remove('info');
|
|
177
258
|
errorEl.classList.add('visible');
|
|
@@ -188,6 +269,7 @@
|
|
|
188
269
|
const elId = tab === 'pr' ? 'start-review-error-pr' : 'start-review-error-local';
|
|
189
270
|
const errorEl = document.getElementById(elId);
|
|
190
271
|
if (errorEl) {
|
|
272
|
+
clearLocalPathUrlErrorFlag(errorEl);
|
|
191
273
|
errorEl.textContent = message;
|
|
192
274
|
errorEl.classList.add('visible', 'info');
|
|
193
275
|
}
|
|
@@ -885,7 +967,10 @@
|
|
|
885
967
|
|
|
886
968
|
// Clear previous errors/info messages
|
|
887
969
|
const errorEl = document.getElementById('start-review-error-local');
|
|
888
|
-
if (errorEl)
|
|
970
|
+
if (errorEl) {
|
|
971
|
+
errorEl.classList.remove('visible', 'info');
|
|
972
|
+
clearLocalPathUrlErrorFlag(errorEl);
|
|
973
|
+
}
|
|
889
974
|
|
|
890
975
|
if (!pathValue) {
|
|
891
976
|
showError('local', 'Please enter a directory path');
|
|
@@ -894,7 +979,7 @@
|
|
|
894
979
|
}
|
|
895
980
|
|
|
896
981
|
if (isUrlLikeLocalReviewPath(pathValue)) {
|
|
897
|
-
|
|
982
|
+
showLocalPathUrlError();
|
|
898
983
|
input.focus();
|
|
899
984
|
return;
|
|
900
985
|
}
|
|
@@ -912,12 +997,16 @@
|
|
|
912
997
|
if (!input || !errorEl) return;
|
|
913
998
|
|
|
914
999
|
if (isUrlLikeLocalReviewPath(input.value)) {
|
|
915
|
-
|
|
1000
|
+
showLocalPathUrlError();
|
|
916
1001
|
return;
|
|
917
1002
|
}
|
|
918
1003
|
|
|
919
|
-
|
|
1004
|
+
// Flagged rather than text-compared: the message names the configured
|
|
1005
|
+
// hosts, so it can change between being shown and being cleared (the
|
|
1006
|
+
// host list arrives asynchronously from /api/config).
|
|
1007
|
+
if (errorEl.dataset.localPathUrlError === 'true') {
|
|
920
1008
|
errorEl.classList.remove('visible', 'info');
|
|
1009
|
+
clearLocalPathUrlErrorFlag(errorEl);
|
|
921
1010
|
}
|
|
922
1011
|
}
|
|
923
1012
|
|
|
@@ -1313,7 +1402,7 @@
|
|
|
1313
1402
|
|
|
1314
1403
|
// Validate input
|
|
1315
1404
|
if (!url) {
|
|
1316
|
-
showError('pr', 'Please enter a
|
|
1405
|
+
showError('pr', 'Please enter a ' + prHostPrefix() + 'PR URL');
|
|
1317
1406
|
input.focus();
|
|
1318
1407
|
return;
|
|
1319
1408
|
}
|
|
@@ -1325,7 +1414,7 @@
|
|
|
1325
1414
|
const parsed = await parsePRUrl(url);
|
|
1326
1415
|
if (!parsed) {
|
|
1327
1416
|
setFormLoading('pr', false);
|
|
1328
|
-
showError('pr', 'Invalid PR URL. Please enter a
|
|
1417
|
+
showError('pr', 'Invalid PR URL. Please enter a ' + prHostPrefix() + 'PR URL (e.g., https://github.com/owner/repo/pull/123)');
|
|
1329
1418
|
input.focus();
|
|
1330
1419
|
return;
|
|
1331
1420
|
}
|
|
@@ -1397,6 +1486,7 @@
|
|
|
1397
1486
|
window.__pairReview.modelOverride = config.model_override || null;
|
|
1398
1487
|
window.__pairReview.hasGithubToken = Boolean(config.has_github_token);
|
|
1399
1488
|
window.__pairReview.enableGraphite = config.enable_graphite === true;
|
|
1489
|
+
applyPrHostList(config);
|
|
1400
1490
|
window.__pairReview.chatSpinner = config.chat_spinner || 'dots';
|
|
1401
1491
|
window.__pairReview.chatEnterToSend = config.chat_enter_to_send !== false;
|
|
1402
1492
|
|
|
@@ -2592,7 +2682,14 @@
|
|
|
2592
2682
|
if (typeof module !== 'undefined' && module.exports) {
|
|
2593
2683
|
module.exports = {
|
|
2594
2684
|
buildReviewUrlsFromRows: buildReviewUrlsFromRows,
|
|
2595
|
-
getSelectedCollectionRows: getSelectedCollectionRows
|
|
2685
|
+
getSelectedCollectionRows: getSelectedCollectionRows,
|
|
2686
|
+
applyPrHostList: applyPrHostList,
|
|
2687
|
+
isUrlLikeLocalReviewPath: isUrlLikeLocalReviewPath,
|
|
2688
|
+
localReviewPathUrlError: localReviewPathUrlError,
|
|
2689
|
+
showError: showError,
|
|
2690
|
+
showInfo: showInfo,
|
|
2691
|
+
showLocalPathUrlError: showLocalPathUrlError,
|
|
2692
|
+
handleLocalPathInput: handleLocalPathInput
|
|
2596
2693
|
};
|
|
2597
2694
|
}
|
|
2598
2695
|
|