@kywi-software/cli
v0.24.0
Published
Kywi CMS command-line tool — migrate, seed, and generate schema from a kywi.config.ts project.
Readme
@kywi-software/cli
The kywi command-line tool: applies the schema described by a project's
kywi.config.ts to its database, and seeds default/demo content. Built on
@kywi-software/core's schema generator and Drizzle. See the
root README for how it fits
into the rest of Kywi.
Install
npm install @kywi-software/cliProjects scaffolded with npx create-kywi-app already have it as a
dependency and wire migrate/seed into their package.json scripts.
Commands
Run from a project directory containing kywi.config.ts (or point -c/--config
at a different path):
kywi migrate --push # apply the schema (drizzle-kit push — no migration files, good for prototyping)
kywi migrate # apply the schema via generated Drizzle migration files
kywi migrate:generate # generate Drizzle schema files from kywi.config.ts (writes to build/schema/)
kywi migrate:status # show pending Drizzle migrations
kywi seed # create the default site + a superadmin user
kywi seed:demo # seed realistic demo content (pages, posts, event, contact form, taxonomy, media, feed)kywi migrate (without --push) runs drizzle-kit generate itself before
applying, so a project's migration journal (kywi-generated/migrations/) is
bootstrapped on the first run and grows on every schema-bearing release after
— no manual drizzle-kit generate step required (kywi-cms#141). It fails
loudly, rather than falling back silently, if drizzle-kit can only resolve the
diff by asking an interactive question (e.g. an ambiguous rename) that a
scripted run has no terminal to answer; see
docs/hosting.md
for the full behavior.
Every command accepts -c, --config <path> (default kywi.config.ts).
DATABASE_URL (or the db.url in kywi.config.ts) selects the target
database; kywi.config.ts itself is loaded dynamically at runtime (that's
why tsx is a runtime dependency of this package — the CLI's own code is
plain compiled JS, but the config file it reads lives in your project as
TypeScript).
What's in the package
packages/cli/src/index.ts registers each command
(packages/cli/src/commands/*.ts) on a commander program named kywi.
That file is the source of truth for exact flags and behavior.
