@strifeapp/cli
v0.1.0-alpha.11
Published
Strife command-line interface
Keywords
Readme
@strifeapp/cli
Command-line interface for Strife. Authenticate, link a project to a workspace + team, and push your typed schema to the server.
Status: alpha. Surface area is small and may change in v1.x. Pin the
0.0.1-alpha.xline if you depend on it from CI.
Install
npm install --save-dev @strifeapp/cli @strifeapp/schemaRequires Node >=22 and ESM-compatible tooling.
Quickstart
# 1. Authenticate (Better Auth device flow; opens a browser)
npx strife login
# 2. Link this directory to a workspace + team
npx strife link
# 3. Declare a schema
mkdir schemas && cat > schemas/article.ts <<'EOF'
import { defineType, fields } from '@strifeapp/schema';
export const article = defineType({
name: 'articles',
title: 'Article',
type: 'document',
fields: {
heading: fields.text({ label: 'Heading', localizable: true }),
},
});
EOF
# 4. Register schemas in strife.config.ts
cat > strife.config.ts <<'EOF'
import { defineConfig, glob } from '@strifeapp/schema';
export default defineConfig({
schema: glob('./schemas/**/*.ts'),
});
EOF
# 5. Push
npx strife pushConfiguring schemas with strife.config.ts
strife push reads strife.config.ts (or any of .tsx, .mts, .js, .mjs) at the project root and walks the glob to find your schema files. Each matched file is imported via jiti; every exported defineType() result is collected and pushed.
// strife.config.ts
import { defineConfig, glob } from '@strifeapp/schema';
export default defineConfig({
// Default: recursive — matches schemas/article.ts, schemas/blog/post.ts, etc.
schema: glob('./schemas/**/*.ts'),
});Pass --config <path> to use a config file outside the project root (useful in monorepos):
npx strife push --config packages/cms/strife.config.tsglob() paths resolve relative to the config file's directory, not the working directory. To pin a different base, use the base option:
defineConfig({
schema: glob('*.ts', { base: './content/types' }),
});Commands
strife login— Authenticate via Better Auth device flow (RFC 8628)strife whoami— Show the user from the locally cached JWTstrife link— Pick a workspace + team and write.strife/project.json(auto-gitignored)strife push— Compile local schemas and full-replace the linked team's templates
Run strife --help for the full flag list.
Upgrading
From 0.0.1-alpha.0 (filesystem auto-discovery)
0.0.1-alpha.0 walked ./schemas/ automatically. From 0.0.1-alpha.1 onwards, schemas are registered explicitly via strife.config.ts. The --schema-path flag has been removed; running it now produces a clear error pointing at the new flow.
To migrate:
- Create
strife.config.tsat the project root:import { defineConfig, glob } from '@strifeapp/schema'; export default defineConfig({ schema: glob('./schemas/**/*.ts'), }); - Drop any
--schema-pathflags from your scripts.--config <path>covers the monorepo case.
