Context
The init command currently only prints placeholder messages but doesn't implement the interactive setup wizard described in its documentation.
Location: src/commands/init.rs:64
Current Behavior
When running crately init (without --no-interactive):
Interactive Setup Wizard
========================
This wizard will guide you through:
1. OpenAI API key setup
2. Cache configuration
3. Test run validation
4. Setup completion
Interactive wizard to be implemented
Initialization complete!
Expected Behavior
The wizard should interactively guide users through initial configuration:
-
OpenAI API Key Setup
- Prompt for API key with masked input
- Validate API key by making test request
- Store in config file or environment
- Provide clear error messages if invalid
-
Cache Configuration
- Prompt for cache location (default: XDG_CACHE_HOME)
- Prompt for cache size limits
- Validate directory is writable
- Create directory if needed
-
Test Run Validation
- Make a test API call to validate setup
- Verify database connectivity
- Check all dependencies available
-
Setup Completion
- Display summary of configured settings
- Show config file location
- Provide next steps
Implementation Requirements
Dependencies
dialoguer crate for interactive prompts
rpassword for secure API key input
- Use existing
ConfigManager for config persistence
User Experience
- Clear, step-by-step prompts
- Validation with helpful error messages
- Ability to skip optional steps
- Safe defaults for all settings
- Progress indication
Files to Modify
src/commands/init.rs (main implementation)
Cargo.toml (add dialoguer dependency)
CLAUDE.md (update documentation)
Example Interactive Flow
Welcome to Crately Setup!
========================
Step 1/4: OpenAI API Key Configuration
--------------------------------------
Enter your OpenAI API key (or press Enter to skip): [hidden input]
✓ API key validated successfully
Step 2/4: Cache Configuration
------------------------------
Cache directory [~/.cache/crately]: [user input]
Cache size limit in GB [10]: [user input]
✓ Cache directory created
Step 3/4: Testing Configuration
--------------------------------
⋯ Running test API call...
✓ Configuration validated
Step 4/4: Setup Complete
------------------------
✓ Configuration saved to: ~/.config/crately/config.toml
✓ Cache directory: ~/.cache/crately
✓ API key configured
Next steps:
- Run 'crately doctor' to verify your configuration
- Run 'crately serve' to start the server
Testing Requirements
Success Criteria
Related Files
src/commands/init.rs - Main implementation needed
src/actors/config.rs - ConfigManager for persistence
CLAUDE.md - Documentation to update
Priority
Medium - Quality of life improvement for first-time users
Context
The
initcommand currently only prints placeholder messages but doesn't implement the interactive setup wizard described in its documentation.Location:
src/commands/init.rs:64Current Behavior
When running
crately init(without--no-interactive):Expected Behavior
The wizard should interactively guide users through initial configuration:
OpenAI API Key Setup
Cache Configuration
Test Run Validation
Setup Completion
Implementation Requirements
Dependencies
dialoguercrate for interactive promptsrpasswordfor secure API key inputConfigManagerfor config persistenceUser Experience
Files to Modify
src/commands/init.rs(main implementation)Cargo.toml(adddialoguerdependency)CLAUDE.md(update documentation)Example Interactive Flow
Testing Requirements
--no-interactiveflag still workscargo nextest runcargo clippy --all-targetsSuccess Criteria
Related Files
src/commands/init.rs- Main implementation neededsrc/actors/config.rs- ConfigManager for persistenceCLAUDE.md- Documentation to updatePriority
Medium - Quality of life improvement for first-time users