Skip to main content

lean_ctx/cli/completions/
spec.rs

1//! Static command-tree specification for CLI completions.
2//!
3//! Every top-level command, its subcommands, flags and dynamic value kinds
4//! live here so the completion engine has a single source of truth.
5/// Describes a dynamic value set resolved at completion time.
6#[derive(Clone, Copy)]
7pub enum DynamicKind {
8    Agents,
9    Shells,
10    Modes,
11    ConfigKeys,
12    Profiles,
13    TerseLevel,
14}
15/// A flag/option accepted by a command.
16pub struct FlagSpec {
17    pub long: &'static str,
18    pub short: Option<char>,
19    pub description: &'static str,
20    pub takes_value: bool,
21    pub value_kind: Option<DynamicKind>,
22}
23/// A command or subcommand node in the tree.
24pub struct CommandNode {
25    pub name: &'static str,
26    pub aliases: &'static [&'static str],
27    pub description: &'static str,
28    pub subcommands: &'static [CommandNode],
29    pub flags: &'static [FlagSpec],
30    pub positional: Option<DynamicKind>,
31    pub hidden: bool,
32}
33pub(super) const fn pack_leaf(name: &'static str, description: &'static str) -> CommandNode {
34    CommandNode {
35        name,
36        aliases: &[],
37        description,
38        subcommands: &[],
39        flags: &[],
40        positional: None,
41        hidden: false,
42    }
43}
44
45pub(super) const fn pack_flag(
46    long: &'static str,
47    description: &'static str,
48    takes_value: bool,
49) -> FlagSpec {
50    FlagSpec {
51        long,
52        short: None,
53        description,
54        takes_value,
55        value_kind: None,
56    }
57}
58
59pub static COMMAND_TREE: &[CommandNode] = &[
60    super::spec_setup::MODEL,
61    super::spec_setup::TRIAGE,
62    super::spec_setup::SHELL,
63    super::spec_setup::INIT,
64    super::spec_setup::STATUS,
65    super::spec_setup::CONFIG,
66    super::spec_setup::PROXY,
67    super::spec_setup::COCKPIT,
68    super::spec_setup::CACHE,
69    super::spec_setup::TERSE,
70    super::spec_setup::PROFILE,
71    super::spec_setup::GAIN,
72    super::spec_setup::SPEND,
73    super::spec_setup::INDEX,
74    super::spec_setup::EXPLORE,
75    super::spec_setup::COMPRESS,
76    super::spec_setup::UPDATE,
77    super::spec_setup::STOP,
78    super::spec_setup::RESTART,
79    super::spec_setup::DEV_INSTALL,
80    super::spec_setup::WRAP,
81    super::spec_setup::UNWRAP,
82    super::spec_setup::DOCTOR,
83    super::spec_setup::SELFTEST,
84    super::spec_setup::RULES,
85    super::spec_setup::EXPORT_RULES,
86    super::spec_setup::HARDEN,
87    super::spec_setup::COMPLETIONS,
88    super::spec_setup::GOTCHAS,
89    super::spec_setup::LEARN,
90    super::spec_account::HELP,
91    super::spec_account::EVAL,
92    super::spec_account::AUDIT,
93    super::spec_account::AGENT,
94    super::spec_account::SESSION,
95    super::spec_account::KNOWLEDGE,
96    super::spec_account::STATS,
97    super::spec_account::CHEATSHEET,
98    super::spec_account::MCP,
99    super::spec_account::WRAPPED,
100    super::spec_account::ADDON,
101    super::spec_value::SAVINGS,
102    super::spec_value::OUTPUT_SAVINGS,
103    super::spec_value::VALUE_REPORT,
104    super::spec_value::SHADOW,
105    super::spec_value::SCENARIO,
106    super::spec_value::MEASURE,
107    super::spec_value::EVIDENCE_EXPORT,
108    super::spec_value::PROVE,
109    super::spec_value::CLAUDE_MOD,
110    super::spec_value::STATUSLINE,
111    super::spec_value::INSPECT,
112    super::spec_value::GATEWAY,
113    super::spec_value::PROMPT_SEGMENT,
114    super::spec_value::VALUE,
115    super::spec_value::VERIFY,
116    super::spec_value::VERIFY_CACHE,
117    super::spec_tools::INSTRUCTIONS,
118    super::spec_tools::SEMANTIC_SEARCH,
119    super::spec_tools::READ,
120    super::spec_tools::CALL,
121    super::spec_tools::DIFF,
122    super::spec_tools::GREP,
123    super::spec_tools::GLOB,
124    super::spec_tools::LS,
125    super::spec_tools::DEPS,
126    super::spec_tools::DISCOVER,
127    super::spec_tools::GHOST,
128    super::spec_tools::FILTER,
129    super::spec_tools::HEATMAP,
130    super::spec_tools::GRAPH,
131    super::spec_tools::SMELLS,
132    super::spec_tools::LEDGER,
133    super::spec_tools::CONTROL,
134    super::spec_tools::PLAN,
135    super::spec_tools::COMPILE,
136    super::spec_tools::SKILLIFY,
137    super::spec_tools::SUMMARY,
138    super::spec_tools::BENCHMARK,
139    super::spec_tools::TOOLS,
140    super::spec_tools::ALLOW,
141    super::spec_tools::ALLOW_PATH,
142    super::workspace::WORKSPACE,
143    super::spec_tools::PROJECT,
144    super::spec_tools::UNTRUST,
145    super::spec_tools::THEME,
146    super::spec_tools::TEE,
147    super::spec_tools::CODESIGN_SETUP,
148    super::spec_tools::LEARNING,
149    super::spec_tools::TOKEN_REPORT,
150    super::spec_team::PACK,
151    super::spec_team::POLICY,
152    super::spec_team::CEP,
153    super::spec_team::PROVIDER,
154    super::spec_team::WATCH,
155    super::spec_team::YOLO,
156    super::spec_team::INTERNAL_COMPLETE,
157    super::spec_team::HIVE,
158    super::spec_team::TELEMETRY,
159    super::spec_team::DAEMON,
160];
161#[cfg(test)]
162#[path = "spec_tests.rs"]
163mod tests;