1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
pub struct CodeMerge {
#[clap(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Merge code files
Merge {
#[arg(value_parser)]
path: Option<PathBuf>,
#[arg(short, long, value_parser)]
output: Option<PathBuf>,
#[clap(short, long)]
ignores: Vec<String>,
#[clap(short = 'f', long = "filter")]
filters: Vec<String>,
#[clap(short, long)]
verbose: bool,
#[clap(short = 'n', long = "file-names-only", help = "Print only file names")]
file_name: bool,
/// Configuration file path
#[clap(long)]
config: Option<PathBuf>,
/// Override configuration file
#[clap(long)]
no_config: bool,
},
/// Token management commands
Tokens {
/// Tokenizer model to use (gpt-3.5, gpt-4, claude)
#[clap(long, default_value = "gpt-3.5")]
model: String,
/// Token budget limit
#[clap(long)]
budget: Option<usize>,
/// Warning threshold as percentage of budget (0.0-1.0)
#[clap(long, default_value = "0.8")]
warning_threshold: f32,
/// Base directory to analyze
#[clap(value_parser, default_value = ".")]
path: PathBuf,
/// Number of top files to show
#[clap(short = 'n', long, default_value = "10")]
count: usize,
/// Ignore patterns
#[clap(short, long)]
ignores: Vec<String>,
/// File filters
#[clap(short = 'f', long = "filter")]
filters: Vec<String>,
/// Show verbose output
#[clap(short, long)]
verbose: bool,
/// Output format (json, csv, markdown)
#[clap(long, default_value = "markdown")]
format: String,
/// Output file path
#[clap(short, long)]
output: Option<PathBuf>,
/// Additional metadata fields (key=value pairs)
#[clap(long)]
metadata: Vec<String>,
/// Configuration file path
#[clap(long)]
config: Option<PathBuf>,
/// Override configuration file
#[clap(long)]
no_config: bool,
},
}