Skip to content

Commit 19e98c0

Browse files
AnnatarHeclaude
andcommitted
fix(model): add backward compatibility for deprecated ccotel config key
Support both ccotel (deprecated) and aiCodeOtel config keys to ensure users with existing configs using the old key continue to work after upgrading. The migration happens silently at config read time. - Add deprecated CCOtel field to ShellTimeConfig with old tags - Migrate ccotel to AICodeOtel in ReadConfigFile after unmarshal - Handle deprecated field in mergeConfig for local config overrides 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0a810ff commit 19e98c0

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)