Skip to content

feat(daily): default 7-day window and token display units#3

Merged
Miss-you merged 2 commits into
mainfrom
feat/daily-default-window-unit
Feb 18, 2026
Merged

feat(daily): default 7-day window and token display units#3
Miss-you merged 2 commits into
mainfrom
feat/daily-default-window-unit

Conversation

@Miss-you

@Miss-you Miss-you commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • make codetok daily default to a rolling 7-day window
  • add --all and --days controls for full history and custom lookback
  • add --unit raw|k|m|g for table token display (default k)
  • keep JSON output as raw integer token counts
  • refresh docs (README.md, README_zh.md, AGENTS.md, CLAUDE.md)
  • add unit/e2e coverage for date-window and unit behaviors

Requirement Check

  • default daily output is no longer full-history; now uses 7-day lookback
  • full-history remains available via codetok daily --all
  • custom date window remains available via --days or --since/--until
  • table output supports readable token units (raw, k, m, g)
  • docs explain that stats are aggregated from existing local session logs

Validation

  • make test
  • make lint (skipped: golangci-lint not installed in local env)
  • make build

Notes

  • --all is mutually exclusive with --days, --since, --until
  • --days is mutually exclusive with --since and --until

Copilot AI review requested due to automatic review settings February 18, 2026 02:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates codetok daily to default to a rolling 7-day lookback and adds new flags to control history windowing and table token display units, with accompanying docs and test coverage.

Changes:

  • Change daily default behavior from full-history to a 7-day rolling window; add --all and --days controls.
  • Add --unit raw|k|m|g for table token display scaling (JSON remains raw integers).
  • Update README/agent docs and expand unit/date-window test coverage (unit + e2e adjustments).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
e2e/e2e_test.go Updates daily e2e invocations to use --all and adds coverage for --unit in table output.
cmd/daily_test.go Adds unit tests for date-range resolution and token unit formatting/parsing.
cmd/daily.go Implements new --days, --all, and --unit behavior; refactors date-range logic and table formatting.
README_zh.md Documents new daily defaults/flags and clarifies stats scope in Chinese docs.
README.md Documents new daily defaults/flags and clarifies stats scope in English docs.
CLAUDE.md Adds guidance on stats scope, rebuild workflow, and daily command behavior contract.
AGENTS.md Adds repository-level agent guidance including daily command contract and build/test workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/daily.go Outdated
Comment thread cmd/daily.go Outdated
Comment thread cmd/daily.go Outdated
- defer --unit validation until table output so --json ignores unit errors

- prioritize --all conflict checks before invalid --days validation

- compute default rolling window from UTC day boundary for consistency

- add unit tests for UTC default window, conflict precedence, and json unit behavior
@Miss-you
Miss-you merged commit 950cf47 into main Feb 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants