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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser, Debug)]
#[command(name = "bl", version, about = "Git-native task tracker", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Initialize balls in the current git repository.
Init {
/// Stealth mode: store tasks outside the repo (not git-tracked).
#[arg(long)]
stealth: bool,
},
/// Create a new task.
Create {
/// Task title
title: String,
/// Priority: 1 (highest) to 4 (lowest)
#[arg(short = 'p', long, default_value_t = 3)]
priority: u8,
/// Task type: epic, task, bug
#[arg(short = 't', long, default_value = "task")]
task_type: String,
/// Parent task ID
#[arg(long)]
parent: Option<String>,
/// Dependency task ID (repeatable)
#[arg(long = "dep")]
dep: Vec<String>,
/// Tag (repeatable)
#[arg(long = "tag")]
tag: Vec<String>,
/// Description
#[arg(short = 'd', long, default_value = "")]
description: String,
},
/// List tasks.
List {
/// Filter by status
#[arg(long)]
status: Option<String>,
/// Filter by priority
#[arg(short = 'p', long)]
priority: Option<u8>,
/// Filter by parent
#[arg(long)]
parent: Option<String>,
/// Filter by tag
#[arg(long)]
tag: Option<String>,
/// Include closed tasks
#[arg(long)]
all: bool,
/// JSON output
#[arg(long)]
json: bool,
},
/// Show details of a task.
Show {
id: String,
#[arg(long)]
json: bool,
},
/// Show tasks ready to be claimed.
Ready {
#[arg(long)]
json: bool,
#[arg(long)]
no_fetch: bool,
},
/// Claim a task: update the task file and create a worktree.
Claim {
id: String,
#[arg(long = "as")]
identity: Option<String>,
},
/// Submit work for review: merge to main, keep worktree for rework.
Review {
id: String,
#[arg(short = 'm', long)]
message: Option<String>,
},
/// Close a reviewed task: archive and remove worktree. Must run from repo root.
Close {
id: String,
#[arg(short = 'm', long)]
message: Option<String>,
},
/// Drop a claim: reset task and remove worktree.
Drop {
id: String,
#[arg(long)]
force: bool,
},
/// Update fields of a task.
Update {
id: String,
/// field=value pairs
assignments: Vec<String>,
#[arg(long)]
note: Option<String>,
#[arg(long = "as")]
identity: Option<String>,
},
/// Manage dependencies.
Dep {
#[command(subcommand)]
sub: DepCmd,
},
/// Manage typed links (relates_to, duplicates, supersedes, replies_to).
Link {
#[command(subcommand)]
sub: LinkCmd,
},
/// Sync with remote: fetch, merge, resolve, push.
Sync {
#[arg(long, default_value = "origin")]
remote: String,
/// Sync a single task by local ID or remote key.
#[arg(long)]
task: Option<String>,
},
/// Resolve a conflicted task file.
Resolve { file: String },
/// Prime an agent session: sync and print ready + in-progress tasks.
Prime {
#[arg(long = "as")]
identity: Option<String>,
#[arg(long)]
json: bool,
},
/// Scan and repair malformed task files and orphaned state.
Repair {
#[arg(long)]
fix: bool,
},
/// Print the agent skill guide (SKILL.md).
Skill,
/// Generate shell completions for bash, zsh, or fish.
Completions {
/// Shell to generate completions for.
shell: ShellArg,
},
}
#[derive(Clone, Debug, ValueEnum)]
pub enum ShellArg {
Bash,
Zsh,
Fish,
}
#[derive(Subcommand, Debug)]
pub enum DepCmd {
/// Add a dependency: TASK depends on DEPENDS_ON.
Add { task: String, depends_on: String },
/// Remove a dependency.
Rm { task: String, depends_on: String },
/// Print dependency tree. Without ID, prints full graph.
Tree { id: Option<String> },
}
#[derive(Subcommand, Debug)]
pub enum LinkCmd {
/// Add a typed link: relates_to, duplicates, supersedes, replies_to.
Add {
task: String,
link_type: String,
target: String,
},
/// Remove a typed link.
Rm {
task: String,
link_type: String,
target: String,
},
}