Overview
The DefProd CLI provides a command-line interface for interacting with DefProd product definitions. It supports both interactive REPL mode and one-shot command execution.
Installation
npm install -g @defprod/cli
Then run:
defprod
Building from Source
git clone https://github.com/defprod1/defprod-cli.git
cd defprod-cli
npm install
npm run build
node dist/main.js
Usage Modes
Interactive REPL Mode: Start the CLI without arguments to enter REPL mode where you can execute multiple commands in a session.
$ defprod
DefProd CLI Agent
>
One-shot Mode: Execute commands directly by passing them as arguments:
$ defprod /list stories
$ defprod "Create a user story for login with 2FA"
Natural Language Commands
Commands without a "/" prefix are interpreted as natural language and processed by the LLM. This allows you to interact with DefProd using conversational commands.
Quick Reference
| Command |
Description |
Category |
| /list |
List entities (stories, areas, elements) |
Listing Entities |
| /view |
View entity details |
Viewing Entities |
| /product |
Manage product context |
Product Management |
| /config |
Manage CLI configuration |
Configuration |
| /search |
Search across all entities |
Searching |
| /reorder |
Reorder entities (areas, stories) |
Reordering |
| /init |
Run configuration setup wizard |
Configuration |
| /help |
Show help information |
Other |
| /exit |
Exit the CLI |
Other |
| /chat |
Manage chat sessions |
Other |
Global Options
These options are available for all commands:
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Command Categories
/config
- Manage CLI configuration
/init
- Run configuration setup wizard
/list
- List entities (stories, areas, elements)
/help
- Show help information
/exit
- Exit the CLI
/chat
- Manage chat sessions
/product
- Manage product context
/reorder
- Reorder entities (areas, stories)
/search
- Search across all entities
/view
- View entity details
Command Reference
/list
List entities (stories, areas, elements)
/list
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--filter <query>, -f
Filter results by keyword
Subcommands
/list stories
- List user stories
/list areas
- List areas
/list elements
- List architecture elements
/list stories
List user stories
/list stories
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--filter <query>, -f
Filter results by keyword
Examples
/list stories
/list stories -s
/list areas
List areas
/list areas
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--filter <query>, -f
Filter results by keyword
Examples
/list areas
/list areas -s
/list elements
List architecture elements
/list elements
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--filter <query>, -f
Filter results by keyword
Examples
/list elements
/list elements -s
/view
View entity details
/view
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Subcommands
/view product
- View current product
/view brief
- View current product brief
/view story
- View a user story (by ID, name, or list number)
/view area
- View an area (by ID, name, or list number)
/view element
- View an architecture element (by dotted number or "root")
/view architecture
- View architecture
/view product
View current product
/view product
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view product
/view product -s
/view brief
View current product brief
/view brief
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view brief
/view brief -s
/view story
View a user story (by ID, name, or list number)
/view story <id|name|#>
Arguments
<id|name|#>required
Story identifier (ID, name, or list number)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view story example-id
/view story -s
/view area
View an area (by ID, name, or list number)
/view area <id|name|#>
Arguments
<id|name|#>required
Area identifier (ID, name, or list number)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view area example-id
/view area -s
/view element
View an architecture element (by dotted number or "root")
/view element <number|root>
Arguments
<number|root>required
Element identifier (dotted number like "1.2.1" or "root")
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view element example-id
/view element -s
/view architecture
View architecture
/view architecture
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/view architecture
/view architecture -s
/product
Manage product context
/product
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Subcommands
/product list
- List all available products
/product set
- Set current product (by ID, name, or list number)
/product current
- Show currently selected product
/product unset
- Clear current product
Examples
/product
/product -s
/product list
List all available products
/product list
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/product list
/product list -s
/product set
Set current product (by ID, name, or list number)
/product set <id|name|#>
Arguments
<id|name|#>required
Product identifier (ID, name, or list number)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/product set example-id
/product set -s
/product current
Show currently selected product
/product current
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/product current
/product current -s
/product unset
Clear current product
/product unset
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/product unset
/product unset -s
/config
Manage CLI configuration
/config
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Subcommands
/config show
- Display current configuration
/config set
- Set a configuration value
/config unset
- Remove a configuration value
/config reset
- Reset to default configuration
Examples
/config
/config -s
/config show
Display current configuration
/config show
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/config show
/config show -s
/config set
Set a configuration value
/config set <key> <value>
Arguments
<key>required
Configuration key
<value>required
Configuration value
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/config set exampleKey exampleValue
/config set -s
/config unset
Remove a configuration value
/config unset <key>
Arguments
<key>required
Configuration key to remove
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/config unset exampleKey
/config unset -s
/config reset
Reset to default configuration
/config reset
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/config reset
/config reset -s
/search
Search across all entities
/search <query>
Arguments
<query>required
Search query (can be multiple words)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/search "example query"
/search -s
/reorder
Reorder entities (areas, stories)
/reorder
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Subcommands
/reorder areas
- Reorder areas within the current product
/reorder stories
- Reorder user stories within an area
Examples
/reorder
/reorder -s
/reorder areas
Reorder areas within the current product
/reorder areas <from> <to>
Arguments
<from>required
Source position (1-based)
<to>required
Target position (1-based)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/reorder areas 1 1
/reorder areas -s
/reorder stories
Reorder user stories within an area
/reorder stories <area> <from> <to>
Arguments
<area>required
Area identifier (ID, name, or list number)
<from>required
Source position (1-based)
<to>required
Target position (1-based)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/reorder stories area-id 1 1
/reorder stories -s
/init
Run configuration setup wizard
/init
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
/help
Show help information
/help [command]
Arguments
commandoptional
Optional command name to show specific help (e.g., list, view, product, config, reorder)
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/help example
/help -s
/exit
Exit the CLI
/exit
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
/chat
Manage chat sessions
/chat
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Subcommands
/chat new
- Create a new empty chat session and switch to it
/chat save
- Save current session under a name
/chat list
- Show all stored chat sessions with IDs, names, created/updated timestamps
/chat load
- Load the session as the active chat (replaces current in-memory session)
/chat delete
- Permanently delete a saved chat session
/chat rename
- Rename a session
/chat fork
- Make a copy of a session and load it
/chat history
- Show the active session message list with numbering
/chat remove
- Delete an entry from the active session's message history
/chat summarize
- Summarize the current session into fewer entries
/chat clear
- Clear only the active chat history
/chat new
Create a new empty chat session and switch to it
/chat new name
Arguments
namerequired
Name for the new chat session
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat new example
/chat new -s
/chat save
Save current session under a name
/chat save name
Arguments
namerequired
Name to save the session as
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat save example
/chat save -s
/chat list
Show all stored chat sessions with IDs, names, created/updated timestamps
/chat list
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat list
/chat list -s
/chat load
Load the session as the active chat (replaces current in-memory session)
/chat load id
Arguments
idrequired
Session ID to load (numeric shortcuts like "1" are padded to "001")
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat load example-id
/chat load -s
/chat delete
Permanently delete a saved chat session
/chat delete id
Arguments
idrequired
Session ID to delete (numeric shortcuts like "1" are padded to "001")
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat delete example-id
/chat delete -s
/chat rename
Rename a session
/chat rename id new-name
Arguments
idrequired
Session ID to rename
new-namerequired
New name for the session
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat rename example-id example
/chat rename -s
/chat fork
Make a copy of a session and load it
/chat fork id new-name
Arguments
idrequired
Session ID to fork
new-namerequired
Name for the forked session
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat fork example-id example
/chat fork -s
/chat history
Show the active session message list with numbering
/chat history
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--no-tools, -t
Omit toolCalls and toolResults entries from output
--no-working, -w
Omit assistant entries with stage "work" (show only final results)
Subcommands
/chat history summary
- Show a truncated summary of the active session message list
Examples
/chat history
/chat history -s
/chat history summary
Show a truncated summary of the active session message list
/chat history summary
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
--no-tools, -t
Omit toolCalls and toolResults entries from output
--no-working, -w
Omit assistant entries with stage "work" (show only final results)
Examples
/chat history summary
/chat history summary -s
/chat remove
Delete an entry from the active session's message history
/chat remove index
Arguments
indexrequired
1-indexed entry number to remove
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat remove example
/chat remove -s
/chat summarize
Summarize the current session into fewer entries
/chat summarize
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat summarize
/chat summarize -s
/chat clear
Clear only the active chat history
/chat clear
Options
--strict, -s
Enable strict mode (no fuzzy matching)
--json, -j
Output in JSON format
--out <value>, -o
Save output to file. Format: --out <file> or --out <file>:t (tee) or --out <file>:a (append) or --out <file>:ta (tee+append)
Examples
/chat clear
/chat clear -s
Common Examples
Set Product Context
/product list
/product set defprod
List Entities
/list stories
/list stories --filter login
/list areas
View Entities
/view story "user login"
/view area "authentication"
/view product
Search
/search "authentication"
/search "login" --strict
Natural Language Commands
Create a user story for passwordless login using Passkeys
Update the acceptance criteria for USR-124
Export the current product for API integration
Configuration
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 |
All fields are optional. You can also use environment variables:
- DEFPROD_CLI_CONFIG - Override config file path
- DEFPROD_AI_PROVIDER - AI provider
- DEFPROD_AI_API_KEY - AI provider API key
- DEFPROD_AI_MODEL - AI model name
- DEFPROD_API_KEY - DefProd API key
- DEFPROD_API_URL - DefProd API URL
- DEFPROD_CURRENT_PRODUCT - Current product ID
- DEFPROD_STRICT_MODE - Enable strict mode (true/false)
Environment variables override config file values.
Use /config show to display current configuration and /config set <key> <value> to update settings.