@quickchatai/pi-quickreview 1.2.0 → 1.3.2
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 +79 -27
- package/assets/config.example.toml +25 -7
- package/assets/prompts/onboarding.md +8 -7
- package/assets/schemas/review-result.v1.json +60 -0
- package/dist/extensions/quickreview.d.ts +17 -5
- package/dist/extensions/quickreview.d.ts.map +1 -1
- package/dist/extensions/quickreview.js +79 -26
- package/dist/extensions/quickreview.js.map +1 -1
- package/dist/src/engine/auth.d.ts +4 -0
- package/dist/src/engine/auth.d.ts.map +1 -1
- package/dist/src/engine/auth.js +11 -2
- package/dist/src/engine/auth.js.map +1 -1
- package/dist/src/engine/lens/activity.d.ts +45 -0
- package/dist/src/engine/lens/activity.d.ts.map +1 -0
- package/dist/src/engine/lens/activity.js +118 -0
- package/dist/src/engine/lens/activity.js.map +1 -0
- package/dist/src/engine/lens/runlens.d.ts +7 -0
- package/dist/src/engine/lens/runlens.d.ts.map +1 -1
- package/dist/src/engine/lens/runlens.js +30 -1
- package/dist/src/engine/lens/runlens.js.map +1 -1
- package/dist/src/engine/lens/tool.d.ts +7 -0
- package/dist/src/engine/lens/tool.d.ts.map +1 -1
- package/dist/src/engine/lens/tool.js +101 -18
- package/dist/src/engine/lens/tool.js.map +1 -1
- package/dist/src/engine/lens/wave.d.ts +6 -0
- package/dist/src/engine/lens/wave.d.ts.map +1 -1
- package/dist/src/engine/lens/wave.js +16 -0
- package/dist/src/engine/lens/wave.js.map +1 -1
- package/dist/src/homes.js +1 -1
- package/dist/src/homes.js.map +1 -1
- package/dist/src/live/events.d.ts +3 -0
- package/dist/src/live/events.d.ts.map +1 -1
- package/dist/src/live/events.js.map +1 -1
- package/dist/src/live/lensline.d.ts +20 -0
- package/dist/src/live/lensline.d.ts.map +1 -0
- package/dist/src/live/lensline.js +70 -0
- package/dist/src/live/lensline.js.map +1 -0
- package/dist/src/live/projection.d.ts +55 -0
- package/dist/src/live/projection.d.ts.map +1 -0
- package/dist/src/live/projection.js +465 -0
- package/dist/src/live/projection.js.map +1 -0
- package/dist/src/live/read.d.ts +24 -0
- package/dist/src/live/read.d.ts.map +1 -0
- package/dist/src/live/read.js +60 -0
- package/dist/src/live/read.js.map +1 -0
- package/dist/src/live/writer.d.ts +3 -0
- package/dist/src/live/writer.d.ts.map +1 -1
- package/dist/src/live/writer.js +6 -1
- package/dist/src/live/writer.js.map +1 -1
- package/dist/src/localreview.d.ts +18 -8
- package/dist/src/localreview.d.ts.map +1 -1
- package/dist/src/localreview.js +103 -43
- package/dist/src/localreview.js.map +1 -1
- package/dist/src/modelroute.d.ts +4 -0
- package/dist/src/modelroute.d.ts.map +1 -1
- package/dist/src/modelroute.js +21 -0
- package/dist/src/modelroute.js.map +1 -1
- package/dist/src/plugin/args.d.ts +38 -7
- package/dist/src/plugin/args.d.ts.map +1 -1
- package/dist/src/plugin/args.js +134 -37
- package/dist/src/plugin/args.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +5 -1
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/login.d.ts +8 -4
- package/dist/src/plugin/login.d.ts.map +1 -1
- package/dist/src/plugin/login.js +25 -32
- package/dist/src/plugin/login.js.map +1 -1
- package/dist/src/plugin/messages.d.ts +7 -0
- package/dist/src/plugin/messages.d.ts.map +1 -0
- package/dist/src/plugin/messages.js +13 -0
- package/dist/src/plugin/messages.js.map +1 -0
- package/dist/src/plugin/peers.d.ts +17 -0
- package/dist/src/plugin/peers.d.ts.map +1 -0
- package/dist/src/plugin/peers.js +55 -0
- package/dist/src/plugin/peers.js.map +1 -0
- package/dist/src/plugin/review.d.ts +52 -6
- package/dist/src/plugin/review.d.ts.map +1 -1
- package/dist/src/plugin/review.js +261 -95
- package/dist/src/plugin/review.js.map +1 -1
- package/dist/src/plugin/scan.d.ts +80 -44
- package/dist/src/plugin/scan.d.ts.map +1 -1
- package/dist/src/plugin/scan.js +450 -233
- package/dist/src/plugin/scan.js.map +1 -1
- package/dist/src/plugin/scancases.d.ts +33 -0
- package/dist/src/plugin/scancases.d.ts.map +1 -0
- package/dist/src/plugin/scancases.js +153 -0
- package/dist/src/plugin/scancases.js.map +1 -0
- package/dist/src/plugin/settings.d.ts +18 -0
- package/dist/src/plugin/settings.d.ts.map +1 -0
- package/dist/src/plugin/settings.js +47 -0
- package/dist/src/plugin/settings.js.map +1 -0
- package/dist/src/plugin/setup.d.ts +35 -12
- package/dist/src/plugin/setup.d.ts.map +1 -1
- package/dist/src/plugin/setup.js +258 -118
- package/dist/src/plugin/setup.js.map +1 -1
- package/dist/src/plugin/versiongate.d.ts +3 -0
- package/dist/src/plugin/versiongate.d.ts.map +1 -1
- package/dist/src/plugin/versiongate.js +9 -4
- package/dist/src/plugin/versiongate.js.map +1 -1
- package/dist/src/profileoverrides.d.ts +3 -0
- package/dist/src/profileoverrides.d.ts.map +1 -1
- package/dist/src/profileoverrides.js +9 -2
- package/dist/src/profileoverrides.js.map +1 -1
- package/dist/src/reviewapi.d.ts +22 -31
- package/dist/src/reviewapi.d.ts.map +1 -1
- package/dist/src/reviewapi.js +90 -66
- package/dist/src/reviewapi.js.map +1 -1
- package/dist/src/reviewdest.d.ts +1 -1
- package/dist/src/reviewdest.d.ts.map +1 -1
- package/dist/src/reviewdest.js +4 -3
- package/dist/src/reviewdest.js.map +1 -1
- package/dist/src/reviewtarget.d.ts +36 -0
- package/dist/src/reviewtarget.d.ts.map +1 -0
- package/dist/src/reviewtarget.js +6 -0
- package/dist/src/reviewtarget.js.map +1 -0
- package/dist/src/round-progress.d.ts +5 -0
- package/dist/src/round-progress.d.ts.map +1 -1
- package/dist/src/round-progress.js.map +1 -1
- package/dist/src/round-stage-deadlines.d.ts +26 -1
- package/dist/src/round-stage-deadlines.d.ts.map +1 -1
- package/dist/src/round-stage-deadlines.js +45 -2
- package/dist/src/round-stage-deadlines.js.map +1 -1
- package/dist/src/savedpost.d.ts +65 -0
- package/dist/src/savedpost.d.ts.map +1 -0
- package/dist/src/savedpost.js +131 -0
- package/dist/src/savedpost.js.map +1 -0
- package/dist/src/scan/caseread.d.ts +84 -0
- package/dist/src/scan/caseread.d.ts.map +1 -0
- package/dist/src/scan/caseread.js +263 -0
- package/dist/src/scan/caseread.js.map +1 -0
- package/dist/src/scan/channelfs.d.ts +6 -0
- package/dist/src/scan/channelfs.d.ts.map +1 -0
- package/dist/src/scan/channelfs.js +27 -0
- package/dist/src/scan/channelfs.js.map +1 -0
- package/dist/src/scan/cutrender.d.ts +13 -0
- package/dist/src/scan/cutrender.d.ts.map +1 -0
- package/dist/src/scan/cutrender.js +51 -0
- package/dist/src/scan/cutrender.js.map +1 -0
- package/dist/src/scan/facts.d.ts +72 -0
- package/dist/src/scan/facts.d.ts.map +1 -0
- package/dist/src/scan/facts.js +593 -0
- package/dist/src/scan/facts.js.map +1 -0
- package/dist/src/scan/findings.d.ts +320 -0
- package/dist/src/scan/findings.d.ts.map +1 -0
- package/dist/src/scan/findings.js +948 -0
- package/dist/src/scan/findings.js.map +1 -0
- package/dist/src/scan/ledger.d.ts +116 -0
- package/dist/src/scan/ledger.d.ts.map +1 -0
- package/dist/src/scan/ledger.js +207 -0
- package/dist/src/scan/ledger.js.map +1 -0
- package/dist/src/scan/presentation.d.ts +19 -0
- package/dist/src/scan/presentation.d.ts.map +1 -0
- package/dist/src/scan/presentation.js +9 -0
- package/dist/src/scan/presentation.js.map +1 -0
- package/dist/src/scan/scan.d.ts +354 -0
- package/dist/src/scan/scan.d.ts.map +1 -0
- package/dist/src/scan/scan.js +725 -0
- package/dist/src/scan/scan.js.map +1 -0
- package/dist/src/scan/scanagents.d.ts +23 -0
- package/dist/src/scan/scanagents.d.ts.map +1 -0
- package/dist/src/scan/scanagents.js +99 -0
- package/dist/src/scan/scanagents.js.map +1 -0
- package/dist/src/scan/scanassemble.d.ts +65 -0
- package/dist/src/scan/scanassemble.d.ts.map +1 -0
- package/dist/src/scan/scanassemble.js +93 -0
- package/dist/src/scan/scanassemble.js.map +1 -0
- package/dist/src/scan/scanfs.d.ts +26 -0
- package/dist/src/scan/scanfs.d.ts.map +1 -0
- package/dist/src/scan/scanfs.js +229 -0
- package/dist/src/scan/scanfs.js.map +1 -0
- package/dist/src/scan/scanlease.d.ts +50 -0
- package/dist/src/scan/scanlease.d.ts.map +1 -0
- package/dist/src/scan/scanlease.js +251 -0
- package/dist/src/scan/scanlease.js.map +1 -0
- package/dist/src/scan/scanleaves.d.ts +55 -0
- package/dist/src/scan/scanleaves.d.ts.map +1 -0
- package/dist/src/scan/scanleaves.js +258 -0
- package/dist/src/scan/scanleaves.js.map +1 -0
- package/dist/src/scan/scanports.d.ts +79 -0
- package/dist/src/scan/scanports.d.ts.map +1 -0
- package/dist/src/scan/scanports.js +8 -0
- package/dist/src/scan/scanports.js.map +1 -0
- package/dist/src/scan/scanrender.d.ts +128 -0
- package/dist/src/scan/scanrender.d.ts.map +1 -0
- package/dist/src/scan/scanrender.js +527 -0
- package/dist/src/scan/scanrender.js.map +1 -0
- package/dist/src/scan/scanreport.d.ts +126 -0
- package/dist/src/scan/scanreport.d.ts.map +1 -0
- package/dist/src/scan/scanreport.js +289 -0
- package/dist/src/scan/scanreport.js.map +1 -0
- package/dist/src/scan/scanrun.d.ts +472 -0
- package/dist/src/scan/scanrun.d.ts.map +1 -0
- package/dist/src/scan/scanrun.js +1733 -0
- package/dist/src/scan/scanrun.js.map +1 -0
- package/dist/src/scan/scantree.d.ts +21 -0
- package/dist/src/scan/scantree.d.ts.map +1 -0
- package/dist/src/scan/scantree.js +297 -0
- package/dist/src/scan/scantree.js.map +1 -0
- package/dist/src/scan/scanverbs.d.ts +208 -0
- package/dist/src/scan/scanverbs.d.ts.map +1 -0
- package/dist/src/scan/scanverbs.js +689 -0
- package/dist/src/scan/scanverbs.js.map +1 -0
- package/dist/src/scan/stage2.d.ts +221 -0
- package/dist/src/scan/stage2.d.ts.map +1 -0
- package/dist/src/scan/stage2.js +617 -0
- package/dist/src/scan/stage2.js.map +1 -0
- package/dist/src/scan/stage2request.d.ts +125 -0
- package/dist/src/scan/stage2request.d.ts.map +1 -0
- package/dist/src/scan/stage2request.js +259 -0
- package/dist/src/scan/stage2request.js.map +1 -0
- package/dist/src/scan/textsniff.d.ts +14 -0
- package/dist/src/scan/textsniff.d.ts.map +1 -0
- package/dist/src/scan/textsniff.js +88 -0
- package/dist/src/scan/textsniff.js.map +1 -0
- package/dist/src/scan/unitcut.d.ts +135 -0
- package/dist/src/scan/unitcut.d.ts.map +1 -0
- package/dist/src/scan/unitcut.js +437 -0
- package/dist/src/scan/unitcut.js.map +1 -0
- package/dist/src/scan/unitcutstore.d.ts +155 -0
- package/dist/src/scan/unitcutstore.d.ts.map +1 -0
- package/dist/src/scan/unitcutstore.js +381 -0
- package/dist/src/scan/unitcutstore.js.map +1 -0
- package/dist/src/setupchecklist.d.ts +240 -0
- package/dist/src/setupchecklist.d.ts.map +1 -0
- package/dist/src/setupchecklist.js +407 -0
- package/dist/src/setupchecklist.js.map +1 -0
- package/package.json +7 -3
- package/skills/qcr-review/SKILL.md +24 -0
- package/skills/qcr-scan/SKILL.md +23 -0
- package/skills/qcr-setup/SKILL.md +18 -0
package/dist/src/plugin/args.js
CHANGED
|
@@ -1,18 +1,59 @@
|
|
|
1
|
-
//
|
|
1
|
+
// /qcr-review's arguments, as a person types them after the command:
|
|
2
2
|
//
|
|
3
|
-
// /review
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// --
|
|
13
|
-
// --
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
// /qcr-review [preset] [target] [flags]
|
|
4
|
+
//
|
|
5
|
+
// preset quick | full | security: the first word, when it names one
|
|
6
|
+
// (else the `quickreview.preset` pi setting, else none)
|
|
7
|
+
// target nothing this branch against its base, with its
|
|
8
|
+
// uncommitted changes, as one review
|
|
9
|
+
// 123 | #123 | URL a pull request
|
|
10
|
+
// NAME the branch NAME against its base (its commits)
|
|
11
|
+
// --uncommitted the uncommitted changes alone, against HEAD
|
|
12
|
+
// --base REF the base a branch is reviewed against
|
|
13
|
+
// --preview the plan and the price; nothing runs
|
|
14
|
+
// --json the result as JSON (pi's print mode)
|
|
15
|
+
// --profile NAME review under that profile
|
|
16
|
+
// --limit USD this run's limit (above it the run asks)
|
|
17
|
+
// --repo O/N the PR's repo, when it is not the cwd's
|
|
18
|
+
// --stop stop the review running in this session
|
|
19
|
+
//
|
|
20
|
+
// A preset is the review options the core already takes, named: a lens plan
|
|
21
|
+
// (`[review] preset`, `skip_lenses`) and a scope (`full`). It is never a code
|
|
22
|
+
// path of its own.
|
|
23
|
+
//
|
|
24
|
+
// Retired spellings stay accepted (tests/legacy-acceptance.test.ts), folded
|
|
25
|
+
// to the current ones and never named in the usage: `--full` is the `full`
|
|
26
|
+
// preset, `--branch` the bare command's branch, and `--to LIST` the old
|
|
27
|
+
// destination list, of which only `json` still means anything (a result is
|
|
28
|
+
// always shown and kept, and a post is the posting rule's).
|
|
29
|
+
import { ALL_PASSES } from "../passes.js";
|
|
30
|
+
/** The lenses the security preset keeps; every other lens is skipped. */
|
|
31
|
+
export const SECURITY_LENSES = [
|
|
32
|
+
"pass-baseline",
|
|
33
|
+
"pass-security",
|
|
34
|
+
"pass-data-safety",
|
|
35
|
+
"pass-bounds",
|
|
36
|
+
"pass-contracts",
|
|
37
|
+
"pass-validate",
|
|
38
|
+
];
|
|
39
|
+
function securitySkips() {
|
|
40
|
+
return ALL_PASSES.filter((p) => !SECURITY_LENSES.includes(p));
|
|
41
|
+
}
|
|
42
|
+
/** The presets /qcr-review takes, each as the core's review options. */
|
|
43
|
+
export const REVIEW_PRESETS = {
|
|
44
|
+
/** The default plan at low reasoning: about half the cost and time. */
|
|
45
|
+
quick: { levers: "review.preset=low", full: false },
|
|
46
|
+
/** The full lever plan at the highest reasoning, over the whole target
|
|
47
|
+
* again (what an earlier review left is ignored). */
|
|
48
|
+
full: { levers: "review.preset=max", full: true },
|
|
49
|
+
/** Only the risk lenses the change triggers (security, data safety,
|
|
50
|
+
* bounds, contracts), with the baseline and the validator. */
|
|
51
|
+
security: { levers: `review.skip_lenses=${securitySkips().join("|")}`, full: false },
|
|
52
|
+
};
|
|
53
|
+
export const REVIEW_PRESET_NAMES = Object.keys(REVIEW_PRESETS);
|
|
54
|
+
export const isPresetName = (w) => w !== undefined && REVIEW_PRESET_NAMES.includes(w);
|
|
55
|
+
export const REVIEW_COMMAND_USAGE = `usage: /qcr-review [${REVIEW_PRESET_NAMES.join("|")}] [PR number or URL | BRANCH | --uncommitted] ` +
|
|
56
|
+
"[--base REF] [--preview] [--json] [--profile NAME] [--limit USD] [--repo OWNER/NAME] | /qcr-review --stop";
|
|
16
57
|
/** The words of a command line; double quotes group, nothing else is special. */
|
|
17
58
|
export function splitArgs(line) {
|
|
18
59
|
const out = [];
|
|
@@ -21,15 +62,30 @@ export function splitArgs(line) {
|
|
|
21
62
|
out.push(m[1] ?? m[2]);
|
|
22
63
|
return out;
|
|
23
64
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
65
|
+
/** The destinations the retired `--to` took. */
|
|
66
|
+
const LEGACY_DESTINATIONS = ["terminal", "file", "json", "pr"];
|
|
67
|
+
/** A word that names a pull request: a number, `#N`, or a pull URL. */
|
|
68
|
+
const isPrWord = (w) => /^#?\d+$/.test(w) || /^https?:\/\/\S+\/pull\/\d+/.test(w);
|
|
69
|
+
/**
|
|
70
|
+
* Parse `/qcr-review`'s arguments; a usage error is `{ error }`, `--stop` is
|
|
71
|
+
* `{ stop: true }`. `defaultPreset` is the person's own (pi's settings): a
|
|
72
|
+
* preset typed as the first word wins over it.
|
|
73
|
+
*/
|
|
74
|
+
export function parseReviewCommand(line, defaultPreset = null) {
|
|
26
75
|
const a = splitArgs(line);
|
|
27
|
-
|
|
76
|
+
if (a.length === 1 && a[0] === "--stop")
|
|
77
|
+
return { stop: true };
|
|
78
|
+
let preset = defaultPreset;
|
|
79
|
+
const typed = isPresetName(a[0]);
|
|
80
|
+
if (typed)
|
|
81
|
+
preset = a.shift();
|
|
82
|
+
let word;
|
|
28
83
|
let repo;
|
|
29
84
|
let base;
|
|
30
|
-
let branch = false;
|
|
31
85
|
let uncommitted = false;
|
|
32
|
-
|
|
86
|
+
let full = false;
|
|
87
|
+
let branch = false;
|
|
88
|
+
const cmd = { preview: false, json: false };
|
|
33
89
|
const value = (i, flag) => {
|
|
34
90
|
const v = a[i + 1];
|
|
35
91
|
if (v === undefined || v.startsWith("--"))
|
|
@@ -46,12 +102,6 @@ export function parseReviewCommand(line) {
|
|
|
46
102
|
case "--json":
|
|
47
103
|
cmd.json = true;
|
|
48
104
|
break;
|
|
49
|
-
case "--full":
|
|
50
|
-
cmd.full = true;
|
|
51
|
-
break;
|
|
52
|
-
case "--branch":
|
|
53
|
-
branch = true;
|
|
54
|
-
break;
|
|
55
105
|
case "--uncommitted":
|
|
56
106
|
uncommitted = true;
|
|
57
107
|
break;
|
|
@@ -64,9 +114,6 @@ export function parseReviewCommand(line) {
|
|
|
64
114
|
case "--profile":
|
|
65
115
|
cmd.profile = value(i++, w);
|
|
66
116
|
break;
|
|
67
|
-
case "--to":
|
|
68
|
-
cmd.to = [...cmd.to, ...parseDestinations(value(i++, w))];
|
|
69
|
-
break;
|
|
70
117
|
case "--limit": {
|
|
71
118
|
const n = Number(value(i++, w));
|
|
72
119
|
if (!Number.isFinite(n) || n <= 0)
|
|
@@ -74,12 +121,32 @@ export function parseReviewCommand(line) {
|
|
|
74
121
|
cmd.limitUsd = n;
|
|
75
122
|
break;
|
|
76
123
|
}
|
|
124
|
+
case "--full":
|
|
125
|
+
full = true;
|
|
126
|
+
break;
|
|
127
|
+
case "--branch":
|
|
128
|
+
branch = true;
|
|
129
|
+
break;
|
|
130
|
+
case "--to":
|
|
131
|
+
for (const d of value(i++, w)
|
|
132
|
+
.split(",")
|
|
133
|
+
.map((x) => x.trim())) {
|
|
134
|
+
if (!LEGACY_DESTINATIONS.includes(d))
|
|
135
|
+
throw new Error(`unknown destination ${d || "(empty)"}`);
|
|
136
|
+
if (d === "json")
|
|
137
|
+
cmd.json = true;
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case "--stop":
|
|
141
|
+
throw new Error("--stop goes alone");
|
|
77
142
|
default:
|
|
78
143
|
if (w.startsWith("--"))
|
|
79
144
|
throw new Error(`unknown flag ${w}`);
|
|
80
|
-
if (
|
|
81
|
-
throw new Error(`
|
|
82
|
-
|
|
145
|
+
if (isPresetName(w) && word === undefined && i > 0)
|
|
146
|
+
throw new Error(`the preset goes first: /qcr-review ${w} …`);
|
|
147
|
+
if (word !== undefined)
|
|
148
|
+
throw new Error(`one target at a time (got ${word} and ${w})`);
|
|
149
|
+
word = w;
|
|
83
150
|
}
|
|
84
151
|
}
|
|
85
152
|
}
|
|
@@ -88,20 +155,50 @@ export function parseReviewCommand(line) {
|
|
|
88
155
|
error: `${err instanceof Error ? err.message : String(err)}\n${REVIEW_COMMAND_USAGE}`,
|
|
89
156
|
};
|
|
90
157
|
}
|
|
91
|
-
|
|
92
|
-
|
|
158
|
+
if (full) {
|
|
159
|
+
if (typed && preset !== "full")
|
|
160
|
+
return {
|
|
161
|
+
error: `--full is the full preset, and ${preset} was asked for: pick one\n${REVIEW_COMMAND_USAGE}`,
|
|
162
|
+
};
|
|
163
|
+
preset = "full";
|
|
164
|
+
}
|
|
165
|
+
if (branch && (word !== undefined || uncommitted))
|
|
93
166
|
return {
|
|
94
|
-
error:
|
|
167
|
+
error: `--branch is this branch: a PR, a branch name and --uncommitted are each a whole target\n${REVIEW_COMMAND_USAGE}`,
|
|
168
|
+
};
|
|
169
|
+
const pr = word !== undefined && isPrWord(word) ? word : undefined;
|
|
170
|
+
const head = word !== undefined && pr === undefined ? word : undefined;
|
|
171
|
+
if (word !== undefined && uncommitted)
|
|
172
|
+
return {
|
|
173
|
+
error: `${word} and --uncommitted are each a whole target: pick one\n${REVIEW_COMMAND_USAGE}`,
|
|
95
174
|
};
|
|
96
175
|
if (base !== undefined && (pr !== undefined || uncommitted))
|
|
97
|
-
return { error: `--base goes with
|
|
176
|
+
return { error: `--base goes with a branch review\n${REVIEW_COMMAND_USAGE}` };
|
|
98
177
|
if (repo !== undefined && pr === undefined)
|
|
99
178
|
return { error: `--repo names the PR's repo: give a PR too\n${REVIEW_COMMAND_USAGE}` };
|
|
100
179
|
const target = pr !== undefined
|
|
101
180
|
? { kind: "pr", pr, ...(repo !== undefined ? { repo } : {}) }
|
|
102
181
|
: uncommitted
|
|
103
182
|
? { kind: "uncommitted" }
|
|
104
|
-
: {
|
|
105
|
-
|
|
183
|
+
: {
|
|
184
|
+
kind: "branch",
|
|
185
|
+
...(base !== undefined ? { base } : {}),
|
|
186
|
+
...(head !== undefined ? { head } : { uncommitted: true }),
|
|
187
|
+
};
|
|
188
|
+
return { ...cmd, preset, target };
|
|
189
|
+
}
|
|
190
|
+
/** What a review is of, in the words a person reads ("PR #12 (quick)"). */
|
|
191
|
+
export function reviewLabel(cmd) {
|
|
192
|
+
const t = cmd.target;
|
|
193
|
+
const what = t.kind === "pr"
|
|
194
|
+
? `PR ${/^\d+$/.test(String(t.pr)) ? `#${t.pr}` : String(t.pr)}`
|
|
195
|
+
: t.kind === "uncommitted"
|
|
196
|
+
? "the uncommitted changes"
|
|
197
|
+
: t.kind === "branch" && t.head !== undefined
|
|
198
|
+
? `the branch ${t.head}`
|
|
199
|
+
: t.kind === "branch"
|
|
200
|
+
? "this branch with its uncommitted changes"
|
|
201
|
+
: "the diff";
|
|
202
|
+
return cmd.preset !== null ? `${what} (${cmd.preset})` : what;
|
|
106
203
|
}
|
|
107
204
|
//# sourceMappingURL=args.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/plugin/args.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"args.js","source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C,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAChE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa;YACxB,CAAC,CAAC,yBAAyB;YAC3B,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS;gBAC3C,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE;gBACxB,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ;oBACnB,CAAC,CAAC,0CAA0C;oBAC5C,CAAC,CAAC,UAAU,CAAC;IACvB,OAAO,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":";AAYA,wBAMG"}
|
package/dist/src/plugin/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// The pi plugin's entry, the file the package's `pi.extensions` names: the
|
|
2
2
|
// one place the process's environment, home and standard output become the
|
|
3
|
-
// plugin's config (extensions/quickreview.ts takes them as data)
|
|
3
|
+
// plugin's config (extensions/quickreview.ts takes them as data), and where
|
|
4
|
+
// the process-wide resolve hook for pi's own packages is registered
|
|
5
|
+
// (src/plugin/peers.ts).
|
|
4
6
|
import { homedir } from "node:os";
|
|
5
7
|
import { createQuickReview } from "../../extensions/quickreview.js";
|
|
8
|
+
import { resolvePeersFrom } from "./peers.js";
|
|
6
9
|
import { nodeRunner } from "./runner.js";
|
|
7
10
|
const env = process.env;
|
|
8
11
|
export default createQuickReview({
|
|
@@ -10,5 +13,6 @@ export default createQuickReview({
|
|
|
10
13
|
home: (env["HOME"] ?? "").trim() || homedir(),
|
|
11
14
|
runner: nodeRunner(env),
|
|
12
15
|
print: (text) => void process.stdout.write(text.endsWith("\n") ? text : `${text}\n`),
|
|
16
|
+
peers: (piDir) => void resolvePeersFrom(piDir),
|
|
13
17
|
});
|
|
14
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,oEAAoE;AACpE,yBAAyB;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;AAExB,eAAe,iBAAiB,CAAC;IAC/B,GAAG;IACH,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,OAAO,EAAE;IAC7C,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC;IACvB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC;IACpF,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,gBAAgB,CAAC,KAAK,CAAC;CAC/C,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CoreConfig } from "../reviewconfig.js";
|
|
2
1
|
import type { LoginSummary } from "../engine/auth.js";
|
|
3
2
|
/** What the plugin asks of the host pi's auth, by shape (the extension wires
|
|
4
3
|
* it to `ctx.modelRegistry` and the host's auth file). */
|
|
@@ -12,9 +11,6 @@ export interface HostAuth {
|
|
|
12
11
|
* `minValidityMs` more: it refreshes it if not. Rejects when it cannot. */
|
|
13
12
|
refresh(provider: string, minValidityMs: number): Promise<void>;
|
|
14
13
|
}
|
|
15
|
-
/** The providers the review's sessions run on: every model spec's
|
|
16
|
-
* `provider/` prefix, in first-seen order. */
|
|
17
|
-
export declare function reviewProviders(cfg: Pick<CoreConfig, "models">): string[];
|
|
18
14
|
export type BorrowResult = {
|
|
19
15
|
ok: true;
|
|
20
16
|
refreshed: string[];
|
|
@@ -27,6 +23,14 @@ export type BorrowResult = {
|
|
|
27
23
|
};
|
|
28
24
|
/** The hint for a provider pi has no credential for. */
|
|
29
25
|
export declare function noLoginHint(provider: string, keyed: readonly string[]): string;
|
|
26
|
+
/** The providers a run actually uses for the review's `providers`: each one
|
|
27
|
+
* itself, or its OpenAI twin when only the twin has a credential
|
|
28
|
+
* (modelroute.ts). One reading for the setup checklist and `borrowLogin`, so
|
|
29
|
+
* setup never calls a login missing that a review can run on. */
|
|
30
|
+
export declare function routedProviders(providers: readonly string[], host: Pick<HostAuth, "logins" | "configured">): string[];
|
|
31
|
+
/** Can a run use `provider` at all: an OAuth login (pi refreshes a short one
|
|
32
|
+
* before the run), or any other credential pi has. */
|
|
33
|
+
export declare function canUseProvider(provider: string, host: Pick<HostAuth, "logins" | "configured">): boolean;
|
|
30
34
|
/**
|
|
31
35
|
* Make sure every provider the review needs is usable for `needMs` from now,
|
|
32
36
|
* refreshing a short OAuth login through the host. `marginMs` is added to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/plugin/login.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/plugin/login.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;0DAC0D;AAC1D,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,MAAM,IAAI,YAAY,CAAC;IACvB;2BACuB;IACvB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC;+EAC2E;IAC3E,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,YAAY,GACpB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;qDACiD;IACjD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAS9E;AAED;;;iEAGiE;AACjE,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAAC,GAC5C,MAAM,EAAE,CAUV;AAED;sDACsD;AACtD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAAC,GAC5C,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE;IACnC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CAmCxB"}
|
package/dist/src/plugin/login.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { routeProvider } from "../modelroute.js";
|
|
2
|
-
/** The providers the review's sessions run on: every model spec's
|
|
3
|
-
* `provider/` prefix, in first-seen order. */
|
|
4
|
-
export function reviewProviders(cfg) {
|
|
5
|
-
const m = cfg.models;
|
|
6
|
-
const specs = [
|
|
7
|
-
m.conversation,
|
|
8
|
-
m.default,
|
|
9
|
-
...Object.values(m.tiers),
|
|
10
|
-
...Object.values(m.pass_models),
|
|
11
|
-
];
|
|
12
|
-
const out = [];
|
|
13
|
-
for (const spec of specs) {
|
|
14
|
-
const slash = spec.indexOf("/");
|
|
15
|
-
if (slash <= 0)
|
|
16
|
-
continue;
|
|
17
|
-
const p = spec.slice(0, slash);
|
|
18
|
-
if (!out.includes(p))
|
|
19
|
-
out.push(p);
|
|
20
|
-
}
|
|
21
|
-
return out;
|
|
22
|
-
}
|
|
23
2
|
/** The hint for a provider pi has no credential for. */
|
|
24
3
|
export function noLoginHint(provider, keyed) {
|
|
25
4
|
const keys = keyed.length > 0
|
|
26
5
|
? ` pi has a key for ${keyed.join(", ")}, and the review does not switch models to use it: to review on that provider, set the review's models to it in your qcr config.`
|
|
27
6
|
: "";
|
|
28
7
|
return (`the review runs on ${provider}, and this pi has no login for it. ` +
|
|
29
|
-
`Run /login ${provider} in pi, then /review again.${keys}`);
|
|
8
|
+
`Run /login ${provider} in pi, then /qcr-review again.${keys}`);
|
|
9
|
+
}
|
|
10
|
+
/** The providers a run actually uses for the review's `providers`: each one
|
|
11
|
+
* itself, or its OpenAI twin when only the twin has a credential
|
|
12
|
+
* (modelroute.ts). One reading for the setup checklist and `borrowLogin`, so
|
|
13
|
+
* setup never calls a login missing that a review can run on. */
|
|
14
|
+
export function routedProviders(providers, host) {
|
|
15
|
+
const logins = host.logins();
|
|
16
|
+
const out = [];
|
|
17
|
+
for (const named of providers) {
|
|
18
|
+
const p = routeProvider(named, "", {
|
|
19
|
+
hasCredential: (q) => logins[q] !== undefined || host.configured(q),
|
|
20
|
+
});
|
|
21
|
+
if (!out.includes(p))
|
|
22
|
+
out.push(p);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
/** Can a run use `provider` at all: an OAuth login (pi refreshes a short one
|
|
27
|
+
* before the run), or any other credential pi has. */
|
|
28
|
+
export function canUseProvider(provider, host) {
|
|
29
|
+
return host.logins()[provider]?.type === "oauth" || host.configured(provider);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Make sure every provider the review needs is usable for `needMs` from now,
|
|
@@ -38,14 +38,7 @@ export async function borrowLogin(o) {
|
|
|
38
38
|
const want = o.needMs + o.marginMs;
|
|
39
39
|
const refreshed = [];
|
|
40
40
|
let logins = o.host.logins();
|
|
41
|
-
const providers =
|
|
42
|
-
for (const named of o.providers) {
|
|
43
|
-
const p = routeProvider(named, "", {
|
|
44
|
-
hasCredential: (q) => logins[q] !== undefined || o.host.configured(q),
|
|
45
|
-
});
|
|
46
|
-
if (!providers.includes(p))
|
|
47
|
-
providers.push(p);
|
|
48
|
-
}
|
|
41
|
+
const providers = routedProviders(o.providers, o.host);
|
|
49
42
|
for (const p of providers) {
|
|
50
43
|
const login = logins[p];
|
|
51
44
|
if (login?.type === "oauth") {
|
|
@@ -57,7 +50,7 @@ export async function borrowLogin(o) {
|
|
|
57
50
|
catch (err) {
|
|
58
51
|
return {
|
|
59
52
|
ok: false,
|
|
60
|
-
error: `pi could not refresh your ${p} login (${err instanceof Error ? err.message : String(err)}). Run /login ${p} in pi, then /review again.`,
|
|
53
|
+
error: `pi could not refresh your ${p} login (${err instanceof Error ? err.message : String(err)}). Run /login ${p} in pi, then /qcr-review again.`,
|
|
61
54
|
};
|
|
62
55
|
}
|
|
63
56
|
logins = o.host.logins();
|
|
@@ -65,7 +58,7 @@ export async function borrowLogin(o) {
|
|
|
65
58
|
if (after?.type !== "oauth" || after.expires === null || after.expires < now() + want)
|
|
66
59
|
return {
|
|
67
60
|
ok: false,
|
|
68
|
-
error: `your ${p} login does not last this review's ${Math.round(o.needMs / 60_000)} minutes even after pi refreshed it. Run /login ${p} in pi, then /review again.`,
|
|
61
|
+
error: `your ${p} login does not last this review's ${Math.round(o.needMs / 60_000)} minutes even after pi refreshed it. Run /login ${p} in pi, then /qcr-review again.`,
|
|
69
62
|
};
|
|
70
63
|
refreshed.push(p);
|
|
71
64
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/plugin/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/plugin/login.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyBjD,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,KAAwB;IACpE,MAAM,IAAI,GACR,KAAK,CAAC,MAAM,GAAG,CAAC;QACd,CAAC,CAAC,qBAAqB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kIAAkI;QACzK,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,CACL,sBAAsB,QAAQ,qCAAqC;QACnE,cAAc,QAAQ,kCAAkC,IAAI,EAAE,CAC/D,CAAC;AACJ,CAAC;AAED;;;iEAGiE;AACjE,MAAM,UAAU,eAAe,CAC7B,SAA4B,EAC5B,IAA6C;IAE7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,aAAa,C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E,KAAK,CAAC,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The custom message type the review is shown as. */
|
|
2
|
+
export declare const REVIEW_MESSAGE = "qcr-review";
|
|
3
|
+
/** The answers the post question offers: No first, as pi's own confirm
|
|
4
|
+
* would start on Yes. */
|
|
5
|
+
export declare const KEEP_IT_HERE = "No, keep it here";
|
|
6
|
+
export declare const postAnswer: (dryRun: boolean) => string;
|
|
7
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/plugin/messages.ts"],"names":[],"mappings":"AAKA,sDAAsD;AACtD,eAAO,MAAM,cAAc,eAAe,CAAC;AAE3C;yBACyB;AACzB,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,UAAU,GAAI,QAAQ,OAAO,KAAG,MAGA,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// What the plugin shows of a review in a pi session, in a module of its own:
|
|
2
|
+
// the custom message type and the post question's answers. A host that only
|
|
3
|
+
// shows a review (the app's home) imports this and never the review's
|
|
4
|
+
// runtime.
|
|
5
|
+
/** The custom message type the review is shown as. */
|
|
6
|
+
export const REVIEW_MESSAGE = "qcr-review";
|
|
7
|
+
/** The answers the post question offers: No first, as pi's own confirm
|
|
8
|
+
* would start on Yes. */
|
|
9
|
+
export const KEEP_IT_HERE = "No, keep it here";
|
|
10
|
+
export const postAnswer = (dryRun) => dryRun
|
|
11
|
+
? "Yes, post it (dry run: the review is recorded, not sent)"
|
|
12
|
+
: "Yes, post it as a comment-only review";
|
|
13
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/plugin/messages.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACtE,WAAW;AAEX,sDAAsD;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C;yBACyB;AACzB,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAe,EAAU,EAAE,CACpD,MAAM;IACJ,CAAC,CAAC,0DAA0D;IAC5D,CAAC,CAAC,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The packages the plugin's package.json declares as peers. */
|
|
2
|
+
export declare function declaredPeers(from?: string): string[];
|
|
3
|
+
/** Is `specifier` one of `peers` or a subpath of one? */
|
|
4
|
+
export declare function isPeer(specifier: string, peers: readonly string[]): boolean;
|
|
5
|
+
interface ResolveContext {
|
|
6
|
+
parentURL?: string | undefined;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
type NextResolve = (specifier: string, context?: ResolveContext) => unknown;
|
|
10
|
+
/** The resolve hook: Node's own answer first; a peer Node cannot find from the
|
|
11
|
+
* importer is resolved as if pi at `piDir` imported it. */
|
|
12
|
+
export declare function peerResolve(piDir: string, peers: readonly string[]): (specifier: string, context: ResolveContext, next: NextResolve) => unknown;
|
|
13
|
+
/** Register the hook for this process, once; false where this Node has no
|
|
14
|
+
* `module.registerHooks` or a hook is already in place. */
|
|
15
|
+
export declare function resolvePeersFrom(piDir: string, peers?: readonly string[]): boolean;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=peers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peers.d.ts","sourceRoot":"","sources":["../../../src/plugin/peers.ts"],"names":[],"mappings":"AAmBA,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAwB,GAAG,MAAM,EAAE,CAEtE;AAED,yDAAyD;AACzD,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE3E;AAED,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AACD,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC;AAE5E;2DAC2D;AAC3D,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAW5E;AAID;2DAC2D;AAC3D,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,SAAS,MAAM,EAAoB,GACzC,OAAO,CAQT"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// pi's own packages for the modules the plugin loads with Node's import().
|
|
2
|
+
//
|
|
3
|
+
// pi installs a package without its peer dependencies (`--omit=peer`, on
|
|
4
|
+
// purpose) and hands an extension its own modules through its loader's
|
|
5
|
+
// alias table. That covers the modules the loader loads: the entry and its
|
|
6
|
+
// static imports. The review's SDK is imported later with Node's own
|
|
7
|
+
// import() (src/engine/reviewruntime.ts), and Node resolves its bare
|
|
8
|
+
// specifiers from the plugin's install, where no pi is: ERR_MODULE_NOT_FOUND.
|
|
9
|
+
//
|
|
10
|
+
// The hook below resolves the plugin's declared peers (package.json
|
|
11
|
+
// `peerDependencies`) from the running pi's package dir instead, and only
|
|
12
|
+
// where Node found nothing from the importer. A host that installs pi beside
|
|
13
|
+
// the plugin (the qcr app, the image) never reaches the fallback, so its
|
|
14
|
+
// resolution is unchanged. One pi package dir per process: the first wins.
|
|
15
|
+
import * as nodeModule from "node:module";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
import { pathToFileURL } from "node:url";
|
|
18
|
+
import { declaredPeerRanges } from "./versiongate.js";
|
|
19
|
+
/** The packages the plugin's package.json declares as peers. */
|
|
20
|
+
export function declaredPeers(from = import.meta.url) {
|
|
21
|
+
return Object.keys(declaredPeerRanges(from));
|
|
22
|
+
}
|
|
23
|
+
/** Is `specifier` one of `peers` or a subpath of one? */
|
|
24
|
+
export function isPeer(specifier, peers) {
|
|
25
|
+
return peers.some((p) => specifier === p || specifier.startsWith(`${p}/`));
|
|
26
|
+
}
|
|
27
|
+
/** The resolve hook: Node's own answer first; a peer Node cannot find from the
|
|
28
|
+
* importer is resolved as if pi at `piDir` imported it. */
|
|
29
|
+
export function peerResolve(piDir, peers) {
|
|
30
|
+
const parentURL = pathToFileURL(join(piDir, "package.json")).href;
|
|
31
|
+
return (specifier, context, next) => {
|
|
32
|
+
try {
|
|
33
|
+
return next(specifier, context);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (err.code !== "ERR_MODULE_NOT_FOUND" || !isPeer(specifier, peers))
|
|
37
|
+
throw err;
|
|
38
|
+
return next(specifier, { ...context, parentURL });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const INSTALLED = Symbol.for("qcr.plugin.piPeers");
|
|
43
|
+
/** Register the hook for this process, once; false where this Node has no
|
|
44
|
+
* `module.registerHooks` or a hook is already in place. */
|
|
45
|
+
export function resolvePeersFrom(piDir, peers = declaredPeers()) {
|
|
46
|
+
const g = globalThis;
|
|
47
|
+
const register = nodeModule
|
|
48
|
+
.registerHooks;
|
|
49
|
+
if (g[INSTALLED] !== undefined || typeof register !== "function")
|
|
50
|
+
return false;
|
|
51
|
+
register({ resolve: peerResolve(piDir, peers) });
|
|
52
|
+
g[INSTALLED] = piDir;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=peers.js.map
|
|
@@ -0,0 +1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AC,IAAI,KAAK,sBAAsB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC;gBACzF,MAAM,GAAG,CAAC;YACZ,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAEnD;2DAC2D;AAC3D,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,QAA2B,aAAa,EAAE;IAE1C,MAAM,CAAC,GAAG,UAAqC,CAAC;IAChD,MAAM,QAAQ,GAAI,UAA2E;SAC1F,aAAa,CAAC;IACjB,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IAC/E,QAAQ,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -3,14 +3,14 @@ import { type ReviewRuntimeOptions } from "../engine/reviewruntime.js";
|
|
|
3
3
|
import { preview as corePreview, review as coreReview, type ReviewRuntime } from "../reviewapi.js";
|
|
4
4
|
import type { CoreConfig } from "../reviewconfig.js";
|
|
5
5
|
import type { PluginHost, SessionUi } from "./session.js";
|
|
6
|
-
|
|
7
|
-
export
|
|
6
|
+
import { type QuickReviewSettings } from "./settings.js";
|
|
7
|
+
export { KEEP_IT_HERE, postAnswer, REVIEW_MESSAGE } from "./messages.js";
|
|
8
8
|
/** A review's wall clock, as `qcr review`'s. */
|
|
9
9
|
export declare const REVIEW_TIMEOUT_MS: number;
|
|
10
10
|
/** What a refused login says inside pi: pi's own /login is the fix. */
|
|
11
11
|
export declare const PLUGIN_AUTH_WORDS: AuthCopyWords;
|
|
12
|
-
/** How long a stopped review (
|
|
13
|
-
* before /review gives up waiting on it
|
|
12
|
+
/** How long a stopped review (`--stop`, the session ending) gets to wind
|
|
13
|
+
* down before /qcr-review gives up waiting on it. */
|
|
14
14
|
export declare const STOP_GRACE_MS = 30000;
|
|
15
15
|
/** The seams a test replaces. */
|
|
16
16
|
export interface ReviewCommandDeps {
|
|
@@ -22,6 +22,52 @@ export interface ReviewCommandDeps {
|
|
|
22
22
|
runtime: (cfg: CoreConfig, o: ReviewRuntimeOptions) => ReviewRuntime;
|
|
23
23
|
}
|
|
24
24
|
export declare const REVIEW_DEPS: ReviewCommandDeps;
|
|
25
|
-
/**
|
|
26
|
-
export
|
|
25
|
+
/** What the status line knows of the review in flight. */
|
|
26
|
+
export interface ReviewProgress {
|
|
27
|
+
/** What is reviewed ("PR #12 (quick)", args.ts `reviewLabel`). */
|
|
28
|
+
label: string;
|
|
29
|
+
stage: "pricing" | "preparing" | "running" | "asking" | "posting";
|
|
30
|
+
/** When the command started it (ms). */
|
|
31
|
+
startedAt: number;
|
|
32
|
+
/** From the round's start (`ReviewIo.started`). */
|
|
33
|
+
lenses?: number;
|
|
34
|
+
estimateUsd?: number;
|
|
35
|
+
capUsd?: number | null;
|
|
36
|
+
/** What each running lens is doing, from the round's live log
|
|
37
|
+
* (`liveLensLines`); empty until a lens has started. */
|
|
38
|
+
running?: readonly string[];
|
|
39
|
+
}
|
|
40
|
+
/** The status line for the review in flight: what it reviews, its stage, and
|
|
41
|
+
* what the round's start said (lenses, price, hard stop), with the time
|
|
42
|
+
* since it started. Every status line /qcr-review shows is built here. */
|
|
43
|
+
export declare function reviewStatusLine(p: ReviewProgress, now: number): string;
|
|
44
|
+
/** One line per running lens of the review in `runDir`, read from its live
|
|
45
|
+
* log: none when the log is missing or unreadable, which never costs the
|
|
46
|
+
* review its status line. */
|
|
47
|
+
export declare function liveLensLines(runDir: string, now: number): string[];
|
|
48
|
+
/** The one review a session runs at a time. */
|
|
49
|
+
export declare class ReviewSlot {
|
|
50
|
+
private current;
|
|
51
|
+
/** What is being reviewed now; null when nothing is. */
|
|
52
|
+
get running(): string | null;
|
|
53
|
+
/** Stop the review in flight; what it was reviewing, or null when none runs. */
|
|
54
|
+
stop(): string | null;
|
|
55
|
+
/** Resolves once no review runs. */
|
|
56
|
+
idle(): Promise<void>;
|
|
57
|
+
/** Hold `done` as the review in flight until it settles. */
|
|
58
|
+
hold(label: string, stop: AbortController, done: Promise<void>): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* /qcr-review. Starts the review and returns at once (pi's print mode and a
|
|
62
|
+
* preview wait for it); the review then runs in `slot`, one at a time. Never
|
|
63
|
+
* throws: every refusal reaches the person.
|
|
64
|
+
*/
|
|
65
|
+
export declare function startReviewCommand(line: string, host: PluginHost, ui: SessionUi, o: {
|
|
66
|
+
slot: ReviewSlot;
|
|
67
|
+
deps?: ReviewCommandDeps;
|
|
68
|
+
settings?: QuickReviewSettings;
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
/** One /qcr-review, waited for to its end (its result shown, its post asked):
|
|
71
|
+
* the command's work without the background. */
|
|
72
|
+
export declare function runReviewCommand(line: string, host: PluginHost, ui: SessionUi, deps?: ReviewCommandDeps, settings?: QuickReviewSettings): Promise<void>;
|
|
27
73
|
//# sourceMappingURL=review.d.ts.map
|