CLI reference
Every aces command and its options, from setup to removing a page type.
The aces command comes from @aces-core/cli and is installed in every project. Run it with pnpm aces <command>, or npx aces <command> with npm. pnpm aces <command> --help shows the details.
Project scripts wrap the most used commands:
| Script | What it does |
|---|---|
dev |
aces sync, then the Next.js dev server on http://localhost:3000 |
build |
aces sync, then a production build |
typecheck / lint |
next typegen + tsc, and ESLint |
aces:setup / aces:sync / aces:doctor |
Shortcuts for those commands |
Project and Contentful
aces setup
Sets the App ID, writes .env.local (including a generated CF_PREVIEW_SECRET), imports the content model and content, creates Live Preview URLs, then runs doctor. It prompts for anything missing.
| Option | |
|---|---|
--space <id> --environment <id> |
The Contentful space and environment |
--delivery-token --preview-token --management-token |
API tokens. Or set CONTENTFUL_DELIVERY_TOKEN, CONTENTFUL_PREVIEW_TOKEN, CONTENTFUL_MANAGEMENT_TOKEN (and CONTENTFUL_SPACE_ID, CONTENTFUL_ENVIRONMENT) in the environment, which keeps them out of ps and shell history. |
--site-url <url> |
Site URL for Live Preview. Default: site.url or http://localhost:3000. |
--app-id <id> |
The Apps entry this site reads |
--demo-content / --no-demo-content |
Demo pages, or only an Apps entry and an empty Home page |
--no-models / --no-content / --no-previews |
Skip a step |
-y, --yes |
Never prompt; fail if a value is missing |
When the space already has some of the same content types (for example its own page), the import keeps any fields the space has that ACES doesn’t, instead of deleting them.
aces doctor
Checks:
aces.config.tsagainst the code- the skin:
ui.skinagainstsrc/styles/skin/and its import - Layered Content Modeling names and descriptions
- the env vars, the preview secret and the management token
- the Apps entry, in both delivery and preview
- that every configured content type exists in the space
- with Optimization: the installed code, the Personalization app and the
nt_experiencesfields
Each check reports ok, warn or fail. Add --json for machine-readable output.
aces sync
Checks aces.config.ts against the code and regenerates the component registry and the config-derived rules in contentful/models.json.
| Option | |
|---|---|
--check |
Change nothing; fail if anything is out of date (for CI) |
--contentful |
Also push page body rules, Specialty Pages, Internal Link targets and Live Preview URLs to the space |
--site-url <url> |
Site URL for Live Preview URLs (with --contentful) |
aces previews
Creates or updates the Live Preview URLs for every page type and component. Run it after you deploy: pnpm aces previews --site-url https://www.example.com.
Models and content
models import creates locales listed in models.json that the space doesn’t have yet, and adds new fields to a content type’s editor layout (its first group) so the import doesn’t fail. Other Contentful commands fall back to CONTENTFUL_MANAGEMENT_TOKEN in the environment when .env.local has no management token.
| Command | What it does |
|---|---|
models import / models export |
Content model to or from contentful/models.json |
models delete <ids...> |
Deletes content types from the space and from contentful/*.json, first removing them from other types’ link rules. Options: --delete-entries --keep-model --force --yes |
content import / content export |
Entries and assets to or from contentful/content.json and contentful/assets/ |
After a command creates or changes content types in Contentful, run pnpm aces models export so models.json matches the space.
Look (skin)
The project’s look: the ACES Base skin (src/styles/skin/) or Unstyled. See Styling.
| Command | What it does |
|---|---|
skin add base |
Copies the Base skin into src/styles/skin/, imports it, and sets ui.skin: "base". --tokens also writes the ACES colors and fonts; --overwrite replaces skin files you already have. |
skin remove |
Unstyled: deletes src/styles/skin/ and its import, and sets ui.skin: "none". src/styles/custom/ is kept. --tokens also resets tokens and fonts to neutral; --yes skips the confirmation. |
skin eject <name> |
Moves one skin file (for example hero) to src/styles/custom/, which the project owns. |
Components, page bodies and page types
aces component add <name>
Does three things:
- scaffolds
src/libs/cf/lib/cf-<name>/(markup with adata-slothook; looks go in the skin) - adds the component to
componentsand to a page body - creates its content type, with the 🔷 icon and a description
With Optimization installed, it asks whether to optimize the component.
| Option | |
|---|---|
--body <key> |
Page body to allow it in. Repeat the flag or comma-separate the keys. Default: default. |
--title <title> / --description <text> |
Selector label and the content type’s one-line description |
--optimization / --no-optimization |
Optimize it, or don’t |
--no-model |
Only scaffold code; don’t touch Contentful |
pnpm aces component add "Stat Strip" --description "A row of big numbers."
aces page-body add <name>
Adds a named list of components to pageBodies and asks which components to include. Options: --components <list|all> --title --yes.
aces page add <name>
Does four things:
- scaffolds
/<plural>/[slug](route, services and Live Preview client), plus a paginated listing if you ask for one - adds the page type to
pageTypes - creates its 📄 content type and its Live Preview URL
- lets Internal Links point at it
| Option | |
|---|---|
--body <key|richText> |
A page body, or a single rich text field |
--listing |
Also scaffold a paginated listing page |
--path <segment> |
URL segment. Default: the kebab-case plural of the name. |
--specialty-page <value> |
The listing’s Specialty Page. Default: <Plural> Listing. |
--description <text> |
One-line description shown to editors |
--no-model / --yes |
Code only; never prompt |
pnpm aces page-body add "Case Study" --components hero,richtextsection,"stat strip"
pnpm aces page add "Case Study" --body caseStudy --listing # /case-studies/[slug] + /case-studies
pnpm aces page add "Press Release" --body richText
Removing things
Use the CLI rather than deleting folders. A component or page type is wired into the barrel, the config, the page bodies, the generated registry and the model files.
| Command | What it removes |
|---|---|
component remove <name> (rm) |
Folder, exports, config and page body entries, and model files. It refuses if other code uses the component (--force). |
page-body remove <key> (rm) |
A page body that no page type uses |
page remove <key> (rm) |
The routes, config entry, model entry and Specialty Page value. Page can’t be removed, and Article needs --force. |
By default a remove changes only code, config and contentful/*.json. To change the space as well, add one of these flags:
| Flag | Effect in the space |
|---|---|
--contentful |
Pushes page body rules, links and Live Preview URLs |
--delete-content-type |
Deletes the content type (kept if it has entries) |
--delete-entries |
Deletes the content type and its entries, after a confirmation that shows the count |
Optimization
| Command | What it does |
|---|---|
optimization add |
Installs Contentful Optimization (SDK, preview panel, config) and optimizes the components you pick. Options: --components <list|all|none> --consent granted|required --no-model --yes |
component add-optimization <names...> |
Optimizes existing components. It adds the experiences to each component’s query, wraps its render, and adds the nt_experiences field (skip the field with --no-model). |
component remove-optimization <names...> |
Takes that code and the config flag out again. The field stays in Contentful. |
See Optimization for how it works.
Something wrong or missing? Open an issue.