Inherits from
/AGENTS.md(root). This file adds context specific to@faststore/cli.
@faststore/cli is the command-line tooling for FastStore. It is an oclif-based CLI that generates types, caches GraphQL persisted documents, scaffolds projects, and orchestrates dev/build workflows for other packages.
- oclif
- TypeScript 5.3 (strict)
- tsup for build (
tsup.config.ts) - Vitest
bin/— CLI entrypointsrc/commands/— oclif commands (one file per command)src/utils/— shared utilitiessrc/__mocks__/— mocks for testssrc/index.ts— public entry
Each file in src/commands/ defines one oclif command:
build.ts— production build orchestrationdev.ts— development serverstart.ts— production servertest.ts— test runnerprepare.ts— pre-run preparationcms-sync.ts— sync CMS content (legacy Headless CMS or CP schema publish, auto-detected fromdiscovery.config.jscontentSource.type). CP mode runs a pre-flight (vtex --version+vtex whoamivsapi.storeId, viautils/vtex.ts), thengenerate-schema/upload-schemainteractively with paths relative to the store root. Whenexperimental.enableFaststoreMyAccountis on, it file-merges the core My Account schemas with the store'scms/faststore/{components,pages}into a staging dir under.faststore(store overrides core) and uses those two merged dirs as the single generate/upload input.create.ts— scaffold new storesgenerate.ts— top-level type generation entrygenerate-graphql.ts— GraphQL type generationgenerate-types.ts— TypeScript type generationgenerate-i18n.ts— i18n message generation (paired withgenerate-i18n.test.ts)cache-graphql.ts— cache GraphQL persisted documents
@faststore/cli MUST be compiled before @faststore/core or @faststore/api can run their generate step. This is enforced by turbo.json:
@faststore/core#generateexplicitly depends on@faststore/cli#build@faststore/api#builddepends on its owngeneratestep (which in turn depends on the CLI)
When working on the CLI, always re-build (pnpm build in this package) before running generate steps in downstream packages.
cd packages/cli
pnpm vitest runCommand tests should mock the file system and external processes — use src/__mocks__/ for shared fixtures.
- Create
src/commands/{command-name}.tsfollowing the oclif convention. - Document inputs, flags, and side effects in the file header.
- If the command writes to disk or modifies downstream packages, mock those interactions in tests.
- Add a test file alongside (or under
test/) matching{command-name}.test.ts.
Built with tsup. Output goes to dist/. The CLI binary is exposed via bin/.