crysk 0.4.0 → 0.5.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 +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/force-comment.ts +14 -1
- package/src/ci/gates.ts +86 -57
- package/src/ci/outcome.ts +421 -330
- package/src/ci/platform-config.ts +2 -2
- package/src/ci/platform-estimate.ts +111 -0
- package/src/ci/platform-report.ts +274 -41
- package/src/ci/platform-trace.ts +581 -0
- package/src/ci/platform.ts +58 -12
- package/src/ci/publish.ts +19 -6
- package/src/ci/reporter.ts +14 -4
- package/src/ci/review-levels.ts +8 -7
- package/src/ci/run.ts +88 -0
- package/src/ci/setup.ts +485 -118
- package/src/ci/trace-bundle.ts +1486 -0
- package/src/ci/trace-transcripts.ts +480 -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/ci-admission-gate.ts +2 -0
- package/src/pr/discovery.ts +18 -0
- package/src/pr/plan.ts +55 -5
- package/src/pr/preflight.ts +1 -1
- package/src/pr/publish-outcome.ts +1 -1
- package/src/pr/review-pr.ts +26 -1
- package/src/pr/target.ts +63 -11
- 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 +30 -26
- package/src/review/review.ts +20 -3
- package/src/review/route-preflight.ts +79 -11
- package/src/review/run.ts +44 -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 +84 -50
- package/src/updater.ts +10 -7
- package/prompts/default/deep-review-lifecycle.md +0 -362
package/src/ci/gates.ts
CHANGED
|
@@ -190,7 +190,10 @@ function sizeLimitsText(maxLines: number, maxFiles: number): string {
|
|
|
190
190
|
return `${lines} / ${files}`;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
function buildSizeSkipComment(
|
|
193
|
+
function buildSizeSkipComment(
|
|
194
|
+
data: SkipSizeSummary,
|
|
195
|
+
platformConnected: boolean,
|
|
196
|
+
): string {
|
|
194
197
|
const lines = [
|
|
195
198
|
SKIP_SIZE_COMMENT_MARKER,
|
|
196
199
|
"## Crysk review skipped",
|
|
@@ -199,16 +202,28 @@ function buildSizeSkipComment(data: SkipSizeSummary): string {
|
|
|
199
202
|
`${data.changedFiles} file(s), exceeding the configured size gate ` +
|
|
200
203
|
`(${sizeLimitsText(data.maxChangedLines, data.maxChangedFiles)}).`,
|
|
201
204
|
"",
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"
|
|
205
|
+
// A platform repository sets its limits in the dashboard, not as inputs.
|
|
206
|
+
platformConnected
|
|
207
|
+
? "Crysk did not run to avoid reviewing an unbounded diff. Split the " +
|
|
208
|
+
"PR or raise the size limits in the Crysk dashboard to change them " +
|
|
209
|
+
"for later pushes."
|
|
210
|
+
: "Crysk did not run to avoid reviewing an unbounded diff. Split the " +
|
|
211
|
+
"PR or raise `max-changed-lines` / `max-changed-files` to change the " +
|
|
212
|
+
"limit for later pushes.",
|
|
205
213
|
"",
|
|
206
|
-
ciForceReviewHintLine(data.prNumber),
|
|
214
|
+
ciForceReviewHintLine(data.prNumber, platformConnected),
|
|
207
215
|
];
|
|
208
216
|
return `${lines.join("\n")}\n`;
|
|
209
217
|
}
|
|
210
218
|
|
|
219
|
+
// What a platform repository can do about a budget skip (cryskai/platform#12):
|
|
220
|
+
// it has no `budget-usd` input to raise, and what a review costs is the model
|
|
221
|
+
// setup chosen in the dashboard.
|
|
222
|
+
const PLATFORM_BUDGET_SKIP_HINT =
|
|
223
|
+
"To change what reviews cost, change the model setup in the Crysk dashboard.";
|
|
224
|
+
|
|
211
225
|
function buildBudgetSkipComment(data: SkipBudgetSummary): string {
|
|
226
|
+
const platformConnected = data.platformConnected === true;
|
|
212
227
|
const lines = [
|
|
213
228
|
SKIP_BUDGET_COMMENT_MARKER,
|
|
214
229
|
"## Crysk review skipped",
|
|
@@ -216,10 +231,12 @@ function buildBudgetSkipComment(data: SkipBudgetSummary): string {
|
|
|
216
231
|
`⚠️ The estimated review cost (${usd(data.estimatedCostUsd)}) exceeds ` +
|
|
217
232
|
`the configured CI budget ceiling (${usd(data.budgetUsd)}).`,
|
|
218
233
|
"",
|
|
219
|
-
|
|
220
|
-
|
|
234
|
+
platformConnected
|
|
235
|
+
? PLATFORM_BUDGET_SKIP_HINT
|
|
236
|
+
: "Crysk did not run to stay within the configured `--budget-usd` " +
|
|
237
|
+
"ceiling.",
|
|
221
238
|
"",
|
|
222
|
-
ciForceReviewHintLine(data.prNumber),
|
|
239
|
+
ciForceReviewHintLine(data.prNumber, platformConnected),
|
|
223
240
|
];
|
|
224
241
|
return `${lines.join("\n")}\n`;
|
|
225
242
|
}
|
|
@@ -240,6 +257,9 @@ export interface CiSizeGateSkipInput {
|
|
|
240
257
|
// failed (size-gate.ts), but the summary/comment show both metrics.
|
|
241
258
|
maxChangedLines: number;
|
|
242
259
|
maxChangedFiles: number;
|
|
260
|
+
// The run came through the Crysk platform (CRYSK_PLATFORM_CONNECTED): the
|
|
261
|
+
// comment names only what applies to a platform repository.
|
|
262
|
+
platformConnected?: boolean;
|
|
243
263
|
}
|
|
244
264
|
|
|
245
265
|
// `null` means "nothing to publish": either this isn't a CI run, or the
|
|
@@ -254,8 +274,12 @@ export function ciSizeGateSkip(input: CiSizeGateSkipInput): CiGateSkip | null {
|
|
|
254
274
|
changedFiles: input.verdict.effectiveFiles,
|
|
255
275
|
maxChangedLines: input.maxChangedLines,
|
|
256
276
|
maxChangedFiles: input.maxChangedFiles,
|
|
277
|
+
...(input.platformConnected === true ? { platformConnected: true } : {}),
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
comment: buildSizeSkipComment(summary, input.platformConnected === true),
|
|
281
|
+
summary,
|
|
257
282
|
};
|
|
258
|
-
return { comment: buildSizeSkipComment(summary), summary };
|
|
259
283
|
}
|
|
260
284
|
|
|
261
285
|
export interface CiBudgetGateSkipInput {
|
|
@@ -263,6 +287,9 @@ export interface CiBudgetGateSkipInput {
|
|
|
263
287
|
estimatedCostUsd: number;
|
|
264
288
|
budgetUsd: number;
|
|
265
289
|
prNumber: number;
|
|
290
|
+
// The run came through the Crysk platform (CRYSK_PLATFORM_CONNECTED): the
|
|
291
|
+
// skip names only what applies to a platform repository.
|
|
292
|
+
platformConnected?: boolean;
|
|
266
293
|
}
|
|
267
294
|
|
|
268
295
|
export function ciBudgetGateSkip(
|
|
@@ -275,6 +302,7 @@ export function ciBudgetGateSkip(
|
|
|
275
302
|
prNumber: input.prNumber,
|
|
276
303
|
estimatedCostUsd: input.estimatedCostUsd,
|
|
277
304
|
budgetUsd: input.budgetUsd,
|
|
305
|
+
...(input.platformConnected === true ? { platformConnected: true } : {}),
|
|
278
306
|
};
|
|
279
307
|
return { comment: buildBudgetSkipComment(summary), summary };
|
|
280
308
|
}
|
|
@@ -330,44 +358,30 @@ export type CiBillingMode = "subscription" | "metered";
|
|
|
330
358
|
// ANTHROPIC_AUTH_TOKEN joined the signal in the same move. It was never
|
|
331
359
|
// excluded by a decision — the doctrine below never mentions it — and
|
|
332
360
|
// `ENV_PASSTHROUGH` (harness.ts) projects it into the child immediately beside
|
|
333
|
-
// ANTHROPIC_API_KEY as the same per-token credential class, so the rule
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
//
|
|
337
|
-
//
|
|
361
|
+
// ANTHROPIC_API_KEY as the same per-token credential class, so the presence rule
|
|
362
|
+
// that stood below (retired by S5) already covered it. It cannot reach a run's
|
|
363
|
+
// ceiling any more: the action takes Claude credentials only from the CRYSK_CLAUDE_*
|
|
364
|
+
// secrets in its crysk-secrets input (S8, U5) and empties the CLI's own variables,
|
|
365
|
+
// and the run env (claudeRunEnv) removes ANTHROPIC_AUTH_TOKEN whatever its source.
|
|
338
366
|
//
|
|
339
|
-
//
|
|
340
|
-
//
|
|
341
|
-
//
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
// the projection with no precedence between them, and `defaultClaudeAuthProbe`
|
|
349
|
-
// (model/provider-capabilities.ts:402-405) ORs them into a single boolean. Whichever
|
|
350
|
-
// one the Claude CLI itself prefers wins, and that fact is recorded nowhere in
|
|
351
|
-
// this codebase.
|
|
367
|
+
// S5 (2026-11-06) retired the rule that stood here: "the mere PRESENCE of a key keeps
|
|
368
|
+
// the ceiling", written while nobody chose which credential billed when both were set
|
|
369
|
+
// (the CLI preferred the key, observed on CLI 2.1.312). Now the run chooses: the first
|
|
370
|
+
// credential in `credentials.claude` (default subscription, then api_key) that is
|
|
371
|
+
// present, once at run start (security/claude-credential.ts). The env this function
|
|
372
|
+
// receives is that run's env, which holds the chosen Claude credential and no other,
|
|
373
|
+
// so `metered` here means the run uses the API key, and a repo holding both secrets
|
|
374
|
+
// with the default order runs on the subscription with no ceiling. A caller that
|
|
375
|
+
// passes the raw process env instead gets the old presence answer.
|
|
352
376
|
//
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
// Trimming is load-bearing. 2026-09-02, #177 corrects the overstatement this
|
|
363
|
-
// paragraph used to carry ("without the trim, no route would ever resolve as
|
|
364
|
-
// a subscription in Actions"): action.yml:111 binds the input UNCONDITIONALLY
|
|
365
|
-
// and GitHub renders an unset input as the empty string, so every
|
|
366
|
-
// subscription-route CI run carries `ANTHROPIC_API_KEY=""` — and `""` is
|
|
367
|
-
// already falsy, so that case never needed the trim. What the trim catches is
|
|
368
|
-
// a WHITESPACE-ONLY value, which is truthy and would otherwise impose a
|
|
369
|
-
// ceiling on a subscription route. `test/ci/gates.test.ts` asserts both cases
|
|
370
|
-
// separately, and only the whitespace ones flip when the trim is removed.
|
|
377
|
+
// Trimming is load-bearing. An empty value never needed it: `""` is already
|
|
378
|
+
// falsy, and it is what the action binds the CLI's Claude variables to and how
|
|
379
|
+
// GitHub renders a secret the repository does not have. What the trim catches is
|
|
380
|
+
// a WHITESPACE-ONLY value, which is truthy and would otherwise impose a ceiling
|
|
381
|
+
// on a subscription route, for a caller that passes a raw env (the run env never
|
|
382
|
+
// holds one: claudeCredentialPresence trims the same way and drops it).
|
|
383
|
+
// `test/ci/gates.test.ts` asserts both cases separately, and only the
|
|
384
|
+
// whitespace ones flip when the trim is removed.
|
|
371
385
|
//
|
|
372
386
|
// This is deliberately NOT `model/provider-capabilities.ts`'s
|
|
373
387
|
// `CLAUDE_CAPABILITY_STATICS.billingMode`, and the two must not be "unified"
|
|
@@ -396,19 +410,19 @@ export type CiBillingMode = "subscription" | "metered";
|
|
|
396
410
|
// through that one decision — this CI gate is not that caller, and never
|
|
397
411
|
// should be.
|
|
398
412
|
//
|
|
399
|
-
// Optional `
|
|
413
|
+
// Optional `openCodeBillsMetered` is the OpenCode half of the same ceiling
|
|
400
414
|
// question — "could this run invoice?" — ORed beside the Anthropic env
|
|
401
415
|
// predicate, never folded into it. `envBillsMetered` stamps Claude CLI
|
|
402
416
|
// usage and must stay Anthropic-env-only. Omit the option (or leave it
|
|
403
|
-
// undefined/false) and this function stays env-only.
|
|
404
|
-
//
|
|
405
|
-
//
|
|
406
|
-
//
|
|
417
|
+
// undefined/false) and this function stays env-only. The caller derives it
|
|
418
|
+
// from the routes the run resolves (openCodeRoutesBillMetered, ci/setup.ts):
|
|
419
|
+
// an OpenCode provider bound to an API key can invoice; an auth file that only
|
|
420
|
+
// holds providers no model uses cannot (cryskai/platform#12).
|
|
407
421
|
export function deriveCiBillingMode(
|
|
408
422
|
env: Record<string, string | undefined>,
|
|
409
|
-
opts?: {
|
|
423
|
+
opts?: { openCodeBillsMetered?: boolean },
|
|
410
424
|
): CiBillingMode {
|
|
411
|
-
return envBillsMetered(env) || opts?.
|
|
425
|
+
return envBillsMetered(env) || opts?.openCodeBillsMetered === true
|
|
412
426
|
? "metered"
|
|
413
427
|
: "subscription";
|
|
414
428
|
}
|
|
@@ -669,6 +683,7 @@ const COVERAGE_REASON_LABEL: Record<
|
|
|
669
683
|
function buildCoverageSkipComment(
|
|
670
684
|
data: SkipCoverageSummary,
|
|
671
685
|
reason: CiReviewSkipReason,
|
|
686
|
+
platformConnected: boolean,
|
|
672
687
|
): string {
|
|
673
688
|
// A stop is a maintainer's decision, not a score: the score line would
|
|
674
689
|
// blame the push for a skip it did not cause.
|
|
@@ -691,7 +706,7 @@ function buildCoverageSkipComment(
|
|
|
691
706
|
"The existing review comment still describes the last head Crysk " +
|
|
692
707
|
"reviewed.",
|
|
693
708
|
"",
|
|
694
|
-
ciForceReviewHintLine(data.prNumber),
|
|
709
|
+
ciForceReviewHintLine(data.prNumber, platformConnected),
|
|
695
710
|
];
|
|
696
711
|
return `${lines.join("\n")}\n`;
|
|
697
712
|
}
|
|
@@ -700,7 +715,10 @@ function buildCoverageSkipComment(
|
|
|
700
715
|
// it by the repository's own rules, says what the gate does with the next pushes, and how to ask for more.
|
|
701
716
|
// Stage 2 #12: no review reads those pushes, so the gate holds a green instead of carrying it, and the
|
|
702
717
|
// override is how a human merges a head no review verified.
|
|
703
|
-
function buildManualRequiredComment(
|
|
718
|
+
function buildManualRequiredComment(
|
|
719
|
+
data: ManualRequiredSummary,
|
|
720
|
+
platformConnected: boolean,
|
|
721
|
+
): string {
|
|
704
722
|
const manualOnly = data.admissionReason === "manual-only-policy";
|
|
705
723
|
const rules = [
|
|
706
724
|
...(data.policyMode === undefined
|
|
@@ -734,7 +752,7 @@ function buildManualRequiredComment(data: ManualRequiredSummary): string {
|
|
|
734
752
|
"",
|
|
735
753
|
"The existing review comment still describes the last head Crysk reviewed.",
|
|
736
754
|
"",
|
|
737
|
-
`Want more review rounds? ${ciForceReviewHintLine(data.prNumber)}`,
|
|
755
|
+
`Want more review rounds? ${ciForceReviewHintLine(data.prNumber, platformConnected)}`,
|
|
738
756
|
];
|
|
739
757
|
return `${lines.join("\n")}\n`;
|
|
740
758
|
}
|
|
@@ -794,6 +812,8 @@ export function planCiReviewSkip(input: {
|
|
|
794
812
|
verdict: Extract<CiReviewAdmissionVerdict, { action: "skip" }>;
|
|
795
813
|
admission?: AdmissionContext;
|
|
796
814
|
ciMode: CiMode;
|
|
815
|
+
// The run came through the Crysk platform: the hint names only `/crysk review`.
|
|
816
|
+
platformConnected?: boolean;
|
|
797
817
|
}): CiGateSkipPlan {
|
|
798
818
|
const detail = ciReviewSkipDetail(input.verdict);
|
|
799
819
|
const summary: SkipCoverageSummary = {
|
|
@@ -808,7 +828,11 @@ export function planCiReviewSkip(input: {
|
|
|
808
828
|
...skipAdmissionSummaryFields(input.verdict, input.admission),
|
|
809
829
|
};
|
|
810
830
|
return {
|
|
811
|
-
comment: buildCoverageSkipComment(
|
|
831
|
+
comment: buildCoverageSkipComment(
|
|
832
|
+
summary,
|
|
833
|
+
input.verdict.reason,
|
|
834
|
+
input.platformConnected === true,
|
|
835
|
+
),
|
|
812
836
|
markerPrefix: SKIP_COVERAGE_COMMENT_MARKER,
|
|
813
837
|
summaryMarkdown: renderStepSummary(summary, input.ciMode),
|
|
814
838
|
outputs: ciGateSkipOutputs("skipped-coverage", 0),
|
|
@@ -820,6 +844,8 @@ export function planCiReviewManualRequired(input: {
|
|
|
820
844
|
verdict: Extract<CiReviewAdmissionVerdict, { action: "manual-required" }>;
|
|
821
845
|
admission?: AdmissionContext;
|
|
822
846
|
ciMode: CiMode;
|
|
847
|
+
// The run came through the Crysk platform: the hint names only `/crysk review`.
|
|
848
|
+
platformConnected?: boolean;
|
|
823
849
|
}): CiGateSkipPlan {
|
|
824
850
|
const detail = ciReviewManualRequiredDetail(input.verdict);
|
|
825
851
|
const summary: ManualRequiredSummary = {
|
|
@@ -836,7 +862,10 @@ export function planCiReviewManualRequired(input: {
|
|
|
836
862
|
...manualAdmissionSummaryFields(input.verdict, input.admission),
|
|
837
863
|
};
|
|
838
864
|
return {
|
|
839
|
-
comment: buildManualRequiredComment(
|
|
865
|
+
comment: buildManualRequiredComment(
|
|
866
|
+
summary,
|
|
867
|
+
input.platformConnected === true,
|
|
868
|
+
),
|
|
840
869
|
markerPrefix: MANUAL_REQUIRED_COMMENT_MARKER,
|
|
841
870
|
summaryMarkdown: renderStepSummary(summary, input.ciMode),
|
|
842
871
|
outputs: ciGateSkipOutputs("manual-required", 0),
|