crysk 0.3.3 → 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-dsnffnfp.md +140 -0
- package/dist/SKILL-gnrbph72.md +140 -0
- package/dist/SKILL-k4k0zn1w.md +143 -0
- package/dist/SKILL-kq0xejn3.md +553 -0
- package/dist/SKILL-qaqsbygw.md +66 -0
- package/dist/SKILL-vhb4c3vv.md +553 -0
- package/dist/SKILL-vws0aqb8.md +553 -0
- package/dist/SKILL-xpf6kmdw.md +74 -0
- package/dist/ci-admission-0ken6ehx.md +128 -0
- package/dist/ci-admission-t0f5qwth.md +128 -0
- package/dist/cli.js +3366 -1680
- package/dist/index.js +1884 -947
- package/dist/opencode-ci-ac5zksdn.md +106 -0
- package/dist/workflow-4pkyck01.yml +160 -0
- package/package.json +2 -2
- package/prompts/default/PROVENANCE.md +1 -0
- package/skills/crysk/SKILL.md +16 -16
- package/skills/crysk-ci-setup/SKILL.md +42 -39
- package/skills/crysk-ci-setup/assets/workflow.yml +31 -22
- package/skills/crysk-ci-setup/references/ci-admission.md +2 -2
- package/skills/crysk-ci-setup/references/opencode-ci.md +53 -88
- package/skills/crysk-loop/SKILL.md +20 -9
- package/skills/crysk-pr/SKILL.md +1 -1
- package/src/asset-manifest.ts +0 -4
- package/src/assets.ts +2 -2
- 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 +31 -42
- package/src/ci/outcome.ts +421 -330
- package/src/ci/platform-config.ts +127 -0
- package/src/ci/platform-report.ts +935 -0
- package/src/ci/platform-trace.ts +551 -0
- package/src/ci/platform.ts +465 -0
- package/src/ci/publish.ts +19 -6
- package/src/ci/reporter.ts +9 -7
- package/src/ci/review-admission.ts +8 -4
- package/src/ci/review-levels.ts +8 -7
- package/src/ci/run.ts +88 -0
- package/src/ci/setup.ts +547 -109
- 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/compare/loop.ts +9 -1
- package/src/compare/martian-adapter.ts +1 -1
- 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 +71 -11
- package/src/pr/ci-admission-gate.ts +2 -1
- package/src/pr/finding-state-record.ts +58 -0
- package/src/pr/gate-record.ts +22 -0
- package/src/pr/inline.ts +3 -0
- package/src/pr/plan.ts +20 -4
- package/src/pr/posting.ts +4 -0
- package/src/pr/pr-status.ts +27 -7
- package/src/pr/pr.ts +39 -8
- package/src/pr/preflight.ts +44 -2
- package/src/pr/publish-outcome.ts +11 -3
- package/src/pr/review-pr.ts +20 -4
- package/src/pr/target.ts +12 -3
- package/src/production-runtime.ts +760 -331
- package/src/rereview/classify.ts +4 -0
- package/src/rereview/prepare.ts +47 -22
- package/src/rereview/state.ts +34 -8
- package/src/review/pipeline.ts +277 -101
- package/src/review/preflight.ts +201 -294
- package/src/review/report.ts +60 -40
- 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/published-text.ts +161 -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/triage/triage.ts +2 -1
- 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/commands/doctor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import { loadEffectiveConfig, resolveOptionalRepoRoot } from "#config/config";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ModelsConfig, modelsNeedOpenCode } from "#model/model-name";
|
|
4
4
|
import type { CliOptions } from "#review/preflight";
|
|
5
5
|
import { styleEnabled, terminalWidth } from "#ui/primitives";
|
|
6
6
|
import {
|
|
@@ -38,7 +38,7 @@ export async function runDoctorCommand(input: {
|
|
|
38
38
|
// the loader share. Tests pass a version without resolving a package.
|
|
39
39
|
readSdkVersion?: () => Promise<string | undefined>;
|
|
40
40
|
}): Promise<{ report: DoctorReport; lines: string[] }> {
|
|
41
|
-
let
|
|
41
|
+
let models: ModelsConfig | undefined;
|
|
42
42
|
let configCheck: DoctorCheckItem | undefined;
|
|
43
43
|
try {
|
|
44
44
|
const loaded = await loadEffectiveConfig({
|
|
@@ -46,7 +46,16 @@ export async function runDoctorCommand(input: {
|
|
|
46
46
|
home: input.home,
|
|
47
47
|
configFlag: input.configFlag,
|
|
48
48
|
});
|
|
49
|
-
|
|
49
|
+
models = loaded.effective.models;
|
|
50
|
+
// A config that loads with warnings works today and will not after the
|
|
51
|
+
// key it uses is removed: degraded, with the warning as its message.
|
|
52
|
+
if (loaded.warnings.length > 0) {
|
|
53
|
+
configCheck = {
|
|
54
|
+
name: "config",
|
|
55
|
+
severity: "degraded",
|
|
56
|
+
message: loaded.warnings.join("\n"),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
50
59
|
} catch (error) {
|
|
51
60
|
configCheck = {
|
|
52
61
|
name: "config",
|
|
@@ -63,7 +72,7 @@ export async function runDoctorCommand(input: {
|
|
|
63
72
|
probeExactBindings: () =>
|
|
64
73
|
collectDoctorExactBindingReports({
|
|
65
74
|
workspaceRoot: input.workspaceRoot,
|
|
66
|
-
|
|
75
|
+
models,
|
|
67
76
|
}),
|
|
68
77
|
});
|
|
69
78
|
// Same home the command was given. The no-arg reader uses os.homedir().
|
|
@@ -73,9 +82,9 @@ export async function runDoctorCommand(input: {
|
|
|
73
82
|
readInstalledOpenCodeSdkVersion({
|
|
74
83
|
nodeModulesDir: prheroLayout(input.home).nodeModulesDir,
|
|
75
84
|
}));
|
|
76
|
-
const sdkCheck =
|
|
85
|
+
const sdkCheck = modelsNeedOpenCode(models)
|
|
77
86
|
? openCodeRoutingSdkCheck({
|
|
78
|
-
|
|
87
|
+
models,
|
|
79
88
|
sdkVersion: await readSdkVersion(),
|
|
80
89
|
})
|
|
81
90
|
: undefined;
|
package/src/compare/loop.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
// "carried from <sha>" is a prior verdict copied to a new head (not a review),
|
|
8
8
|
// "overridden" and "stopped by a maintainer" are a human ending the loop.
|
|
9
9
|
|
|
10
|
+
import { isManualReviewHold } from "#pr/preflight";
|
|
11
|
+
|
|
10
12
|
export interface RawStatus {
|
|
11
13
|
createdAt: string;
|
|
12
14
|
context: string;
|
|
@@ -40,6 +42,7 @@ type GateEvent =
|
|
|
40
42
|
| "unverified-fixes"
|
|
41
43
|
| "budget-carried"
|
|
42
44
|
| "error"
|
|
45
|
+
| "held"
|
|
43
46
|
| "pending"
|
|
44
47
|
| "other-success"
|
|
45
48
|
| "other-failure";
|
|
@@ -55,7 +58,11 @@ export function classifyStatus(status: RawStatus): GateEvent {
|
|
|
55
58
|
const d = status.description ?? "";
|
|
56
59
|
switch (status.state) {
|
|
57
60
|
case "pending":
|
|
58
|
-
|
|
61
|
+
// Since Stage 2 #12 a capped rule (budget used up, manual_only) holds the head pending until a
|
|
62
|
+
// human acts. No run holds it, so it is not a review in flight: it is a head that is not green.
|
|
63
|
+
return isManualReviewHold({ state: status.state, description: d })
|
|
64
|
+
? "held"
|
|
65
|
+
: "pending";
|
|
59
66
|
case "error":
|
|
60
67
|
return "error";
|
|
61
68
|
case "success":
|
|
@@ -145,6 +152,7 @@ const NOT_GREEN = new Set<GateEvent>([
|
|
|
145
152
|
"budget-exhausted",
|
|
146
153
|
"size-skipped",
|
|
147
154
|
"error",
|
|
155
|
+
"held",
|
|
148
156
|
"other-failure",
|
|
149
157
|
]);
|
|
150
158
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Project a pr-hero findings.json onto Martian's offline candidate shape.
|
|
2
2
|
// Pure: no I/O, no judge, no precision/recall. The judge is theirs; this
|
|
3
|
-
// only makes our artifacts injectable. See
|
|
3
|
+
// only makes our artifacts injectable. See benchmarks/martian/README.md.
|
|
4
4
|
|
|
5
5
|
import type { Finding } from "#review/findings";
|
|
6
6
|
|
package/src/config/config.ts
CHANGED
|
@@ -158,6 +158,10 @@ export interface EffectiveConfig {
|
|
|
158
158
|
// Returned from the same stat the read used, so the artifact cannot
|
|
159
159
|
// disagree with what was actually loaded.
|
|
160
160
|
globalPresent: boolean;
|
|
161
|
+
// What the two files said that still works but is on its way out (today,
|
|
162
|
+
// `summary.model: "haiku"`), one line each, file named. Every shell that
|
|
163
|
+
// loads config for a run prints them; the parsers never print.
|
|
164
|
+
warnings: string[];
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
// C5 §3.4 — the two-layer read, and the ONLY place either config file is
|
|
@@ -201,15 +205,19 @@ export interface EffectiveConfig {
|
|
|
201
205
|
export async function loadGlobalConfigLayer(home: string): Promise<{
|
|
202
206
|
filePath: string;
|
|
203
207
|
layer: ConfigLayer | undefined;
|
|
208
|
+
warnings: string[];
|
|
204
209
|
}> {
|
|
205
210
|
const filePath = prheroLayout(home).reviewConfigPath;
|
|
206
|
-
|
|
211
|
+
const warnings: string[] = [];
|
|
212
|
+
if (!existsSync(filePath)) return { filePath, layer: undefined, warnings };
|
|
207
213
|
return {
|
|
208
214
|
filePath,
|
|
209
215
|
layer: parseGlobalConfig(
|
|
210
216
|
await Bun.file(filePath).text(),
|
|
211
217
|
`~/${path.basename(path.dirname(filePath))}/config.json`,
|
|
218
|
+
warnings,
|
|
212
219
|
),
|
|
220
|
+
warnings,
|
|
213
221
|
};
|
|
214
222
|
}
|
|
215
223
|
|
|
@@ -226,8 +234,11 @@ export async function loadEffectiveConfig(input: {
|
|
|
226
234
|
if (input.configFlag && !existsSync(repoConfigPath)) {
|
|
227
235
|
throw new CliError(`config file not found: ${repoConfigPath}`);
|
|
228
236
|
}
|
|
229
|
-
const {
|
|
230
|
-
|
|
237
|
+
const {
|
|
238
|
+
filePath: globalConfigPath,
|
|
239
|
+
layer: global,
|
|
240
|
+
warnings,
|
|
241
|
+
} = await loadGlobalConfigLayer(input.home);
|
|
231
242
|
// `global !== undefined` and not a second stat: the helper returns a layer
|
|
232
243
|
// exactly when the file was there and read, so the artifact's
|
|
233
244
|
// `global_present` cannot disagree with what was actually loaded — which is
|
|
@@ -240,6 +251,7 @@ export async function loadEffectiveConfig(input: {
|
|
|
240
251
|
input.configFlag
|
|
241
252
|
? undefined
|
|
242
253
|
: `${path.basename(path.dirname(repoConfigPath))}/config.json`,
|
|
254
|
+
warnings,
|
|
243
255
|
)
|
|
244
256
|
: {};
|
|
245
257
|
return {
|
|
@@ -247,6 +259,7 @@ export async function loadEffectiveConfig(input: {
|
|
|
247
259
|
repoConfigPath,
|
|
248
260
|
globalConfigPath,
|
|
249
261
|
globalPresent,
|
|
262
|
+
warnings,
|
|
250
263
|
};
|
|
251
264
|
}
|
|
252
265
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { modelNameFromAlias } from "#model/model-name";
|
|
2
3
|
import {
|
|
3
4
|
agentStepKey,
|
|
4
|
-
parseLogicalIdentity,
|
|
5
5
|
type ResolvedStepRoute,
|
|
6
|
-
type RoutingConfig,
|
|
7
6
|
resolveStepRoute,
|
|
8
7
|
} from "#model/routing";
|
|
9
8
|
import {
|
|
@@ -106,7 +105,6 @@ export function freezeDiversityPlan(
|
|
|
106
105
|
export interface BuildDiversityPlanInput {
|
|
107
106
|
readonly spec: ReviewSpec;
|
|
108
107
|
readonly c2SchemaVersion: string;
|
|
109
|
-
readonly routingConfig?: RoutingConfig;
|
|
110
108
|
readonly cliModel?: string;
|
|
111
109
|
readonly frontmatterModel?: (agentKey: string) => string | undefined;
|
|
112
110
|
readonly target?: BenchmarkTarget;
|
|
@@ -131,7 +129,9 @@ export function buildDiversityPlan(
|
|
|
131
129
|
if (!models || models.length === 0) continue;
|
|
132
130
|
const specialty = resolveSpecialty(agent);
|
|
133
131
|
for (const model of models) {
|
|
134
|
-
|
|
132
|
+
// A leg's model is internal: a bare alias or a full model name. Its
|
|
133
|
+
// own model always wins over `models`, so the plan needs no `models`.
|
|
134
|
+
const parsed = { canonical: modelNameFromAlias(model).raw };
|
|
135
135
|
const provisionalKey = diversityLegAgentKey(
|
|
136
136
|
agent.key,
|
|
137
137
|
deriveLegId(specialty, parsed.canonical, "pending"),
|
|
@@ -142,7 +142,6 @@ export function buildDiversityPlan(
|
|
|
142
142
|
cliModel: input.cliModel,
|
|
143
143
|
specModel: model,
|
|
144
144
|
frontmatterModel: input.frontmatterModel?.(agent.key),
|
|
145
|
-
routingConfig: input.routingConfig,
|
|
146
145
|
});
|
|
147
146
|
const legId = deriveLegId(
|
|
148
147
|
specialty,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedRoutePlan
|
|
1
|
+
import type { ResolvedRoutePlan } from "#model/routing";
|
|
2
2
|
import type { DraftFinding } from "#review/drafts";
|
|
3
3
|
import { SCHEMA_VERSION_V1_1 } from "#review/findings";
|
|
4
4
|
import type { AgentSpec, ReviewSpec } from "#review/spec";
|
|
@@ -60,7 +60,6 @@ export interface DiversityExecutionContext {
|
|
|
60
60
|
export interface PrepareDiversityInput {
|
|
61
61
|
readonly reviewSpec: ReviewSpec;
|
|
62
62
|
readonly cliModel?: string;
|
|
63
|
-
readonly routingConfig?: RoutingConfig;
|
|
64
63
|
readonly frontmatterModel?: (agentKey: string) => string | undefined;
|
|
65
64
|
readonly target?: BenchmarkTarget;
|
|
66
65
|
readonly runtimeTarget?: BenchmarkTarget;
|
|
@@ -88,7 +87,6 @@ export function prepareDiversityExecution(
|
|
|
88
87
|
spec: input.reviewSpec,
|
|
89
88
|
c2SchemaVersion: SCHEMA_VERSION_V1_1,
|
|
90
89
|
cliModel: input.cliModel,
|
|
91
|
-
routingConfig: input.routingConfig,
|
|
92
90
|
frontmatterModel: input.frontmatterModel,
|
|
93
91
|
target: frozenTarget,
|
|
94
92
|
promptFingerprint: input.promptFingerprint,
|
|
@@ -307,9 +305,6 @@ export function recordDiversityHunterResult(
|
|
|
307
305
|
legId: resolvedLeg.legId,
|
|
308
306
|
backend: routeProvenance.backend,
|
|
309
307
|
provider: routeProvenance.provider,
|
|
310
|
-
...(routeProvenance.gateway === undefined
|
|
311
|
-
? {}
|
|
312
|
-
: { gateway: routeProvenance.gateway }),
|
|
313
308
|
modelFamily: routeProvenance.modelFamily,
|
|
314
309
|
modelSnapshot: routeProvenance.modelSnapshot,
|
|
315
310
|
...(routeProvenance.modelVariant === undefined
|
|
@@ -435,9 +430,6 @@ export function diversityDebugFromLedger(
|
|
|
435
430
|
path: record.observation.path,
|
|
436
431
|
backend: record.observation.backend,
|
|
437
432
|
provider: record.observation.provider,
|
|
438
|
-
...(record.observation.gateway === undefined
|
|
439
|
-
? {}
|
|
440
|
-
: { gateway: record.observation.gateway }),
|
|
441
433
|
modelFamily: record.observation.modelFamily,
|
|
442
434
|
modelSnapshot: record.observation.modelSnapshot,
|
|
443
435
|
...(record.observation.modelVariant === undefined
|
package/src/doctor.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { type ModelsConfig, modelsNeedOpenCode } from "#model/model-name";
|
|
4
5
|
import {
|
|
5
6
|
exactBindingCapabilityIssues,
|
|
6
7
|
type ProviderCapabilityReport,
|
|
7
8
|
} from "#model/provider-capabilities";
|
|
8
|
-
import { type RoutingConfig, routingNeedsOpenCodeSdk } from "#model/routing";
|
|
9
9
|
import {
|
|
10
10
|
agentFilePath,
|
|
11
11
|
GOTCHAS_PLACEHOLDER_MARKER,
|
|
@@ -161,10 +161,10 @@ function pushProviderIssues(
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
export function openCodeRoutingSdkCheck(input: {
|
|
164
|
-
|
|
164
|
+
models: ModelsConfig | undefined;
|
|
165
165
|
sdkVersion: string | undefined;
|
|
166
166
|
}): DoctorCheckItem | undefined {
|
|
167
|
-
if (!
|
|
167
|
+
if (!modelsNeedOpenCode(input.models)) return undefined;
|
|
168
168
|
const version =
|
|
169
169
|
typeof input.sdkVersion === "string" ? input.sdkVersion.trim() : "";
|
|
170
170
|
if (version === SUPPORTED_OPENCODE_SDK_VERSION) return undefined;
|
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
redactEvidenceText,
|
|
9
9
|
} from "../security/evidence-redaction";
|
|
10
10
|
import { writeJsonAtomically } from "./atomic-write";
|
|
11
|
-
import
|
|
11
|
+
import {
|
|
12
|
+
effortApplied,
|
|
13
|
+
type TransportOutcome,
|
|
14
|
+
type TransportRequest,
|
|
15
|
+
} from "./contracts";
|
|
12
16
|
import type { SettlementReceipt } from "./settlement";
|
|
13
17
|
import { attemptEvidencePath } from "./step-artifacts";
|
|
14
18
|
|
|
@@ -378,12 +382,13 @@ export async function freezeAttemptEvidenceIdentity(
|
|
|
378
382
|
// #299: the effort the engine REQUESTED, and whether this backend
|
|
379
383
|
// could apply it. The CLI's implicit default (medium on the 5.5
|
|
380
384
|
// family) is what the artifacts could not show before. OpenCode has
|
|
381
|
-
// no `--effort
|
|
382
|
-
//
|
|
383
|
-
//
|
|
385
|
+
// no `--effort`: there the level is intent only, and an effort reaches
|
|
386
|
+
// it only as the variant a `models` entry sets (S7, `route.modelVariant`
|
|
387
|
+
// above), so `effortApplied` is true only then (effortApplied,
|
|
388
|
+
// contracts.ts). Additive, and deliberately NOT in `identity` or the
|
|
384
389
|
// route fingerprint: those are compared across runs by the lab.
|
|
385
390
|
effort: request.effort,
|
|
386
|
-
effortApplied: request.route
|
|
391
|
+
effortApplied: effortApplied(request.route),
|
|
387
392
|
...frozen,
|
|
388
393
|
};
|
|
389
394
|
await mkdir(path.dirname(file), { recursive: true });
|