co-maintainer 0.7.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 -25
- 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/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 -1
- 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
|
@@ -178,16 +178,13 @@ function humanLocation(row) {
|
|
|
178
178
|
}
|
|
179
179
|
/** The finding heading, as the shared header prints it. A parsed heading is
|
|
180
180
|
* `[P2 · non-blocking] \`path\`: \`symbol\``. The label and the location are
|
|
181
|
-
* already printed beside it, so only the symbol survives.
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* or the path again would repeat what the line already says. */
|
|
181
|
+
* already printed beside it, so only the symbol survives. A heading with no
|
|
182
|
+
* symbol leaves nothing: printing the label or the path again would repeat
|
|
183
|
+
* what the line already says. */
|
|
185
184
|
export function humanShortTitle(row) {
|
|
186
185
|
const withoutLabel = row.title.replace(/^\[P\d\s*·\s*[^\]]*\]\s*/, "");
|
|
187
|
-
const
|
|
188
|
-
const
|
|
189
|
-
const colon = tail.indexOf(": ");
|
|
190
|
-
const symbol = colon === -1 ? tail : tail.slice(colon + 2);
|
|
186
|
+
const colon = withoutLabel.indexOf(": ");
|
|
187
|
+
const symbol = colon === -1 ? withoutLabel : withoutLabel.slice(colon + 2);
|
|
191
188
|
const clean = symbol.replace(/^`|`$/g, "").trim();
|
|
192
189
|
return clean === "" || clean === row.path ? "" : clean;
|
|
193
190
|
}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Platform } from "./util/runtime.ts";
|
|
2
2
|
import type { ExtensionRegistration } from "./extensions/registry.ts";
|
|
3
|
-
/** Everything init/remake resolved for one repo, except secrets
|
|
3
|
+
/** Everything init/remake resolved for one repo, except secrets, an API
|
|
4
4
|
* token is never written to config.json, only ever taken from --token or
|
|
5
5
|
* an env file. Remembering this lets `remake owner/repo` run with no
|
|
6
6
|
* flags and no interactive prompts, reusing what `init` was told. */
|
|
@@ -43,7 +43,7 @@ export type RepoConfig = {
|
|
|
43
43
|
* means none. */
|
|
44
44
|
reviewSystemPrompt?: string;
|
|
45
45
|
/** Cap on `reviewSystemPrompt` in characters for this repository. Unset
|
|
46
|
-
* means the default
|
|
46
|
+
* means the default, `0` or a negative number means no limit. */
|
|
47
47
|
reviewSystemPromptMaxChars?: number;
|
|
48
48
|
/** Which diagram language this repository's reviews use. Unset means
|
|
49
49
|
* `mermaid`. `set --repo` writes it, so App reviews can use it too. */
|
|
@@ -54,7 +54,7 @@ export type RepoConfig = {
|
|
|
54
54
|
/** `svg` or `png`. Unset means `svg`. */
|
|
55
55
|
plantumlOutputFormat?: "svg" | "png";
|
|
56
56
|
/** Cap on one `read-full-diff` answer in characters for this repository.
|
|
57
|
-
* Unset means the default
|
|
57
|
+
* Unset means the default, `0` or a negative number means no limit. */
|
|
58
58
|
reviewReadDiffMaxChars?: number;
|
|
59
59
|
};
|
|
60
60
|
export type UserConfig = {
|
|
@@ -68,7 +68,7 @@ export type UserConfig = {
|
|
|
68
68
|
/** GitHub Personal Access Token, used when `--auth=pat`. Only ever
|
|
69
69
|
* written by `set --github-pat=...`. */
|
|
70
70
|
githubPat?: string;
|
|
71
|
-
/** GitHub App credentials for `co-maintainer serve
|
|
71
|
+
/** GitHub App credentials for `co-maintainer serve`, also only ever
|
|
72
72
|
* written by `set`. `githubWebhookSecret` is optional. */
|
|
73
73
|
githubAppId?: string;
|
|
74
74
|
githubAppPrivateKey?: string;
|
|
@@ -78,12 +78,12 @@ export type UserConfig = {
|
|
|
78
78
|
githubWebhookSecret?: string;
|
|
79
79
|
webhookUrl?: string;
|
|
80
80
|
/** "Sign in with GitHub" for the dashboard, reusing the App's own OAuth
|
|
81
|
-
* client
|
|
81
|
+
* client, only `githubOAuthAllowedUser` may complete it. All three only
|
|
82
82
|
* ever written by `set`. */
|
|
83
83
|
githubOAuthClientId?: string;
|
|
84
84
|
githubOAuthClientSecret?: string;
|
|
85
85
|
githubOAuthAllowedUser?: string;
|
|
86
|
-
/** Which sign-in methods `serve` accepts by default
|
|
86
|
+
/** Which sign-in methods `serve` accepts by default. A `--disable-auth`/
|
|
87
87
|
* `--enable-auth` flag on the `serve` command overrides these per run. */
|
|
88
88
|
passwordAuthDisabled?: boolean;
|
|
89
89
|
githubAuthEnabled?: boolean;
|
|
@@ -112,11 +112,11 @@ export type UserConfig = {
|
|
|
112
112
|
codegraphVersion?: string;
|
|
113
113
|
/** Remote review CLI target (`co-maintainer set`). */
|
|
114
114
|
remoteHost?: string;
|
|
115
|
-
/** Bearer token for `/api/remote
|
|
115
|
+
/** Bearer token for `/api/remote/*`. Only written by `set`. */
|
|
116
116
|
remoteToken?: string;
|
|
117
117
|
/** Hosts for which the unpublished-code notice was shown. */
|
|
118
118
|
remoteNoticeShownFor?: string[];
|
|
119
|
-
/** Remote client watchdog timeout
|
|
119
|
+
/** Remote client watchdog timeout. Dashboard may override. */
|
|
120
120
|
remoteSyncTimeoutSeconds?: number;
|
|
121
121
|
maxConcurrentRemoteReviewsPerToken?: number;
|
|
122
122
|
remoteToolOutputMaxChars?: number;
|
|
@@ -171,11 +171,11 @@ export declare function remoteByokPolicy(config?: Pick<UserConfig, "remoteByokPo
|
|
|
171
171
|
* migration's `"windows"` vs `"win32"` trap is invisible otherwise. */
|
|
172
172
|
export declare function getConfigDir(os?: Platform, env?: (name: string) => string | undefined): string;
|
|
173
173
|
export declare function getCacheDir(os?: Platform, env?: (name: string) => string | undefined): string;
|
|
174
|
-
/** `CM_CONFIG_PATH` overrides the path
|
|
174
|
+
/** `CM_CONFIG_PATH` overrides the path, tests point it at a temp file so
|
|
175
175
|
* they never read or write the real config.json. */
|
|
176
176
|
export declare function configPath(): string;
|
|
177
177
|
/** Where generated skills (SKILL.md, CODEBASE.md, review guides) live.
|
|
178
|
-
* Never relative to the current directory
|
|
178
|
+
* Never relative to the current directory, a globally installed CLI can be
|
|
179
179
|
* invoked from anywhere, including directories it has no permission to
|
|
180
180
|
* write into (e.g. C:\Windows\System32). */
|
|
181
181
|
export declare function reposDir(): string;
|
|
@@ -227,7 +227,7 @@ export declare function writeRepoConfig(repo: string, patch: RepoConfig): Promis
|
|
|
227
227
|
export declare function removeRepoConfig(repo: string): Promise<boolean>;
|
|
228
228
|
/** Drops every per-repo entry. `clear all` forgets every repository it knows. */
|
|
229
229
|
export declare function removeAllRepoConfig(): Promise<boolean>;
|
|
230
|
-
/** Merges `patch` into the top-level (global, cross-repo) config
|
|
230
|
+
/** Merges `patch` into the top-level (global, cross-repo) config,
|
|
231
231
|
* used by `co-maintainer set`. This is the only path allowed to persist
|
|
232
232
|
* a token. */
|
|
233
233
|
export declare function writeUserConfig(patch: Partial<UserConfig>): Promise<void>;
|
package/dist/src/config.js
CHANGED
|
@@ -88,13 +88,13 @@ export function getCacheDir(os = currentPlatform(), env = getEnv) {
|
|
|
88
88
|
return env("XDG_CACHE_HOME") ?? `${home}/.cache`;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
/** `CM_CONFIG_PATH` overrides the path
|
|
91
|
+
/** `CM_CONFIG_PATH` overrides the path, tests point it at a temp file so
|
|
92
92
|
* they never read or write the real config.json. */
|
|
93
93
|
export function configPath() {
|
|
94
94
|
return (getEnv("CM_CONFIG_PATH") ?? `${getConfigDir()}/co-maintainer/config.json`);
|
|
95
95
|
}
|
|
96
96
|
/** Where generated skills (SKILL.md, CODEBASE.md, review guides) live.
|
|
97
|
-
* Never relative to the current directory
|
|
97
|
+
* Never relative to the current directory, a globally installed CLI can be
|
|
98
98
|
* invoked from anywhere, including directories it has no permission to
|
|
99
99
|
* write into (e.g. C:\Windows\System32). */
|
|
100
100
|
export function reposDir() {
|
|
@@ -245,7 +245,7 @@ export async function removeAllRepoConfig() {
|
|
|
245
245
|
await writeConfig({ ...config, repos: undefined });
|
|
246
246
|
return true;
|
|
247
247
|
}
|
|
248
|
-
/** Merges `patch` into the top-level (global, cross-repo) config
|
|
248
|
+
/** Merges `patch` into the top-level (global, cross-repo) config,
|
|
249
249
|
* used by `co-maintainer set`. This is the only path allowed to persist
|
|
250
250
|
* a token. */
|
|
251
251
|
export async function writeUserConfig(patch) {
|
package/dist/src/github/app.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type Installation = {
|
|
|
12
12
|
events?: string[];
|
|
13
13
|
};
|
|
14
14
|
/** App-level calls: list installations, mint an installation access token.
|
|
15
|
-
* Not scoped to one installation
|
|
15
|
+
* Not scoped to one installation, `AppClient` below is. */
|
|
16
16
|
export declare class AppJwtClient {
|
|
17
17
|
private readonly appId;
|
|
18
18
|
private readonly privateKeyPem;
|
package/dist/src/github/app.js
CHANGED
|
@@ -27,7 +27,7 @@ async function get(endpoint, token) {
|
|
|
27
27
|
}
|
|
28
28
|
const installationTokens = new Map();
|
|
29
29
|
/** App-level calls: list installations, mint an installation access token.
|
|
30
|
-
* Not scoped to one installation
|
|
30
|
+
* Not scoped to one installation, `AppClient` below is. */
|
|
31
31
|
export class AppJwtClient {
|
|
32
32
|
appId;
|
|
33
33
|
privateKeyPem;
|
|
@@ -36,7 +36,7 @@ export type ManifestConversion = {
|
|
|
36
36
|
clientId: string;
|
|
37
37
|
clientSecret: string;
|
|
38
38
|
};
|
|
39
|
-
/** `POST /app-manifests/{code}/conversions
|
|
39
|
+
/** `POST /app-manifests/{code}/conversions`, the `code` is single use and
|
|
40
40
|
* expires roughly an hour after GitHub redirects the browser back. */
|
|
41
41
|
export declare function convertManifest(code: string): Promise<ManifestConversion>;
|
|
42
42
|
export declare function beginManifestState(now?: number): string;
|
|
@@ -75,7 +75,7 @@ export function manifestBlockedReason(webhookUrl) {
|
|
|
75
75
|
return `${reach} Set a public webhook address first.`;
|
|
76
76
|
return undefined;
|
|
77
77
|
}
|
|
78
|
-
/** `POST /app-manifests/{code}/conversions
|
|
78
|
+
/** `POST /app-manifests/{code}/conversions`, the `code` is single use and
|
|
79
79
|
* expires roughly an hour after GitHub redirects the browser back. */
|
|
80
80
|
export async function convertManifest(code) {
|
|
81
81
|
const response = await githubFetch(`https://api.github.com/app-manifests/${encodeURIComponent(code)}/conversions`, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Shared by every `GitHubClient` implementation that talks over `fetch`
|
|
2
2
|
* (pat.ts, and app.ts). `GhClient` shells out to the `gh` binary and does
|
|
3
|
-
* not use `githubFetch
|
|
3
|
+
* not use `githubFetch`. Both paths share `paginate` and `waitForRateLimit`. */
|
|
4
4
|
export declare class GitHubHttpError extends Error {
|
|
5
5
|
readonly status: number;
|
|
6
6
|
constructor(status: number, body: string, hint?: string);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Shared by every `GitHubClient` implementation that talks over `fetch`
|
|
2
2
|
* (pat.ts, and app.ts). `GhClient` shells out to the `gh` binary and does
|
|
3
|
-
* not use `githubFetch
|
|
3
|
+
* not use `githubFetch`. Both paths share `paginate` and `waitForRateLimit`. */
|
|
4
4
|
import { log } from "../util/log.js";
|
|
5
5
|
import { networkFailure } from "../cli/error.js";
|
|
6
6
|
import { missingHint, refusalHint } from "./permissions.js";
|
package/dist/src/github/gh.js
CHANGED
|
@@ -40,14 +40,14 @@ function runGh(args, input) {
|
|
|
40
40
|
* what to do next. The four shapes that came up in practice:
|
|
41
41
|
* `gh` missing from PATH, the repo missing or unreadable, an empty stderr, and
|
|
42
42
|
* everything else. The first line is the only part a human reads, so it always
|
|
43
|
-
* names the situation
|
|
43
|
+
* names the situation. The raw gh text moves to the hint so it stays available
|
|
44
44
|
* without drowning the message. */
|
|
45
45
|
function ghFailure(method, endpoint, stderr) {
|
|
46
46
|
if (/ENOENT|command not found|not recognized/i.test(stderr)) {
|
|
47
47
|
return new CliError("gh_not_installed", "GitHub CLI (gh) was not found.", "Install it from https://cli.github.com or use --auth=pat.", EXIT_USAGE);
|
|
48
48
|
}
|
|
49
49
|
if (/HTTP 404|Not Found/i.test(stderr)) {
|
|
50
|
-
// The endpoint is `repos/owner/repo
|
|
50
|
+
// The endpoint is `repos/owner/repo/...`. The user thinks in `owner/repo`.
|
|
51
51
|
const match = endpoint.match(/^repos\/([^/]+)\/([^/]+)/);
|
|
52
52
|
const subject = match ? `${match[1]}/${match[2]}` : endpoint;
|
|
53
53
|
return new CliError("repo_not_found", `${subject} was not found, or your GitHub account cannot read it.`, "Check the name and run gh auth status.", EXIT_USAGE);
|
package/dist/src/github/jwt.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* KEY"). Web Crypto's `importKey("pkcs8", ...)` only takes PKCS#8. The two
|
|
3
3
|
* differ by a fixed 26-byte wrapper around the same PKCS#1 bytes: a version
|
|
4
4
|
* INTEGER, the rsaEncryption AlgorithmIdentifier, and an OCTET STRING tag
|
|
5
|
-
* around the PKCS#1 payload
|
|
5
|
+
* around the PKCS#1 payload, this file builds that wrapper by hand rather
|
|
6
6
|
* than pulling in an ASN.1 library for one fixed structure. */
|
|
7
7
|
export declare function pkcs1ToPkcs8(pkcs1: Uint8Array): Uint8Array;
|
|
8
8
|
export declare function importAppPrivateKey(pem: string): Promise<CryptoKey>;
|
package/dist/src/github/jwt.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* KEY"). Web Crypto's `importKey("pkcs8", ...)` only takes PKCS#8. The two
|
|
3
3
|
* differ by a fixed 26-byte wrapper around the same PKCS#1 bytes: a version
|
|
4
4
|
* INTEGER, the rsaEncryption AlgorithmIdentifier, and an OCTET STRING tag
|
|
5
|
-
* around the PKCS#1 payload
|
|
5
|
+
* around the PKCS#1 payload, this file builds that wrapper by hand rather
|
|
6
6
|
* than pulling in an ASN.1 library for one fixed structure. */
|
|
7
7
|
const RSA_ALGORITHM_IDENTIFIER = Uint8Array.from([
|
|
8
8
|
0x30,
|
package/dist/src/github/oauth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** The user-to-server side of a GitHub App's OAuth flow
|
|
2
|
-
* GitHub"
|
|
1
|
+
/** The user-to-server side of a GitHub App's OAuth flow, "Sign in with
|
|
2
|
+
* GitHub", reusing the App's own client ID/secret. No separate OAuth App
|
|
3
3
|
* is needed. */
|
|
4
4
|
import { githubFetch } from "./client.js";
|
|
5
5
|
export function githubAuthorizeUrl(clientId, redirectUri, state) {
|
|
@@ -95,7 +95,7 @@ function sourceModuleClaim(path, content) {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
return `\`${path}\` contains ${symbols
|
|
97
97
|
.map((symbol) => `\`${symbol}\``)
|
|
98
|
-
.join(", ")}
|
|
98
|
+
.join(", ")}. Keep related changes in this module.`;
|
|
99
99
|
}
|
|
100
100
|
function commandPrefix(source) {
|
|
101
101
|
if (source.tree.some((path) => /pnpm-lock\.yaml$/.test(path)))
|
|
@@ -316,7 +316,7 @@ export function extractFacts(source, options) {
|
|
|
316
316
|
if (examples.length) {
|
|
317
317
|
add(facts, fact("style", `Recent commit examples: ${examples
|
|
318
318
|
.map((message) => `\`${message.slice(0, 100)}\``)
|
|
319
|
-
.join("
|
|
319
|
+
.join(", ")}.`, "commit history", 2));
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
const currentPaths = new Set(source.tree);
|
|
@@ -327,7 +327,7 @@ export function extractFacts(source, options) {
|
|
|
327
327
|
const files = counts(changedFiles).slice(0, 10);
|
|
328
328
|
add(facts, fact("review-bar", `Frequently changed files include ${files
|
|
329
329
|
.map(([path]) => `\`${path}\``)
|
|
330
|
-
.join(", ")}
|
|
330
|
+
.join(", ")}. Check nearby tests and workflows before editing.`, "pull request files", 2));
|
|
331
331
|
}
|
|
332
332
|
return [...facts.values()];
|
|
333
333
|
}
|
|
@@ -17,7 +17,7 @@ const MAX_CHECK_LINES = 400;
|
|
|
17
17
|
* broad as that window. */
|
|
18
18
|
const MAX_FINDINGS = 160;
|
|
19
19
|
/** How strongly a finding recurs. Repository policy (`current`) outranks
|
|
20
|
-
* repeated history, which outranks a single example
|
|
20
|
+
* repeated history, which outranks a single example. Weight and evidence count
|
|
21
21
|
* break ties. This is the guide's only ordering signal: rules carry no
|
|
22
22
|
* priority. */
|
|
23
23
|
function recurrence(item) {
|
|
@@ -25,7 +25,7 @@ function recurrence(item) {
|
|
|
25
25
|
return scope * 1000 + item.weight * 10 + item.evidence.length;
|
|
26
26
|
}
|
|
27
27
|
/** Approval/merge narration is not a rule. The extraction prompt already
|
|
28
|
-
* forbids it
|
|
28
|
+
* forbids it. This drops any that slips through, without touching the many
|
|
29
29
|
* findings that legitimately begin "Reviewers should require …". */
|
|
30
30
|
function isNarrative(claim) {
|
|
31
31
|
return (/\bLGTM\b/i.test(claim) ||
|
|
@@ -34,7 +34,7 @@ function isNarrative(claim) {
|
|
|
34
34
|
}
|
|
35
35
|
/** The review findings the guide is built from: a concrete rule with an impact
|
|
36
36
|
* and an action. Nothing is dropped for being a single PR's finding, because
|
|
37
|
-
* the point of the guide is the specifics
|
|
37
|
+
* the point of the guide is the specifics. Recurrence only orders them. */
|
|
38
38
|
function guideFindings(facts) {
|
|
39
39
|
return facts
|
|
40
40
|
.filter((item) => item.sectionKey === "review" &&
|
|
@@ -107,7 +107,7 @@ export function validateGuide(text, options = {}) {
|
|
|
107
107
|
return `fewer than ${minPasses} passes`;
|
|
108
108
|
}
|
|
109
109
|
if (areas.length > maxPasses) {
|
|
110
|
-
return `too many passes (${areas.length})
|
|
110
|
+
return `too many passes (${areas.length}), consolidate related areas`;
|
|
111
111
|
}
|
|
112
112
|
for (const area of areas) {
|
|
113
113
|
const name = area.split("\n")[0].trim();
|
|
@@ -129,7 +129,7 @@ export function validateGuide(text, options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
/** The findings handed to the synthesis, as a flat list. Earlier this was
|
|
131
131
|
* pre-grouped by the extraction's own `class` label, which made the model emit
|
|
132
|
-
* one pass per finding (24 areas in the skunk run)
|
|
132
|
+
* one pass per finding (24 areas in the skunk run). A flat list lets it cluster
|
|
133
133
|
* related findings into a small set of coherent passes instead. */
|
|
134
134
|
function guideMaterial(facts) {
|
|
135
135
|
const findings = guideFindings(facts)
|
|
@@ -162,7 +162,7 @@ export function findingPullRequests(facts) {
|
|
|
162
162
|
}
|
|
163
163
|
const GUIDE_SYSTEM = `You write a code-review method for an unfamiliar open-source repository.
|
|
164
164
|
Ground every check in the supplied findings. Never invent a file, path, command, or policy. Never write a pull-request number, a commit id, a reviewer name, a mention, a quoted comment, or an attribution. Never add a priority tag. Never tell the reader to run a command.`;
|
|
165
|
-
const CONSOLIDATE = `- Consolidate the findings into a small set of coherent passes: group related findings, merge near-duplicates, and use between 3 and 12 passes. Represent every finding
|
|
165
|
+
const CONSOLIDATE = `- Consolidate the findings into a small set of coherent passes: group related findings, merge near-duplicates, and use between 3 and 12 passes. Represent every finding. Never drop one to hit the pass count.
|
|
166
166
|
- Name each pass in Title Case. Never a lowercase slug such as "test-cleanup".
|
|
167
167
|
- Every rule is a general invariant a future change must satisfy, not a description of one past fix. Keep the specific case only as the example under it.`;
|
|
168
168
|
const CHECK_SHAPE = `- Under each pass, write each rule as one general invariant line, then its concrete case indented under it:
|
|
@@ -232,7 +232,7 @@ export async function synthesizeReviewGuides(provider, repo, ai, model, concurre
|
|
|
232
232
|
const full = cleanGuide(fullResponse?.text ?? "");
|
|
233
233
|
if (!full) {
|
|
234
234
|
// Not a failure: SKILL.md and CODEBASE.md are written anyway.
|
|
235
|
-
log("ai", "synth_guide produced nothing usable
|
|
235
|
+
log("ai", "synth_guide produced nothing usable, skipping the guide");
|
|
236
236
|
return undefined;
|
|
237
237
|
}
|
|
238
238
|
const sources = findingPullRequests(facts);
|
|
@@ -102,7 +102,7 @@ export function analyzeProbe(meta, pulls, detailSamples, commits) {
|
|
|
102
102
|
(30.44 * 24 * 60 * 60 * 1_000)
|
|
103
103
|
: Infinity;
|
|
104
104
|
reasons.push(releaseAgeMonths <= 18
|
|
105
|
-
? `A release from ${latestReleaseAt.slice(0, 10)} is recent
|
|
105
|
+
? `A release from ${latestReleaseAt.slice(0, 10)} is recent. Use the last ${maxPrMonths} months to prioritize the current contribution and release process.`
|
|
106
106
|
: `The last ${maxPrMonths} months cover at least 85% of pull requests. Older history is a minority.`);
|
|
107
107
|
}
|
|
108
108
|
else if (pulls.length) {
|
|
@@ -101,7 +101,7 @@ export async function assembleSkill(repo, facts, previousMarkdown, previousHashe
|
|
|
101
101
|
const canonicalHeading = `## ${sectionTitles[key] ?? key}`;
|
|
102
102
|
const override = overrides[key]?.trim();
|
|
103
103
|
// The codebase sections hold a link, not text, so the skill never takes a
|
|
104
|
-
// synthesized override for them
|
|
104
|
+
// synthesized override for them. The override goes to CODEBASE.md instead.
|
|
105
105
|
const hasOverride = Boolean(override) && !codebaseSectionKeys.has(key);
|
|
106
106
|
if (!hasOverride &&
|
|
107
107
|
previousMarkdown &&
|
|
@@ -268,7 +268,7 @@ function sectionGoal(key) {
|
|
|
268
268
|
function synthesisFacts(facts, key) {
|
|
269
269
|
return (facts
|
|
270
270
|
// A section that states repository policy never learns from a single pull
|
|
271
|
-
// request's narrative
|
|
271
|
+
// request's narrative. Only `review-bar` may.
|
|
272
272
|
.filter((item) => item.sectionKey === key &&
|
|
273
273
|
(sectionAllowsPrFacts(key) || !isPullRequestFact(item)))
|
|
274
274
|
.sort((a, b) => (b.status === "active" ? 1 : 0) - (a.status === "active" ? 1 : 0) ||
|
|
@@ -301,8 +301,8 @@ Rules:
|
|
|
301
301
|
- Never write an approval, a merge, "LGTM", thanks, a reviewer name, a pull-request number, a commit id, or quoted comment text.
|
|
302
302
|
- The claim is a general invariant, not one past fix: "When X changes, Y must also change", or "Every Z uses W", never "change this one line".
|
|
303
303
|
- trigger is what a reviewer can see in a diff: a path, a glob, or a symbol. It is how the rule applies to a future change, so a rule with no trigger is a one-off and is not useful.
|
|
304
|
-
- impact and action are mandatory and concrete. Paraphrase the reviewer's reasoning for impact
|
|
305
|
-
- class is a short area label chosen from a small, consistent set
|
|
304
|
+
- impact and action are mandatory and concrete. Paraphrase the reviewer's reasoning for impact. Never quote it.
|
|
305
|
+
- class is a short area label chosen from a small, consistent set. Reuse the same label for findings of the same kind so related findings can be grouped.
|
|
306
306
|
- location is a repository path when the review names one, otherwise leave it empty.
|
|
307
307
|
- Return every distinct finding the reviews support, not a summary. Do not explain the answer.
|
|
308
308
|
|
|
@@ -325,8 +325,8 @@ release gates, and conventions that affect a code change. Ignore end-user featur
|
|
|
325
325
|
installation walkthroughs, and generic programming advice. For source files, identify
|
|
326
326
|
what important modules own and how tests exercise them when the files provide evidence.
|
|
327
327
|
Do not infer PR titles, labels, review rules, or contributor policy unless the input
|
|
328
|
-
contains PR or pull-request-template evidence
|
|
329
|
-
by a provided file. Do not report a current version value
|
|
328
|
+
contains PR or pull-request-template evidence. Every claim must be directly supported
|
|
329
|
+
by a provided file. Do not report a current version value. Preserve the version
|
|
330
330
|
change or release rule instead.
|
|
331
331
|
Return at most 10 items. Keep each claim under 180 characters. Do not explain the answer.
|
|
332
332
|
|
|
@@ -429,11 +429,11 @@ existing guidance, remove contradictions, deduplicate overlapping facts, and do
|
|
|
429
429
|
invent anything. Include the correct human-readable section heading. Use inline
|
|
430
430
|
backticks instead of fenced code blocks. Do not create examples, placeholder
|
|
431
431
|
identifiers, or policies that are not present in the facts. Prefer at most
|
|
432
|
-
6 high-value bullets
|
|
432
|
+
6 high-value bullets. Keep a concrete example only when it changes an agent decision.
|
|
433
433
|
Do not preserve a current version value that can become stale. In Shipping,
|
|
434
434
|
consolidate CI and release facts instead of repeating the same workflow rule.
|
|
435
435
|
Facts are raw candidates, not all mandatory output. A fact supported by only one PR
|
|
436
|
-
is an example, not a repository-wide rule
|
|
436
|
+
is an example, not a repository-wide rule. Omit it unless canonical files or repeated
|
|
437
437
|
evidence support it. Omit conflicting claims rather than guessing. Return only the
|
|
438
438
|
heading when this section has no durable guidance. Do not preserve bot-specific
|
|
439
439
|
automation commands, reviewer identities, or one-off historical requests as
|
|
@@ -12,7 +12,7 @@ export type LocalCarrySnapshot = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function localSubjectId(repo: string, root: string, branch: string): string;
|
|
14
14
|
export declare function loadLocalCarry(repo: string, root: string, branch: string): Promise<LocalCarrySnapshot | null>;
|
|
15
|
-
/** Plan E163
|
|
15
|
+
/** Plan E163, corrupt or locked cache must not abort review. */
|
|
16
16
|
export declare function tryLoadLocalCarry(repo: string, root: string, branch: string): Promise<{
|
|
17
17
|
data: LocalCarrySnapshot | null;
|
|
18
18
|
unavailable: boolean;
|
|
@@ -13,7 +13,7 @@ export async function loadLocalCarry(repo, root, branch) {
|
|
|
13
13
|
}
|
|
14
14
|
return loaded.data;
|
|
15
15
|
}
|
|
16
|
-
/** Plan E163
|
|
16
|
+
/** Plan E163, corrupt or locked cache must not abort review. */
|
|
17
17
|
export async function tryLoadLocalCarry(repo, root, branch) {
|
|
18
18
|
try {
|
|
19
19
|
const raw = await cacheGet(NS, key(repo, root, branch));
|
|
@@ -11,7 +11,7 @@ export async function prepareLocalCodegraph(input) {
|
|
|
11
11
|
const run = input.run ?? runCommand;
|
|
12
12
|
const resolved = await ensureCodegraphForReview({
|
|
13
13
|
allowInstall: input.allowInstall,
|
|
14
|
-
// The prompt is safe only when a human can answer it
|
|
14
|
+
// The prompt is safe only when a human can answer it, `canPrompt` checks
|
|
15
15
|
// stdin, stdout and `CI`, so a `</dev/null` or piped run never asks.
|
|
16
16
|
interactive: input.interactive ?? canPrompt(),
|
|
17
17
|
log: (message) => log("codegraph", message.replace(/^\[codegraph\]\s*/, "")),
|
|
@@ -86,7 +86,7 @@ export async function currentBranch(cwd, override, run = runCommand) {
|
|
|
86
86
|
return override;
|
|
87
87
|
const result = await run("git", ["symbolic-ref", "--short", "-q", "HEAD"], cwd);
|
|
88
88
|
if (result.code !== 0 || !result.stdout.trim()) {
|
|
89
|
-
throw new ReviewCliError("detached_head", "Detached HEAD
|
|
89
|
+
throw new ReviewCliError("detached_head", "Detached HEAD. Pass --branch=<name> to review.");
|
|
90
90
|
}
|
|
91
91
|
return result.stdout.trim();
|
|
92
92
|
}
|
|
@@ -43,7 +43,7 @@ function fail(error, json) {
|
|
|
43
43
|
if (error.hint)
|
|
44
44
|
console.error(`Hint: ${error.hint}`);
|
|
45
45
|
}
|
|
46
|
-
// Set the exit code and return
|
|
46
|
+
// Set the exit code and return, `process.exit` here would assert in libuv on
|
|
47
47
|
// Windows whenever a fetch pool is open.
|
|
48
48
|
exitWith(error.exitCode);
|
|
49
49
|
}
|
|
@@ -186,7 +186,7 @@ export async function runLocalReview(cli) {
|
|
|
186
186
|
let previous = carryLoad.data;
|
|
187
187
|
// A guide rebuilt after the last review judged its findings under rules
|
|
188
188
|
// that no longer exist. Rather than let those stale findings mask new
|
|
189
|
-
// ones, start fresh automatically
|
|
189
|
+
// ones, start fresh automatically, the same effect as
|
|
190
190
|
// `--fresh`, without making the user remember the flag.
|
|
191
191
|
if (previous &&
|
|
192
192
|
guideRebuiltSince(previous.guideBuiltAt, guides.guideBuiltAt)) {
|
|
@@ -204,7 +204,7 @@ export async function runLocalReview(cli) {
|
|
|
204
204
|
gitRoot: root,
|
|
205
205
|
enabled: options.useCodegraph === true,
|
|
206
206
|
allowInstall: cli.allowToolInstall,
|
|
207
|
-
// `--json` output must stay machine-readable, so never prompt then
|
|
207
|
+
// `--json` output must stay machine-readable, so never prompt then.
|
|
208
208
|
// `canPrompt` adds the TTY and CI checks.
|
|
209
209
|
interactive: !json && canPrompt(),
|
|
210
210
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function withCloneLock<T>(repo: string, fn: () => Promise<T>): Promise<T>;
|
|
2
2
|
/** Shared git plumbing for anything that needs a real checkout of a
|
|
3
|
-
* repository
|
|
3
|
+
* repository, the codegraph map and the upstream/own-work scope both need
|
|
4
4
|
* a clone and a way to resolve a commit that is not necessarily reachable
|
|
5
5
|
* from any branch (a squash-merged or rebased-away PR head). One
|
|
6
6
|
* implementation, so the two never manage the same on-disk clone in two
|
|
@@ -16,8 +16,8 @@ export declare function pathExists(path: string): Promise<boolean>;
|
|
|
16
16
|
/** Like `ensureClone` but assumes the caller already holds `withCloneLock`. */
|
|
17
17
|
export declare function ensureCloneUnlocked(repo: string, run: Run): Promise<string>;
|
|
18
18
|
export declare function ensureClone(repo: string, run: Run): Promise<string>;
|
|
19
|
-
/** Resolves `revision
|
|
20
|
-
*
|
|
19
|
+
/** Resolves `revision`, a branch name, a remote-tracking ref, or a commit SHA,
|
|
20
|
+
* to a commit SHA, fetching it directly if it is a SHA the clone does not
|
|
21
21
|
* have. A round's boundary commit is often reachable only by SHA once its
|
|
22
22
|
* branch has moved on or the PR was squash-merged, so no local or
|
|
23
23
|
* remote-tracking ref points at it any more. */
|
package/dist/src/pr/checkout.js
CHANGED
|
@@ -60,7 +60,7 @@ async function cloneInto(repo, dir, run) {
|
|
|
60
60
|
`repository scope and falls back to the diff only` +
|
|
61
61
|
(firstLine ? `: ${firstLine}` : ""));
|
|
62
62
|
}
|
|
63
|
-
// A pull request may ship symlinks
|
|
63
|
+
// A pull request may ship symlinks. Without this a codegraph tool could read
|
|
64
64
|
// through one to a file outside the tree. Persist it in the clone so every
|
|
65
65
|
// worktree checkout writes symlinks as plain files instead of following them.
|
|
66
66
|
await run("git", ["config", "core.symlinks", "false"], dir);
|
|
@@ -69,14 +69,14 @@ async function cloneInto(repo, dir, run) {
|
|
|
69
69
|
}
|
|
70
70
|
/** In-flight clone per destination directory. A benchmark run reviews several
|
|
71
71
|
* PRs of the same repo concurrently, and each one's scope/map computation
|
|
72
|
-
* calls `ensureClone` independently
|
|
72
|
+
* calls `ensureClone` independently. Without this, the first concurrent burst
|
|
73
73
|
* has every caller see "not cloned yet" and race `git clone` into the same
|
|
74
|
-
* directory
|
|
74
|
+
* directory, one wins, the rest fail with "already exists" and silently fall
|
|
75
75
|
* back to an unscoped review. Concurrent callers now await the one real clone
|
|
76
76
|
* instead. The two statements between the `pathExists` check and this map's
|
|
77
77
|
* `get`/`set` are synchronous (no `await` between them), so whichever caller's
|
|
78
78
|
* continuation runs first registers the clone before any other caller can
|
|
79
|
-
* observe an empty map entry
|
|
79
|
+
* observe an empty map entry, ordinary JS single-threaded scheduling, not a
|
|
80
80
|
* lock. */
|
|
81
81
|
const cloningInFlight = new Map();
|
|
82
82
|
/** Like `ensureClone` but assumes the caller already holds `withCloneLock`. */
|
|
@@ -99,7 +99,7 @@ export async function ensureClone(repo, run) {
|
|
|
99
99
|
/** Resolves `candidate` to a commit SHA, or returns undefined. Two plain
|
|
100
100
|
* commands rather than one `rev-parse <rev>^{commit}`: on Windows this runs
|
|
101
101
|
* through `cmd /c`, where `^` is the shell's own escape character and would
|
|
102
|
-
* silently eat the peel suffix, making a present commit look absent
|
|
102
|
+
* silently eat the peel suffix, making a present commit look absent, the
|
|
103
103
|
* same trap `benchmark/core_v2/runners.ts`'s `requireCommit` avoids for the same
|
|
104
104
|
* reason. `cat-file -t` after a caret-free `rev-parse` sidesteps it. */
|
|
105
105
|
async function resolveCommit(clone, candidate, run) {
|
|
@@ -112,8 +112,8 @@ async function resolveCommit(clone, candidate, run) {
|
|
|
112
112
|
return undefined;
|
|
113
113
|
return sha;
|
|
114
114
|
}
|
|
115
|
-
/** Resolves `revision
|
|
116
|
-
*
|
|
115
|
+
/** Resolves `revision`, a branch name, a remote-tracking ref, or a commit SHA,
|
|
116
|
+
* to a commit SHA, fetching it directly if it is a SHA the clone does not
|
|
117
117
|
* have. A round's boundary commit is often reachable only by SHA once its
|
|
118
118
|
* branch has moved on or the PR was squash-merged, so no local or
|
|
119
119
|
* remote-tracking ref points at it any more. */
|
|
@@ -7,7 +7,7 @@ export declare function rejectFlagLike(value: string, label: string): string | n
|
|
|
7
7
|
* `>` or `%` can append a second command. None of them have a legitimate place
|
|
8
8
|
* in a search term, symbol name or repo-relative path, so refuse them. */
|
|
9
9
|
export declare function rejectShellMetacharacters(value: string, label: string): string | null;
|
|
10
|
-
/** Repo-relative path only
|
|
10
|
+
/** Repo-relative path only, no `..`, no absolute paths (plan E103). */
|
|
11
11
|
export declare function rejectEscapingPath(file: string): string | null;
|
|
12
12
|
export declare function guardToolArgs(args: Args, allowed: ReadonlySet<string>): string | null;
|
|
13
13
|
export {};
|
|
@@ -24,7 +24,7 @@ export function rejectShellMetacharacters(value, label) {
|
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
-
/** Repo-relative path only
|
|
27
|
+
/** Repo-relative path only, no `..`, no absolute paths (plan E103). */
|
|
28
28
|
export function rejectEscapingPath(file) {
|
|
29
29
|
const flag = rejectFlagLike(file, "file");
|
|
30
30
|
if (flag)
|
package/dist/src/pr/findings.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
const FILE_LINE = /(?<path>(?:[\w.-]+\/)*[\w.-]+\.[A-Za-z0-9]+):(?<from>\d+)(?:-(?<to>\d+))?/g;
|
|
2
|
-
/** The finding heading: `[P2 · non-blocking] \`path
|
|
3
|
-
* sometimes
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
const NEW_HEADING = /^\[(?<severity>P[0-3])\s*·\s*(?<impact>blocking|non-blocking)\]\s+(?<path>.+?)(?:\s*(?:—|:)\s*(?<symbol>.+))?$/;
|
|
2
|
+
/** The finding heading: `[P2 · non-blocking] \`path\`: \`symbol\``. The model
|
|
3
|
+
* sometimes leaves the symbol off, so the symbol is optional: an unrecognised
|
|
4
|
+
* heading used to send every finding down the fallback path, which is what
|
|
5
|
+
* produced the truncated and shifted output. The separator may also sit
|
|
6
|
+
* directly against the path (`\`src/a.ts\`: \`helper()\``), which is how the
|
|
7
|
+
* model usually writes it. */
|
|
8
|
+
const NEW_HEADING = /^\[(?<severity>P[0-3])\s*·\s*(?<impact>blocking|non-blocking)\]\s+(?<path>.+?)(?:\s*:\s*(?<symbol>.+))?$/;
|
|
10
9
|
function uncode(value) {
|
|
11
10
|
return value.trim().replace(/^`|`$/g, "").trim();
|
|
12
11
|
}
|
|
@@ -41,7 +40,7 @@ function newFinding(header, block) {
|
|
|
41
40
|
const summary = excerpt.split(/\r?\n/).find((line) => line.trim()) ?? "";
|
|
42
41
|
return {
|
|
43
42
|
...at,
|
|
44
|
-
// The Location line is authoritative for the path
|
|
43
|
+
// The Location line is authoritative for the path. The heading only names
|
|
45
44
|
// it, and may omit the symbol entirely.
|
|
46
45
|
path: at.path || path,
|
|
47
46
|
heading: symbol
|