crysk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -17
- package/config/models/anthropic.json +1 -1
- package/dist/SKILL-k4k0zn1w.md +143 -0
- package/dist/SKILL-vhb4c3vv.md +553 -0
- package/dist/SKILL-xpf6kmdw.md +74 -0
- package/dist/ci-admission-0ken6ehx.md +128 -0
- package/dist/cli.js +3056 -1623
- package/dist/index.js +1744 -938
- package/dist/opencode-ci-ac5zksdn.md +106 -0
- package/dist/workflow-4pkyck01.yml +160 -0
- package/package.json +1 -1
- package/prompts/default/PROVENANCE.md +1 -0
- package/skills/crysk/SKILL.md +16 -16
- package/skills/crysk-ci-setup/SKILL.md +41 -38
- package/skills/crysk-ci-setup/assets/workflow.yml +31 -22
- package/skills/crysk-ci-setup/references/ci-admission.md +1 -1
- package/skills/crysk-ci-setup/references/opencode-ci.md +53 -88
- package/skills/crysk-loop/SKILL.md +1 -1
- package/src/asset-manifest.ts +0 -4
- package/src/assets.ts +1 -1
- package/src/ci/admission-ledger.ts +4 -0
- package/src/ci/classify-error.ts +21 -24
- package/src/ci/cli-record.ts +53 -1
- package/src/ci/crysk-secrets.ts +409 -0
- package/src/ci/gates.ts +22 -36
- package/src/ci/outcome.ts +421 -330
- package/src/ci/platform-config.ts +2 -2
- package/src/ci/platform-report.ts +274 -41
- package/src/ci/platform-trace.ts +551 -0
- package/src/ci/platform.ts +28 -12
- package/src/ci/publish.ts +19 -6
- package/src/ci/review-levels.ts +8 -7
- package/src/ci/run.ts +88 -0
- package/src/ci/setup.ts +453 -118
- package/src/ci/trace-bundle.ts +1282 -0
- package/src/ci/trace-transcripts.ts +415 -0
- package/src/ci/trigger.ts +176 -33
- package/src/cli.ts +11 -3
- package/src/commands/ci-setup-questions.ts +3 -3
- package/src/commands/ci-setup.ts +152 -6
- package/src/commands/config.ts +3 -0
- package/src/commands/doctor.ts +15 -6
- package/src/config/config.ts +16 -3
- package/src/diversity/clustering.ts +0 -1
- package/src/diversity/identity.ts +4 -5
- package/src/diversity/pipeline-integration.ts +1 -9
- package/src/doctor.ts +3 -3
- package/src/execution/attempt-evidence.ts +10 -5
- package/src/execution/claude-session-trace.ts +480 -0
- package/src/execution/contracts.ts +21 -4
- package/src/execution/harness.ts +105 -8
- package/src/execution/model-fallback.ts +239 -0
- package/src/execution/usage-normalized.ts +6 -4
- package/src/home-preflight.ts +1 -1
- package/src/index.ts +1 -1
- package/src/model/catalog.ts +13 -37
- package/src/model/free-discovery.ts +117 -8
- package/src/model/model-name.ts +404 -0
- package/src/model/provider-capabilities.ts +22 -7
- package/src/model/routing.ts +346 -467
- package/src/pr/admission.ts +18 -0
- package/src/pr/plan.ts +20 -4
- package/src/pr/preflight.ts +1 -1
- package/src/pr/publish-outcome.ts +1 -1
- package/src/pr/review-pr.ts +15 -1
- package/src/pr/target.ts +12 -3
- package/src/production-runtime.ts +760 -331
- package/src/review/pipeline.ts +277 -101
- package/src/review/preflight.ts +201 -294
- package/src/review/report.ts +26 -26
- package/src/review/review.ts +20 -3
- package/src/review/route-preflight.ts +79 -11
- package/src/review/run.ts +28 -6
- package/src/review/scout.ts +1 -1
- package/src/review/spec.ts +3 -3
- package/src/review/step-runner.ts +70 -1
- package/src/runner-authority.ts +127 -9
- package/src/security/binding-policy.ts +1 -2
- package/src/security/claude-credential.ts +355 -0
- package/src/security/credential-broker.ts +56 -40
- package/src/security/evidence-redaction.ts +179 -4
- package/src/security/opencode-secret-manifest.ts +114 -0
- package/src/security/redact.ts +45 -0
- package/src/system-tools.ts +48 -21
- package/src/transport-registry.ts +12 -2
- package/src/transports/claude-code-cli.ts +21 -2
- package/src/transports/opencode-sdk.ts +11 -9
- package/src/transports/opencode-server.ts +7 -10
- package/src/ui/config-edit.ts +9 -20
- package/src/ui/config.ts +32 -27
- package/src/ui/plan.ts +76 -47
- package/src/updater.ts +10 -7
- package/prompts/default/deep-review-lifecycle.md +0 -362
package/src/review/preflight.ts
CHANGED
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
type CiReviewPolicyMode,
|
|
14
14
|
} from "#ci/review-policy";
|
|
15
15
|
import type { EffectiveConfig } from "#config/config";
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "#model/routing";
|
|
16
|
+
import {
|
|
17
|
+
ModelNameError,
|
|
18
|
+
type ModelsConfig,
|
|
19
|
+
parseModelsConfig,
|
|
20
|
+
} from "#model/model-name";
|
|
21
|
+
import { judgeModelChoice } from "#model/routing";
|
|
22
22
|
import { POST_MIN_SEVERITIES, type PostMinSeverity } from "#pr/post-floor";
|
|
23
23
|
import type { SuspicionPrior } from "#review/prompt-set";
|
|
24
24
|
import { type AgentSpec, isSafeSlug, type ReviewSpec } from "#review/spec";
|
|
@@ -36,7 +36,7 @@ import { REPO_DIR_NAME } from "../brand-paths";
|
|
|
36
36
|
// imports only the ones it uses itself.
|
|
37
37
|
import { CliError, CliUsageError, withUsageClass } from "../errors";
|
|
38
38
|
import { DEFAULT_BASE_REF, listPaths } from "../git/refs";
|
|
39
|
-
import {
|
|
39
|
+
import { redactConfigValue } from "../security/redact";
|
|
40
40
|
// review/size-gate.ts imports only a TYPE from here, so this is not a runtime
|
|
41
41
|
// cycle — the type import is erased and size-gate has no load-time
|
|
42
42
|
// dependency on this module.
|
|
@@ -512,7 +512,11 @@ Options:
|
|
|
512
512
|
default 8; 0 pauses verification), and optional
|
|
513
513
|
max_concurrent_steps (cap on steps in flight at once;
|
|
514
514
|
a positive integer; unset = unlimited)
|
|
515
|
-
--model <model> Override every
|
|
515
|
+
--model <model> Override every step's model but the materiality judge's:
|
|
516
|
+
claude:<name>-latest, claude:<full model name>,
|
|
517
|
+
opencode:<provider>/<model>, or a bare alias (sonnet,
|
|
518
|
+
opus, haiku, fable). A model only: per-role models and
|
|
519
|
+
their effort go in "models" in ~/.crysk/config.json
|
|
516
520
|
--summary Enable the engine-owned PR summary (default)
|
|
517
521
|
--no-summary Disable the engine-owned PR summary
|
|
518
522
|
--scout review only: run the diff-only scout stage before the
|
|
@@ -1963,12 +1967,23 @@ export function assertBasenameOnly(file: string, index: number): void {
|
|
|
1963
1967
|
|
|
1964
1968
|
export const AGENT_FILE_PATTERNS = ["deep-review-*.md", "review-*.md"];
|
|
1965
1969
|
|
|
1966
|
-
// BIDIRECTIONAL on purpose, and this is the check that pays for itself.
|
|
1967
|
-
//
|
|
1968
|
-
//
|
|
1969
|
-
//
|
|
1970
|
-
//
|
|
1971
|
-
//
|
|
1970
|
+
// BIDIRECTIONAL on purpose, and this is the check that pays for itself. A spec
|
|
1971
|
+
// that omits a file the dir carries silently drops that hunter — the run
|
|
1972
|
+
// completes, the artifacts validate, the cost looks normal, and nothing
|
|
1973
|
+
// downstream notices. So: every file the spec names must exist, AND every
|
|
1974
|
+
// agent file present must be named.
|
|
1975
|
+
//
|
|
1976
|
+
// The lifecycle hunter was retired from the default spec (2026-11-08: on the
|
|
1977
|
+
// benchmarks it added almost nothing the other hunters missed, for about 37%
|
|
1978
|
+
// of the cost and wall time). A custom set copied from an older default still
|
|
1979
|
+
// carries its file, so that one file gets the way out in its message.
|
|
1980
|
+
const RETIRED_AGENT_HINTS: Record<string, string> = {
|
|
1981
|
+
"deep-review-lifecycle.md":
|
|
1982
|
+
"; the lifecycle hunter was retired from the default spec: delete the " +
|
|
1983
|
+
"file, or keep the hunter with " +
|
|
1984
|
+
"CRYSK_EXTRA_HUNTERS=lifecycle:deep-review-lifecycle.md",
|
|
1985
|
+
};
|
|
1986
|
+
|
|
1972
1987
|
export function agentsDirProblems(
|
|
1973
1988
|
specFiles: string[],
|
|
1974
1989
|
presentFiles: string[],
|
|
@@ -1987,7 +2002,7 @@ export function agentsDirProblems(
|
|
|
1987
2002
|
if (!named.has(file)) {
|
|
1988
2003
|
problems.push(
|
|
1989
2004
|
`the dir has "${file}" but no agent in the spec references it ` +
|
|
1990
|
-
|
|
2005
|
+
`(it would never run)${RETIRED_AGENT_HINTS[file] ?? ""}`,
|
|
1991
2006
|
);
|
|
1992
2007
|
}
|
|
1993
2008
|
}
|
|
@@ -2104,10 +2119,9 @@ function parseExtraHunters(read: BrandEnvValue | undefined): AgentSpec[] {
|
|
|
2104
2119
|
});
|
|
2105
2120
|
}
|
|
2106
2121
|
|
|
2107
|
-
// Local mode's wiring: the
|
|
2122
|
+
// Local mode's wiring: the three unconditional hunters, the conditional
|
|
2108
2123
|
// parity hunter, and the refuter. Deliberately NOT defaultReviewSpec() — that
|
|
2109
|
-
// one omits the
|
|
2110
|
-
// clean set. Hunter keys stay inside the findings-schema v1.1.0 Hunter/specialty
|
|
2124
|
+
// one omits the logic hunter, and local mode targets the 5-file clean set. Hunter keys stay inside the findings-schema v1.1.0 Hunter/specialty
|
|
2111
2125
|
// set, which validateReviewSpec enforces.
|
|
2112
2126
|
//
|
|
2113
2127
|
// `env` is injectable (defaults to `process.env`) so PRHERO_EXTRA_HUNTERS can
|
|
@@ -2125,7 +2139,6 @@ export function localReviewSpec(
|
|
|
2125
2139
|
role: "hunter",
|
|
2126
2140
|
},
|
|
2127
2141
|
{ key: "resilience", file: "deep-review-resilience.md", role: "hunter" },
|
|
2128
|
-
{ key: "lifecycle", file: "deep-review-lifecycle.md", role: "hunter" },
|
|
2129
2142
|
{ key: "logic", file: "deep-review-logic.md", role: "hunter" },
|
|
2130
2143
|
{
|
|
2131
2144
|
key: "parity",
|
|
@@ -2175,7 +2188,11 @@ export const CONFIG_DIRECTION: Record<keyof LocalConfig, ConfigDirection> = {
|
|
|
2175
2188
|
// exists. This row declares the key for the known-key set; the merge
|
|
2176
2189
|
// descends into it rather than folding the object whole.
|
|
2177
2190
|
summary: "capped",
|
|
2178
|
-
|
|
2191
|
+
// Which model runs each role and which Claude credential pays for it are the
|
|
2192
|
+
// operator's decisions: a committed file must not move them onto another
|
|
2193
|
+
// model or another bill. Both are PERSON_ONLY_KEYS, refused in a repo file.
|
|
2194
|
+
models: "person",
|
|
2195
|
+
credentials: "person",
|
|
2179
2196
|
max_verification_steps: "capped",
|
|
2180
2197
|
max_concurrent_steps: "capped",
|
|
2181
2198
|
max_changed_lines: "capped",
|
|
@@ -2201,12 +2218,10 @@ export const CONFIG_DIRECTION: Record<keyof LocalConfig, ConfigDirection> = {
|
|
|
2201
2218
|
};
|
|
2202
2219
|
|
|
2203
2220
|
// The ONE nested key, so this is a second table and not a pattern. `enabled`
|
|
2204
|
-
// takes the cap because it switches spend on
|
|
2205
|
-
//
|
|
2206
|
-
// cannot be computed is worse than no direction at all.
|
|
2221
|
+
// takes the cap because it switches spend on. `summary.model` is gone: the
|
|
2222
|
+
// summary model is the `summary` role under `models` (see parseSummaryConfig).
|
|
2207
2223
|
export const SUMMARY_DIRECTION: Record<keyof SummaryConfig, ConfigDirection> = {
|
|
2208
2224
|
enabled: "capped",
|
|
2209
|
-
model: "person",
|
|
2210
2225
|
};
|
|
2211
2226
|
|
|
2212
2227
|
export interface LocalConfig {
|
|
@@ -2218,7 +2233,11 @@ export interface LocalConfig {
|
|
|
2218
2233
|
agents_dir?: string;
|
|
2219
2234
|
default_base?: string;
|
|
2220
2235
|
summary?: SummaryConfig;
|
|
2221
|
-
|
|
2236
|
+
// Role -> model list (S1). A role not listed uses `default`, and with no
|
|
2237
|
+
// `default` the step keeps its prompt's model.
|
|
2238
|
+
models?: ModelsConfig;
|
|
2239
|
+
// Which Claude credential is used, in order (S5).
|
|
2240
|
+
credentials?: CredentialsConfig;
|
|
2222
2241
|
// Item 7: unattended bound on the verify queue. Absent means
|
|
2223
2242
|
// DEFAULT_MAX_VERIFICATION_STEPS. 0 is legal — every queued prior lands
|
|
2224
2243
|
// `unconfirmed` (the pause switch, same shape as watch daily_cap).
|
|
@@ -2251,7 +2270,16 @@ export interface LocalConfig {
|
|
|
2251
2270
|
|
|
2252
2271
|
export interface SummaryConfig {
|
|
2253
2272
|
enabled?: boolean;
|
|
2254
|
-
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
// The Claude credentials a run may use, in the order they are tried (S5).
|
|
2276
|
+
// A closed vocabulary on purpose: this key is exempt from the credential
|
|
2277
|
+
// deny-list only because no value it admits can be a secret.
|
|
2278
|
+
export const CLAUDE_CREDENTIAL_KINDS = ["subscription", "api_key"] as const;
|
|
2279
|
+
export type ClaudeCredentialKind = (typeof CLAUDE_CREDENTIAL_KINDS)[number];
|
|
2280
|
+
|
|
2281
|
+
export interface CredentialsConfig {
|
|
2282
|
+
readonly claude?: readonly ClaudeCredentialKind[];
|
|
2255
2283
|
}
|
|
2256
2284
|
|
|
2257
2285
|
export interface SummarySettings {
|
|
@@ -2285,8 +2313,13 @@ export type ConfigLayer = Partial<LocalConfig>;
|
|
|
2285
2313
|
// known key.
|
|
2286
2314
|
const KNOWN_CONFIG_KEYS = new Set<string>(Object.keys(CONFIG_DIRECTION));
|
|
2287
2315
|
|
|
2316
|
+
// Keys a committed repo file may never set. Wider than "direction is person":
|
|
2317
|
+
// `agents_dir` and `post_min_severity` are person-direction keys a repo file
|
|
2318
|
+
// may still name. These two choose a model or a bill.
|
|
2319
|
+
const PERSON_ONLY_KEYS = new Set<string>(["models", "credentials"]);
|
|
2320
|
+
|
|
2288
2321
|
const LOCAL_CONFIG_KEYS = new Set<string>(
|
|
2289
|
-
Object.keys(CONFIG_DIRECTION).filter((key) => key
|
|
2322
|
+
Object.keys(CONFIG_DIRECTION).filter((key) => !PERSON_ONLY_KEYS.has(key)),
|
|
2290
2323
|
);
|
|
2291
2324
|
|
|
2292
2325
|
const GLOBAL_CONFIG_KEYS = new Set<string>(
|
|
@@ -2319,19 +2352,21 @@ const GLOBAL_CONFIG_LABEL = "~/.crysk/config.json";
|
|
|
2319
2352
|
// can still see was absent. The `?? []` locals below stay exactly as they
|
|
2320
2353
|
// are: they feed the validators, and validating an absent key against the
|
|
2321
2354
|
// empty array is what keeps every error string byte-identical.
|
|
2322
|
-
// The repo layer's usage errors carry the repo-config class (T2d-1).
|
|
2323
|
-
//
|
|
2324
|
-
// rejected as a per-person key before any routing value is parsed. The person layer's
|
|
2325
|
-
// errors carry no class (see parseGlobalConfig).
|
|
2355
|
+
// The repo layer's usage errors carry the repo-config class (T2d-1). The person
|
|
2356
|
+
// layer's errors carry no class (see parseGlobalConfig).
|
|
2326
2357
|
// `label` is the file name an error should show: a repo still on the legacy
|
|
2327
2358
|
// `.prhero/` passes `.prhero/config.json`, so the message names the file that
|
|
2328
2359
|
// was actually read.
|
|
2360
|
+
// `warnings` collects what the file says that still works but is on its way
|
|
2361
|
+
// out (today: `summary.model: "haiku"`). Returned as data, never printed here:
|
|
2362
|
+
// this module is the pure half, and the shells decide where a warning goes.
|
|
2329
2363
|
export function parseLocalConfig(
|
|
2330
2364
|
raw: string,
|
|
2331
2365
|
label: string = REPO_CONFIG_LABEL,
|
|
2366
|
+
warnings?: string[],
|
|
2332
2367
|
): ConfigLayer {
|
|
2333
2368
|
return withUsageClass({ kind: "config-parse", source: "repo-config" }, () =>
|
|
2334
|
-
parseConfigLayer(raw, label, LOCAL_CONFIG_KEYS,
|
|
2369
|
+
parseConfigLayer(raw, label, LOCAL_CONFIG_KEYS, true, warnings),
|
|
2335
2370
|
);
|
|
2336
2371
|
}
|
|
2337
2372
|
|
|
@@ -2341,22 +2376,28 @@ export function parseLocalConfig(
|
|
|
2341
2376
|
// rejects the three that are, because no global answer to them could be
|
|
2342
2377
|
// right: two are lists of paths inside one repository and the third selects a
|
|
2343
2378
|
// commit range ahead of an autodetection that already works.
|
|
2344
|
-
// Its routing object is parsed without the routing class. That class renders
|
|
2345
|
-
// PRH-ROUTING-INVALID, whose text names CRYSK_ROUTING and `gh variable set`: the
|
|
2346
|
-
// fix for the CI routing input, not for this personal file. The message is the same.
|
|
2347
2379
|
export function parseGlobalConfig(
|
|
2348
2380
|
raw: string,
|
|
2349
2381
|
label: string = GLOBAL_CONFIG_LABEL,
|
|
2382
|
+
warnings?: string[],
|
|
2350
2383
|
): ConfigLayer {
|
|
2351
|
-
return parseConfigLayer(
|
|
2352
|
-
raw,
|
|
2353
|
-
label,
|
|
2354
|
-
GLOBAL_CONFIG_KEYS,
|
|
2355
|
-
parseRoutingValue,
|
|
2356
|
-
false,
|
|
2357
|
-
);
|
|
2384
|
+
return parseConfigLayer(raw, label, GLOBAL_CONFIG_KEYS, false, warnings);
|
|
2358
2385
|
}
|
|
2359
2386
|
|
|
2387
|
+
// S2's clean break: `routing` is not read alongside `models`, it is refused
|
|
2388
|
+
// with the one thing that fixes it. Checked BEFORE the unknown-key and the
|
|
2389
|
+
// per-person checks, so a repo file gets this message too and not "routing is
|
|
2390
|
+
// a per-person key", which would send the operator to move a dead key.
|
|
2391
|
+
export const REMOVED_ROUTING_MESSAGE =
|
|
2392
|
+
'`routing` is gone: set models per role, e.g. `"models": {"hunter.logic": ["claude:sonnet-latest"]}`';
|
|
2393
|
+
|
|
2394
|
+
// `summary.model` is gone too (L6 item 1), except for the one value `crysk
|
|
2395
|
+
// init` used to write, which is accepted with a warning (parseSummaryConfig).
|
|
2396
|
+
const SUMMARY_MODEL_EXAMPLE =
|
|
2397
|
+
'`"models": {"summary": ["claude:haiku-latest"]}`';
|
|
2398
|
+
const SUMMARY_MODEL_INIT_VALUE = "haiku";
|
|
2399
|
+
const SUMMARY_MODEL_CONVERTED = ["claude:haiku-latest"] as const;
|
|
2400
|
+
|
|
2360
2401
|
// `??` is what makes an explicit `null` mean "absent" for the two arrays, and
|
|
2361
2402
|
// the returned layer has to agree with it: `{"suspicion_priors": null}`
|
|
2362
2403
|
// validates as the empty array, so it must not claim the layer spoke either.
|
|
@@ -2376,14 +2417,12 @@ function parseOptionalBoolean(
|
|
|
2376
2417
|
return value;
|
|
2377
2418
|
}
|
|
2378
2419
|
|
|
2379
|
-
// `parseRouting` is the layer's routing parser: the classed one for the repo file, the
|
|
2380
|
-
// unclassed one for the person file (see parseGlobalConfig for why it differs).
|
|
2381
2420
|
function parseConfigLayer(
|
|
2382
2421
|
raw: string,
|
|
2383
2422
|
file: string,
|
|
2384
2423
|
admitted: ReadonlySet<string>,
|
|
2385
|
-
parseRouting: typeof parseRoutingConfig,
|
|
2386
2424
|
isRepoFile: boolean,
|
|
2425
|
+
warnings: string[] | undefined,
|
|
2387
2426
|
): ConfigLayer {
|
|
2388
2427
|
let parsed: unknown;
|
|
2389
2428
|
try {
|
|
@@ -2398,8 +2437,11 @@ function parseConfigLayer(
|
|
|
2398
2437
|
}
|
|
2399
2438
|
const config = parsed as Record<string, unknown>;
|
|
2400
2439
|
for (const key of Object.keys(config)) {
|
|
2440
|
+
if (key === "routing") {
|
|
2441
|
+
throw new CliUsageError(`${file}: ${REMOVED_ROUTING_MESSAGE}`);
|
|
2442
|
+
}
|
|
2401
2443
|
if (!KNOWN_CONFIG_KEYS.has(key)) {
|
|
2402
|
-
throw new CliUsageError(`${file} unknown key: ${
|
|
2444
|
+
throw new CliUsageError(`${file} unknown key: ${redactConfigValue(key)}`);
|
|
2403
2445
|
}
|
|
2404
2446
|
// Templated over the OFFENDING key, never a fixed example: one hardcoded
|
|
2405
2447
|
// key name across three rejections sends two operators out of three
|
|
@@ -2451,8 +2493,39 @@ function parseConfigLayer(
|
|
|
2451
2493
|
throw new CliUsageError(`suspicion_priors[${i}].reason required`);
|
|
2452
2494
|
}
|
|
2453
2495
|
}
|
|
2454
|
-
const
|
|
2455
|
-
const
|
|
2496
|
+
const summaryParse = parseSummaryConfig(config.summary, file);
|
|
2497
|
+
const summary = summaryParse?.summary;
|
|
2498
|
+
let models = parseModels(config.models, file);
|
|
2499
|
+
if (summaryParse?.initModel === true) {
|
|
2500
|
+
if (isRepoFile) {
|
|
2501
|
+
// L6 item 6: a repo file can no longer pick the summary model, and
|
|
2502
|
+
// `models` is person-only, so the init-written value is dropped. It was
|
|
2503
|
+
// the summarizer prompt's own model, so dropping it changes nothing.
|
|
2504
|
+
warnings?.push(
|
|
2505
|
+
`${file}: summary.model is gone and is ignored here: the summary model is set per person, under models.summary in your person config (~/.crysk/config.json). Delete summary.model from this file.`,
|
|
2506
|
+
);
|
|
2507
|
+
} else if (models?.summary !== undefined) {
|
|
2508
|
+
warnings?.push(
|
|
2509
|
+
`${file}: summary.model is gone and models.summary already sets the summary model. Delete summary.model.`,
|
|
2510
|
+
);
|
|
2511
|
+
} else {
|
|
2512
|
+
models = { ...models, summary: [...SUMMARY_MODEL_CONVERTED] };
|
|
2513
|
+
warnings?.push(
|
|
2514
|
+
`${file}: summary.model is gone; "haiku" is read as ${SUMMARY_MODEL_EXAMPLE}. Write that instead of summary.model.`,
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
// The judge's list is kept as written (the plan skips what it cannot
|
|
2519
|
+
// use), but a model it will never run on is said out loud here, once.
|
|
2520
|
+
if (models?.judge !== undefined) {
|
|
2521
|
+
const { model, dropped } = judgeModelChoice(models);
|
|
2522
|
+
if (dropped.length > 0) {
|
|
2523
|
+
warnings?.push(
|
|
2524
|
+
`${file}: models.judge skips ${dropped.join(", ")}: the materiality judge runs only on claude:sonnet-latest or claude:opus-latest${model === undefined ? ", so it stands down" : ""}.`,
|
|
2525
|
+
);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
const credentials = parseCredentialsConfig(config.credentials, file);
|
|
2456
2529
|
const maxVerificationSteps = parseNonNegativeInteger(
|
|
2457
2530
|
config.max_verification_steps,
|
|
2458
2531
|
"max_verification_steps",
|
|
@@ -2536,7 +2609,8 @@ function parseConfigLayer(
|
|
|
2536
2609
|
...optionalString(config, "agents_dir", file),
|
|
2537
2610
|
...optionalString(config, "default_base", file),
|
|
2538
2611
|
...(summary === undefined ? {} : { summary }),
|
|
2539
|
-
...(
|
|
2612
|
+
...(models === undefined ? {} : { models }),
|
|
2613
|
+
...(credentials === undefined ? {} : { credentials }),
|
|
2540
2614
|
...(maxVerificationSteps === undefined
|
|
2541
2615
|
? {}
|
|
2542
2616
|
: { max_verification_steps: maxVerificationSteps }),
|
|
@@ -2580,251 +2654,83 @@ function parseConfigLayer(
|
|
|
2580
2654
|
};
|
|
2581
2655
|
}
|
|
2582
2656
|
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
"credentials",
|
|
2593
|
-
]);
|
|
2594
|
-
|
|
2595
|
-
function checkNoCredentials(
|
|
2596
|
-
obj: Record<string, unknown>,
|
|
2597
|
-
path: string,
|
|
2598
|
-
file: string,
|
|
2599
|
-
): void {
|
|
2600
|
-
for (const key of Object.keys(obj)) {
|
|
2601
|
-
const lower = key.toLowerCase();
|
|
2602
|
-
if (
|
|
2603
|
-
CREDENTIAL_KEY_NAMES.has(lower) ||
|
|
2604
|
-
lower.includes("secret") ||
|
|
2605
|
-
lower.includes("password") ||
|
|
2606
|
-
lower.includes("token") ||
|
|
2607
|
-
lower.includes("apikey") ||
|
|
2608
|
-
lower.includes("api_key")
|
|
2609
|
-
) {
|
|
2610
|
-
throw new CliUsageError(
|
|
2611
|
-
`${file} ${path}: credentials are not permitted in routing config`,
|
|
2612
|
-
);
|
|
2613
|
-
}
|
|
2614
|
-
const val = obj[key];
|
|
2615
|
-
if (typeof val === "string") {
|
|
2616
|
-
const redacted = redactDiagnostic(val);
|
|
2617
|
-
if (redacted !== val) {
|
|
2618
|
-
throw new CliUsageError(
|
|
2619
|
-
`${file} ${path}: credentials are not permitted in routing config`,
|
|
2620
|
-
);
|
|
2621
|
-
}
|
|
2657
|
+
// The `models` object (S1, S3). Its rules live in model/model-name.ts; this
|
|
2658
|
+
// adds the file to every message, as every other key's error does.
|
|
2659
|
+
function parseModels(value: unknown, file: string): ModelsConfig | undefined {
|
|
2660
|
+
if (value === undefined) return undefined;
|
|
2661
|
+
try {
|
|
2662
|
+
return parseModelsConfig(value);
|
|
2663
|
+
} catch (error) {
|
|
2664
|
+
if (error instanceof ModelNameError) {
|
|
2665
|
+
throw new CliUsageError(`${file} ${error.message}`);
|
|
2622
2666
|
}
|
|
2667
|
+
throw error;
|
|
2623
2668
|
}
|
|
2624
2669
|
}
|
|
2625
2670
|
|
|
2626
|
-
const
|
|
2627
|
-
"
|
|
2628
|
-
"backend",
|
|
2629
|
-
"provider",
|
|
2630
|
-
"gateway",
|
|
2631
|
-
"modelFamily",
|
|
2632
|
-
"modelSnapshot",
|
|
2633
|
-
"modelVariant",
|
|
2634
|
-
"disabled",
|
|
2635
|
-
"allowSpend",
|
|
2636
|
-
]);
|
|
2671
|
+
const CREDENTIALS_EXAMPLE =
|
|
2672
|
+
'`"credentials": {"claude": ["subscription", "api_key"]}`';
|
|
2637
2673
|
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2674
|
+
// `credentials` (S5): which Claude credential a run uses, in order. Parsed and
|
|
2675
|
+
// validated here; choosing a credential at run start is not this parser's job.
|
|
2676
|
+
//
|
|
2677
|
+
// WHY this key escapes the credential deny-list that used to guard `routing`:
|
|
2678
|
+
// it names KINDS of credential, never one. The values are a closed set, and
|
|
2679
|
+
// no message echoes a value, so a secret pasted here is refused unseen.
|
|
2680
|
+
function parseCredentialsConfig(
|
|
2681
|
+
value: unknown,
|
|
2641
2682
|
file: string,
|
|
2642
|
-
):
|
|
2643
|
-
if (
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
for (const key of Object.keys(mapping)) {
|
|
2650
|
-
if (!KNOWN_ROUTE_MAPPING_KEYS.has(key)) {
|
|
2651
|
-
throw new CliUsageError(
|
|
2652
|
-
`${file} ${path} unknown key: ${redactDiagnostic(key)}`,
|
|
2653
|
-
);
|
|
2654
|
-
}
|
|
2683
|
+
): CredentialsConfig | undefined {
|
|
2684
|
+
if (value === undefined) return undefined;
|
|
2685
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2686
|
+
throw new CliUsageError(
|
|
2687
|
+
`${file} credentials must be an object, e.g. ${CREDENTIALS_EXAMPLE}`,
|
|
2688
|
+
);
|
|
2655
2689
|
}
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
if (
|
|
2659
|
-
typeof mapping.logical !== "string" ||
|
|
2660
|
-
mapping.logical.trim().length === 0
|
|
2661
|
-
) {
|
|
2690
|
+
const record = value as Record<string, unknown>;
|
|
2691
|
+
for (const key of Object.keys(record)) {
|
|
2692
|
+
if (key !== "claude") {
|
|
2662
2693
|
throw new CliUsageError(
|
|
2663
|
-
`${file} ${
|
|
2694
|
+
`${file} credentials has an unknown key "${redactConfigValue(key)}": only claude is supported, e.g. ${CREDENTIALS_EXAMPLE}`,
|
|
2664
2695
|
);
|
|
2665
2696
|
}
|
|
2666
2697
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
(mapping.backend !== "claude-code" && mapping.backend !== "opencode")
|
|
2671
|
-
) {
|
|
2698
|
+
if (record.claude === undefined) return {};
|
|
2699
|
+
const list = record.claude;
|
|
2700
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
2672
2701
|
throw new CliUsageError(
|
|
2673
|
-
`${file}
|
|
2702
|
+
`${file} credentials.claude must list subscription, api_key or both, in the order to try them`,
|
|
2674
2703
|
);
|
|
2675
2704
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
typeof mapping.provider !== "string" ||
|
|
2679
|
-
mapping.provider.trim().length === 0
|
|
2680
|
-
) {
|
|
2681
|
-
throw new CliUsageError(
|
|
2682
|
-
`${file} ${path}.provider must be a non-empty string`,
|
|
2683
|
-
);
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
if (mapping.gateway !== undefined) {
|
|
2705
|
+
const seen = new Set<string>();
|
|
2706
|
+
for (const [i, entry] of list.entries()) {
|
|
2687
2707
|
if (
|
|
2688
|
-
typeof
|
|
2689
|
-
(
|
|
2690
|
-
mapping.gateway !== "direct" &&
|
|
2691
|
-
mapping.gateway !== "openrouter")
|
|
2708
|
+
typeof entry !== "string" ||
|
|
2709
|
+
!(CLAUDE_CREDENTIAL_KINDS as readonly string[]).includes(entry)
|
|
2692
2710
|
) {
|
|
2693
2711
|
throw new CliUsageError(
|
|
2694
|
-
`${file} ${
|
|
2712
|
+
`${file} credentials.claude[${i}] must be "subscription" or "api_key"`,
|
|
2695
2713
|
);
|
|
2696
2714
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
if (
|
|
2700
|
-
mapping.modelFamily !== undefined &&
|
|
2701
|
-
typeof mapping.modelFamily !== "string"
|
|
2702
|
-
) {
|
|
2703
|
-
throw new CliUsageError(`${file} ${path}.modelFamily must be a string`);
|
|
2704
|
-
}
|
|
2705
|
-
if (
|
|
2706
|
-
mapping.modelSnapshot !== undefined &&
|
|
2707
|
-
typeof mapping.modelSnapshot !== "string"
|
|
2708
|
-
) {
|
|
2709
|
-
throw new CliUsageError(`${file} ${path}.modelSnapshot must be a string`);
|
|
2710
|
-
}
|
|
2711
|
-
if (
|
|
2712
|
-
mapping.modelVariant !== undefined &&
|
|
2713
|
-
typeof mapping.modelVariant !== "string"
|
|
2714
|
-
) {
|
|
2715
|
-
throw new CliUsageError(`${file} ${path}.modelVariant must be a string`);
|
|
2716
|
-
}
|
|
2717
|
-
if (mapping.disabled !== undefined && typeof mapping.disabled !== "boolean") {
|
|
2718
|
-
throw new CliUsageError(`${file} ${path}.disabled must be a boolean`);
|
|
2719
|
-
}
|
|
2720
|
-
if (
|
|
2721
|
-
mapping.allowSpend !== undefined &&
|
|
2722
|
-
typeof mapping.allowSpend !== "boolean"
|
|
2723
|
-
) {
|
|
2724
|
-
throw new CliUsageError(`${file} ${path}.allowSpend must be a boolean`);
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
return {
|
|
2728
|
-
...(mapping.logical ? { logical: mapping.logical as string } : {}),
|
|
2729
|
-
backend: mapping.backend as RunnerBackend,
|
|
2730
|
-
provider: mapping.provider as string,
|
|
2731
|
-
...(mapping.gateway ? { gateway: mapping.gateway as ModelGateway } : {}),
|
|
2732
|
-
...(mapping.modelFamily
|
|
2733
|
-
? { modelFamily: mapping.modelFamily as string }
|
|
2734
|
-
: {}),
|
|
2735
|
-
...(mapping.modelSnapshot
|
|
2736
|
-
? { modelSnapshot: mapping.modelSnapshot as string }
|
|
2737
|
-
: {}),
|
|
2738
|
-
...(mapping.modelVariant
|
|
2739
|
-
? { modelVariant: mapping.modelVariant as string }
|
|
2740
|
-
: {}),
|
|
2741
|
-
...(mapping.disabled !== undefined
|
|
2742
|
-
? { disabled: mapping.disabled as boolean }
|
|
2743
|
-
: {}),
|
|
2744
|
-
...(mapping.allowSpend !== undefined
|
|
2745
|
-
? { allowSpend: mapping.allowSpend as boolean }
|
|
2746
|
-
: {}),
|
|
2747
|
-
};
|
|
2748
|
-
}
|
|
2749
|
-
|
|
2750
|
-
// Every usage error of the routing object carries the routing class (T2d-1). The CI
|
|
2751
|
-
// routing input (src/ci/setup.ts) keeps its own class and discards this one. The repo
|
|
2752
|
-
// layer passes this parser too, but never reaches a routing value (see
|
|
2753
|
-
// parseLocalConfig). The person layer calls parseRoutingValue directly, so its errors
|
|
2754
|
-
// carry no class.
|
|
2755
|
-
export function parseRoutingConfig(
|
|
2756
|
-
value: unknown,
|
|
2757
|
-
file: string,
|
|
2758
|
-
): RoutingConfig | undefined {
|
|
2759
|
-
return withUsageClass({ kind: "config-parse", source: "routing" }, () =>
|
|
2760
|
-
parseRoutingValue(value, file),
|
|
2761
|
-
);
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
|
-
function parseRoutingValue(
|
|
2765
|
-
value: unknown,
|
|
2766
|
-
file: string,
|
|
2767
|
-
): RoutingConfig | undefined {
|
|
2768
|
-
if (value === undefined) return undefined;
|
|
2769
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2770
|
-
throw new CliUsageError(`${file} routing must be an object`);
|
|
2771
|
-
}
|
|
2772
|
-
const routing = value as Record<string, unknown>;
|
|
2773
|
-
checkNoCredentials(routing, "routing", file);
|
|
2774
|
-
|
|
2775
|
-
for (const key of Object.keys(routing)) {
|
|
2776
|
-
if (key !== "mappings" && key !== "default" && key !== "disabled") {
|
|
2715
|
+
if (seen.has(entry)) {
|
|
2777
2716
|
throw new CliUsageError(
|
|
2778
|
-
`${file}
|
|
2717
|
+
`${file} credentials.claude lists "${entry}" twice`,
|
|
2779
2718
|
);
|
|
2780
2719
|
}
|
|
2720
|
+
seen.add(entry);
|
|
2781
2721
|
}
|
|
2782
|
-
|
|
2783
|
-
let mappings: RouteMapping[] | Record<string, RouteMapping> | undefined;
|
|
2784
|
-
if (routing.mappings !== undefined) {
|
|
2785
|
-
if (Array.isArray(routing.mappings)) {
|
|
2786
|
-
mappings = routing.mappings.map((m, i) =>
|
|
2787
|
-
parseRouteMapping(m, `routing.mappings[${i}]`, file),
|
|
2788
|
-
);
|
|
2789
|
-
} else if (
|
|
2790
|
-
typeof routing.mappings === "object" &&
|
|
2791
|
-
routing.mappings !== null
|
|
2792
|
-
) {
|
|
2793
|
-
const rec = routing.mappings as Record<string, unknown>;
|
|
2794
|
-
const result: Record<string, RouteMapping> = {};
|
|
2795
|
-
for (const [k, v] of Object.entries(rec)) {
|
|
2796
|
-
result[k] = parseRouteMapping(v, `routing.mappings.${k}`, file);
|
|
2797
|
-
}
|
|
2798
|
-
mappings = result;
|
|
2799
|
-
} else {
|
|
2800
|
-
throw new CliUsageError(
|
|
2801
|
-
`${file} routing.mappings must be an array or object`,
|
|
2802
|
-
);
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2806
|
-
let def: RouteMapping | undefined;
|
|
2807
|
-
if (routing.default !== undefined) {
|
|
2808
|
-
def = parseRouteMapping(routing.default, "routing.default", file);
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
if (routing.disabled !== undefined && typeof routing.disabled !== "boolean") {
|
|
2812
|
-
throw new CliUsageError(`${file} routing.disabled must be a boolean`);
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
return {
|
|
2816
|
-
...(mappings ? { mappings } : {}),
|
|
2817
|
-
...(def ? { default: def } : {}),
|
|
2818
|
-
...(routing.disabled !== undefined
|
|
2819
|
-
? { disabled: routing.disabled as boolean }
|
|
2820
|
-
: {}),
|
|
2821
|
-
};
|
|
2722
|
+
return { claude: list as ClaudeCredentialKind[] };
|
|
2822
2723
|
}
|
|
2823
2724
|
|
|
2725
|
+
// `initModel` is true when the file said `summary.model: "haiku"`, the value
|
|
2726
|
+
// `crysk init` wrote into every scaffolded repo file (L6 item 1): accepted with
|
|
2727
|
+
// a warning so those repos keep working, and turned into `models.summary` by
|
|
2728
|
+
// the caller where the layer may hold `models`. Any other value is refused with
|
|
2729
|
+
// the new form.
|
|
2824
2730
|
function parseSummaryConfig(
|
|
2825
2731
|
value: unknown,
|
|
2826
2732
|
file: string,
|
|
2827
|
-
): SummaryConfig | undefined {
|
|
2733
|
+
): { summary: SummaryConfig; initModel: boolean } | undefined {
|
|
2828
2734
|
if (value === undefined) return undefined;
|
|
2829
2735
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2830
2736
|
throw new CliUsageError(`${file} summary must be an object`);
|
|
@@ -2838,15 +2744,14 @@ function parseSummaryConfig(
|
|
|
2838
2744
|
if (config.enabled !== undefined && typeof config.enabled !== "boolean") {
|
|
2839
2745
|
throw new CliUsageError(`${file} summary.enabled must be a boolean`);
|
|
2840
2746
|
}
|
|
2841
|
-
if (
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
throw new CliUsageError(`${file} summary.model must be a non-empty string`);
|
|
2747
|
+
if (config.model !== undefined && config.model !== SUMMARY_MODEL_INIT_VALUE) {
|
|
2748
|
+
throw new CliUsageError(
|
|
2749
|
+
`${file} summary.model is gone: set the summary model per person, under models in your person config, e.g. ${SUMMARY_MODEL_EXAMPLE}`,
|
|
2750
|
+
);
|
|
2846
2751
|
}
|
|
2847
2752
|
return {
|
|
2848
|
-
|
|
2849
|
-
|
|
2753
|
+
summary: config.enabled === undefined ? {} : { enabled: config.enabled },
|
|
2754
|
+
initModel: config.model !== undefined,
|
|
2850
2755
|
};
|
|
2851
2756
|
}
|
|
2852
2757
|
|
|
@@ -2948,7 +2853,9 @@ export function resolveSummary(
|
|
|
2948
2853
|
options: Pick<CliOptions, "summary" | "model">,
|
|
2949
2854
|
config: Pick<ConfigLayer, "summary">,
|
|
2950
2855
|
): SummarySettings {
|
|
2951
|
-
|
|
2856
|
+
// `--model` only: the configured summary model is `models.summary`, which
|
|
2857
|
+
// the route plan reads.
|
|
2858
|
+
const model = options.model;
|
|
2952
2859
|
return {
|
|
2953
2860
|
enabled: options.summary ?? config.summary?.enabled ?? true,
|
|
2954
2861
|
...(model === undefined ? {} : { model }),
|
|
@@ -3101,11 +3008,6 @@ export function mergeConfig(
|
|
|
3101
3008
|
(layer) => layer.summary?.enabled,
|
|
3102
3009
|
(a, b) => a && b,
|
|
3103
3010
|
);
|
|
3104
|
-
const summaryModel = foldKey(
|
|
3105
|
-
layers,
|
|
3106
|
-
SUMMARY_DIRECTION.model,
|
|
3107
|
-
(layer) => layer.summary?.model,
|
|
3108
|
-
);
|
|
3109
3011
|
const maxSteps = foldKey(
|
|
3110
3012
|
layers,
|
|
3111
3013
|
CONFIG_DIRECTION.max_verification_steps,
|
|
@@ -3158,10 +3060,17 @@ export function mergeConfig(
|
|
|
3158
3060
|
CONFIG_DIRECTION.post_min_severity,
|
|
3159
3061
|
(layer) => layer.post_min_severity,
|
|
3160
3062
|
);
|
|
3161
|
-
|
|
3063
|
+
// Folded whole, not per role: the person layer is the only one that may
|
|
3064
|
+
// hold either, so there is never a second layer to merge roles from.
|
|
3065
|
+
const models = foldKey(
|
|
3066
|
+
layers,
|
|
3067
|
+
CONFIG_DIRECTION.models,
|
|
3068
|
+
(layer) => layer.models,
|
|
3069
|
+
);
|
|
3070
|
+
const credentials = foldKey(
|
|
3162
3071
|
layers,
|
|
3163
|
-
CONFIG_DIRECTION.
|
|
3164
|
-
(layer) => layer.
|
|
3072
|
+
CONFIG_DIRECTION.credentials,
|
|
3073
|
+
(layer) => layer.credentials,
|
|
3165
3074
|
);
|
|
3166
3075
|
const ciReviewPolicy = foldKey(
|
|
3167
3076
|
layers,
|
|
@@ -3209,7 +3118,6 @@ export function mergeConfig(
|
|
|
3209
3118
|
...(summaryEnabled.value === undefined
|
|
3210
3119
|
? {}
|
|
3211
3120
|
: { enabled: summaryEnabled.value }),
|
|
3212
|
-
...(summaryModel.value === undefined ? {} : { model: summaryModel.value }),
|
|
3213
3121
|
};
|
|
3214
3122
|
|
|
3215
3123
|
const effective: LocalConfig = {
|
|
@@ -3224,10 +3132,11 @@ export function mergeConfig(
|
|
|
3224
3132
|
...(defaultBase.value === undefined
|
|
3225
3133
|
? {}
|
|
3226
3134
|
: { default_base: defaultBase.value }),
|
|
3227
|
-
...(summaryEnabled.value === undefined
|
|
3135
|
+
...(summaryEnabled.value === undefined ? {} : { summary }),
|
|
3136
|
+
...(models.value === undefined ? {} : { models: models.value }),
|
|
3137
|
+
...(credentials.value === undefined
|
|
3228
3138
|
? {}
|
|
3229
|
-
: {
|
|
3230
|
-
...(routing.value === undefined ? {} : { routing: routing.value }),
|
|
3139
|
+
: { credentials: credentials.value }),
|
|
3231
3140
|
...(maxSteps.value === undefined
|
|
3232
3141
|
? {}
|
|
3233
3142
|
: { max_verification_steps: maxSteps.value }),
|
|
@@ -3280,8 +3189,9 @@ export function mergeConfig(
|
|
|
3280
3189
|
default_base: defaultBase.source,
|
|
3281
3190
|
parity_trigger_paths: triggers.source,
|
|
3282
3191
|
suspicion_priors: priors.source,
|
|
3283
|
-
summary: { enabled: summaryEnabled.source
|
|
3284
|
-
|
|
3192
|
+
summary: { enabled: summaryEnabled.source },
|
|
3193
|
+
models: models.source,
|
|
3194
|
+
credentials: credentials.source,
|
|
3285
3195
|
max_verification_steps: maxSteps.source,
|
|
3286
3196
|
max_concurrent_steps: maxConcurrentSteps.source,
|
|
3287
3197
|
max_changed_lines: maxLines.source,
|
|
@@ -3342,7 +3252,6 @@ export interface InitTemplateInput {
|
|
|
3342
3252
|
export interface InitTemplateOmissions {
|
|
3343
3253
|
agentsDir: boolean;
|
|
3344
3254
|
summaryEnabled: boolean;
|
|
3345
|
-
summaryModel: boolean;
|
|
3346
3255
|
// The same three facts as config-file key names, for init's log. Derived
|
|
3347
3256
|
// here rather than rebuilt at the call site, because a scaffold that omits a
|
|
3348
3257
|
// key and a log that does not mention it is worse than either alone: the
|
|
@@ -3371,15 +3280,12 @@ export function initTemplateOmissions(
|
|
|
3371
3280
|
(input.global?.agents_dir !== undefined &&
|
|
3372
3281
|
input.agentsDirFromFlag !== true);
|
|
3373
3282
|
const summaryEnabled = input.global?.summary?.enabled !== undefined;
|
|
3374
|
-
const summaryModel = input.global?.summary?.model !== undefined;
|
|
3375
3283
|
return {
|
|
3376
3284
|
agentsDir,
|
|
3377
3285
|
summaryEnabled,
|
|
3378
|
-
summaryModel,
|
|
3379
3286
|
keys: [
|
|
3380
3287
|
...(agentsDir ? ["agents_dir"] : []),
|
|
3381
3288
|
...(summaryEnabled ? ["summary.enabled"] : []),
|
|
3382
|
-
...(summaryModel ? ["summary.model"] : []),
|
|
3383
3289
|
],
|
|
3384
3290
|
};
|
|
3385
3291
|
}
|
|
@@ -3394,16 +3300,17 @@ export function initTemplateOmissions(
|
|
|
3394
3300
|
// required.
|
|
3395
3301
|
export function initConfigTemplate(input: InitTemplateInput): string {
|
|
3396
3302
|
const omit = initTemplateOmissions(input);
|
|
3303
|
+
// No `summary.model` any more: the summary model is a person setting
|
|
3304
|
+
// (`models.summary`), and a repo file that names it gets a warning.
|
|
3397
3305
|
const summary: SummaryConfig = {
|
|
3398
3306
|
...(omit.summaryEnabled ? {} : { enabled: true }),
|
|
3399
|
-
...(omit.summaryModel ? {} : { model: DEFAULT_SUMMARY_MODEL }),
|
|
3400
3307
|
};
|
|
3401
3308
|
return `${JSON.stringify(
|
|
3402
3309
|
{
|
|
3403
3310
|
...(omit.agentsDir ? {} : { agents_dir: input.agentsDir }),
|
|
3404
3311
|
// Always written, whatever the global file says.
|
|
3405
3312
|
default_base: input.defaultBase,
|
|
3406
|
-
// Dropped WHOLE when
|
|
3313
|
+
// Dropped WHOLE when `enabled` hoisted: `"summary": {}` parses fine
|
|
3407
3314
|
// and configures nothing, which is a line whose only effect is to make
|
|
3408
3315
|
// the next reader wonder what it does.
|
|
3409
3316
|
...(Object.keys(summary).length === 0 ? {} : { summary }),
|