co-maintainer 0.6.12 → 0.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/package.json +1 -1
- package/dist/src/ai/anthropic.js +2 -0
- package/dist/src/ai/batch.d.ts +3 -1
- package/dist/src/ai/batch.js +23 -2
- package/dist/src/ai/mermaid_loop.js +1 -1
- package/dist/src/ai/oauth/sign-in-with-chatgpt.js +8 -10
- package/dist/src/ai/openai.js +2 -0
- package/dist/src/ai/openrouter.js +2 -0
- package/dist/src/cli/args.js +47 -0
- package/dist/src/cli/command_json.d.ts +20 -1
- package/dist/src/cli/command_json.js +4 -0
- package/dist/src/cli/commands/config.d.ts +1 -1
- package/dist/src/cli/commands/config.js +1 -0
- package/dist/src/cli/commands/registry.js +226 -1
- package/dist/src/cli/commands/review.js +50 -9
- package/dist/src/cli/commands/serve.js +5 -0
- package/dist/src/cli/commands/set.js +75 -17
- package/dist/src/cli/commands/view.js +46 -5
- package/dist/src/cli/commands/view_sources.d.ts +11 -0
- package/dist/src/cli/commands/view_sources.js +40 -0
- package/dist/src/cli/main.js +5 -0
- package/dist/src/cli/pr_carry.d.ts +25 -0
- package/dist/src/cli/pr_carry.js +128 -0
- package/dist/src/cli/prompt.js +26 -1
- package/dist/src/cli/review_args.d.ts +8 -0
- package/dist/src/cli/review_args.js +18 -0
- package/dist/src/cli/review_carry.d.ts +32 -0
- package/dist/src/cli/review_carry.js +60 -0
- package/dist/src/cli/review_github.d.ts +16 -2
- package/dist/src/cli/review_github.js +49 -12
- package/dist/src/cli/review_intent.d.ts +25 -0
- package/dist/src/cli/review_intent.js +87 -0
- package/dist/src/cli/review_result.d.ts +53 -2
- package/dist/src/cli/review_result.js +90 -23
- package/dist/src/config.d.ts +30 -0
- package/dist/src/config.js +20 -12
- package/dist/src/extensions/command.d.ts +1 -0
- package/dist/src/extensions/command.js +355 -0
- package/dist/src/extensions/contexts.d.ts +65 -0
- package/dist/src/extensions/contexts.js +134 -0
- package/dist/src/extensions/cost.d.ts +8 -0
- package/dist/src/extensions/cost.js +6 -0
- package/dist/src/extensions/local_tracking.d.ts +7 -0
- package/dist/src/extensions/local_tracking.js +29 -0
- package/dist/src/extensions/mock.d.ts +29 -0
- package/dist/src/extensions/mock.js +67 -0
- package/dist/src/extensions/process.d.ts +43 -0
- package/dist/src/extensions/process.js +244 -0
- package/dist/src/extensions/registry.d.ts +79 -0
- package/dist/src/extensions/registry.js +240 -0
- package/dist/src/extensions/render_actions.d.ts +6 -0
- package/dist/src/extensions/render_actions.js +50 -0
- package/dist/src/extensions/render_cli.d.ts +18 -0
- package/dist/src/extensions/render_cli.js +88 -0
- package/dist/src/extensions/render_json.d.ts +51 -0
- package/dist/src/extensions/render_json.js +144 -0
- package/dist/src/extensions/render_markdown.d.ts +22 -0
- package/dist/src/extensions/render_markdown.js +96 -0
- package/dist/src/extensions/render_review.d.ts +44 -0
- package/dist/src/extensions/render_review.js +167 -0
- package/dist/src/extensions/report.d.ts +57 -0
- package/dist/src/extensions/report.js +97 -0
- package/dist/src/extensions/review_result.d.ts +2 -0
- package/dist/src/extensions/review_result.js +14 -0
- package/dist/src/extensions/run_folder.d.ts +74 -0
- package/dist/src/extensions/run_folder.js +172 -0
- package/dist/src/extensions/runner.d.ts +66 -0
- package/dist/src/extensions/runner.js +251 -0
- package/dist/src/extensions/schema.d.ts +103 -0
- package/dist/src/extensions/schema.js +539 -0
- package/dist/src/extensions/session.d.ts +56 -0
- package/dist/src/extensions/session.js +173 -0
- package/dist/src/github/collect.d.ts +7 -2
- package/dist/src/github/collect.js +66 -6
- package/dist/src/github/gh.d.ts +7 -0
- package/dist/src/github/gh.js +24 -29
- package/dist/src/knowledge/guide.js +3 -2
- package/dist/src/knowledge/instruction_files.d.ts +45 -0
- package/dist/src/knowledge/instruction_files.js +91 -0
- package/dist/src/knowledge/instructions.d.ts +78 -0
- package/dist/src/knowledge/instructions.js +280 -0
- package/dist/src/knowledge/rule_changes.d.ts +39 -0
- package/dist/src/knowledge/rule_changes.js +90 -0
- package/dist/src/knowledge/rules.d.ts +44 -0
- package/dist/src/knowledge/rules.js +82 -0
- package/dist/src/knowledge/synthesis.d.ts +1 -0
- package/dist/src/knowledge/synthesis.js +12 -5
- package/dist/src/knowledge/types.d.ts +4 -0
- package/dist/src/local/carry_over_store.d.ts +10 -0
- package/dist/src/local/carry_over_store.js +17 -0
- package/dist/src/local/review_local.js +100 -62
- package/dist/src/local/review_lock.js +15 -4
- package/dist/src/pr/diff_plan.d.ts +110 -0
- package/dist/src/pr/diff_plan.js +429 -0
- package/dist/src/pr/diff_summary.d.ts +17 -1
- package/dist/src/pr/diff_summary.js +87 -13
- package/dist/src/pr/review_diff.d.ts +47 -0
- package/dist/src/pr/review_diff.js +112 -0
- package/dist/src/pr/reviewer.d.ts +44 -19
- package/dist/src/pr/reviewer.js +114 -142
- package/dist/src/remote/client.js +67 -8
- package/dist/src/remote/http.d.ts +12 -0
- package/dist/src/remote/http.js +31 -0
- package/dist/src/remote/push_client.js +14 -3
- package/dist/src/remote/server/guides.js +12 -1
- package/dist/src/remote/server/routes.js +4 -2
- package/dist/src/remote/server/sessions.js +4 -1
- package/dist/src/remote/validate.js +11 -0
- package/dist/src/review/carry_over.d.ts +6 -1
- package/dist/src/review/carry_over.js +10 -2
- package/dist/src/review/coverage.d.ts +57 -0
- package/dist/src/review/coverage.js +186 -0
- package/dist/src/review/diagram.d.ts +73 -0
- package/dist/src/review/diagram.js +309 -0
- package/dist/src/review/engine.d.ts +2 -6
- package/dist/src/review/engine.js +1 -1
- package/dist/src/review/guides.d.ts +6 -0
- package/dist/src/review/guides.js +8 -1
- package/dist/src/review/intent.d.ts +24 -0
- package/dist/src/review/intent.js +28 -0
- package/dist/src/review/not_initialized.d.ts +13 -0
- package/dist/src/review/not_initialized.js +18 -0
- package/dist/src/review/system_prompt.d.ts +6 -0
- package/dist/src/review/system_prompt.js +13 -0
- package/dist/src/review/visible_paths.d.ts +22 -0
- package/dist/src/review/visible_paths.js +41 -0
- package/dist/src/server/auth.js +8 -1
- package/dist/src/server/pages/extensions.d.ts +5 -0
- package/dist/src/server/pages/extensions.js +72 -0
- package/dist/src/server/pages/pr.js +3 -2
- package/dist/src/services/dashboard.d.ts +8 -0
- package/dist/src/services/dashboard.js +8 -0
- package/dist/src/services/push_review.js +14 -5
- package/dist/src/services/remote_review.js +81 -26
- package/dist/src/services/replies.js +15 -8
- package/dist/src/services/review.d.ts +9 -3
- package/dist/src/services/review.js +109 -28
- package/dist/src/services/rules_build.d.ts +46 -0
- package/dist/src/services/rules_build.js +155 -0
- package/dist/src/services/setup.d.ts +31 -0
- package/dist/src/services/setup.js +120 -25
- package/dist/src/services/watch_comments.js +2 -0
- package/dist/src/store/app_db.d.ts +3 -1
- package/dist/src/store/app_db.js +7 -2
- package/dist/src/store/cache_db.js +3 -0
- package/dist/src/store/extensions.d.ts +51 -0
- package/dist/src/store/extensions.js +132 -0
- package/dist/src/store/migrations.js +40 -0
- package/dist/src/types.d.ts +22 -1
- package/dist/src/util/atomic.d.ts +15 -1
- package/dist/src/util/atomic.js +59 -29
- package/dist/src/util/interrupt.d.ts +6 -0
- package/dist/src/util/interrupt.js +27 -0
- package/dist/src/util/runtime.d.ts +3 -1
- package/dist/src/util/runtime.js +2 -2
- package/dist/src/util/test_location_guard.d.ts +6 -0
- package/dist/src/util/test_location_guard.js +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ npm run docs:build # rebuild docs/ from docs/md/
|
|
|
104
104
|
npm run e2e # end-to-end CLI loop
|
|
105
105
|
npm run review-local-e2e # fake-AI local review loop
|
|
106
106
|
npm run dashboard:smoke # browser smoke test
|
|
107
|
-
npm run e2e:simulate # init in a simulated GitHub, see CONTRIBUTING.md
|
|
107
|
+
npm run e2e:simulate # init, sync, review and App flows in a simulated GitHub, see CONTRIBUTING.md
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
Made by [Murat Kirazkaya](https://muratkirazkaya.com). If it helps you, a star or a thank you is how this project gets paid.
|
package/dist/package.json
CHANGED
package/dist/src/ai/anthropic.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getEnv } from "../util/runtime.js";
|
|
2
2
|
import { outputLimitError } from "./provider.js";
|
|
3
|
+
import { interruptSignal } from "../util/interrupt.js";
|
|
3
4
|
import { CliError, EXIT_RUNTIME, EXIT_USAGE, networkFailure, readBody, } from "../cli/error.js";
|
|
4
5
|
/** Required on every Messages request and the only version the errors below
|
|
5
6
|
* are written against. */
|
|
@@ -239,6 +240,7 @@ export class AnthropicProvider {
|
|
|
239
240
|
"Content-Type": "application/json",
|
|
240
241
|
},
|
|
241
242
|
body: JSON.stringify(body),
|
|
243
|
+
signal: interruptSignal(),
|
|
242
244
|
});
|
|
243
245
|
}
|
|
244
246
|
catch (error) {
|
package/dist/src/ai/batch.d.ts
CHANGED
|
@@ -34,7 +34,9 @@ export declare class AiBatch {
|
|
|
34
34
|
* rejects. It never throws: a provider error that outlives its retries drops
|
|
35
35
|
* the unit, and a response that still does not validate is used anyway. A run
|
|
36
36
|
* that has already paid for extraction must still write what it has; a format
|
|
37
|
-
* deviation is not worth losing the whole run over.
|
|
37
|
+
* deviation is not worth losing the whole run over. The one exception is
|
|
38
|
+
* Ctrl-C: every call then fails at once, and a run that went on without
|
|
39
|
+
* them would write guides with every section dropped. */
|
|
38
40
|
private completeUnit;
|
|
39
41
|
private load;
|
|
40
42
|
private persist;
|
package/dist/src/ai/batch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isNotFound, readTextFile } from "../util/runtime.js";
|
|
|
3
3
|
import { formatError } from "../cli/error.js";
|
|
4
4
|
import { recordRateLimitWait } from "../services/rate_limit.js";
|
|
5
5
|
import { log } from "../util/log.js";
|
|
6
|
+
import { interrupted, interruptSignal } from "../util/interrupt.js";
|
|
6
7
|
/** A provider call and an unusable response are both retried this many times
|
|
7
8
|
* before the batch gives up and the run fails. */
|
|
8
9
|
export const MAX_ATTEMPTS = 3;
|
|
@@ -24,6 +25,20 @@ export function retryDelayMs(reason, attempt) {
|
|
|
24
25
|
return 0;
|
|
25
26
|
return RATE_LIMIT_BACKOFF_MS[Math.min(attempt - 1, RATE_LIMIT_BACKOFF_MS.length - 1)];
|
|
26
27
|
}
|
|
28
|
+
/** Waits `ms`, or less when Ctrl-C comes first. A rate-limit wait is up to a
|
|
29
|
+
* minute, and an interrupted run should not sit through it. */
|
|
30
|
+
function pause(ms) {
|
|
31
|
+
const signal = interruptSignal();
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
const done = () => {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
signal?.removeEventListener("abort", done);
|
|
36
|
+
resolve();
|
|
37
|
+
};
|
|
38
|
+
const timer = setTimeout(done, ms);
|
|
39
|
+
signal?.addEventListener("abort", done, { once: true });
|
|
40
|
+
});
|
|
41
|
+
}
|
|
27
42
|
async function digest(value) {
|
|
28
43
|
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
29
44
|
return [...new Uint8Array(bytes)]
|
|
@@ -114,7 +129,9 @@ export class AiBatch {
|
|
|
114
129
|
* rejects. It never throws: a provider error that outlives its retries drops
|
|
115
130
|
* the unit, and a response that still does not validate is used anyway. A run
|
|
116
131
|
* that has already paid for extraction must still write what it has; a format
|
|
117
|
-
* deviation is not worth losing the whole run over.
|
|
132
|
+
* deviation is not worth losing the whole run over. The one exception is
|
|
133
|
+
* Ctrl-C: every call then fails at once, and a run that went on without
|
|
134
|
+
* them would write guides with every section dropped. */
|
|
118
135
|
async completeUnit(item, results, usage, startedAt) {
|
|
119
136
|
for (let attempt = 1;; attempt++) {
|
|
120
137
|
let response;
|
|
@@ -122,6 +139,8 @@ export class AiBatch {
|
|
|
122
139
|
response = await this.provider.complete(item.request);
|
|
123
140
|
}
|
|
124
141
|
catch (error) {
|
|
142
|
+
if (interrupted())
|
|
143
|
+
throw error;
|
|
125
144
|
const reason = formatError(error);
|
|
126
145
|
const limit = isRateLimit(reason)
|
|
127
146
|
? MAX_RATE_LIMIT_ATTEMPTS
|
|
@@ -137,7 +156,9 @@ export class AiBatch {
|
|
|
137
156
|
seconds: wait / 1000,
|
|
138
157
|
});
|
|
139
158
|
log("ai", `waiting ${Math.round(wait / 1000)}s before retry (provider is rate limiting)`);
|
|
140
|
-
await
|
|
159
|
+
await pause(wait);
|
|
160
|
+
if (interrupted())
|
|
161
|
+
throw error;
|
|
141
162
|
}
|
|
142
163
|
continue;
|
|
143
164
|
}
|
|
@@ -17,9 +17,11 @@ import { spawn } from "node:child_process";
|
|
|
17
17
|
import { createServer } from "node:http";
|
|
18
18
|
import { CliError, EXIT_RUNTIME, EXIT_USAGE, networkFailure, readBody, } from "../../cli/error.js";
|
|
19
19
|
import { getConfigDir } from "../../config.js";
|
|
20
|
-
import {
|
|
20
|
+
import { writeTextFileAtomic } from "../../util/atomic.js";
|
|
21
|
+
import { getEnv, isNotFound, readTextFileSync, remove, } from "../../util/runtime.js";
|
|
21
22
|
import { parseResponsesBody, readResponsesStream, responsesBody, } from "../openai.js";
|
|
22
23
|
import { SIWC_ALIAS, SIWC_LABEL, SIWC_PROVIDER } from "./ids.js";
|
|
24
|
+
import { interruptSignal } from "../../util/interrupt.js";
|
|
23
25
|
export { SIWC_ALIAS, SIWC_LABEL, SIWC_PROVIDER };
|
|
24
26
|
const CALLBACK_PATH = "/auth/callback";
|
|
25
27
|
const APP_NAME = "co-maintainer";
|
|
@@ -140,16 +142,11 @@ export function loadCredentials() {
|
|
|
140
142
|
return undefined;
|
|
141
143
|
}
|
|
142
144
|
}
|
|
145
|
+
/** A refresh in `serve` can write the file while a review in another process
|
|
146
|
+
* reads it, and a half file reads as signed out. So it is replaced whole, and
|
|
147
|
+
* kept readable only by the current user where the platform supports it. */
|
|
143
148
|
async function saveCredentials(creds) {
|
|
144
|
-
|
|
145
|
-
await mkdir(path.replace(/\/[^/]+$/, ""), { recursive: true });
|
|
146
|
-
await writeTextFile(path, `${JSON.stringify(creds, null, 2)}\n`);
|
|
147
|
-
try {
|
|
148
|
-
await chmod(path, 0o600);
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// Windows has no POSIX chmod; NotSupported there is expected.
|
|
152
|
-
}
|
|
149
|
+
await writeTextFileAtomic(credentialsPath(), `${JSON.stringify(creds, null, 2)}\n`, { mode: 0o600 });
|
|
153
150
|
}
|
|
154
151
|
/** Keeps the issued client id even when the code exchange fails, so a later
|
|
155
152
|
* run reauthorizes with it instead of registering again. */
|
|
@@ -528,6 +525,7 @@ export class SignInWithChatGptProvider {
|
|
|
528
525
|
"Content-Type": "application/json",
|
|
529
526
|
},
|
|
530
527
|
body: JSON.stringify(responsesBody(this.model, request, { planUsage: true })),
|
|
528
|
+
signal: interruptSignal(),
|
|
531
529
|
});
|
|
532
530
|
}
|
|
533
531
|
catch (error) {
|
package/dist/src/ai/openai.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getEnv } from "../util/runtime.js";
|
|
2
2
|
import { outputLimitError, withoutRefusedPart } from "./provider.js";
|
|
3
|
+
import { interruptSignal } from "../util/interrupt.js";
|
|
3
4
|
import { CliError, EXIT_RUNTIME, EXIT_USAGE, connectionCut, networkFailure, readBody, } from "../cli/error.js";
|
|
4
5
|
/** `CM_OPENAI_URL` points at a local fake in tests. Unset means the real
|
|
5
6
|
* endpoint, so production behavior is unchanged. */
|
|
@@ -254,6 +255,7 @@ export class OpenAiProvider {
|
|
|
254
255
|
"Content-Type": "application/json",
|
|
255
256
|
},
|
|
256
257
|
body: JSON.stringify(body),
|
|
258
|
+
signal: interruptSignal(),
|
|
257
259
|
});
|
|
258
260
|
}
|
|
259
261
|
catch (error) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { chatBody, parseChatResponse, withoutRefusedPart } from "./provider.js";
|
|
2
2
|
import { getEnv } from "../util/runtime.js";
|
|
3
|
+
import { interruptSignal } from "../util/interrupt.js";
|
|
3
4
|
import { CliError, EXIT_RUNTIME, EXIT_USAGE, networkFailure, readBody, } from "../cli/error.js";
|
|
4
5
|
/** `CM_OPENROUTER_URL` points the provider at a local fake in tests. It is
|
|
5
6
|
* only a default override: with the env unset the real endpoint is used, so
|
|
@@ -64,6 +65,7 @@ export class OpenRouterProvider {
|
|
|
64
65
|
...this.host.headers,
|
|
65
66
|
},
|
|
66
67
|
body: JSON.stringify(body),
|
|
68
|
+
signal: interruptSignal(),
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
catch (error) {
|
package/dist/src/cli/args.js
CHANGED
|
@@ -8,7 +8,14 @@ import { availableModelSlugs } from "../ai/oauth/sign-in-with-chatgpt.js";
|
|
|
8
8
|
import { detectRemoteRepo } from "../local/git_ops.js";
|
|
9
9
|
import { canonicalRepoName } from "../util/repo_name.js";
|
|
10
10
|
import { reviewBlockingFrom } from "../review/blocking.js";
|
|
11
|
+
import { DiagramSettingError, diagramOptionsFrom } from "../review/diagram.js";
|
|
12
|
+
import { agentInstructionsError } from "../knowledge/instruction_files.js";
|
|
11
13
|
import { renderCommandHelp, renderGlobalHelp, unknownCommandMessage, unknownOptionMessage, } from "./commands/registry.js";
|
|
14
|
+
const REVIEW_DIAGRAM_FLAGS = [
|
|
15
|
+
"diagram-runtime",
|
|
16
|
+
"plantuml-server",
|
|
17
|
+
"plantuml-output-format",
|
|
18
|
+
];
|
|
12
19
|
function numberOption(value, name) {
|
|
13
20
|
const number = Number(value);
|
|
14
21
|
if (!Number.isInteger(number) || number < 0) {
|
|
@@ -172,6 +179,9 @@ export async function parseArgs(args) {
|
|
|
172
179
|
"github-pat",
|
|
173
180
|
"low-model",
|
|
174
181
|
"high-model",
|
|
182
|
+
...(command === "review" ? REVIEW_DIAGRAM_FLAGS : []),
|
|
183
|
+
"agent-instructions",
|
|
184
|
+
"agent-instructions-max-chars",
|
|
175
185
|
].some((name) => arg.startsWith(`--${name}=`));
|
|
176
186
|
if (arg === "--codegraph")
|
|
177
187
|
die("Unknown option: --codegraph");
|
|
@@ -187,6 +197,23 @@ export async function parseArgs(args) {
|
|
|
187
197
|
if (arg.startsWith("--") && !known)
|
|
188
198
|
die(unknownOptionMessage(arg, command));
|
|
189
199
|
}
|
|
200
|
+
// Only `review` takes the diagram flags. The repository's stored choice is
|
|
201
|
+
// read the same way, so a bad stored value stops the run and names itself.
|
|
202
|
+
let diagram = {};
|
|
203
|
+
if (command === "review") {
|
|
204
|
+
try {
|
|
205
|
+
diagram = diagramOptionsFrom({
|
|
206
|
+
runtime: text("diagram-runtime"),
|
|
207
|
+
server: text("plantuml-server"),
|
|
208
|
+
format: text("plantuml-output-format"),
|
|
209
|
+
}, repoConfig, repoName);
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
if (error instanceof DiagramSettingError)
|
|
213
|
+
die(error.message);
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
190
217
|
// `--json` must not prompt. `review` strips the flag before this parse and
|
|
191
218
|
// sets the same switch itself.
|
|
192
219
|
const json = rest.includes("--json");
|
|
@@ -296,6 +323,21 @@ export async function parseArgs(args) {
|
|
|
296
323
|
(!lowModel || !highModel || !aiToken)) {
|
|
297
324
|
die("--token, --low-model, and --high-model are required when AI is enabled");
|
|
298
325
|
}
|
|
326
|
+
// A blank value is kept: it turns the instructions off and is remembered
|
|
327
|
+
// that way, unlike a missing flag, which keeps the saved value.
|
|
328
|
+
const agentInstructionsFlag = text("agent-instructions");
|
|
329
|
+
const agentInstructions = agentInstructionsFlag ?? repoConfig.agentInstructions;
|
|
330
|
+
if (agentInstructionsFlag !== undefined && agentInstructionsFlag.trim()) {
|
|
331
|
+
const error = agentInstructionsError(agentInstructionsFlag);
|
|
332
|
+
if (error) {
|
|
333
|
+
die(`--agent-instructions is not a valid regular expression: ${error}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const rawMaxChars = text("agent-instructions-max-chars");
|
|
337
|
+
if (rawMaxChars !== undefined &&
|
|
338
|
+
(rawMaxChars.trim() === "" || !Number.isInteger(Number(rawMaxChars)))) {
|
|
339
|
+
die("--agent-instructions-max-chars must be an integer");
|
|
340
|
+
}
|
|
299
341
|
const resolvedConcurrency = resolveConcurrency(repoName, config);
|
|
300
342
|
return {
|
|
301
343
|
command: command === "sync" ? "remake" : command,
|
|
@@ -335,7 +377,12 @@ export async function parseArgs(args) {
|
|
|
335
377
|
repoConfig.maxPullRequestChangeLines ??
|
|
336
378
|
configDefault.maxPullRequestChangeLines,
|
|
337
379
|
maxComments: value("max-comment") ?? repoConfig.maxComments,
|
|
380
|
+
agentInstructions,
|
|
381
|
+
agentInstructionsMaxChars: rawMaxChars !== undefined
|
|
382
|
+
? Number(rawMaxChars)
|
|
383
|
+
: repoConfig.agentInstructionsMaxChars,
|
|
338
384
|
reviewBlocking,
|
|
339
385
|
reviewSystemPrompt: repoConfig.reviewSystemPrompt,
|
|
386
|
+
...diagram,
|
|
340
387
|
};
|
|
341
388
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { Estimate } from "../ai/estimate.ts";
|
|
9
9
|
import type { RunSummary } from "../util/run_summary.ts";
|
|
10
|
+
import type { RuleChanges } from "../knowledge/rule_changes.ts";
|
|
10
11
|
export type ProbeJsonInput = {
|
|
11
12
|
repo: string;
|
|
12
13
|
recommended: string;
|
|
@@ -41,11 +42,29 @@ export type SetupJsonInput = {
|
|
|
41
42
|
facts: number;
|
|
42
43
|
pullRequests: number;
|
|
43
44
|
commits: number;
|
|
44
|
-
|
|
45
|
+
/** `kept` when this run could not rebuild the guide and kept the last one. */
|
|
46
|
+
reviewGuide: "detailed" | "single" | "kept" | "skipped";
|
|
45
47
|
validation: {
|
|
46
48
|
errors: string[];
|
|
47
49
|
warnings: string[];
|
|
48
50
|
};
|
|
51
|
+
/** What happened to `INSTRUCTIONS.md`. `kept` means the AI gave no usable
|
|
52
|
+
* answer and any earlier file stays. */
|
|
53
|
+
instructions?: {
|
|
54
|
+
status: "written" | "kept" | "empty" | "skipped";
|
|
55
|
+
rules: number;
|
|
56
|
+
reason?: string;
|
|
57
|
+
counts?: {
|
|
58
|
+
unsupportedSource: number;
|
|
59
|
+
unknownName: number;
|
|
60
|
+
overCap: number;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/** The full change lists behind the `[instructions]` line, or `null` when
|
|
64
|
+
* there was no earlier `RULES.json`. */
|
|
65
|
+
ruleChanges?: {
|
|
66
|
+
instructions: RuleChanges;
|
|
67
|
+
} | null;
|
|
49
68
|
summary: RunSummary;
|
|
50
69
|
};
|
|
51
70
|
export declare function buildSetupJson(input: SetupJsonInput): string;
|
|
@@ -35,6 +35,10 @@ export function buildSetupJson(input) {
|
|
|
35
35
|
commits: input.commits,
|
|
36
36
|
reviewGuide: input.reviewGuide,
|
|
37
37
|
validation: input.validation,
|
|
38
|
+
...(input.instructions ? { instructions: input.instructions } : {}),
|
|
39
|
+
...(input.ruleChanges !== undefined
|
|
40
|
+
? { ruleChanges: input.ruleChanges }
|
|
41
|
+
: {}),
|
|
38
42
|
usage: {
|
|
39
43
|
tokensIn: summary.tokensIn,
|
|
40
44
|
tokensOut: summary.tokensOut,
|
|
@@ -37,7 +37,7 @@ export declare function resolveField(name: string): string;
|
|
|
37
37
|
* `defaults` are nested maps, not settings, so they are not listed.
|
|
38
38
|
* `satisfies` makes this the type's own vocabulary: a name that is not a
|
|
39
39
|
* `UserConfig` key is a compile error rather than a silently undefined read. */
|
|
40
|
-
export declare const KNOWN_FIELDS: readonly ["auth", "ai", "lowModel", "highModel", "token", "githubPat", "githubAppId", "githubAppPrivateKey", "githubAppPrivateKeyPath", "githubWebhookSecret", "webhookUrl", "githubOAuthClientId", "githubOAuthClientSecret", "githubOAuthAllowedUser", "passwordAuthDisabled", "githubAuthEnabled", "dashboardPasswordHash", "maxConcurrentJobs", "reviewBlocking", "codegraphVersion", "remoteHost", "remoteToken", "remoteNoticeShownFor", "remoteSyncTimeoutSeconds", "maxConcurrentRemoteReviewsPerToken", "remoteToolOutputMaxChars", "remoteByok", "remoteByokDefault", "remoteByokPolicy", "reviewPolicy"];
|
|
40
|
+
export declare const KNOWN_FIELDS: readonly ["auth", "ai", "lowModel", "highModel", "token", "githubPat", "githubAppId", "githubAppPrivateKey", "githubAppPrivateKeyPath", "githubWebhookSecret", "webhookUrl", "githubOAuthClientId", "githubOAuthClientSecret", "githubOAuthAllowedUser", "passwordAuthDisabled", "githubAuthEnabled", "dashboardPasswordHash", "maxConcurrentJobs", "reviewBlocking", "codegraphVersion", "remoteHost", "remoteToken", "remoteNoticeShownFor", "remoteSyncTimeoutSeconds", "maxConcurrentRemoteReviewsPerToken", "remoteToolOutputMaxChars", "remoteByok", "remoteByokDefault", "remoteByokPolicy", "reviewPolicy", "extensionRerunOnRestart"];
|
|
41
41
|
/** `co-maintainer config <sub> ...`. `set` is handled by runSet, which this
|
|
42
42
|
* command delegates to so there is one implementation of the write rules. */
|
|
43
43
|
export declare function runConfig(args: string[]): Promise<void>;
|
|
@@ -161,6 +161,7 @@ export const KNOWN_FIELDS = [
|
|
|
161
161
|
"remoteByokDefault",
|
|
162
162
|
"remoteByokPolicy",
|
|
163
163
|
"reviewPolicy",
|
|
164
|
+
"extensionRerunOnRestart",
|
|
164
165
|
];
|
|
165
166
|
/** `co-maintainer config <sub> ...`. `set` is handled by runSet, which this
|
|
166
167
|
* command delegates to so there is one implementation of the write rules. */
|