Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ func mergeConfig(base, local *ShellTimeConfig) {
if local.CCUsage != nil {
base.CCUsage = local.CCUsage
}
// Migrate deprecated ccotel from local config
if local.CCOtel != nil && local.AICodeOtel == nil {
local.AICodeOtel = local.CCOtel
}
if local.AICodeOtel != nil {
base.AICodeOtel = local.AICodeOtel
}
Comment on lines +157 to 163
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation for migrating the deprecated ccotel key modifies the local config object. While this works, it's generally better to avoid side effects on input parameters. A more direct approach would be to check both aiCodeOtel and the deprecated ccotel from the local config and update base accordingly, without modifying local.

This makes the function's behavior more predictable and self-contained.

	// Handle AICodeOtel from local config, with fallback to deprecated ccotel
	if local.AICodeOtel != nil {
		base.AICodeOtel = local.AICodeOtel
	} else if local.CCOtel != nil {
		base.AICodeOtel = local.CCOtel
	}

Expand Down Expand Up @@ -213,6 +217,12 @@ func (cs *configService) ReadConfigFile(ctx context.Context, opts ...ReadConfigO
return
}

// Migrate deprecated ccotel field to AICodeOtel (silent migration)
if config.CCOtel != nil && config.AICodeOtel == nil {
config.AICodeOtel = config.CCOtel
config.CCOtel = nil
}

// Read and merge local config if exists
if files.localFile != "" {
if localConfig, localErr := os.ReadFile(files.localFile); localErr == nil {
Expand Down
5 changes: 5 additions & 0 deletions model/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ type ShellTimeConfig struct {
// CCUsage configuration for Claude Code usage tracking (v1 - ccusage CLI based)
CCUsage *CCUsage `toml:"ccusage" yaml:"ccusage" json:"ccusage"`

// CCOtel is deprecated, use AICodeOtel instead
// Deprecated: This field will be removed in a future version
CCOtel *AICodeOtel `toml:"ccotel" yaml:"ccotel" json:"ccotel"`

// AICodeOtel configuration for OTEL-based AI CLI tracking (Claude Code, Codex, etc.)
AICodeOtel *AICodeOtel `toml:"aiCodeOtel" yaml:"aiCodeOtel" json:"aiCodeOtel"`

Expand Down Expand Up @@ -118,6 +122,7 @@ var DefaultConfig = ShellTimeConfig{
AI: DefaultAIConfig,
Exclude: []string{},
CCUsage: nil,
CCOtel: nil, // deprecated
AICodeOtel: nil,
CodeTracking: nil,
LogCleanup: nil,
Expand Down