crysk 0.5.1 → 0.6.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 +15 -1
- package/dist/SKILL-nncgwkx7.md +553 -0
- package/dist/cli.js +6379 -5561
- package/dist/index.js +967 -467
- package/dist/workflow-ag62s87j.yml +163 -0
- package/package.json +3 -2
- package/skills/crysk-ci-setup/assets/workflow.yml +3 -0
- package/skills/crysk-loop/SKILL.md +2 -2
- package/src/asset-manifest.ts +11 -0
- package/src/assets.ts +34 -11
- package/src/ci/credential-refresh.ts +524 -0
- package/src/ci/crysk-secrets.ts +20 -6
- package/src/ci/gates.ts +2 -24
- package/src/ci/outcome.ts +165 -15
- package/src/ci/platform.ts +205 -7
- package/src/ci/setup.ts +64 -6
- package/src/ci/trigger.ts +84 -8
- package/src/commands/ci-setup.ts +12 -3
- package/src/commands/doctor.ts +25 -23
- package/src/commands/status.ts +2 -0
- package/src/diversity/identity.ts +11 -1
- package/src/diversity/pipeline-integration.ts +19 -6
- package/src/doctor.ts +133 -4
- package/src/execution/contracts.ts +15 -3
- package/src/harness/materiality-judge.ts +153 -0
- package/src/harness/pipeline-plan.ts +133 -0
- package/src/harness/replay-rows.ts +172 -0
- package/src/harness/route-runner.ts +288 -0
- package/src/harness/single-step.ts +153 -0
- package/src/index.ts +1 -1
- package/src/model/catalog.ts +10 -7
- package/src/model/model-name.ts +14 -0
- package/src/model/profiles/claude.ts +34 -0
- package/src/model/profiles/openai.ts +44 -0
- package/src/model/profiles.ts +213 -0
- package/src/model/routing.ts +155 -50
- package/src/pr/answered-findings.ts +3 -0
- package/src/pr/ci-admission-gate.ts +1 -0
- package/src/pr/discovery.ts +1 -0
- package/src/pr/plan.ts +6 -1
- package/src/pr/pr-status.ts +18 -3
- package/src/pr/publish-outcome.ts +14 -13
- package/src/pr/review-pr.ts +49 -8
- package/src/pr/target.ts +16 -7
- package/src/production-runtime.ts +100 -13
- package/src/rereview/prepare.ts +13 -2
- package/src/review/exit-code.ts +60 -0
- package/src/review/findings.ts +3 -3
- package/src/review/pipeline.ts +193 -58
- package/src/review/preflight.ts +100 -10
- package/src/review/prompt-set.ts +73 -0
- package/src/review/review.ts +32 -13
- package/src/review/route-preflight.ts +117 -67
- package/src/review/run.ts +34 -4
- package/src/security/credential-broker.ts +21 -9
- package/src/security/oauth-providers.ts +101 -0
- package/src/transport-registry.ts +33 -0
- package/src/transports/opencode-sdk.ts +33 -1
- package/src/triage/adjudication.ts +35 -2
- package/src/ui/config-edit.ts +9 -0
- package/src/ui/config.ts +1 -0
- package/src/ui/menu.ts +9 -2
- package/src/ui/result.ts +1 -1
- package/src/updater.ts +21 -13
- package/src/watch/preflight.ts +34 -8
- package/src/watch/watch.ts +8 -4
- package/src/wizard.ts +23 -0
package/src/review/preflight.ts
CHANGED
|
@@ -18,9 +18,22 @@ import {
|
|
|
18
18
|
type ModelsConfig,
|
|
19
19
|
parseModelsConfig,
|
|
20
20
|
} from "#model/model-name";
|
|
21
|
+
import {
|
|
22
|
+
FALLBACK_PROFILE,
|
|
23
|
+
type ModelProfile,
|
|
24
|
+
profileIdProblem,
|
|
25
|
+
profileJudgeModels,
|
|
26
|
+
profileModelAlias,
|
|
27
|
+
profileRoute,
|
|
28
|
+
resolveProfile,
|
|
29
|
+
} from "#model/profiles";
|
|
21
30
|
import { judgeModelChoice } from "#model/routing";
|
|
22
31
|
import { POST_MIN_SEVERITIES, type PostMinSeverity } from "#pr/post-floor";
|
|
23
|
-
import
|
|
32
|
+
import {
|
|
33
|
+
type ProfilePromptSets,
|
|
34
|
+
profilePromptSet,
|
|
35
|
+
type SuspicionPrior,
|
|
36
|
+
} from "#review/prompt-set";
|
|
24
37
|
import { type AgentSpec, isSafeSlug, type ReviewSpec } from "#review/spec";
|
|
25
38
|
import {
|
|
26
39
|
ADJUDICATED_TAGS,
|
|
@@ -60,10 +73,12 @@ export const DEFAULT_GC_INTERVAL_MIN = 360;
|
|
|
60
73
|
|
|
61
74
|
export const DEFAULT_HEAD_REF = "HEAD";
|
|
62
75
|
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
// only the honest model label shown in a preflight plan.
|
|
66
|
-
export const DEFAULT_SUMMARY_MODEL =
|
|
76
|
+
// The `claude` profile's summary model as a CLI alias (model-profiles S2),
|
|
77
|
+
// which prompts/summarizer.md's frontmatter also names while it keeps the
|
|
78
|
+
// line. This value is only the honest model label shown in a preflight plan.
|
|
79
|
+
export const DEFAULT_SUMMARY_MODEL = profileModelAlias(
|
|
80
|
+
profileRoute(FALLBACK_PROFILE, "summary").model,
|
|
81
|
+
);
|
|
67
82
|
|
|
68
83
|
export interface CliOptions {
|
|
69
84
|
// Relative on purpose: parseArgs is pure, so "resolve against cwd" is the
|
|
@@ -598,7 +613,15 @@ questions; use it first.
|
|
|
598
613
|
The size gate is a COST gate, not a quality gate: past its limits a diff bills
|
|
599
614
|
several times more with a much wider spread, so Crysk skips it unattended
|
|
600
615
|
rather than guess at the bill. An interactive run asks first. It says nothing
|
|
601
|
-
about how well a large diff reviews
|
|
616
|
+
about how well a large diff reviews.
|
|
617
|
+
|
|
618
|
+
Exit codes of a review (findings never change them):
|
|
619
|
+
0 the review is complete, with or without findings
|
|
620
|
+
1 no usable review: every hunter failed, no reviewer ran, or findings
|
|
621
|
+
that should have been posted were dropped
|
|
622
|
+
2 usage error
|
|
623
|
+
3 the review is incomplete: a step failed (a hunter, the refuter,
|
|
624
|
+
verify, adjudicate, or the time ceiling). Run it again.`;
|
|
602
625
|
|
|
603
626
|
const VALUE_FLAGS = new Set([
|
|
604
627
|
"--repo",
|
|
@@ -1609,6 +1632,11 @@ export interface AgentsDirResolution {
|
|
|
1609
1632
|
kind: "dir" | "bundled";
|
|
1610
1633
|
// Logical filename -> readable path. Present iff `kind === "bundled"`.
|
|
1611
1634
|
files?: Record<string, string>;
|
|
1635
|
+
// The model profile's prompt set merged over the default one
|
|
1636
|
+
// (model-profiles S4), present only when that set overrides an agent file.
|
|
1637
|
+
// It names the merged set in provenance, as a directory basename names a
|
|
1638
|
+
// user set. Absent: the default set itself, exactly as before profiles.
|
|
1639
|
+
promptSet?: string;
|
|
1612
1640
|
}
|
|
1613
1641
|
|
|
1614
1642
|
// The label the shipped binary shows wherever a prompt-set path would go.
|
|
@@ -1686,6 +1714,11 @@ export function resolveAgentsDirSetting(input: {
|
|
|
1686
1714
|
// inside the default branch so an explicit flag, config or env never pays
|
|
1687
1715
|
// for asset detection.
|
|
1688
1716
|
assets?: EngineAssets | undefined;
|
|
1717
|
+
// The active model profile (model-profiles S4). Absent: `claude`, whose
|
|
1718
|
+
// default set is the bundled one. `promptSets` is injected by tests only:
|
|
1719
|
+
// no profile ships a set yet (asset-manifest.ts PROFILE_PROMPT_FILES).
|
|
1720
|
+
profile?: ModelProfile | undefined;
|
|
1721
|
+
promptSets?: ProfilePromptSets | undefined;
|
|
1689
1722
|
}): AgentsDirResolution {
|
|
1690
1723
|
if (input.flag) {
|
|
1691
1724
|
return {
|
|
@@ -1709,6 +1742,28 @@ export function resolveAgentsDirSetting(input: {
|
|
|
1709
1742
|
};
|
|
1710
1743
|
}
|
|
1711
1744
|
const assets = input.assets ?? resolveEngineAssets();
|
|
1745
|
+
// The active profile's prompt set, file by file over the default set (S4).
|
|
1746
|
+
// Only here, in the default branch: a person's `--agents`, `agents_dir` or
|
|
1747
|
+
// env set above outranks the profile and is never mixed with it. With no
|
|
1748
|
+
// agent override (`claude`, or a set that only changes root prompts) the
|
|
1749
|
+
// resolution below is today's, byte for byte.
|
|
1750
|
+
const overrides = profilePromptSet(
|
|
1751
|
+
input.profile ?? FALLBACK_PROFILE,
|
|
1752
|
+
Object.keys(assets.bundledAgentFiles),
|
|
1753
|
+
input.promptSets,
|
|
1754
|
+
).agents;
|
|
1755
|
+
const setName = (input.profile ?? FALLBACK_PROFILE).promptSet;
|
|
1756
|
+
if (Object.keys(overrides).length > 0 && setName !== undefined) {
|
|
1757
|
+
// A MAP, like the compiled binary's: the files now live in two places, so
|
|
1758
|
+
// there is no single directory to join a basename onto.
|
|
1759
|
+
return {
|
|
1760
|
+
dir: `${BUNDLED_AGENTS_DIR_LABEL}, prompt set ${setName}`,
|
|
1761
|
+
source: "default",
|
|
1762
|
+
kind: "bundled",
|
|
1763
|
+
files: { ...assets.bundledAgentFiles, ...overrides },
|
|
1764
|
+
promptSet: setName,
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1712
1767
|
// The compiled binary's default set is a MAP, never a directory: its
|
|
1713
1768
|
// `defaultAgentsDir` is `path.dirname(<embedded path>)`, i.e. "/$bunfs/root",
|
|
1714
1769
|
// which no `existsSync` accepts and no `Bun.Glob` can scan. Handing that
|
|
@@ -2021,6 +2076,12 @@ export function resolveAgentsDir(
|
|
|
2021
2076
|
// detectAssetMode() reads `import.meta.dir` and always reports "dev" under
|
|
2022
2077
|
// `bun test`.
|
|
2023
2078
|
assets?: EngineAssets,
|
|
2079
|
+
// The active model profile and, in tests only, its prompt sets
|
|
2080
|
+
// (model-profiles S4). Absent: `claude`, today's resolution.
|
|
2081
|
+
prompts: Pick<
|
|
2082
|
+
Parameters<typeof resolveAgentsDirSetting>[0],
|
|
2083
|
+
"profile" | "promptSets"
|
|
2084
|
+
> = {},
|
|
2024
2085
|
): AgentsDirResolution {
|
|
2025
2086
|
const seat = agentsDirSeat({
|
|
2026
2087
|
config: loaded.effective,
|
|
@@ -2034,6 +2095,7 @@ export function resolveAgentsDir(
|
|
|
2034
2095
|
env: readBrandEnv(process.env, "AGENTS_DIR")?.value,
|
|
2035
2096
|
cwd: process.cwd(),
|
|
2036
2097
|
...(assets === undefined ? {} : { assets }),
|
|
2098
|
+
...prompts,
|
|
2037
2099
|
});
|
|
2038
2100
|
// Only a DIRECTORY can be checked for existence, and this gate running
|
|
2039
2101
|
// unconditionally is the whole shipped defect: the compiled binary's bundled
|
|
@@ -2193,6 +2255,9 @@ export const CONFIG_DIRECTION: Record<keyof LocalConfig, ConfigDirection> = {
|
|
|
2193
2255
|
// model or another bill. Both are PERSON_ONLY_KEYS, refused in a repo file.
|
|
2194
2256
|
models: "person",
|
|
2195
2257
|
credentials: "person",
|
|
2258
|
+
// Which model profile the review runs (openai-profile S1): it picks every
|
|
2259
|
+
// step's model and so the bill, like `models`, so it is person-only too.
|
|
2260
|
+
profile: "person",
|
|
2196
2261
|
max_verification_steps: "capped",
|
|
2197
2262
|
max_concurrent_steps: "capped",
|
|
2198
2263
|
max_changed_lines: "capped",
|
|
@@ -2238,6 +2303,9 @@ export interface LocalConfig {
|
|
|
2238
2303
|
models?: ModelsConfig;
|
|
2239
2304
|
// Which Claude credential is used, in order (S5).
|
|
2240
2305
|
credentials?: CredentialsConfig;
|
|
2306
|
+
// The model profile id (openai-profile S1). Absent: the fallback profile.
|
|
2307
|
+
// `models` still outranks it role by role.
|
|
2308
|
+
profile?: string;
|
|
2241
2309
|
// Item 7: unattended bound on the verify queue. Absent means
|
|
2242
2310
|
// DEFAULT_MAX_VERIFICATION_STEPS. 0 is legal — every queued prior lands
|
|
2243
2311
|
// `unconfirmed` (the pause switch, same shape as watch daily_cap).
|
|
@@ -2315,8 +2383,8 @@ const KNOWN_CONFIG_KEYS = new Set<string>(Object.keys(CONFIG_DIRECTION));
|
|
|
2315
2383
|
|
|
2316
2384
|
// Keys a committed repo file may never set. Wider than "direction is person":
|
|
2317
2385
|
// `agents_dir` and `post_min_severity` are person-direction keys a repo file
|
|
2318
|
-
// may still name. These
|
|
2319
|
-
const PERSON_ONLY_KEYS = new Set<string>(["models", "credentials"]);
|
|
2386
|
+
// may still name. These three choose a model or a bill.
|
|
2387
|
+
const PERSON_ONLY_KEYS = new Set<string>(["models", "credentials", "profile"]);
|
|
2320
2388
|
|
|
2321
2389
|
const LOCAL_CONFIG_KEYS = new Set<string>(
|
|
2322
2390
|
Object.keys(CONFIG_DIRECTION).filter((key) => !PERSON_ONLY_KEYS.has(key)),
|
|
@@ -2493,6 +2561,7 @@ function parseConfigLayer(
|
|
|
2493
2561
|
throw new CliUsageError(`suspicion_priors[${i}].reason required`);
|
|
2494
2562
|
}
|
|
2495
2563
|
}
|
|
2564
|
+
const profile = parseProfile(config.profile, file);
|
|
2496
2565
|
const summaryParse = parseSummaryConfig(config.summary, file);
|
|
2497
2566
|
const summary = summaryParse?.summary;
|
|
2498
2567
|
let models = parseModels(config.models, file);
|
|
@@ -2517,11 +2586,14 @@ function parseConfigLayer(
|
|
|
2517
2586
|
}
|
|
2518
2587
|
// The judge's list is kept as written (the plan skips what it cannot
|
|
2519
2588
|
// use), but a model it will never run on is said out loud here, once.
|
|
2589
|
+
// Checked against this file's own profile: `profile` and `models` are both
|
|
2590
|
+
// person-only, so they are always read from the same file.
|
|
2520
2591
|
if (models?.judge !== undefined) {
|
|
2521
|
-
const
|
|
2592
|
+
const active = resolveProfile(profile);
|
|
2593
|
+
const { model, dropped } = judgeModelChoice(models, active);
|
|
2522
2594
|
if (dropped.length > 0) {
|
|
2523
2595
|
warnings?.push(
|
|
2524
|
-
`${file}: models.judge skips ${dropped.join(", ")}: the materiality judge runs only on
|
|
2596
|
+
`${file}: models.judge skips ${dropped.join(", ")}: the materiality judge runs only on ${profileJudgeModels(active).join(" or ")}${model === undefined ? ", so it stands down" : ""}.`,
|
|
2525
2597
|
);
|
|
2526
2598
|
}
|
|
2527
2599
|
}
|
|
@@ -2611,6 +2683,7 @@ function parseConfigLayer(
|
|
|
2611
2683
|
...(summary === undefined ? {} : { summary }),
|
|
2612
2684
|
...(models === undefined ? {} : { models }),
|
|
2613
2685
|
...(credentials === undefined ? {} : { credentials }),
|
|
2686
|
+
...(profile === undefined ? {} : { profile }),
|
|
2614
2687
|
...(maxVerificationSteps === undefined
|
|
2615
2688
|
? {}
|
|
2616
2689
|
: { max_verification_steps: maxVerificationSteps }),
|
|
@@ -2654,6 +2727,16 @@ function parseConfigLayer(
|
|
|
2654
2727
|
};
|
|
2655
2728
|
}
|
|
2656
2729
|
|
|
2730
|
+
// The `profile` id (openai-profile S1): one of the registered profiles.
|
|
2731
|
+
function parseProfile(value: unknown, file: string): string | undefined {
|
|
2732
|
+
if (value === undefined) return undefined;
|
|
2733
|
+
const problem = profileIdProblem(value);
|
|
2734
|
+
if (problem === undefined) return value as string;
|
|
2735
|
+
const got =
|
|
2736
|
+
typeof value === "string" ? ` (got "${redactConfigValue(value)}")` : "";
|
|
2737
|
+
throw new CliUsageError(`${file} ${problem}${got}`);
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2657
2740
|
// The `models` object (S1, S3). Its rules live in model/model-name.ts; this
|
|
2658
2741
|
// adds the file to every message, as every other key's error does.
|
|
2659
2742
|
function parseModels(value: unknown, file: string): ModelsConfig | undefined {
|
|
@@ -3072,6 +3155,11 @@ export function mergeConfig(
|
|
|
3072
3155
|
CONFIG_DIRECTION.credentials,
|
|
3073
3156
|
(layer) => layer.credentials,
|
|
3074
3157
|
);
|
|
3158
|
+
const profile = foldKey(
|
|
3159
|
+
layers,
|
|
3160
|
+
CONFIG_DIRECTION.profile,
|
|
3161
|
+
(layer) => layer.profile,
|
|
3162
|
+
);
|
|
3075
3163
|
const ciReviewPolicy = foldKey(
|
|
3076
3164
|
layers,
|
|
3077
3165
|
CONFIG_DIRECTION.ci_review_policy,
|
|
@@ -3137,6 +3225,7 @@ export function mergeConfig(
|
|
|
3137
3225
|
...(credentials.value === undefined
|
|
3138
3226
|
? {}
|
|
3139
3227
|
: { credentials: credentials.value }),
|
|
3228
|
+
...(profile.value === undefined ? {} : { profile: profile.value }),
|
|
3140
3229
|
...(maxSteps.value === undefined
|
|
3141
3230
|
? {}
|
|
3142
3231
|
: { max_verification_steps: maxSteps.value }),
|
|
@@ -3192,6 +3281,7 @@ export function mergeConfig(
|
|
|
3192
3281
|
summary: { enabled: summaryEnabled.source },
|
|
3193
3282
|
models: models.source,
|
|
3194
3283
|
credentials: credentials.source,
|
|
3284
|
+
profile: profile.source,
|
|
3195
3285
|
max_verification_steps: maxSteps.source,
|
|
3196
3286
|
max_concurrent_steps: maxConcurrentSteps.source,
|
|
3197
3287
|
max_changed_lines: maxLines.source,
|
package/src/review/prompt-set.ts
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
// spawn time moves into the driver (renderAgentBody).
|
|
7
7
|
|
|
8
8
|
import { EFFORT_LEVELS, type Effort, isEffort } from "#model/catalog";
|
|
9
|
+
import type { ModelProfile } from "#model/profiles";
|
|
10
|
+
import { PROFILE_PROMPT_FILES } from "../asset-manifest";
|
|
11
|
+
import { resolveBundledFilePath } from "../assets";
|
|
9
12
|
import { wrapBlock } from "./boundary";
|
|
10
13
|
|
|
11
14
|
// Fixed order — the lab's promptSetFingerprint hashes the concatenated files
|
|
@@ -19,6 +22,76 @@ export const AGENT_NAMES = [
|
|
|
19
22
|
"review-refuter",
|
|
20
23
|
] as const;
|
|
21
24
|
|
|
25
|
+
// The engine-owned prompts at `prompts/` root: not part of the fingerprinted
|
|
26
|
+
// agent set (a user `agents_dir` never holds them), but looked up through the
|
|
27
|
+
// active profile's prompt set like every other step's prompt
|
|
28
|
+
// (model-profiles S4).
|
|
29
|
+
export const ENGINE_PROMPT_FILES = [
|
|
30
|
+
"consolidate.md",
|
|
31
|
+
"scout.md",
|
|
32
|
+
"summarizer.md",
|
|
33
|
+
"materiality.md",
|
|
34
|
+
] as const;
|
|
35
|
+
export type EnginePromptFile = (typeof ENGINE_PROMPT_FILES)[number];
|
|
36
|
+
|
|
37
|
+
// Profile prompt sets by name: logical filename -> readable path, holding ONLY
|
|
38
|
+
// the files that differ from the default set (`prompts/profiles/<set>/`,
|
|
39
|
+
// embedded through asset-manifest.ts like every other prompt).
|
|
40
|
+
export type ProfilePromptSets = Readonly<
|
|
41
|
+
Record<string, Readonly<Record<string, string>>>
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
export interface ProfilePromptOverrides {
|
|
45
|
+
// Agent files (`deep-review-*.md`, `review-refuter.md`) the set overrides.
|
|
46
|
+
agents: Record<string, string>;
|
|
47
|
+
// Engine-owned root prompts the set overrides.
|
|
48
|
+
engine: Partial<Record<EnginePromptFile, string>>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The ONE lookup of a profile's prompt set, split into the two places a
|
|
52
|
+
// prompt is read from: the agents (merged over the default set by
|
|
53
|
+
// resolveAgentsDirSetting) and the engine-owned root prompts
|
|
54
|
+
// (enginePromptPath). Any file the set does not hold falls back to the default
|
|
55
|
+
// set's. A profile with no `promptSet` (`claude`) overrides nothing.
|
|
56
|
+
//
|
|
57
|
+
// A set name this build lacks, or a file that overrides nothing in the default
|
|
58
|
+
// set, throws: either is a build defect, and a silent fallback would run the
|
|
59
|
+
// default prompt while the profile reads as tuned.
|
|
60
|
+
export function profilePromptSet(
|
|
61
|
+
profile: Pick<ModelProfile, "id" | "promptSet">,
|
|
62
|
+
defaultAgentFiles: readonly string[],
|
|
63
|
+
sets: ProfilePromptSets = PROFILE_PROMPT_FILES,
|
|
64
|
+
): ProfilePromptOverrides {
|
|
65
|
+
const overrides: ProfilePromptOverrides = { agents: {}, engine: {} };
|
|
66
|
+
if (profile.promptSet === undefined) return overrides;
|
|
67
|
+
const set = sets[profile.promptSet];
|
|
68
|
+
if (set === undefined) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`model profile "${profile.id}" names prompt set "${profile.promptSet}", which this build does not have`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
for (const [file, bundledPath] of Object.entries(set)) {
|
|
74
|
+
// Set paths come from bundled `with { type: "file" }` imports, which an npm
|
|
75
|
+
// build emits as cwd-relative strings; resolve them against the module like
|
|
76
|
+
// every other bundled asset (src/assets.ts).
|
|
77
|
+
const filePath = resolveBundledFilePath(bundledPath);
|
|
78
|
+
if (defaultAgentFiles.includes(file)) {
|
|
79
|
+
overrides.agents[file] = filePath;
|
|
80
|
+
} else if (isEnginePromptFile(file)) {
|
|
81
|
+
overrides.engine[file] = filePath;
|
|
82
|
+
} else {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`prompt set "${profile.promptSet}" holds "${file}", which overrides no file of the default set`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return overrides;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function isEnginePromptFile(file: string): file is EnginePromptFile {
|
|
92
|
+
return (ENGINE_PROMPT_FILES as readonly string[]).includes(file);
|
|
93
|
+
}
|
|
94
|
+
|
|
22
95
|
export interface ParsedAgent {
|
|
23
96
|
name: string;
|
|
24
97
|
description: string;
|
package/src/review/review.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { engineIdentity } from "#git/identity";
|
|
|
26
26
|
import { countFreeRouteSteps } from "#model/free-discovery";
|
|
27
27
|
import { planRoutes } from "#model/routing";
|
|
28
28
|
import { reviewPr } from "#pr/review-pr";
|
|
29
|
+
import { reviewExitCode } from "#review/exit-code";
|
|
29
30
|
import type { Telemetry } from "#review/findings";
|
|
30
31
|
import { type PipelineResult, runPipeline } from "#review/pipeline";
|
|
31
32
|
import {
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
} from "#review/preflight";
|
|
40
41
|
import { estimateCost } from "#review/report";
|
|
41
42
|
import {
|
|
43
|
+
isBundledAgentsDir,
|
|
42
44
|
pipelineConsolidateInput,
|
|
43
45
|
pipelineMaterialityInput,
|
|
44
46
|
pipelineScoutInput,
|
|
@@ -56,6 +58,7 @@ import {
|
|
|
56
58
|
resolvePipelineRoute,
|
|
57
59
|
resolvePromptSet,
|
|
58
60
|
resolveReviewInstructions,
|
|
61
|
+
routingConfigured,
|
|
59
62
|
selectActiveHunters,
|
|
60
63
|
shadowedGotchasNotice,
|
|
61
64
|
validateGotchas,
|
|
@@ -100,12 +103,14 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
100
103
|
// Two layers since C5, folded by loadEffectiveConfig into the one
|
|
101
104
|
// LocalConfig everything below already expected. The --config missing-file
|
|
102
105
|
// error and the boundary rules live there.
|
|
103
|
-
const { loaded, config, summary, scout, post } = await loadRunConfig(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const { loaded, config, summary, scout, post, profile } = await loadRunConfig(
|
|
107
|
+
{
|
|
108
|
+
root: repoRoot,
|
|
109
|
+
home: os.homedir(),
|
|
110
|
+
configFlag: options.config,
|
|
111
|
+
options,
|
|
112
|
+
},
|
|
113
|
+
);
|
|
109
114
|
options = { ...options, scout, post };
|
|
110
115
|
// S5: the Claude credential this run uses, chosen once, here, from
|
|
111
116
|
// `credentials.claude` and what is set. Every runner, binding and child below
|
|
@@ -158,6 +163,7 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
158
163
|
const { agents, spec, agentFiles, promptSet } = await resolvePromptSet(
|
|
159
164
|
options,
|
|
160
165
|
loaded,
|
|
166
|
+
{ profile },
|
|
161
167
|
);
|
|
162
168
|
const { dir: agentsDir, source: agentsDirSource } = agents;
|
|
163
169
|
|
|
@@ -250,12 +256,14 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
250
256
|
true,
|
|
251
257
|
);
|
|
252
258
|
const productionRoute = await resolvePipelineRoute({
|
|
253
|
-
modelsConfigured: config
|
|
259
|
+
modelsConfigured: routingConfigured(config),
|
|
254
260
|
workspaceRoot: repoRoot,
|
|
255
261
|
spec,
|
|
256
262
|
options,
|
|
257
263
|
agentFiles,
|
|
264
|
+
bundledAgents: isBundledAgentsDir(agents),
|
|
258
265
|
models: config.models,
|
|
266
|
+
profile,
|
|
259
267
|
summary,
|
|
260
268
|
materialityEnabled: resolveMaterialityGate(config),
|
|
261
269
|
claudeRun: options.dryRun ? undefined : claudeRun,
|
|
@@ -425,6 +433,8 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
425
433
|
gotchasPath,
|
|
426
434
|
agentsDir,
|
|
427
435
|
...(agents.files ? { agentFiles: agents.files } : {}),
|
|
436
|
+
// The same answer the plan was built with (resolvePipelineRoute).
|
|
437
|
+
...(isBundledAgentsDir(agents) ? { bundledAgents: true } : {}),
|
|
428
438
|
runDir,
|
|
429
439
|
outPath: path.join(runDir, "findings.json"),
|
|
430
440
|
mcpConfigPath,
|
|
@@ -432,10 +442,11 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
432
442
|
...(options.model ? { model: options.model } : {}),
|
|
433
443
|
parityTriggerPaths: config.parity_trigger_paths,
|
|
434
444
|
suspicionPriors: config.suspicion_priors,
|
|
435
|
-
|
|
436
|
-
...
|
|
437
|
-
...
|
|
438
|
-
...
|
|
445
|
+
modelProfile: profile,
|
|
446
|
+
...pipelineSummarizerInput(summary, { profile }),
|
|
447
|
+
...pipelineScoutInput(options, { profile }),
|
|
448
|
+
...pipelineConsolidateInput({ profile }),
|
|
449
|
+
...pipelineMaterialityInput(config, { profile }),
|
|
439
450
|
...(prTitle === undefined ? {} : { prTitle }),
|
|
440
451
|
...(resolveSharedPrefix(options) ? { sharedPrefix: true } : {}),
|
|
441
452
|
...pipelineConfigInput(loaded),
|
|
@@ -527,6 +538,14 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
527
538
|
})) {
|
|
528
539
|
log(line);
|
|
529
540
|
}
|
|
530
|
-
|
|
531
|
-
|
|
541
|
+
// The same table as PR and CI mode (src/review/exit-code.ts). Local mode
|
|
542
|
+
// posts nothing, so nothing can be dropped.
|
|
543
|
+
return reviewExitCode({
|
|
544
|
+
sessionFailed: result.sessionFailed,
|
|
545
|
+
...(result.noReviewerRan === undefined
|
|
546
|
+
? {}
|
|
547
|
+
: { noReviewerRan: result.noReviewerRan }),
|
|
548
|
+
runStatus: doc.run_status,
|
|
549
|
+
droppedFindingIds: 0,
|
|
550
|
+
});
|
|
532
551
|
}
|