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 -- --helpUsage: 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.
Finding your theme
Section titled “Finding your theme”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:
cd wp-content/themes/your-themenode /path/to/sek/cli/sek-cli.js add-section promoThe rest of this page shows commands as node cli/sek-cli.js <command> ...:
run them the same way, from inside your theme.
sek add-section <handle>
Section titled “sek add-section <handle>”node cli/sek-cli.js add-section promoScaffolds blocks/<handle>.yaml and blocks/<handle>.blade.php in the
theme’s sections directory, with a minimal starting config:
label: Promohandle: promotemplatePath: blocks.promocategory: contenticon: layoutfields: []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.
sek add-type <name> [--sections a,b,c]
Section titled “sek add-type <name> [--sections a,b,c]”node cli/sek-cli.js add-type landing-page --sections hero,cta,faqCreates <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.
sek edit-type <name> [--sections a,b,c]
Section titled “sek edit-type <name> [--sections a,b,c]”node cli/sek-cli.js edit-type landing-page --sections hero,cta,faq,testimonialSame 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.
Common behaviour
Section titled “Common behaviour”--helpon any command (or onsekitself) 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-typeandedit-typevalidate the assembled post-type config againstpost-type.schema.json;add-sectionvalidates the section config againstsection.schema.json. A validation failure prints every schema error and exits non-zero: nothing partial is written.
Where to go next
Section titled “Where to go next”- CLI command reference: the full reference entry for every command and flag.
- Config & YAML reference: the shape of the files these commands scaffold.
- The
.sek.ymltheme opt-in: how the CLI resolves which theme it’s operating on.