@loredunk/ccoach 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 loredunk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # ccoach
2
+
3
+ <p align="center"><a href="README_CN.md">中文 README</a></p>
4
+
5
+ > A local AI usage coach (macOS / Linux). Read-only analysis of how you use **Claude Code / Codex** —
6
+ > where your tokens go, what's wasted, and how to use the tools better — turned into a **shareable scorecard**.
7
+ > Both platforms are first-class and symmetric (not a Codex-only tool); more agent CLIs (OpenClaw, Harness, …) are planned. Design & decisions live in [`docs/`](docs/).
8
+
9
+ ## What it does
10
+
11
+ - **Usage report**: read-only parse of your local **Claude Code / Codex** records — tokens, estimated cost,
12
+ tool calls, and breakdowns by repo / hour / source / language / git habits / config scan. Read-only; changes nothing.
13
+ - **Advice** (skill): teaches Claude Code / Codex to interpret this data and give **feature-first** advice —
14
+ whenever a finding can be solved with a native feature (CLAUDE.md/AGENTS.md, subagents, hooks, plan mode,
15
+ permission settings, model/effort tiers…), it names the feature. Supports **session / project / global** scopes.
16
+ - **Shareable scorecard**: grade your usage / habits / prompts across four axes (Prompt Skill, Spending
17
+ Style, Engineering Sense, Diligence) into a screenshot-friendly card at the top of the HTML report
18
+ (bilingual zh/en, rendered by the skill).
19
+
20
+ > **Privacy**: all analysis runs locally — your prompts never leave your machine.
21
+
22
+ ## Install
23
+
24
+ ccoach is a TypeScript / Node package (ESM, Node ≥ 18); the CLI binary is `ccoach`. Distribution is "everything is npx".
25
+
26
+ ```bash
27
+ npx @loredunk/ccoach # run without installing (once published)
28
+ npm i -g @loredunk/ccoach # or install globally
29
+ ```
30
+
31
+ ### From source (today)
32
+
33
+ ```bash
34
+ npm install
35
+ npm run build # -> dist/cli.js (bin: ccoach)
36
+ node dist/cli.js --json --days 7
37
+ # or `npm link`, then `ccoach` is on your PATH
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ A bare invocation prints today's usage report, both platforms merged:
43
+
44
+ ```bash
45
+ ccoach # today, all platforms
46
+ ccoach --date 2026-05-13 # a specific day
47
+ ccoach --since 2026-05-01 # from a day through today
48
+ ccoach --days 7 # the last 7 days
49
+ ccoach --platform claude-code # claude-code | codex | all (default: all)
50
+ ccoach --by-repo # per-repository breakdown (with branches)
51
+ ccoach --scope project # global | project | session (adds projects[] / sessions_detail[])
52
+ ccoach --json # JSON output, script / agent friendly
53
+ ```
54
+
55
+ ## Advice skill
56
+
57
+ For richer AI-written HTML reports, use the reusable skill
58
+ [skills/ai-usage-html-report](skills/ai-usage-html-report/SKILL.md): it reads local **Claude Code + Codex**
59
+ data from `ccoach report --json` (tokens, per-model breakdown and behavior for *both* platforms; `ccusage`
60
+ is an offline token cross-check, never a runtime dependency), computes authoritative cost from each model's
61
+ **official online price**, and renders
62
+ a dual-platform HTML report with a scorecard. It can drill from high-token projects down to candidate
63
+ sessions (`ccoach sessions`), reads a selected session's user prompts only after explicit approval, and
64
+ never reads hidden system prompts.
65
+
66
+ ## Notes & boundaries
67
+
68
+ - **Local machine only**: rollouts are per-machine; this tool reads only local files and never aggregates across machines.
69
+ - **No quota percentages**: `rate_limits` is always null under the CLI, and quota is account-level / cross-machine.
70
+ - **Cost is an estimate**, not your actual bill. The CLI ships a best-effort **offline fallback** price table; **authoritative** cost is computed by the report skill, which looks up each observed model's **official online price** per token class. Tokens (and the offline cost) are cross-checked against `ccusage` — token-exact, cost within 1% — via `npm run verify:ccusage` (ccusage is a dev/CI check only, never a runtime dependency).
71
+ - Time windows use absolute local-timezone day boundaries; the report header states the timezone.
72
+
73
+ ## Credits
74
+
75
+ ccoach stands on the shoulders of [ccusage](https://github.com/ryoppippi/ccusage) by [@ryoppippi](https://github.com/ryoppippi): its unified parser learned how to read the local JSONL from ccusage's approach (without copying its code), and ccusage remains ccoach's token / cost cross-check. Thank you. 🙏