Skip to content

CLI command reference

The exhaustive reference entry for every sek command. For the narrative walkthrough see The sek CLI; this page is the flag-by-flag lookup. Re-verified against cli/commands/ and cli/sek-cli.js: there are exactly three commands.

Usage: sek <command>
Commands:
add-section Scaffold a new section
add-type Scaffold a new post type config
edit-type Edit an existing post type config
Options:
--help Show this help message

--help on sek itself, or on any individual command, prints usage and exits without writing anything.

Arguments <handle>: required. Validated before anything is written.
Flags --help
Writes <sectionsPath>/<handle>.yaml and <sectionsPath>/<handle>.blade.php, under the theme’s .sek.yml sections directory.
Refuses to run when Either output file already exists.

Scaffolds a minimal section config:

label: <Title Case of handle>
handle: <handle>
templatePath: <computed>
category: content
icon: layout
fields: []

label is derived from handle (kebab-case → Title Case). templatePath is computed relative to {themeRoot}/resources/views/: the Sage/Blade view-finder convention. On a classic (non-Blade) theme whose sections key points directly at a theme-root directory, the computed templatePath won’t match the actual template location; correct it by hand after scaffolding.

The assembled config is validated against section.schema.json before either file is written.

Arguments <name>: required. Validated before anything is written.
Flags --sections <comma-separated handles> (optional: launches an interactive checkbox prompt over every section type discovered under the theme’s sections directory when omitted); --help
Writes <postTypesPath>/<name>.yaml: { sections: [<selected handles>] }.
Refuses to run when The post-type config already exists (use edit-type instead), or no section types were found to choose from.

The assembled { sections: [...] } config is validated against post-type.schema.json before writing.

Arguments <name>: required. Must match an existing post-type config.
Flags --sections <comma-separated handles> (optional: the interactive checkbox prompt pre-checks whichever sections are already selected when omitted); --help
Writes <postTypesPath>/<name>.yaml, replacing only the sections: key. Every other existing key (preview, previewDebounce, and so on) is preserved untouched.
Refuses to run when The post-type config does not already exist, or no section types were found to choose from.

Same schema validation as add-type, against the merged config.

Common behaviour across all three commands

Section titled “Common behaviour across all three commands”
  • Handle/name arguments are validated before any file touches disk: an invalid value (wrong case, disallowed characters) fails fast.
  • Schema validation runs before every write; a failure prints every schema error via the CLI’s Ajv validator and exits non-zero with nothing partial written.
  • All three commands locate the active theme by searching upward for .sek.yml from the current working directory. See the .sek.yml reference. The CLI has no global binary; run it via node cli/sek-cli.js <command> from inside your theme, or npm run sek -- <command> from the repo root (npm run pins its working directory to the root, so that form only finds a .sek.yml at or above it). See the narrative walkthrough for the full invocation forms and worked examples.