-
Notifications
You must be signed in to change notification settings - Fork 0
feat: architecture-v2 part 2 — batches G-K + CodeRabbit fixes #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
47ab7ac
ddd3b3f
064f4eb
3b2ac12
fb14510
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package core | ||
|
|
||
| // --- Analytics Types --- | ||
|
|
||
| type AIClassification string | ||
|
|
||
| const ( | ||
| AIClassHighProbability AIClassification = "high_probability_ai" | ||
| AIClassLikelyAI AIClassification = "likely_ai" | ||
| AIClassMixedVerified AIClassification = "mixed_verified" | ||
| AIClassHumanAuthored AIClassification = "human_authored" | ||
| ) | ||
|
|
||
| type AIConfidenceScore struct { | ||
| Score float64 `json:"score"` | ||
| Classification AIClassification `json:"classification"` | ||
| } | ||
|
|
||
| type AnalyticsEvent struct { | ||
| SessionID string `json:"sessionId"` | ||
| EventType string `json:"eventType"` | ||
| ToolName string `json:"toolName,omitempty"` | ||
| Timestamp string `json:"timestamp"` | ||
| FilePath string `json:"filePath,omitempty"` | ||
| LinesAdded int `json:"linesAdded,omitempty"` | ||
| LinesRemoved int `json:"linesRemoved,omitempty"` | ||
| AIConfidenceScore *float64 `json:"aiConfidenceScore,omitempty"` | ||
| } | ||
|
|
||
| type SessionSummary struct { | ||
| TotalToolCalls int `json:"totalToolCalls"` | ||
| FileEditsCount int `json:"fileEditsCount"` | ||
| AIAuthoredLines int `json:"aiAuthoredLines"` | ||
| HumanVerifiedLines int `json:"humanVerifiedLines"` | ||
| Classification string `json:"classification,omitempty"` | ||
| EstimatedCostUSD float64 `json:"estimatedCostUsd,omitempty"` | ||
| } | ||
|
|
||
| type AuthorshipSummary struct { | ||
| TotalEntries int `json:"totalEntries"` | ||
| TotalLinesChanged int `json:"totalLinesChanged"` | ||
| WeightedAIScore float64 `json:"weightedAIScore"` | ||
| ClassificationBreakdown map[AIClassification]int `json:"classificationBreakdown"` | ||
| } | ||
|
|
||
| type StatsOptions struct { | ||
| SessionID string `json:"sessionId,omitempty"` | ||
| Days int `json:"days,omitempty"` | ||
| From string `json:"from,omitempty"` | ||
| To string `json:"to,omitempty"` | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,136 @@ | ||||||||||||||||||||||
| package core | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // --- Config Types --- | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // DispatchConfig holds settings for the dispatch pipeline. | ||||||||||||||||||||||
| type DispatchConfig struct { | ||||||||||||||||||||||
| TimeoutMs int `yaml:"timeout_ms" json:"timeoutMs"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // HooksConfig is the top-level configuration structure. | ||||||||||||||||||||||
| type HooksConfig struct { | ||||||||||||||||||||||
| Version int `yaml:"version" json:"version"` | ||||||||||||||||||||||
| Guards []GuardRuleConfig `yaml:"guards" json:"guards"` | ||||||||||||||||||||||
| Coaching CoachingConfig `yaml:"coaching" json:"coaching"` | ||||||||||||||||||||||
| Analytics AnalyticsConfig `yaml:"analytics" json:"analytics"` | ||||||||||||||||||||||
| Greeting GreetingConfig `yaml:"greeting" json:"greeting"` | ||||||||||||||||||||||
| Sounds SoundsConfig `yaml:"sounds" json:"sounds"` | ||||||||||||||||||||||
| StatusLine StatusLineConfig `yaml:"status_line" json:"statusLine"` | ||||||||||||||||||||||
| CostTracking CostTrackingConfig `yaml:"cost_tracking" json:"costTracking"` | ||||||||||||||||||||||
| TranscriptBackup TranscriptConfig `yaml:"transcript_backup" json:"transcriptBackup"` | ||||||||||||||||||||||
| Handlers []CustomHandlerConfig `yaml:"handlers" json:"handlers"` | ||||||||||||||||||||||
| Settings SettingsConfig `yaml:"settings" json:"settings"` | ||||||||||||||||||||||
| Includes []string `yaml:"includes" json:"includes"` | ||||||||||||||||||||||
| Feeds FeedsConfig `yaml:"feeds" json:"feeds"` | ||||||||||||||||||||||
| Daemon DaemonConfig `yaml:"daemon" json:"daemon"` | ||||||||||||||||||||||
| TUI TUIConfig `yaml:"tui" json:"tui"` | ||||||||||||||||||||||
| Dispatch DispatchConfig `yaml:"dispatch" json:"dispatch"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type CoachingConfig struct { | ||||||||||||||||||||||
| Metacognition MetacognitionConfig `yaml:"metacognition" json:"metacognition"` | ||||||||||||||||||||||
| BuilderTrap BuilderTrapConfig `yaml:"builder_trap" json:"builderTrap"` | ||||||||||||||||||||||
| Communication CommunicationConfig `yaml:"communication" json:"communication"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type MetacognitionConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| IntervalSeconds int `yaml:"interval_seconds" json:"intervalSeconds"` | ||||||||||||||||||||||
| PromptsFile string `yaml:"prompts_file,omitempty" json:"promptsFile,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type BuilderTrapConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| Thresholds BuilderTrapThresholds `yaml:"thresholds" json:"thresholds"` | ||||||||||||||||||||||
| ToolingPatterns []string `yaml:"tooling_patterns" json:"toolingPatterns"` | ||||||||||||||||||||||
| PracticeTools []string `yaml:"practice_tools" json:"practiceTools"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type BuilderTrapThresholds struct { | ||||||||||||||||||||||
| Yellow int `yaml:"yellow" json:"yellow"` | ||||||||||||||||||||||
| Orange int `yaml:"orange" json:"orange"` | ||||||||||||||||||||||
| Red int `yaml:"red" json:"red"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type CommunicationConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| Frequency int `yaml:"frequency" json:"frequency"` | ||||||||||||||||||||||
| MinLength int `yaml:"min_length" json:"minLength"` | ||||||||||||||||||||||
| Rules []string `yaml:"rules" json:"rules"` | ||||||||||||||||||||||
| Tone string `yaml:"tone" json:"tone"` // "gentle", "direct", "silent" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type AnalyticsConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| DBPath string `yaml:"db_path,omitempty" json:"dbPath,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type GreetingConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| QuotesFile string `yaml:"quotes_file,omitempty" json:"quotesFile,omitempty"` | ||||||||||||||||||||||
| Categories map[string]QuoteCategoryConfig `yaml:"categories,omitempty" json:"categories,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type QuoteCategoryConfig struct { | ||||||||||||||||||||||
| Weight int `yaml:"weight" json:"weight"` | ||||||||||||||||||||||
| Quotes []QuoteEntry `yaml:"quotes" json:"quotes"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type QuoteEntry struct { | ||||||||||||||||||||||
| Text string `yaml:"text" json:"text"` | ||||||||||||||||||||||
| Author string `yaml:"author,omitempty" json:"author,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type SoundsConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| Notification string `yaml:"notification,omitempty" json:"notification,omitempty"` | ||||||||||||||||||||||
| Completion string `yaml:"completion,omitempty" json:"completion,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type StatusLineConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| Segments []SegmentConfig `yaml:"segments" json:"segments"` | ||||||||||||||||||||||
| Delimiter string `yaml:"delimiter" json:"delimiter"` | ||||||||||||||||||||||
| CachePath string `yaml:"cache_path" json:"cachePath"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type CostTrackingConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| Rates map[string]float64 `yaml:"rates" json:"rates"` | ||||||||||||||||||||||
| DailyBudget float64 `yaml:"daily_budget" json:"dailyBudget"` | ||||||||||||||||||||||
| Enforcement string `yaml:"enforcement" json:"enforcement"` // "warn" or "enforce" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type TranscriptConfig struct { | ||||||||||||||||||||||
| Enabled bool `yaml:"enabled" json:"enabled"` | ||||||||||||||||||||||
| BackupDir string `yaml:"backup_dir" json:"backupDir"` | ||||||||||||||||||||||
| MaxSizeMB int `yaml:"max_size_mb" json:"maxSizeMb"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+104
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Inconsistent casing in JSON tag for The field name uses ✏️ Suggested fix type TranscriptConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
BackupDir string `yaml:"backup_dir" json:"backupDir"`
- MaxSizeMB int `yaml:"max_size_mb" json:"maxSizeMb"`
+ MaxSizeMB int `yaml:"max_size_mb" json:"maxSizeMB"`
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type SettingsConfig struct { | ||||||||||||||||||||||
| LogLevel string `yaml:"log_level" json:"logLevel"` // "debug", "info", "warn", "error" | ||||||||||||||||||||||
| HandlerTimeoutSeconds int `yaml:"handler_timeout_seconds" json:"handlerTimeoutSeconds"` | ||||||||||||||||||||||
| StateDir string `yaml:"state_dir" json:"stateDir"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type CustomHandlerConfig struct { | ||||||||||||||||||||||
| Name string `yaml:"name" json:"name"` | ||||||||||||||||||||||
| Type string `yaml:"type" json:"type"` // "builtin", "script", "inline" | ||||||||||||||||||||||
| Events []string `yaml:"events" json:"events"` | ||||||||||||||||||||||
| Phase string `yaml:"phase,omitempty" json:"phase,omitempty"` | ||||||||||||||||||||||
| Timeout int `yaml:"timeout,omitempty" json:"timeout,omitempty"` | ||||||||||||||||||||||
| Module string `yaml:"module,omitempty" json:"module,omitempty"` | ||||||||||||||||||||||
| Command string `yaml:"command,omitempty" json:"command,omitempty"` | ||||||||||||||||||||||
| Action map[string]interface{} `yaml:"action,omitempty" json:"action,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type DaemonConfig struct { | ||||||||||||||||||||||
| AutoStart bool `yaml:"auto_start" json:"autoStart"` | ||||||||||||||||||||||
| InactivityTimeoutMinutes int `yaml:"inactivity_timeout_minutes" json:"inactivityTimeoutMinutes"` | ||||||||||||||||||||||
| LogFile string `yaml:"log_file" json:"logFile"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type TUIConfig struct { | ||||||||||||||||||||||
| AutoLaunch bool `yaml:"auto_launch" json:"autoLaunch"` | ||||||||||||||||||||||
| LaunchMethod string `yaml:"launch_method" json:"launchMethod"` // "newWindow" or "background" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Keep the guard-trigger threshold in one place.
GuardBlockSummariesnow bakes inHAVING cnt >= 5, butinternal/notifications/producers.go, Lines 83-86, still applies the same cutoff again. That split rule will drift the next time the threshold changes. Either return raw per-tool counts here or acceptminCountas an argument and let the caller own the rule.🤖 Prompt for AI Agents