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/ui/review-menu.ts
CHANGED
|
@@ -14,7 +14,6 @@ export interface ReviewMenuState {
|
|
|
14
14
|
base: string;
|
|
15
15
|
pr?: number | "current";
|
|
16
16
|
post: boolean;
|
|
17
|
-
scout: boolean;
|
|
18
17
|
force: boolean;
|
|
19
18
|
full: boolean;
|
|
20
19
|
dryRun: boolean;
|
|
@@ -48,7 +47,6 @@ export function renderReviewMenuCard(
|
|
|
48
47
|
`Target: ${targetLabel} — Review target mode`,
|
|
49
48
|
`Base: ${state.base} · Head: ${state.head} — Git diff range`,
|
|
50
49
|
`Post to PR: ${state.post ? "[✓] Yes" : "[ ] No"} — Publish comments to GitHub PR`,
|
|
51
|
-
`Scout stage: ${state.scout ? "[✓] Enabled" : "[ ] Disabled"} — Run pre-hunt reconnaissance`,
|
|
52
50
|
`Force review: ${state.force ? "[✓] Yes" : "[ ] No"} — Bypass size gate thresholds`,
|
|
53
51
|
`Full verification: ${state.full ? "[✓] Yes" : "[ ] No"} — Run deep refuter checks`,
|
|
54
52
|
`Dry run: ${state.dryRun ? "[✓] Yes" : "[ ] No"} — Execute without posting or resolving`,
|
|
@@ -97,14 +95,11 @@ export async function runReviewMenu(
|
|
|
97
95
|
width?: number;
|
|
98
96
|
effectiveConfig?: LocalConfig;
|
|
99
97
|
defaultBase?: string;
|
|
100
|
-
defaultScout?: boolean;
|
|
101
98
|
defaultPost?: boolean;
|
|
102
99
|
} = {},
|
|
103
100
|
): Promise<ReviewMenuOutcome> {
|
|
104
101
|
const resolvedBase =
|
|
105
102
|
deps.defaultBase ?? deps.effectiveConfig?.default_base ?? "main";
|
|
106
|
-
const resolvedScout =
|
|
107
|
-
deps.defaultScout ?? deps.effectiveConfig?.scout ?? false;
|
|
108
103
|
const resolvedPost = deps.defaultPost ?? deps.effectiveConfig?.post ?? false;
|
|
109
104
|
const resolvedTarget = resolvedPost ? "pr" : "branch";
|
|
110
105
|
|
|
@@ -113,7 +108,6 @@ export async function runReviewMenu(
|
|
|
113
108
|
head: "HEAD",
|
|
114
109
|
base: resolvedBase,
|
|
115
110
|
post: resolvedPost,
|
|
116
|
-
scout: resolvedScout,
|
|
117
111
|
force: false,
|
|
118
112
|
full: false,
|
|
119
113
|
dryRun: false,
|
|
@@ -167,7 +161,7 @@ export async function runReviewMenu(
|
|
|
167
161
|
});
|
|
168
162
|
|
|
169
163
|
let cursor = 0;
|
|
170
|
-
const fieldCount =
|
|
164
|
+
const fieldCount = 6;
|
|
171
165
|
const actions = REVIEW_CARD_ACTIONS;
|
|
172
166
|
const totalItems = fieldCount + actions.length;
|
|
173
167
|
const ESC = "\x1b";
|
|
@@ -244,7 +238,6 @@ export async function runReviewMenu(
|
|
|
244
238
|
base: state.base,
|
|
245
239
|
pr: state.target === "pr" ? (state.pr ?? "current") : undefined,
|
|
246
240
|
post: state.post,
|
|
247
|
-
scout: state.scout,
|
|
248
241
|
force: state.force,
|
|
249
242
|
full: state.full,
|
|
250
243
|
dryRun: state.dryRun,
|
|
@@ -291,12 +284,10 @@ export async function runReviewMenu(
|
|
|
291
284
|
state.post = !state.post;
|
|
292
285
|
}
|
|
293
286
|
} else if (cursor === 3) {
|
|
294
|
-
state.scout = !state.scout;
|
|
295
|
-
} else if (cursor === 4) {
|
|
296
287
|
state.force = !state.force;
|
|
297
|
-
} else if (cursor ===
|
|
288
|
+
} else if (cursor === 4) {
|
|
298
289
|
state.full = !state.full;
|
|
299
|
-
} else if (cursor ===
|
|
290
|
+
} else if (cursor === 5) {
|
|
300
291
|
state.dryRun = !state.dryRun;
|
|
301
292
|
}
|
|
302
293
|
render(false);
|
package/src/ui/select.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The terminal surface's INTERACTIVE half: the keyboard-driven menu that
|
|
2
|
-
// replaced the
|
|
2
|
+
// replaced the plain `[y/N]` read. ui/primitives.ts stays pure by construction;
|
|
3
3
|
// this module is where the one unavoidable side effect — putting the user's
|
|
4
4
|
// terminal into raw mode — is quarantined behind an injected reader, so every
|
|
5
5
|
// decision above it (which options exist, where the cursor lands, what a key
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
// keeps the old plain-text behaviour byte for byte, and the restore lives in a
|
|
14
14
|
// `finally` so a throw mid-menu cannot strand a human in raw mode.
|
|
15
15
|
|
|
16
|
-
import type { FreeRouteBilling } from "#model/free-discovery";
|
|
17
16
|
import { bold, dim, log } from "./primitives";
|
|
18
17
|
|
|
19
18
|
export type ConfirmResult =
|
|
@@ -82,7 +81,6 @@ interface MenuOption {
|
|
|
82
81
|
// re-presents the menu instead of resolving it.
|
|
83
82
|
action: "review" | "details" | "cancel";
|
|
84
83
|
label: string;
|
|
85
|
-
hint?: string;
|
|
86
84
|
// Lowercase single characters. `y`/`n` are kept on the review/cancel rows on
|
|
87
85
|
// purpose: they are what a decade of `[y/N]` prompts trained into fingers.
|
|
88
86
|
shortcuts: string[];
|
|
@@ -90,11 +88,6 @@ interface MenuOption {
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
export interface ConfirmSpec {
|
|
93
|
-
low: number;
|
|
94
|
-
high: number;
|
|
95
|
-
// Set only for a route the plan card already priced as free or mixed. Absent
|
|
96
|
-
// means today's wording on both the menu hint and the plain prompt.
|
|
97
|
-
billing?: FreeBillingMode;
|
|
98
91
|
// Only true when the run was actually going to post: offering "don't post"
|
|
99
92
|
// to a run that never would is an option with no meaning behind it.
|
|
100
93
|
canSkipPost: boolean;
|
|
@@ -137,8 +130,7 @@ export function menuOptions(canSkipPost: boolean): MenuOption[] {
|
|
|
137
130
|
|
|
138
131
|
export type SizeGateConfirmResult = { kind: "proceed" } | { kind: "cancel" };
|
|
139
132
|
|
|
140
|
-
// Continue / Cancel only
|
|
141
|
-
// not guess at this bill) and no details view (the SKIP line above the
|
|
133
|
+
// Continue / Cancel only, and no details view (the SKIP line above the
|
|
142
134
|
// menu already named the reason and the two flag hatches).
|
|
143
135
|
export function sizeGateMenuOptions(): MenuOption[] {
|
|
144
136
|
return [
|
|
@@ -157,55 +149,6 @@ export function sizeGateMenuOptions(): MenuOption[] {
|
|
|
157
149
|
];
|
|
158
150
|
}
|
|
159
151
|
|
|
160
|
-
const LABEL_WIDTH = 32;
|
|
161
|
-
|
|
162
|
-
// The billing mode of an admitted route plan, derived ONCE from the same
|
|
163
|
-
// free-step count the plan card prints (planEstimateLine in ui/plan.ts reads
|
|
164
|
-
// this too). All steps free: nothing is billed. Some free: the band stays and
|
|
165
|
-
// names the free share. Otherwise there is no mode, and today's wording stands.
|
|
166
|
-
export type FreeBillingMode = "free" | "mixed";
|
|
167
|
-
|
|
168
|
-
export const FREE_STEPS_NOTE = "(free steps not billed)";
|
|
169
|
-
|
|
170
|
-
export function freeBillingMode(
|
|
171
|
-
free: FreeRouteBilling | undefined,
|
|
172
|
-
): FreeBillingMode | undefined {
|
|
173
|
-
if (free === undefined || free.total === 0) return undefined;
|
|
174
|
-
if (free.free === free.total) return "free";
|
|
175
|
-
return free.free > 0 ? "mixed" : undefined;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function band(low: number, high: number): string {
|
|
179
|
-
return `$${low.toFixed(2)} – $${high.toFixed(2)}`;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// The menu's first-row hint. A free route shows no dollar figure at all: the
|
|
183
|
-
// band would read as spend, which is the claim the plan card just retracted.
|
|
184
|
-
export function costHint(
|
|
185
|
-
low: number,
|
|
186
|
-
high: number,
|
|
187
|
-
billing?: FreeBillingMode,
|
|
188
|
-
): string {
|
|
189
|
-
if (billing === "free") return "free route (not billed)";
|
|
190
|
-
if (billing === "mixed") return `${band(low, high)} ${FREE_STEPS_NOTE}`;
|
|
191
|
-
return band(low, high);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// The plain [y/N] prompt's sentence, without its question mark and answer
|
|
195
|
-
// domain. Metered is the sentence this module always printed, byte for byte.
|
|
196
|
-
export function spendSentence(
|
|
197
|
-
low: number,
|
|
198
|
-
high: number,
|
|
199
|
-
billing?: FreeBillingMode,
|
|
200
|
-
): string {
|
|
201
|
-
const range = `$${low.toFixed(2)}–$${high.toFixed(2)}`;
|
|
202
|
-
if (billing === "free") {
|
|
203
|
-
return `Run this review on a free route (token-derived ${range}, not billed)`;
|
|
204
|
-
}
|
|
205
|
-
const note = billing === "mixed" ? ` ${FREE_STEPS_NOTE}` : "";
|
|
206
|
-
return `Spend an estimated ${range} on this review${note}`;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
152
|
// The frame, as lines. Built unstyled and painted per line, same rule as the
|
|
210
153
|
// plan card: the pointer is plain text either way, so a piped run reads
|
|
211
154
|
// correctly with no escapes at all.
|
|
@@ -217,10 +160,7 @@ export function renderMenu(
|
|
|
217
160
|
return options.map((option, i) => {
|
|
218
161
|
const active = i === cursor;
|
|
219
162
|
const head = active ? "❯ " : " ";
|
|
220
|
-
const
|
|
221
|
-
? `${option.label.padEnd(LABEL_WIDTH)}${option.hint}`
|
|
222
|
-
: option.label;
|
|
223
|
-
const line = ` ${head}${body}`;
|
|
163
|
+
const line = ` ${head}${option.label}`;
|
|
224
164
|
if (!styles) return line;
|
|
225
165
|
return active ? bold(line, true) : dim(line, true);
|
|
226
166
|
});
|
|
@@ -265,11 +205,6 @@ export async function runConfirm(
|
|
|
265
205
|
if (!reader.raw) return runPlainConfirm(spec, reader, io);
|
|
266
206
|
|
|
267
207
|
const options = menuOptions(spec.canSkipPost);
|
|
268
|
-
const withHint = options.map((option, i) =>
|
|
269
|
-
i === 0
|
|
270
|
-
? { ...option, hint: costHint(spec.low, spec.high, spec.billing) }
|
|
271
|
-
: option,
|
|
272
|
-
);
|
|
273
208
|
let cursor = 0;
|
|
274
209
|
// Repainting in place needs cursor-movement escapes, which are exactly what
|
|
275
210
|
// must never reach a pipe. When styling is off the frames are simply
|
|
@@ -279,7 +214,7 @@ export async function runConfirm(
|
|
|
279
214
|
|
|
280
215
|
const draw = (): void => {
|
|
281
216
|
if (repaint && drawn > 0) io.write(`${ESC}[${drawn}A`);
|
|
282
|
-
const lines = renderMenu(
|
|
217
|
+
const lines = renderMenu(options, cursor, spec.styles);
|
|
283
218
|
for (const line of lines) {
|
|
284
219
|
if (repaint) io.write(`${ESC}[2K`);
|
|
285
220
|
io.line(line);
|
|
@@ -313,19 +248,15 @@ export async function runConfirm(
|
|
|
313
248
|
return { kind: "cancel" };
|
|
314
249
|
}
|
|
315
250
|
if (key.type === "up" || key.type === "down") {
|
|
316
|
-
cursor = moveCursor(
|
|
317
|
-
cursor,
|
|
318
|
-
key.type === "up" ? -1 : 1,
|
|
319
|
-
withHint.length,
|
|
320
|
-
);
|
|
251
|
+
cursor = moveCursor(cursor, key.type === "up" ? -1 : 1, options.length);
|
|
321
252
|
draw();
|
|
322
253
|
continue;
|
|
323
254
|
}
|
|
324
255
|
const chosen =
|
|
325
256
|
key.type === "enter"
|
|
326
|
-
?
|
|
257
|
+
? options[cursor]
|
|
327
258
|
: key.type === "char"
|
|
328
|
-
?
|
|
259
|
+
? options.find((option) => option.shortcuts.includes(key.char))
|
|
329
260
|
: undefined;
|
|
330
261
|
if (chosen === undefined) continue;
|
|
331
262
|
if (chosen.action === "details") {
|
|
@@ -357,7 +288,7 @@ async function runPlainConfirm(
|
|
|
357
288
|
io: ConfirmIo,
|
|
358
289
|
): Promise<ConfirmResult> {
|
|
359
290
|
io.line();
|
|
360
|
-
io.write(
|
|
291
|
+
io.write("Run this review? [y/N] ");
|
|
361
292
|
const answer = (await reader.read())?.trim().toLowerCase() ?? "";
|
|
362
293
|
io.line();
|
|
363
294
|
return answer === "y" || answer === "yes"
|
|
@@ -437,8 +368,7 @@ export async function confirmReview(
|
|
|
437
368
|
}
|
|
438
369
|
|
|
439
370
|
// Sibling of runConfirm for the size-gate override. Same reader/io contract,
|
|
440
|
-
// same unanswered-is-no rule, no details view
|
|
441
|
-
// at this bill is the thing the gate refuses to do.
|
|
371
|
+
// same unanswered-is-no rule, no details view.
|
|
442
372
|
export async function runSizeGateConfirm(
|
|
443
373
|
styles: boolean,
|
|
444
374
|
reader: KeyReader,
|
package/src/updater.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function detectInstallMethod(
|
|
|
55
55
|
): InstallMethod {
|
|
56
56
|
const home = options.home ?? os.homedir();
|
|
57
57
|
const execPath = options.execPath ?? process.execPath;
|
|
58
|
-
const version = options.version ?? "0.
|
|
58
|
+
const version = options.version ?? "0.8.0";
|
|
59
59
|
const exists = options.exists ?? existsSync;
|
|
60
60
|
|
|
61
61
|
const isSource =
|
package/src/usage.ts
CHANGED
|
@@ -6,11 +6,9 @@ export interface SessionUsage {
|
|
|
6
6
|
tokens_in: number;
|
|
7
7
|
tokens_out: number;
|
|
8
8
|
tokens_total: number;
|
|
9
|
-
cost_usd_est: number;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
interface RawSessionResult {
|
|
13
|
-
total_cost_usd?: number;
|
|
14
12
|
usage?: {
|
|
15
13
|
input_tokens?: number;
|
|
16
14
|
output_tokens?: number;
|
|
@@ -19,7 +17,7 @@ interface RawSessionResult {
|
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
// Session-total tokens
|
|
20
|
+
// Session-total tokens is the MUST (Rec-R3); per-agent attribution is a
|
|
23
21
|
// documented SHOULD/best-effort gap — `--output-format json` only exposes the
|
|
24
22
|
// session aggregate (verified against a live headless run), never a
|
|
25
23
|
// per-hunter/refuter breakdown, so this slice does not populate it.
|
|
@@ -35,7 +33,6 @@ export function parseUsage(rawStdout: string, wall_ms: number): SessionUsage {
|
|
|
35
33
|
tokens_in: 0,
|
|
36
34
|
tokens_out: 0,
|
|
37
35
|
tokens_total: 0,
|
|
38
|
-
cost_usd_est: 0,
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
38
|
const usage = parsed.usage ?? {};
|
|
@@ -49,7 +46,6 @@ export function parseUsage(rawStdout: string, wall_ms: number): SessionUsage {
|
|
|
49
46
|
tokens_in,
|
|
50
47
|
tokens_out,
|
|
51
48
|
tokens_total: tokens_in + tokens_out,
|
|
52
|
-
cost_usd_est: parsed.total_cost_usd ?? 0,
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
51
|
|
|
@@ -59,7 +55,6 @@ export function zeroUsage(): SessionUsage {
|
|
|
59
55
|
tokens_in: 0,
|
|
60
56
|
tokens_out: 0,
|
|
61
57
|
tokens_total: 0,
|
|
62
|
-
cost_usd_est: 0,
|
|
63
58
|
};
|
|
64
59
|
}
|
|
65
60
|
|
|
@@ -72,6 +67,5 @@ export function sumUsage(a: SessionUsage, b: SessionUsage): SessionUsage {
|
|
|
72
67
|
tokens_in: a.tokens_in + b.tokens_in,
|
|
73
68
|
tokens_out: a.tokens_out + b.tokens_out,
|
|
74
69
|
tokens_total: a.tokens_total + b.tokens_total,
|
|
75
|
-
cost_usd_est: a.cost_usd_est + b.cost_usd_est,
|
|
76
70
|
};
|
|
77
71
|
}
|
package/prompts/scout.md
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pr-hero-scout
|
|
3
|
-
description: Diff-only triage pass that emits unverified leads biasing the hunters' scan.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are the engine-owned scout. You read ONE diff and nothing else. You have no
|
|
7
|
-
repository access and no tools: you cannot open a file, grep, follow a symbol,
|
|
8
|
-
or confirm anything you suspect. Everything you emit is an unverified
|
|
9
|
-
suspicion, and you must never write as though you had checked it.
|
|
10
|
-
|
|
11
|
-
Your job is to point the reviewers at the places in this diff most likely to
|
|
12
|
-
hide a defect. You do not decide whether a defect is actually there — reviewers
|
|
13
|
-
with repository access do that, and they read the whole diff regardless of what
|
|
14
|
-
you say. A lead you get wrong costs a reviewer a moment of attention on code
|
|
15
|
-
they were going to read anyway. A place you fail to point at is not excluded
|
|
16
|
-
from review.
|
|
17
|
-
|
|
18
|
-
That asymmetry sets your bias: **within your cap, prefer recall.** A suspicion
|
|
19
|
-
you can state in one sentence is worth emitting even when you cannot tell
|
|
20
|
-
whether it holds. Do not withhold a lead because you cannot prove it — proving
|
|
21
|
-
it is not your job and you are not equipped for it.
|
|
22
|
-
|
|
23
|
-
The cap is the other half. Leading on every hunk is the same as leading on
|
|
24
|
-
nothing. Emit **at most 12 leads**, at most **3 per file**, and spend them on
|
|
25
|
-
the places where the change is least self-evidently correct. When more places
|
|
26
|
-
deserve a lead than you have budget for, break the tie by consequence — what
|
|
27
|
-
goes wrong if you are right, not how unsure you feel. Both limits are applied
|
|
28
|
-
after you answer, by keeping your leads **in the order you wrote them**: a
|
|
29
|
-
fourth lead on one file is discarded, never weighed against the three before
|
|
30
|
-
it. So within a file, write the worst consequence first. A diff whose changes
|
|
31
|
-
are all self-evident is a real and expected outcome: return `{"leads":[]}`
|
|
32
|
-
rather than manufacturing suspicion.
|
|
33
|
-
|
|
34
|
-
## What counts as a lead
|
|
35
|
-
|
|
36
|
-
Any location in the changed code whose correctness is not settled. Ask three
|
|
37
|
-
questions of every change, in this order. They are ordered by how much they
|
|
38
|
-
yield, and the later ones must not crowd out the first.
|
|
39
|
-
|
|
40
|
-
**1. Is this wrong on its own terms?** Read the added lines as they stand and
|
|
41
|
-
work out what they do for every input they can receive — not the input the
|
|
42
|
-
author had in mind. Most defects are fully decidable from the lines in front of
|
|
43
|
-
you, and they are the ones a reader skims past because the code looks
|
|
44
|
-
reasonable. This is where the majority of your leads should come from.
|
|
45
|
-
|
|
46
|
-
**2. What does this change assume about the REST OF THIS DIFF?** A patch is one
|
|
47
|
-
change, not a list of files. An enum gains a case in one hunk and a switch over
|
|
48
|
-
it sits unmodified in another; a producer changes shape here and its second
|
|
49
|
-
consumer is three files down, untouched. Those relations are decidable from
|
|
50
|
-
what you were handed, and they are leads.
|
|
51
|
-
|
|
52
|
-
**3. What does it assume about code you cannot see?** Callers, siblings and
|
|
53
|
-
concurrent execution outside the patch. Legitimate, and the smallest of the
|
|
54
|
-
three. A lead list made entirely of "this depends on something not in the diff"
|
|
55
|
-
is a scout that read the patch as a list of external dependencies instead of as
|
|
56
|
-
code.
|
|
57
|
-
|
|
58
|
-
### Three places a defect hides best
|
|
59
|
-
|
|
60
|
-
These are the classes a reviewer's eye slides over, and they are most of the
|
|
61
|
-
reason you exist. Check every diff for all three.
|
|
62
|
-
|
|
63
|
-
- **Deletions.** Additions look dangerous; deletions look like cleanup. But a
|
|
64
|
-
removed field, config flag, default, branch or interface member can change
|
|
65
|
-
behaviour while the code still compiles and the tests still pass. Of every
|
|
66
|
-
deletion ask: who depended on this, and what used to be true that is not
|
|
67
|
-
anymore?
|
|
68
|
-
- **One side of a boundary updated.** The patch changes one producer of two,
|
|
69
|
-
one handler of an enum, one implementation of an interface, one caller of a
|
|
70
|
-
changed signature — and leaves its sibling as it was. Neither side breaks on
|
|
71
|
-
its own, which is exactly why nothing catches it. When both sides are in this
|
|
72
|
-
diff you can see it outright; when only one is, name the sibling you would
|
|
73
|
-
expect to have moved.
|
|
74
|
-
- **Silent behaviour changes.** The signature holds and the name holds, but the
|
|
75
|
-
behaviour does not: an error now swallowed that used to propagate, a miss now
|
|
76
|
-
treated as a failure or a failure as a miss, a default that changed value.
|
|
77
|
-
|
|
78
|
-
### And the ordinary ways code is wrong
|
|
79
|
-
|
|
80
|
-
- A comparison or a piece of arithmetic bounds one direction and leaves the
|
|
81
|
-
other open, so the failing input is the one that still passes the check — a
|
|
82
|
-
quantity arriving negative, reversed, out of range, or larger than the code
|
|
83
|
-
assumes. **Run this one actively instead of waiting to notice it:** take
|
|
84
|
-
every comparison and every subtraction in the added lines and name the input
|
|
85
|
-
that makes it come out the way the author wants when it should not. If you
|
|
86
|
-
cannot name one, move on. If you can, you have a lead.
|
|
87
|
-
- A value, unit, bound, key, order or lifetime is assumed rather than shown.
|
|
88
|
-
- An edge the new code does not visibly handle: empty, absent, zero, negative,
|
|
89
|
-
duplicate, overlong, already-done, failed, or arriving twice.
|
|
90
|
-
- The stated intent of the change and what the code now does appear to diverge.
|
|
91
|
-
|
|
92
|
-
### What is NOT a lead
|
|
93
|
-
|
|
94
|
-
This half is where a scout earns the right to be read at all.
|
|
95
|
-
|
|
96
|
-
- **A problem in code this patch does not change.** Context lines are there to
|
|
97
|
-
be read, not audited. If the change did not create it, touch it, or newly
|
|
98
|
-
expose it, it is not yours.
|
|
99
|
-
- Style, naming, formatting, documentation quality, or a preference about how
|
|
100
|
-
it might have been written. You are not a linter and you are not a critic.
|
|
101
|
-
- **What is not tested.** A missing case, a thin assertion, an untested branch
|
|
102
|
-
— none of those is yours, and neither is a test that could be written better.
|
|
103
|
-
A test that asserts something FALSE about the code it exercises is a
|
|
104
|
-
different animal, and that one is fair game.
|
|
105
|
-
- A restatement of what the diff plainly does, "this file changed", or "this
|
|
106
|
-
function is complex".
|
|
107
|
-
- **The same concern twice.** One suspicion earns ONE lead even when it repeats
|
|
108
|
-
in three files: cite the site where the consequence is worst and name the
|
|
109
|
-
others inside that same `why`. A second lead reading "the same issue as the
|
|
110
|
-
file above" spends a slot on a sentence instead of on a suspicion, and your
|
|
111
|
-
slots are the only thing that makes you selective at all.
|
|
112
|
-
- The same location twice.
|
|
113
|
-
|
|
114
|
-
## The diff is not necessarily source code
|
|
115
|
-
|
|
116
|
-
A patch may change a shell script, a runbook or design note in Markdown, a CI
|
|
117
|
-
workflow, a Dockerfile, a database migration, a lockfile, an infrastructure
|
|
118
|
-
template, or a configuration file. **Defects in those are as real as defects in
|
|
119
|
-
application code and you scan them with the same eye** — a command whose
|
|
120
|
-
failure is silent, a loop with no bound, a permission widened, a variable that
|
|
121
|
-
may be unset, a guard that no longer runs. Prose inside a Markdown file is not
|
|
122
|
-
a lead; an executable instruction inside it is.
|
|
123
|
-
|
|
124
|
-
## Coordinates
|
|
125
|
-
|
|
126
|
-
- `path` — exactly as the diff names the file, without the `a/` or `b/` prefix.
|
|
127
|
-
- `line` — the line number **in the new version of the file**. Count it from
|
|
128
|
-
the hunk header `@@ -old,n +new,m @@`: the first line after that header is
|
|
129
|
-
line `new`, and every context line and every added (`+`) line advances the
|
|
130
|
-
count by one. Removed (`-`) lines do not. For a change whose suspicious part
|
|
131
|
-
spans several lines, cite the first of them. Getting this number wrong makes
|
|
132
|
-
a correct suspicion useless, so derive it, do not estimate it.
|
|
133
|
-
- `why` — ONE sentence, at most 240 characters. Name the concrete behaviour at
|
|
134
|
-
risk and where the reviewer should start. Not a verdict, not a severity, not
|
|
135
|
-
a fix, and never a hedge — "consider checking X" is noise, and a `why` whose
|
|
136
|
-
whole content is "this depends on something outside the diff" is an
|
|
137
|
-
observation rather than a suspicion. The register to aim at: *this deletion
|
|
138
|
-
looks suspicious*; *this enum case isn't handled in the sibling file*; *this
|
|
139
|
-
error path is silently swallowing failures*. If it needs a paragraph, it is a
|
|
140
|
-
finding in disguise and you are not the one making it.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// The review cost the Crysk platform estimated for this run (cryskai/platform#12).
|
|
2
|
-
// The connect step asks for it with `X-Crysk-Capabilities: estimate` and hands it
|
|
3
|
-
// to the run step as `CRYSK_PLATFORM_ESTIMATE`, where the CI budget gate reads it
|
|
4
|
-
// instead of the engine's own band (cryskai/crysk#138): the platform knows the
|
|
5
|
-
// setup's models, their catalog prices and what its recent reviews cost; the
|
|
6
|
-
// band only knows the diff's size and prices every model as Claude.
|
|
7
|
-
//
|
|
8
|
-
// The platform already checked it, and the engine checks again: a value that is
|
|
9
|
-
// not a usable range is dropped, and the band decides, as without a platform.
|
|
10
|
-
|
|
11
|
-
export type PlatformEstimateBasis = "history" | "catalog";
|
|
12
|
-
|
|
13
|
-
export interface PlatformEstimate {
|
|
14
|
-
readonly usdLow: number;
|
|
15
|
-
readonly usdHigh: number;
|
|
16
|
-
// `history`: the setup's recent reviews scaled to this pull request.
|
|
17
|
-
// `catalog`: the catalog prices of the setup's models.
|
|
18
|
-
readonly basis: PlatformEstimateBasis;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const PLATFORM_ESTIMATE_CAPABILITY = "estimate";
|
|
22
|
-
|
|
23
|
-
const usable = (value: unknown): value is number =>
|
|
24
|
-
typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
25
|
-
|
|
26
|
-
// The `/runs/token` field, `{ usd_low, usd_high, basis }`, or undefined when it
|
|
27
|
-
// is absent or not a usable range.
|
|
28
|
-
export function parsePlatformEstimate(
|
|
29
|
-
value: unknown,
|
|
30
|
-
): PlatformEstimate | undefined {
|
|
31
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
const {
|
|
35
|
-
usd_low: low,
|
|
36
|
-
usd_high: high,
|
|
37
|
-
basis,
|
|
38
|
-
} = value as Record<string, unknown>;
|
|
39
|
-
if (!usable(low) || !usable(high) || low > high) return undefined;
|
|
40
|
-
if (basis !== "history" && basis !== "catalog") return undefined;
|
|
41
|
-
return { usdLow: low, usdHigh: high, basis };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// What the connect step writes to its `estimate` output: one line of JSON in the
|
|
45
|
-
// response's own field names, numbers and an enum only.
|
|
46
|
-
export function serializePlatformEstimate(estimate: PlatformEstimate): string {
|
|
47
|
-
return JSON.stringify({
|
|
48
|
-
usd_low: estimate.usdLow,
|
|
49
|
-
usd_high: estimate.usdHigh,
|
|
50
|
-
basis: estimate.basis,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// The run step's read of `CRYSK_PLATFORM_ESTIMATE`. Empty (a standalone run, an
|
|
55
|
-
// older platform, nothing priceable) or malformed reads as no estimate.
|
|
56
|
-
export function readPlatformEstimate(
|
|
57
|
-
env: Readonly<Record<string, string | undefined>>,
|
|
58
|
-
): PlatformEstimate | undefined {
|
|
59
|
-
const text = env.CRYSK_PLATFORM_ESTIMATE;
|
|
60
|
-
if (text === undefined || text === "") return undefined;
|
|
61
|
-
try {
|
|
62
|
-
return parsePlatformEstimate(JSON.parse(text));
|
|
63
|
-
} catch {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// The estimate as the plan and the CI budget gate read a cost band (report.ts's
|
|
69
|
-
// CostEstimate, structurally: this module imports nothing).
|
|
70
|
-
export function platformCostEstimate(estimate: PlatformEstimate): {
|
|
71
|
-
low: number;
|
|
72
|
-
high: number;
|
|
73
|
-
basis: string;
|
|
74
|
-
platform: PlatformEstimateBasis;
|
|
75
|
-
} {
|
|
76
|
-
return {
|
|
77
|
-
low: estimate.usdLow,
|
|
78
|
-
high: estimate.usdHigh,
|
|
79
|
-
basis:
|
|
80
|
-
estimate.basis === "history"
|
|
81
|
-
? "The Crysk platform's estimate, from this setup's recent reviews scaled to this pull request."
|
|
82
|
-
: "The Crysk platform's estimate, from the catalog prices of this setup's models.",
|
|
83
|
-
platform: estimate.basis,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// The estimate the run gates and plans on. The platform prices the whole pull
|
|
88
|
-
// request from the setup's own models, before the engine knows how much of it
|
|
89
|
-
// this run reviews. A narrowed run (a re-review whose discovery reads only what
|
|
90
|
-
// changed since the last review, or one that only verifies earlier findings)
|
|
91
|
-
// passes `fullBand`, the band for a full review of the pull request: the
|
|
92
|
-
// platform's figure is scaled by the share of that work the run does
|
|
93
|
-
// (band / fullBand, at most 1). The band measures the share only; its prices,
|
|
94
|
-
// which treat every model as Claude, never replace the platform's. A full review
|
|
95
|
-
// uses the platform's figure; without one the band decides, as before.
|
|
96
|
-
export function runCostEstimate<Band extends { high: number }>(
|
|
97
|
-
platform: PlatformEstimate | undefined,
|
|
98
|
-
band: Band,
|
|
99
|
-
fullBand: { high: number } | undefined,
|
|
100
|
-
): Band | ReturnType<typeof platformCostEstimate> {
|
|
101
|
-
if (platform === undefined) return band;
|
|
102
|
-
const estimate = platformCostEstimate(platform);
|
|
103
|
-
if (fullBand === undefined || !(fullBand.high > 0)) return estimate;
|
|
104
|
-
const share = Math.min(1, Math.max(0, band.high / fullBand.high));
|
|
105
|
-
return {
|
|
106
|
-
...estimate,
|
|
107
|
-
low: estimate.low * share,
|
|
108
|
-
high: estimate.high * share,
|
|
109
|
-
basis: `${estimate.basis} Scaled to the ${Math.round(share * 100)}% of a full review this run does.`,
|
|
110
|
-
};
|
|
111
|
-
}
|