CLI Commands
The builder binary is the user-facing entry point of Project Builder: it parses commands, validates input, and orchestrates schematic engines. This page catalogs every registered command. If you have not installed the CLI yet, start with the installation guide.
Run builder --help for the top-level listing, or builder <command> --help for command-specific usage. builder --version prints the binary version.
Command summary
Section titled “Command summary”| Command | Aliases | Status | Purpose |
|---|---|---|---|
builder init |
— | Available | Initialise a Project Builder workspace in the current repository |
builder execute |
e, g, generate |
Available | Execute a schematic against an existing project workspace |
builder new schematic |
s |
Available | Create a new schematic in the workspace |
builder new collection |
c |
Available | Create a new collection in the workspace |
builder info |
— | Available | Inspect the project’s registered collections and schematics |
builder describe |
— | Available | Set the title, jobs, keywords and description a generator is chosen by |
builder selection shortlist |
— | Available | List the local generators that cover at least one of a goal’s jobs |
builder add |
— | Not implemented | Add a new artefact to an existing project workspace |
builder remove |
— | Not implemented | Remove a generated artefact from the project workspace |
builder sync |
— | Available | Resolve what the Manifest declares and write the Lock |
builder validate |
— | Available | Check that the workspace is aligned with its schematics |
builder skill update |
— | Not implemented | Update registered skills and extensions to their latest versions |
Global flags
Section titled “Global flags”These persistent flags are accepted by every command:
| Flag | Values | Effect |
|---|---|---|
--output |
pretty, json |
Output format: pretty (human-readable) or json, one {result, error, warnings} envelope on stdout for CI, pipes and AI agents. Default: auto-detect from terminal. |
--theme |
light, dark, auto |
Terminal color scheme. Default auto, resolved from the BUILDER_THEME environment variable or terminal detection. |
--verbose |
boolean | Print full diagnostic output (sanitised) for subprocess/engine failures and enable debug-level log lines (text mode only). |
--help |
boolean | Show help for the command. |
--version |
boolean | Print the CLI version (root command only). |
Boolean flag conventions: --flag means true, --no-flag means false, and --flag=value sets the explicit value.
See CLI output and errors for how --output, --theme, and --verbose shape what the CLI prints, and for the exit-code contract.
builder init
Section titled “builder init”Bootstraps a Project Builder workspace in an existing repository. It runs in the CLI only and does not call any schematic engine.
Synopsis
Section titled “Synopsis”builder init [directory] [flags]directory is optional. When omitted, init operates on the current working directory. The chosen directory is taken literally: init does not climb the filesystem looking for .git or package.json.
What it does
Section titled “What it does”A successful init produces:
project-builder.jsonat the project root, the workspace anchor file (schema v1,$schemapointed at the locally-installed SDK package).schematics/.gitkeep, a skeleton folder for local schematic authoring (later filled in bybuilder new schematic)..claude/skills/pbuilder/, the bundled AI skill artefact set:SKILL.md(router) plususe.md,choose.md,create.md.- A fenced reference block in
AGENTS.md(preferred) orCLAUDE.md, idempotent and line-exact. package.jsonsetup:devDependencies["@pbuilder/sdk"]and ascripts["generate:types"]entry, each added only when its key is missing. Seepackage.jsonedits.
After the writes, init invokes your detected package manager to install the SDK (with a 120-second timeout), unless --no-install, --no-sdk-dependency or --no-skill is set. init never prompts unless you pass --interactive: with it, on a terminal and with --mcp unset, it asks about MCP server setup, and an affirmative reply prints setup instructions.
The outputs are written in the order above. If a later step fails, earlier outputs stay on disk, because there is no whole-init rollback. Fix the cause and re-run with --force.
package.json edits
Section titled “package.json edits”init adds two entries to package.json:
| Entry | Value |
|---|---|
devDependencies["@pbuilder/sdk"] |
>=0.1.0 |
scripts["generate:types"] |
A shell loop that runs pbuilder-codegen once for every schema.json under schematics/, skipping files/ template trees |
The edit is additive and lossless:
- Only missing keys are added. An SDK version you already pinned, or your own
generate:typesscript, is never overwritten. - Existing bytes are kept. New entries are inserted into the file as it is: indentation, tabs, CRLF line endings and key order elsewhere stay untouched, and the inserted lines follow the surrounding style. When
package.jsondoes not exist,initcreates a minimal one. - Nothing to add means identical content. When both entries already exist, the file content stays byte-identical.
initstill writes the file, so do not rely on it being untouched on disk (for example, its modification time). - With no entry requested,
package.jsonis not touched at all. Under--no-sdk-dependency(with its inherited--skip-types-script) or--no-skill,initdoes not read, create or write it.
init validates the fields it is about to edit:
- A
devDependenciesorscriptsfield that is present but is not an object of strings (including"scripts": null) is invalid, not an empty map.initstops withinvalid_input(package.json scripts field is not a valid string map) and leavespackage.jsonunchanged. Repair the field and re-run. Each field is checked only when its entry is requested. - A
package.jsonthat is not valid JSON fails the same way. - A document whose root is
nullis treated as an empty object.
These guarantees cover the CLI’s own edit. The install step that follows, and any install you run later, is your package manager’s, and it can rewrite package.json and the lockfile itself. Use --no-install to separate the two.
| Flag | Effect |
|---|---|
--force |
Re-run on an existing project: project-builder.json is read-merged (collections, externals, dialects, settings, and unknown keys preserved; a dependencies key is moved to externals), while the skill artefact set and marker block are regenerated. |
--dry-run |
Preview every planned operation without writing any files. |
--json |
Same as --output=json: prints the JSON envelope. Combines with --dry-run for a full structured plan. |
--interactive |
Ask about MCP setup when --mcp is not given. Needs a terminal; without one, init asks nothing. |
--non-interactive |
Deprecated. init is non-interactive by default, so the flag only prints the warn_non_interactive_deprecated warning. It cannot be combined with --interactive. |
--package-manager=<npm|pnpm|yarn|bun> |
Override package-manager detection. Default: lockfile sniff (pnpm > yarn > bun > npm) with npm as fallback. |
--no-install |
Skip the package-manager install step only. The requested package.json entries are still added; run the install manually later. |
--no-sdk-dependency |
Do not add @pbuilder/sdk to devDependencies and do not run the install step. Existing entries are preserved, never removed. Its value is also the default for --skip-types-script. See Evaluate without adopting the SDK. |
--skip-types-script |
Do not add the generate:types script. When omitted, it takes the value of --no-sdk-dependency; an explicit value, such as --skip-types-script=false, always wins. |
--no-skill |
Skip the skill artefact set, the AGENTS/CLAUDE reference block, all package.json setup, the install step and MCP setup. Use when you want only project-builder.json + schematics/. |
--mcp=<yes|no|prompt> |
Control the MCP setup prompt. Default: prompt with --interactive on a terminal, otherwise no. --mcp=prompt asks by itself and needs a terminal: without one, init fails with init_prompt_needs_terminal. |
--publishable |
Reserved. It currently returns the init_not_implemented error. |
Package setup flags
Section titled “Package setup flags”--no-sdk-dependency and --skip-types-script decide what init asks of package.json. The table assumes a real run without --no-install or --no-skill; “add” means add when the key is missing.
--no-sdk-dependency |
--skip-types-script |
Add @pbuilder/sdk |
Add generate:types |
Run install |
|---|---|---|---|---|
omitted / false |
omitted / false |
Yes | Yes | Yes |
omitted / false |
true |
Yes | No | Yes |
true |
omitted / true |
No | No | No |
true |
false |
No | Yes | No |
--no-sdk-dependency=false keeps the normal SDK setup, and --skip-types-script=false overrides the inherited default. This applies to these two init flags only. It is not a general rule that one --no- flag negates another. --no-install removes only the install step from any row, and --no-skill skips every column.
When --no-sdk-dependency is set, init prints a warning with the ways to provide an SDK: use one already at node_modules/@pbuilder/sdk, or install it locally with your package manager.
With --dry-run, init writes nothing and installs nothing:
- It reads the real
package.jsononly when an entry is requested, and lists only the entries that are actually missing (for exampleWould modify: package.json (generate:types)), plus the install step when it would run. Invalid fields fail the preview the same way they fail a real run. - The skill artefact set and the agent marker always appear as planned creates/appends, whatever already exists on disk. Treat them as a plan: the real run may differ.
Examples
Section titled “Examples”# Standard init — project-builder.json + schematics/ + skill artefact set +# AGENTS/CLAUDE marker + npm install + prompt for MCP setupbuilder init
# Init a sibling directorybuilder init ./my-new-workspace
# Preview the full plan as JSON (no writes, no subprocess)builder init --dry-run --json /tmp/preview
# CI / AI agent flow — JSON output, explicit PM, no MCP (init never prompts by default)builder init --json --package-manager=pnpm --mcp=no .
# Ask about MCP setup on a terminalbuilder init --interactive
# Skip install (you'll run it manually later)builder init --no-install
# Minimal init — only project-builder.json + schematics/ (no SKILL, no SDK)builder init --no-skill
# Evaluate without declaring the SDK — no SDK entry, no generate:types, no installbuilder init --no-sdk-dependency
# Same, but keep a generate:types entrybuilder init --no-sdk-dependency --skip-types-script=false
# Adopt the SDK without adding generate:typesbuilder init --skip-types-script
# Force re-init over an existing workspacebuilder init --forcebuilder execute
Section titled “builder execute”Runs a named schematic against a project workspace. Aliases: e, g, generate.
Synopsis
Section titled “Synopsis”builder execute [CLI flags] <collection>:<schematic> [schematic flags]Provide the schematic as <collection>:<schematic> (for example @schematics/angular:component). The collection must be registered in project-builder.json: the one in the working directory (created by builder init), or the one named by --manifest.
What it does
Section titled “What it does”execute validates the workspace (project-builder.json must exist in the working directory, or in the directory named by --manifest), resolves the collection and schematic across all registration shapes, validates your inputs against the schematic’s schema.json, and then runs the schematic through the engine, streaming its events to the terminal. When the run ends, it reports every operation grouped by class, followed by a summary that counts each class; see Output formats for the text layout and the JSON plan and changes arrays.
From v0.20.0, execute also hands the engine every schematic of every collection the Manifest defines, as path entries or through a collection.json, so a schematic can run another one with invoke. Inline entries and schematics the CLI cannot resolve are left out, and invoking one fails as an unknown schematic of its collection. Externals are not invocable. An invoked evaluation schematic runs read-only. See Invoke another schematic.
SDK requirement
Section titled “SDK requirement”execute runs the schematic against the @pbuilder/sdk installed at node_modules/@pbuilder/sdk in the workspace, or against an SDK outside the project (see SDK source). A declaration in package.json does not install anything: the package must be present, complete and readable. Declaring it is not required; see Evaluate without adopting the SDK.
Before it inspects the installation, execute selects a version requirement from the first of these sources that is present:
package.json→devDependencies["@pbuilder/sdk"]package.json→dependencies["@pbuilder/sdk"]project-builder.json→sdk.version- None present:
0.2.4, the oldest SDK the CLI is tested against. It is not a guarantee that every newer SDK works.
The requirement is read as npm reads a version range. A bare version such as 0.2.4 is a floor; a range of >=, >, <=, <, =, ^ or ~ comparators is honoured as written, so ^0.15.0 accepts 0.15.x and refuses 0.16.0 (sdk_version_above_ceiling). The >=0.1.0 entry that builder init adds accepts any version from 0.1.0 up. A protocol prefix such as workspace: or npm: is refused with sdk_requirement_invalid.
The selected value must be valid. An invalid value fails with sdk_requirement_invalid, and the CLI does not fall back to a lower-priority source. Once a source is selected, the sources below it are not read. See SDK diagnostics.
To declare a requirement without adding a dependency, set it in project-builder.json:
{ "sdk": { "version": "0.2.4" }}init never writes this block, and the top-level dependencies key in project-builder.json plays no part in SDK selection.
The SDK and the CLI must also fit each other. @pbuilder/sdk 0.24.0 sends frames of up to 64 MiB to the engine, and engines older than v0.16.0, shipped before CLI v0.24.0, cap a frame at 4 MiB and reject a larger one. Run SDK 0.24.0 with CLI v0.24.0 or later. The same engine serves reads of up to 8 MiB per file; see Files over the read cap.
From v0.22.0, when the installed SDK is 0.20.0 or later, execute and validate hand a generator root its qualified name, collection:schematic, as the request addressed it. With SDK 0.23.0 or later, the runner then names a failing factory whose package lies outside the workspace as factory <collection:schematic> instead of by a path of the machine. Older SDKs get no name and run as before.
SDK source
Section titled “SDK source”execute takes the SDK from the first of these sources that is set:
--sdk-root=<dir>- The
BUILDER_SDK_ROOTenvironment variable sdk.rootin the working directory’sproject-builder.json- The workspace’s installed
node_modules/@pbuilder/sdk
A source that is set but names an unusable directory fails the run: execute never falls back to a lower source. The first three name an SDK outside the project and share the same validation, the same link and the same diagnostics, described under sdk.root below. The version requirement applies to all four.
External SDK root (sdk.root)
Section titled “External SDK root (sdk.root)”sdk.root runs schematics against an @pbuilder/sdk that lives outside the project, typically a global install, without installing it into the project or editing package.json:
{ "sdk": { "root": "/Users/me/.bun/install/global/node_modules/@pbuilder/sdk" }}An absolute path is used as is; a relative path resolves against the directory that holds project-builder.json. The path is canonicalised, so symbolic links in it are resolved. The value is checked when execute or new schematic runs, not when the configuration is read. For setup, the link execute creates and how to undo it, see Use an external SDK root.
What the root must be. The @pbuilder/sdk package directory itself, as a global install lays it out (~/.bun/install/global/node_modules/@pbuilder/sdk for bun add -g, <npm root -g>/@pbuilder/sdk for npm install -g). Before linking anything, execute validates the root:
- Identity: its
package.jsonname is@pbuilder/sdk. - Distribution:
dist/runner-manifest.jsonis present, names an entry and a files list, and the entry and every listed file exist under the root. SDK 0.15.x moved its files, so it needs CLI v0.12.1 or later; v0.12.0 refuses it withsdk_root_dist_incomplete. Before each runner starts, the engine also compares every listed file with the SHA-256 digest the runner manifest gives; a file that differs, is missing or is a symbolic link fails the run before any factory runs, and the error does not name the file. - Version: the installed version meets the SDK requirement, selected exactly as for a local install.
- Dependencies: the SDK’s own runtime dependencies resolve from a
node_modulesat or above the root. A package-manager cache directory does not qualify. The workspace’s own install goes through the same check. - Permissions: the root is not writable by its group or by other users, no directory above it is world-writable without the sticky bit, and the root and its ancestors are owned by you or by root. A directory above the root that is only group-writable does not fail the run: it emits the
warn_sdk_root_group_writablewarning and execution continues.
The link. When the run commits, execute creates exactly one entry: node_modules/@pbuilder/sdk, a symbolic link to the canonical root. Runs that do not commit (--dry-run or --commit=never) never create or repoint it; see Dry run. A real node_modules/@pbuilder/sdk that differs from the root fails with execute_sdk_link_path_conflict, and deleting sdk.root leaves the link in place, so the next run fails with execute_manifest_path_escape until you delete it.
builder new schematic resolves the SDK root the way execute does, with no prior execute and no link. It validates the root the same way, except for the version requirement, which only execute enforces. A root that is given but refused fails the command with new_sdk_codegen_undeclared before any file is written; only when no SDK root is present at all does it write the scaffold, warn and skip schema.generated.ts. See builder new schematic.
builder info ignores sdk.root, valid or not.
Messages never contain the path. No error, warning, suggestion or JSON field includes the configured root’s filesystem path. Locations are described relative to the root: “the configured root itself”, “1 level above the root”, “N levels above the root”.
Regenerating types by hand. No package manager installed anything, so there is no node_modules/.bin/pbuilder-codegen shim. See Type generation with sdk.root.
Every error code and reason is listed in SDK diagnostics.
--sdk-root and BUILDER_SDK_ROOT
Section titled “--sdk-root and BUILDER_SDK_ROOT”--sdk-root=<dir> names an external SDK root for one run without touching project-builder.json. The BUILDER_SDK_ROOT environment variable does the same for every run; the flag always wins over it. They name the same directory as sdk.root and go through the same validation, the same link and the same diagnostics. The how-to walks through the three sources and their precedence.
- Value. Absolute, or relative to the working directory, not to
project-builder.json.~is not expanded by the CLI: a shell expands it when you assign the variable, but a value quoted in the shell or written into an editor or agent settings file stays literal and fails withsdk_root_unresolvable. - Local paths only. A value that starts with a URL scheme or a drive letter fails with
sdk_root_unsupported_schemebefore the filesystem is touched. - Empty values. An empty
BUILDER_SDK_ROOTcounts as unset. An empty--sdk-root=fails withsdk_root_value_invalid. - Placement.
executeandnew schematic. Onexecute, put it before<collection>:<schematic>; after the positional it is rejected (invalid_input), never passed to the schematic.inforeads neither the flag nor the variable. - With
--manifest. Both work together. An external manifest’s ownsdkblock stays ignored whichever source supplies the SDK, withwarn_manifest_sdk_root_ignoredwhen it declaressdk.root. - Announcement. A root that came from
BUILDER_SDK_ROOTprintswarn_sdk_root_ambient, which names the variable but never the path; a root from--sdk-rootis not announced. To see which SDK ran, runreadlink node_modules/@pbuilder/sdk. - Messages. The
sdk_root_*reasons ofsdk.rootapply unchanged, and each message names the source that supplied the value:--sdk-root,BUILDER_SDK_ROOTorsdk.root. - Stopping. Unsetting the variable, or dropping the flag, does not remove the link; delete it as described in Use an external SDK root.
Passing inputs to the schematic
Section titled “Passing inputs to the schematic”Everything after the <collection>:<schematic> positional argument is treated as a raw schematic flag, not a CLI flag. Global flags such as --output and --theme must therefore be placed before the positional argument.
Schematic flag tokens follow these rules:
--name=value: string input; the value is kept verbatim (an=inside the value is not re-split).--name: boolean input set totrue.--no-name: boolean input set tofalse.- Tokens that do not start with
--(bare words, single-dash flags) are skipped with a warning. - Duplicate flag names are preserved in order, with a warning.
External manifest (--manifest)
Section titled “External manifest (--manifest)”--manifest=<path> reads project-builder.json, collections, factories, schemas and templates from another directory on this machine, while generated files are still written to the working directory. The BUILDER_MANIFEST environment variable does the same; the flag always wins over it. See External collections for the full workflow.
- Value. A directory or its
project-builder.json, absolute or relative to the working directory, canonicalised once. Local paths only: URL schemes and drive letters are rejected. Naming the working directory is the same as omitting the flag. - Placement. Put it before
<collection>:<schematic>. After the positional it is rejected (invalid_input), never passed to the schematic. - Trust. The root, and every directory above it, must not be writable by other users or by a group (a world-writable ancestor with the sticky bit is allowed), and must be owned by you or by root. The filesystem root and your home directory itself are refused.
- Paths in the manifest must be relative to the manifest root and stay inside it.
- SDK. The run uses the working directory’s own
@pbuilder/sdk, installed in a realnode_modulesor named with--sdk-rootorBUILDER_SDK_ROOT. The manifest root and its ancestors must not contain another@pbuilder/sdkcopy, or the run fails with a split module graph.sdk.rootandsdk.versionin the external manifest are ignored. - Warnings. A root that came from
BUILDER_MANIFESTis announced withwarn_manifest_root_ambient; an ignored externalsdk.rootwithwarn_manifest_sdk_root_ignored.
Dry run
Section titled “Dry run”--dry-run (or --commit=never) runs the schematic, prints its plan, every operation it would apply grouped by class, and writes nothing to the workspace. It prints the warn_dry_run warning. It works in a fresh checkout or worktree that has no node_modules/@pbuilder/sdk link: the engine loads the SDK from the chosen root’s own install, and the dry run never creates or repoints the link.
If the workspace already has a node_modules/@pbuilder/sdk link on the schematic’s resolution path and it points at a different SDK than the one chosen, the dry run fails with execute_dry_run_sdk_link_stale (exit 4) and leaves the link as it is. Run without --dry-run, which repoints the link, or delete the link and run the dry run again.
The output does not yet say which SDK version or source the dry run used.
Prompts (--interactive)
Section titled “Prompts (--interactive)”execute never prompts unless you pass --interactive before <collection>:<schematic>. With it, before the run, execute asks for each input in the schematic’s schema.json that no flag gave and that has no default, in alphabetical order of input name. Without a terminal it asks nothing: if an input would be asked for, it fails with execute_interactive_needs_terminal and names those inputs. A schematic input named manifest, sdk-root or interactive cannot be passed after the positional, because those names are execute’s own options.
| Flag | Effect |
|---|---|
--manifest=<path> |
Read the manifest, collections and schematics from this directory (or its project-builder.json) instead of the working directory. Must precede <collection>:<schematic>. See External manifest. |
--sdk-root=<dir> |
Run against the @pbuilder/sdk in this directory instead of the workspace’s installed SDK or sdk.root. Also read from BUILDER_SDK_ROOT; the flag wins. Must precede <collection>:<schematic>. See --sdk-root and BUILDER_SDK_ROOT. |
--commit=<never|always> |
Write mode. Default always. Any other value is rejected. |
--dry-run |
Alias for --commit=never: list the planned changes, write nothing. See Dry run. Setting --dry-run together with a disagreeing --commit value is an error. |
--interactive |
Prompt, before the run, for the schema inputs no flag gave and that have no default. Needs a terminal. Must precede <collection>:<schematic>. See Prompts. |
--non-interactive |
Deprecated. execute is non-interactive by default, so the flag only prints a warning. |
--strict |
Reserved and not yet implemented; emits a warning if set. |
--force |
Reserved and not yet implemented; emits a warning if set. |
--auto-install |
Reserved and not yet implemented; emits a warning if set. |
Place CLI flags before <collection>:<schematic>. After the positional, --dry-run is rejected with invalid_input (flag --dry-run is a reserved global option and cannot be used as a schematic flag).
Examples
Section titled “Examples”# Run a schematic from the default collection with a string inputbuilder execute default:my-component --name=button
# Alias form, boolean and negated inputsbuilder g default:my-component --standalone --no-tests
# Global flags go BEFORE the positional; schematic flags go afterbuilder --output=json execute default:my-component --name=button
# Preview: list the planned changes, write nothingbuilder execute --dry-run default:my-component --name=button
# Prompt on a terminal for required inputs that no flag gavebuilder execute --interactive default:my-component
# Run a schematic registered in another checkout; files land in the working directorybuilder execute --manifest=../app-schematics default:my-component --name=button
# Same, against a globally installed SDK instead of one in node_modulesbuilder execute --manifest=../app-schematics --sdk-root=/Users/me/.bun/install/global/node_modules/@pbuilder/sdk default:my-component --name=buttonbuilder new schematic
Section titled “builder new schematic”Scaffolds a new schematic with factory and schema files. Alias: s. Operates on the workspace anchored by project-builder.json. It runs in the CLI only and does not call any engine.
Synopsis
Section titled “Synopsis”builder new schematic <name> --title <title> --job <job> [flags]builder new s <name> --title <title> --job <job> [flags]<name> is mandatory and validated against shell metacharacters, path separators, null bytes, and reserved characters.
From v0.21.0, new schematic creates a generator, so it also requires --title and at least one --job: they are what a schematic is chosen by. Without both it refuses with new_selection_metadata_invalid and writes nothing. The values go in the schematic’s entry in the Collection definition, trimmed and with whitespace collapsed. An empty value, or two jobs or two keywords equal after lowercasing, trimming and collapsing whitespace, is refused the same way. See Selection metadata.
What it does
Section titled “What it does”Two modes, controlled by --inline.
Path mode (default) produces 4 outputs:
schematics/<name>/factory.{ts,js}: factory stub (TypeScript or JavaScript depending on language detection). The stub is a default export: path-mode execute resolvesfactory.{ts,js}#defaultby convention.schematics/<name>/schema.json: canonical v1 shape{"properties": {}}. From v0.21.0 it carries nodescription, which lives in the registration entry.schematics/<name>/schema.generated.ts: auto-generated TypeScript interface fromschema.json’sproperties(regardless of--language). Skipped with a warning only when no SDK root is present at all.project-builder.json: addscollections.default.<name>: { "path": "./schematics/<name>", "title": "…", "jobs": ["…"] }, pluskeywordsanddescriptionwhen given.
Inline mode (--inline) embeds the schematic directly inside project-builder.json under collections.default.schematics.<name>; no schematics/<name>/ files are created. Soft warnings fire when a collection accumulates 10 or more inline schematics, or when project-builder.json exceeds 20KB after the write.
Type generation is delegated to pbuilder-codegen, which ships inside @pbuilder/sdk. new schematic takes the SDK root from the first of --sdk-root, BUILDER_SDK_ROOT, sdk.root and the workspace’s install, and checks it the way execute does. It runs the file the root’s package.json declares as bin.pbuilder-codegen, with a Node.js (from PATH or NODE_BINARY) that satisfies the root’s engines.node; the CLI holds no codegen path and no Node.js floor of its own.
Failures are strict. A root that is given but refused, or that does not declare bin.pbuilder-codegen (a file under the root) and engines.node, fails with new_sdk_codegen_undeclared; a Node.js outside the engines.node range fails with new_node_unsupported. Both fail before any file is written. Only when no SDK root is present at all does the codegen step skip with a warning (warn_codegen_sdk_missing) and leave schema.generated.ts stale or absent. To regenerate types later, for one schematic or every registered collection, see Type generation.
new schematic has no --role flag yet (cli_unknown_flag). To create an evaluation schematic, add "role": "evaluation" to its entry in project-builder.json and run codegen again; see Write an evaluation schematic.
| Flag | Effect |
|---|---|
--title=<title> |
One-line title the schematic is chosen by. Required from v0.21.0. |
--job=<job> |
A job the schematic does, as a verb plus an object. Repeat the flag for each job; at least one is required from v0.21.0. |
--keyword=<keyword> |
A term that helps find the schematic. Repeat the flag for each keyword. Optional. |
--description=<text> |
What the schematic does, for whoever chooses it. Optional. |
--force |
Overwrite an existing schematic of the same name. |
--dry-run |
Preview planned operations without writing any files. |
--inline |
Embed the schematic definition in project-builder.json instead of creating standalone files. |
--language=<ts|js> |
Force TypeScript or JavaScript factory. Auto-detect default: TS if devDependencies.typescript or tsconfig.json exists; falls back to TS with a warning otherwise. |
--extends=<@scope/pkg:base> |
Declare a base schematic this one extends. Grammar enforced (@scope/pkg:collection); path traversal rejected. |
--sdk-root=<dir> |
Name the SDK root codegen uses, ahead of BUILDER_SDK_ROOT, sdk.root in project-builder.json and the workspace’s install. See --sdk-root and BUILDER_SDK_ROOT. |
--interactive |
Ask for --extends when it is not given. Needs a terminal; without it, new schematic never prompts. |
--manifest=<path> |
Accepted only when it names the working directory itself. new schematic always writes to the working directory: if --manifest or BUILDER_MANIFEST names another directory, it refuses with manifest_scoped_authoring_refused before writing; cd into that directory instead. |
Examples
Section titled “Examples”# Standard schematic — 3 files + project-builder.json entry, TS auto-detectedbuilder new schematic my-component --title "Add a component" --job "create a React component" --keyword ui
# Schematic with explicit JavaScript factorybuilder new s my-helper --title "Add a helper" --job "write a helper function" --language=js
# Inline schematic — no files, embedded in project-builder.jsonbuilder new schematic config-only --title "Add a config" --job "declare a setting" --inline
# Schematic that extends an external base (no network call at create-time)builder new schematic feature-flags --title "Add a flag" --job "declare a feature flag" --extends=@my-org/core:base
# Preview as JSON without writing anythingbuilder new schematic preview-test --title "Preview" --job "preview a run" --dry-run --output=json
# Force overwrite an existing schematicbuilder new schematic my-component --title "Add a component" --job "create a React component" --forceFor a guided walkthrough, see your first schematic.
builder new collection
Section titled “builder new collection”Scaffolds a new schematic collection with a skeleton collection.json. Alias: c.
Synopsis
Section titled “Synopsis”builder new collection <name> [flags]builder new c <name> [flags]What it does
Section titled “What it does”Default mode produces 2 outputs:
schematics/<name>/collection.json: skeleton{"version": 1, "schematics": {}}.project-builder.json: addscollections.<name>: { "path": "./schematics/<name>/collection.json" }.
Publishable mode (--publishable) produces the collection skeleton plus add/ and remove/ lifecycle stubs (each with factory.ts, schema.json, and schema.generated.ts), turning the collection into a publishable npm package skeleton.
| Flag | Effect |
|---|---|
--force |
Overwrite an existing collection of the same name. |
--dry-run |
Preview planned operations without writing any files. |
--publishable |
Generate add/ and remove/ lifecycle stubs. |
--inline |
Embed the collection definition inline. Conflicts with --publishable; combining them is a mode-conflict error. |
Examples
Section titled “Examples”# Plain collection — collection.json + project-builder.json entry onlybuilder new collection ui-kit
# Publishable collection — adds add/remove lifecycle stubsbuilder new collection my-pkg --publishable
# Collection aliasbuilder new c shared-utils --publishablebuilder info
Section titled “builder info”Inspects the current project workspace’s registered collections and schematics, across all three registration shapes (path-mode, collection-mode, inline-mode).
Synopsis
Section titled “Synopsis”builder info [<collection>[:<schematic>]] [--manifest=<path>]What it does
Section titled “What it does”The single optional argument selects one of three forms:
| Form | Result |
|---|---|
builder info |
List registered collections |
builder info <collection> |
List a collection’s schematics |
builder info <collection>:<schematic> |
Show a schematic’s full input detail |
From v0.21.0, info also shows each generator’s selection metadata and whether it is selectable, and takes the description from the Collection definition, falling back to schema.json. A generator that declares no selection metadata is still registered and executable, but never selectable: info names every such generator in one warn_schematic_unselectable per request, each with the builder describe command that adds it.
| Flag | Effect |
|---|---|
--manifest=<path> |
Inspect the manifest in this directory (or this project-builder.json) instead of the working directory. Also read from BUILDER_MANIFEST; the flag wins. Unlike execute, it may come before or after the argument. See External manifest. |
Pass the global --output=json for machine-readable output.
Examples
Section titled “Examples”# List every collection registered in project-builder.jsonbuilder info
# List the schematics inside the default collectionbuilder info default
# Show a schematic's inputs (name, type, required, default, ...)builder info default:my-component
# Machine-readable variantbuilder info default:my-component --output=json
# Inspect collections registered in another directorybuilder info --manifest=../app-schematics defaultbuilder describe
Section titled “builder describe”Available from v0.21.0. Sets the selection metadata of a generator in the working directory’s Collection definition: its entry in project-builder.json (path or inline mode) or in the collection’s collection.json.
builder describe <collection>:<schematic> [--title <title>] [--job <job>]... [--keyword <keyword>]... [--description <text>] [--dry-run]- Each flag given replaces that whole field, and a field not given stays.
--job "list users" --job "delete users"leaves exactly those two jobs and keeps the title and keywords.--joband--keywordrepeat, one flag per item. - An empty value, two jobs or two keywords equal after lowercasing, trimming and collapsing whitespace, or a result without both a title and a job is refused with
describe_selection_metadata_invalid.describenever clears a field, so a generator without selection metadata needs--titleand--jobtogether. - Only a generator carries selection metadata. An evaluation, setup or teardown schematic, and a schematic of an installed library, are refused with
describe_schematic_refused. - A refused
describechanges nothing on disk. With no flag at all it refuses withinvalid_input, and, likenew schematic, it refuses a named external manifest root. --dry-runreports the file it would update without writing it. With--output=jsonthe result carriesname,title,jobs,keywords,description,fileanddryRun.
builder describe app:add-route --title "Add a route" --job "expose an endpoint" --keyword restbuilder describe app:add-route --job "list users" --job "delete users"builder selection shortlist
Section titled “builder selection shortlist”Available from v0.23.0. Lists the generators of the working directory’s local collections that cover at least one Goal Job, reading only what each declares: title, jobs and keywords. It executes nothing and needs no SDK. Pass one --job per Goal Job.
builder selection shortlist --job "expose an endpoint" --job "validate input"- A declared job covers a Goal Job when both are the same phrase, ignoring case and whitespace. A keyword covers it when it appears in the Goal Job as a whole word, or as a whole phrase for a keyword of several words. There is no partial-word or word-overlap matching: the keyword
userdoes not matchusers, and the joblist usersdoes not coverdelete users. The title and the description are never matched. - The list is ordered by how many Goal Jobs each schematic covers, most first, then by qualified name. It is never cut, and an empty list is a success.
- A generator without selection metadata is never listed. One
warn_schematic_unselectablenames all of them, each with itsbuilder describecommand. Evaluation, setup and teardown schematics are neither listed nor named. - With
--output=jsonthe result is{"candidates": [{"name", "title", "description", "jobs", "keywords", "covers"}]}, wherecoversholds the Goal Jobs the candidate covers. Text mode prints one line per candidate and the warning on stderr. - No
--job, or an empty one, is refused withselection_goal_job_invalid. A workspace withoutproject-builder.jsonis refused withselection_project_not_initialized.
builder sync
Section titled “builder sync”builder sync resolves what project-builder.json declares and writes the result to project-builder-lock.json. It also runs the conformance fixture on each local dialect that is new or has changed since the Lock was written; see Write a local dialect.
builder syncbuilder sync --frozen installs what the Lock pins and never rewrites it. It fails when the workspace no longer matches the Lock, for example when a local dialect’s folder changed, and names what changed.
builder sync --frozenbuilder validate
Section titled “builder validate”builder validate tells whether the code in the workspace is aligned with its schematics. It runs the schematic in a Dry Run and writes nothing to the workspace. The schematic’s inputs follow the positional as flags, as on builder execute. --manifest and --sdk-root work as they do on execute and must precede the positional.
builder validate <collection>:<schematic> [--<input>=<value> ...]For a generator, validate is a drift check. It reports the generator’s Plan as builder execute --dry-run does. An empty Plan means the code is aligned. A non-empty Plan is the drift, and running the generator with builder execute and the same inputs applies it:
✗ [CLI] drift: the generator's Dry Run plans 1 operation(s) validate_drift the Plan is the fix: run the generator with builder execute and the same inputs to apply itFor an evaluation schematic, one whose entry declares "role": "evaluation", validate reports every finding the schematic returned, with its rule, severity, message, path and fix. The check fails when at least one finding has the severity error, and passes when every finding is a warning. Evaluation schematics need @pbuilder/sdk 0.20.0 or later. The entry can be in a collection.json or in project-builder.json, as a path entry or an inline registration (CLI v0.19.9 or later); see Roles. An evaluation registered only inline cannot run: builder validate fails with execute_unsupported_registration.
error hello-content hello.txt — hello.txt must say hello (fix: default:greet) [evals:check]✗ [CLI] the evaluation reported 1 finding(s) with the severity error validate_findingsWithout a positional, builder validate runs every evaluation schematic of the Manifest and reports their findings together.
builder validateFrom v0.20.1, an evaluation that fails while running does not hide the others: result holds the findings of every evaluation that ran, and error is the typed error of the first that could not run, by qualified name, with each failed evaluation and its own error under error.evaluations. The message is the evaluation "<name>" could not run: <message> for one failure, or 2 evaluations could not run: "default:silent", "default:sourced" for several. The exit code is that first error’s family, never 6. With v0.20.0 and earlier, result was empty and the other findings were not reported.
From v0.20.1, a finding whose fix names a schematic that does not resolve in the Manifest is reported unchanged and adds the warning warn_fix_schematic_unresolved: a finding's fix names the schematic "default:clean-todo", which does not resolve in the Manifest.
With --output=json, result holds the role and the Plan or the findings:
{"result":{"role":"generator","plan":[{"class":"create","path":"hello.txt"}]},"warnings":[{"code":"warn_dry_run","message":"dry run: nothing is written to the workspace"}]}{"result":{"role":"evaluation","findings":[{"rule":"hello-content","message":"hello.txt must say hello","severity":"error","path":"hello.txt","fix":{"schematic":"default:greet"},"source":"evals:check"}]},"warnings":[{"code":"warn_dry_run","message":"dry run: nothing is written to the workspace"}]}| Exit code | When |
|---|---|
| 0 | The Plan is empty, or no finding has the severity error. |
| 6 | The Plan is not empty, or at least one finding has the severity error. |
| 2 | A usage error, such as --commit=always (validate accepts only --commit=never) or a schematic that is not registered. |
| 5 | The schematic failed while running. |
When the check cannot run, validate exits with the code of the error, never 6.
Not-yet-implemented commands
Section titled “Not-yet-implemented commands”The following commands are registered in the binary and appear in builder --help, but their handlers are stubs: invoking them exits with code 1 and the not_implemented error, whose message names the command, for example add not yet implemented (planned for a future /plan phase).
| Command | Planned purpose |
|---|---|
builder add |
Generate a new artefact (component, module, service) within an existing project workspace by running a schematic. Inputs are validated against its JSON schema before any file changes occur. |
builder remove |
Delete a generated artefact from the project workspace by reversing the file changes produced by a prior add. Only artefacts tracked in the workspace manifest can be removed. |
builder skill update |
Upgrade the registered schematic skills and extensions in the current project workspace to their latest published versions. |
builder skill itself is a command group: invoked with no sub-command it prints its help and exits 0.