doum-cli 0.3.2

AI-powered terminal assistant that helps you with command-line tasks.
Documentation
# Command Options & Feature Proposals

## πŸ“‹ 1. μ»€λ§¨λ“œ μ˜΅μ…˜ μ œμ•ˆ

### A. Ask λͺ…λ Ήμ–΄ μ˜΅μ…˜
```rust
Ask {
    /// Question to ask
    question: String,
    
    /// Stream response (live output)
    #[arg(short = 's', long = "stream")]
    stream: bool,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum ask "Explain Rust" --stream  # μ‹€μ‹œκ°„ 슀트리밍
```

---

### B. Suggest λͺ…λ Ήμ–΄ μ˜΅μ…˜
```rust
Suggest {
    /// Request description
    request: String,

    /// Number of suggestions to generate
    #[arg(short = 'n', long = "num", default_value = "3")]
    num_suggestions: usize,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum suggest "monitor CPU" --num 5            # 5개 μ œμ•ˆ 생성
```

---

### D. Secret λͺ…λ Ήμ–΄ μ˜΅μ…˜
```rust
Secret {
    /// List all configured secrets (masked)
    #[arg(short = 'l', long = "list")]
    list: bool,
    
    /// Delete/remove secret
    #[arg(short = 'd', long = "delete")]
    delete: bool,
    
    /// Verify secret (test API call)
    #[arg(short = 'v', long = "verify")]
    verify: bool,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum secret --list                    # λͺ¨λ“  secret μƒνƒœ 확인
doum secret openai --verify           # OpenAI API ν‚€ 검증
doum secret anthropic --delete        # Anthropic secret μ‚­μ œ
```

---

### E. Switch λͺ…λ Ήμ–΄ μ˜΅μ…˜
```rust
Switch {
    /// Show current selection
    #[arg(short = 's', long = "show")]
    show: bool,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum switch --show                    # ν˜„μž¬ provider/model ν‘œμ‹œ
```

---

### F. Global μ˜΅μ…˜
```rust
#[derive(Parser, Debug)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Option<Commands>,
    
    /// Auto mode input
    #[arg(value_name = "INPUT")]
    pub input: Option<String>,
    
    /// Verbose output (debug info)
    #[arg(short = 'v', long = "verbose", global = true)]
    pub verbose: bool,
    
    /// Quiet mode (minimal output)
    #[arg(short = 'q', long = "quiet", global = true)]
    pub quiet: bool,
    
    /// Use specific provider for this command
    #[arg(long = "provider", global = true)]
    pub provider_override: Option<String>,
    
    /// Use specific model for this command
    #[arg(long = "model", global = true)]
    pub model_override: Option<String>,
    
    /// Disable web search for this command
    #[arg(long = "no-web-search", global = true)]
    pub no_web_search: bool,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum ask "What is Rust?" --verbose                    # 디버그 정보 ν‘œμ‹œ
doum suggest "find files" --quiet                     # μ΅œμ†Œ 좜λ ₯
doum ask "latest news" --provider anthropic           # μΌνšŒμ„± provider λ³€κ²½
doum suggest "list processes" --model gpt-5-mini      # μΌνšŒμ„± model λ³€κ²½
doum ask "Define AI" --no-web-search                  # μ›Ή 검색 λΉ„ν™œμ„±ν™”
```

---

## πŸš€ 2. μΆ”κ°€ λͺ…λ Ήμ–΄ μ œμ•ˆ

### A. `history` - λͺ…λ Ή 이λ ₯ 관리
```bash
doum history [OPTIONS]
```

**μ˜΅μ…˜:**
```rust
History {
    /// Show last N commands
    #[arg(short = 'n', default_value = "10")]
    num: usize,
    
    /// Search history
    #[arg(short = 's', long = "search")]
    search: Option<String>,
    
    /// Clear history
    #[arg(long = "clear")]
    clear: bool,
    
    /// Re-run command by ID
    #[arg(short = 'r', long = "rerun")]
    rerun: Option<usize>,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum history                      # 졜근 10개 ν‘œμ‹œ
doum history -n 50                # 졜근 50개
doum history --search "docker"    # "docker" 포함 검색
doum history --clear              # 이λ ₯ μ‚­μ œ
```

**μ €μž₯ ν˜•μ‹** (`~/.config/doum-cli/history.json`):
```json
[
  {
    "id": 1,
    "timestamp": "2025-11-26T14:30:22Z",
    "command": "ask",
    "input": "What is Docker?",
    "provider": "openai",
    "model": "gpt-5",
    "success": true
  }
]
```

---

### B. `upgrade` - μžλ™ μ—…λ°μ΄νŠΈ
```bash
doum upgrade [OPTIONS]
```

**μ˜΅μ…˜:**
```rust
Upgrade {
    /// Check for updates without installing
    #[arg(short = 'c', long = "check")]
    check: bool,
    
    /// Upgrade to specific version
    #[arg(short = 'v', long = "version")]
    version: Option<String>,
}
```

**λ™μž‘:**
1. GitHub Releases API 확인
2. ν˜„μž¬ 버전과 비ꡐ
3. μƒˆ 버전이 있으면 λ‹€μš΄λ‘œλ“œ 및 μ„€μΉ˜

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum upgrade                      # μ΅œμ‹  λ²„μ „μœΌλ‘œ μ—…λ°μ΄νŠΈ
doum upgrade --check              # μ—…λ°μ΄νŠΈ κ°€λŠ₯ μ—¬λΆ€λ§Œ 확인
doum upgrade --version 0.2.5      # νŠΉμ • λ²„μ „μœΌλ‘œ
```

**κ΅¬ν˜„ 아이디어:**
```rust
// src/cli/upgrade.rs
use reqwest;
use semver::Version;

pub async fn check_for_updates() -> Result<Option<String>> {
    let current = env!("CARGO_PKG_VERSION");
    let url = "https://api.github.com/repos/junhyungL/doum-cli/releases/latest";
    
    let response: serde_json::Value = reqwest::get(url).await?.json().await?;
    let latest = response["tag_name"].as_str().unwrap().trim_start_matches('v');
    
    if Version::parse(latest)? > Version::parse(current)? {
        Ok(Some(latest.to_string()))
    } else {
        Ok(None)
    }
}
```

---

### C. `context` - μ»¨ν…μŠ€νŠΈ 관리
```bash
doum context [OPTIONS]
```

**κΈ°λŠ₯:**
- ν˜„μž¬ λ””λ ‰ν† λ¦¬μ˜ 파일/ꡬ쑰λ₯Ό LLM μ»¨ν…μŠ€νŠΈλ‘œ 포함
- ν”„λ‘œμ νŠΈλ³„ μ»¨ν…μŠ€νŠΈ μ €μž₯

**μ˜΅μ…˜:**
```rust
Context {
    /// Add files to context
    #[arg(short = 'a', long = "add")]
    add: Vec<PathBuf>,
    
    /// Show current context
    #[arg(short = 's', long = "show")]
    show: bool,
}
```

**μ‚¬μš© μ˜ˆμ‹œ:**
```bash
doum context --add src/**/*.rs           # Rust 파일 μΆ”κ°€
doum context --show                      # ν˜„μž¬ μ»¨ν…μŠ€νŠΈ ν‘œμ‹œ
doum ask "Refactor this code" --with-context  # μ»¨ν…μŠ€νŠΈ 포함 질문
```

---

## πŸ“Œ 3. 버전 관리 방법 μ œμ•ˆ

### A. Semantic Versioning (semver)
```toml
[package]
version = "0.1.0"  # MAJOR.MINOR.PATCH
```

**κ·œμΉ™:**
- **MAJOR**: Breaking changes (config ν˜•μ‹ λ³€κ²½ λ“±)
- **MINOR**: μƒˆ κΈ°λŠ₯ μΆ”κ°€ (μƒˆ λͺ…λ Ήμ–΄, μ˜΅μ…˜)
- **PATCH**: 버그 μˆ˜μ •

---

### B. Upgrade λͺ…λ Ήμ–΄ κ΅¬ν˜„

**Cargo.toml**:
```toml
[dependencies]
self_update = "0.39"  # μžλ™ μ—…λ°μ΄νŠΈ 라이브러리
```

**src/cli/upgrade.rs**:
```rust
use self_update::backends::github::{ReleaseList, Update};
use self_update::cargo_crate_version;

pub fn handle_upgrade_command(check_only: bool, force: bool) -> Result<()> {
    let current_version = cargo_crate_version!();
    
    println!("πŸ” Checking for updates...");
    println!("Current version: {}", current_version);
    
    let releases = ReleaseList::configure()
        .repo_owner("junhyungL")
        .repo_name("doum-cli")
        .build()?
        .fetch()?;
    
    if let Some(latest) = releases.first() {
        let latest_version = latest.version.trim_start_matches('v');
        
        if latest_version > current_version || force {
            if check_only {
                println!("✨ New version available: {}", latest_version);
                return Ok(());
            }
            
            println!("πŸ“₯ Downloading version {}...", latest_version);
            
            Update::configure()
                .repo_owner("junhyungL")
                .repo_name("doum-cli")
                .bin_name("doum")
                .current_version(current_version)
                .build()?
                .update()?;
            
            println!("βœ… Successfully upgraded to {}", latest_version);
        } else {
            println!("βœ… Already up-to-date!");
        }
    }
    
    Ok(())
}
```

---