@defprod/cli
v0.1.6
Published
DefProd CLI - Command-line interface for DefProd product definitions
Downloads
62
Maintainers
Readme
DefProd CLI
Command-line interface for DefProd product definitions.
Installation
npm install -g @defprod/cliThen run:
defprodBuilding from Source
git clone https://github.com/defprod1/defprod-cli.git
cd defprod-cli
npm install
npm run build
node dist/main.jsConfiguration
The CLI stores configuration in ~/.config/defprod/cli.json. Run defprod for the first time to launch the init wizard, or create the file manually:
{
"aiProvider": "gemini",
"aiProviderApiKey": "your-ai-api-key",
"aiModel": "gemini-2.0-flash",
"defprodApiKey": "your-defprod-api-key",
"defprodApiUrl": "https://api.defprod.one/api/v1",
"currentProduct": "your-product-id",
"strictMode": false
}| Field | Description | Default |
|--------------------|------------------------------------------------------------------------------|----------------------------------|
| aiProvider | LLM provider: openai, anthropic, gemini, or perplexity | gemini |
| aiProviderApiKey | API key for your chosen AI provider | — |
| aiModel | Model name (e.g. gpt-4o, claude-3-5-sonnet-20241022, gemini-2.0-flash) | Provider-specific |
| defprodApiKey | Your DefProd API key | — |
| defprodApiUrl | DefProd API base URL | https://api.defprod.one/api/v1 |
| currentProduct | Default product ID to use | — |
| strictMode | Disable fuzzy matching | false |
| proxy | HTTP proxy configuration object (see below) | — |
Proxy Configuration
To route all CLI requests through an HTTP proxy (common in corporate environments), add a proxy object:
{
"proxy": {
"url": "http://proxy.corp.com:8080",
"username": "user",
"password": "pass"
}
}| Field | Description | Required |
|------------------|----------------------------------------------------|----------|
| proxy.url | Proxy URL (e.g. http://proxy.corp.com:8080) | Yes |
| proxy.username | Proxy authentication username | No |
| proxy.password | Proxy authentication password | No |
Set proxy fields via commands: /config set proxy.url http://proxy.corp.com:8080.
When no proxy config is set, the CLI honours the standard HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables.
All fields are optional. You can also use environment variables:
DEFPROD_CLI_CONFIG- Override config file pathDEFPROD_AI_PROVIDER- AI providerDEFPROD_AI_API_KEY- AI provider API keyDEFPROD_AI_MODEL- AI model nameDEFPROD_API_KEY- DefProd API keyDEFPROD_API_URL- DefProd API URLDEFPROD_CURRENT_PRODUCT- Current product IDDEFPROD_STRICT_MODE- Enable strict mode (true/false)
Environment variables override config file values.
Usage
Interactive REPL Mode
Start the CLI without arguments to enter REPL mode:
$ defprod
DefProd CLI Agent
>One-shot Mode
Execute commands directly:
$ defprod /list stories
$ defprod "Create a user story for login with 2FA"Commands
Product Management
/product list- List all available products/product set <id|name>- Set current product/product current- Show currently selected product/product unset- Clear current product
Listing Entities
/list stories- List user stories/list areas- List areas/list architecture- List architecture/list components- List components/list templates- List templates/list users- List users
Options:
--filter <query>- Filter results by keyword--json- Output in JSON format
Viewing Entities
/view product- View current product/view story <id|name|query>- View a user story/view area <id|name|query>- View an area/view template <id|name|#>- View a template/view architecture- View architecture
Options:
--json- Output in JSON format--strict- Use strict matching (no fuzzy search)
Searching
/search "<query>"- Search across all entities
Options:
--json- Output in JSON format--strict- Use strict keyword matching
Configuration
/config show- Display current configuration/config set <key> <value>- Set a configuration value/config unset <key>- Remove a configuration value/config reset- Reset to default configuration
Natural Language Commands
Commands without a / prefix are interpreted as natural language and processed by the LLM:
> Create a user story for passwordless login using Passkeys
> Update the acceptance criteria for USR-124
> Export the current product for API integrationExamples
Set product context
[Democrify]> /product list
1. DefProd
2. Democrify
[DefProd]> /product set defprod
Current product: DefProd (PRODUCT-1234)List entities
[DefProd]> /list stories
# ID Title
─────────────────────────────────────────────────
1. USR-42 User Login
2. USR-43 Password Reset
3. USR-44 Admin Login
> /list stories --filter login
[DefProd]> /list stories
# ID Title
─────────────────────────────────────────────────
1. USR-42 User Login
3. USR-44 Admin LoginView entities
[DefProd]> /view story "subscription change"
Title: System enforces subscription change rules to prevent invalid state transitions
ID: PAY-38
Description: As a system, I want to enforce a state-machine-based rule engine that determines valid subscription actions based on current status, pending changes, and target plan so that users cannot make invalid subscription transitions.
Acceptance Criteria:
- Rule engine determines valid actions based on current subscription state
- Rule engine considers pending changes (e.g. pending downgrade) when evaluating allowed actions
- Invalid transitions are blocked with clear error messages
- Rules are shared between frontend and backend via defprod-commonNatural language creation
> Add a new user story for passwordless login using Passkeys
LLM Output:
Created User Story USR-45
Title: Passwordless Login
Description: ...License
MIT
