kicad monkey v2026.11.30
On This Page (8)

kcr project

KiCad project workflows. Use project create to scaffold a new project.

CommandAliasesCategoryRuntimeConfigGuide
kcr project—Projects, Libraries & AssetsPython kcrExplicit --config <FILE.jsonc> only (no auto-discovery; --emit-config writes project-create.jsonc)Projects, Variants & Design

Usage

sh
kcr project [-h] {create} ...

Subcommands

SubcommandDescription
kcr project createScaffold a new KiCad project (.kicad_pro + top-level .kicad_sch, optional embedded worksheet, library tables, and PCB). Use --tui for the interactive form.

kcr project create

Scaffold a new KiCad project (.kicad_pro + top-level .kicad_sch, optional embedded worksheet, library tables, and PCB). Use --tui for the interactive form.

sh
kcr project create [-h] [--name NAME]
    [--size {A4,A3,A2,A1,A0,A,B,C,D,E,USLetter,USLegal,USLedger}]
    [--dir DIRECTORY]
    [--sheet-name SHEET_NAME]
    [--worksheet WORKSHEET]
    [--no-embed-worksheet] [--with-pcb]
    [--no-lib-tables] [--no-subdir]
    [--text-var NAME=VALUE]
    [--company COMPANY] [--rev REV]
    [--date DATE] [--comment TEXT]
    [--symbol-lib NICK=URI]
    [--footprint-lib NICK=URI]
    [--config FILE.jsonc]
    [--emit-config [FILE.jsonc]] [--tui]

Options

FlagDescription
--name NAMEProject name (also the file stem)
--size, --page-size SIZESchematic page size from KiCad's standard set (default owned by kicad_monkey). Choices: A4, A3, A2, A1, A0, A, B, C, D, E, USLetter, USLegal, USLedger.
--dir, --directory DIRECTORYDirectory to create the project in (default: current dir)
--sheet-name SHEET_NAMETop-level sheet/title name (default: project name)
--worksheet WORKSHEETPath to a .wks drawing sheet to embed
--no-embed-worksheetReference the worksheet by path instead of embedding it
--with-pcbAlso create a blank .kicad_pcb
--no-lib-tablesDo not create empty sym-lib-table / fp-lib-table
--no-subdirWrite into --dir directly instead of a <name>/ subfolder
--text-var NAME=VALUEAdd a project text variable (repeatable)
--company COMPANYSchematic title-block company
--rev, --revision REVSchematic title-block revision
--date DATESchematic title-block date (e.g. 2026-06-22)
--comment TEXTTitle-block comment line 1..9 (repeatable)
--symbol-lib NICK=URIAdd a symbol library to sym-lib-table (repeatable)
--footprint-lib NICK=URIAdd a footprint library to fp-lib-table (repeatable)
--config FILE.jsoncLoad all options from a JSONC config file
--emit-config FILE.jsoncWrite a commented default JSONC config and exit
--tuiOpen the interactive terminal form instead of using flags

How It Works

kcr project create scaffolds a clean KiCad project (.kicad_pro + top-level .kicad_sch, optional embedded .wks worksheet, optional sym-lib-table/fp-lib-table, and optional blank .kicad_pcb) via three front-ends — CLI flags, a JSONC config file, or an interactive --tui form — all converging on the same KiCadProjectCreateOptions model.

Running kcr project with no subcommand prints help to stderr and exits with code 2.

Config Discovery (project-create.jsonc)

jsonc
{
  "name": "My First Project",        // Required non-empty project name & file stem
  "directory": ".",                  // Parent folder (writes to <directory>/<name>/ by default)
  "page_size": "D",                  // A4..A0 | A..E | USLetter | USLegal | USLedger
  "sheet_name": "",                  // Title-block title (defaults to name when empty)
  "worksheet": null,                 // Optional .wks drawing sheet path
  "embed_worksheet": true,           // true = embed into schematic; false = reference by path
  "create_pcb": false,               // true = also create a blank .kicad_pcb
  "create_lib_tables": true,         // Create empty sym-lib-table / fp-lib-table
  "create_subdirectory": true,       // false = write directly into directory (no <name>/ subfolder)
  "revision": "",
  "company": "",
  "date": "",                        // e.g. "2026-06-22"
  "comments": [],                    // Up to 9 title-block comment lines
  "text_variables": {},              // e.g. { "REV": "A" } -> ${REV} in KiCad
  "symbol_libraries": [],            // [{"name": "WN", "uri": "${KIPRJMOD}/WN.kicad_sym"}]
  "footprint_libraries": []          // [{"name": "WN", "uri": "${KIPRJMOD}/WN.pretty"}]
}

Precedence & Conflict Rules

  1. Front-end precedence ladder (highest wins):
    1. --emit-config [FILE.jsonc] — writes the template and exits 0; all creation flags are ignored.
    2. --config <FILE.jsonc> — loads every option strictly from the JSONC file and ignores all CLI flags (--name, --size, --with-pcb, --tui, etc.).
    3. --tui — opens the Textual interactive form pre-populated from any CLI flags you passed (falling back to plain stdin prompts if textual is not installed). Cancelling the form exits 0 without writing files.
    4. Plain CLI flags — --name is required (missing --name exits with code 2).
  2. Strict config validation:
    • Unknown keys in --config fail immediately with exit code 1 (unknown config keys: ...).
    • Missing or empty "name" fails with exit code 1.
  3. create_lib_tables: false exception:
    • Setting create_lib_tables: false (or --no-lib-tables) suppresses empty library tables, except when explicit symbol_libraries / --symbol-lib or footprint_libraries / --footprint-lib entries are provided — in that case the corresponding table is always created so the declared libraries are registered.
  4. Repeatable key=value syntax:
    • --text-var requires NAME=VALUE (non-empty NAME).
    • --symbol-lib and --footprint-lib require NICK=URI (both non-empty).

Quick Examples

sh
# Emit a commented starter JSONC config and exit
kcr project create --emit-config project-create.jsonc
sh
# Scaffold a new KiCad project from CLI flags
kcr project create --name my_board --dir projects/my_board
sh
# Scaffold from a JSONC config (ignores CLI overrides)
kcr project create --config project-create.jsonc
kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)