Skip to content

worklog sources: source listing and event counts #30

Description

@Saber5656

Title

worklog sources: source listing and event counts

Summary

Implement worklog sources: list each configured source with its resolved
paths/state and the event counts it would contribute for the given
--date, including per-originator counts for Codex (the noise-tuning tool
promised by the research doc).

Context

Users need a dry-run view to answer "why is my report empty?" and "which
originators should I exclude?" without generating a report. This command is
also the human-facing probe for known unknown U2 (Codex automation noise).

Scope

  • internal/cli/sources.go (replace stub), a small Meta-count extension
    point in the collector result handling, tests.

Detailed Requirements

  1. Runs the normal collect pipeline (same wiring as 25, honoring
    --source) for the --date day range, but instead of aggregating,
    prints per source (stdout, English, deterministic order zsh, git,
    claude-code, codex):

    zsh          enabled   ~/.zsh_history                    42 commands
    git          enabled   2 repos under 1 root               7 commits
    claude-code  enabled   ~/.claude/projects                 3 sessions
    codex        enabled   ~/.codex/sessions                  5 sessions
      originators: cli=3 auto-orchestrator=2
    warnings:
      [zsh] zsh_no_timestamps: ...
    
    • Column alignment fixed-width (%-12s %-9s %-34s); paths
      tilde-abbreviated. Second-column states (exactly three): enabled
      (collected this run), disabled (off in sources.enabled config),
      skipped (enabled in config but excluded by --source for this run;
      rendered as skipped (--source)). disabled/skipped rows print -
      for counts.
    • Codex originator sub-line: counts by Meta["originator"] over
      collected codex events, sorted by count desc then name; only when
      codex enabled and ≥ 1 session. Excluded originators (config) are NOT
      visible here (they were skipped at parse); add trailing note
      (N originators excluded by config) when exclude_originators is
      non-empty — implement by having the codex provider count skipped
      files into a Meta-free side channel: extend the provider with a
      SkippedByOriginator() int method captured after Collect (simple,
      no interface change).
    • Warnings section: same formatting as reports' stderr lines, but on
      stdout (this command's output IS the diagnostic).
  2. Counts are per event Kind (commands/commits/sessions naming per source).

  3. Exit 0 always (diagnostics), except harness errors (exit 2 path from
    07).

  4. No LLM involvement, no redaction needed (counts only — but note:
    originator strings print raw → pass through sanitize.Line(…, 60)).

  5. Global flags (DESIGN §4): --config, --date (the counted day),
    --verbose honored; --lang parses but is ignored (output is
    English-only, like doctor).

Acceptance Criteria

  • Fixture-HOME golden (reusing the 25 harness): exact table, counts
    matching the fixture ground truth, originator sub-line correct.
  • --source git run lists only git as enabled-and-counted, others
    shown skipped (--source).
  • Simple-format zsh fixture → 0 commands + the warning line.
  • Excluded-originator fixture → exclusion note with correct N.
  • Deterministic output (golden, cross-platform).
  • Read-only tree-hash invariant holds.

Validation

go test -race ./internal/cli/ -run Sources -v + golden in PR.

Dependencies

07, 08, 10, 12, 14, 15.

Non-goals

Doctor-style fix guidance (28 owns that), historical ranges (single day
only in v1), JSON output (v2 if scripting demand appears).

Design References

  • docs/DESIGN.md §4, §7.4 (originators), §15 (U2)
  • docs/research/codex-session-format.md

Source of truth: docs/issues/29-cmd-sources.md (PR #1, branch docs/v1-design). If this issue and the repo docs disagree, the docs win. Execution order and dependencies: docs/ISSUE_PLAN.md (this is issue 29 of 33).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions