crysk 0.6.1 → 0.8.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 +28 -22
- package/dist/SKILL-1q3658n0.md +74 -0
- package/dist/SKILL-25j4q9b8.md +143 -0
- package/dist/SKILL-32cmme3j.md +143 -0
- package/dist/SKILL-4747bhne.md +143 -0
- package/dist/SKILL-4jc3sv23.md +74 -0
- package/dist/SKILL-c0492rch.md +540 -0
- package/dist/SKILL-d1nzkhhr.md +74 -0
- package/dist/SKILL-f8p7kvx0.md +143 -0
- package/dist/SKILL-gxd45g38.md +553 -0
- package/dist/SKILL-rec41991.md +66 -0
- package/dist/SKILL-zze8zj5g.md +536 -0
- package/dist/adjudicator-eckqh14e.md +78 -0
- package/dist/ci-admission-qn797a6c.md +128 -0
- package/dist/cli.js +18608 -18523
- package/dist/consolidate-4xw1pkg7.md +24 -0
- package/dist/deep-review-logic-dgr112y1.md +196 -0
- package/dist/deep-review-logic-fck5z4xe.md +197 -0
- package/dist/deep-review-logic-h1fpamfh.md +192 -0
- package/dist/deep-review-logic-m4vk5683.md +196 -0
- package/dist/deep-review-logic-z63kmgmc.md +157 -0
- package/dist/deep-review-parity-7x7s5d81.md +148 -0
- package/dist/deep-review-parity-9wxmynsc.md +115 -0
- package/dist/deep-review-parity-bwwe7cx6.md +152 -0
- package/dist/deep-review-parity-e50pw3pk.md +117 -0
- package/dist/deep-review-parity-ennmm9m1.md +151 -0
- package/{prompts/default/deep-review-parity.md → dist/deep-review-parity-h7y6y2he.md} +14 -16
- package/dist/deep-review-parity-xg6wy69c.md +151 -0
- package/dist/deep-review-reliability-6h3c4gmw.md +125 -0
- package/dist/deep-review-reliability-dcjab69x.md +122 -0
- package/dist/deep-review-reliability-ec7b5pbk.md +159 -0
- package/dist/deep-review-reliability-hvasvmt9.md +153 -0
- package/dist/deep-review-reliability-mjnayxmt.md +158 -0
- package/dist/deep-review-reliability-mm7fnayf.md +124 -0
- package/dist/deep-review-reliability-xk4xvc2w.md +158 -0
- package/dist/deep-review-resilience-0esd5qeh.md +148 -0
- package/dist/deep-review-resilience-envgcmpy.md +115 -0
- package/dist/deep-review-resilience-fgx8ythf.md +151 -0
- package/dist/deep-review-resilience-mq5qa6ad.md +152 -0
- package/dist/deep-review-resilience-pwh1gawp.md +151 -0
- package/dist/deep-review-resilience-s9n21dkx.md +117 -0
- package/dist/deep-review-resilience-vz4qskea.md +119 -0
- package/dist/deep-review-security-1vwjdc9q.md +205 -0
- package/dist/deep-review-security-x1cc1z00.md +205 -0
- package/dist/index.js +590 -485
- package/dist/opencode-ci-jc8mf4wn.md +106 -0
- package/dist/opencode-ci-qrcv7a99.md +106 -0
- package/dist/opencode-ci-rdpcc7xc.md +106 -0
- package/dist/opencode-ci-yt0k74t0.md +106 -0
- package/dist/review-refuter-7qffwtzz.md +77 -0
- package/dist/verifier-tyh8r45v.md +40 -0
- package/dist/verifier-xf4xj701.md +40 -0
- package/dist/workflow-andv2dvm.yml +158 -0
- package/package.json +1 -1
- package/prompts/consolidate.md +1 -1
- package/prompts/default/PROVENANCE.md +6 -0
- package/prompts/default/deep-review-logic.md +56 -15
- package/prompts/default/deep-review-reliability.md +64 -30
- package/prompts/default/deep-review-resilience.md +71 -37
- package/prompts/default/deep-review-security.md +205 -0
- package/prompts/default/review-refuter.md +1 -1
- package/prompts/verifier.md +40 -0
- package/skills/crysk/SKILL.md +6 -6
- package/skills/crysk-ci-setup/SKILL.md +32 -33
- package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
- package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
- package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
- package/skills/crysk-loop/SKILL.md +37 -54
- package/skills/crysk-loop/adjudicator.md +10 -18
- package/skills/crysk-pr/SKILL.md +1 -1
- package/src/asset-manifest.ts +6 -6
- package/src/assets.ts +4 -4
- package/src/brand.ts +20 -30
- package/src/ci/gates.ts +155 -192
- package/src/ci/outcome.ts +4 -31
- package/src/ci/platform-limits.ts +135 -0
- package/src/ci/platform-report.ts +212 -126
- package/src/ci/platform.ts +28 -26
- package/src/ci/reporter.ts +25 -26
- package/src/ci/review-admission.ts +1 -2
- package/src/ci/review-levels.ts +12 -53
- package/src/ci/setup.ts +96 -66
- package/src/ci/trace-bundle.ts +11 -27
- package/src/ci/trace-transcripts.ts +4 -6
- package/src/ci/trigger.ts +3 -5
- package/src/cli.ts +6 -5
- package/src/commands/ci-setup-questions.ts +2 -55
- package/src/commands/ci-setup.ts +2 -26
- package/src/commands/triage.ts +131 -38
- package/src/commands/usage.ts +0 -1
- package/src/compare/compare.ts +3 -3
- package/src/compare/floor-test.ts +30 -201
- package/src/compare/hunter-exam.ts +631 -0
- package/src/config/config.ts +6 -30
- package/src/diversity/accounting.ts +0 -26
- package/src/diversity/benchmark.ts +1 -17
- package/src/diversity/identity.ts +0 -14
- package/src/diversity/pipeline-integration.ts +0 -29
- package/src/doctor.ts +3 -6
- package/src/execution/claude-session-trace.ts +7 -2
- package/src/execution/contracts.ts +15 -9
- package/src/execution/harness.ts +165 -187
- package/src/execution/spend-limiter.ts +39 -131
- package/src/execution/usage-facts.ts +397 -0
- package/src/execution/usage-normalized.ts +33 -86
- package/src/harness/materiality-judge.ts +0 -5
- package/src/harness/pipeline-plan.ts +0 -3
- package/src/harness/replay-rows.ts +0 -5
- package/src/harness/route-runner.ts +2 -2
- package/src/harness/single-step.ts +3 -9
- package/src/index.ts +1 -1
- package/src/mcp/preflight.ts +2 -2
- package/src/model/catalog.ts +1 -3
- package/src/model/free-discovery.ts +11 -78
- package/src/model/model-name.ts +16 -5
- package/src/model/profiles/claude.ts +1 -2
- package/src/model/profiles/openai.ts +1 -2
- package/src/model/profiles.ts +2 -3
- package/src/model/provider-capabilities.ts +16 -55
- package/src/model/routing.ts +39 -36
- package/src/pr/admission.ts +6 -6
- package/src/pr/answered-findings.ts +8 -4
- package/src/pr/ci-publish.ts +0 -2
- package/src/pr/discovery.ts +4 -25
- package/src/pr/plan.ts +40 -121
- package/src/pr/pr-status.ts +14 -2
- package/src/pr/pr.ts +1 -1
- package/src/pr/preflight.ts +44 -15
- package/src/pr/publish-outcome.ts +1 -19
- package/src/pr/review-pr.ts +15 -47
- package/src/pr/target.ts +76 -82
- package/src/production-runtime.ts +52 -114
- package/src/progress.ts +0 -54
- package/src/rereview/prepare.ts +4 -1
- package/src/rereview/state.ts +1 -1
- package/src/rereview/verify.ts +15 -9
- package/src/review/boundary.ts +5 -8
- package/src/review/drafts.ts +3 -3
- package/src/review/findings-conformance.ts +1 -1
- package/src/review/findings.ts +0 -4
- package/src/review/pipeline.ts +194 -407
- package/src/review/preflight.ts +175 -201
- package/src/review/prompt-set.ts +1 -2
- package/src/review/report.ts +2 -162
- package/src/review/review.ts +25 -74
- package/src/review/route-preflight.ts +19 -35
- package/src/review/run.ts +37 -73
- package/src/review/size-gate.ts +3 -3
- package/src/review/spec.ts +6 -11
- package/src/review/step-runner.ts +4 -4
- package/src/runner-authority.ts +10 -9
- package/src/security/credential-broker.ts +5 -6
- package/src/server/preflight.ts +0 -1
- package/src/server/server.ts +17 -6
- package/src/store/activity.ts +1 -2
- package/src/store/backfill-preflight.ts +0 -3
- package/src/store/backfill.ts +0 -1
- package/src/store/metrics-preflight.ts +4 -14
- package/src/store/metrics.ts +5 -5
- package/src/store/preflight.ts +0 -13
- package/src/store/store.ts +11 -12
- package/src/transport-registry.ts +6 -30
- package/src/transports/claude-code-cli.ts +149 -215
- package/src/transports/opencode-client.ts +4 -24
- package/src/transports/opencode-sdk.ts +17 -112
- package/src/triage/plain-reply.ts +37 -0
- package/src/ui/activity.ts +1 -6
- package/src/ui/config-edit.ts +14 -67
- package/src/ui/config.ts +3 -8
- package/src/ui/plan.ts +11 -198
- package/src/ui/progress.ts +3 -49
- package/src/ui/result.ts +18 -77
- package/src/ui/review-menu.ts +3 -12
- package/src/ui/select.ts +9 -79
- package/src/updater.ts +1 -1
- package/src/usage.ts +1 -7
- package/prompts/scout.md +0 -140
- package/src/ci/platform-estimate.ts +0 -111
- package/src/review/scout.ts +0 -323
package/src/ci/platform.ts
CHANGED
|
@@ -39,11 +39,11 @@ import {
|
|
|
39
39
|
} from "../model/profiles";
|
|
40
40
|
// A sibling with no imports of its own, so the builtins-only rule still holds.
|
|
41
41
|
import {
|
|
42
|
-
|
|
43
|
-
type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} from "./platform-
|
|
42
|
+
PLATFORM_LIMITS_CAPABILITY,
|
|
43
|
+
type PlatformLimits,
|
|
44
|
+
parsePlatformLimits,
|
|
45
|
+
serializePlatformLimits,
|
|
46
|
+
} from "./platform-limits";
|
|
47
47
|
|
|
48
48
|
export const PLATFORM_API_URL = "https://api.crysk.dev";
|
|
49
49
|
|
|
@@ -52,11 +52,17 @@ export const PLATFORM_API_URL = "https://api.crysk.dev";
|
|
|
52
52
|
// profile only to a run that names this capability.
|
|
53
53
|
export const PLATFORM_PROFILE_CAPABILITY = "profile";
|
|
54
54
|
|
|
55
|
+
// platform-owned-cost T7 (L55): this engine applies the platform's limits. Only
|
|
56
|
+
// a run that names the capability gets `limits` in the token response: the
|
|
57
|
+
// per-review limit, what is left of the month's, and the platform's estimate.
|
|
58
|
+
// There is no capability for the usage facts any more: the report always
|
|
59
|
+
// carries them (src/ci/platform-report.ts).
|
|
60
|
+
|
|
55
61
|
// What this engine reads from the `/runs/token` response, as the platform's
|
|
56
62
|
// comma-separated `X-Crysk-Capabilities` list.
|
|
57
63
|
export const PLATFORM_CAPABILITIES = [
|
|
58
|
-
PLATFORM_ESTIMATE_CAPABILITY,
|
|
59
64
|
PLATFORM_PROFILE_CAPABILITY,
|
|
65
|
+
PLATFORM_LIMITS_CAPABILITY,
|
|
60
66
|
].join(",");
|
|
61
67
|
|
|
62
68
|
// The audience the platform verifies. An OIDC token minted for any other
|
|
@@ -174,8 +180,8 @@ export type PlatformTokenResult =
|
|
|
174
180
|
// `full` or `metadata_only`; the connect step reads absence as metadata_only.
|
|
175
181
|
// `traceContent` is present, and true, only when the platform sent exactly
|
|
176
182
|
// `true`; the connect step reads absence as false.
|
|
177
|
-
// `
|
|
178
|
-
// ask for
|
|
183
|
+
// `limits` is present only for the first connect step (refresh steps do not
|
|
184
|
+
// ask for it) and only when the platform sent at least one usable number.
|
|
179
185
|
| {
|
|
180
186
|
ok: true;
|
|
181
187
|
githubToken: string;
|
|
@@ -184,7 +190,7 @@ export type PlatformTokenResult =
|
|
|
184
190
|
dataMode?: PlatformDataMode;
|
|
185
191
|
traceContent?: true;
|
|
186
192
|
config?: PlatformConfig;
|
|
187
|
-
|
|
193
|
+
limits?: PlatformLimits;
|
|
188
194
|
command?: PlatformCommandAnswer;
|
|
189
195
|
}
|
|
190
196
|
// `message` names the HTTP status and the API's own `message` when there was
|
|
@@ -307,9 +313,9 @@ export async function exchangePlatformToken(
|
|
|
307
313
|
headers: {
|
|
308
314
|
Authorization: `Bearer ${oidc}`,
|
|
309
315
|
"X-Crysk-Dispatch-Id": dispatchId,
|
|
310
|
-
// Only the first connect step asks: its
|
|
311
|
-
// gate reads,
|
|
312
|
-
//
|
|
316
|
+
// Only the first connect step asks: its limits are the ones the run
|
|
317
|
+
// step's gate reads, and only that step reads the config a profile
|
|
318
|
+
// arrives in.
|
|
313
319
|
...(deps.ignoreConfig === true
|
|
314
320
|
? {}
|
|
315
321
|
: { "X-Crysk-Capabilities": PLATFORM_CAPABILITIES }),
|
|
@@ -330,7 +336,7 @@ export async function exchangePlatformToken(
|
|
|
330
336
|
data_mode?: unknown;
|
|
331
337
|
trace_content?: unknown;
|
|
332
338
|
config?: unknown;
|
|
333
|
-
|
|
339
|
+
limits?: unknown;
|
|
334
340
|
command?: unknown;
|
|
335
341
|
};
|
|
336
342
|
const {
|
|
@@ -365,13 +371,11 @@ export async function exchangePlatformToken(
|
|
|
365
371
|
[...secrets, githubToken, runToken],
|
|
366
372
|
);
|
|
367
373
|
}
|
|
368
|
-
//
|
|
369
|
-
//
|
|
374
|
+
// Limits are advice: ones that do not parse are dropped and the review
|
|
375
|
+
// runs, never a failed exchange.
|
|
370
376
|
const command = parsePlatformCommand(body.command);
|
|
371
|
-
const
|
|
372
|
-
deps.ignoreConfig === true
|
|
373
|
-
? undefined
|
|
374
|
-
: parsePlatformEstimate(body.estimate);
|
|
377
|
+
const limits =
|
|
378
|
+
deps.ignoreConfig === true ? undefined : parsePlatformLimits(body.limits);
|
|
375
379
|
return {
|
|
376
380
|
ok: true,
|
|
377
381
|
githubToken,
|
|
@@ -387,7 +391,7 @@ export async function exchangePlatformToken(
|
|
|
387
391
|
// an absent or malformed value sends metadata only.
|
|
388
392
|
...(body.trace_content === true ? { traceContent: true as const } : {}),
|
|
389
393
|
...(config.config === undefined ? {} : { config: config.config }),
|
|
390
|
-
...(
|
|
394
|
+
...(limits === undefined ? {} : { limits }),
|
|
391
395
|
...(command === undefined ? {} : { command }),
|
|
392
396
|
};
|
|
393
397
|
} catch (error) {
|
|
@@ -504,12 +508,10 @@ export async function runPlatformConnect(
|
|
|
504
508
|
}
|
|
505
509
|
}
|
|
506
510
|
}
|
|
507
|
-
// Not a secret:
|
|
508
|
-
//
|
|
509
|
-
if (result.
|
|
510
|
-
deps.appendOutput(
|
|
511
|
-
`estimate=${serializePlatformEstimate(result.estimate)}\n`,
|
|
512
|
-
);
|
|
511
|
+
// Not a secret: validated numbers (the limits, and the estimate split per
|
|
512
|
+
// role). The run step's limits gate reads it as CRYSK_PLATFORM_LIMITS.
|
|
513
|
+
if (result.limits !== undefined) {
|
|
514
|
+
deps.appendOutput(`limits=${serializePlatformLimits(result.limits)}\n`);
|
|
513
515
|
}
|
|
514
516
|
// Present only when there is configuration to apply: the setup step and the
|
|
515
517
|
// run step are gated on it, so a standalone run (no platform step, no
|
package/src/ci/reporter.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// for the emoji mapping, blob-link builder, compact duration format, and
|
|
22
22
|
// the re-review delta's data shape — the same severity glyph and blob URL a
|
|
23
23
|
// reader sees on the PR comment must be the one this job summary shows.
|
|
24
|
-
// `deltaLine`/`
|
|
24
|
+
// `deltaLine`/`code`/`severityRank` stay PRIVATE in report.ts, so this
|
|
25
25
|
// module writes small local equivalents rather than exporting report.ts
|
|
26
26
|
// internals for a single extra caller.
|
|
27
27
|
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from "#review/report";
|
|
45
45
|
import { log } from "#ui/primitives";
|
|
46
46
|
import { publishedText } from "../security/published-text";
|
|
47
|
+
import type { PlatformLimitHit } from "./platform-limits";
|
|
47
48
|
|
|
48
49
|
// ---------------------------------------------------------------------------
|
|
49
50
|
// Workflow commands (`::group::`, `::endgroup::`, `::notice::`, `::warning::`,
|
|
@@ -134,7 +135,6 @@ interface CiReviewSummary {
|
|
|
134
135
|
prNumber: number;
|
|
135
136
|
headSha: string;
|
|
136
137
|
findings: readonly Finding[];
|
|
137
|
-
costUsdEst: number;
|
|
138
138
|
wallMs: number;
|
|
139
139
|
model: string;
|
|
140
140
|
// Cosmetic and optional, same contract as renderPrComment's repoWebUrl
|
|
@@ -158,10 +158,12 @@ interface CiSkipSizeSummary {
|
|
|
158
158
|
interface CiSkipBudgetSummary {
|
|
159
159
|
kind: "skipped-budget";
|
|
160
160
|
prNumber: number;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
// Which platform limit was hit. The limits live in the Crysk dashboard
|
|
162
|
+
// (Review > Limits); the summary names the limit, never a dollar figure.
|
|
163
|
+
limit: PlatformLimitHit;
|
|
164
|
+
// The estimate compared was the API share of a mixed setup, not the whole
|
|
165
|
+
// estimate (S17).
|
|
166
|
+
apiShare?: true;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
interface CiSkipExcludedSummary {
|
|
@@ -309,10 +311,6 @@ function formatDeltaLine(delta: PrCommentDelta): string {
|
|
|
309
311
|
return `${since}: ${delta.resolved} resolved · ${delta.new} new · ${delta.persist} persist`;
|
|
310
312
|
}
|
|
311
313
|
|
|
312
|
-
function usd(amount: number): string {
|
|
313
|
-
return `$${amount.toFixed(2)}`;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
314
|
// A size limit <= 0 means that knob is off (review/size-gate.ts). Printed as
|
|
317
315
|
// a number it reads "limit 0", a limit every diff exceeds, and a subscription
|
|
318
316
|
// route now turns a knob off by default (resolveCiSizeLimits), so the other
|
|
@@ -340,20 +338,28 @@ function skipSizeLines(data: CiSkipSizeSummary): string[] {
|
|
|
340
338
|
];
|
|
341
339
|
}
|
|
342
340
|
|
|
341
|
+
const SKIP_BUDGET_REASON: Record<PlatformLimitHit, string> = {
|
|
342
|
+
"month-used-up": "the organization's monthly review limit is used up.",
|
|
343
|
+
"review-limit": "the estimated cost is over the per-review limit.",
|
|
344
|
+
"month-left":
|
|
345
|
+
"the estimated cost is more than what is left of the monthly limit.",
|
|
346
|
+
};
|
|
347
|
+
|
|
343
348
|
function skipBudgetLines(data: CiSkipBudgetSummary): string[] {
|
|
344
349
|
return [
|
|
345
350
|
`### ⚠️ Crysk Review Skipped — PR #${data.prNumber}`,
|
|
346
351
|
"",
|
|
347
|
-
|
|
352
|
+
`**Reason:** ${SKIP_BUDGET_REASON[data.limit]}`,
|
|
353
|
+
...(data.apiShare === true
|
|
354
|
+
? [
|
|
355
|
+
"",
|
|
356
|
+
"Only the part of the estimate that runs on an API key (its API " +
|
|
357
|
+
"share) was compared with the limit.",
|
|
358
|
+
]
|
|
359
|
+
: []),
|
|
348
360
|
"",
|
|
349
|
-
"
|
|
350
|
-
|
|
351
|
-
`| Estimated cost | ${usd(data.estimatedCostUsd)} (budget ${usd(data.budgetUsd)}) |`,
|
|
352
|
-
"",
|
|
353
|
-
data.platformConnected === true
|
|
354
|
-
? "To change what reviews cost, change the model setup in the Crysk dashboard."
|
|
355
|
-
: "Crysk did not run to stay within the configured `--budget-usd` " +
|
|
356
|
-
"ceiling.",
|
|
361
|
+
"Crysk did not run to stay within the limits set in the Crysk dashboard " +
|
|
362
|
+
"(Review > Limits).",
|
|
357
363
|
];
|
|
358
364
|
}
|
|
359
365
|
|
|
@@ -466,7 +472,6 @@ function reviewedLines(data: CiReviewSummary): string[] {
|
|
|
466
472
|
"| --- | --- |",
|
|
467
473
|
`| Findings | ${data.findings.length} (${blocking.length} blocking · ` +
|
|
468
474
|
`${advisory.length} advisory) |`,
|
|
469
|
-
`| Estimated cost | ${usd(data.costUsdEst)} |`,
|
|
470
475
|
`| Duration | ${formatElapsed(data.wallMs)} |`,
|
|
471
476
|
`| Model | ${data.model} |`,
|
|
472
477
|
"",
|
|
@@ -525,10 +530,6 @@ export interface CiOutputs {
|
|
|
525
530
|
findings_count: number;
|
|
526
531
|
blocking_count: number;
|
|
527
532
|
advisory_count: number;
|
|
528
|
-
// Spec 1.1: "cost-usd-est: ... (float string, e.g. `"2.45"`)" — formatted
|
|
529
|
-
// to 2 decimals here so every consumer of $GITHUB_OUTPUT reads the same
|
|
530
|
-
// fixed-precision string the action.yml output contract promises.
|
|
531
|
-
cost_usd_est: number;
|
|
532
533
|
run_dir: string;
|
|
533
534
|
}
|
|
534
535
|
|
|
@@ -541,7 +542,6 @@ export function formatCiOutputs(outputs: CiOutputs): string {
|
|
|
541
542
|
`findings_count=${outputs.findings_count}`,
|
|
542
543
|
`blocking_count=${outputs.blocking_count}`,
|
|
543
544
|
`advisory_count=${outputs.advisory_count}`,
|
|
544
|
-
`cost_usd_est=${outputs.cost_usd_est.toFixed(2)}`,
|
|
545
545
|
`run_dir=${outputs.run_dir}`,
|
|
546
546
|
];
|
|
547
547
|
return `${lines.join("\n")}\n`;
|
|
@@ -633,7 +633,6 @@ export async function reportFatalCiError(
|
|
|
633
633
|
findings_count: 0,
|
|
634
634
|
blocking_count: 0,
|
|
635
635
|
advisory_count: 0,
|
|
636
|
-
cost_usd_est: 0,
|
|
637
636
|
run_dir: "",
|
|
638
637
|
}).catch(() => {});
|
|
639
638
|
}
|
|
@@ -17,7 +17,6 @@ import type { LocalConfig } from "#review/preflight";
|
|
|
17
17
|
import {
|
|
18
18
|
findMarker,
|
|
19
19
|
isCommand,
|
|
20
|
-
legacyCommand,
|
|
21
20
|
MARKER_BRAND_PATTERN,
|
|
22
21
|
MARKER_OPEN,
|
|
23
22
|
matchMarkerPrefix,
|
|
@@ -801,7 +800,7 @@ export function ciReviewSkipDetail(
|
|
|
801
800
|
case "stopped":
|
|
802
801
|
// A status description has little room, so it names the one spelling
|
|
803
802
|
// every workflow accepts during the rename.
|
|
804
|
-
return `a maintainer stopped automatic reviews; ${
|
|
803
|
+
return `a maintainer stopped automatic reviews; ${REVIEW_COMMAND} reviews this head`;
|
|
805
804
|
}
|
|
806
805
|
}
|
|
807
806
|
|
package/src/ci/review-levels.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The choices `setup --ci` asks for, as data: the re-review level presets, the
|
|
2
|
-
// gate mode,
|
|
2
|
+
// gate mode, and the advanced keys. Pure, so every choice
|
|
3
3
|
// and every line of the summary is testable offline; the prompts live in the
|
|
4
4
|
// command shell (src/commands/ci-setup.ts).
|
|
5
5
|
//
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type { PostMinSeverity } from "#pr/post-floor";
|
|
12
12
|
import { DEFAULT_SIZE_GATE } from "#review/size-gate";
|
|
13
|
-
import { CI_DEFAULT_METERED_BUDGET_USD } from "./gates";
|
|
14
13
|
import {
|
|
15
14
|
DEFAULT_CI_ADVISORY_WEIGHT,
|
|
16
15
|
DEFAULT_CI_BLOCKING_WEIGHT,
|
|
@@ -91,8 +90,6 @@ export function isReviewLevel(value: string): value is ReviewLevel {
|
|
|
91
90
|
return (REVIEW_LEVEL_ORDER as readonly string[]).includes(value);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
export type Billing = "subscription" | "api";
|
|
95
|
-
|
|
96
93
|
export interface AdvancedChoices {
|
|
97
94
|
ci_blocking_weight?: number;
|
|
98
95
|
ci_advisory_weight?: number;
|
|
@@ -106,14 +103,9 @@ export interface AdvancedChoices {
|
|
|
106
103
|
export interface CiSetupChoices {
|
|
107
104
|
level: ReviewLevel;
|
|
108
105
|
mode: "gate" | "advisory";
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
// Only with billing "api"; undefined there means the $10 default.
|
|
113
|
-
budgetUsd?: number;
|
|
114
|
-
// Always written. Unlike the budget, a size threshold matters on any route:
|
|
115
|
-
// left unset, a subscription route resolves to NO limit, so a huge PR would
|
|
116
|
-
// run a review nobody asked for. 0 is the explicit, chosen "no limit".
|
|
106
|
+
// Always written: a size threshold matters on any route. Left unset, a
|
|
107
|
+
// subscription route resolves to NO limit, so a huge PR would run a review
|
|
108
|
+
// nobody asked for. 0 is the explicit, chosen "no limit".
|
|
117
109
|
maxChangedLines: number;
|
|
118
110
|
advanced: AdvancedChoices;
|
|
119
111
|
// True when no human or agent chose: the summary must say so.
|
|
@@ -121,13 +113,12 @@ export interface CiSetupChoices {
|
|
|
121
113
|
// Which groups someone chose this run. A chosen group overrides the file; an
|
|
122
114
|
// unchosen one only fills a group the file does not have yet, so re-running
|
|
123
115
|
// setup (say `--force` to refresh an old workflow) never resets tuned keys.
|
|
124
|
-
// `mode`
|
|
125
|
-
//
|
|
116
|
+
// `mode` guards the workflow the same way: on a --force refresh an unchosen
|
|
117
|
+
// one keeps what the old workflow said.
|
|
126
118
|
chosen: {
|
|
127
119
|
level: boolean;
|
|
128
120
|
maxChangedLines: boolean;
|
|
129
121
|
mode: boolean;
|
|
130
|
-
billing: boolean;
|
|
131
122
|
};
|
|
132
123
|
}
|
|
133
124
|
|
|
@@ -137,7 +128,6 @@ export interface CurrentSettings {
|
|
|
137
128
|
config: Record<string, unknown>;
|
|
138
129
|
workflow: {
|
|
139
130
|
mode?: "gate" | "advisory";
|
|
140
|
-
budgetUsd?: string;
|
|
141
131
|
maxChangedLines?: string;
|
|
142
132
|
maxChangedFiles?: string;
|
|
143
133
|
};
|
|
@@ -168,13 +158,14 @@ export function presetMatching(
|
|
|
168
158
|
return "custom";
|
|
169
159
|
}
|
|
170
160
|
|
|
171
|
-
// The
|
|
161
|
+
// The inputs setup writes into the workflow, read back from an existing one.
|
|
172
162
|
export function parseWorkflowChoices(
|
|
173
163
|
text: string,
|
|
174
164
|
): CurrentSettings["workflow"] {
|
|
175
165
|
// One input per line, quoted or not, with an optional trailing comment. A
|
|
176
|
-
// number must be a whole number
|
|
177
|
-
//
|
|
166
|
+
// number must be a whole number: a value like `1.2` reads as absent rather
|
|
167
|
+
// than becoming NaN in the new file. Inputs setup no longer writes (the
|
|
168
|
+
// retired `budget-usd`) are not read, so a re-run drops them.
|
|
178
169
|
const input = (name: string, value: string): string | undefined =>
|
|
179
170
|
new RegExp(`^\\s+${name}:\\s*["']?(${value})["']?\\s*(?:#.*)?$`, "m").exec(
|
|
180
171
|
text,
|
|
@@ -183,12 +174,10 @@ export function parseWorkflowChoices(
|
|
|
183
174
|
| "gate"
|
|
184
175
|
| "advisory"
|
|
185
176
|
| undefined;
|
|
186
|
-
const budgetUsd = input("budget-usd", "-?\\d+(?:\\.\\d+)?");
|
|
187
177
|
const maxChangedLines = input("max-changed-lines", "\\d+");
|
|
188
178
|
const maxChangedFiles = input("max-changed-files", "\\d+");
|
|
189
179
|
return {
|
|
190
180
|
...(mode === undefined ? {} : { mode }),
|
|
191
|
-
...(budgetUsd === undefined ? {} : { budgetUsd }),
|
|
192
181
|
...(maxChangedLines === undefined ? {} : { maxChangedLines }),
|
|
193
182
|
...(maxChangedFiles === undefined ? {} : { maxChangedFiles }),
|
|
194
183
|
};
|
|
@@ -204,30 +193,10 @@ export function defaultChoices(): CiSetupChoices {
|
|
|
204
193
|
maxChangedLines: DEFAULT_MAX_CHANGED_LINES,
|
|
205
194
|
advanced: {},
|
|
206
195
|
defaulted: true,
|
|
207
|
-
chosen: {
|
|
208
|
-
level: false,
|
|
209
|
-
maxChangedLines: false,
|
|
210
|
-
mode: false,
|
|
211
|
-
billing: false,
|
|
212
|
-
},
|
|
196
|
+
chosen: { level: false, maxChangedLines: false, mode: false },
|
|
213
197
|
};
|
|
214
198
|
}
|
|
215
199
|
|
|
216
|
-
// The `budget-usd` workflow input for these choices, or undefined to write none.
|
|
217
|
-
// A subscription writes none. CI bills as metered only when the run's chosen
|
|
218
|
-
// Claude credential is the API key (S5: the first of `credentials.claude` that is
|
|
219
|
-
// present, default subscription then api_key; gates.ts, CiBillingMode), so a
|
|
220
|
-
// subscription run already gets no ceiling. An explicit 0 would print the
|
|
221
|
-
// disabled-ceiling warning on every run and, worse, stay an operator override if
|
|
222
|
-
// the run later moves to an API key, defeating the $10 fail-safe a metered run
|
|
223
|
-
// brings back.
|
|
224
|
-
export function budgetInput(choices: CiSetupChoices): string | undefined {
|
|
225
|
-
if (choices.billing === "api") {
|
|
226
|
-
return String(choices.budgetUsd ?? CI_DEFAULT_METERED_BUDGET_USD);
|
|
227
|
-
}
|
|
228
|
-
return undefined;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
200
|
// How the choices land in .crysk/config.json. `set` overrides; each group in
|
|
232
201
|
// `fillIfAbsent` is written only when the file has none of its keys, and kept
|
|
233
202
|
// whole otherwise, so a tuned policy is never half-replaced by a preset.
|
|
@@ -284,10 +253,9 @@ export function renderChoicesSummary(
|
|
|
284
253
|
...(effective as AdvancedChoices),
|
|
285
254
|
...choices.advanced,
|
|
286
255
|
};
|
|
287
|
-
const budget = budgetInput(choices);
|
|
288
256
|
const lines = [
|
|
289
257
|
choices.defaulted
|
|
290
|
-
? "Review settings (defaults: nobody chose them; pass --level
|
|
258
|
+
? "Review settings (defaults: nobody chose them; pass --level and --ci-mode, or run setup --ci in a terminal, to choose):"
|
|
291
259
|
: "Review settings:",
|
|
292
260
|
...(levelKept.length > 0
|
|
293
261
|
? [
|
|
@@ -299,15 +267,6 @@ export function renderChoicesSummary(
|
|
|
299
267
|
` verification up to ${c.max_verification_steps} prior findings checked per re-review`,
|
|
300
268
|
]),
|
|
301
269
|
` gate ${choices.mode === "gate" ? "gate: blocking findings turn the crysk check red" : "advisory: the crysk check stays green"}`,
|
|
302
|
-
` budget ${
|
|
303
|
-
budget === undefined
|
|
304
|
-
? choices.billing === "subscription"
|
|
305
|
-
? "not set: no ceiling while the review runs on CRYSK_CLAUDE_OAUTH_TOKEN and no OpenCode model (a subscription spends quota, not dollars); CRYSK_CLAUDE_API_KEY chosen in its place, or an OpenCode model with its CRYSK_OPENCODE_* secret, brings back the $10 ceiling"
|
|
306
|
-
: "not set: resolved from how the review is paid (no ceiling on a subscription, $10 on an API key)"
|
|
307
|
-
: Number(budget) <= 0
|
|
308
|
-
? `none (budget-usd: ${budget}; 0 or less disables the ceiling)`
|
|
309
|
-
: `$${budget} per review (budget-usd)`
|
|
310
|
-
}`,
|
|
311
270
|
` score weights blocking ${a.ci_blocking_weight ?? DEFAULT_CI_BLOCKING_WEIGHT}, advisory ${a.ci_advisory_weight ?? DEFAULT_CI_ADVISORY_WEIGHT}`,
|
|
312
271
|
` observe only ${a.ci_admission_observe_only === true ? "yes: skip decisions are logged, every push is reviewed" : "no"}`,
|
|
313
272
|
` trusted actors ${a.ci_trusted_actors && a.ci_trusted_actors.length > 0 ? a.ci_trusted_actors.join(", ") : "none beyond the workflow actor"}`,
|