@case-framework/case-cli
v0.2.0
Published
Operational CLI for the CASE platform.
Readme
CASE CLI
casectl is the operational CLI for the CASE platform.
This repository contains the initial CLI scaffold for CASE.
The goal is to provide a typed operational command-line interface for tasks such as:
- database index management
- migrations
- bootstrap and admin tasks
- environment and connectivity checks
Project structure
src/
cli.ts
commands/
doctor.ts
db/
index.ts
indexes/
diff.ts
index.ts
shared.ts
ensure.ts
core/
config.ts
not-implemented.ts
adapters/
mongodb/
client.ts
indexes.ts
test/
adapters/
mongodb/
indexes.test.tsCommands
Current commands:
casectl --help
casectl help
casectl doctor
casectl doctor --ping --json
casectl db indexes diff --help
casectl db indexes ensure --helpDatabase configuration
DB commands should target a logical database, not a raw MongoDB database name:
usersstudymessageglobal
The CLI derives the physical database name from environment variables:
CASE_DB_NAME_PREFIXCASE_DB_INSTANCE_IDforusers,study, andmessageCASE_USERS_DB_URICASE_STUDY_DB_URICASE_MESSAGE_DB_URICASE_GLOBAL_DB_URI
Derived names follow this convention:
users:<prefix><instanceId>_usersstudy:<prefix><instanceId>_studyDBmessage:<prefix><instanceId>_messageDBglobal:<prefix>global_infos
For local development, create .env.local from .env.local.example. .env.local is gitignored.
Example:
cp .env.local.example .env.local
pnpm dev doctor
pnpm dev doctor --ping --json
pnpm dev db indexes diff --database study --collection participant_identifiers
pnpm dev db indexes ensure --database study --collection participant_identifiers --dry-run
pnpm dev db indexes ensure --database study --collection participant_identifiersDevelopment
Requirements:
- Node.js 20+
- pnpm 10+
Install dependencies:
pnpm installRun the test suite:
pnpm testRun the CLI in development:
pnpm dev --help
pnpm dev doctor
pnpm dev doctor --ping
pnpm dev db indexes diff --help
pnpm dev db indexes ensure --helpBuild the bundled CLI:
pnpm buildRun the built CLI:
node dist/cli.js --helpnpm package behavior
This package publishes a single executable:
- binary name:
casectl - bundled entry:
dist/cli.js
After publishing, consumers can run it with:
npx @case-framework/case-cli --helpor install it globally:
npm install -g @case-framework/case-cli
casectl --helpLicense
Apache-2.0
