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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
use super::help;
use super::{
AdrCommand, ClauseCommand, GuardCommand, ListTarget, LoopCommand, OutputFormat, RenderTarget,
RfcCommand, SkillFormat, TagCommand, WorkCommand,
};
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Subcommand)]
pub(crate) enum Commands {
/// Initialize govctl in the current directory
#[command(after_help = help::INIT)]
Init {
/// Overwrite existing config
#[arg(short = 'f', long)]
force: bool,
},
/// Install skills and agents into the project's agent directory
#[command(name = "init-skills")]
#[command(after_help = help::INIT_SKILLS)]
InitSkills {
/// Force overwrite existing assets
#[arg(short = 'f', long)]
force: bool,
/// Output format for agent definitions: claude (default) or codex
#[arg(long, default_value = "claude")]
format: SkillFormat,
/// Override output directory (default: agent_dir from config, or format-implied)
#[arg(long)]
dir: Option<PathBuf>,
},
/// Validate all governed documents
#[command(visible_alias = "lint")]
#[command(after_help = help::CHECK)]
Check {
/// Treat warnings as errors
#[arg(short = 'W', long)]
deny_warnings: bool,
/// Assert that an active work item exists (exits non-zero if none)
#[arg(long)]
has_active: bool,
},
/// Show summary counts
#[command(visible_alias = "stat")]
#[command(after_help = help::STATUS)]
Status,
/// Render artifacts to markdown from SSOT (bulk operation)
///
/// For single-item render, use: govctl rfc render <ID>, govctl adr render <ID>, etc.
#[command(
visible_alias = "gen",
after_help = help::RENDER
)]
Render {
/// What to render: rfc (default), adr, work, changelog, or all
#[arg(value_enum, default_value = "rfc")]
target: RenderTarget,
/// Dry run: show what would be written
#[arg(long)]
dry_run: bool,
/// Force full regeneration (for changelog: overwrites released sections)
#[arg(long, short)]
force: bool,
},
/// Migrate legacy governance storage to current canonical formats
#[command(after_help = help::MIGRATE)]
Migrate,
/// Execute reusable verification guards
#[command(after_help = help::VERIFY)]
Verify {
/// Verification guard IDs to run
#[arg(value_name = "GUARD-ID")]
guard_ids: Vec<String>,
/// Run the effective guard set for a specific work item
#[arg(long, conflicts_with = "guard_ids")]
work: Option<String>,
},
/// Search governed artifacts.
///
/// Traceability: global search is an explicit namespace exception in
/// [[RFC-0002:C-GLOBAL-COMMANDS]] and is specified by
/// [[RFC-0002:C-SEARCH-COMMAND]].
#[command(after_help = help::SEARCH)]
Search {
/// Query terms to search for.
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: `<query>...` is required and is
/// interpreted as user search terms, not backend raw query syntax.
#[arg(value_name = "QUERY", required = true)]
query: Vec<String>,
/// Restrict results to artifact kind (repeatable).
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: searches all supported artifact
/// kinds unless one or more `--type` filters are provided.
#[arg(long = "type", value_enum)]
types: Vec<ListTarget>,
/// Filter by tag (repeatable; artifact must have ALL specified tags).
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: multiple `--tag` values use ALL-tag
/// semantics; results must contain every requested tag.
#[arg(long)]
tag: Vec<String>,
/// Limit number of results.
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: `--limit` is supported and omission
/// applies a finite default limit.
#[arg(short = 'n', long)]
limit: Option<usize>,
/// Output format.
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: supports table, JSON, and plain
/// result contracts, with table as the CLI default.
#[arg(short = 'o', long, value_enum, default_value = "table")]
output: OutputFormat,
/// Force a full rebuild of the local search index before querying.
///
/// [[RFC-0002:C-SEARCH-COMMAND]]: `--reindex` rebuilds the local
/// derived search index before returning results.
#[arg(long)]
reindex: bool,
},
/// Loop execution-state commands
#[command(after_help = help::LOOP)]
Loop {
#[command(subcommand)]
command: LoopCommand,
},
/// RFC operations
#[command(after_help = help::RFC)]
Rfc {
#[command(subcommand)]
command: RfcCommand,
},
/// Clause operations
#[command(after_help = help::CLAUSE)]
Clause {
#[command(subcommand)]
command: ClauseCommand,
},
/// ADR operations
#[command(after_help = help::ADR)]
Adr {
#[command(subcommand)]
command: AdrCommand,
},
/// Work item operations
#[command(visible_alias = "wi")]
#[command(after_help = help::WORK)]
Work {
#[command(subcommand)]
command: WorkCommand,
},
/// Verification guard operations
#[command(after_help = help::GUARD)]
Guard {
#[command(subcommand)]
command: GuardCommand,
},
/// Cut a release (collect unreleased work items into a version)
#[command(after_help = help::RELEASE)]
Release {
/// Version number (semver, e.g., 0.2.0)
version: String,
/// Release date (defaults to today)
#[arg(long)]
date: Option<String>,
},
/// Output machine-readable CLI metadata for agents
#[command(after_help = help::DESCRIBE)]
Describe {
/// Include project state and suggested actions
#[arg(long)]
context: bool,
/// Output format (currently only json is supported)
#[arg(short = 'o', long, default_value = "json")]
output: String,
},
/// Generate shell completion scripts
#[command(after_help = help::COMPLETIONS)]
Completions {
/// Shell to generate completions for
#[arg(value_enum)]
shell: clap_complete::Shell,
},
/// Update govctl binary to the latest release
#[command(name = "self-update")]
#[command(after_help = help::SELF_UPDATE)]
SelfUpdate {
/// Check for updates without installing
#[arg(long)]
check: bool,
},
/// Launch interactive TUI dashboard
#[cfg(feature = "tui")]
Tui,
/// Manage controlled-vocabulary tags
#[command(after_help = help::TAG)]
Tag {
#[command(subcommand)]
command: TagCommand,
},
}