cc-tool-mix 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -0
  3. package/cli.mjs +189 -0
  4. package/package.json +36 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yurukusa
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,66 @@
1
+ # cc-tool-mix
2
+
3
+ > Which tools does Claude Code use most in your sessions?
4
+
5
+ Break down your tool usage across all Claude Code sessions — Bash, Read, Edit, Grep, Task, and more.
6
+
7
+ ```
8
+ npx cc-tool-mix
9
+ ```
10
+
11
+ ## Output
12
+
13
+ ```
14
+ ⚒ cc-tool-mix — Claude Code tool usage breakdown
15
+ 141,600 total tool calls across all projects
16
+
17
+ Category Breakdown
18
+ File Ops ████████░░░░░░░░░░░░ 41.4% 58,608
19
+ Shell ████████░░░░░░░░░░░░ 37.5% 53,114
20
+ Search ██░░░░░░░░░░░░░░░░░░ 11.0% 15,591
21
+ Web █░░░░░░░░░░░░░░░░░░░ 2.8% 3,909
22
+ AI Agents ░░░░░░░░░░░░░░░░░░░░ 2.2% 3,091
23
+
24
+ Top Tools
25
+ Bash ████████░░░░░░░░░░░░ 37.5% 53,114
26
+ Read █████░░░░░░░░░░░░░░░ 25.6% 36,287
27
+ Edit ██░░░░░░░░░░░░░░░░░░ 11.8% 16,746
28
+ Grep ██░░░░░░░░░░░░░░░░░░ 9.0% 12,798
29
+ Write █░░░░░░░░░░░░░░░░░░░ 3.9% 5,575
30
+
31
+ Insight
32
+ Heavy Bash user (38%) — consider Grep/Glob for searches
33
+ Top tool: Bash (37.5%)
34
+ ```
35
+
36
+ ## Options
37
+
38
+ ```
39
+ npx cc-tool-mix # full breakdown
40
+ npx cc-tool-mix --project # per-project top tool
41
+ npx cc-tool-mix --top=10 # show only top 10 tools
42
+ npx cc-tool-mix --json # JSON output (pipe to other tools)
43
+ ```
44
+
45
+ ## Browser version
46
+
47
+ No install: [yurukusa.github.io/cc-tool-mix](https://yurukusa.github.io/cc-tool-mix/)
48
+
49
+ Drop your `~/.claude` folder to see your breakdown instantly.
50
+
51
+ ## Categories
52
+
53
+ | Category | Tools |
54
+ |-----------|-------|
55
+ | File Ops | Read, Write, Edit, MultiEdit |
56
+ | Shell | Bash |
57
+ | Search | Grep, Glob |
58
+ | AI Agents | Task, TaskOutput, Agent |
59
+ | Web | WebFetch, WebSearch |
60
+ | UI / Flow | ExitPlanMode, AskUserQuestion |
61
+
62
+ ## Zero dependencies
63
+
64
+ Reads directly from `~/.claude/projects/` — no network, no auth, no tracking.
65
+
66
+ MIT License · [cc-toolkit](https://yurukusa.github.io/cc-toolkit/) · 48 free tools
package/cli.mjs ADDED
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+
3
+ // cc-tool-mix — See which tools Claude Code uses most in your sessions.
4
+ // Zero dependencies. Reads ~/.claude/projects/ session transcripts.
5
+
6
+ import { readdir, stat, open, readFile } from 'node:fs/promises';
7
+ import { join } from 'node:path';
8
+ import { homedir } from 'node:os';
9
+
10
+ const C = {
11
+ reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
12
+ red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
13
+ blue: '\x1b[34m', cyan: '\x1b[36m', magenta: '\x1b[35m',
14
+ white: '\x1b[37m',
15
+ };
16
+
17
+ // Tool categories
18
+ const CATEGORIES = {
19
+ 'File Ops': ['Read', 'Write', 'Edit', 'MultiEdit', 'NotebookEdit'],
20
+ 'Search': ['Grep', 'Glob'],
21
+ 'Shell': ['Bash'],
22
+ 'AI Agents': ['Task', 'TaskOutput', 'TaskStop', 'Agent', 'SendMessage'],
23
+ 'Web': ['WebFetch', 'WebSearch'],
24
+ 'UI / Flow': ['ExitPlanMode', 'EnterPlanMode', 'AskUserQuestion', 'Skill'],
25
+ 'Other': [],
26
+ };
27
+
28
+ function catOf(name) {
29
+ for (const [cat, tools] of Object.entries(CATEGORIES)) {
30
+ if (cat === 'Other') continue;
31
+ if (tools.includes(name)) return cat;
32
+ }
33
+ return 'Other';
34
+ }
35
+
36
+ function bar(pct, width = 30, char = '█') {
37
+ const filled = Math.round(pct * width);
38
+ return char.repeat(filled) + '░'.repeat(width - filled);
39
+ }
40
+
41
+ function catColor(cat) {
42
+ const m = { 'File Ops': C.cyan, 'Search': C.blue, 'Shell': C.yellow,
43
+ 'AI Agents': C.magenta, 'Web': C.green, 'UI / Flow': C.dim, 'Other': C.dim };
44
+ return m[cat] || C.reset;
45
+ }
46
+
47
+ async function* walkJsonl(dir) {
48
+ let entries;
49
+ try { entries = await readdir(dir, { withFileTypes: true }); }
50
+ catch { return; }
51
+ for (const e of entries) {
52
+ const full = join(dir, e.name);
53
+ if (e.isDirectory()) yield* walkJsonl(full);
54
+ else if (e.isFile() && e.name.endsWith('.jsonl')) yield full;
55
+ }
56
+ }
57
+
58
+ async function parseFile(path, tools, perProject, projectKey) {
59
+ let text;
60
+ try { text = await readFile(path, 'utf8'); }
61
+ catch { return; }
62
+
63
+ for (const line of text.split('\n')) {
64
+ if (!line.trim()) continue;
65
+ let obj;
66
+ try { obj = JSON.parse(line); } catch { continue; }
67
+
68
+ if (obj.type !== 'assistant') continue;
69
+ const content = obj.message?.content;
70
+ if (!Array.isArray(content)) continue;
71
+
72
+ for (const c of content) {
73
+ if (c?.type !== 'tool_use') continue;
74
+ const name = c.name || 'unknown';
75
+ tools[name] = (tools[name] || 0) + 1;
76
+ if (perProject) {
77
+ perProject[projectKey] = perProject[projectKey] || {};
78
+ perProject[projectKey][name] = (perProject[projectKey][name] || 0) + 1;
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ async function main() {
85
+ const args = process.argv.slice(2);
86
+ const showJson = args.includes('--json');
87
+ const showProject = args.includes('--project') || args.includes('-p');
88
+ const topN = parseInt(args.find(a => a.startsWith('--top='))?.split('=')[1] || '20');
89
+
90
+ const claudeDir = join(homedir(), '.claude', 'projects');
91
+ let projDirs;
92
+ try { projDirs = await readdir(claudeDir, { withFileTypes: true }); }
93
+ catch { console.error('No ~/.claude/projects found'); process.exit(1); }
94
+
95
+ const tools = {};
96
+ const perProject = showProject ? {} : null;
97
+
98
+ for (const d of projDirs) {
99
+ if (!d.isDirectory()) continue;
100
+ const projPath = join(claudeDir, d.name);
101
+ const key = d.name.replace(/^-home-[^-]+-/, '').replace(/-/g, '/');
102
+ for await (const jsonlPath of walkJsonl(projPath)) {
103
+ await parseFile(jsonlPath, tools, perProject, key);
104
+ }
105
+ }
106
+
107
+ const total = Object.values(tools).reduce((s, n) => s + n, 0);
108
+ if (total === 0) { console.log('No tool usage data found.'); return; }
109
+
110
+ const sorted = Object.entries(tools).sort((a, b) => b[1] - a[1]).slice(0, topN);
111
+
112
+ // Category aggregation
113
+ const catTotals = {};
114
+ for (const [name, count] of Object.entries(tools)) {
115
+ const cat = catOf(name);
116
+ catTotals[cat] = (catTotals[cat] || 0) + count;
117
+ }
118
+ const sortedCats = Object.entries(catTotals).sort((a, b) => b[1] - a[1]);
119
+
120
+ if (showJson) {
121
+ console.log(JSON.stringify({ total, tools: Object.fromEntries(sorted), categories: Object.fromEntries(sortedCats) }, null, 2));
122
+ return;
123
+ }
124
+
125
+ console.log(`\n${C.bold}⚒ cc-tool-mix${C.reset} — Claude Code tool usage breakdown`);
126
+ console.log(`${C.dim} ${total.toLocaleString()} total tool calls across all projects${C.reset}\n`);
127
+
128
+ // Category summary
129
+ console.log(`${C.bold}Category Breakdown${C.reset}`);
130
+ for (const [cat, count] of sortedCats) {
131
+ const pct = count / total;
132
+ const col = catColor(cat);
133
+ console.log(` ${col}${cat.padEnd(12)}${C.reset} ${bar(pct, 20)} ${(pct * 100).toFixed(1).padStart(5)}% ${C.dim}${count.toLocaleString()}${C.reset}`);
134
+ }
135
+
136
+ // Top tools
137
+ console.log(`\n${C.bold}Top Tools${C.reset}`);
138
+ for (const [name, count] of sorted) {
139
+ const pct = count / total;
140
+ const cat = catOf(name);
141
+ const col = catColor(cat);
142
+ console.log(` ${col}${name.padEnd(18)}${C.reset} ${bar(pct, 20)} ${(pct * 100).toFixed(1).padStart(5)}% ${C.dim}${count.toLocaleString()}${C.reset}`);
143
+ }
144
+
145
+ // Insight
146
+ const topTool = sorted[0];
147
+ const bashPct = (tools['Bash'] || 0) / total;
148
+ const searchPct = ((tools['Grep'] || 0) + (tools['Glob'] || 0)) / total;
149
+ const filePct = ((tools['Read'] || 0) + (tools['Write'] || 0) + (tools['Edit'] || 0)) / total;
150
+ const agentPct = ((tools['Task'] || 0) + (tools['Agent'] || 0)) / total;
151
+
152
+ console.log(`\n${C.bold}Insight${C.reset}`);
153
+ if (bashPct > 0.35) {
154
+ console.log(` ${C.yellow}Heavy Bash user${C.reset} (${(bashPct*100).toFixed(0)}%) — consider Grep/Glob for searches`);
155
+ } else if (searchPct > 0.15) {
156
+ console.log(` ${C.cyan}Search-driven${C.reset} (${(searchPct*100).toFixed(0)}% Grep+Glob) — efficient file discovery`);
157
+ }
158
+ if (agentPct > 0.1) {
159
+ console.log(` ${C.magenta}Subagent-heavy${C.reset} (${(agentPct*100).toFixed(0)}%) — parallel workflows active`);
160
+ }
161
+ if (filePct > 0.5) {
162
+ console.log(` ${C.cyan}File-ops focused${C.reset} (${(filePct*100).toFixed(0)}%) — read-edit-write cycle dominant`);
163
+ }
164
+ console.log(` ${C.dim}Top tool: ${topTool[0]} (${(topTool[1]/total*100).toFixed(1)}%)${C.reset}`);
165
+
166
+ // Per-project breakdown
167
+ if (showProject && perProject) {
168
+ console.log(`\n${C.bold}Per-Project Top Tool${C.reset}`);
169
+ const projSorted = Object.entries(perProject)
170
+ .map(([proj, t]) => {
171
+ const tot = Object.values(t).reduce((s, n) => s + n, 0);
172
+ const top = Object.entries(t).sort((a, b) => b[1] - a[1])[0];
173
+ return { proj, tot, top };
174
+ })
175
+ .filter(x => x.tot > 10)
176
+ .sort((a, b) => b.tot - a.tot)
177
+ .slice(0, 15);
178
+
179
+ for (const { proj, tot, top } of projSorted) {
180
+ const pct = top[1] / tot;
181
+ const col = catColor(catOf(top[0]));
182
+ console.log(` ${C.dim}${proj.slice(0, 30).padEnd(30)}${C.reset} ${col}${top[0].padEnd(10)}${C.reset} ${(pct*100).toFixed(0).padStart(3)}% ${C.dim}${tot.toLocaleString()} calls${C.reset}`);
183
+ }
184
+ }
185
+
186
+ console.log('');
187
+ }
188
+
189
+ main().catch(e => { console.error(e.message); process.exit(1); });
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "cc-tool-mix",
3
+ "version": "1.0.0",
4
+ "description": "See which tools Claude Code uses most in your sessions — break down by category and project.",
5
+ "bin": {
6
+ "cc-tool-mix": "cli.mjs"
7
+ },
8
+ "type": "module",
9
+ "keywords": [
10
+ "claude-code",
11
+ "claude",
12
+ "ai",
13
+ "tools",
14
+ "usage",
15
+ "analytics",
16
+ "productivity",
17
+ "developer-tools"
18
+ ],
19
+ "author": "yurukusa",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/yurukusa/cc-tool-mix.git"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "files": [
29
+ "cli.mjs",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
33
+ "scripts": {
34
+ "prepublishOnly": "node --check cli.mjs"
35
+ }
36
+ }