Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

Scaffold Commands

The b2c scaffold commands help you generate B2C Commerce components from templates (scaffolds). Built-in scaffolds include cartridges, controllers, hooks, custom APIs, job steps, and Page Designer components.

Commands Overview

CommandDescription
b2c scaffold listList available scaffolds
b2c scaffold generate <id>Generate files from a scaffold
b2c scaffold info <id>Show scaffold details and parameters
b2c scaffold search <query>Search scaffolds by name/tags
b2c scaffold init <name>Create a custom scaffold
b2c scaffold validate <path>Validate a scaffold manifest

b2c scaffold list

List available project scaffolds with optional filtering.

Usage

bash
b2c scaffold list [--category <category>] [--source <source>]

Flags

FlagDescription
--category, -cFilter by category: cartridge, custom-api, page-designer, job, metadata
--source, -sFilter by source: built-in, user, project, plugin
--columnsColumns to display (comma-separated)
--extended, -xShow all columns including description and tags

Output

Default columns: id, displayName, category, source

Extended columns (with -x): adds description, tags, path

Examples

bash
# list all available scaffolds
b2c scaffold list

# list only cartridge scaffolds
b2c scaffold list --category cartridge

# list project-local scaffolds
b2c scaffold list --source project

# show extended information
b2c scaffold list -x

b2c scaffold generate

Generate files from a scaffold template. You can also use the shorthand b2c scaffold <id>.

Usage

bash
b2c scaffold generate <scaffoldId> [--name <name>] [--option key=value] [--output <dir>]
b2c scaffold <scaffoldId>  # shorthand

Arguments

ArgumentDescription
scaffoldIdID of the scaffold to generate (required)

Flags

FlagDescription
--name, -nPrimary name parameter (shorthand for --option name=VALUE)
--output, -oOutput directory (defaults to scaffold default or current directory)
--optionParameter value in key=value format (repeatable)
--dry-runPreview files without writing them
--force, -fSkip prompts, use defaults, and overwrite existing files

Examples

bash
# generate a cartridge interactively
b2c scaffold generate cartridge

# generate with name specified
b2c scaffold cartridge --name app_custom

# generate with multiple options
b2c scaffold generate controller --option controllerName=Account --option cartridgeName=app_custom

# preview what would be generated
b2c scaffold generate cartridge --name app_custom --dry-run

# skip all prompts and use defaults
b2c scaffold generate cartridge --name app_custom --force

# generate to a specific directory
b2c scaffold generate cartridge --name app_custom --output ./src/cartridges

b2c scaffold info

Show detailed information about a scaffold including its parameters and usage.

Usage

bash
b2c scaffold info <scaffoldId>

Arguments

ArgumentDescription
scaffoldIdID of the scaffold to get info for (required)

Output

Displays:

  • Scaffold ID, category, source, and description
  • Tags (if any)
  • Parameters with types, requirements, defaults, and conditions
  • Usage example with required parameters
  • Post-generation instructions (if any)

Examples

bash
# show info for the cartridge scaffold
b2c scaffold info cartridge

# show info for the controller scaffold
b2c scaffold info controller

Search for scaffolds by name, description, or tags.

Usage

bash
b2c scaffold search <query> [--category <category>]

Arguments

ArgumentDescription
querySearch query (required)

Flags

FlagDescription
--category, -cFilter results by category

Examples

bash
# search for scaffolds related to API
b2c scaffold search api

# search within a specific category
b2c scaffold search template --category page-designer

b2c scaffold init

Create a new custom scaffold template.

Usage

bash
b2c scaffold init [name] [--project | --user | --output <dir>]

Arguments

ArgumentDescription
nameName for the new scaffold (kebab-case, optional - prompts if not provided)

Flags

FlagDescription
--projectCreate in project scaffolds directory (.b2c/scaffolds/)
--userCreate in user scaffolds directory (~/.b2c/scaffolds/)
--output, -oCustom output directory for the scaffold
--force, -fOverwrite existing scaffold if it exists

Examples

bash
# create a project-local scaffold interactively
b2c scaffold init --project

# create a user scaffold with a specific name
b2c scaffold init my-component --user

# create a scaffold in a custom directory
b2c scaffold init my-scaffold --output ./custom-scaffolds

b2c scaffold validate

Validate a custom scaffold manifest and templates.

Usage

bash
b2c scaffold validate <path> [--strict]

Arguments

ArgumentDescription
pathPath to the scaffold directory (required)

Flags

FlagDescription
--strictTreat warnings as errors

Validation Checks

  • Manifest structure (scaffold.json)
  • Required fields and types
  • Parameter definitions and validation patterns
  • Template file existence
  • Orphaned template files
  • EJS syntax in templates

Examples

bash
# validate a custom scaffold
b2c scaffold validate ./.b2c/scaffolds/my-scaffold

# validate with strict mode
b2c scaffold validate ./my-scaffold --strict

Built-in Scaffolds

ScaffoldCategoryDescription
cartridgecartridgeB2C cartridge with standard directory structure
controllercartridgeSFRA controller with route handlers and middleware
hookcartridgeHook implementation with hooks.json registration
servicecartridgeB2C web service using LocalServiceRegistry
custom-apicartridgeCustom SCAPI endpoint with OAS 3.0 schema
job-stepcartridgeCustom job step with steptypes.json registration
page-designer-componentcartridgePage Designer component with meta/script/template

Use b2c scaffold info <id> to see the parameters for each scaffold.

Released under the Apache-2.0 License.