@@ -13,14 +13,21 @@ pub struct Metrics {
13
13
sender : Option < tokio:: sync:: mpsc:: UnboundedSender < Event > > ,
14
14
}
15
15
16
- #[ derive( Debug , Clone , Serialize , Deserialize , strum:: Display ) ]
16
+ #[ derive( Debug , Clone , Copy , Serialize , Deserialize , strum:: Display ) ]
17
17
#[ serde( rename_all = "camelCase" ) ]
18
18
pub enum EventKind {
19
19
Mcp ,
20
20
McpInternal ,
21
- CliLog ,
22
- CliStatus ,
23
- CliRub ,
21
+ #[ strum( serialize = "Cli" ) ]
22
+ Cli ( Command ) ,
23
+ }
24
+
25
+ #[ derive( Debug , Clone , Copy , Serialize , Deserialize , strum:: Display ) ]
26
+ #[ serde( rename_all = "camelCase" ) ]
27
+ pub enum Command {
28
+ Log ,
29
+ Status ,
30
+ Rub ,
24
31
ClaudePreTool ,
25
32
ClaudePostTool ,
26
33
ClaudeStop ,
@@ -30,13 +37,13 @@ pub enum EventKind {
30
37
impl From < CommandName > for EventKind {
31
38
fn from ( command_name : CommandName ) -> Self {
32
39
match command_name {
33
- CommandName :: Log => EventKind :: CliLog ,
34
- CommandName :: Status => EventKind :: CliStatus ,
35
- CommandName :: Rub => EventKind :: CliRub ,
36
- CommandName :: ClaudePreTool => EventKind :: ClaudePreTool ,
37
- CommandName :: ClaudePostTool => EventKind :: ClaudePostTool ,
38
- CommandName :: ClaudeStop => EventKind :: ClaudeStop ,
39
- _ => EventKind :: Unknown ,
40
+ CommandName :: Log => EventKind :: Cli ( Command :: Log ) ,
41
+ CommandName :: Status => EventKind :: Cli ( Command :: Status ) ,
42
+ CommandName :: Rub => EventKind :: Cli ( Command :: Rub ) ,
43
+ CommandName :: ClaudePreTool => EventKind :: Cli ( Command :: ClaudePreTool ) ,
44
+ CommandName :: ClaudePostTool => EventKind :: Cli ( Command :: ClaudePostTool ) ,
45
+ CommandName :: ClaudeStop => EventKind :: Cli ( Command :: ClaudeStop ) ,
46
+ _ => EventKind :: Cli ( Command :: Unknown ) ,
40
47
}
41
48
}
42
49
}
@@ -86,6 +93,9 @@ impl Event {
86
93
event_name,
87
94
props : HashMap :: new ( ) ,
88
95
} ;
96
+ if let EventKind :: Cli ( command) = event_name {
97
+ event. insert_prop ( "command" , command) ;
98
+ }
89
99
event. insert_prop ( "appVersion" , option_env ! ( "VERSION" ) . unwrap_or_default ( ) ) ;
90
100
event. insert_prop ( "releaseChannel" , option_env ! ( "CHANNEL" ) . unwrap_or_default ( ) ) ;
91
101
event. insert_prop ( "appName" , option_env ! ( "CARGO_BIN_NAME" ) . unwrap_or_default ( ) ) ;
0 commit comments