Skip to content

Commit e95bd0b

Browse files
authored
Merge pull request #182 from shelltime/fix/model-backward-compat-ccotel-config
fix(model): add backward compatibility for deprecated ccotel config key
2 parents 0a810ff + 19e98c0 commit e95bd0b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

model/config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ func mergeConfig(base, local *ShellTimeConfig) {
154154
if local.CCUsage != nil {
155155
base.CCUsage = local.CCUsage
156156
}
157+
// Migrate deprecated ccotel from local config
158+
if local.CCOtel != nil && local.AICodeOtel == nil {
159+
local.AICodeOtel = local.CCOtel
160+
}
157161
if local.AICodeOtel != nil {
158162
base.AICodeOtel = local.AICodeOtel
159163
}
@@ -213,6 +217,12 @@ func (cs *configService) ReadConfigFile(ctx context.Context, opts ...ReadConfigO
213217
return
214218
}
215219

220+
// Migrate deprecated ccotel field to AICodeOtel (silent migration)
221+
if config.CCOtel != nil && config.AICodeOtel == nil {
222+
config.AICodeOtel = config.CCOtel
223+
config.CCOtel = nil
224+
}
225+
216226
// Read and merge local config if exists
217227
if files.localFile != "" {
218228
if localConfig, localErr := os.ReadFile(files.localFile); localErr == nil {

model/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ type ShellTimeConfig struct {
8181
// CCUsage configuration for Claude Code usage tracking (v1 - ccusage CLI based)
8282
CCUsage *CCUsage `toml:"ccusage" yaml:"ccusage" json:"ccusage"`
8383

84+
// CCOtel is deprecated, use AICodeOtel instead
85+
// Deprecated: This field will be removed in a future version
86+
CCOtel *AICodeOtel `toml:"ccotel" yaml:"ccotel" json:"ccotel"`
87+
8488
// AICodeOtel configuration for OTEL-based AI CLI tracking (Claude Code, Codex, etc.)
8589
AICodeOtel *AICodeOtel `toml:"aiCodeOtel" yaml:"aiCodeOtel" json:"aiCodeOtel"`
8690

@@ -118,6 +122,7 @@ var DefaultConfig = ShellTimeConfig{
118122
AI: DefaultAIConfig,
119123
Exclude: []string{},
120124
CCUsage: nil,
125+
CCOtel: nil, // deprecated
121126
AICodeOtel: nil,
122127
CodeTracking: nil,
123128
LogCleanup: nil,

0 commit comments

Comments
 (0)