summaryrefslogtreecommitdiff
path: root/internal/stats
AgeCommit message (Collapse)Author
2026-04-13ask: serialize concurrent CLI with repo lock and stale PID recoveryPaul Buetow
Add advisory lock under .git/hexai-ask.lock around Taskwarrior execution, with metadata (PID and process basename) and Linux /proc comm checks to remove orphan lock files when the recorded holder is gone or not ask. Extract internal/filelock for shared flock helpers; stats uses it too. Made-with: Cursor
2026-03-23chore: bump version to v0.25.9v0.25.9Paul Buetow
Code quality fixes from audit: - Log silently discarded errors in status sinks and stats.Update call sites - Fix json.Marshal errors silently ignored in LSP handlers - Replace time.Sleep in tests with channel signaling (mcp) and fake clock (stats) - Make context cancellation work in production time.Sleep sites (handlers_document, cmdentry) - Remove init()-based provider registration from llm package; use explicit RegisterAllProviders() - Add WaitGroup goroutine tracking to MCP server Run() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17Fix bugs, remove duplication, and clean up code quality issuesPaul Buetow
- Log swallowed JSON unmarshal errors in stats and LSP handlers - Fix debug log file handle leak in tmuxedit (return closer from initDebugLog) - Check f.Close() errors on write paths in promptstore and tmuxedit - Fix cacheGet TOCTOU race by using single write lock - Fix readInput to use passed stdin reader instead of os.Stdin.Stat() - Remove 45 'moved to' comment tombstones from lsp/handlers.go - Deduplicate canonicalProvider wrappers (use llmutils.CanonicalProvider directly) - Remove SetWindow side effect from stats.TakeSnapshot (pure read now) - Move duplicated splitLines to textutil.SplitLinesBytes - Collapse StatusSink.SetGlobal 10 params into GlobalStatus struct - Simplify LRU touchLocked to in-place delete-and-append Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16Add Snapshot.ScopeReqs/ScopeRPM and simplify 3 callersPaul Buetow
Centralizes the provider+model map traversal and window-minutes guard that was duplicated in hexaiaction, hexaicli, and lsp. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Replace custom stringsTrim with strings.TrimSpacePaul Buetow
Remove duplicate stringsTrim implementations in stats and tmux packages, replacing all call sites with the standard library strings.TrimSpace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Refactor oversized functions and split large test filesPaul Buetow
Split DefaultPrompts (201L), loadFromFile (83L), and Update (74L) into focused helper functions under 50 lines each. Split handlers_test.go (1650L) and config_test.go (1419L) into logical sub-files under 1000L. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Fix time.After timer leak in stats.acquireFileLockPaul Buetow
Replace per-iteration time.After with a single time.NewTimer that is reused via Reset() and cleaned up with defer Stop(). Prevents leaking a timer and channel on every retry iteration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Release v0.24.0v0.24.0Paul Buetow
Bring unit test coverage from ~75% to 85.1% project-wide. All internal packages now exceed 80% coverage. Refactored cmd entrypoints to extract testable run() functions with injectable seams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11refactor: consolidate cache and state into .local/hexai directoryPaul Buetow
Move all cache and state files under ~/.local/hexai/ with subdirectories: - ~/.local/hexai/cache/ (was ~/.cache/hexai/) - ~/.local/hexai/state/ (was ~/.local/state/hexai/) - ~/.local/hexai/data/ (was ~/.local/share/hexai/) This centralizes all non-config hexai files under a single .local/hexai directory, making it easier to manage and back up user data. Amp-Thread-ID: https://ampcode.com/threads/T-019c4e03-73db-70a2-ae27-3e1cc31d59c3 Co-authored-by: Amp <amp@ampcode.com>
2025-11-02some linter fixesPaul Buetow
2025-09-19morev0.11.6Paul Buetow
2025-09-19fixPaul Buetow
2025-09-17feat(stats,tmux): global Σ@window stats across processes with flocked ↵Paul Buetow
cache; width mitigation (narrow/maxlen); configurable [stats] window_minutes; robust coverage parsing; docs update\n\n- Add internal/stats with windowed event cache + flock + atomic writes\n- Wire stats into LSP/CLI/Tmux Action; tmux shows Σ@window with per-model tail\n- HEXAI_TMUX_STATUS_NARROW and HEXAI_TMUX_STATUS_MAXLEN for width control\n- Add [stats] window_minutes to config and apply on startup\n- Improve Magefile coverage handling; add tests to lift coverage >85%\n- Update docs/tmux.md and config example