Type to search pages and rules.

Browse pages

Initialize Consumer

Markdown

Name#

litespec init starts a consumer repository from a preset, a ready-made selection of shape, stacks, and frontends, or the records conformance level with no stacks.

Synopsis#

Shell
litespec init --preset <name> --size <small|large> [--root <path>] [--name <project>] [--help]

Description#

This command writes .litespec/project.json into the consumer root. It reads the consumer template and the named preset from the release the tool carries, overlays the preset's shape, stacks, and frontends, writes the conformance level when the preset declares one, and then writes the project size, name, and reviewedLiteSpecVersion. A preset that names no stacks or no frontends writes a project with none, so a server project with no frontend omits paths.frontends. It refuses to overwrite an existing project file.

It also copies the starting agent context, the glossary at .litespec/glossary.yaml, and the example cast at .litespec/example-cast.md into the LiteSpec folder, leaving existing files alone, and writes .litespec/.gitignore listing the generated model/ and book/ folders. A fresh AGENTS.md carries the ## LiteSpec block filled with the release, size, shape, stacks, and selection index of the new project. It writes .config/dotnet-tools.json pinning the LiteSpec.Cli tool at the release, leaving an existing tool manifest alone.

Five presets ship with the release:

PresetShapeStacksFrontend
dotnet-reactserverdotnet, reactweb at apps/web on react
dotnet-svelteserverdotnet, svelteweb at apps/web on svelte
blazor-clientclient-onlyblazorapp at apps/app on blazor
android-clientclient-onlyandroidandroid at apps/mobile/src/{name}.Android on android
recordsservernonenone

The records preset declares "conformance": "records" and names no stacks and no frontends, so the written project claims the records conformance level. Every other preset keeps the template conformance level, full. Every written project file validates against schemas/litespec-project.schema.json.

Run this command once in an empty folder, then run litespec model check to validate the new project.

Arguments#

None.

Options#

OptionDefaultEffect
--preset <name>requiredSelects the preset: android-client, blazor-client, dotnet-react, dotnet-svelte, or records.
--size <size>requiredSets the project size: small or large.
--root <path>the working directorySelects the consumer repository to write into.
--name <project>the root folder's nameSets the project name.
--helpoffPrints the synopsis, the options, and the exit codes, then exits zero.

Exit Codes#

CodeMeaning
0The project file was written.
1The release holds no readable template, preset, scaffold file, or version.
2The project file exists, the preset or size is invalid, or an option is unknown, repeated, or empty. A usage error is reported before --help is honoured.

Examples#

Start a small React consumer in a new folder:

Shell
litespec init --preset dotnet-react --size small --root ./shop

Start a large Blazor client and name the project:

Shell
litespec init --preset blazor-client --size large --name shop

Start a small records-only project with no stacks:

Shell
litespec init --preset records --size small --root ./shop

Underneath#

This command merges templates/consumer/project.json with templates/presets/<name>.json from the release the tool carries and writes the result. It copies the scaffold files from templates/consumer/, including the glossary as .litespec/glossary.yaml, the example cast as .litespec/example-cast.md, and .litespec/.gitignore. Nothing beneath it is separately runnable. Validate the written file with litespec model check.