co-maintainer 0.7.2-beta.1 → 0.7.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/dist/package.json +2 -1
- package/dist/src/ai/anthropic.d.ts +1 -1
- package/dist/src/ai/anthropic.js +1 -1
- package/dist/src/ai/batch.d.ts +1 -1
- package/dist/src/ai/batch.js +3 -3
- package/dist/src/ai/copy_rule.d.ts +7 -0
- package/dist/src/ai/copy_rule.js +23 -0
- package/dist/src/ai/estimate.js +3 -3
- package/dist/src/ai/fake.js +2 -1
- package/dist/src/ai/mermaid.js +1 -0
- package/dist/src/ai/oauth/registry.d.ts +1 -1
- package/dist/src/ai/oauth/sign-in-with-chatgpt.d.ts +4 -4
- package/dist/src/ai/oauth/sign-in-with-chatgpt.js +6 -6
- package/dist/src/ai/openai.d.ts +3 -3
- package/dist/src/ai/openai.js +4 -4
- package/dist/src/ai/openrouter.d.ts +1 -1
- package/dist/src/ai/openrouter.js +1 -1
- package/dist/src/ai/pricing.js +1 -1
- package/dist/src/ai/provider.d.ts +2 -0
- package/dist/src/ai/provider.js +8 -2
- package/dist/src/ai/verify.d.ts +1 -1
- package/dist/src/ai/verify.js +1 -1
- package/dist/src/cli/args.js +1 -1
- package/dist/src/cli/command_json.d.ts +1 -1
- package/dist/src/cli/commands/config.d.ts +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/oauth.js +1 -1
- package/dist/src/cli/commands/probe.js +1 -1
- package/dist/src/cli/commands/serve.d.ts +1 -1
- package/dist/src/cli/commands/serve.js +1 -1
- package/dist/src/cli/commands/set.d.ts +1 -1
- package/dist/src/cli/commands/set.js +4 -4
- package/dist/src/cli/commands/view.js +2 -2
- package/dist/src/cli/error.d.ts +1 -1
- package/dist/src/cli/error.js +1 -1
- package/dist/src/cli/prompt.d.ts +2 -2
- package/dist/src/cli/prompt.js +3 -3
- package/dist/src/cli/review_args.js +2 -2
- package/dist/src/cli/review_result.d.ts +3 -4
- package/dist/src/cli/review_result.js +5 -8
- package/dist/src/config.d.ts +11 -11
- package/dist/src/config.js +3 -3
- package/dist/src/github/app.d.ts +1 -1
- package/dist/src/github/app.js +1 -1
- package/dist/src/github/app_manifest.d.ts +1 -1
- package/dist/src/github/app_manifest.js +1 -1
- package/dist/src/github/client.d.ts +1 -1
- package/dist/src/github/client.js +1 -1
- package/dist/src/github/gh.js +2 -2
- package/dist/src/github/jwt.d.ts +1 -1
- package/dist/src/github/jwt.js +1 -1
- package/dist/src/github/oauth.js +2 -2
- package/dist/src/knowledge/facts.js +3 -3
- package/dist/src/knowledge/guide.js +7 -7
- package/dist/src/knowledge/probe.js +1 -1
- package/dist/src/knowledge/skill.js +1 -1
- package/dist/src/knowledge/synthesis.js +7 -7
- package/dist/src/local/carry_over_store.d.ts +1 -1
- package/dist/src/local/carry_over_store.js +1 -1
- package/dist/src/local/codegraph_prepare.js +1 -1
- package/dist/src/local/git_ops.js +1 -1
- package/dist/src/local/review_local.js +3 -3
- package/dist/src/local/review_lock.d.ts +1 -1
- package/dist/src/pr/checkout.d.ts +3 -3
- package/dist/src/pr/checkout.js +7 -7
- package/dist/src/pr/codegraph_tool_args.d.ts +1 -1
- package/dist/src/pr/codegraph_tool_args.js +1 -1
- package/dist/src/pr/findings.js +8 -9
- package/dist/src/pr/findings_json.d.ts +2 -2
- package/dist/src/pr/findings_json.js +1 -1
- package/dist/src/pr/github_revision.js +1 -1
- package/dist/src/pr/review_copy.d.ts +2 -3
- package/dist/src/pr/review_copy.js +2 -3
- package/dist/src/pr/reviewer.d.ts +3 -3
- package/dist/src/pr/reviewer.js +24 -26
- package/dist/src/pr/scope.d.ts +8 -8
- package/dist/src/pr/scope.js +4 -4
- package/dist/src/pr/snapshot.d.ts +2 -2
- package/dist/src/remote/client.js +3 -3
- package/dist/src/remote/schema.d.ts +1 -1
- package/dist/src/remote/schema.js +1 -1
- package/dist/src/remote/server/body.d.ts +1 -1
- package/dist/src/remote/server/body.js +1 -1
- package/dist/src/remote/server/guides.js +1 -1
- package/dist/src/remote/validate.js +1 -1
- package/dist/src/review/blocking.d.ts +3 -3
- package/dist/src/review/blocking.js +2 -2
- package/dist/src/review/carry_over.d.ts +1 -1
- package/dist/src/review/carry_over.js +2 -2
- package/dist/src/review/diagram.js +7 -6
- package/dist/src/review/engine.d.ts +1 -1
- package/dist/src/review/guides.js +1 -1
- package/dist/src/review/system_prompt.d.ts +1 -1
- package/dist/src/review/system_prompt.js +1 -1
- package/dist/src/server/api/jobs.js +2 -2
- package/dist/src/server/api/repos.js +1 -1
- package/dist/src/server/app.js +1 -1
- package/dist/src/server/auth.d.ts +3 -3
- package/dist/src/server/auth.js +9 -4
- package/dist/src/server/http.js +5 -5
- package/dist/src/server/pages/activity.js +1 -1
- package/dist/src/server/pages/add_repo.js +1 -0
- package/dist/src/server/pages/client.d.ts +2 -2
- package/dist/src/server/pages/client.js +2 -2
- package/dist/src/server/pages/home.d.ts +1 -1
- package/dist/src/server/pages/home.js +1 -1
- package/dist/src/server/pages/icons.d.ts +1 -1
- package/dist/src/server/pages/icons.js +1 -1
- package/dist/src/server/pages/layout.d.ts +2 -2
- package/dist/src/server/pages/layout.js +3 -3
- package/dist/src/server/pages/pr.js +2 -0
- package/dist/src/server/pages/rate_limit_waits.js +2 -2
- package/dist/src/server/pages/repo_settings.js +1 -0
- package/dist/src/server/pages/router.js +3 -2
- package/dist/src/server/pages/styles.d.ts +2 -2
- package/dist/src/server/pages/styles.js +2 -2
- package/dist/src/server/pages/ui.d.ts +1 -1
- package/dist/src/server/pages/ui.js +2 -2
- package/dist/src/server/webhook/index.js +1 -1
- package/dist/src/services/clear.d.ts +2 -2
- package/dist/src/services/clear.js +2 -2
- package/dist/src/services/probe.js +1 -1
- package/dist/src/services/remote_review_abort.d.ts +1 -1
- package/dist/src/services/remote_review_abort.js +1 -1
- package/dist/src/services/remote_tokens.js +1 -1
- package/dist/src/services/replies.js +0 -2
- package/dist/src/services/review.d.ts +3 -5
- package/dist/src/services/review.js +8 -10
- package/dist/src/services/setup.d.ts +2 -2
- package/dist/src/services/setup.js +9 -9
- package/dist/src/services/watch_comments.js +1 -2
- package/dist/src/services/watch_notes.js +1 -3
- package/dist/src/store/app_db.d.ts +1 -1
- package/dist/src/store/app_db.js +2 -2
- package/dist/src/store/jobs.d.ts +2 -2
- package/dist/src/store/jobs.js +3 -3
- package/dist/src/store/migrations.d.ts +2 -2
- package/dist/src/store/migrations.js +18 -18
- package/dist/src/store/rows.d.ts +2 -2
- package/dist/src/store/rows.js +1 -1
- package/dist/src/store/sessions.d.ts +1 -1
- package/dist/src/store/sessions.js +2 -2
- package/dist/src/store/sqlite.js +2 -2
- package/dist/src/tools/codegraph.d.ts +1 -1
- package/dist/src/tools/codegraph.js +3 -3
- package/dist/src/tools/codegraph_exec.d.ts +1 -1
- package/dist/src/tools/codegraph_exec.js +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/util/keyed_lock.d.ts +1 -1
- package/dist/src/util/keyed_lock.js +1 -1
- package/dist/src/util/log.js +1 -1
- package/dist/src/util/redact.js +2 -1
- package/dist/src/util/run_summary.d.ts +3 -3
- package/dist/src/util/run_summary.js +3 -3
- package/dist/src/util/runtime.d.ts +4 -4
- package/dist/src/util/runtime.js +5 -5
- package/dist/src/util/time.d.ts +1 -1
- package/dist/src/util/time.js +1 -1
- package/package.json +2 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* wrong offsets, because the model's free-form Markdown was sliced by the
|
|
5
5
|
* fallback parser. The fix is to have the model return JSON and generate the
|
|
6
6
|
* Markdown ourselves, so a finding's boundaries can no longer be guessed from
|
|
7
|
-
* prose. Markdown stays the internal contract
|
|
7
|
+
* prose. Markdown stays the internal contract, every downstream consumer
|
|
8
8
|
* (`parseFindings`, carry-over, GitHub posting) keeps working unchanged.
|
|
9
9
|
*/
|
|
10
10
|
import type { Json } from "../types.ts";
|
|
@@ -13,7 +13,7 @@ import type { ParsedFinding } from "./findings.ts";
|
|
|
13
13
|
* get the prompt's instruction to return a fenced JSON block. */
|
|
14
14
|
export declare const FINDINGS_JSON_SCHEMA: Json;
|
|
15
15
|
/** The prompt's contract, kept next to the schema so the two cannot drift. */
|
|
16
|
-
export declare const FINDINGS_JSON_INSTRUCTIONS = "Return a single JSON object, and nothing else, with this shape:\n{\"findings\":[{\"severity\":\"P1\",\"blocking\":true,\"path\":\"src/a.ts\",\"lineFrom\":42,\"lineTo\":42,\"symbol\":\"helper()\",\"title\":\"The helper ignores its argument\",\"body\":\"One sentence on what is wrong and its impact, then a short evidence paragraph.\",\"suggestion\":\"the exact replacement lines, or omit this field\"}],\"previousFindings\":[{\"id\":\"F1\",\"state\":\"open\"}]}\n\nRules for the JSON:\n- \"severity\" is exactly one of P0, P1, P2, P3. \"blocking\" is true or false.\n- \"lineFrom\" and \"lineTo\" are numbers in the new file, copied from the DIFF\n column, never counted from the @@ header. \"lineTo\" may equal \"lineFrom\".\n- \"title\" is one sentence naming the defect, without the severity or the path.\n- \"body\" is the explanation. Do not repeat the title, the path, or the location\n line inside it
|
|
16
|
+
export declare const FINDINGS_JSON_INSTRUCTIONS = "Return a single JSON object, and nothing else, with this shape:\n{\"findings\":[{\"severity\":\"P1\",\"blocking\":true,\"path\":\"src/a.ts\",\"lineFrom\":42,\"lineTo\":42,\"symbol\":\"helper()\",\"title\":\"The helper ignores its argument\",\"body\":\"One sentence on what is wrong and its impact, then a short evidence paragraph.\",\"suggestion\":\"the exact replacement lines, or omit this field\"}],\"previousFindings\":[{\"id\":\"F1\",\"state\":\"open\"}]}\n\nRules for the JSON:\n- \"severity\" is exactly one of P0, P1, P2, P3. \"blocking\" is true or false.\n- \"lineFrom\" and \"lineTo\" are numbers in the new file, copied from the DIFF\n column, never counted from the @@ header. \"lineTo\" may equal \"lineFrom\".\n- \"title\" is one sentence naming the defect, without the severity or the path.\n- \"body\" is the explanation. Do not repeat the title, the path, or the location\n line inside it. Our code renders those. Do not add a closing sentence asking\n whether to explain more, and do not use the words Mechanism, Symptom,\n Scenario, Verified, Repro, Options, or Scope as labels.\n- \"suggestion\" holds only the replacement source lines, with their original\n indentation, when the fix replaces the exact lines lineFrom-lineTo in one\n hunk of the same file. Omit it otherwise. Never wrap it in a code fence.\n- When a fix needs removed lines, another file, or more than one hunk, omit\n \"suggestion\".\n- Return every independently actionable finding, including none: use\n {\"findings\":[]} when the change is clean. Never invent a finding to fill the\n array.";
|
|
17
17
|
/** Reads the structured output and renders it as Markdown. `undefined` means
|
|
18
18
|
* the text was not usable JSON, so the caller falls back to the legacy
|
|
19
19
|
* Markdown parser rather than dropping the review. */
|
|
@@ -56,7 +56,7 @@ Rules for the JSON:
|
|
|
56
56
|
column, never counted from the @@ header. "lineTo" may equal "lineFrom".
|
|
57
57
|
- "title" is one sentence naming the defect, without the severity or the path.
|
|
58
58
|
- "body" is the explanation. Do not repeat the title, the path, or the location
|
|
59
|
-
line inside it
|
|
59
|
+
line inside it. Our code renders those. Do not add a closing sentence asking
|
|
60
60
|
whether to explain more, and do not use the words Mechanism, Symptom,
|
|
61
61
|
Scenario, Verified, Repro, Options, or Scope as labels.
|
|
62
62
|
- "suggestion" holds only the replacement source lines, with their original
|
|
@@ -14,7 +14,7 @@ export function githubFileToRevisionFile(file) {
|
|
|
14
14
|
const additions = Number(file.additions ?? 0);
|
|
15
15
|
const deletions = Number(file.deletions ?? 0);
|
|
16
16
|
const patch = String(file.patch ?? "");
|
|
17
|
-
// GitHub omits large text patches
|
|
17
|
+
// GitHub omits large text patches. Do not treat that as binary.
|
|
18
18
|
const binary = false;
|
|
19
19
|
return {
|
|
20
20
|
path,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** The severity legend and the review-copy rule.
|
|
2
2
|
*
|
|
3
3
|
* Product text avoids the em dash and the semicolon: the docs linter rejects
|
|
4
|
-
* them, and the finding parser had to accept both a
|
|
4
|
+
* them, and the finding parser had to accept both a dash and a `:` heading
|
|
5
5
|
* separator only because the prompt itself modelled the em dash. The colon is
|
|
6
|
-
* the one separator now.
|
|
7
|
-
* comments posted before 0.5.0 stay readable. */
|
|
6
|
+
* the one separator now. */
|
|
8
7
|
/** `[P2] path: symbol` headings and `Summary: 3 new, 1 open, ...` lines are
|
|
9
8
|
* built from this legend, so the four levels read the same everywhere. */
|
|
10
9
|
export declare const SEVERITY_LEGEND: ReadonlyArray<{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** The severity legend and the review-copy rule.
|
|
2
2
|
*
|
|
3
3
|
* Product text avoids the em dash and the semicolon: the docs linter rejects
|
|
4
|
-
* them, and the finding parser had to accept both a
|
|
4
|
+
* them, and the finding parser had to accept both a dash and a `:` heading
|
|
5
5
|
* separator only because the prompt itself modelled the em dash. The colon is
|
|
6
|
-
* the one separator now.
|
|
7
|
-
* comments posted before 0.5.0 stay readable. */
|
|
6
|
+
* the one separator now. */
|
|
8
7
|
/** `[P2] path: symbol` headings and `Summary: 3 new, 1 open, ...` lines are
|
|
9
8
|
* built from this legend, so the four levels read the same everywhere. */
|
|
10
9
|
export const SEVERITY_LEGEND = [
|
|
@@ -55,7 +55,7 @@ export type ReviewOutcome = AiResponse & {
|
|
|
55
55
|
* the review itself. A server with no low model configured summarized with
|
|
56
56
|
* the review's provider before, and still does, so no review fails for it. */
|
|
57
57
|
export declare function summaryProvider(options: Options, reviewAi: AiProvider, report: ProgressSink, extras?: ReviewExtras): AiProvider;
|
|
58
|
-
export declare const MERMAID_GUIDANCE = "Mermaid selection and minimal syntax:\nflowchart = decisions, branches, pipelines, and fallback paths
|
|
58
|
+
export declare const MERMAID_GUIDANCE = "Mermaid selection and minimal syntax:\nflowchart = decisions, branches, pipelines, and fallback paths.\nswimlane-beta = work crossing owners, actors, services, teams, or layers.\nsequenceDiagram = ordered calls, webhooks, retries, responses, and timing.\nclassDiagram = class, interface, type, inheritance, or composition relationships.\nstateDiagram-v2 = lifecycle and state transitions.\nerDiagram = database entities, keys, and cardinality.\nrequirementDiagram = requirements linked to tests or implementation.\nusecase-beta = actors and system capabilities.\nC4Context = users, systems, boundaries, and integrations.\nzenuml = compact nested call sequences.\npacket = binary fields, bit ranges, and protocol layout.\narchitecture-beta = services, containers, storage, and deployment topology.\neventmodeling = commands, events, processors, read models, and timelines.\ntreeView-beta = directory, file, module, or dependency hierarchy.\nIf a diagram is useful, call read-mermaid-syntaxes before writing any Mermaid.\nRequest every type you need in a single call, because repeated tool rounds are\ncapped. Use the smallest type that matches the evidence.";
|
|
59
59
|
/** Without tool support the model cannot read the Mermaid syntax docs, so
|
|
60
60
|
* asking for a diagram only invites invented syntax. */
|
|
61
61
|
export declare const NO_DIAGRAM_RULES = "Do not use Mermaid or any other diagram. Explain with prose only.";
|
|
@@ -63,7 +63,7 @@ export declare function reviewSystemPrompt(diagrams: boolean, options?: Options)
|
|
|
63
63
|
/** The guide block every review sends, kept as the stable head of the system
|
|
64
64
|
* prompt rather than the user prompt so a provider with prompt caching
|
|
65
65
|
* (Anthropic's `cache_control`) reads it instead of re-billing it. Nothing
|
|
66
|
-
* time-varying may enter this string
|
|
66
|
+
* time-varying may enter this string, a single differing byte makes the cache
|
|
67
67
|
* miss. */
|
|
68
68
|
export declare function reviewGuidesBlock(guide: string, detailed: string, codebase: string, instructions?: string): string;
|
|
69
69
|
/** Shared PR and local/remote workspace review instructions: confirm claims
|
|
@@ -74,5 +74,5 @@ export declare function clampImproveMatrix(matrix: number): number;
|
|
|
74
74
|
export declare function readGuide(repo: string, name: string): Promise<string>;
|
|
75
75
|
export type { Snapshot };
|
|
76
76
|
export declare function reviewPullRequest(client: GitHubClient, options: Options, usage?: UsageSink, snapshot?: Snapshot, ai?: AiProvider, progress?: ProgressSink, extras?: ReviewExtras): Promise<ReviewOutcome>;
|
|
77
|
-
/** Local workspace review
|
|
77
|
+
/** Local workspace review, same prompt loop as PR review without GitHub. */
|
|
78
78
|
export declare function reviewWorkspaceRevision(revision: Revision, options: Options, headSha: string, usage?: UsageSink, ai?: AiProvider, progress?: ProgressSink, extras?: ReviewExtras): Promise<ReviewOutcome>;
|
package/dist/src/pr/reviewer.js
CHANGED
|
@@ -5,7 +5,7 @@ import { loadGuides } from "../review/guides.js";
|
|
|
5
5
|
import { notInitializedError } from "../review/not_initialized.js";
|
|
6
6
|
import { computeScope } from "./scope.js";
|
|
7
7
|
import { prepareCodegraphTools } from "./codegraph_tools.js";
|
|
8
|
-
import {
|
|
8
|
+
import { severitySection } from "./review_copy.js";
|
|
9
9
|
import { repositoryInstructionsBlock, reviewSystemPromptBlock, } from "../review/system_prompt.js";
|
|
10
10
|
import { readDiffMaxChars } from "./diff_summary.js";
|
|
11
11
|
import { intentField, intentPromptNote } from "../review/intent.js";
|
|
@@ -78,19 +78,19 @@ function diffReport(chars, coverage) {
|
|
|
78
78
|
return `diff prepared · ${chars} chars${coverageTruncated(coverage) ? ` · ${coverageCounts(coverage)}` : ""}`;
|
|
79
79
|
}
|
|
80
80
|
export const MERMAID_GUIDANCE = `Mermaid selection and minimal syntax:
|
|
81
|
-
flowchart = decisions, branches, pipelines, and fallback paths
|
|
82
|
-
swimlane-beta = work crossing owners, actors, services, teams, or layers
|
|
83
|
-
sequenceDiagram = ordered calls, webhooks, retries, responses, and timing
|
|
84
|
-
classDiagram = class, interface, type, inheritance, or composition relationships
|
|
85
|
-
stateDiagram-v2 = lifecycle and state transitions
|
|
86
|
-
erDiagram = database entities, keys, and cardinality
|
|
87
|
-
requirementDiagram = requirements linked to tests or implementation
|
|
88
|
-
usecase-beta = actors and system capabilities
|
|
89
|
-
C4Context = users, systems, boundaries, and integrations
|
|
90
|
-
zenuml = compact nested call sequences
|
|
91
|
-
packet = binary fields, bit ranges, and protocol layout
|
|
92
|
-
architecture-beta = services, containers, storage, and deployment topology
|
|
93
|
-
eventmodeling = commands, events, processors, read models, and timelines
|
|
81
|
+
flowchart = decisions, branches, pipelines, and fallback paths.
|
|
82
|
+
swimlane-beta = work crossing owners, actors, services, teams, or layers.
|
|
83
|
+
sequenceDiagram = ordered calls, webhooks, retries, responses, and timing.
|
|
84
|
+
classDiagram = class, interface, type, inheritance, or composition relationships.
|
|
85
|
+
stateDiagram-v2 = lifecycle and state transitions.
|
|
86
|
+
erDiagram = database entities, keys, and cardinality.
|
|
87
|
+
requirementDiagram = requirements linked to tests or implementation.
|
|
88
|
+
usecase-beta = actors and system capabilities.
|
|
89
|
+
C4Context = users, systems, boundaries, and integrations.
|
|
90
|
+
zenuml = compact nested call sequences.
|
|
91
|
+
packet = binary fields, bit ranges, and protocol layout.
|
|
92
|
+
architecture-beta = services, containers, storage, and deployment topology.
|
|
93
|
+
eventmodeling = commands, events, processors, read models, and timelines.
|
|
94
94
|
treeView-beta = directory, file, module, or dependency hierarchy.
|
|
95
95
|
If a diagram is useful, call read-mermaid-syntaxes before writing any Mermaid.
|
|
96
96
|
Request every type you need in a single call, because repeated tool rounds are
|
|
@@ -131,7 +131,7 @@ ${diagrams ? (plantumlSystemRules(options) ?? REVIEW_DIAGRAM_RULES) : NO_DIAGRAM
|
|
|
131
131
|
/** The guide block every review sends, kept as the stable head of the system
|
|
132
132
|
* prompt rather than the user prompt so a provider with prompt caching
|
|
133
133
|
* (Anthropic's `cache_control`) reads it instead of re-billing it. Nothing
|
|
134
|
-
* time-varying may enter this string
|
|
134
|
+
* time-varying may enter this string, a single differing byte makes the cache
|
|
135
135
|
* miss. */
|
|
136
136
|
export function reviewGuidesBlock(guide, detailed, codebase, instructions = "") {
|
|
137
137
|
return `REVIEW GUIDE:
|
|
@@ -158,7 +158,7 @@ when a tool can answer. A missing regression test is not a substitute for
|
|
|
158
158
|
identifying the concrete input or code path that misbehaves when you can.`;
|
|
159
159
|
/** Turns a model reply into the Markdown every consumer already parses.
|
|
160
160
|
* A reply that is not usable JSON is retried once with an
|
|
161
|
-
* explicit reminder
|
|
161
|
+
* explicit reminder, if that also fails, the raw text is returned so the
|
|
162
162
|
* legacy Markdown parser can still read it. This keeps a provider that ignores
|
|
163
163
|
* `response_format` working, and never drops a review on the floor. */
|
|
164
164
|
async function normalizeReviewResponse(provider, request, response, extraTools, maxToolRounds, usage, report, options) {
|
|
@@ -255,9 +255,9 @@ export async function reviewPullRequest(client, options, usage, snapshot, ai, pr
|
|
|
255
255
|
console.log(`[debug] PR #${number} · comments=${comments.length} · reviews=${reviews.length} · files=${files.length}`);
|
|
256
256
|
}
|
|
257
257
|
// What the author actually wrote this round, as opposed to code that
|
|
258
|
-
// arrived by merging the default branch in
|
|
258
|
+
// arrived by merging the default branch in, see scope.ts. A re-review
|
|
259
259
|
// round's diff regularly carries a `merge main` that dwarfs the PR's own
|
|
260
|
-
// change and that no human reviewer reads either
|
|
260
|
+
// change and that no human reviewer reads either, --review-upstream turns
|
|
261
261
|
// this off and reviews everything, matching the pre-scope behavior.
|
|
262
262
|
const headSha = snapshot?.commit ?? String(pr.head?.sha ?? "");
|
|
263
263
|
const baseRevision = snapshot?.base ?? String(pr.base?.ref ?? "main");
|
|
@@ -309,7 +309,7 @@ export async function reviewPullRequest(client, options, usage, snapshot, ai, pr
|
|
|
309
309
|
report(`codegraph tools · ${codegraphTools.length > 0 ? "ready" : "unavailable"}`);
|
|
310
310
|
}
|
|
311
311
|
const extraTools = [...codegraphTools, ...prepared.tools];
|
|
312
|
-
// Bigger own-scope diffs need more codegraph round-trips to trace
|
|
312
|
+
// Bigger own-scope diffs need more codegraph round-trips to trace, fixed
|
|
313
313
|
// at 3 rounds regardless of size caused the model to run out mid-review on
|
|
314
314
|
// large PRs (verified via a tokio benchmark run: it hallucinated fake
|
|
315
315
|
// tool-call text instead of a finding once tools were dropped).
|
|
@@ -346,12 +346,12 @@ Do not invent requirements. Ignore bot noise and historical PR identities.
|
|
|
346
346
|
Reason thoroughly, then answer with the JSON object described below and nothing
|
|
347
347
|
else. There is no fixed number of findings. Return every independently
|
|
348
348
|
actionable finding supported by the diff and guide, including zero findings
|
|
349
|
-
when appropriate. Do not stop early
|
|
349
|
+
when appropriate. Do not stop early. Inspect all supplied diff text first and
|
|
350
350
|
return the natural count. If the diff contains a truncation marker, limit
|
|
351
351
|
claims to the supplied text and do not imply that omitted files were reviewed.
|
|
352
352
|
Do not invent low-value findings.
|
|
353
353
|
When the DIFF section below has an UPSTREAM CONTEXT part, that code arrived
|
|
354
|
-
through a merge and was not authored by this pull request
|
|
354
|
+
through a merge and was not authored by this pull request. Do not raise a
|
|
355
355
|
finding located only there, and never mark blocking a finding whose only
|
|
356
356
|
support is upstream context.
|
|
357
357
|
${CODEGRAPH_DIFF_VERIFICATION}
|
|
@@ -360,7 +360,6 @@ suggestion. Write prose only: do not emit Markdown headings, a Location line,
|
|
|
360
360
|
backticks around the path, or the sentence "If you'd like me to explain it in
|
|
361
361
|
more detail, please ask." Our code renders the heading, the location, and the
|
|
362
362
|
suggestion from your JSON fields. Use P0-P3 severity, and true for blocking.
|
|
363
|
-
${REVIEW_COPY_RULE}
|
|
364
363
|
Every diff line in the DIFF section starts with its line number in the new
|
|
365
364
|
file. Copy "lineFrom" and "lineTo" from that column instead of counting from
|
|
366
365
|
the @@ header. Removed lines have no number, so anchor a finding about removed
|
|
@@ -409,7 +408,7 @@ ${diff}`;
|
|
|
409
408
|
if (!response.text.trim()) {
|
|
410
409
|
throw new Error(`${aiProviderName(options)} returned an empty review. The reasoning budget may have been exhausted`);
|
|
411
410
|
}
|
|
412
|
-
// The model returns JSON
|
|
411
|
+
// The model returns JSON. We render the Markdown. A reply
|
|
413
412
|
// that is not usable JSON is retried once and then falls back to the legacy
|
|
414
413
|
// Markdown parser, so a provider that ignores the schema still works.
|
|
415
414
|
let reviewText = await normalizeReviewResponse(provider, request, response, extraTools, maxToolRounds, usage, report, options);
|
|
@@ -462,7 +461,7 @@ ${reviewText}`,
|
|
|
462
461
|
diffStats: diffStats(named.map(({ file }) => diffFileFromGithub(file))),
|
|
463
462
|
};
|
|
464
463
|
}
|
|
465
|
-
/** Local workspace review
|
|
464
|
+
/** Local workspace review, same prompt loop as PR review without GitHub. */
|
|
466
465
|
export async function reviewWorkspaceRevision(revision, options, headSha, usage, ai, progress, extras) {
|
|
467
466
|
const report = progress ?? (() => { });
|
|
468
467
|
report(modelSummary(options));
|
|
@@ -511,7 +510,6 @@ Do not invent low-value findings. If the diff contains a truncation marker or a
|
|
|
511
510
|
file is summarized, limit claims to the supplied text and use read-full-diff or
|
|
512
511
|
codegraph tools before asserting behavior outside what was shown.
|
|
513
512
|
${CODEGRAPH_DIFF_VERIFICATION}
|
|
514
|
-
${REVIEW_COPY_RULE}
|
|
515
513
|
${diagrams ? (plantumlPromptRules(options) ?? DIAGRAM_PROMPT_RULES) : NO_DIAGRAM_RULES}
|
|
516
514
|
${FINDINGS_JSON_INSTRUCTIONS}
|
|
517
515
|
|
|
@@ -549,7 +547,7 @@ ${ownDiff}${unchangedListing}`;
|
|
|
549
547
|
prompt: `Audit the draft review below against the complete diff and guides.
|
|
550
548
|
Preserve valid findings, correct inaccurate ones, remove duplicate or
|
|
551
549
|
unsupported ones, and add every missing actionable finding. Re-check each
|
|
552
|
-
finding with codegraph when it depends on behavior outside the diff
|
|
550
|
+
finding with codegraph when it depends on behavior outside the diff. Remove
|
|
553
551
|
findings that only looked plausible from the diff slice.
|
|
554
552
|
Return the complete revised review as the same JSON object, and nothing else.
|
|
555
553
|
|
package/dist/src/pr/scope.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { type Run } from "./checkout.ts";
|
|
|
2
2
|
/** What a pull request's author actually wrote this round, as opposed to code
|
|
3
3
|
* that arrived by merging the default branch in. A re-review round's diff
|
|
4
4
|
* regularly includes a `merge main` a human reviewer never reads and a bot
|
|
5
|
-
* should not either
|
|
5
|
+
* should not either, one measured case in this repo's own benchmark had a
|
|
6
6
|
* round diff of 48 files where the author's own commits touched 5. Findings
|
|
7
|
-
* belong in the own set
|
|
7
|
+
* belong in the own set. Upstream code is context, shown but not policed,
|
|
8
8
|
* because the author's own change can still interact badly with it. */
|
|
9
9
|
export type ScopeResult = {
|
|
10
10
|
/** Files touched by a commit the author made this round: their own
|
|
11
11
|
* non-merge commits, plus the conflict-resolution hunks of any merge they
|
|
12
|
-
* made. A clean "merge main in" contributes nothing here
|
|
12
|
+
* made. A clean "merge main in" contributes nothing here, `--cc` only
|
|
13
13
|
* surfaces lines that differ from every parent, which is exactly the part
|
|
14
14
|
* a human resolved by hand. */
|
|
15
15
|
ownFiles: Set<string>;
|
|
16
|
-
/** Everything else touched between the round's boundary and its head
|
|
16
|
+
/** Everything else touched between the round's boundary and its head,
|
|
17
17
|
* code that arrived via a merge and was not authored this round. */
|
|
18
18
|
upstreamFiles: Set<string>;
|
|
19
19
|
defaultBranch: string;
|
|
@@ -21,13 +21,13 @@ export type ScopeResult = {
|
|
|
21
21
|
mergeCommits: number;
|
|
22
22
|
};
|
|
23
23
|
/** The scope algorithm against a clone that is already on disk. Split out from
|
|
24
|
-
* `computeScope` so a caller that already manages its own clone
|
|
25
|
-
* benchmark's OCR runner has its own, separate from co-maintainer's
|
|
24
|
+
* `computeScope` so a caller that already manages its own clone, the
|
|
25
|
+
* benchmark's OCR runner has its own, separate from co-maintainer's, can run
|
|
26
26
|
* the identical algorithm without a second clone of the same repository. */
|
|
27
27
|
export declare function scopeInClone(clone: string, base: string, head: string, run?: Run, remote?: string): Promise<ScopeResult | undefined>;
|
|
28
28
|
/** Clones (or reuses) `repo` under co-maintainer's own cache and runs the
|
|
29
|
-
* scope algorithm against it. Returns `undefined` on any failure
|
|
30
|
-
* an unresolvable commit, no default branch to compare against
|
|
29
|
+
* scope algorithm against it. Returns `undefined` on any failure, no clone,
|
|
30
|
+
* an unresolvable commit, no default branch to compare against, so the
|
|
31
31
|
* caller's fallback is always "review everything, unscoped", never a broken
|
|
32
32
|
* review. */
|
|
33
33
|
export declare function computeScope(repo: string, base: string, head: string, options?: {
|
package/dist/src/pr/scope.js
CHANGED
|
@@ -8,8 +8,8 @@ function lines(output) {
|
|
|
8
8
|
.filter(Boolean);
|
|
9
9
|
}
|
|
10
10
|
/** The scope algorithm against a clone that is already on disk. Split out from
|
|
11
|
-
* `computeScope` so a caller that already manages its own clone
|
|
12
|
-
* benchmark's OCR runner has its own, separate from co-maintainer's
|
|
11
|
+
* `computeScope` so a caller that already manages its own clone, the
|
|
12
|
+
* benchmark's OCR runner has its own, separate from co-maintainer's, can run
|
|
13
13
|
* the identical algorithm without a second clone of the same repository. */
|
|
14
14
|
export async function scopeInClone(clone, base, head, run = runCommand, remote = "origin") {
|
|
15
15
|
let baseSha;
|
|
@@ -64,8 +64,8 @@ export async function scopeInClone(clone, base, head, run = runCommand, remote =
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
/** Clones (or reuses) `repo` under co-maintainer's own cache and runs the
|
|
67
|
-
* scope algorithm against it. Returns `undefined` on any failure
|
|
68
|
-
* an unresolvable commit, no default branch to compare against
|
|
67
|
+
* scope algorithm against it. Returns `undefined` on any failure, no clone,
|
|
68
|
+
* an unresolvable commit, no default branch to compare against, so the
|
|
69
69
|
* caller's fallback is always "review everything, unscoped", never a broken
|
|
70
70
|
* review. */
|
|
71
71
|
export async function computeScope(repo, base, head, options = {}) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Pins a review to a historical diff/discussion state instead of the PR's
|
|
2
|
-
* current (latest) state
|
|
2
|
+
* current (latest) state, used by the benchmarks to show the model exactly
|
|
3
3
|
* what a human reviewer saw, without leaking later comments as hints.
|
|
4
4
|
* `base` defaults to the PR's merge-base with its base branch (the whole PR
|
|
5
|
-
* so far)
|
|
5
|
+
* so far). Pass an earlier review round's commit as `base` to show only the
|
|
6
6
|
* incremental diff a re-reviewer would see since that round (P11). */
|
|
7
7
|
export type Snapshot = {
|
|
8
8
|
base?: string;
|
|
@@ -162,7 +162,7 @@ export async function runRemoteReview(cli) {
|
|
|
162
162
|
gitRoot: root,
|
|
163
163
|
enabled: !cli.disableCodegraph,
|
|
164
164
|
allowInstall: cli.allowToolInstall,
|
|
165
|
-
// `--json` must stay machine-readable
|
|
165
|
+
// `--json` must stay machine-readable, `canPrompt` adds TTY and CI.
|
|
166
166
|
interactive: !cli.json && canPrompt(),
|
|
167
167
|
});
|
|
168
168
|
const localTools = toolHandlerMap(codegraphPrep.tools);
|
|
@@ -188,7 +188,7 @@ export async function runRemoteReview(cli) {
|
|
|
188
188
|
files: built.revision.files,
|
|
189
189
|
},
|
|
190
190
|
capabilities: { tools: capabilityTools },
|
|
191
|
-
// Only present when this run turned BYOK on
|
|
191
|
+
// Only present when this run turned BYOK on, `byokKey` is
|
|
192
192
|
// known to be set here because of the earlier `byokEnabled` guard.
|
|
193
193
|
...(byokEnabled ? { byok: { key: byokKey } } : {}),
|
|
194
194
|
// The client's one-run instructions, when given. The server applies
|
|
@@ -219,7 +219,7 @@ export async function runRemoteReview(cli) {
|
|
|
219
219
|
let afterLogSeq = 0;
|
|
220
220
|
let toolResults = [];
|
|
221
221
|
let toolCallsRun = 0;
|
|
222
|
-
// A trustworthy server drives at most a few tool rounds
|
|
222
|
+
// A trustworthy server drives at most a few tool rounds. Cap the total so a
|
|
223
223
|
// malicious one cannot make the client read its tree without limit.
|
|
224
224
|
const MAX_REMOTE_TOOL_CALLS = 200;
|
|
225
225
|
const intervalMs = hs.sync.intervalSeconds * 1000;
|
|
@@ -10,7 +10,7 @@ export declare const REMOTE_SYNC_INTERVAL_SECONDS = 3;
|
|
|
10
10
|
* repository's own cap is applied on the server. Guards the body size. */
|
|
11
11
|
export declare const REMOTE_MAX_SYSTEM_PROMPT_CHARS = 200000;
|
|
12
12
|
/** SHA-256 of sorted `fixtures/v<N>/*.json` (name + contents, `\r\n` normalized
|
|
13
|
-
* to `\n`)
|
|
13
|
+
* to `\n`). Bump with schema version. */
|
|
14
14
|
export declare const REMOTE_FIXTURE_HASH: Record<number, string>;
|
|
15
15
|
export declare const REMOTE_SYNC_STATUSES: readonly ["queued", "running", "done", "failed", "canceled"];
|
|
16
16
|
export type RemoteSyncStatus = (typeof REMOTE_SYNC_STATUSES)[number];
|
|
@@ -10,7 +10,7 @@ export const REMOTE_SYNC_INTERVAL_SECONDS = 3;
|
|
|
10
10
|
* repository's own cap is applied on the server. Guards the body size. */
|
|
11
11
|
export const REMOTE_MAX_SYSTEM_PROMPT_CHARS = 200_000;
|
|
12
12
|
/** SHA-256 of sorted `fixtures/v<N>/*.json` (name + contents, `\r\n` normalized
|
|
13
|
-
* to `\n`)
|
|
13
|
+
* to `\n`). Bump with schema version. */
|
|
14
14
|
export const REMOTE_FIXTURE_HASH = {
|
|
15
15
|
1: "71e4e5f8637eab4b53d47817a688812a517310d967abe26aa0d7f4e7d7d65092",
|
|
16
16
|
};
|
|
@@ -14,7 +14,7 @@ export type BoundedBodyResult = {
|
|
|
14
14
|
reason: "too_large" | "empty";
|
|
15
15
|
};
|
|
16
16
|
/** Reads the raw body, streaming, and refuses once more than `maxBytes` have
|
|
17
|
-
* arrived
|
|
17
|
+
* arrived, this holds with no Content-Length (chunked) too. The caller gets
|
|
18
18
|
* the exact bytes, which the webhook HMAC needs. */
|
|
19
19
|
export declare function readBoundedBytes(request: Request, maxBytes: number): Promise<BoundedBytesResult>;
|
|
20
20
|
export declare function readBoundedUtf8(request: Request, maxBytes: number): Promise<BoundedBodyResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Bounded request body read (bytes, streaming). */
|
|
2
2
|
/** Reads the raw body, streaming, and refuses once more than `maxBytes` have
|
|
3
|
-
* arrived
|
|
3
|
+
* arrived, this holds with no Content-Length (chunked) too. The caller gets
|
|
4
4
|
* the exact bytes, which the webhook HMAC needs. */
|
|
5
5
|
export async function readBoundedBytes(request, maxBytes) {
|
|
6
6
|
const lengthHeader = request.headers.get("content-length");
|
|
@@ -243,7 +243,7 @@ export function validateSubmitRequest(body) {
|
|
|
243
243
|
if (typeof tool.name !== "string" || !tool.name) {
|
|
244
244
|
return bad(`capabilities.tools[${i}].name`, "required");
|
|
245
245
|
}
|
|
246
|
-
// Unknown tools are ignored at runtime
|
|
246
|
+
// Unknown tools are ignored at runtime. No error here.
|
|
247
247
|
if (REMOTE_KNOWN_TOOL_NAMES.has(tool.name) &&
|
|
248
248
|
tool.version !== undefined &&
|
|
249
249
|
typeof tool.version !== "string") {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* The same pull request was reviewed twice, the same P2 finding came back
|
|
4
4
|
* `non-blocking` the first time and `blocking` the second, and the exit code
|
|
5
5
|
* changed because the model's own label moved. `model` keeps that behavior
|
|
6
|
-
* (the model decides) because it is what 0.4.13 shipped
|
|
6
|
+
* (the model decides) because it is what 0.4.13 shipped, `severity` ignores
|
|
7
7
|
* the model's label and uses a fixed threshold, so the same finding set always
|
|
8
8
|
* yields the same exit code.
|
|
9
9
|
*
|
|
10
10
|
* This is the one place that answers "does this finding block". Every review
|
|
11
|
-
* path
|
|
11
|
+
* path, local, PR, remote and the GitHub App, calls it, so the modes cannot
|
|
12
12
|
* drift apart.
|
|
13
13
|
*/
|
|
14
14
|
export type ReviewBlocking = "model" | "severity";
|
|
@@ -17,7 +17,7 @@ export declare const DEFAULT_REVIEW_BLOCKING: ReviewBlocking;
|
|
|
17
17
|
* so an unset or mistyped value never silently tightens the rule. */
|
|
18
18
|
export declare function reviewBlockingFrom(value: unknown): ReviewBlocking;
|
|
19
19
|
/** One finding, in the shape any of the review paths happens to have. Only
|
|
20
|
-
* `severity` is always available
|
|
20
|
+
* `severity` is always available. The other two describe the model's own
|
|
21
21
|
* claim, which `severity` mode ignores. */
|
|
22
22
|
export type BlockingInput = {
|
|
23
23
|
severity?: string;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* The same pull request was reviewed twice, the same P2 finding came back
|
|
4
4
|
* `non-blocking` the first time and `blocking` the second, and the exit code
|
|
5
5
|
* changed because the model's own label moved. `model` keeps that behavior
|
|
6
|
-
* (the model decides) because it is what 0.4.13 shipped
|
|
6
|
+
* (the model decides) because it is what 0.4.13 shipped, `severity` ignores
|
|
7
7
|
* the model's label and uses a fixed threshold, so the same finding set always
|
|
8
8
|
* yields the same exit code.
|
|
9
9
|
*
|
|
10
10
|
* This is the one place that answers "does this finding block". Every review
|
|
11
|
-
* path
|
|
11
|
+
* path, local, PR, remote and the GitHub App, calls it, so the modes cannot
|
|
12
12
|
* drift apart.
|
|
13
13
|
*/
|
|
14
14
|
export const DEFAULT_REVIEW_BLOCKING = "model";
|
|
@@ -48,7 +48,7 @@ export declare function relocate(anchorText: string | null, oldFrom: number, pat
|
|
|
48
48
|
to: number;
|
|
49
49
|
} | null;
|
|
50
50
|
/** A guide rebuilt after the previous review invalidates that
|
|
51
|
-
* review's verdicts, its "unchanged" suppression and its open findings
|
|
51
|
+
* review's verdicts, its "unchanged" suppression and its open findings, they
|
|
52
52
|
* were all judged against the old rules. Such a run starts fresh instead:
|
|
53
53
|
* every file is scanned again and old findings are no longer carried over.
|
|
54
54
|
*
|
|
@@ -71,7 +71,7 @@ function guideChanged(previous, currentGuideBuiltAt) {
|
|
|
71
71
|
return (previous.guideBuiltAt ?? "") !== (currentGuideBuiltAt ?? "");
|
|
72
72
|
}
|
|
73
73
|
/** A guide rebuilt after the previous review invalidates that
|
|
74
|
-
* review's verdicts, its "unchanged" suppression and its open findings
|
|
74
|
+
* review's verdicts, its "unchanged" suppression and its open findings, they
|
|
75
75
|
* were all judged against the old rules. Such a run starts fresh instead:
|
|
76
76
|
* every file is scanned again and old findings are no longer carried over.
|
|
77
77
|
*
|
|
@@ -209,7 +209,7 @@ export function buildCarryPromptSection(items, current) {
|
|
|
209
209
|
" not. Report every decision in a final section headed",
|
|
210
210
|
' exactly "## Previous findings", one line per id, exactly as',
|
|
211
211
|
' "- F1: open path:from-to" or "- F1: closed".',
|
|
212
|
-
'Do not repeat an open previous finding under "## Findings"
|
|
212
|
+
'Do not repeat an open previous finding under "## Findings". Report there',
|
|
213
213
|
"only findings from job 1 that are not already covered below.",
|
|
214
214
|
"",
|
|
215
215
|
];
|
|
@@ -62,6 +62,7 @@ export function plantumlServerProblem(value) {
|
|
|
62
62
|
// The link is posted as Markdown, so a path that can end it early or be
|
|
63
63
|
// rewritten as prose would break every diagram.
|
|
64
64
|
if (/\s/.test(value) || /[()[\]<>`\\;"]/.test(url.pathname)) {
|
|
65
|
+
// punctuation: code, the message names the semicolon character the path check rejects
|
|
65
66
|
return 'must not contain spaces or any of ( ) [ ] < > ` \\ ; " in its path';
|
|
66
67
|
}
|
|
67
68
|
return null;
|
|
@@ -253,13 +254,13 @@ const PLANTUML_GUIDANCE = `PlantUML selection and minimal syntax:
|
|
|
253
254
|
Write standard PlantUML source in a fenced code block tagged plantuml, from
|
|
254
255
|
@startuml to @enduml. Do not write an image, an image link, a server URL, or
|
|
255
256
|
any other diagram language. Our code decides how the source is shown.
|
|
256
|
-
sequence diagram = ordered calls, webhooks, retries, responses, and timing
|
|
257
|
-
activity diagram = decisions, branches, pipelines, and fallback paths
|
|
257
|
+
sequence diagram = ordered calls, webhooks, retries, responses, and timing.
|
|
258
|
+
activity diagram = decisions, branches, pipelines, and fallback paths.
|
|
258
259
|
class diagram = classes, interfaces, types, inheritance, composition, and
|
|
259
|
-
database entities
|
|
260
|
-
state diagram = lifecycle and state transitions
|
|
261
|
-
component diagram = services, modules, boundaries, and integrations
|
|
262
|
-
deployment diagram = containers, storage, and deployment topology
|
|
260
|
+
database entities.
|
|
261
|
+
state diagram = lifecycle and state transitions.
|
|
262
|
+
component diagram = services, modules, boundaries, and integrations.
|
|
263
|
+
deployment diagram = containers, storage, and deployment topology.
|
|
263
264
|
use case diagram = actors and system capabilities.
|
|
264
265
|
Use the smallest type that matches the evidence. Keep labels short.`;
|
|
265
266
|
/** The system prompt's diagram section for a PlantUML runtime, or `undefined`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Review prompt, tool loop, and improvement passes
|
|
1
|
+
/** Review prompt, tool loop, and improvement passes, PR adapter calls this
|
|
2
2
|
* after building a `Revision` and carry-over input. */
|
|
3
3
|
import type { GitHubClient, Options } from "../types.ts";
|
|
4
4
|
import type { Snapshot } from "../pr/snapshot.ts";
|
|
@@ -56,7 +56,7 @@ export async function loadGuides(repo) {
|
|
|
56
56
|
guideBuiltAt = getRepo(repo)?.knowledge_built_at ?? null;
|
|
57
57
|
}
|
|
58
58
|
catch {
|
|
59
|
-
// Local CLI review without `serve
|
|
59
|
+
// Local CLI review without `serve`, guides still load from disk.
|
|
60
60
|
}
|
|
61
61
|
// With no `repos` row, the files are the only evidence of when the guide
|
|
62
62
|
// was built. Without this a local review always says `guide unknown` and
|
|
@@ -6,7 +6,7 @@ import type { Options } from "../types.ts";
|
|
|
6
6
|
import type { RepoConfig } from "../config.ts";
|
|
7
7
|
/** Default cap on `reviewSystemPrompt`, in characters. */
|
|
8
8
|
export declare const DEFAULT_REVIEW_SYSTEM_PROMPT_MAX_CHARS = 8000;
|
|
9
|
-
/** The repository's cap, or `null` for no limit. Unset takes the default
|
|
9
|
+
/** The repository's cap, or `null` for no limit. Unset takes the default. A
|
|
10
10
|
* non-positive value means unlimited. */
|
|
11
11
|
export declare function reviewSystemPromptLimit(repoConfig: Pick<RepoConfig, "reviewSystemPromptMaxChars"> | undefined): number | null;
|
|
12
12
|
/** The problem with a custom prompt, or `null` when it is fine. Blank text is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Default cap on `reviewSystemPrompt`, in characters. */
|
|
2
2
|
export const DEFAULT_REVIEW_SYSTEM_PROMPT_MAX_CHARS = 8000;
|
|
3
|
-
/** The repository's cap, or `null` for no limit. Unset takes the default
|
|
3
|
+
/** The repository's cap, or `null` for no limit. Unset takes the default. A
|
|
4
4
|
* non-positive value means unlimited. */
|
|
5
5
|
export function reviewSystemPromptLimit(repoConfig) {
|
|
6
6
|
const raw = repoConfig?.reviewSystemPromptMaxChars;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The log stream is meant to be consumed with `fetch()` and a manual
|
|
2
|
-
* reader, not the native `EventSource` API
|
|
2
|
+
* reader, not the native `EventSource` API, `EventSource` cannot set an
|
|
3
3
|
* `Authorization` header, and every other `/api/*` route needs one. */
|
|
4
4
|
import { errorResponse } from "../errors.js";
|
|
5
5
|
import { cancel, getLogsSince, subscribeToLogs } from "../../services/jobs.js";
|
|
@@ -78,7 +78,7 @@ function streamLogs(jobId, fromSeq) {
|
|
|
78
78
|
unsubscribe = subscribeToLogs(jobId, send);
|
|
79
79
|
},
|
|
80
80
|
cancel() {
|
|
81
|
-
// The client disconnected
|
|
81
|
+
// The client disconnected, stop pushing to it.
|
|
82
82
|
closed = true;
|
|
83
83
|
unsubscribe?.();
|
|
84
84
|
},
|
|
@@ -147,7 +147,7 @@ export async function handleReposRoute(request, url, githubApp) {
|
|
|
147
147
|
policyToKeep = stored.value;
|
|
148
148
|
}
|
|
149
149
|
// `patch` is the confirmed preview. It is optional so a caller that
|
|
150
|
-
// never opened the preview keeps the old behavior
|
|
150
|
+
// never opened the preview keeps the old behavior. When present it is
|
|
151
151
|
// written before `activateRepo` so the enqueued init reads it.
|
|
152
152
|
const patch = body.patch && typeof body.patch === "object"
|
|
153
153
|
? body.patch
|
package/dist/src/server/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** `createApp(deps).fetch(request)
|
|
1
|
+
/** `createApp(deps).fetch(request)`, no port, no sockets, so it is testable
|
|
2
2
|
* with a plain `Request`. */
|
|
3
3
|
import { VERSION } from "../version.js";
|
|
4
4
|
import { errorResponse } from "./errors.js";
|
|
@@ -5,7 +5,7 @@ export declare const SESSION_COOKIE = "cm";
|
|
|
5
5
|
export declare const OAUTH_STATE_COOKIE = "cm_oauth_state";
|
|
6
6
|
/** Which sign-in methods a running `serve` accepts. Resolved once at
|
|
7
7
|
* startup (CLI flag, falling back to config) and threaded through
|
|
8
|
-
* `AppDeps`/`PageDeps
|
|
8
|
+
* `AppDeps`/`PageDeps`, every route reads the same resolved value. */
|
|
9
9
|
export type AuthMethods = {
|
|
10
10
|
password: boolean;
|
|
11
11
|
github: boolean;
|
|
@@ -35,7 +35,7 @@ export declare function checkPassword(password: string, store: PasswordStore, ip
|
|
|
35
35
|
export declare function login(password: string, store: PasswordStore, ip: string): Promise<LoginResult | undefined>;
|
|
36
36
|
export declare function revokeOtherSessions(keepToken: string): Promise<void>;
|
|
37
37
|
/** Issues a session for the one dashboard identity, bypassing the password
|
|
38
|
-
* check
|
|
38
|
+
* check, used after GitHub OAuth has already verified the caller. */
|
|
39
39
|
export declare function createSession(): Promise<LoginResult>;
|
|
40
40
|
export declare function verifySession(token: string): Promise<{
|
|
41
41
|
username: string;
|
|
@@ -46,7 +46,7 @@ export declare function readSessionToken(request: Request): string | undefined;
|
|
|
46
46
|
export declare function sessionCookieHeader(token: string, secure: boolean): string;
|
|
47
47
|
export declare function clearSessionCookieHeader(secure: boolean): string;
|
|
48
48
|
/** The GitHub OAuth `state` param, plus the post-login `next` path,
|
|
49
|
-
* round-tripped through an HttpOnly cookie instead of server memory
|
|
49
|
+
* round-tripped through an HttpOnly cookie instead of server memory, one
|
|
50
50
|
* admin, one in-flight login at a time, so a cookie is all this needs. */
|
|
51
51
|
export declare function readOauthState(request: Request): {
|
|
52
52
|
state: string;
|