crysk 0.3.1 → 0.3.3
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 +61 -37
- package/dist/SKILL-12as0f3q.md +74 -0
- package/dist/SKILL-2h445snn.md +140 -0
- package/dist/SKILL-6j27707y.md +140 -0
- package/dist/SKILL-6vy283pt.md +140 -0
- package/dist/SKILL-816621e5.md +74 -0
- package/dist/SKILL-bnh7nrjz.md +74 -0
- package/dist/SKILL-ebn0fqaq.md +140 -0
- package/dist/SKILL-fv8x6hhx.md +140 -0
- package/dist/SKILL-nv32jpc5.md +74 -0
- package/dist/SKILL-qnfc8yp3.md +539 -0
- package/dist/SKILL-xr56f0b6.md +140 -0
- package/dist/SKILL-yz6wk92g.md +542 -0
- package/dist/ci-admission-09k2ba89.md +126 -0
- package/dist/ci-admission-a6d0wk1c.md +128 -0
- package/dist/ci-admission-f19qh39t.md +128 -0
- package/dist/ci-admission-tcqsj7b2.md +126 -0
- package/dist/cli.js +11544 -10726
- package/dist/index.js +1578 -942
- package/dist/materiality-f1qwnvg1.md +27 -0
- package/dist/review-refuter-btpgnkcd.md +77 -0
- package/package.json +3 -2
- package/prompts/default/PROVENANCE.md +1 -0
- package/prompts/default/review-refuter.md +6 -0
- package/prompts/materiality.md +27 -0
- package/skills/crysk/SKILL.md +5 -5
- package/skills/crysk-ci-setup/SKILL.md +16 -10
- package/skills/crysk-ci-setup/references/ci-admission.md +4 -0
- package/skills/crysk-loop/SKILL.md +32 -5
- package/src/asset-manifest.ts +2 -0
- package/src/assets.ts +4 -1
- package/src/brand.ts +11 -9
- package/src/ci/cli-record.ts +1 -1
- package/src/ci/gates.ts +31 -0
- package/src/ci/outcome.ts +6 -5
- package/src/ci/override.ts +11 -10
- package/src/ci/publish.ts +44 -103
- package/src/ci/reporter.ts +34 -5
- package/src/ci/review-levels.ts +21 -0
- package/src/ci/setup.ts +1 -2
- package/src/commands/ci-setup.ts +21 -18
- package/src/commands/init.ts +21 -12
- package/src/commands/post.ts +17 -0
- package/src/compare/loop.ts +356 -0
- package/src/compare/materiality.ts +266 -0
- package/src/compare/noise.ts +166 -0
- package/src/diversity/projection.ts +3 -0
- package/src/doctor.ts +48 -29
- package/src/index.ts +1 -1
- package/src/menu-context.ts +1 -1
- package/src/model/routing.ts +62 -0
- package/src/pr/admission.ts +13 -1
- package/src/pr/discovery.ts +17 -5
- package/src/pr/inline.ts +15 -1
- package/src/pr/plan.ts +5 -0
- package/src/pr/post-floor.ts +30 -0
- package/src/pr/posting.ts +4 -0
- package/src/pr/pr-status.ts +14 -0
- package/src/pr/pr.ts +50 -34
- package/src/pr/preflight.ts +2 -2
- package/src/pr/publish-outcome.ts +4 -0
- package/src/pr/review-pr.ts +65 -26
- package/src/pr/target.ts +16 -3
- package/src/pr/teardown.ts +1 -1
- package/src/rereview/prepare.ts +16 -0
- package/src/rereview/state.ts +206 -25
- package/src/review/boundary.ts +5 -1
- package/src/review/dedupe.ts +48 -4
- package/src/review/findings.ts +47 -1
- package/src/review/materiality-gate.ts +158 -0
- package/src/review/pipeline.ts +581 -56
- package/src/review/preflight.ts +201 -28
- package/src/review/prompt-set.ts +12 -8
- package/src/review/report.ts +73 -10
- package/src/review/review.ts +30 -5
- package/src/review/route-preflight.ts +29 -1
- package/src/review/run.ts +56 -18
- package/src/ui/config.ts +8 -0
- package/src/updater.ts +1 -1
- package/src/wizard.ts +35 -9
package/src/review/review.ts
CHANGED
|
@@ -32,12 +32,14 @@ import {
|
|
|
32
32
|
type CliOptions,
|
|
33
33
|
createRunDir,
|
|
34
34
|
emptyDiffMessage,
|
|
35
|
+
resolveMaterialityGate,
|
|
35
36
|
resolveMaxConcurrentSteps,
|
|
36
37
|
resolveSharedPrefix,
|
|
37
38
|
} from "#review/preflight";
|
|
38
39
|
import { estimateCost } from "#review/report";
|
|
39
40
|
import {
|
|
40
41
|
pipelineConsolidateInput,
|
|
42
|
+
pipelineMaterialityInput,
|
|
41
43
|
pipelineScoutInput,
|
|
42
44
|
pipelineSummarizerInput,
|
|
43
45
|
} from "#review/route-preflight";
|
|
@@ -47,12 +49,14 @@ import {
|
|
|
47
49
|
computeDiffStatAndSizeGate,
|
|
48
50
|
enforceCapabilityGate,
|
|
49
51
|
loadRunConfig,
|
|
52
|
+
NO_INSTRUCTIONS_NOTICE,
|
|
50
53
|
prepareRunnerForRoute,
|
|
51
|
-
resolveGotchasPath,
|
|
52
54
|
resolveParityFires,
|
|
53
55
|
resolvePipelineRoute,
|
|
54
56
|
resolvePromptSet,
|
|
57
|
+
resolveReviewInstructions,
|
|
55
58
|
selectActiveHunters,
|
|
59
|
+
shadowedGotchasNotice,
|
|
56
60
|
validateGotchas,
|
|
57
61
|
writeMcpConfig,
|
|
58
62
|
writeRunFindings,
|
|
@@ -149,16 +153,23 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
149
153
|
);
|
|
150
154
|
const { dir: agentsDir, source: agentsDirSource } = agents;
|
|
151
155
|
|
|
152
|
-
// 7 — gotchas. Checked HERE rather
|
|
153
|
-
// abort: the pipeline is right to
|
|
154
|
-
// zero-cost partial run, which reads like
|
|
156
|
+
// 7 — review instructions (REVIEW.md, else gotchas). Checked HERE rather
|
|
157
|
+
// than left to the pipeline's fail-loud abort: the pipeline is right to
|
|
158
|
+
// refuse, but all it can return is a zero-cost partial run, which reads like
|
|
159
|
+
// a clean review to a human. Neither file existing is allowed (the review
|
|
160
|
+
// runs with the default guidance); a present one must be real.
|
|
155
161
|
//
|
|
156
162
|
// `--gotchas` exists because requiring the file INSIDE the reviewed tree
|
|
157
163
|
// makes two legitimate cases impossible: reviewing a historical commit (the
|
|
158
164
|
// file would be an untracked addition, and the clean-tree gate rightly
|
|
159
165
|
// refuses), and reviewing a repo you do not control. The gotchas describe
|
|
160
166
|
// the repo, not the commit, so they do not belong to the checkout.
|
|
161
|
-
const
|
|
167
|
+
const instructions = resolveReviewInstructions(options.gotchas, repoRoot);
|
|
168
|
+
if (instructions.shadowed !== undefined) {
|
|
169
|
+
log(shadowedGotchasNotice(instructions.shadowed));
|
|
170
|
+
}
|
|
171
|
+
if (instructions.path === undefined) log(NO_INSTRUCTIONS_NOTICE);
|
|
172
|
+
const gotchasPath = instructions.path;
|
|
162
173
|
await validateGotchas(gotchasPath);
|
|
163
174
|
|
|
164
175
|
// 7.5 — `.prheroignore`, read from the WORKING TREE. Local review has no
|
|
@@ -238,6 +249,7 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
238
249
|
agentFiles,
|
|
239
250
|
routingConfig: config.routing,
|
|
240
251
|
summary,
|
|
252
|
+
materialityEnabled: resolveMaterialityGate(config),
|
|
241
253
|
});
|
|
242
254
|
const routePlan = productionRoute?.routePlan;
|
|
243
255
|
const productionAdmission = productionRoute?.productionAdmission;
|
|
@@ -355,6 +367,17 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
355
367
|
// same signal and refuses to start another attempt. Two controllers would
|
|
356
368
|
// leave the ceiling unable to stop the steps it is waiting on.
|
|
357
369
|
const ceilingController = new AbortController();
|
|
370
|
+
// Local mode has no PR, so the materiality judge reads the reviewed head's
|
|
371
|
+
// commit subject as the title (S9). Only asked for when the gate is on, so
|
|
372
|
+
// a run with it off spawns exactly the processes it always did. A failed
|
|
373
|
+
// read leaves it absent and the pipeline renders its fallback.
|
|
374
|
+
let prTitle: string | undefined;
|
|
375
|
+
if (resolveMaterialityGate(config)) {
|
|
376
|
+
const subject = await git(repoRoot, ["log", "-1", "--format=%s", headSha]);
|
|
377
|
+
if (subject.ok && subject.stdout.trim() !== "") {
|
|
378
|
+
prTitle = subject.stdout.trim();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
358
381
|
let productionRuntime: ProductionRuntime | undefined;
|
|
359
382
|
try {
|
|
360
383
|
const prepared = await prepareRunnerForRoute({
|
|
@@ -395,6 +418,8 @@ export async function review(options: CliOptions): Promise<number> {
|
|
|
395
418
|
...pipelineSummarizerInput(summary),
|
|
396
419
|
...pipelineScoutInput(options),
|
|
397
420
|
...pipelineConsolidateInput(),
|
|
421
|
+
...pipelineMaterialityInput(config),
|
|
422
|
+
...(prTitle === undefined ? {} : { prTitle }),
|
|
398
423
|
...(resolveSharedPrefix(options) ? { sharedPrefix: true } : {}),
|
|
399
424
|
...pipelineConfigInput(loaded),
|
|
400
425
|
...(routePlan === undefined ? {} : { routePlan }),
|
|
@@ -32,7 +32,12 @@ import {
|
|
|
32
32
|
} from "../transport-registry";
|
|
33
33
|
import type { OpenCodeSdkLike } from "../transports/opencode-client";
|
|
34
34
|
import { DEFAULT_CONSOLIDATE_MODEL, DEFAULT_SCOUT_MODEL } from "./pipeline";
|
|
35
|
-
import
|
|
35
|
+
import {
|
|
36
|
+
type CliOptions,
|
|
37
|
+
type ConfigLayer,
|
|
38
|
+
resolveMaterialityGate,
|
|
39
|
+
type SummarySettings,
|
|
40
|
+
} from "./preflight";
|
|
36
41
|
import { type ParsedAgent, parseAgentFile } from "./prompt-set";
|
|
37
42
|
import type { ReviewSpec } from "./spec";
|
|
38
43
|
|
|
@@ -85,6 +90,23 @@ export function pipelineConsolidateInput(): {
|
|
|
85
90
|
};
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
// The materiality gate (odd/tasks/materiality-gate.md) is ENGINE-owned like
|
|
94
|
+
// the consolidation pass but OFF by default: it is config-only
|
|
95
|
+
// (`materiality_gate`), and absent means today's pipeline, byte for byte. The
|
|
96
|
+
// judge's model is pinned inside the pipeline, so nothing but the prompt path
|
|
97
|
+
// travels here.
|
|
98
|
+
export function pipelineMaterialityInput(
|
|
99
|
+
config: Pick<ConfigLayer, "materiality_gate">,
|
|
100
|
+
): { materiality: { promptPath: string } } | Record<string, never> {
|
|
101
|
+
return resolveMaterialityGate(config)
|
|
102
|
+
? {
|
|
103
|
+
materiality: {
|
|
104
|
+
promptPath: resolveEngineAssets().materialityPromptPath,
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
: {};
|
|
108
|
+
}
|
|
109
|
+
|
|
88
110
|
export async function buildCliRoutePlan(params: {
|
|
89
111
|
spec: ReviewSpec;
|
|
90
112
|
options: CliOptions;
|
|
@@ -97,6 +119,9 @@ export async function buildCliRoutePlan(params: {
|
|
|
97
119
|
// that skips discovery passes false, the scout's condition, so the plan
|
|
98
120
|
// never carries a route for a step that will not run.
|
|
99
121
|
consolidateEnabled?: boolean;
|
|
122
|
+
// Defaults OFF, unlike consolidation: the gate is opt-in, and a judge key in
|
|
123
|
+
// the plan changes its fingerprint, so absent must mean today's plan.
|
|
124
|
+
materialityEnabled?: boolean;
|
|
100
125
|
}): Promise<ResolvedRoutePlan> {
|
|
101
126
|
const summarizerEnabled = params.summarizerEnabled ?? params.summary.enabled;
|
|
102
127
|
const scoutEnabled = params.scoutEnabled ?? params.options.scout;
|
|
@@ -165,6 +190,9 @@ export async function buildCliRoutePlan(params: {
|
|
|
165
190
|
},
|
|
166
191
|
}
|
|
167
192
|
: {}),
|
|
193
|
+
...(params.materialityEnabled === true
|
|
194
|
+
? { materiality: true as const }
|
|
195
|
+
: {}),
|
|
168
196
|
});
|
|
169
197
|
}
|
|
170
198
|
|
package/src/review/run.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// registerActiveRun and the try/finally around runPipeline stay call-site
|
|
15
15
|
// owned: their POSITION differs between the orchestrators, not their data.
|
|
16
16
|
|
|
17
|
+
import { existsSync } from "node:fs";
|
|
17
18
|
import path from "node:path";
|
|
18
19
|
import {
|
|
19
20
|
type EffectiveConfig,
|
|
@@ -154,33 +155,68 @@ export function assertDistinctRange(baseSha: string, headSha: string): void {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
// The
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
// it.
|
|
163
|
-
|
|
158
|
+
// The repository's review instructions (odd/tasks/review-md.md S2/S3). An
|
|
159
|
+
// explicit `--gotchas` flag always wins (resolved against cwd). Otherwise a
|
|
160
|
+
// root `REVIEW.md` — the format Claude Code Review reads — and only when it is
|
|
161
|
+
// absent `<root>/.crysk/gotchas.md` (or the legacy `.prhero/`). One file is
|
|
162
|
+
// effective, never both: a present REVIEW.md that is empty or still a scaffold
|
|
163
|
+
// is refused, it does not fall through to gotchas.md (the same rule the ignore
|
|
164
|
+
// file keeps, git.ts readBaseRefIgnoreRules). `shadowed` names a gotchas file
|
|
165
|
+
// REVIEW.md overrides, so the shells can say it is ignored instead of the
|
|
166
|
+
// hunters silently losing it. `path: undefined` means neither file exists:
|
|
167
|
+
// the review runs with the default guidance only. `root` is the caller's own
|
|
168
|
+
// root — repoRoot in review(), operatorRoot in reviewPr(), repoDir in
|
|
169
|
+
// doctor.ts — never resolved here.
|
|
170
|
+
export const REVIEW_MD_FILE_NAME = "REVIEW.md";
|
|
171
|
+
|
|
172
|
+
export interface ReviewInstructions {
|
|
173
|
+
path: string | undefined;
|
|
174
|
+
shadowed?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function resolveReviewInstructions(
|
|
164
178
|
flag: string | undefined,
|
|
165
179
|
root: string,
|
|
166
|
-
exists
|
|
167
|
-
):
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
180
|
+
exists: (p: string) => boolean = existsSync,
|
|
181
|
+
): ReviewInstructions {
|
|
182
|
+
if (flag !== undefined) return { path: path.resolve(flag) };
|
|
183
|
+
const reviewMd = path.join(root, REVIEW_MD_FILE_NAME);
|
|
184
|
+
const gotchas = path.join(resolveRepoDir(root, exists), "gotchas.md");
|
|
185
|
+
if (exists(reviewMd)) {
|
|
186
|
+
return exists(gotchas)
|
|
187
|
+
? { path: reviewMd, shadowed: gotchas }
|
|
188
|
+
: { path: reviewMd };
|
|
189
|
+
}
|
|
190
|
+
return { path: exists(gotchas) ? gotchas : undefined };
|
|
171
191
|
}
|
|
172
192
|
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
193
|
+
// The one line every shell prints when REVIEW.md shadows a gotchas file.
|
|
194
|
+
export function shadowedGotchasNotice(shadowed: string): string {
|
|
195
|
+
return `${path.basename(shadowed)} ignored: ${REVIEW_MD_FILE_NAME} takes precedence (${shadowed})`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// What every shell prints when the repo has no instructions file: the run
|
|
199
|
+
// still spends, so the absence must not be silent (a misnamed `review.md` or a
|
|
200
|
+
// file missing from the default branch would otherwise look like a normal run).
|
|
201
|
+
export const NO_INSTRUCTIONS_NOTICE = `no review instructions found (${REVIEW_MD_FILE_NAME} or .crysk/gotchas.md): reviewing with the default guidance only`;
|
|
202
|
+
|
|
203
|
+
// Byte-identical instructions read + validation in both orchestrators. Neither
|
|
204
|
+
// caller reads the text afterward (only the path goes on to the pipeline), so
|
|
205
|
+
// this validates and returns nothing. No path is the opt-out (S3) and passes;
|
|
206
|
+
// a path whose file is missing — only an explicit `--gotchas` can name one —
|
|
207
|
+
// reads as empty and is refused, as it always was.
|
|
208
|
+
export async function validateGotchas(
|
|
209
|
+
gotchasPath: string | undefined,
|
|
210
|
+
): Promise<void> {
|
|
211
|
+
if (gotchasPath === undefined) return;
|
|
177
212
|
const file = Bun.file(gotchasPath);
|
|
178
|
-
const
|
|
213
|
+
const present = await file.exists();
|
|
214
|
+
const gotchas = present ? await file.text() : "";
|
|
179
215
|
const unusable = gotchasUnusableReason(gotchas);
|
|
180
216
|
if (unusable !== undefined) {
|
|
181
217
|
// The class carries the gate's reason into cli.json (T2d-1). Both reasons render
|
|
182
218
|
// the one gotchas code today; the reason stays on the record for that reason only.
|
|
183
|
-
throw new CliError(gotchasErrorMessage(gotchasPath, unusable), {
|
|
219
|
+
throw new CliError(gotchasErrorMessage(gotchasPath, unusable, present), {
|
|
184
220
|
cls: { kind: "gotchas", reason: unusable },
|
|
185
221
|
});
|
|
186
222
|
}
|
|
@@ -461,6 +497,7 @@ export async function resolvePipelineRoute(params: {
|
|
|
461
497
|
summarizerEnabled?: boolean;
|
|
462
498
|
scoutEnabled?: boolean;
|
|
463
499
|
consolidateEnabled?: boolean;
|
|
500
|
+
materialityEnabled?: boolean;
|
|
464
501
|
}): Promise<ProductionRoutePlanResult | undefined> {
|
|
465
502
|
return resolveProductionRoutePlanAtConfirm({
|
|
466
503
|
routingConfigured: params.routingConfigured,
|
|
@@ -475,6 +512,7 @@ export async function resolvePipelineRoute(params: {
|
|
|
475
512
|
summarizerEnabled: params.summarizerEnabled,
|
|
476
513
|
scoutEnabled: params.scoutEnabled,
|
|
477
514
|
consolidateEnabled: params.consolidateEnabled,
|
|
515
|
+
materialityEnabled: params.materialityEnabled,
|
|
478
516
|
}),
|
|
479
517
|
});
|
|
480
518
|
}
|
package/src/ui/config.ts
CHANGED
|
@@ -179,7 +179,15 @@ export function configRows(
|
|
|
179
179
|
sources.max_changed_files,
|
|
180
180
|
),
|
|
181
181
|
scout: cell(effective.scout?.toString(), sources.scout),
|
|
182
|
+
materiality_gate: cell(
|
|
183
|
+
effective.materiality_gate?.toString(),
|
|
184
|
+
sources.materiality_gate,
|
|
185
|
+
),
|
|
182
186
|
post: cell(effective.post?.toString(), sources.post),
|
|
187
|
+
post_min_severity: cell(
|
|
188
|
+
effective.post_min_severity,
|
|
189
|
+
sources.post_min_severity,
|
|
190
|
+
),
|
|
183
191
|
ci_review_policy: cell(
|
|
184
192
|
effective.ci_review_policy,
|
|
185
193
|
sources.ci_review_policy,
|
package/src/updater.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function detectInstallMethod(
|
|
|
54
54
|
): InstallMethod {
|
|
55
55
|
const home = options.home ?? os.homedir();
|
|
56
56
|
const execPath = options.execPath ?? process.execPath;
|
|
57
|
-
const version = options.version ?? "0.3.
|
|
57
|
+
const version = options.version ?? "0.3.3";
|
|
58
58
|
const exists = options.exists ?? existsSync;
|
|
59
59
|
|
|
60
60
|
const isSource =
|
package/src/wizard.ts
CHANGED
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
GOTCHAS_PLACEHOLDER_MARKER,
|
|
6
6
|
initConfigTemplate,
|
|
7
7
|
initGitReminder,
|
|
8
|
-
|
|
8
|
+
REVIEW_MD_TEMPLATE,
|
|
9
9
|
} from "#review/preflight";
|
|
10
|
+
import { REVIEW_MD_FILE_NAME, resolveReviewInstructions } from "#review/run";
|
|
10
11
|
import {
|
|
11
12
|
type AgentEnvDetection,
|
|
12
13
|
detectAgentEnvironments,
|
|
@@ -82,6 +83,11 @@ export interface WizardState {
|
|
|
82
83
|
// The directory step 4 wrote into (.crysk, or a legacy .prhero updated in
|
|
83
84
|
// place), so the closing advice names a path that exists.
|
|
84
85
|
repoDirName?: string;
|
|
86
|
+
// The instructions file step 4 scaffolded or found (repo-relative), and
|
|
87
|
+
// whether this run wrote a root REVIEW.md — which the git reminder must
|
|
88
|
+
// name, since it is untracked outside the config dir.
|
|
89
|
+
instructionsFile?: string;
|
|
90
|
+
reviewMdWritten?: boolean;
|
|
85
91
|
// "this run wrote the PLACEHOLDER gotchas file" — the no-entries fallback
|
|
86
92
|
// branch, the only one that emits GOTCHAS_PLACEHOLDER_MARKER. Writing
|
|
87
93
|
// `gotchas.md` is not enough: with entries collected, the file written is
|
|
@@ -620,7 +626,16 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
620
626
|
|
|
621
627
|
const repoDir = resolveRepoDir(cwd, exists);
|
|
622
628
|
const configPath = path.join(repoDir, "config.json");
|
|
623
|
-
|
|
629
|
+
// REVIEW.md at the root unless the repo already has instructions: an
|
|
630
|
+
// existing gotchas file is the user's work, and a REVIEW.md written
|
|
631
|
+
// beside it would shadow it (odd/tasks/review-md.md S2/S7).
|
|
632
|
+
const existingInstructions = resolveReviewInstructions(
|
|
633
|
+
undefined,
|
|
634
|
+
cwd,
|
|
635
|
+
exists,
|
|
636
|
+
);
|
|
637
|
+
const gotchasPath =
|
|
638
|
+
existingInstructions.path ?? path.join(cwd, REVIEW_MD_FILE_NAME);
|
|
624
639
|
|
|
625
640
|
const isGit = await exec(["git", "rev-parse", "--is-inside-work-tree"], {
|
|
626
641
|
cwd,
|
|
@@ -633,6 +648,7 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
633
648
|
// one. These start false and are set by the branch that actually writes.
|
|
634
649
|
let workspaceFilesWritten = false;
|
|
635
650
|
let placeholderGotchasWritten = false;
|
|
651
|
+
let reviewMdWritten = false;
|
|
636
652
|
|
|
637
653
|
if (isRepo) {
|
|
638
654
|
// 1. Write <repo dir>/config.json if not present
|
|
@@ -644,15 +660,15 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
644
660
|
workspaceFilesWritten = true;
|
|
645
661
|
}
|
|
646
662
|
|
|
647
|
-
// 2. Write
|
|
663
|
+
// 2. Write the root REVIEW.md if the repo has no instructions yet
|
|
648
664
|
if (!exists(gotchasPath)) {
|
|
649
665
|
let gotchasContent: string;
|
|
650
666
|
if (state.gotchas.entries && state.gotchas.entries.length > 0) {
|
|
651
|
-
gotchasContent = `#
|
|
667
|
+
gotchasContent = `# Review instructions\n\n${state.gotchas.entries.map((e) => `- ${e}`).join("\n")}\n`;
|
|
652
668
|
} else {
|
|
653
669
|
// Shared with the gotchas gate (preflight.ts), so the gate still
|
|
654
670
|
// recognises this scaffold after its marker line is deleted.
|
|
655
|
-
gotchasContent =
|
|
671
|
+
gotchasContent = REVIEW_MD_TEMPLATE;
|
|
656
672
|
// Set HERE, in the branch that emits the marker, and nowhere
|
|
657
673
|
// else: it is the marker that makes step 5's placeholder warning
|
|
658
674
|
// true, so the flag is set by the code that writes the marker.
|
|
@@ -660,6 +676,7 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
660
676
|
}
|
|
661
677
|
await writeFile(gotchasPath, gotchasContent);
|
|
662
678
|
workspaceFilesWritten = true;
|
|
679
|
+
reviewMdWritten = existingInstructions.path === undefined;
|
|
663
680
|
}
|
|
664
681
|
}
|
|
665
682
|
|
|
@@ -675,6 +692,9 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
675
692
|
let workspaceCommitted = false;
|
|
676
693
|
if (isRepo && state.commitChoice === "commit") {
|
|
677
694
|
await exec(["git", "add", path.basename(repoDir)], { cwd });
|
|
695
|
+
if (exists(path.join(cwd, REVIEW_MD_FILE_NAME))) {
|
|
696
|
+
await exec(["git", "add", REVIEW_MD_FILE_NAME], { cwd });
|
|
697
|
+
}
|
|
678
698
|
const commitRes = await exec(
|
|
679
699
|
[
|
|
680
700
|
"git",
|
|
@@ -699,6 +719,8 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
699
719
|
return {
|
|
700
720
|
workspaceFilesWritten,
|
|
701
721
|
repoDirName: path.basename(repoDir),
|
|
722
|
+
instructionsFile: path.relative(cwd, gotchasPath),
|
|
723
|
+
reviewMdWritten,
|
|
702
724
|
placeholderGotchasWritten,
|
|
703
725
|
setupStateWritten: true,
|
|
704
726
|
workspaceCommitted,
|
|
@@ -710,10 +732,12 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
710
732
|
): string[] {
|
|
711
733
|
const lines: string[] = [];
|
|
712
734
|
const bold = (s: string) => (opts.styles ? `\x1b[1m${s}\x1b[0m` : s);
|
|
713
|
-
lines.push(
|
|
735
|
+
lines.push(
|
|
736
|
+
bold("Step 4/5: Workspace Configuration & Review Instructions"),
|
|
737
|
+
);
|
|
714
738
|
lines.push("");
|
|
715
739
|
lines.push(
|
|
716
|
-
" Scaffolding config.json
|
|
740
|
+
" Scaffolding config.json in .crysk/ (or the .prhero/ the repo already has) and a REVIEW.md, unless the repo already has review instructions",
|
|
717
741
|
);
|
|
718
742
|
return lines;
|
|
719
743
|
},
|
|
@@ -798,7 +822,9 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
798
822
|
lines.push("");
|
|
799
823
|
}
|
|
800
824
|
if (needsGitStep) {
|
|
801
|
-
lines.push(
|
|
825
|
+
lines.push(
|
|
826
|
+
` ${initGitReminder(repoDirName, state.reviewMdWritten === true)}`,
|
|
827
|
+
);
|
|
802
828
|
lines.push("");
|
|
803
829
|
}
|
|
804
830
|
if (needsGotchasStep) {
|
|
@@ -813,7 +839,7 @@ export const WIZARD_STEPS: readonly WizardStepDescriptor[] = [
|
|
|
813
839
|
// which is the same untestable-by-design trap this slice exists to
|
|
814
840
|
// remove.
|
|
815
841
|
lines.push(
|
|
816
|
-
` Write REAL
|
|
842
|
+
` Write REAL review instructions in ${state.instructionsFile ?? REVIEW_MD_FILE_NAME} — the one just ` +
|
|
817
843
|
"scaffolded is a placeholder, and Crysk refuses to review " +
|
|
818
844
|
`while its \`${GOTCHAS_PLACEHOLDER_MARKER}\` marker line is there.`,
|
|
819
845
|
);
|