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
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "whetstone",
version = env!("WHETSTONE_VERSION"),
about = "Headroom + RTK + MemStack for Claude Code"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Command>,
}
#[derive(Subcommand)]
pub enum Command {
/// Install Headroom, RTK, and optionally MemStack
Setup {
/// Force-upgrade all tools and refresh MemStack files
#[arg(long)]
full: bool,
/// Headroom pip extras: "all" (default), "none", or comma-separated like "proxy,code"
#[arg(long, default_value = "all")]
headroom_extras: String,
},
/// Remove whetstone components
Uninstall,
/// Start Claude Code via headroom wrap (default when no subcommand given)
Claude {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Alias for claude
Code {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Run headroom proxy
Proxy {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Run rtk
Rtk {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Print whetstone version
Version,
/// Pull latest and rerun setup
Update {
#[arg(long)]
full: bool,
},
/// Bump VERSION file
Release {
#[command(subcommand)]
action: ReleaseAction,
},
/// Release, commit, tag, and push
ReleasePublish {
#[command(subcommand)]
action: ReleaseAction,
},
/// MemStack database operations
Db {
#[command(subcommand)]
action: DbCommand,
},
}
#[derive(Subcommand, Clone)]
pub enum ReleaseAction {
Patch,
Minor,
Major,
Set { version: String },
}
#[derive(Subcommand)]
pub enum DbCommand {
/// Initialize or re-apply schema
Init,
/// Add a session diary entry (JSON argument)
AddSession { json: String },
/// Add an insight/decision (JSON argument)
AddInsight { json: String },
/// Full-text search across tables
Search {
query: String,
#[arg(long)]
project: Option<String>,
#[arg(long, default_value_t = 10)]
limit: usize,
},
/// Get recent sessions for a project
GetSessions {
project: String,
#[arg(long, default_value_t = 5)]
limit: usize,
},
/// Get insights for a project
GetInsights { project: String },
/// Get project context
GetContext { project: String },
/// Upsert project context (JSON argument)
SetContext { json: String },
/// Add a task to a project plan (JSON argument)
AddPlanTask { json: String },
/// Get all plan tasks for a project
GetPlan { project: String },
/// Update a plan task status (JSON argument)
UpdateTask { json: String },
/// Export project memory as markdown
ExportMd { project: String },
/// Show database statistics
Stats,
}