Skip to content

The sek CLI

The sek CLI scaffolds section and post-type config files, validating everything it writes against the same JSON Schemas the plugin itself validates config against, so a file the CLI creates is always schema-valid on disk.

sek is not installed as a global binary: there’s no bin entry and nothing on your PATH. Run it with Node, either through the repo-root sek npm script or by invoking cli/sek-cli.js directly:

$ npm run sek -- --help
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

(npm run sek -- forwards everything after -- to the script: that’s npm’s own convention, not something sek does.) The bare inline form node cli/sek-cli.js --help prints the same thing.

Every command resolves which theme it operates on by searching upward from your shell’s current working directory for .sek.yml (see the .sek.yml theme opt-in for the full discovery rules). This matters for how you invoke the CLI: npm run always runs its script with the working directory pinned to wherever the owning package.json lives (the project root), so npm run sek -- can only find a .sek.yml that sits at or above the root. To scaffold into a theme nested below the root (the normal case, a theme under wp-content/themes/ is), cd into the theme first and invoke the CLI directly with node, pointing it at the cli/sek-cli.js in your SEK checkout:

Terminal window
cd wp-content/themes/your-theme
node /path/to/sek/cli/sek-cli.js add-section promo

The rest of this page shows commands as node cli/sek-cli.js <command> ...: run them the same way, from inside your theme.

Terminal window
node cli/sek-cli.js add-section promo

Scaffolds blocks/<handle>.yaml and blocks/<handle>.blade.php in the theme’s sections directory, with a minimal starting config:

label: Promo
handle: promo
templatePath: blocks.promo
category: content
icon: layout
fields: []

label is derived from handle (kebab-case → Title Case). templatePath is computed as a dotted path relative to {themeRoot}/resources/views/ (the Sage/Blade view-finder convention). Both files must not already exist; the command refuses to overwrite.

Terminal window
node cli/sek-cli.js add-type landing-page --sections hero,cta,faq

Creates <postTypes>/<name>.yaml listing the given sections. Without --sections, it launches an interactive checkbox prompt over every section type discovered in the theme’s sections directory. Refuses to run if the post-type config already exists (use edit-type instead) or if no section types were found to choose from.

Terminal window
node cli/sek-cli.js edit-type landing-page --sections hero,cta,faq,testimonial

Same shape as add-type, but updates an existing post-type config’s sections: list: the interactive prompt pre-checks whichever sections are already selected. Every other key already in the file (preview, previewDebounce, and so on) is preserved untouched; only sections: is replaced.

  • --help on any command (or on sek itself) prints usage and exits without doing anything.
  • Handles are validated before anything is written: an invalid handle (wrong case, disallowed characters) fails fast with an error, before any file touches disk.
  • Schema validation runs before every write. Both add-type and edit-type validate the assembled post-type config against post-type.schema.json; add-section validates the section config against section.schema.json. A validation failure prints every schema error and exits non-zero: nothing partial is written.