feat: add API keys management and config CRUD operations
- Add api_keys and feishu_apps to config.json - Add env export/init commands for shell integration - Add config CRUD: list, set, delete, init - Add config.json.example template - Add config.json to .gitignore for security - Update README with new commands Usage: mycli env export # Export all env vars mycli config set key value # Set config value mycli config delete key # Delete config key
This commit is contained in:
@@ -64,13 +64,31 @@ mycli self update # Update mycli
|
||||
mycli self uninstall # Uninstall mycli
|
||||
mycli self info # Show installation info
|
||||
|
||||
# Configuration (config.json)
|
||||
mycli config show # Show full config
|
||||
mycli config get paths # Get paths section
|
||||
mycli config get paths.apaam # Get specific path
|
||||
mycli config paths # List all paths with existence check
|
||||
mycli config where # Show config file location
|
||||
mycli config edit # Edit config in $EDITOR
|
||||
# Configuration (config.json) - 增删改查
|
||||
mycli config show # Show full config
|
||||
mycli config list # List top-level sections
|
||||
mycli config get paths # Get paths section
|
||||
mycli config get paths.apaam # Get specific path
|
||||
mycli config get api_keys.deepseek # Get API key
|
||||
mycli config set paths.new ~/Documents/new # Set simple value
|
||||
mycli config set api_keys.newkey abc123 # Set new API key
|
||||
mycli config set --json ssh_hosts.new '{"host":"user@host","port":22}'
|
||||
mycli config delete paths.old # Delete a key
|
||||
mycli config delete api_keys.old -y # Delete without confirmation
|
||||
mycli config paths # List all paths with existence check
|
||||
mycli config where # Show config file location
|
||||
mycli config edit # Edit config in $EDITOR
|
||||
mycli config init # Create config from template
|
||||
|
||||
# Environment Variables (API Keys)
|
||||
mycli env status # Show paths, API keys, Feishu status
|
||||
mycli env export # Print all export statements
|
||||
mycli env export deepseek # Export specific API key
|
||||
mycli env export qwen
|
||||
mycli env export feishu # Export all Feishu apps
|
||||
mycli env export claude # Export specific Feishu app
|
||||
eval "$(mycli env export)" # Load all in current shell
|
||||
mycli env init # Print shell init snippet
|
||||
```
|
||||
|
||||
## Configuration
|
||||
@@ -80,6 +98,30 @@ All settings are stored in `mycli/config.json`:
|
||||
- `ssh_hosts`: SSH connection settings
|
||||
- `git_proxies`: Git proxy URLs
|
||||
- `openfoam`: OpenFOAM mount settings
|
||||
- `api_keys`: API keys (deepseek, qwen)
|
||||
- `feishu_apps`: Feishu app credentials
|
||||
|
||||
### Security Note
|
||||
|
||||
`config.json` contains sensitive information (API keys) and is **gitignored**.
|
||||
The repository includes `config.json.example` as a template.
|
||||
|
||||
### Setup
|
||||
|
||||
1. Copy the example config:
|
||||
```bash
|
||||
cp mycli/config.json.example mycli/config.json
|
||||
```
|
||||
|
||||
2. Edit with your actual API keys:
|
||||
```bash
|
||||
mycli config edit
|
||||
```
|
||||
|
||||
3. Add to your `~/.zshrc` to auto-load:
|
||||
```bash
|
||||
eval "$(mycli env export 2>/dev/null)"
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
|
||||
|
||||
Reference in New Issue
Block a user