Generate a Korean textbook from a local, reviewed concept pack. The CLI and GUI backend default to the deterministic mock provider and run offline. The bundled practice tasks are data; quiz answers can be graded by the local API.
Use Node.js 24. From the repository root, run npm ci once (requires a
primed npm cache or registry access), then run the following. Generation and
inspection work offline. The vault scanner currently requires Linux with
/proc/self/fd; generation without a vault does not.
npm run build
npm run study-builder -- --help
DEMO="$(mktemp -d)"
# Without a vault: unknown mastery, no evidence.
npm run study-builder -- generate --topic msa --out "$DEMO/beginner"
npm run study-builder -- inspect "$DEMO/beginner"
# With the read-only, synthetic Spring-student fixture: compare section mastery.
npm run study-builder -- generate --topic msa --out "$DEMO/student" --vault fixtures/vault-backend-student
npm run study-builder -- inspect "$DEMO/student"
# Prepare a reader copy and check the proposed destination in the synthetic vault.
npm run study-builder -- export-preview --out "$DEMO/student" --vault fixtures/vault-backend-student
# Recheck and reuse the same book. Repeat the original topic and vault flags.
npm run study-builder -- generate --topic msa --out "$DEMO/student" --vault fixtures/vault-backend-student --resumeThe default --provider mock stays fully offline. --provider http or
--provider codex needs --model, and a vault run also needs
--share-profile or the command exits 2 with PROFILE_CONSENT_REQUIRED
before any outbound call.
Generation prints the absolute path to OUT/bundle/manifest.json on success.
inspect checks the recorded publication receipt, bundle structure and resource hashes and prints each
chapter’s title, mastery, quiz item count and exercise count, plus section
mastery. Markdown, quizzes and public exercises are under bundle/; private
job status, stage checkpoints and hidden practice cases are under .study/.
export-preview --out OUT prints the path to OUT/export-preview/index.md.
Copy the entire export-preview/ folder to read the chapters, quizzes and public
exercises offline. The pack omits note references, quiz keys and hidden practice
cases. With the optional fixture selector, the CLI also lists the proposed vault
directory, chapter filenames and collisions. The vault stays read-only.
Repeated previews reuse an identical pack. Replacing an edited pack uses GNU
/usr/bin/mv --exchange on a filesystem that supports atomic directory exchange.
The synthetic fixture yields a brief REST recap, a review of data ownership, and full lessons for unknown concepts. The book and quizzes use a fictional loan-service scenario; filenames and note prose are not prompt inputs. Keep OUT local: chapter and section evidence contains relative note paths, concept IDs and reasons, not excerpts. Only the bundled synthetic fixture is accepted by the CLI/API in this release; do not point them at personal notes. The CLI demo publishes automatically. Jobs created through the local HTTP API pause for outline approval by default and can also request approval before publication.
Use a fresh or empty OUT for generation. A successful resume makes no provider
calls. A damaged or incompatible published book is refused rather than
overwritten. S11-era books remain inspectable, but regenerate them in a fresh
OUT: resume requires a matching pipeline recipe. Exit codes: 0 success, 2 usage/input/path or
incompatible output, 3 pipeline or I/O failure, 4 verification blocked.
For a different topic, supply its reviewed pack explicitly, for example:
npm run study-builder -- generate --topic colors --sources fixtures/packs/colors.v1.json --out "$DEMO/colors"npm run study-builder -- serve --port 4317The server listens on 127.0.0.1 and accepts the Vite origins
http://localhost:5173 and http://127.0.0.1:5173.
The default server accepts only mock jobs. To enable an HTTP provider, configure a
model and a compatible API base URL, for example:
npm run study-builder -- serve --provider http --model your-model --base-url http://127.0.0.1:8080/v1HTTP accepts --base-url or STUDY_BUILDER_BASE_URL and takes an optional bearer key
from the process environment variable STUDY_BUILDER_API_KEY. Use HTTPS for a remote
endpoint or HTTP for loopback. Jobs still use mock by default. A job requesting
"provider":"http" uses the configured model. An explicit job model must match it.
Live jobs using the fixture vault also require "shareProfile":true.
To enable Codex, supply the verified capabilities for the installed executable and
model. The deployment profile is JSON with executable (absolute path), model,
and capabilities. Under capabilities, list the verified flags, configOverrides,
sandboxModes (including read-only), and approvalPolicies (including never).
Set noTools to true only after verifying that the fixed invocation disables all
tools and loads no user or project hooks. To inspect the flags and configuration
assignments the adapter requires, run:
node --input-type=module -e 'import { CODEX_REQUIRED_FLAGS as flags, CODEX_CONFIG_OVERRIDES as configOverrides } from "@study-builder/core"; console.log(JSON.stringify({ flags, configOverrides }, null, 2))'For a deployment verified for your-model, start the server with its profile:
STUDY_BUILDER_CODEX_CONFIG="$(cat /opt/study-builder/verified-codex.json)" \
npm run study-builder -- serve --provider codex --model your-modelA job can then request "provider":"codex". Invalid startup options exit with code
2 and a diagnostic on stderr. API requests for disabled providers or a
different model receive HTTP 400 INVALID_REQUEST.
For setup and endpoints, see the web GUI guide and
local API contract.
See the operator guide for the offline release check, expected book contents and CLI failure codes.
npm run typecheck
npm test