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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// aid CLI arguments for project and worktree commands: project, worktree, clean, __run-task,
// experiment.
// Exports the matching clap Args structs and their subcommand enums; depends on clap derive.
use clap::{Args, Subcommand};
#[derive(Args)]
#[command(after_help = r#"Examples:
aid project init
aid project show
aid project state"#)]
pub struct ProjectArgs {
#[command(subcommand)]
pub action: ProjectAction,
}
#[derive(Subcommand)]
pub enum ProjectAction {
/// Initialize project configuration in current repo
Init,
/// Show the detected project configuration
Show,
/// Show the current computed project state
State,
/// Sync project config to CLAUDE.md and global budget
Sync,
}
#[derive(Args)]
#[command(after_help = r#"Examples:
aid worktree create feat/my-feature
aid worktree create fix/bug --base develop
aid worktree list"#)]
pub struct WorktreeArgs {
#[command(subcommand)]
pub action: WorktreeAction,
}
#[derive(Subcommand)]
pub enum WorktreeAction {
/// Create a worktree for a branch (prints path to stdout)
Create {
/// Branch name for the worktree
branch: String,
/// Base branch to fork from (default: HEAD)
#[arg(long)]
base: Option<String>,
/// Repository path (defaults to current dir)
#[arg(long)]
repo: Option<String>,
},
/// List active aid-managed worktrees
List {
/// Emit machine-readable JSON
#[arg(long)]
json: bool,
/// Show only worktrees with live task locks
#[arg(long)]
active: bool,
/// Repository path (defaults to current dir)
#[arg(long)]
repo: Option<String>,
},
}
#[derive(Args)]
pub struct CleanArgs {
#[arg(long, value_name = "DAYS", default_value = "7", help = "Remove records older than this many days")]
pub older_than: u64,
#[arg(long)]
pub worktrees: bool,
#[arg(long)]
pub dry_run: bool,
}
#[derive(Args)]
pub struct InternalRunTaskArgs {
pub task_id: String,
}
#[derive(Subcommand)]
pub enum ExperimentCommands {
/// Start an experiment loop
Run {
/// Agent to use for each iteration
agent: String,
/// Prompt describing what to optimize
prompt: String,
/// Command to measure the metric (output must be a number)
#[arg(long)]
metric: String,
/// Optimization direction
#[arg(long, default_value = "max")]
direction: String,
/// Correctness checks (must pass to keep changes)
#[arg(long)]
checks: Option<String>,
/// Maximum number of experiment runs
#[arg(long, default_value = "5")]
max_runs: usize,
/// Worktree branch for the experiment
#[arg(long)]
worktree: Option<String>,
/// Verify command to run after each iteration
#[arg(long)]
verify: Option<String>,
},
/// Show experiment status and history
Status {
/// Working directory (where experiment.jsonl is)
#[arg(long)]
dir: Option<String>,
},
}