zarz 0.3.4-alpha → 0.3.5-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +193 -22
- package/bin/zarz.js +10 -31
- package/package.json +6 -10
- package/scripts/postinstall.js +162 -40
- package/Cargo.lock +0 -2815
- package/Cargo.toml +0 -30
- package/QUICKSTART.md +0 -326
- package/src/cli.rs +0 -201
- package/src/config.rs +0 -249
- package/src/conversation_store.rs +0 -183
- package/src/executor.rs +0 -166
- package/src/fs_ops.rs +0 -117
- package/src/intelligence/context.rs +0 -143
- package/src/intelligence/mod.rs +0 -60
- package/src/intelligence/rust_parser.rs +0 -141
- package/src/intelligence/symbol_search.rs +0 -97
- package/src/main.rs +0 -873
- package/src/mcp/client.rs +0 -316
- package/src/mcp/config.rs +0 -133
- package/src/mcp/manager.rs +0 -186
- package/src/mcp/mod.rs +0 -12
- package/src/mcp/types.rs +0 -170
- package/src/providers/anthropic.rs +0 -242
- package/src/providers/glm.rs +0 -259
- package/src/providers/mod.rs +0 -103
- package/src/providers/openai.rs +0 -247
- package/src/repl.rs +0 -2153
- package/src/session.rs +0 -173
package/Cargo.toml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "zarzcli"
|
|
3
|
-
version = "0.3.4-ALPHA"
|
|
4
|
-
edition = "2024"
|
|
5
|
-
|
|
6
|
-
[dependencies]
|
|
7
|
-
anyhow = "1.0.100"
|
|
8
|
-
clap = { version = "4.5.51", features = ["derive"] }
|
|
9
|
-
dialoguer = "0.12"
|
|
10
|
-
reqwest = { version = "0.12.24", features = ["json", "gzip", "brotli", "stream", "rustls-tls"] }
|
|
11
|
-
serde = { version = "1.0.228", features = ["derive"] }
|
|
12
|
-
serde_json = "1.0.145"
|
|
13
|
-
similar = "2.7.0"
|
|
14
|
-
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread", "fs", "io-util", "process"] }
|
|
15
|
-
async-trait = "0.1.89"
|
|
16
|
-
rustyline = { version = "17.0.2", features = ["custom-bindings"] }
|
|
17
|
-
crossterm = "0.29.0"
|
|
18
|
-
futures = "0.3.31"
|
|
19
|
-
tokio-stream = "0.1.17"
|
|
20
|
-
eventsource-stream = "0.2.3"
|
|
21
|
-
ignore = "0.4.25"
|
|
22
|
-
walkdir = "2.5.0"
|
|
23
|
-
tree-sitter = "0.25.10"
|
|
24
|
-
syn = { version = "2.0.108", features = ["full", "parsing", "visit"] }
|
|
25
|
-
regex = "1.12.2"
|
|
26
|
-
bytes = "1.10.1"
|
|
27
|
-
toml = "0.9.8"
|
|
28
|
-
quote = "1.0.41"
|
|
29
|
-
dirs = "6.0.0"
|
|
30
|
-
chrono = { version = "0.4.39", features = ["serde"] }
|
package/QUICKSTART.md
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
# ZarzCLI Quick Start Guide
|
|
2
|
-
|
|
3
|
-
ZarzCLI is an AI-powered coding assistant that works directly from your command line, similar to Claude Code and Codex CLI.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
1. Make sure you have Rust installed:
|
|
8
|
-
```bash
|
|
9
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
2. Build ZarzCLI:
|
|
13
|
-
```bash
|
|
14
|
-
cd ZarzCLI
|
|
15
|
-
cargo build --release
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
3. Set up your API key:
|
|
19
|
-
```bash
|
|
20
|
-
# For Claude (Anthropic)
|
|
21
|
-
export ANTHROPIC_API_KEY=sk-ant-your-key-here
|
|
22
|
-
|
|
23
|
-
# Or for OpenAI
|
|
24
|
-
export OPENAI_API_KEY=sk-your-key-here
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Basic Usage
|
|
28
|
-
|
|
29
|
-
### 1. Interactive Chat (Default)
|
|
30
|
-
|
|
31
|
-
Just run `zarz` to start an interactive session:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
./zarz.bat # Windows
|
|
35
|
-
./zarz.sh # Linux/Mac
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
You'll enter a chat session where you can ask questions and edit code:
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
Zarz Interactive Session
|
|
42
|
-
Type /help for available commands, /quit to exit
|
|
43
|
-
|
|
44
|
-
> What does this codebase do?
|
|
45
|
-
Assistant: [AI analyzes your project...]
|
|
46
|
-
|
|
47
|
-
> /edit src/main.rs
|
|
48
|
-
Loaded src/main.rs for editing
|
|
49
|
-
|
|
50
|
-
> Add better error handling
|
|
51
|
-
Assistant: [AI suggests changes with file blocks]
|
|
52
|
-
File changes detected. Use /diff to review, /apply to apply
|
|
53
|
-
|
|
54
|
-
> /diff
|
|
55
|
-
[shows unified diff]
|
|
56
|
-
|
|
57
|
-
> /apply
|
|
58
|
-
Applied changes to src/main.rs
|
|
59
|
-
|
|
60
|
-
> /quit
|
|
61
|
-
Goodbye!
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 2. One-Shot Questions
|
|
65
|
-
|
|
66
|
-
Send a single question and get an answer:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
zarz --message "Explain what this function does" -f src/auth.rs
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Or shorter with alias:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
zarz --msg "Fix the bug in this file" -f src/main.rs
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### 3. Switch Models On-the-Fly
|
|
79
|
-
|
|
80
|
-
Start with one model, switch to another mid-conversation:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
zarz
|
|
84
|
-
|
|
85
|
-
> /model claude-haiku-4-5
|
|
86
|
-
Switched to model: claude-haiku-4-5
|
|
87
|
-
Provider: anthropic
|
|
88
|
-
|
|
89
|
-
> Add docstrings
|
|
90
|
-
[Uses faster, cheaper Haiku model]
|
|
91
|
-
|
|
92
|
-
> /model gpt-5-codex
|
|
93
|
-
Switched to model: gpt-5-codex
|
|
94
|
-
Provider: openai
|
|
95
|
-
|
|
96
|
-
> Optimize this algorithm
|
|
97
|
-
[Uses GPT-5 Codex]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Available Models
|
|
101
|
-
|
|
102
|
-
### Anthropic Claude
|
|
103
|
-
|
|
104
|
-
- **claude-sonnet-4-5-20250929** (default) - Best for complex coding ($3/$15 per 1M tokens)
|
|
105
|
-
- **claude-haiku-4-5** - Fast and cheap ($1/$5 per 1M tokens)
|
|
106
|
-
- **claude-opus-4-1** - Most powerful for complex tasks
|
|
107
|
-
|
|
108
|
-
### OpenAI
|
|
109
|
-
|
|
110
|
-
- **gpt-5-codex** - Optimized for coding ($1.25/$10 per 1M tokens)
|
|
111
|
-
- **gpt-4o** - Multimodal
|
|
112
|
-
- **gpt-4-turbo** - Fast
|
|
113
|
-
|
|
114
|
-
## In-Chat Commands
|
|
115
|
-
|
|
116
|
-
- `/help` - Show all commands and current model
|
|
117
|
-
- `/model <name>` - Switch AI model
|
|
118
|
-
- `/edit <file>` - Load a file for editing
|
|
119
|
-
- `/diff` - Preview pending changes
|
|
120
|
-
- `/apply` - Apply pending changes
|
|
121
|
-
- `/undo` - Discard pending changes
|
|
122
|
-
- `/run <command>` - Execute shell command
|
|
123
|
-
- `/search <symbol>` - Find symbol in codebase
|
|
124
|
-
- `/context <query>` - Find relevant files
|
|
125
|
-
- `/files` - List loaded files
|
|
126
|
-
- `/clear` - Clear conversation history
|
|
127
|
-
- `/quit` - Exit
|
|
128
|
-
|
|
129
|
-
## Common Workflows
|
|
130
|
-
|
|
131
|
-
### Workflow 1: Code Review and Fix
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
zarz
|
|
135
|
-
|
|
136
|
-
> /edit src/server.rs
|
|
137
|
-
> Review this code for security issues
|
|
138
|
-
[AI finds issues]
|
|
139
|
-
|
|
140
|
-
> Fix the SQL injection vulnerability
|
|
141
|
-
[AI provides fix with file blocks]
|
|
142
|
-
|
|
143
|
-
> /diff
|
|
144
|
-
[Review changes]
|
|
145
|
-
|
|
146
|
-
> /apply
|
|
147
|
-
[Changes applied]
|
|
148
|
-
|
|
149
|
-
> /run cargo test
|
|
150
|
-
[Verify tests pass]
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Workflow 2: Add Feature with Cost Optimization
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
zarz
|
|
157
|
-
|
|
158
|
-
# Use Sonnet for planning
|
|
159
|
-
> Design an authentication system with JWT
|
|
160
|
-
|
|
161
|
-
# Switch to Haiku for implementation (cheaper)
|
|
162
|
-
> /model claude-haiku-4-5
|
|
163
|
-
> Implement the JWT authentication based on your design
|
|
164
|
-
|
|
165
|
-
# Back to Sonnet for complex parts
|
|
166
|
-
> /model claude-sonnet-4-5-20250929
|
|
167
|
-
> Add rate limiting and refresh token logic
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Workflow 3: Multi-File Refactoring
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
zarz
|
|
174
|
-
|
|
175
|
-
> /edit src/main.rs
|
|
176
|
-
> /edit src/config.rs
|
|
177
|
-
> /edit src/handlers.rs
|
|
178
|
-
|
|
179
|
-
> Refactor these files to use async/await consistently
|
|
180
|
-
|
|
181
|
-
> /diff
|
|
182
|
-
[Shows changes across all files]
|
|
183
|
-
|
|
184
|
-
> /apply
|
|
185
|
-
[Applies all changes]
|
|
186
|
-
|
|
187
|
-
> /run cargo check
|
|
188
|
-
[Verify code compiles]
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## Legacy Commands (Still Supported)
|
|
192
|
-
|
|
193
|
-
### Ask Mode
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
zarz ask --prompt "What does this do?" src/main.rs
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Rewrite Mode
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
zarz rewrite --instructions "Add error handling" src/lib.rs
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Explicit Chat Mode
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
zarz chat
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Configuration
|
|
212
|
-
|
|
213
|
-
### Environment Variables
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
# Model selection
|
|
217
|
-
export ZARZ_MODEL=claude-sonnet-4-5-20250929
|
|
218
|
-
|
|
219
|
-
# Provider selection
|
|
220
|
-
export ZARZ_PROVIDER=anthropic # or openai
|
|
221
|
-
|
|
222
|
-
# Anthropic settings
|
|
223
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
224
|
-
export ANTHROPIC_API_URL=https://api.anthropic.com/v1/messages
|
|
225
|
-
export ANTHROPIC_TIMEOUT_SECS=120
|
|
226
|
-
|
|
227
|
-
# OpenAI settings
|
|
228
|
-
export OPENAI_API_KEY=sk-...
|
|
229
|
-
export OPENAI_API_URL=https://api.openai.com/v1/chat/completions
|
|
230
|
-
export OPENAI_TIMEOUT_SECS=120
|
|
231
|
-
|
|
232
|
-
# Advanced settings
|
|
233
|
-
export ZARZ_MAX_OUTPUT_TOKENS=4096
|
|
234
|
-
export ZARZ_TEMPERATURE=0.3
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Per-Command Overrides
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
# Use specific model
|
|
241
|
-
zarz --model claude-haiku-4-5
|
|
242
|
-
|
|
243
|
-
# Use OpenAI instead of default
|
|
244
|
-
zarz --provider openai --model gpt-5-codex
|
|
245
|
-
|
|
246
|
-
# Custom endpoint
|
|
247
|
-
zarz --endpoint https://custom-api.example.com
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## Tips for Best Results
|
|
251
|
-
|
|
252
|
-
1. **Be Specific**: "Add error handling to the login function" is better than "improve the code"
|
|
253
|
-
|
|
254
|
-
2. **Use Context**: Load relevant files with `/edit` before asking questions
|
|
255
|
-
|
|
256
|
-
3. **Iterate**: Don't try to do everything at once. Make small, focused changes
|
|
257
|
-
|
|
258
|
-
4. **Review Before Applying**: Always `/diff` before `/apply`
|
|
259
|
-
|
|
260
|
-
5. **Choose the Right Model**:
|
|
261
|
-
- Sonnet 4.5: Complex refactoring, architecture decisions
|
|
262
|
-
- Haiku 4.5: Quick fixes, adding docstrings, simple tasks
|
|
263
|
-
- GPT-5 Codex: Agentic workflows, algorithm optimization
|
|
264
|
-
|
|
265
|
-
6. **Cost Optimization**: Start with Sonnet for planning, switch to Haiku for implementation
|
|
266
|
-
|
|
267
|
-
## Troubleshooting
|
|
268
|
-
|
|
269
|
-
### API Key Not Found
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
Error: Environment variable ANTHROPIC_API_KEY is required
|
|
273
|
-
|
|
274
|
-
# Fix:
|
|
275
|
-
export ANTHROPIC_API_KEY=sk-ant-your-key
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Model Not Found
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
Error: Unknown model provider for 'typo-model'
|
|
282
|
-
|
|
283
|
-
# Fix: Use /model without arguments to see available models
|
|
284
|
-
> /model
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Build Errors
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# Clean and rebuild
|
|
291
|
-
cargo clean
|
|
292
|
-
cargo build --release
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
## Next Steps
|
|
296
|
-
|
|
297
|
-
- Read [MODELS.md](MODELS.md) for detailed model information
|
|
298
|
-
- Check [README.md](README.md) for full documentation
|
|
299
|
-
- Report issues: https://github.com/fapzarz/zarzcli/issues
|
|
300
|
-
|
|
301
|
-
## Quick Reference Card
|
|
302
|
-
|
|
303
|
-
```
|
|
304
|
-
┌─────────────────────────────────────────────────┐
|
|
305
|
-
│ ZarzCLI Quick Reference │
|
|
306
|
-
├─────────────────────────────────────────────────┤
|
|
307
|
-
│ Start Chat: zarz │
|
|
308
|
-
│ One-Shot: zarz --message "prompt" │
|
|
309
|
-
│ With Files: zarz -f file.rs │
|
|
310
|
-
│ │
|
|
311
|
-
│ In Chat: │
|
|
312
|
-
│ /help Show all commands │
|
|
313
|
-
│ /model <name> Switch AI model │
|
|
314
|
-
│ /edit <file> Load file │
|
|
315
|
-
│ /diff Preview changes │
|
|
316
|
-
│ /apply Apply changes │
|
|
317
|
-
│ /undo Discard changes │
|
|
318
|
-
│ /run <cmd> Execute command │
|
|
319
|
-
│ /quit Exit │
|
|
320
|
-
│ │
|
|
321
|
-
│ Models: │
|
|
322
|
-
│ claude-sonnet-4-5-20250929 (default) │
|
|
323
|
-
│ claude-haiku-4-5 (fast/cheap) │
|
|
324
|
-
│ gpt-5-codex (OpenAI) │
|
|
325
|
-
└─────────────────────────────────────────────────┘
|
|
326
|
-
```
|
package/src/cli.rs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
use std::path::PathBuf;
|
|
2
|
-
|
|
3
|
-
use clap::{Args, Parser, Subcommand, ValueEnum};
|
|
4
|
-
|
|
5
|
-
#[derive(Debug, Clone, PartialEq, ValueEnum)]
|
|
6
|
-
pub enum Provider {
|
|
7
|
-
Anthropic,
|
|
8
|
-
OpenAi,
|
|
9
|
-
Glm,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
impl Provider {
|
|
13
|
-
pub fn as_str(&self) -> &'static str {
|
|
14
|
-
match self {
|
|
15
|
-
Provider::Anthropic => "anthropic",
|
|
16
|
-
Provider::OpenAi => "openai",
|
|
17
|
-
Provider::Glm => "glm",
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
pub fn from_str(name: &str) -> Option<Self> {
|
|
22
|
-
match name.to_ascii_lowercase().as_str() {
|
|
23
|
-
"anthropic" => Some(Provider::Anthropic),
|
|
24
|
-
"openai" => Some(Provider::OpenAi),
|
|
25
|
-
"glm" => Some(Provider::Glm),
|
|
26
|
-
_ => None,
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
#[allow(dead_code)]
|
|
31
|
-
pub fn from_env_or_default() -> Self {
|
|
32
|
-
match std::env::var("ZARZ_PROVIDER")
|
|
33
|
-
.ok()
|
|
34
|
-
.as_deref()
|
|
35
|
-
.map(|v| v.to_ascii_lowercase())
|
|
36
|
-
{
|
|
37
|
-
Some(ref v) if v == "openai" => Provider::OpenAi,
|
|
38
|
-
Some(ref v) if v == "anthropic" => Provider::Anthropic,
|
|
39
|
-
Some(ref v) if v == "glm" => Provider::Glm,
|
|
40
|
-
_ => Provider::Anthropic,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#[derive(Debug, Parser)]
|
|
46
|
-
#[command(
|
|
47
|
-
name = "zarz",
|
|
48
|
-
version,
|
|
49
|
-
about = "ZarzCLI · AI-assisted code refactoring and rewrites",
|
|
50
|
-
author = "Fapzarz",
|
|
51
|
-
long_about = "ZarzCLI - Interactive AI coding assistant\n\nUsage:\n zarz Start interactive chat\n zarz --message \"prompt\" Send a single prompt and exit\n zarz ask \"question\" Ask mode (legacy)\n zarz chat Chat mode (legacy)"
|
|
52
|
-
)]
|
|
53
|
-
pub struct Cli {
|
|
54
|
-
/// Send a message and exit (like Claude Code)
|
|
55
|
-
#[arg(long, visible_alias = "msg")]
|
|
56
|
-
pub message: Option<String>,
|
|
57
|
-
|
|
58
|
-
/// Additional files to include as context
|
|
59
|
-
#[arg(short = 'f', long)]
|
|
60
|
-
pub files: Vec<PathBuf>,
|
|
61
|
-
|
|
62
|
-
#[command(flatten)]
|
|
63
|
-
pub model_args: CommonModelArgs,
|
|
64
|
-
|
|
65
|
-
/// Working directory for the session
|
|
66
|
-
#[arg(long)]
|
|
67
|
-
pub directory: Option<PathBuf>,
|
|
68
|
-
|
|
69
|
-
#[command(subcommand)]
|
|
70
|
-
pub command: Option<Commands>,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#[derive(Debug, Subcommand)]
|
|
74
|
-
pub enum Commands {
|
|
75
|
-
/// Ask the model a question with optional code context.
|
|
76
|
-
Ask(AskArgs),
|
|
77
|
-
/// Rewrite one or more files using the model's response.
|
|
78
|
-
Rewrite(RewriteArgs),
|
|
79
|
-
/// Start an interactive chat session with AI code assistance.
|
|
80
|
-
Chat(ChatArgs),
|
|
81
|
-
/// Configure API keys and settings.
|
|
82
|
-
Config(ConfigArgs),
|
|
83
|
-
/// Manage MCP (Model Context Protocol) servers.
|
|
84
|
-
Mcp(McpArgs),
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
#[derive(Debug, Args)]
|
|
88
|
-
pub struct CommonModelArgs {
|
|
89
|
-
/// Target model identifier (e.g. claude-3-5-sonnet-20241022).
|
|
90
|
-
#[arg(short, long)]
|
|
91
|
-
pub model: Option<String>,
|
|
92
|
-
/// Override the default provider.
|
|
93
|
-
#[arg(long, value_enum)]
|
|
94
|
-
pub provider: Option<Provider>,
|
|
95
|
-
/// Override the default API endpoint.
|
|
96
|
-
#[arg(long)]
|
|
97
|
-
pub endpoint: Option<String>,
|
|
98
|
-
/// Optional system prompt override.
|
|
99
|
-
#[arg(long)]
|
|
100
|
-
pub system_prompt: Option<String>,
|
|
101
|
-
/// Timeout in seconds for the request.
|
|
102
|
-
#[arg(long)]
|
|
103
|
-
pub timeout: Option<u64>,
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
#[derive(Debug, Args)]
|
|
107
|
-
pub struct AskArgs {
|
|
108
|
-
#[command(flatten)]
|
|
109
|
-
pub model_args: CommonModelArgs,
|
|
110
|
-
/// Inline prompt text. If omitted, reads from STDIN.
|
|
111
|
-
#[arg(short, long)]
|
|
112
|
-
pub prompt: Option<String>,
|
|
113
|
-
/// Optional file containing additional instructions.
|
|
114
|
-
#[arg(long)]
|
|
115
|
-
pub prompt_file: Option<PathBuf>,
|
|
116
|
-
/// Additional context files to include in the request.
|
|
117
|
-
#[arg(value_name = "FILE", num_args = 0..)]
|
|
118
|
-
pub context_files: Vec<PathBuf>,
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
#[derive(Debug, Args)]
|
|
122
|
-
pub struct RewriteArgs {
|
|
123
|
-
#[command(flatten)]
|
|
124
|
-
pub model_args: CommonModelArgs,
|
|
125
|
-
/// High-level instructions for the rewrite.
|
|
126
|
-
#[arg(short, long)]
|
|
127
|
-
pub instructions: Option<String>,
|
|
128
|
-
/// File containing rewrite instructions.
|
|
129
|
-
#[arg(long)]
|
|
130
|
-
pub instructions_file: Option<PathBuf>,
|
|
131
|
-
/// Apply the changes without confirmation.
|
|
132
|
-
#[arg(long)]
|
|
133
|
-
pub yes: bool,
|
|
134
|
-
/// Preview diff without writing files.
|
|
135
|
-
#[arg(long)]
|
|
136
|
-
pub dry_run: bool,
|
|
137
|
-
/// Target files that will be rewritten.
|
|
138
|
-
#[arg(value_name = "FILE", num_args = 1..)]
|
|
139
|
-
pub files: Vec<PathBuf>,
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
#[derive(Debug, Args)]
|
|
143
|
-
pub struct ChatArgs {
|
|
144
|
-
#[command(flatten)]
|
|
145
|
-
pub model_args: CommonModelArgs,
|
|
146
|
-
/// Working directory for the session (defaults to current directory).
|
|
147
|
-
#[arg(long)]
|
|
148
|
-
pub directory: Option<PathBuf>,
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
#[derive(Debug, Clone, Args)]
|
|
152
|
-
pub struct ConfigArgs {
|
|
153
|
-
/// Reset configuration and run interactive setup.
|
|
154
|
-
#[arg(long)]
|
|
155
|
-
pub reset: bool,
|
|
156
|
-
/// Show current configuration.
|
|
157
|
-
#[arg(long)]
|
|
158
|
-
pub show: bool,
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
#[derive(Debug, Clone, Args)]
|
|
162
|
-
pub struct McpArgs {
|
|
163
|
-
#[command(subcommand)]
|
|
164
|
-
pub command: McpCommands,
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
#[derive(Debug, Clone, Subcommand)]
|
|
168
|
-
pub enum McpCommands {
|
|
169
|
-
/// Add a new MCP server
|
|
170
|
-
Add {
|
|
171
|
-
/// Server name
|
|
172
|
-
name: String,
|
|
173
|
-
/// Server command (for stdio servers)
|
|
174
|
-
#[arg(long)]
|
|
175
|
-
command: Option<String>,
|
|
176
|
-
/// Server arguments
|
|
177
|
-
#[arg(long, num_args = 0..)]
|
|
178
|
-
args: Vec<String>,
|
|
179
|
-
/// Environment variables (KEY=VALUE)
|
|
180
|
-
#[arg(long = "env")]
|
|
181
|
-
env_vars: Vec<String>,
|
|
182
|
-
/// Server URL (for http/sse servers)
|
|
183
|
-
#[arg(long)]
|
|
184
|
-
url: Option<String>,
|
|
185
|
-
/// Transport type: stdio, http, sse
|
|
186
|
-
#[arg(long, default_value = "stdio")]
|
|
187
|
-
transport: String,
|
|
188
|
-
},
|
|
189
|
-
/// List all configured MCP servers
|
|
190
|
-
List,
|
|
191
|
-
/// Get details of a specific MCP server
|
|
192
|
-
Get {
|
|
193
|
-
/// Server name
|
|
194
|
-
name: String,
|
|
195
|
-
},
|
|
196
|
-
/// Remove an MCP server
|
|
197
|
-
Remove {
|
|
198
|
-
/// Server name
|
|
199
|
-
name: String,
|
|
200
|
-
},
|
|
201
|
-
}
|