From ec39ee7fc9cd3b82733b00247ff0116f2451309c Mon Sep 17 00:00:00 2001 From: contributor Date: Mon, 31 Aug 2026 13:31:41 +0300 Subject: [PATCH 1/2] feat: add `--validate` option to `show` command --- packages/cli/src/index.ts | 10 ++++++++-- packages/cli/src/show.ts | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 0a9ced4..f5f4942 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -5,7 +5,7 @@ import { z } from "zod"; import { runPrep } from "./prep.js"; import { WORKING_TREE_REF } from "./schema.js"; import type { DiffScopeOptions } from "./scope.js"; -import { show } from "./show.js"; +import { show, validate } from "./show.js"; const require = createRequire(import.meta.url); const { version } = require("../package.json") as { version: string }; @@ -28,6 +28,7 @@ interface DiffCommandOptions { ref?: string; pr?: string; instructions?: string; + validate?: boolean; } /** @@ -79,9 +80,14 @@ program .option("--base ", "Base ref to diff against (default: auto-detect main/master)") .option("--compare ", "Compare ref to diff against --base") .option("--pr ", "Review a GitHub pull request by number or URL") + .option("--validate", "Validate chapters without starting the server or opening the browser") .addOption(refOption) .action(async (jsonPath: string, refs: string[], opts: DiffCommandOptions) => { - await show(jsonPath, toDiffScopeOptions(refs, opts)); + if (opts.validate) { + await validate(jsonPath, toDiffScopeOptions(refs, opts)); + } else { + await show(jsonPath, toDiffScopeOptions(refs, opts)); + } }); program.parseAsync(process.argv).catch((err) => { diff --git a/packages/cli/src/show.ts b/packages/cli/src/show.ts index f713fd2..33d12b0 100644 --- a/packages/cli/src/show.ts +++ b/packages/cli/src/show.ts @@ -79,6 +79,10 @@ export async function show(jsonPath: string, options: DiffScopeOptions): Promise closeDb(); } +export async function validate(jsonPath: string, options: DiffScopeOptions): Promise { + await buildChaptersFile(jsonPath, options); +} + interface BuiltChaptersFile { chaptersFile: ChaptersFile; /** The reviewed PR's number when `--pr` was used, else null. */ From cdb763d4f3899315fe52fe7d06ab3ddf6ce34af6 Mon Sep 17 00:00:00 2001 From: contributor Date: Mon, 31 Aug 2026 11:25:33 +0300 Subject: [PATCH 2/2] docs: document `--validate` option in README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c099aa1..a5ed347 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ navigation. | `--compare ` | Compare ref to diff against `--base` | | `--ref ` | Diff scope: `work` (staged + unstaged + untracked), `staged`, or `unstaged` (default: auto-detect) | | `--pr ` | Review a GitHub pull request by number or URL (requires `gh`) | +| `--validate` | Validate chapters without starting the server or opening the browser | | `--instructions ` | One-off instructions for chapter generation (up to 1000 characters; `prep` command) | Examples: