SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

@sdxc/kit

The sdxc command line: start a Remix v3 app, generate its files, copy UI components into it and upgrade it

Terminal
npm install @sdxc/kit remix
Terminal
pnpm add @sdxc/kit remix
Terminal
yarn add @sdxc/kit remix
Terminal
bun add @sdxc/kit remix
Depends on
oxc-parser

The sdxc command line: start a Remix v3 app, generate its files, copy UI components into it and upgrade it.

Installation

Terminal
npm add -g @sdxc/kit

The package installs a command named sdxc. It works on projects that depend on the @sdxc/* packages, and every command that writes code lists the packages that code imports in package.json.

Usage

Terminal
sdxc create my-app                   # a Remix v3 app, or --template org/repo from GitHub
sdxc make controller posts/show      # a file where the app layout puts it, with its test and .spec
sdxc make controller api/keys --routes api  # a JSON endpoint and an http .spec
sdxc make middleware require-user --mount page  # called last in the page chain
sdxc make model post title author_id  # the model, its migration and its factory
sdxc make migration add-slug-to-posts 'slug?'  # ALTER TABLE, read from the name
sdxc make migration add-slug --from-model post  # the SQL app/models/post.ts needs
sdxc scaffold post title body published_at   # types follow the names: text, timestamp
sdxc scaffold post title body --api          # JSON endpoints, OpenAPI ops and one feature .spec
sdxc destroy controller posts/show           # remove it, its .spec, its mapping and its declaration
sdxc models post                             # the table app/models/post.ts declares, vs the migrations
sdxc ui add dialog                   # copy a component into the project to edit it
sdxc ui update --all                 # move every unedited copy to the installed @sdxc/ui
sdxc upgrade                         # move to the latest release and print a prompt for the code
sdxc doctor                          # report release drift, missing secrets and app-layout slips
sdxc routes --json                   # every route, its controller and middleware, for an agent
sdxc routes -g posts --method post   # narrow it, as rails routes does; --unused, -c, -E too
sdxc run users find ada@example.com  # run the project's command line (run.entry)
sdxc deploy                          # build, then the app's db migrate --remote and deploy

On a terminal each command asks for what you left out; every question has a flag, so scripts and agents never wait on one.

Releases

Every @sdxc/* package versions as the UTC date it was published, and a daily release republishes only the packages that changed, so a project's packages carry different dates from the same release. The kit reads a project's release as the newest date among its @sdxc/* pins, and pins a package "at a release" to its newest version on or before that date:

  • sdxc create pins each package the template lists to its latest version.

  • sdxc make and sdxc ui add add a package the written code imports at the project's release, and print the install command to run.

  • sdxc upgrade [release] moves every @sdxc/* package the project lists to the target release, latest when left out, and remix to the version that release requires, then installs and prints a prompt for an AI agent from that release's changelog.

  • sdxc doctor reports packages pinned behind the project's release and a remix pin other than the release's peer; sdxc upgrade <release> fixes both.

sdxc doctor also checks secrets, migrations, the app layout, JSDoc comment shape and source conventions (local let, constant names, the stack's imports, env, fetch and logging), and runs a project's own checks written with defineCheck from @sdxc/kit/doctor. The doctor guide lists every check.

API

Commands

CommandWhat it does
sdxc createWrites a new project from the built-in app template or a GitHub repository
sdxc initWrites .config/sdxc.jsonc with every key at its default
sdxc makeWrites a controller, job, model, migration or other file, declared and mapped
sdxc scaffoldWrites a resource's model, migration, pages or JSON endpoints, and tests
sdxc destroyRemoves what sdxc make wrote, its mapping and its declaration, once confirmed
sdxc routesPrints every route with its controller and middleware
sdxc modelsPrints each model's table and whether the migrations create it
sdxc scheduleLists scheduled jobs, their next runs and the Worker triggers that fire them
sdxc middlewarePrints each router's global middleware and every chain in app/http/middleware
sdxc initializersLists the initializers, their exports and the factories that build them
sdxc notesLists the TODO, FIXME, HACK and OPTIMIZE comments in the app's code
sdxc statsCounts lines of code per kind of code, and the code to test ratio
sdxc runRuns the project's command line (run.entry, default bootstrap/cli.ts)
sdxc doctorLints the project: release drift, secrets, migrations, layout, JSDoc and its own checks
sdxc fixApplies the repairs sdxc doctor names that the kit can make safely
sdxc setupInstalls a multi-file feature (auth, billing, flags), or lists them with no name
sdxc diagramDraws the project's layer architecture as Mermaid, or as SVG through @sdxc/diagram
sdxc uiCopies @sdxc/ui components into the project and points imports at the copies
sdxc upgradeMoves the @sdxc/* packages and remix to a release and prints the prompt
sdxc deployBuilds, then runs the app's own db migrate --remote and deploy, once confirmed

Commands run from the project root, the nearest directory with a package.json. sdxc <command> --help prints a command's arguments and flags, and --help --json prints them as data for an agent. Every command that runs tasks also takes --no-progress.

sdxc ci

Run the project's CI script (.config/sdxc/ci.ts), and sign green commits off on GitHub

FlagDoes
--only <pattern>Run only steps, groups or entries (Workspaces/@acme/ui) matching it; * spans /
--skip <pattern>Leave out steps, groups or entries matching it
--scope <workspace>Keep matrix entries for this workspace path or name and its dependents
--since <ref>Keep matrix entries for workspaces changed since this ref (and their dependents); a change outside every workspace covers every entry
--runner <runner>local or remote: run as on a laptop or on a CI host; detected from the CI variable
--pushAfter a green run, push the tested commit to its upstream branch, then sign off
--no-signoffMake ci.signoff a plain success that posts nothing
--no-cacheRun every step, ignoring passes stored for unchanged inputs
--concurrency <n>Concurrency slots running steps share, each holding its weight (1 by default); the machine's available parallelism by default
--memory <size>RAM budget for step memory reservations (2GB, 512MB); three quarters of total RAM by default
--worktreeRun in a temporary detached worktree of HEAD so a dirty checkout can still sign off
--watchRe-run when tracked files change; unchanged cached steps replay; never signs off or pushes
--remote <name>Git remote to push to and read the GitHub repository from; the upstream's by default
--token-env <NAME>Environment variable holding the GitHub token; gh auth token answers when it is unset
-v, --verbosePrint every step's log, not only a failed one's
--jsonPrint the report as JSON
--rerun-failedRun only the steps the last recorded run failed
--no-installSkip the frozen-lockfile install a local run starts with

sdxc ci list

Print the steps and matrix entries a fully passing run takes, without running any

FlagDoes
--only <pattern>Run only steps, groups or entries (Workspaces/@acme/ui) matching it; * spans /
--skip <pattern>Leave out steps, groups or entries matching it
--scope <workspace>Keep matrix entries for this workspace path or name and its dependents
--since <ref>Keep matrix entries for workspaces changed since this ref (and their dependents); a change outside every workspace covers every entry
--runner <runner>local or remote: run as on a laptop or on a CI host; detected from the CI variable
--matrix <name>Print only the entry keys of this matrix
--jsonPrint the report as JSON

sdxc ci signoff [sha]

Post the signoff an earlier green run recorded for a commit already on GitHub

FlagDoes
--remote <name>Git remote to push to and read the GitHub repository from; the upstream's by default
--token-env <NAME>Environment variable holding the GitHub token; gh auth token answers when it is unset
--jsonPrint the report as JSON

sdxc ci verify <sha>

Exit 0 when a contributor signed the commit off, 1 when nobody did, 2 when GitHub cannot be reached

FlagDoes
--wait <duration>Poll until a signoff appears or this long passes: 30s, 2m, 500ms
--repo <owner/name>The GitHub repository; read from the git remote when left out
--remote <name>Git remote to push to and read the GitHub repository from; the upstream's by default
--token-env <NAME>Environment variable holding the GitHub token; gh auth token answers when it is unset
--jsonPrint the report as JSON

sdxc ci clean

Remove the step cache and run history kept in the git directory; signoff records stay

FlagDoes
--jsonPrint the report as JSON

sdxc create [directory]

Write a new project from a built-in template or a GitHub repository

FlagDoes
--template <template>A built-in template, or a GitHub repository as org/repo[/path][#ref]
--gitInitialize a git repository without asking, or skip it with --no-git

sdxc deploy

Build, then run the app's db migrate --remote and deploy commands

FlagDoes
-y, --yesDeploy without asking; required without a terminal
--dry-runBuild and print the plan; migrate and deploy nothing
--skip <step>Leave out build, migrate or deploy; repeat it or list them

sdxc destroy <kind> <name>

Remove a file sdxc make wrote, its test, its pairing .spec, its mapping and its declaration

FlagDoes
-y, --yesRemove without asking; required without a terminal
--dry-runPrint what would be written and change nothing
--resourceWith mcp, a resource in app/mcp/resources instead of a tool

sdxc doctor

Lint release drift, secrets, migrations, app layout, complexity and project checks

FlagDoes
--jsonPrint the report as JSON for an agent
--only <check>Run only the named checks
--skip <check>Leave out the named checks

sdxc fix

Apply doctor repairs the kit can make safely

FlagDoes
--dry-runPrint what would be written and change nothing

sdxc fix env

Append missing bindings.secret() keys to .env.example

FlagDoes
--dry-runPrint what would be written and change nothing

sdxc fix models

Register unmapped createModel modules in app/models/index.ts

FlagDoes
--dry-runPrint what would be written and change nothing

sdxc fix emails

Map unmapped emails in app/initializers/mail.ts

FlagDoes
--dry-runPrint what would be written and change nothing

sdxc init

Write .config/sdxc.jsonc with every default spelled out

FlagDoes
--dry-runPrint it and write nothing

sdxc initializers

List the initializers in app/initializers, their exports and what builds them

FlagDoes
--jsonPrint a JSON array instead of a table

sdxc make <kind> <name>

Write a controller, job, model or other file where the app layout puts it

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make controller <name>

A route handler in app/http/controllers, declared and mapped

FlagDoes
--method <method>get, post, put, patch, delete, form; asked on a terminal (default: get)
--path <path>The route's pattern (default: /<name>)
--routes <contract>The route contract in routes/ (default: make.routes)
--resource <name>Check the resource's ability the method implies (get reads, form and post create, put and patch update, delete deletes); a read, update or delete route takes /<name>/:id
--actions <action>One controller per action under <name>: index, new, show, edit and destroy pages, or with --routes api index, show, create, update and destroy endpoints; all writes each
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--specWrite a pairing .spec under spec/, or skip it with --no-spec (default: make.specs)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make middleware <name>

A middleware in app/http/middleware

FlagDoes
--mount <target>Also call it last in a chain: a router initializer (router) or a chain module (page, api)
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make validator <name>

An input validator in app/http/validators

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make job <name>

A background job in app/jobs, declared and mapped

FlagDoes
--cron <expression>A scheduled job instead of one with input, with the Worker trigger that fires it
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make model <name> [field[:type][?]...]

A model in app/models, with the migration creating its table and its factory

FlagDoes
--chain <chain>The chain in make.migrations the migration goes in (default: default)
--skip <file>Leave out the migration or the factory; repeat it or list them
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make migration <name> [field[:type][?]...]

A numbered SQL migration in a configured chain

FlagDoes
--chain <chain>The chain in make.migrations (default: default)
--from-model <model>Write the SQL that brings the chain in step with app/models/<model>.ts
--dry-runPrint what would be written and change nothing

sdxc make factory <name>

A test factory in database/factories

FlagDoes
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make service <name>

A service in app/services

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make policy <name>

A resource's create, read, update and delete abilities in app/policies, with their test

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make initializer <name>

An initializer in app/initializers

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make email <name> [field[:type][?]...]

An email template in app/emails, its props declared and the template mapped

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make mcp <name>

An MCP tool in app/mcp/tools, or a resource, declared and mapped

FlagDoes
--resourceA resource in app/mcp/resources instead of a tool
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--specWrite a pairing .spec under spec/, or skip it with --no-spec (default: make.specs)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make command <name>

A command-line command in app/commands, declared and mapped

FlagDoes
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--specWrite a pairing .spec under spec/, or skip it with --no-spec (default: make.specs)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make test <file>

The test make writes beside a file, for an existing file without one

FlagDoes
--dry-runPrint what would be written and change nothing
--forceReplace the test when it exists

sdxc make stubs [kind...]

Copy the built-in stubs into make.stubs to edit

sdxc make secret <NAME>

Declare a bindings.secret() in cloudflare.config.ts and append .env.example

FlagDoes
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make binding <kind> <NAME>

Declare a Cloudflare binding in cloudflare.config.ts

FlagDoes
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc make do <name>

Write a Durable Object class, re-export it from bootstrap/worker.ts, and declare its binding

FlagDoes
--role <role>app/models when it owns stored state, app/services otherwise (default: service)
--binding <NAME>The env binding key (default: derived from the class name)
--dry-runPrint what would be written and change nothing
--forceReplace the file, its test and its pairing .spec when they exist, keeping their declaration

sdxc middleware

Print each router's global middleware and every chain in app/http/middleware

FlagDoes
--jsonPrint the chains as JSON

sdxc models [model...]

Print each model's table and whether the migrations create it, from app/models

FlagDoes
--jsonPrint the models as JSON

sdxc notes

List the TODO, FIXME, HACK and OPTIMIZE comments in the app's code

FlagDoes
--tag <tag>The tags to list instead of TODO, FIXME, HACK, OPTIMIZE; repeat it or list them
--jsonPrint a JSON array instead of a list

sdxc routes

Print every route with its controller and the middleware that runs for it

FlagDoes
--jsonPrint a JSON array instead of a table
-E, --expandedPrint one block per route with every field, for a narrow terminal
-g, --grep <pattern>Keep routes whose name, pattern, method or controller matches
-c, --controller <path>Keep routes of a controller file or folder, as posts or posts/show
--method <method>Keep routes answering a method; ANY routes answer every one
--contract <contract>Keep routes declared in a contract in routes/, as web
--unusedKeep routes no router maps, and report controllers no route maps
--except-path <path>Leave out routes under a path, as /api or /mcp; repeat it or list them
--sort <field>Order routes by name, pattern, method, controller instead of declaration order

sdxc pkg [name...]

Run an @sdxc package's command line through bunx or npx; with no name, list them

sdxc run [command...]

Run the project's own command line (run.entry, default bootstrap/cli.ts)

sdxc scaffold <name> [field[:type][?]...]

Write a resource's model, migration, pages, tests and more, declared and mapped

FlagDoes
--plural <word>The plural the table, URLs and folders take (default: the English plural of <name>)
--mcpAlso write MCP tools to list, get, create, update and delete
--commandAlso write app commands to list, show, create and delete
--apiJSON endpoints in routes/api.ts with their OpenAPI operations, instead of pages
--skip <piece>Leave out pieces the project already has: model, migration, factory, validator, policy, pages; repeat it or list them
--testWrite a test beside the file, or skip it with --no-test (default: make.tests)
--specWrite a pairing .spec under spec/, or skip it with --no-spec (default: make.specs)
--dry-runPrint what would be written and change nothing

sdxc schedule

List the scheduled jobs, their next runs and the Worker triggers that fire them

FlagDoes
--jsonPrint the schedule as JSON

sdxc setup [feature]

Install a multi-file feature (auth, billing, flags); lists known features with no name

FlagDoes
--provider <provider>Backend for features that vary (auth: r3-auth; billing: polar)
-y, --yesWrite the plan; without it the plan is printed and nothing changes
--dry-runPrint what would be written and change nothing

sdxc stats

Count lines of code per kind of code the app layout names, and the test ratio

FlagDoes
--jsonPrint the counts as JSON

sdxc diagram

Draw the project's layer architecture as Mermaid, or as SVG through @sdxc/diagram

FlagDoes
--jsonPrint the import graph as JSON instead of Mermaid
--svg <path>Write an SVG drawing to this path (relative to the project root) via @sdxc/diagram

sdxc ui list

Every component, marking copies that are edited or behind

sdxc ui add [component...]

Copy components and point the project's imports at the copies

FlagDoes
--with-depsAlso copy every component they reach through others
--dry-runPrint what would be written and change nothing

sdxc ui diff <component>

Show how a copy differs from the installed version

sdxc ui update [component...]

Replace copied files with the installed version

FlagDoes
--allUpdate every copy, leaving edited files unless --force
--with-depsAlso copy components the new versions reach and the project lacks
--forceReplace edited files without asking
--dry-runPrint what would be written and change nothing

sdxc ui remove [component...]

Delete copies and point imports back at @sdxc/ui/<name>

FlagDoes
--dry-runPrint what would be written and change nothing

sdxc upgrade [version]

Move the @sdxc packages to another release and print the prompt for the code

FlagDoes
--no-installChange package.json only and print the commands to run next
--output <file>Write the prompt to a file instead of stdout
--promptPrint the prompt for this release of @sdxc/kit only; needs --from
--from <version>The release the project moved from, with --prompt
--since <package@version>A package's own pinned release when it lagged behind --from, with --prompt; repeatable
--remix-from <version>The remix version the project moved from, with --prompt

Configuration

The CLI reads .config/sdxc.jsonc (or sdxc.jsonc at the project root). Every key is optional.

KeyDefaultMeaning
ui.directoryresources/components/uiWhere sdxc ui add writes components
ui.aliasinferred from tsconfig pathsImport prefix for the copies
ui.testsfalseCopy a component's tests beside it
make.routeswebRoute contract sdxc make controller adds to, a module in routes/
make.migrations{ "default": "database/migrations" }Migration chains by name
make.teststrueWrite a test beside every generated file except migrations and factories
make.specstrueWrite a pairing .spec for controllers, commands, MCP tools and scaffolds
make.stubs.config/sdxc/stubsStubs that replace the built-in ones
doctor.checks.config/sdxc/checksThe project's own sdxc doctor checks, one module each
doctor.migrations.accept[]Migration errors sdxc doctor steps past, each { "file", "column" }
doctor.complexity.max4Highest cyclomatic complexity a function may have
doctor.moduleSize.maxLines200Most code lines a module may hold
doctor.crap.max12Highest CRAP score a function may have
doctor.crap.coveragecoverage/coverage-final.jsonIstanbul coverage the crap check reads
doctor.testRatio.min0.3Lowest test lines per code line
doctor.fanOut.max15Most project modules one module may import statically
doctor.duplication.minLines8Fewest code lines that count as a duplicated block
doctor.mutation.reportreports/mutation/mutation.jsonMutation-testing report the mutation check reads
doctor.mutation.maxSurvived0Most surviving mutants the mutation check allows
run.entrybootstrap/cli.tsModule sdxc run starts, relative to the project root
formatnoneCommand run once on every file a command wrote or edited, the paths appended
lock.config/sdxc.lock.jsonlWhere the CLI keeps its state

format is an argument list, such as ["bunx", "vp", "fmt"].

@sdxc/kit/config.schema.json

The JSON Schema 2020-12 document for .config/sdxc.jsonc. sdxc init points the file's $schema at https://unpkg.com/@sdxc/kit/config.schema.json.

@sdxc/kit/lock.schema.json

The JSON Schema 2020-12 document for one line of the lock file, where the CLI records state such as copied components. Commit the lock file and leave it to the CLI.

createSDXC(options?) and kitVersion()

Builds the command line the sdxc binary runs, for a program that embeds it: await createSDXC({ version: kitVersion() }).run(argv) answers the exit code.

API

Can’t find it? Contact us