crysk 0.5.1 → 0.6.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 +15 -1
- package/dist/SKILL-nncgwkx7.md +553 -0
- package/dist/cli.js +6379 -5561
- package/dist/index.js +967 -467
- package/dist/workflow-ag62s87j.yml +163 -0
- package/package.json +3 -2
- package/skills/crysk-ci-setup/assets/workflow.yml +3 -0
- package/skills/crysk-loop/SKILL.md +2 -2
- package/src/asset-manifest.ts +11 -0
- package/src/assets.ts +34 -11
- package/src/ci/credential-refresh.ts +524 -0
- package/src/ci/crysk-secrets.ts +20 -6
- package/src/ci/gates.ts +2 -24
- package/src/ci/outcome.ts +165 -15
- package/src/ci/platform.ts +205 -7
- package/src/ci/setup.ts +64 -6
- package/src/ci/trigger.ts +84 -8
- package/src/commands/ci-setup.ts +12 -3
- package/src/commands/doctor.ts +25 -23
- package/src/commands/status.ts +2 -0
- package/src/diversity/identity.ts +11 -1
- package/src/diversity/pipeline-integration.ts +19 -6
- package/src/doctor.ts +133 -4
- package/src/execution/contracts.ts +15 -3
- package/src/harness/materiality-judge.ts +153 -0
- package/src/harness/pipeline-plan.ts +133 -0
- package/src/harness/replay-rows.ts +172 -0
- package/src/harness/route-runner.ts +288 -0
- package/src/harness/single-step.ts +153 -0
- package/src/index.ts +1 -1
- package/src/model/catalog.ts +10 -7
- package/src/model/model-name.ts +14 -0
- package/src/model/profiles/claude.ts +34 -0
- package/src/model/profiles/openai.ts +44 -0
- package/src/model/profiles.ts +213 -0
- package/src/model/routing.ts +155 -50
- 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/plan.ts +6 -1
- package/src/pr/pr-status.ts +18 -3
- package/src/pr/publish-outcome.ts +14 -13
- package/src/pr/review-pr.ts +49 -8
- package/src/pr/target.ts +16 -7
- package/src/production-runtime.ts +100 -13
- package/src/rereview/prepare.ts +13 -2
- package/src/review/exit-code.ts +60 -0
- package/src/review/findings.ts +3 -3
- package/src/review/pipeline.ts +193 -58
- package/src/review/preflight.ts +100 -10
- package/src/review/prompt-set.ts +73 -0
- package/src/review/review.ts +32 -13
- package/src/review/route-preflight.ts +117 -67
- package/src/review/run.ts +34 -4
- package/src/security/credential-broker.ts +21 -9
- package/src/security/oauth-providers.ts +101 -0
- package/src/transport-registry.ts +33 -0
- package/src/transports/opencode-sdk.ts +33 -1
- package/src/triage/adjudication.ts +35 -2
- package/src/ui/config-edit.ts +9 -0
- package/src/ui/config.ts +1 -0
- package/src/ui/menu.ts +9 -2
- package/src/ui/result.ts +1 -1
- package/src/updater.ts +21 -13
- package/src/watch/preflight.ts +34 -8
- package/src/watch/watch.ts +8 -4
- package/src/wizard.ts +23 -0
|
@@ -2,6 +2,7 @@ import type { BucketScope } from "../execution/bucket-id";
|
|
|
2
2
|
import { deriveBucketId } from "../execution/bucket-id";
|
|
3
3
|
import type {
|
|
4
4
|
AsyncEventSink,
|
|
5
|
+
OpenCodeFailureCredential,
|
|
5
6
|
ProviderCapabilityReport,
|
|
6
7
|
ProviderEvent,
|
|
7
8
|
ProviderEventBase,
|
|
@@ -409,6 +410,12 @@ export interface OpenCodeSdkTransportOptions {
|
|
|
409
410
|
readonly provider: string;
|
|
410
411
|
};
|
|
411
412
|
readonly defaultRoute?: ResolvedModelRoute;
|
|
413
|
+
// S7: the CRYSK_OPENCODE_* secret this transport's route runs on, named by the
|
|
414
|
+
// registry factory from the route's provider and credential kind (the transport
|
|
415
|
+
// holds neither credential nor kind). Stamped on every failed outcome as
|
|
416
|
+
// `failureCredential`, so a CI fix names the secret to replace or top up. Absent
|
|
417
|
+
// for a free route, an unknown kind, or a provider no secret name can carry.
|
|
418
|
+
readonly failureCredential?: OpenCodeFailureCredential;
|
|
412
419
|
}
|
|
413
420
|
|
|
414
421
|
const MARKER_ABORT_UNCONFIRMED =
|
|
@@ -708,6 +715,9 @@ export class OpenCodeSdkTransport implements ProviderTransport {
|
|
|
708
715
|
// attempted.
|
|
709
716
|
readonly credentialProjection = "server-lifetime" as const;
|
|
710
717
|
readonly defaultRoute?: ResolvedModelRoute;
|
|
718
|
+
// Public and readonly for the same reason as usageBillingMode below: the factory
|
|
719
|
+
// derives it, and reading it is how a test observes that derivation.
|
|
720
|
+
readonly failureCredential?: OpenCodeFailureCredential;
|
|
711
721
|
private readonly client: OpenCodeClientLike;
|
|
712
722
|
private readonly stallDeadlineMs: number;
|
|
713
723
|
private readonly abortConfirmMs: number;
|
|
@@ -739,6 +749,7 @@ export class OpenCodeSdkTransport implements ProviderTransport {
|
|
|
739
749
|
};
|
|
740
750
|
this.cancellationSemantics = "provider-proof";
|
|
741
751
|
this.defaultRoute = options.defaultRoute;
|
|
752
|
+
this.failureCredential = options.failureCredential;
|
|
742
753
|
this.client = options.client;
|
|
743
754
|
this.stallDeadlineMs = options.stallDeadlineMs ?? DEFAULT_STALL_DEADLINE_MS;
|
|
744
755
|
this.abortConfirmMs = options.abortConfirmMs ?? SDK_ABORT_CONFIRM_MS;
|
|
@@ -878,7 +889,9 @@ export class OpenCodeSdkTransport implements ProviderTransport {
|
|
|
878
889
|
request: TransportRequest,
|
|
879
890
|
context: { readonly signal: AbortSignal; readonly events: AsyncEventSink },
|
|
880
891
|
): Promise<TransportOutcome> {
|
|
881
|
-
const outcome =
|
|
892
|
+
const outcome = this.withFailureCredential(
|
|
893
|
+
await this.executeAttempt(request, context),
|
|
894
|
+
);
|
|
882
895
|
try {
|
|
883
896
|
const diagnosticEvidence = this.client.takeEvidence?.(
|
|
884
897
|
request.sessionId,
|
|
@@ -890,6 +903,15 @@ export class OpenCodeSdkTransport implements ProviderTransport {
|
|
|
890
903
|
}
|
|
891
904
|
}
|
|
892
905
|
|
|
906
|
+
// The secret only on a failed attempt, like the Claude transport: it is what the fix
|
|
907
|
+
// names, and a success or a cancellation has nothing to fix.
|
|
908
|
+
private withFailureCredential(outcome: TransportOutcome): TransportOutcome {
|
|
909
|
+
return outcome.completion === "failed" &&
|
|
910
|
+
this.failureCredential !== undefined
|
|
911
|
+
? { ...outcome, failureCredential: this.failureCredential }
|
|
912
|
+
: outcome;
|
|
913
|
+
}
|
|
914
|
+
|
|
893
915
|
private async executeAttempt(
|
|
894
916
|
request: TransportRequest,
|
|
895
917
|
context: { readonly signal: AbortSignal; readonly events: AsyncEventSink },
|
|
@@ -2255,6 +2277,16 @@ export class OpenCodeSdkTransport implements ProviderTransport {
|
|
|
2255
2277
|
) {
|
|
2256
2278
|
return "model_unavailable";
|
|
2257
2279
|
}
|
|
2280
|
+
// S7, same slot rule: a 401 is the provider refusing the credential, whatever its
|
|
2281
|
+
// words (OpenAI's "Incorrect API key provided" matches none of the auth patterns
|
|
2282
|
+
// above). auth_invalid is terminal like runtime_unavailable, so the retry policy is
|
|
2283
|
+
// unchanged; the cause lets the PR name the secret to replace (CRYSK-CRED-REJECTED).
|
|
2284
|
+
if (
|
|
2285
|
+
witness.includes(MARKER_PROVIDER_REFUSAL) &&
|
|
2286
|
+
providerRefusalStatus(witness) === "401"
|
|
2287
|
+
) {
|
|
2288
|
+
return "auth_invalid";
|
|
2289
|
+
}
|
|
2258
2290
|
if (witness.includes(MARKER_PROVIDER_REFUSAL)) {
|
|
2259
2291
|
return providerRefusalRetries(witness) === true
|
|
2260
2292
|
? "network_transient"
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
// `dismissed` reply to a blocking finding, and posts the ruling as a reply on the
|
|
5
5
|
// finding's thread. That reply is the only CI verdict the gate trusts, and only
|
|
6
6
|
// when all of these hold:
|
|
7
|
-
// - GitHub says the reply's author is CI_ADJUDICATOR_LOGIN
|
|
8
|
-
//
|
|
7
|
+
// - GitHub says the reply's author is CI_ADJUDICATOR_LOGIN, or the GitHub App bot
|
|
8
|
+
// that posted the finding itself (trustedAdjudicator). The marker's own text
|
|
9
|
+
// proves nothing, since anyone can type it;
|
|
9
10
|
// - its `reply=` names the comment id of the thread's LATEST triage reply, so a
|
|
10
11
|
// newer dismissal is pending again;
|
|
11
12
|
// - that triage reply is `dismissed`, and the verdict is `upheld` (D5: only a
|
|
@@ -21,6 +22,38 @@ export const ADJUDICATION_MARKER_PREFIX = `${MARKER_OPEN}adjudication `;
|
|
|
21
22
|
// The login GitHub stamps on comments posted with the workflow's GITHUB_TOKEN.
|
|
22
23
|
export const CI_ADJUDICATOR_LOGIN = "github-actions[bot]";
|
|
23
24
|
|
|
25
|
+
// A GitHub App's bot login. A person's login can never end in `[bot]`.
|
|
26
|
+
const APP_BOT_LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\[bot\]$/;
|
|
27
|
+
|
|
28
|
+
// Who a read trusts to rule (odd/tasks/platform-commands.md in the platform repo, S5).
|
|
29
|
+
// - `ci`: a run's own read, which decides the gate. Standalone only github-actions[bot] rules. A
|
|
30
|
+
// run a Crysk platform dispatched posts as the platform App's bot, the login the platform's
|
|
31
|
+
// token exchange returned (CRYSK_PLATFORM_ACTOR), so that login rules too, on a finding it posted.
|
|
32
|
+
// - `local`: `crysk status` on a developer's machine, which never learns the platform's login. It
|
|
33
|
+
// trusts an App's bot ruling on a finding that same bot posted. That read only advises the next
|
|
34
|
+
// action; the gate's own read is `ci`.
|
|
35
|
+
export type AdjudicatorTrust =
|
|
36
|
+
| { kind: "ci"; platformActor?: string }
|
|
37
|
+
| { kind: "local" };
|
|
38
|
+
|
|
39
|
+
export const CI_ADJUDICATOR_TRUST: AdjudicatorTrust = { kind: "ci" };
|
|
40
|
+
|
|
41
|
+
// WHY the finding's own author: another App installed on the repository can post the marker too,
|
|
42
|
+
// but only the bot that posted the finding rules on it. A person can type the marker under a
|
|
43
|
+
// finding they posted, so the author must be an App's bot.
|
|
44
|
+
export function trustedAdjudicator(
|
|
45
|
+
rulingAuthor: string | undefined,
|
|
46
|
+
findingAuthor: string | undefined,
|
|
47
|
+
trust: AdjudicatorTrust,
|
|
48
|
+
): boolean {
|
|
49
|
+
if (rulingAuthor === undefined) return false;
|
|
50
|
+
if (rulingAuthor === CI_ADJUDICATOR_LOGIN) return true;
|
|
51
|
+
if (rulingAuthor !== findingAuthor || !APP_BOT_LOGIN.test(rulingAuthor)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return trust.kind === "local" || rulingAuthor === trust.platformActor;
|
|
55
|
+
}
|
|
56
|
+
|
|
24
57
|
// The most adjudicator calls one run makes. A pending dismissal past the cap
|
|
25
58
|
// stays pending, still counted, and the next recheck takes it.
|
|
26
59
|
export const MAX_ADJUDICATIONS_PER_RUN = 5;
|
package/src/ui/config-edit.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { profileIdProblem } from "#model/profiles";
|
|
4
5
|
import {
|
|
5
6
|
mergeConfig,
|
|
6
7
|
parseGlobalConfig,
|
|
7
8
|
parseLocalConfig,
|
|
8
9
|
} from "#review/preflight";
|
|
9
10
|
import { resolveHomeDir, resolveRepoDir } from "../brand-paths";
|
|
11
|
+
import { redactConfigValue } from "../security/redact";
|
|
10
12
|
import { bold, box, cyan, dim, sanitizeText, yellow } from "./primitives";
|
|
11
13
|
import type { KeyReader } from "./select";
|
|
12
14
|
|
|
@@ -628,6 +630,13 @@ export async function setConfigValue(input: {
|
|
|
628
630
|
// Gone (L6 item 1): writing it would plant the very key the parser now
|
|
629
631
|
// refuses. Say where the summary model lives instead.
|
|
630
632
|
throw new Error(SUMMARY_MODEL_GONE);
|
|
633
|
+
} else if (input.key === "profile") {
|
|
634
|
+
const value = input.value.trim();
|
|
635
|
+
const problem = profileIdProblem(value);
|
|
636
|
+
if (problem !== undefined) {
|
|
637
|
+
throw new Error(`${problem} (got "${redactConfigValue(value)}")`);
|
|
638
|
+
}
|
|
639
|
+
currentPerson.profile = value;
|
|
631
640
|
} else if (input.key === "agents_dir") {
|
|
632
641
|
currentPerson.agents_dir = input.value.trim();
|
|
633
642
|
} else if (input.key === "scout") {
|
package/src/ui/config.ts
CHANGED
|
@@ -168,6 +168,7 @@ export function configRows(
|
|
|
168
168
|
),
|
|
169
169
|
models: modelsCell(effective.models, sources.models),
|
|
170
170
|
credentials: credentialsCell(effective.credentials, sources.credentials),
|
|
171
|
+
profile: cell(effective.profile, sources.profile),
|
|
171
172
|
max_verification_steps: cell(
|
|
172
173
|
effective.max_verification_steps?.toString(),
|
|
173
174
|
sources.max_verification_steps,
|
package/src/ui/menu.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DEFAULT_SIZE_GATE } from "#review/size-gate";
|
|
|
6
6
|
import { listActiveRuns } from "#store/activity";
|
|
7
7
|
import { DEFAULT_DAILY_CAP } from "#watch/preflight";
|
|
8
8
|
import { resolveHomeDir, resolveRepoDir } from "../brand-paths";
|
|
9
|
-
import { runDoctor } from "../doctor";
|
|
9
|
+
import { loadDoctorRouting, runDoctor } from "../doctor";
|
|
10
10
|
import {
|
|
11
11
|
getMenuOptions,
|
|
12
12
|
type MenuItem,
|
|
@@ -157,7 +157,14 @@ export async function gatherMenuStatus(
|
|
|
157
157
|
|
|
158
158
|
let doctorStatus: MenuStatusInfo["doctorStatus"];
|
|
159
159
|
try {
|
|
160
|
-
|
|
160
|
+
// The person's profile decides whether the Claude CLI is required
|
|
161
|
+
// (openai-profile S6), as `crysk doctor` reads it.
|
|
162
|
+
const routing = await loadDoctorRouting({ home, repoRoot: cwd });
|
|
163
|
+
const report = await runDoctor({
|
|
164
|
+
home,
|
|
165
|
+
cwd,
|
|
166
|
+
claudeRequired: routing.claudeRequired,
|
|
167
|
+
});
|
|
161
168
|
doctorStatus = report.overall;
|
|
162
169
|
} catch {
|
|
163
170
|
// Ignore
|
package/src/ui/result.ts
CHANGED
|
@@ -540,7 +540,7 @@ export function renderResult(input: ResultInput): string[] {
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
// The line that outranks every count above it. The exit code is the SHELL's
|
|
543
|
-
// (
|
|
543
|
+
// (reviewExitCode, src/review/exit-code.ts: 1 here) — this only says so.
|
|
544
544
|
if (input.sessionFailed) {
|
|
545
545
|
lines.push(
|
|
546
546
|
"",
|
package/src/updater.ts
CHANGED
|
@@ -24,9 +24,10 @@ import { type AssetMode, resolveEngineAssets, selfInvocation } from "./assets";
|
|
|
24
24
|
import { BIN_NAME, LEGACY_BIN_NAME } from "./brand";
|
|
25
25
|
import { LEGACY_HOME_DIR_NAME, resolveHomeDir } from "./brand-paths";
|
|
26
26
|
import { loadGlobalConfigLayer } from "./config/config";
|
|
27
|
-
import { runDoctor } from "./doctor";
|
|
27
|
+
import { loadDoctorRouting, runDoctor } from "./doctor";
|
|
28
28
|
import { prheroLayout } from "./home-preflight";
|
|
29
|
-
import { type ModelsConfig,
|
|
29
|
+
import { type ModelsConfig, routingNeedsOpenCode } from "./model/model-name";
|
|
30
|
+
import { resolveProfile } from "./model/profiles";
|
|
30
31
|
import {
|
|
31
32
|
readInstalledOpenCodeSdkVersion,
|
|
32
33
|
SUPPORTED_OPENCODE_SDK_VERSION,
|
|
@@ -54,7 +55,7 @@ export function detectInstallMethod(
|
|
|
54
55
|
): InstallMethod {
|
|
55
56
|
const home = options.home ?? os.homedir();
|
|
56
57
|
const execPath = options.execPath ?? process.execPath;
|
|
57
|
-
const version = options.version ?? "0.
|
|
58
|
+
const version = options.version ?? "0.6.1";
|
|
58
59
|
const exists = options.exists ?? existsSync;
|
|
59
60
|
|
|
60
61
|
const isSource =
|
|
@@ -656,14 +657,15 @@ export function spawnOpenCodeSdkInstaller(
|
|
|
656
657
|
});
|
|
657
658
|
}
|
|
658
659
|
|
|
659
|
-
// The person file's `models`, the only layer that may hold them.
|
|
660
|
-
// file that no longer parses (a removed `routing` key) throws here,
|
|
661
|
-
// reconcile step records that message instead of crashing.
|
|
662
|
-
async function readReconcileModels(
|
|
663
|
-
|
|
664
|
-
|
|
660
|
+
// The person file's `models` and `profile`, the only layer that may hold them.
|
|
661
|
+
// A person file that no longer parses (a removed `routing` key) throws here,
|
|
662
|
+
// and the reconcile step records that message instead of crashing.
|
|
663
|
+
async function readReconcileModels(home: string): Promise<{
|
|
664
|
+
models: ModelsConfig | undefined;
|
|
665
|
+
profile: string | undefined;
|
|
666
|
+
}> {
|
|
665
667
|
const loaded = await loadGlobalConfigLayer(home);
|
|
666
|
-
return loaded.layer?.models;
|
|
668
|
+
return { models: loaded.layer?.models, profile: loaded.layer?.profile };
|
|
667
669
|
}
|
|
668
670
|
|
|
669
671
|
async function ensureOpenCodeSdkInstalled(options: {
|
|
@@ -673,8 +675,8 @@ async function ensureOpenCodeSdkInstalled(options: {
|
|
|
673
675
|
which?: (bin: string) => string | null;
|
|
674
676
|
spawnInstaller?: (argv: readonly string[]) => Promise<OpenCodeSdkSpawnResult>;
|
|
675
677
|
}): Promise<void> {
|
|
676
|
-
const models = await readReconcileModels(options.home);
|
|
677
|
-
if (!
|
|
678
|
+
const { models, profile } = await readReconcileModels(options.home);
|
|
679
|
+
if (!routingNeedsOpenCode(models, resolveProfile(profile))) return;
|
|
678
680
|
// Install and the version check share this home. The no-arg reader uses
|
|
679
681
|
// os.homedir(), which is a different tree whenever reconcile was given one.
|
|
680
682
|
const nodeModulesDir = prheroLayout(options.home).nodeModulesDir;
|
|
@@ -823,7 +825,13 @@ export async function reconcileUpgrade(
|
|
|
823
825
|
}
|
|
824
826
|
} else {
|
|
825
827
|
try {
|
|
826
|
-
|
|
828
|
+
// The person's profile decides whether the Claude CLI is required
|
|
829
|
+
// (openai-profile S6), as `crysk doctor` reads it.
|
|
830
|
+
const routing = await loadDoctorRouting({ home });
|
|
831
|
+
const doc = await runDoctor({
|
|
832
|
+
home,
|
|
833
|
+
claudeRequired: routing.claudeRequired,
|
|
834
|
+
});
|
|
827
835
|
if (doc.overall === "blocking") {
|
|
828
836
|
errors.push("Doctor check found blocking issues");
|
|
829
837
|
}
|
package/src/watch/preflight.ts
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { isFullCommitId } from "#git/refs";
|
|
13
13
|
import { PR_COMMENT_MARKER_PREFIX } from "#pr/preflight";
|
|
14
|
+
import {
|
|
15
|
+
EXIT_REVIEW_COMPLETE,
|
|
16
|
+
EXIT_REVIEW_INCOMPLETE,
|
|
17
|
+
} from "#review/exit-code";
|
|
14
18
|
import type { NumstatFile } from "#review/preflight";
|
|
15
19
|
import {
|
|
16
20
|
DEFAULT_SIZE_GATE,
|
|
@@ -1096,9 +1100,21 @@ export function launchedLine(
|
|
|
1096
1100
|
return `${ts} launched pr=${pr} repo=${repoBase} head=${headSha.slice(0, 8)}`;
|
|
1097
1101
|
}
|
|
1098
1102
|
|
|
1103
|
+
// What the watcher makes of a review child's exit code, by the review's own
|
|
1104
|
+
// table (src/review/exit-code.ts). "incomplete" is exit 3: the review ran and
|
|
1105
|
+
// may have posted findings, but a step failed, so it is neither a clean "ok"
|
|
1106
|
+
// nor a "failed" whose counts mean nothing.
|
|
1107
|
+
export type ReviewResult = "ok" | "incomplete" | "failed";
|
|
1108
|
+
|
|
1109
|
+
export function reviewOutcomeResult(exitCode: number): ReviewResult {
|
|
1110
|
+
if (exitCode === EXIT_REVIEW_COMPLETE) return "ok";
|
|
1111
|
+
if (exitCode === EXIT_REVIEW_INCOMPLETE) return "incomplete";
|
|
1112
|
+
return "failed";
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1099
1115
|
export interface ReviewOutcome {
|
|
1100
1116
|
pr: number;
|
|
1101
|
-
|
|
1117
|
+
result: ReviewResult;
|
|
1102
1118
|
exitCode: number;
|
|
1103
1119
|
counts: { blocking: number; advisory: number } | null;
|
|
1104
1120
|
}
|
|
@@ -1108,13 +1124,17 @@ export function outcomeLine(
|
|
|
1108
1124
|
repoBase: string,
|
|
1109
1125
|
outcome: ReviewOutcome,
|
|
1110
1126
|
): string {
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
? outcome.counts === null
|
|
1127
|
+
const counts =
|
|
1128
|
+
outcome.counts === null
|
|
1114
1129
|
? ""
|
|
1115
|
-
: ` blocking=${outcome.counts.blocking} advisory=${outcome.counts.advisory}
|
|
1116
|
-
|
|
1117
|
-
|
|
1130
|
+
: ` blocking=${outcome.counts.blocking} advisory=${outcome.counts.advisory}`;
|
|
1131
|
+
const detail =
|
|
1132
|
+
outcome.result === "ok"
|
|
1133
|
+
? counts
|
|
1134
|
+
: outcome.result === "incomplete"
|
|
1135
|
+
? ` exit=${outcome.exitCode}${counts}`
|
|
1136
|
+
: ` exit=${outcome.exitCode}`;
|
|
1137
|
+
return `${ts} outcome pr=${outcome.pr} repo=${repoBase} status=${outcome.result}${detail}`;
|
|
1118
1138
|
}
|
|
1119
1139
|
|
|
1120
1140
|
// Counts today's launches back out of the raw log text. dayPrefix is the
|
|
@@ -1267,9 +1287,15 @@ export function osascriptNotifyArgs(title: string, text: string): string[] {
|
|
|
1267
1287
|
}
|
|
1268
1288
|
|
|
1269
1289
|
export function outcomeNotificationText(outcome: ReviewOutcome): string {
|
|
1270
|
-
if (
|
|
1290
|
+
if (outcome.result === "failed") {
|
|
1271
1291
|
return `PR #${outcome.pr} review failed (exit ${outcome.exitCode})`;
|
|
1272
1292
|
}
|
|
1293
|
+
if (outcome.result === "incomplete") {
|
|
1294
|
+
const prefix = `PR #${outcome.pr} review incomplete, run it again`;
|
|
1295
|
+
return outcome.counts === null
|
|
1296
|
+
? `${prefix} (counts unavailable)`
|
|
1297
|
+
: `${prefix}: ${outcome.counts.blocking} blocking, ${outcome.counts.advisory} advisory`;
|
|
1298
|
+
}
|
|
1273
1299
|
if (outcome.counts === null) {
|
|
1274
1300
|
return `PR #${outcome.pr} reviewed (counts unavailable)`;
|
|
1275
1301
|
}
|
package/src/watch/watch.ts
CHANGED
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
removeWatchRepo,
|
|
103
103
|
renderWatchPlist,
|
|
104
104
|
renderWatchStatus,
|
|
105
|
+
reviewOutcomeResult,
|
|
105
106
|
skipLine,
|
|
106
107
|
type TickDecision,
|
|
107
108
|
type TickLaunch,
|
|
@@ -860,14 +861,17 @@ async function runTick(
|
|
|
860
861
|
);
|
|
861
862
|
const exitCode = await proc.exited;
|
|
862
863
|
|
|
864
|
+
// An incomplete review (exit 3) still ran and may have posted findings, so
|
|
865
|
+
// its counts are read like a complete one's; only a failed run has none.
|
|
866
|
+
const result = reviewOutcomeResult(exitCode);
|
|
863
867
|
const outcome: ReviewOutcome = {
|
|
864
868
|
pr: launch.pr,
|
|
865
|
-
|
|
869
|
+
result,
|
|
866
870
|
exitCode,
|
|
867
871
|
counts:
|
|
868
|
-
|
|
869
|
-
?
|
|
870
|
-
:
|
|
872
|
+
result === "failed"
|
|
873
|
+
? null
|
|
874
|
+
: await readTierCounts(launched?.runsRoot, launch.pr, launch.head),
|
|
871
875
|
};
|
|
872
876
|
await appendLog(
|
|
873
877
|
paths.logPath,
|
package/src/wizard.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import type { ModelsConfig } from "#model/model-name";
|
|
5
|
+
import type { ModelProfile } from "#model/profiles";
|
|
4
6
|
import {
|
|
5
7
|
GOTCHAS_PLACEHOLDER_MARKER,
|
|
6
8
|
initConfigTemplate,
|
|
@@ -16,6 +18,7 @@ import {
|
|
|
16
18
|
} from "./agent-env";
|
|
17
19
|
import { resolveEngineAssets, selfInvocation } from "./assets";
|
|
18
20
|
import { REPO_DIR_NAME, resolveHomeDir, resolveRepoDir } from "./brand-paths";
|
|
21
|
+
import { loadDoctorRouting } from "./doctor";
|
|
19
22
|
import type {
|
|
20
23
|
ExactBindingCapabilityReport,
|
|
21
24
|
RunnerBackend,
|
|
@@ -341,6 +344,22 @@ function authProjectionDetail(
|
|
|
341
344
|
return ` (auth projection: ${ready ? "ready" : "unavailable"})`;
|
|
342
345
|
}
|
|
343
346
|
|
|
347
|
+
// The routing the wizard's binding probe resolves, read like `crysk doctor`
|
|
348
|
+
// reads it. A config that fails to load keeps the fallback profile with
|
|
349
|
+
// Claude required, which is what the probe did before profiles existed.
|
|
350
|
+
async function wizardDoctorRouting(home: string): Promise<{
|
|
351
|
+
claudeRequired: boolean;
|
|
352
|
+
models?: ModelsConfig;
|
|
353
|
+
profile: ModelProfile;
|
|
354
|
+
}> {
|
|
355
|
+
const routing = await loadDoctorRouting({ home });
|
|
356
|
+
return {
|
|
357
|
+
claudeRequired: routing.claudeRequired,
|
|
358
|
+
...(routing.models === undefined ? {} : { models: routing.models }),
|
|
359
|
+
profile: routing.profile,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
344
363
|
export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
345
364
|
// Step 1: System tools
|
|
346
365
|
{
|
|
@@ -372,6 +391,10 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
372
391
|
? await deps.probeExactBinding()
|
|
373
392
|
: await collectDoctorExactBindingReports({
|
|
374
393
|
workspaceRoot,
|
|
394
|
+
// What the person's config routes, as `crysk doctor` probes it
|
|
395
|
+
// (openai-profile S6): a profile with no Claude step is not
|
|
396
|
+
// probed on a Claude binding it never opens.
|
|
397
|
+
...(await wizardDoctorRouting(deps.home ?? os.homedir())),
|
|
375
398
|
authorityDeps: {
|
|
376
399
|
existsFn: deps.exists ?? deps.checkToolsOptions?.exists,
|
|
377
400
|
},
|