crysk 0.6.0 → 0.7.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 +16 -1
- package/dist/SKILL-32cmme3j.md +143 -0
- package/dist/SKILL-nncgwkx7.md +553 -0
- package/dist/adjudicator-eckqh14e.md +78 -0
- package/dist/ci-admission-qn797a6c.md +128 -0
- package/dist/cli.js +6471 -5572
- 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/dist/deep-review-parity-h7y6y2he.md +118 -0
- 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 +1056 -480
- package/dist/opencode-ci-jc8mf4wn.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-ag62s87j.yml +163 -0
- package/package.json +1 -1
- package/prompts/consolidate.md +1 -1
- package/prompts/default/PROVENANCE.md +5 -0
- package/prompts/default/deep-review-logic.md +56 -15
- package/prompts/default/deep-review-parity.md +71 -39
- 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-ci-setup/SKILL.md +3 -3
- package/skills/crysk-ci-setup/references/ci-admission.md +1 -1
- package/skills/crysk-ci-setup/references/opencode-ci.md +1 -1
- package/skills/crysk-loop/SKILL.md +2 -2
- package/skills/crysk-loop/adjudicator.md +10 -18
- package/src/asset-manifest.ts +6 -0
- package/src/assets.ts +37 -11
- package/src/ci/gates.ts +13 -26
- package/src/ci/platform.ts +50 -0
- package/src/ci/review-levels.ts +4 -4
- package/src/ci/trigger.ts +64 -4
- package/src/commands/ci-setup-questions.ts +1 -1
- package/src/commands/status.ts +2 -0
- package/src/compare/hunter-exam.ts +631 -0
- package/src/index.ts +1 -1
- package/src/model/model-name.ts +2 -1
- package/src/model/profiles.ts +1 -1
- 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/pr-status.ts +18 -3
- package/src/pr/pr.ts +1 -1
- package/src/pr/preflight.ts +29 -3
- package/src/pr/publish-outcome.ts +14 -13
- package/src/pr/review-pr.ts +22 -2
- package/src/rereview/prepare.ts +13 -2
- package/src/rereview/verify.ts +15 -9
- package/src/review/boundary.ts +1 -0
- package/src/review/exit-code.ts +60 -0
- package/src/review/findings.ts +3 -3
- package/src/review/pipeline.ts +139 -14
- package/src/review/preflight.ts +25 -4
- package/src/review/prompt-set.ts +7 -1
- package/src/review/review.ts +20 -11
- package/src/review/route-preflight.ts +16 -0
- package/src/triage/adjudication.ts +35 -2
- package/src/ui/result.ts +1 -1
- package/src/updater.ts +1 -1
- package/src/watch/preflight.ts +34 -8
- package/src/watch/watch.ts +8 -4
package/src/ci/platform.ts
CHANGED
|
@@ -133,6 +133,39 @@ export function parsePlatformConfig(
|
|
|
133
133
|
// says. `full` is the only value that lets the report step send finding text.
|
|
134
134
|
export type PlatformDataMode = "full" | "metadata_only";
|
|
135
135
|
|
|
136
|
+
// The PR comment command the platform dispatched this run for (odd/tasks/platform-commands.md
|
|
137
|
+
// in the platform repo, S2-S4). A platform-managed repository has no issue_comment trigger, so the
|
|
138
|
+
// platform checks the comment and its author, and names the command here; the trigger reads it
|
|
139
|
+
// from this step's outputs. Absent for an ordinary review, and for a name this engine does not know.
|
|
140
|
+
// An override keeps its name when the actor or head is unusable, so the trigger refuses it instead
|
|
141
|
+
// of running a review nobody asked for.
|
|
142
|
+
export type PlatformCommandAnswer =
|
|
143
|
+
| { name: "recheck" }
|
|
144
|
+
| { name: "override"; actor?: string; headSha?: string };
|
|
145
|
+
|
|
146
|
+
const SAFE_SHA = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
|
|
147
|
+
// The override's actor is a commenter, who may be an Enterprise Managed User (`handle_shortcode`):
|
|
148
|
+
// the trigger's own GITHUB_LOGIN grammar (src/ci/trigger.ts), not SAFE_LOGIN, which is the App's.
|
|
149
|
+
const COMMAND_ACTOR = /^(?=.{1,91}$)[A-Za-z0-9][A-Za-z0-9_-]{0,90}(\[bot\])?$/;
|
|
150
|
+
|
|
151
|
+
function parsePlatformCommand(
|
|
152
|
+
value: unknown,
|
|
153
|
+
): PlatformCommandAnswer | undefined {
|
|
154
|
+
if (typeof value !== "object" || value === null) return undefined;
|
|
155
|
+
const { name, actor, head_sha: headSha } = value as Record<string, unknown>;
|
|
156
|
+
if (name === "recheck") return { name };
|
|
157
|
+
if (name !== "override") return undefined;
|
|
158
|
+
return {
|
|
159
|
+
name,
|
|
160
|
+
...(typeof actor === "string" && COMMAND_ACTOR.test(actor)
|
|
161
|
+
? { actor }
|
|
162
|
+
: {}),
|
|
163
|
+
...(typeof headSha === "string" && SAFE_SHA.test(headSha)
|
|
164
|
+
? { headSha }
|
|
165
|
+
: {}),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
136
169
|
export type PlatformTokenResult =
|
|
137
170
|
// `githubActor` is the login the platform says posts as the App's bot. It is
|
|
138
171
|
// absent when the platform sent none or one that is not a plausible login.
|
|
@@ -152,6 +185,7 @@ export type PlatformTokenResult =
|
|
|
152
185
|
traceContent?: true;
|
|
153
186
|
config?: PlatformConfig;
|
|
154
187
|
estimate?: PlatformEstimate;
|
|
188
|
+
command?: PlatformCommandAnswer;
|
|
155
189
|
}
|
|
156
190
|
// `message` names the HTTP status and the API's own `message` when there was
|
|
157
191
|
// one. It never carries a token.
|
|
@@ -297,6 +331,7 @@ export async function exchangePlatformToken(
|
|
|
297
331
|
trace_content?: unknown;
|
|
298
332
|
config?: unknown;
|
|
299
333
|
estimate?: unknown;
|
|
334
|
+
command?: unknown;
|
|
300
335
|
};
|
|
301
336
|
const {
|
|
302
337
|
github_token: githubToken,
|
|
@@ -332,6 +367,7 @@ export async function exchangePlatformToken(
|
|
|
332
367
|
}
|
|
333
368
|
// An estimate is advice: one that does not parse is dropped and the
|
|
334
369
|
// engine's own band decides, never a failed exchange.
|
|
370
|
+
const command = parsePlatformCommand(body.command);
|
|
335
371
|
const estimate =
|
|
336
372
|
deps.ignoreConfig === true
|
|
337
373
|
? undefined
|
|
@@ -352,6 +388,7 @@ export async function exchangePlatformToken(
|
|
|
352
388
|
...(body.trace_content === true ? { traceContent: true as const } : {}),
|
|
353
389
|
...(config.config === undefined ? {} : { config: config.config }),
|
|
354
390
|
...(estimate === undefined ? {} : { estimate }),
|
|
391
|
+
...(command === undefined ? {} : { command }),
|
|
355
392
|
};
|
|
356
393
|
} catch (error) {
|
|
357
394
|
const detail = error instanceof Error ? error.message : String(error);
|
|
@@ -454,6 +491,19 @@ export async function runPlatformConnect(
|
|
|
454
491
|
if (result.githubActor !== undefined) {
|
|
455
492
|
deps.appendOutput(`github-actor=${result.githubActor}\n`);
|
|
456
493
|
}
|
|
494
|
+
// Not a secret: a known command name, a validated login and a validated sha. The trigger
|
|
495
|
+
// reads them as PLATFORM_COMMAND* (action.yml), from the first connect step only.
|
|
496
|
+
if (result.command !== undefined) {
|
|
497
|
+
deps.appendOutput(`command=${result.command.name}\n`);
|
|
498
|
+
if (result.command.name === "override") {
|
|
499
|
+
if (result.command.actor !== undefined) {
|
|
500
|
+
deps.appendOutput(`command-actor=${result.command.actor}\n`);
|
|
501
|
+
}
|
|
502
|
+
if (result.command.headSha !== undefined) {
|
|
503
|
+
deps.appendOutput(`command-head=${result.command.headSha}\n`);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
457
507
|
// Not a secret: two validated numbers and a basis. The run step's budget
|
|
458
508
|
// gate reads it as CRYSK_PLATFORM_ESTIMATE in place of the engine's band.
|
|
459
509
|
if (result.estimate !== undefined) {
|
package/src/ci/review-levels.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface CiSetupChoices {
|
|
|
109
109
|
// Undefined: nobody said how the review is paid, so no ceiling is written
|
|
110
110
|
// and the action resolves it from the route's billing mode.
|
|
111
111
|
billing?: Billing;
|
|
112
|
-
// Only with billing "api"; undefined there means the
|
|
112
|
+
// Only with billing "api"; undefined there means the metered default.
|
|
113
113
|
budgetUsd?: number;
|
|
114
114
|
// Always written. Unlike the budget, a size threshold matters on any route:
|
|
115
115
|
// left unset, a subscription route resolves to NO limit, so a huge PR would
|
|
@@ -219,7 +219,7 @@ export function defaultChoices(): CiSetupChoices {
|
|
|
219
219
|
// present, default subscription then api_key; gates.ts, CiBillingMode), so a
|
|
220
220
|
// subscription run already gets no ceiling. An explicit 0 would print the
|
|
221
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
|
|
222
|
+
// the run later moves to an API key, defeating the default ceiling a metered run
|
|
223
223
|
// brings back.
|
|
224
224
|
export function budgetInput(choices: CiSetupChoices): string | undefined {
|
|
225
225
|
if (choices.billing === "api") {
|
|
@@ -302,8 +302,8 @@ export function renderChoicesSummary(
|
|
|
302
302
|
` budget ${
|
|
303
303
|
budget === undefined
|
|
304
304
|
? choices.billing === "subscription"
|
|
305
|
-
?
|
|
306
|
-
:
|
|
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 $${CI_DEFAULT_METERED_BUDGET_USD} ceiling`
|
|
306
|
+
: `not set: resolved from how the review is paid (no ceiling on a subscription, $${CI_DEFAULT_METERED_BUDGET_USD} on an API key)`
|
|
307
307
|
: Number(budget) <= 0
|
|
308
308
|
? `none (budget-usd: ${budget}; 0 or less disables the ceiling)`
|
|
309
309
|
: `$${budget} per review (budget-usd)`
|
package/src/ci/trigger.ts
CHANGED
|
@@ -206,8 +206,20 @@ export interface CiTriggerInput {
|
|
|
206
206
|
// EVENT_COMMENT_ID when it is all digits: the comment that triggered the run,
|
|
207
207
|
// which the reaction names. Absent for any other event, or any other value.
|
|
208
208
|
commentId?: string;
|
|
209
|
+
// The command a Crysk platform dispatched (odd/tasks/platform-commands.md in the platform
|
|
210
|
+
// repo, S2-S4). A platform-managed repository has no issue_comment trigger, so the platform
|
|
211
|
+
// checks the comment and its author's permission and names the command in its token exchange
|
|
212
|
+
// (src/ci/platform.ts). Read only on a workflow_dispatch, and only from the Connect step's
|
|
213
|
+
// outputs, never from a dispatch input, which anyone with write access can set by hand.
|
|
214
|
+
platformCommand?: PlatformCommand;
|
|
209
215
|
}
|
|
210
216
|
|
|
217
|
+
export type PlatformCommand =
|
|
218
|
+
| { kind: "recheck" }
|
|
219
|
+
| { kind: "override"; actor: string; headSha: string }
|
|
220
|
+
// An override the platform named without a usable actor or head: refused, never recorded.
|
|
221
|
+
| { kind: "malformed-override" };
|
|
222
|
+
|
|
211
223
|
export type CiTriggerDecision =
|
|
212
224
|
| { kind: "review"; force: boolean; full: boolean; adjudicate: boolean }
|
|
213
225
|
// A human's override: no CLI run, $0. `actor` is the login that unlocked the gate.
|
|
@@ -434,6 +446,21 @@ export function decideCiTrigger(input: CiTriggerInput): CiTriggerDecision {
|
|
|
434
446
|
const event = classifyEvent(input);
|
|
435
447
|
if (event.kind === "ignore") return event;
|
|
436
448
|
|
|
449
|
+
// WHY no permission lookup: the platform looked up the commenter's permission before it
|
|
450
|
+
// dispatched, and the dispatch carries no comment to look one up for.
|
|
451
|
+
const platform = event.kind === "event" ? input.platformCommand : undefined;
|
|
452
|
+
if (platform?.kind === "malformed-override") {
|
|
453
|
+
return {
|
|
454
|
+
kind: "denied",
|
|
455
|
+
reason:
|
|
456
|
+
"The Crysk platform asked for an override without a valid login or head, so " +
|
|
457
|
+
"nothing was recorded.",
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
if (platform?.kind === "override") {
|
|
461
|
+
return overrideDecision({ ...input, commenterLogin: platform.actor });
|
|
462
|
+
}
|
|
463
|
+
|
|
437
464
|
if (event.kind === "comment") {
|
|
438
465
|
const verdict = commenterVerdict(input, event.command);
|
|
439
466
|
if (verdict !== undefined) return verdict;
|
|
@@ -475,12 +502,13 @@ export function decideCiTrigger(input: CiTriggerInput): CiTriggerDecision {
|
|
|
475
502
|
event.command.kind === "review" &&
|
|
476
503
|
event.command.full;
|
|
477
504
|
const commentAdjudicate =
|
|
478
|
-
event.kind === "comment" &&
|
|
479
|
-
|
|
480
|
-
|
|
505
|
+
(event.kind === "comment" &&
|
|
506
|
+
event.command.kind === "review" &&
|
|
507
|
+
event.command.adjudicate) ||
|
|
508
|
+
platform?.kind === "recheck";
|
|
481
509
|
return {
|
|
482
510
|
kind: "review",
|
|
483
|
-
force: input.forceInput || fromComment,
|
|
511
|
+
force: input.forceInput || fromComment || platform?.kind === "recheck",
|
|
484
512
|
full: input.fullInput || commentFull,
|
|
485
513
|
adjudicate: commentAdjudicate,
|
|
486
514
|
};
|
|
@@ -952,9 +980,27 @@ function readTriggerInput(
|
|
|
952
980
|
fullInput: flag("FULL_INPUT"),
|
|
953
981
|
...(runAttempt === undefined ? {} : { runAttempt }),
|
|
954
982
|
...(commentId === undefined ? {} : { commentId }),
|
|
983
|
+
...platformCommandOf(text),
|
|
955
984
|
};
|
|
956
985
|
}
|
|
957
986
|
|
|
987
|
+
// PLATFORM_COMMAND* are bound in action.yml only from the Connect step's outputs, and that step
|
|
988
|
+
// runs only on a workflow_dispatch with a dispatch id. An unknown command is no command.
|
|
989
|
+
function platformCommandOf(text: (name: string) => string): {
|
|
990
|
+
platformCommand?: PlatformCommand;
|
|
991
|
+
} {
|
|
992
|
+
if (text("EVENT_NAME") !== "workflow_dispatch") return {};
|
|
993
|
+
const command = text("PLATFORM_COMMAND");
|
|
994
|
+
if (command === "recheck") return { platformCommand: { kind: "recheck" } };
|
|
995
|
+
if (command !== "override") return {};
|
|
996
|
+
const actor = text("PLATFORM_COMMAND_ACTOR");
|
|
997
|
+
const headSha = validSha(text("PLATFORM_COMMAND_HEAD"));
|
|
998
|
+
if (!GITHUB_LOGIN.test(actor) || headSha === undefined) {
|
|
999
|
+
return { platformCommand: { kind: "malformed-override" } };
|
|
1000
|
+
}
|
|
1001
|
+
return { platformCommand: { kind: "override", actor, headSha } };
|
|
1002
|
+
}
|
|
1003
|
+
|
|
958
1004
|
// The reaction a comment earns. Best effort: it runs only on an issue_comment with an
|
|
959
1005
|
// id, and a failure prints one warning. It never changes the decision or the exit code,
|
|
960
1006
|
// because the reaction is a courtesy and the decision is the product.
|
|
@@ -1139,6 +1185,7 @@ const OVERRIDE_UNKNOWN_FORK_REFUSAL = `The override could not confirm whether th
|
|
|
1139
1185
|
// with the adjudicator's reason. The unknown answer gets its own text, as the override does.
|
|
1140
1186
|
const RECHECK_FORK_REFUSAL =
|
|
1141
1187
|
"A recheck cannot run on a fork pull request: the adjudicator needs this repository's checkout of the head";
|
|
1188
|
+
const OVERRIDE_HEAD_MOVED = `Crysk did not override the gate: the pull request has new commits since the override was asked, and an override applies to the head at the time of the comment; comment ${commandHint(OVERRIDE_COMMAND)} again.`;
|
|
1142
1189
|
const RECHECK_UNKNOWN_FORK_REFUSAL = `The recheck could not confirm whether this pull request comes from a fork, so it was refused; comment ${commandHint(RECHECK_COMMAND)} again.`;
|
|
1143
1190
|
|
|
1144
1191
|
// What the override's one lookup says. `crossRepository` is undefined when the
|
|
@@ -1405,6 +1452,19 @@ export function runCiTrigger(deps: CiTriggerDeps): number {
|
|
|
1405
1452
|
react(deps, base, "-1");
|
|
1406
1453
|
return 0;
|
|
1407
1454
|
}
|
|
1455
|
+
// WHY refused when the head moved: an override applies to the head at the time of the
|
|
1456
|
+
// comment. On a comment event the job resolves the head moments later; a platform dispatch
|
|
1457
|
+
// can start minutes later, so it carries the head the platform saw and must still match.
|
|
1458
|
+
const asked =
|
|
1459
|
+
input.platformCommand?.kind === "override"
|
|
1460
|
+
? input.platformCommand.headSha
|
|
1461
|
+
: undefined;
|
|
1462
|
+
if (asked !== undefined && answer.head !== asked) {
|
|
1463
|
+
writeRecord(deps, run, { decision: "denied", params: {} });
|
|
1464
|
+
deps.appendOutput(formatTriggerOutputs(NO_RUN));
|
|
1465
|
+
deps.stdout(workflowCommand("notice", OVERRIDE_HEAD_MOVED));
|
|
1466
|
+
return 0;
|
|
1467
|
+
}
|
|
1408
1468
|
react(deps, base, "eyes");
|
|
1409
1469
|
// WHY the no-head path is kept: a same-repository answer with no usable sha
|
|
1410
1470
|
// still posts, and the publisher's comment says no status could be set.
|
|
@@ -206,7 +206,7 @@ export async function askChoices(
|
|
|
206
206
|
);
|
|
207
207
|
if (choices.billing === "subscription") {
|
|
208
208
|
say(
|
|
209
|
-
|
|
209
|
+
` No spend ceiling, and nothing to write: a subscription review spends quota, not dollars, and CI applies no ceiling while the run uses CRYSK_CLAUDE_OAUTH_TOKEN and no OpenCode model with its CRYSK_OPENCODE_* secret. A run on CRYSK_CLAUDE_API_KEY (no subscription set, or api_key first in credentials.claude) or an OpenCode model with its CRYSK_OPENCODE_* secret brings back the $${CI_DEFAULT_METERED_BUDGET_USD} ceiling.`,
|
|
210
210
|
);
|
|
211
211
|
} else {
|
|
212
212
|
choices.budgetUsd = await askValue(
|
package/src/commands/status.ts
CHANGED
|
@@ -125,6 +125,8 @@ export async function runStatusCommand(input: {
|
|
|
125
125
|
statuses,
|
|
126
126
|
issueComments,
|
|
127
127
|
reviewComments,
|
|
128
|
+
// A developer's machine never learns the platform's login (src/triage/adjudication.ts).
|
|
129
|
+
adjudicatorTrust: { kind: "local" },
|
|
128
130
|
});
|
|
129
131
|
consecutivePollErrors = 0;
|
|
130
132
|
} catch (err) {
|