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
//! Management subcommand definitions for the top-level CLI.
use std::path::PathBuf;
use clap::{Args, Subcommand};
/// Scope selector shared by agent install/show/uninstall commands.
#[derive(Args, Debug, Clone, Copy)]
pub struct AgentScope {
/// Install in the agent's global configuration.
#[arg(short = 'g', long, conflicts_with = "project")]
pub global: bool,
/// Install in the current project's agent configuration.
#[arg(long, conflicts_with = "global")]
pub project: bool,
}
/// RTK-style convenience installer arguments.
#[derive(Args, Debug)]
pub struct InitArgs {
#[command(flatten)]
pub scope: AgentScope,
/// Agent integration name (claude, cursor, copilot, gemini, opencode,
/// openclaw, codex, cline, windsurf, kilocode, antigravity, githooks).
#[arg(long, value_name = "AGENT")]
pub agent: Option<String>,
/// Install the Claude Code integration.
#[arg(long)]
pub claude: bool,
/// Install the Cursor integration.
#[arg(long)]
pub cursor: bool,
/// Install the GitHub Copilot integration.
#[arg(long)]
pub copilot: bool,
/// Install the Gemini CLI integration.
#[arg(long)]
pub gemini: bool,
/// Install the OpenCode integration.
#[arg(long)]
pub opencode: bool,
/// Install the OpenClaw integration.
#[arg(long)]
pub openclaw: bool,
/// Install the Codex CLI integration.
#[arg(long)]
pub codex: bool,
/// Install the Cline / Roo Code rules integration.
#[arg(long)]
pub cline: bool,
/// Install the Windsurf rules integration.
#[arg(long)]
pub windsurf: bool,
/// Install the Kilo Code rules integration.
#[arg(long)]
pub kilocode: bool,
/// Install the Google Antigravity rules integration.
#[arg(long)]
pub antigravity: bool,
/// Also install the git hooks integration (post-commit/post-checkout/
/// post-merge/post-rewrite auto-update; project scope only).
#[arg(long)]
pub githooks: bool,
/// Enable `core.fsmonitor` for this repository (`git config
/// core.fsmonitor true`), which makes bounded auto-update-on-search
/// freshness checks near-instant. Never set without this flag: enabling
/// fsmonitor starts a background daemon, so it requires explicit,
/// opt-in consent.
#[arg(long)]
pub fsmonitor: bool,
}
/// Agent integration subcommands.
#[derive(Subcommand, Debug)]
pub enum AgentCommand {
/// Install an agent integration.
Install {
/// Agent integration name (claude, cursor, copilot, gemini, opencode,
/// openclaw, codex, cline, windsurf, kilocode, antigravity, githooks).
agent: String,
#[command(flatten)]
scope: AgentScope,
},
/// Uninstall an agent integration.
Uninstall {
/// Agent integration name (claude, cursor, copilot, gemini, opencode,
/// openclaw, codex, cline, windsurf, kilocode, antigravity, githooks).
agent: String,
#[command(flatten)]
scope: AgentScope,
},
/// Show agent integration status.
Show {
/// Agent integration name (claude, cursor, copilot, gemini, opencode,
/// openclaw, codex, cline, windsurf, kilocode, antigravity, githooks).
agent: String,
#[command(flatten)]
scope: AgentScope,
},
}
/// Management subcommands dispatched from the top-level CLI.
#[derive(Subcommand, Debug)]
pub enum ManageCommand {
/// Build or rebuild the search index.
Index {
/// Rebuild from scratch even if an index exists.
#[arg(long)]
force: bool,
/// Print statistics after build.
#[arg(long)]
stats: bool,
/// Suppress progress output.
#[arg(short, long)]
quiet: bool,
/// Re-measure the index-vs-scan crossover threshold instead of
/// reusing the prior calibrated value (use after hardware changes).
#[arg(long)]
recalibrate: bool,
},
/// Show index statistics.
Status {
/// Output as JSON.
#[arg(long)]
json: bool,
},
/// Verify index integrity (full checksum of all segments).
Verify,
/// Incrementally update the index for changed files.
Update {
/// Force flush overlay to segment.
#[arg(long)]
flush: bool,
/// Suppress output.
#[arg(short, long)]
quiet: bool,
},
/// Install an agent integration using RTK-style flags.
Init(InitArgs),
/// Manage agent integrations.
Agent {
#[command(subcommand)]
command: AgentCommand,
},
/// Internal hook entrypoint for agent integrations.
#[command(name = "__hook", hide = true)]
Hook {
/// Hook target name.
target: String,
},
/// Internal command rewrite helper.
#[command(name = "__rewrite", hide = true)]
Rewrite {
/// Directory used to decide whether a .syntext index is present.
#[arg(long)]
cwd: Option<PathBuf>,
/// Shell command to rewrite.
command: String,
},
#[command(hide = true)]
BenchSearch {
#[arg(long = "query", required = true)]
queries: Vec<String>,
#[arg(long, default_value_t = 1)]
iterations: usize,
#[arg(long, default_value_t = 0)]
warmups: usize,
},
}