@a9n-shoji/rvw 0.11.0 → 0.13.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/CHANGELOG.md +18 -0
- package/README.md +14 -1
- package/dist/cli.mjs +163 -48
- package/dist/cli.mjs.map +3 -3
- package/dist/parser-worker.mjs.map +1 -1
- package/dist/web/assets/DocumentViewer-BZj_OavK.js +1420 -0
- package/dist/web/assets/{StructureViewer-CwBbKYKF.js → StructureViewer-vuR0upv8.js} +1 -1
- package/dist/web/assets/WalkthroughPanel-CI_-kadA.js +33 -0
- package/dist/web/assets/WalkthroughViewer-Byr2C1TN.js +43 -0
- package/dist/web/assets/{index-CCxD40fx.css → index-C_jtOk1w.css} +1 -1
- package/dist/web/assets/index-DXmVWjds.js +11 -0
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/web/assets/DocumentViewer-CzOf3Y_e.js +0 -1420
- package/dist/web/assets/WalkthroughPanel-DvyIFY5z.js +0 -33
- package/dist/web/assets/WalkthroughViewer-Dt_IUyQ1.js +0 -43
- package/dist/web/assets/index-CbZzzSE-.js +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.13.0] - 2026-10-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- 引数なしの`rvw`で登録済みPull Requestの一覧をブラウザで開けるようにしました。リポジトリ外や未登録の環境からも起動できます。
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- 一覧起動時はPRの検出やGit/GitHubへの問い合わせを行わず、既存の`rvw open [PR]`は従来どおり利用できます。
|
|
17
|
+
- 内部のviewer起動protocolを7へ更新しました。公開Agent protocolは6のままです。
|
|
18
|
+
|
|
19
|
+
## [0.12.0] - 2026-10-05
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- 複数のPull Requestを横断するコメント一覧を追加。コメントの本文、対象PR、解決状態をまとめて確認できます。
|
|
24
|
+
- コメント一覧から返信し、対象のコード位置へ移動できるようにしました。
|
|
25
|
+
|
|
8
26
|
## [0.11.0] - 2026-10-02
|
|
9
27
|
|
|
10
28
|
### Added
|
package/README.md
CHANGED
|
@@ -32,12 +32,17 @@ gh auth setup-git
|
|
|
32
32
|
# インストール
|
|
33
33
|
npm install --global @a9n-shoji/rvw
|
|
34
34
|
|
|
35
|
-
#
|
|
35
|
+
# 登録済みPRの一覧を開く(リポジトリの外でも実行可能)
|
|
36
|
+
rvw
|
|
37
|
+
|
|
38
|
+
# 初めてのPRを登録して開く
|
|
36
39
|
cd /path/to/base-repository-clone
|
|
37
40
|
rvw doctor
|
|
38
41
|
rvw open https://github.com/owner/repository/pull/123
|
|
39
42
|
```
|
|
40
43
|
|
|
44
|
+
`rvw` だけで登録済みPRの一覧を開き、行を選んでレビューを再開できます。未登録の場合は `rvw open <PR URL>` でPRを追加してください。
|
|
45
|
+
|
|
41
46
|
`http://127.0.0.1:43117` でブラウザが開きます。ブラウザのタブをすべて閉じると、サーバーも自動停止します。
|
|
42
47
|
|
|
43
48
|
---
|
|
@@ -71,6 +76,14 @@ PR全体の流れを把握するために、Agentが生成した解説(Walkthr
|
|
|
71
76
|
|
|
72
77
|
---
|
|
73
78
|
|
|
79
|
+
## PRを横断してコメントを読む
|
|
80
|
+
|
|
81
|
+
入口の`Pull Requests / Comments`でPR単位とコメント単位を切り替えられます。CommentsではPRごとに
|
|
82
|
+
全スレッドの本文・返信を展開表示し、その場で返信、解決/再開できます。PR/スレッド/全体の折りたたみ、
|
|
83
|
+
状態・リポジトリ・PRの絞り込み、返信本文も含む検索に対応します。「PRで開く」でコメントの対象箇所へ移動し、
|
|
84
|
+
戻ると一覧の位置と下書きを保ちます。外部からの返信は自動反映され、並びや表示対象の変更は
|
|
85
|
+
「新しい更新を反映」で適用します。
|
|
86
|
+
|
|
74
87
|
## Agent連携(Codex / Claude Code)
|
|
75
88
|
|
|
76
89
|
ローカルの Agent に Skill を登録することで、PRの構成図生成や、行コメントに対する調査・返信を自動化できます。
|
package/dist/cli.mjs
CHANGED
|
@@ -18753,7 +18753,7 @@ function parseWalkthroughUri(uri) {
|
|
|
18753
18753
|
}
|
|
18754
18754
|
|
|
18755
18755
|
// src/shared/constants.ts
|
|
18756
|
-
var APP_VERSION = "0.
|
|
18756
|
+
var APP_VERSION = "0.13.0";
|
|
18757
18757
|
var PROTOCOL_VERSION = 6;
|
|
18758
18758
|
var VIEWER_ID_HEADER = "x-rvw-viewer-id";
|
|
18759
18759
|
var VIEWER_OPEN_LEASE_HEADER = "x-rvw-viewer-open-lease";
|
|
@@ -20428,6 +20428,70 @@ var RvwDatabase = class {
|
|
|
20428
20428
|
).get(id);
|
|
20429
20429
|
return row ? this.mapComment(row) : null;
|
|
20430
20430
|
}
|
|
20431
|
+
listCommentFeed(input) {
|
|
20432
|
+
const parameters = [
|
|
20433
|
+
input.status,
|
|
20434
|
+
input.status,
|
|
20435
|
+
input.hideClosedOrMerged ? 1 : 0,
|
|
20436
|
+
input.repository,
|
|
20437
|
+
input.repository,
|
|
20438
|
+
input.pullRequestId,
|
|
20439
|
+
input.pullRequestId,
|
|
20440
|
+
input.search,
|
|
20441
|
+
input.search
|
|
20442
|
+
];
|
|
20443
|
+
const matching = `WITH matching AS (
|
|
20444
|
+
SELECT c.id, c.pull_request_id,
|
|
20445
|
+
(SELECT MAX(p.created_at) FROM comment_posts p WHERE p.comment_id = c.id) AS posted_at
|
|
20446
|
+
FROM comments c JOIN pull_requests pr ON pr.id = c.pull_request_id
|
|
20447
|
+
WHERE (? = 'all' OR CASE WHEN ? = 'resolved' THEN c.resolved_at IS NOT NULL ELSE c.resolved_at IS NULL END)
|
|
20448
|
+
AND (? = 0 OR pr.github_state IS NULL OR pr.github_state = 'OPEN')
|
|
20449
|
+
AND (? = '' OR pr.owner || '/' || pr.repository = ?)
|
|
20450
|
+
AND (? = '' OR pr.id = ?)
|
|
20451
|
+
AND (? = '' OR EXISTS (SELECT 1 FROM comment_posts p WHERE p.comment_id = c.id
|
|
20452
|
+
AND instr(lower(p.body), lower(?)) > 0))
|
|
20453
|
+
)`;
|
|
20454
|
+
const totals = this.database.prepare(
|
|
20455
|
+
`${matching}
|
|
20456
|
+
SELECT COUNT(*) AS comments, COUNT(DISTINCT pull_request_id) AS groups FROM matching`
|
|
20457
|
+
).get(...parameters);
|
|
20458
|
+
const rows = this.database.prepare(
|
|
20459
|
+
`${matching}, page AS (
|
|
20460
|
+
SELECT pull_request_id, MAX(posted_at) AS posted_at FROM matching
|
|
20461
|
+
GROUP BY pull_request_id ORDER BY posted_at DESC, pull_request_id DESC LIMIT ?
|
|
20462
|
+
) SELECT m.id, m.pull_request_id FROM matching m JOIN page p ON p.pull_request_id = m.pull_request_id
|
|
20463
|
+
ORDER BY p.posted_at DESC, p.pull_request_id DESC, m.posted_at DESC, m.id DESC`
|
|
20464
|
+
).all(...parameters, input.limit);
|
|
20465
|
+
const pullRequests = this.database.prepare(
|
|
20466
|
+
`SELECT id, owner, repository, number, latest_title, github_state, github_is_draft
|
|
20467
|
+
FROM pull_requests ORDER BY owner, repository, number DESC`
|
|
20468
|
+
).all().map((row) => ({
|
|
20469
|
+
id: stringValue(row, "id"),
|
|
20470
|
+
owner: stringValue(row, "owner"),
|
|
20471
|
+
repository: stringValue(row, "repository"),
|
|
20472
|
+
number: numberValue(row, "number"),
|
|
20473
|
+
title: stringValue(row, "latest_title"),
|
|
20474
|
+
githubState: nullableString(row, "github_state"),
|
|
20475
|
+
githubIsDraft: row.github_is_draft === null ? null : row.github_is_draft === 1
|
|
20476
|
+
}));
|
|
20477
|
+
const byId = new Map(pullRequests.map((pr) => [pr.id, pr]));
|
|
20478
|
+
const groups = [];
|
|
20479
|
+
for (const row of rows) {
|
|
20480
|
+
const id = stringValue(row, "pull_request_id");
|
|
20481
|
+
let group = groups.at(-1);
|
|
20482
|
+
if (group?.pullRequest.id !== id) {
|
|
20483
|
+
group = { pullRequest: byId.get(id), commentIds: [] };
|
|
20484
|
+
groups.push(group);
|
|
20485
|
+
}
|
|
20486
|
+
group.commentIds.push(stringValue(row, "id"));
|
|
20487
|
+
}
|
|
20488
|
+
return {
|
|
20489
|
+
groups,
|
|
20490
|
+
pullRequests,
|
|
20491
|
+
totalGroups: numberValue(totals, "groups"),
|
|
20492
|
+
totalComments: numberValue(totals, "comments")
|
|
20493
|
+
};
|
|
20494
|
+
}
|
|
20431
20495
|
listComments(pullRequestId, resolved) {
|
|
20432
20496
|
const where = resolved === void 0 ? "" : resolved ? " AND c.resolved_at IS NOT NULL" : " AND c.resolved_at IS NULL";
|
|
20433
20497
|
return this.database.prepare(
|
|
@@ -50274,6 +50338,17 @@ function createApp(service, options) {
|
|
|
50274
50338
|
pullRequest: service.setPullRequestArchived(context.req.param("id"), input.archived)
|
|
50275
50339
|
});
|
|
50276
50340
|
});
|
|
50341
|
+
app.get("/api/comment-feed", (context) => {
|
|
50342
|
+
const input = external_exports.object({
|
|
50343
|
+
status: external_exports.enum(["unresolved", "resolved", "all"]).default("unresolved"),
|
|
50344
|
+
hideClosedOrMerged: external_exports.enum(["true", "false"]).default("true").transform((value) => value === "true"),
|
|
50345
|
+
repository: external_exports.string().max(300).default(""),
|
|
50346
|
+
pullRequestId: external_exports.union([external_exports.uuid(), external_exports.literal("")]).default(""),
|
|
50347
|
+
search: external_exports.string().max(500).default(""),
|
|
50348
|
+
limit: external_exports.coerce.number().int().min(1).max(1e3).default(20)
|
|
50349
|
+
}).parse(context.req.query());
|
|
50350
|
+
return context.json({ ok: true, ...service.database.listCommentFeed(input) });
|
|
50351
|
+
});
|
|
50277
50352
|
app.post(
|
|
50278
50353
|
"/api/pull-requests/refresh-statuses",
|
|
50279
50354
|
async (context) => context.json({ ok: true, ...await service.refreshPullRequestStatuses() })
|
|
@@ -50930,7 +51005,7 @@ import os4 from "node:os";
|
|
|
50930
51005
|
import path10 from "node:path";
|
|
50931
51006
|
var MAX_CLI_STDIN_BYTES = 40 * 1024 * 1024;
|
|
50932
51007
|
var MAX_AGENT_MESSAGE_BYTES = MAX_CLI_STDIN_BYTES + 64 * 1024;
|
|
50933
|
-
var AGENT_SOCKET_PROTOCOL_VERSION =
|
|
51008
|
+
var AGENT_SOCKET_PROTOCOL_VERSION = 7;
|
|
50934
51009
|
var RUNTIME_VIEWER_OPEN_OPERATION = "viewer.open";
|
|
50935
51010
|
var AGENT_SOCKET_RESTART_SUGGESTION = "\u8D77\u52D5\u4E2D\u306Ervw viewer\u3092\u505C\u6B62\u3057\u3001\u66F4\u65B0\u5F8C\u306Ervw open\u3067\u518D\u8D77\u52D5\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
50936
51011
|
var DEFAULT_CONNECT_TIMEOUT_MS = 2e3;
|
|
@@ -50946,14 +51021,17 @@ var agentRequestEnvelopeSchema = external_exports.object({
|
|
|
50946
51021
|
}).strict();
|
|
50947
51022
|
var runtimeViewerOpenInputSchema = external_exports.object({
|
|
50948
51023
|
reference: external_exports.string().min(1).optional(),
|
|
51024
|
+
list: external_exports.boolean().optional(),
|
|
50949
51025
|
cwd: external_exports.string().min(1),
|
|
50950
51026
|
requestedPort: external_exports.number().int().min(0).max(65535)
|
|
50951
|
-
}).strict()
|
|
51027
|
+
}).strict().refine((input) => !input.list || input.reference === void 0, {
|
|
51028
|
+
message: "\u4E00\u89A7\u8D77\u52D5\u306B\u306FPR\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002"
|
|
51029
|
+
});
|
|
50952
51030
|
var runtimeViewerOpenResultSchema = external_exports.object({
|
|
50953
51031
|
url: external_exports.string().url(),
|
|
50954
51032
|
origin: external_exports.string().url(),
|
|
50955
51033
|
port: external_exports.number().int().min(1).max(65535),
|
|
50956
|
-
pullRequestId: external_exports.string().min(1),
|
|
51034
|
+
pullRequestId: external_exports.string().min(1).nullable(),
|
|
50957
51035
|
ownerPid: external_exports.number().int().positive(),
|
|
50958
51036
|
viewerLeaseId: external_exports.uuid().optional()
|
|
50959
51037
|
}).strict();
|
|
@@ -51822,6 +51900,7 @@ async function startRuntimeAgentSocket(databaseFilePath) {
|
|
|
51822
51900
|
if (!parsed.success) throw invalidSocketInput(parsed.error);
|
|
51823
51901
|
return await (await handlerPromise).openViewer({
|
|
51824
51902
|
...parsed.data.reference === void 0 ? {} : { reference: parsed.data.reference },
|
|
51903
|
+
...parsed.data.list === void 0 ? {} : { list: parsed.data.list },
|
|
51825
51904
|
cwd: parsed.data.cwd,
|
|
51826
51905
|
requestedPort: parsed.data.requestedPort
|
|
51827
51906
|
});
|
|
@@ -52273,6 +52352,16 @@ var OPEN_WORKER_PARENT_TIMEOUT_PADDING_MS = 5e3;
|
|
|
52273
52352
|
var RUNTIME_REUSE_RETRY_MS = 50;
|
|
52274
52353
|
var RUNTIME_VIEWER_HEARTBEAT_INTERVAL_MS = 3e4;
|
|
52275
52354
|
var RUNTIME_VIEWER_REQUEST_TIMEOUT_MS = 5e3;
|
|
52355
|
+
function viewerLaunchOptions(command) {
|
|
52356
|
+
let options = { ...command.opts() };
|
|
52357
|
+
const parent = command.parent;
|
|
52358
|
+
for (const key2 of ["open", "foreground", "port"]) {
|
|
52359
|
+
if (command.getOptionValueSource(key2) !== "cli" && parent?.getOptionValueSource(key2) === "cli") {
|
|
52360
|
+
options = { ...options, [key2]: parent.opts()[key2] };
|
|
52361
|
+
}
|
|
52362
|
+
}
|
|
52363
|
+
return options;
|
|
52364
|
+
}
|
|
52276
52365
|
function writeJson(value) {
|
|
52277
52366
|
process.stdout.write(`${JSON.stringify(value)}
|
|
52278
52367
|
`);
|
|
@@ -52485,13 +52574,14 @@ function staticDirectory() {
|
|
|
52485
52574
|
];
|
|
52486
52575
|
return candidates.find((candidate) => existsSync6(candidate)) ?? candidates[0];
|
|
52487
52576
|
}
|
|
52488
|
-
function forkOpenWorker(reference, port, requestedPort) {
|
|
52577
|
+
function forkOpenWorker(reference, port, requestedPort, list2) {
|
|
52489
52578
|
const modulePath = process.argv[1];
|
|
52490
52579
|
if (!modulePath) {
|
|
52491
52580
|
throw new RvwError("PROCESS_FAILED", "rvw CLI\u306E\u5B9F\u884Cpath\u3092\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
|
|
52492
52581
|
}
|
|
52493
52582
|
const args = ["__open-worker", "--port", String(port), "--requested-port", String(requestedPort)];
|
|
52494
52583
|
if (reference !== void 0) args.push("--reference", reference);
|
|
52584
|
+
if (list2) args.push("--list");
|
|
52495
52585
|
return fork(path11.resolve(modulePath), args, {
|
|
52496
52586
|
cwd: process.cwd(),
|
|
52497
52587
|
env: process.env,
|
|
@@ -52499,11 +52589,12 @@ function forkOpenWorker(reference, port, requestedPort) {
|
|
|
52499
52589
|
stdio: ["ignore", "ignore", "ignore", "ipc"]
|
|
52500
52590
|
});
|
|
52501
52591
|
}
|
|
52502
|
-
async function startBackgroundOpen(reference, port, dependencies = {}) {
|
|
52592
|
+
async function startBackgroundOpen(reference, port, dependencies = {}, list2 = false) {
|
|
52503
52593
|
const startupPort = port ?? DEFAULT_VIEWER_PORT;
|
|
52504
52594
|
const requestedPort = port ?? 0;
|
|
52505
52595
|
const input = {
|
|
52506
52596
|
...reference === void 0 ? {} : { reference },
|
|
52597
|
+
...list2 ? { list: true } : {},
|
|
52507
52598
|
cwd: process.cwd(),
|
|
52508
52599
|
requestedPort
|
|
52509
52600
|
};
|
|
@@ -52525,7 +52616,12 @@ async function startBackgroundOpen(reference, port, dependencies = {}) {
|
|
|
52525
52616
|
{ details: existing.details }
|
|
52526
52617
|
);
|
|
52527
52618
|
}
|
|
52528
|
-
const child = (dependencies.forkWorker ?? forkOpenWorker)(
|
|
52619
|
+
const child = (dependencies.forkWorker ?? forkOpenWorker)(
|
|
52620
|
+
reference,
|
|
52621
|
+
startupPort,
|
|
52622
|
+
requestedPort,
|
|
52623
|
+
list2
|
|
52624
|
+
);
|
|
52529
52625
|
return await completeBackgroundOpen(child, launchBrowser);
|
|
52530
52626
|
}
|
|
52531
52627
|
async function sendOpenWorkerMessage(message) {
|
|
@@ -52558,9 +52654,10 @@ async function waitForInitialViewer(firstViewerConnected, timeoutMs = DEFAULT_VI
|
|
|
52558
52654
|
void firstViewerConnected.then(() => finish("connected"));
|
|
52559
52655
|
});
|
|
52560
52656
|
}
|
|
52561
|
-
function runtimeViewerOpenInput(reference, cwd, requestedPort) {
|
|
52657
|
+
function runtimeViewerOpenInput(reference, cwd, requestedPort, list2) {
|
|
52562
52658
|
return {
|
|
52563
52659
|
...reference === void 0 ? {} : { reference },
|
|
52660
|
+
...list2 ? { list: true } : {},
|
|
52564
52661
|
cwd,
|
|
52565
52662
|
requestedPort
|
|
52566
52663
|
};
|
|
@@ -52583,16 +52680,16 @@ function createRuntimeAgentSocketHandler(activeRuntime, running) {
|
|
|
52583
52680
|
}
|
|
52584
52681
|
const viewerLeaseId = running.reserveViewer();
|
|
52585
52682
|
try {
|
|
52586
|
-
const opened = await activeRuntime.service.openPullRequest(input.reference, input.cwd);
|
|
52683
|
+
const opened = input.list ? null : await activeRuntime.service.openPullRequest(input.reference, input.cwd);
|
|
52587
52684
|
if (viewerLeaseId !== null) running.armViewerReservation(viewerLeaseId);
|
|
52588
52685
|
const url2 = new URL(running.origin);
|
|
52589
|
-
url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52686
|
+
if (opened) url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52590
52687
|
if (viewerLeaseId !== null) url2.searchParams.set(VIEWER_OPEN_LEASE_QUERY, viewerLeaseId);
|
|
52591
52688
|
return {
|
|
52592
52689
|
url: url2.toString(),
|
|
52593
52690
|
origin: running.origin,
|
|
52594
52691
|
port: running.port,
|
|
52595
|
-
pullRequestId: opened
|
|
52692
|
+
pullRequestId: opened?.pullRequest.id ?? null,
|
|
52596
52693
|
ownerPid: process.pid,
|
|
52597
52694
|
...viewerLeaseId === null ? {} : { viewerLeaseId }
|
|
52598
52695
|
};
|
|
@@ -52717,7 +52814,7 @@ async function waitForWorkerParentDisconnect() {
|
|
|
52717
52814
|
if (!process.connected) return;
|
|
52718
52815
|
await new Promise((resolve) => process.once("disconnect", resolve));
|
|
52719
52816
|
}
|
|
52720
|
-
async function runOpenServer(runtimeFactory, reference, port, openAutomatically, useAgentSocket, reuseExisting) {
|
|
52817
|
+
async function runOpenServer(runtimeFactory, reference, port, openAutomatically, useAgentSocket, reuseExisting, list2 = false) {
|
|
52721
52818
|
const startupPort = port ?? DEFAULT_VIEWER_PORT;
|
|
52722
52819
|
const requestedPort = port ?? 0;
|
|
52723
52820
|
let activeRuntime;
|
|
@@ -52728,7 +52825,7 @@ async function runOpenServer(runtimeFactory, reference, port, openAutomatically,
|
|
|
52728
52825
|
const databaseFilePath = databasePathConfiguration().filePath;
|
|
52729
52826
|
if (reuseExisting) {
|
|
52730
52827
|
const startup = await acquireRuntimeOrReuseExisting(
|
|
52731
|
-
runtimeViewerOpenInput(reference, process.cwd(), requestedPort),
|
|
52828
|
+
runtimeViewerOpenInput(reference, process.cwd(), requestedPort, list2),
|
|
52732
52829
|
databaseFilePath
|
|
52733
52830
|
);
|
|
52734
52831
|
if (startup.kind === "reused") {
|
|
@@ -52755,7 +52852,7 @@ async function runOpenServer(runtimeFactory, reference, port, openAutomatically,
|
|
|
52755
52852
|
}
|
|
52756
52853
|
}
|
|
52757
52854
|
activeRuntime = runtimeFactory();
|
|
52758
|
-
const opened = await activeRuntime.service.openPullRequest(reference, process.cwd());
|
|
52855
|
+
const opened = list2 ? null : await activeRuntime.service.openPullRequest(reference, process.cwd());
|
|
52759
52856
|
running = await startServer(activeRuntime.service, {
|
|
52760
52857
|
port: startupPort,
|
|
52761
52858
|
staticDirectory: staticDirectory(),
|
|
@@ -52763,7 +52860,7 @@ async function runOpenServer(runtimeFactory, reference, port, openAutomatically,
|
|
|
52763
52860
|
});
|
|
52764
52861
|
agentSocket?.setHandler(createRuntimeAgentSocketHandler(activeRuntime, running));
|
|
52765
52862
|
const url2 = new URL(running.origin);
|
|
52766
|
-
url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52863
|
+
if (opened) url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52767
52864
|
process.stdout.write(`rvw: ${url2.toString()}
|
|
52768
52865
|
`);
|
|
52769
52866
|
if (openAutomatically) await open_default(url2.toString());
|
|
@@ -52775,7 +52872,7 @@ async function runOpenServer(runtimeFactory, reference, port, openAutomatically,
|
|
|
52775
52872
|
await closeOwnedRuntime(agentSocket, running, activeRuntime);
|
|
52776
52873
|
}
|
|
52777
52874
|
}
|
|
52778
|
-
async function runOpenWorker(runtimeFactory, reference, port, requestedPort) {
|
|
52875
|
+
async function runOpenWorker(runtimeFactory, reference, port, requestedPort, list2) {
|
|
52779
52876
|
let activeRuntime;
|
|
52780
52877
|
let running;
|
|
52781
52878
|
let agentSocket;
|
|
@@ -52785,7 +52882,7 @@ async function runOpenWorker(runtimeFactory, reference, port, requestedPort) {
|
|
|
52785
52882
|
}
|
|
52786
52883
|
const databaseFilePath = databasePathConfiguration().filePath;
|
|
52787
52884
|
const startup = await acquireRuntimeOrReuseExisting(
|
|
52788
|
-
runtimeViewerOpenInput(reference, process.cwd(), requestedPort),
|
|
52885
|
+
runtimeViewerOpenInput(reference, process.cwd(), requestedPort, list2),
|
|
52789
52886
|
databaseFilePath
|
|
52790
52887
|
);
|
|
52791
52888
|
if (startup.kind === "reused") {
|
|
@@ -52797,7 +52894,7 @@ async function runOpenWorker(runtimeFactory, reference, port, requestedPort) {
|
|
|
52797
52894
|
}
|
|
52798
52895
|
agentSocket = startup.agentSocket;
|
|
52799
52896
|
activeRuntime = runtimeFactory();
|
|
52800
|
-
const opened = await activeRuntime.service.openPullRequest(reference, process.cwd());
|
|
52897
|
+
const opened = list2 ? null : await activeRuntime.service.openPullRequest(reference, process.cwd());
|
|
52801
52898
|
running = await startServer(activeRuntime.service, {
|
|
52802
52899
|
port,
|
|
52803
52900
|
staticDirectory: staticDirectory(),
|
|
@@ -52805,7 +52902,7 @@ async function runOpenWorker(runtimeFactory, reference, port, requestedPort) {
|
|
|
52805
52902
|
});
|
|
52806
52903
|
agentSocket.setHandler(createRuntimeAgentSocketHandler(activeRuntime, running));
|
|
52807
52904
|
const url2 = new URL(running.origin);
|
|
52808
|
-
url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52905
|
+
if (opened) url2.searchParams.set("pullRequestId", opened.pullRequest.id);
|
|
52809
52906
|
if (!await sendOpenWorkerMessage({ type: "ready", url: url2.toString() })) return;
|
|
52810
52907
|
const firstViewerConnected = running.firstViewerConnected;
|
|
52811
52908
|
if (!firstViewerConnected) {
|
|
@@ -52842,7 +52939,9 @@ function createProgram(runtimeFactory = defaultRuntimeFactory) {
|
|
|
52842
52939
|
return await direct();
|
|
52843
52940
|
};
|
|
52844
52941
|
const program2 = new Command();
|
|
52845
|
-
program2.name("rvw").description(
|
|
52942
|
+
program2.name("rvw").description(
|
|
52943
|
+
"GitHub Pull Request\u3092commit\u5358\u4F4D\u3067\u95B2\u89A7\u30FB\u30B3\u30E1\u30F3\u30C8\u3059\u308B\u30ED\u30FC\u30AB\u30EBviewer\u3002\u5F15\u6570\u306A\u3057\u3067\u767B\u9332\u6E08\u307FPR\u4E00\u89A7\u3092\u958B\u304F"
|
|
52944
|
+
).version(APP_VERSION).enablePositionalOptions().showHelpAfterError();
|
|
52846
52945
|
program2.command("doctor").description(
|
|
52847
52946
|
"git\u3001gh\u8A8D\u8A3C\u3001repository\u3001DB\u3092\u78BA\u8A8D\uFF08RVW_DATABASE_PATH\u306Fchmod\u3057\u306A\u3044caller-managed DB\uFF09"
|
|
52848
52947
|
).option("--json", "JSON\u3067\u51FA\u529B").action(async (options) => {
|
|
@@ -52927,37 +53026,52 @@ function createProgram(runtimeFactory = defaultRuntimeFactory) {
|
|
|
52927
53026
|
writeOutput(options, { ok: ok2, ...status }, formatAgentTransportStatus(status));
|
|
52928
53027
|
if (!ok2) process.exitCode = 2;
|
|
52929
53028
|
});
|
|
52930
|
-
|
|
52931
|
-
|
|
52932
|
-
|
|
52933
|
-
|
|
52934
|
-
process.stdout.write(`rvw: ${url2}
|
|
53029
|
+
const launchViewer = async (reference, options, list2) => {
|
|
53030
|
+
if (options.open && !options.foreground && useAgentSocket) {
|
|
53031
|
+
const url2 = await startBackgroundOpen(reference, options.port, {}, list2);
|
|
53032
|
+
process.stdout.write(`rvw: ${url2}
|
|
52935
53033
|
`);
|
|
52936
|
-
|
|
52937
|
-
|
|
52938
|
-
|
|
52939
|
-
|
|
52940
|
-
|
|
52941
|
-
|
|
52942
|
-
|
|
52943
|
-
|
|
52944
|
-
|
|
52945
|
-
|
|
53034
|
+
return;
|
|
53035
|
+
}
|
|
53036
|
+
await runOpenServer(
|
|
53037
|
+
getRuntime,
|
|
53038
|
+
reference,
|
|
53039
|
+
options.port,
|
|
53040
|
+
options.open,
|
|
53041
|
+
useAgentSocket,
|
|
53042
|
+
!options.foreground,
|
|
53043
|
+
list2
|
|
53044
|
+
);
|
|
53045
|
+
};
|
|
53046
|
+
program2.option("--no-open", "\u30D6\u30E9\u30A6\u30B6\u3092\u958B\u304B\u306A\u3044").option("--foreground", "terminal\u306B\u63A5\u7D9A\u3057\u305F\u307E\u307Eviewer\u3092\u5B9F\u884C").option("--port <port>", `listen port\uFF08\u65E2\u5B9A${DEFAULT_VIEWER_PORT}\u30010\u306F\u81EA\u52D5\uFF09`, parsePort).action(async (options) => {
|
|
53047
|
+
await launchViewer(void 0, options, true);
|
|
53048
|
+
});
|
|
53049
|
+
program2.command("open").argument("[pull-request]", "PR URL\u307E\u305F\u306F\u756A\u53F7").option("--no-open", "\u30D6\u30E9\u30A6\u30B6\u3092\u958B\u304B\u306A\u3044").option("--foreground", "terminal\u306B\u63A5\u7D9A\u3057\u305F\u307E\u307Eviewer\u3092\u5B9F\u884C").option("--port <port>", `listen port\uFF08\u65E2\u5B9A${DEFAULT_VIEWER_PORT}\u30010\u306F\u81EA\u52D5\uFF09`, parsePort).description("Pull Request\u3092\u958B\u3044\u3066\u30ED\u30FC\u30AB\u30EBviewer\u3092\u8D77\u52D5").action(
|
|
53050
|
+
async (reference, _options, command) => {
|
|
53051
|
+
await launchViewer(reference, viewerLaunchOptions(command), false);
|
|
52946
53052
|
}
|
|
52947
53053
|
);
|
|
52948
|
-
program2.command("__open-worker", { hidden: true }).option("--reference <pull-request>").requiredOption("--port <port>", "listen port", parsePort).requiredOption("--requested-port <port>", "requested listen port", parsePort).action(
|
|
52949
|
-
|
|
52950
|
-
|
|
52951
|
-
|
|
52952
|
-
|
|
52953
|
-
|
|
52954
|
-
|
|
52955
|
-
|
|
52956
|
-
|
|
52957
|
-
|
|
52958
|
-
|
|
53054
|
+
program2.command("__open-worker", { hidden: true }).option("--reference <pull-request>").option("--list", "\u767B\u9332\u6E08\u307FPR\u4E00\u89A7\u3092\u958B\u304F").requiredOption("--port <port>", "listen port", parsePort).requiredOption("--requested-port <port>", "requested listen port", parsePort).action(
|
|
53055
|
+
async (options) => {
|
|
53056
|
+
try {
|
|
53057
|
+
await runOpenWorker(
|
|
53058
|
+
getRuntime,
|
|
53059
|
+
options.reference,
|
|
53060
|
+
options.port,
|
|
53061
|
+
options.requestedPort,
|
|
53062
|
+
options.list ?? false
|
|
53063
|
+
);
|
|
53064
|
+
} catch (error51) {
|
|
53065
|
+
const rvwError = asRvwError(error51);
|
|
53066
|
+
const sent = await sendOpenWorkerMessage({
|
|
53067
|
+
type: "error",
|
|
53068
|
+
error: { ...rvwError.toJSON(), status: rvwError.status }
|
|
53069
|
+
});
|
|
53070
|
+
if (!sent) throw error51;
|
|
53071
|
+
process.exitCode = rvwError.status >= 500 ? 1 : 2;
|
|
53072
|
+
}
|
|
52959
53073
|
}
|
|
52960
|
-
|
|
53074
|
+
);
|
|
52961
53075
|
const pr = program2.command("pr").description("Pull Request\u72B6\u614B\u3092\u7BA1\u7406");
|
|
52962
53076
|
pr.command("list").option("--json", "JSON\u3067\u51FA\u529B").option("--offset <offset>", "\u958B\u59CB\u4F4D\u7F6E", "0").option("--limit <limit>", "\u53D6\u5F97\u4EF6\u6570\uFF08\u6700\u5927100\uFF09", "50").option("--include-archived", "\u30A2\u30FC\u30AB\u30A4\u30D6\u6E08\u307F\u3082\u542B\u3081\u308B").option("--include-closed", "Closed / Merged\u3082\u542B\u3081\u308B").action(
|
|
52963
53077
|
async (options) => {
|
|
@@ -53473,7 +53587,7 @@ function createProgram(runtimeFactory = defaultRuntimeFactory) {
|
|
|
53473
53587
|
);
|
|
53474
53588
|
});
|
|
53475
53589
|
program2.hook("postAction", (_command, actionCommand) => {
|
|
53476
|
-
if (actionCommand.name() !== "open" && actionCommand.name() !== "__open-worker") {
|
|
53590
|
+
if (actionCommand !== program2 && actionCommand.name() !== "open" && actionCommand.name() !== "__open-worker") {
|
|
53477
53591
|
runtime?.close();
|
|
53478
53592
|
}
|
|
53479
53593
|
});
|
|
@@ -53513,6 +53627,7 @@ export {
|
|
|
53513
53627
|
holdRuntimeViewerLease,
|
|
53514
53628
|
runCli,
|
|
53515
53629
|
startBackgroundOpen,
|
|
53630
|
+
viewerLaunchOptions,
|
|
53516
53631
|
waitForServerShutdown
|
|
53517
53632
|
};
|
|
53518
53633
|
//# sourceMappingURL=cli.mjs.map
|