ccusage 0.1.4 → 0.1.6

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) 2025 ryoppippi
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 CHANGED
@@ -36,10 +36,10 @@ Run directly without installation:
36
36
 
37
37
  ```bash
38
38
  # Using npx
39
- npx ccusage@latest daily
39
+ npx ccusage@latest
40
40
 
41
41
  # Using bunx
42
- bunx ccusage daily
42
+ bunx ccusage
43
43
  ```
44
44
 
45
45
  ### Local Installation
@@ -78,6 +78,7 @@ Shows token usage and costs aggregated by date:
78
78
  ```bash
79
79
  # Show all daily usage
80
80
  ccusage daily
81
+ # or: ccusage
81
82
  # or: npx ccusage@latest daily
82
83
  # or: bunx ccusage daily
83
84
 
@@ -91,6 +92,8 @@ ccusage daily --path /custom/path/to/.claude
91
92
  ccusage daily --json
92
93
  ```
93
94
 
95
+ `ccusage` is an alias for `ccusage daily`, so you can run it without specifying the subcommand.
96
+
94
97
  ### Session Report
95
98
 
96
99
  Shows usage grouped by conversation sessions, sorted by cost:
package/dist/index.js CHANGED
@@ -6816,7 +6816,7 @@ const consola = createConsola();
6816
6816
  //#endregion
6817
6817
  //#region package.json
6818
6818
  var name = "ccusage";
6819
- var version = "0.1.4";
6819
+ var version = "0.1.6";
6820
6820
  var description = "Usage analysis tool for Claude Code";
6821
6821
 
6822
6822
  //#endregion
@@ -6984,7 +6984,7 @@ const sessionCommand = define({
6984
6984
  if (sessionData.length === 0) {
6985
6985
  if (ctx.values.json) log(JSON.stringify([]));
6986
6986
  else logger.warn("No Claude usage data found.");
6987
- process.exit(0);
6987
+ process$1.exit(0);
6988
6988
  }
6989
6989
  const totals = sessionData.reduce((acc, data) => ({
6990
6990
  inputTokens: acc.inputTokens + data.inputTokens,
@@ -7018,7 +7018,8 @@ const sessionCommand = define({
7018
7018
  logger.box("Claude Code Token Usage Report - By Session");
7019
7019
  const table = new import_cli_table3.default({
7020
7020
  head: [
7021
- "Project / Session",
7021
+ "Project",
7022
+ "Session",
7022
7023
  "Input Tokens",
7023
7024
  "Output Tokens",
7024
7025
  "Total Tokens",
@@ -7027,6 +7028,7 @@ const sessionCommand = define({
7027
7028
  ],
7028
7029
  style: { head: ["cyan"] },
7029
7030
  colAligns: [
7031
+ "left",
7030
7032
  "left",
7031
7033
  "right",
7032
7034
  "right",
@@ -7035,11 +7037,16 @@ const sessionCommand = define({
7035
7037
  "left"
7036
7038
  ]
7037
7039
  });
7040
+ let maxProjectLength = 0;
7041
+ let maxSessionLength = 0;
7038
7042
  for (const data of sessionData) {
7039
- const projectDisplay = data.projectPath.length > 40 ? `...${data.projectPath.slice(-37)}` : data.projectPath;
7040
- const sessionDisplay = data.sessionId.length > 20 ? `${data.sessionId.slice(0, 17)}...` : data.sessionId;
7043
+ const projectDisplay = data.projectPath.length > 20 ? `...${data.projectPath.slice(-17)}` : data.projectPath;
7044
+ const sessionDisplay = data.sessionId.split("-").slice(-2).join("-");
7045
+ maxProjectLength = Math.max(maxProjectLength, projectDisplay.length);
7046
+ maxSessionLength = Math.max(maxSessionLength, sessionDisplay.length);
7041
7047
  table.push([
7042
- `${projectDisplay}\n └─ ${sessionDisplay}`,
7048
+ projectDisplay,
7049
+ sessionDisplay,
7043
7050
  formatNumber(data.inputTokens),
7044
7051
  formatNumber(data.outputTokens),
7045
7052
  formatNumber(data.inputTokens + data.outputTokens),
@@ -7048,7 +7055,8 @@ const sessionCommand = define({
7048
7055
  ]);
7049
7056
  }
7050
7057
  table.push([
7051
- "─".repeat(40),
7058
+ "─".repeat(maxProjectLength),
7059
+ "─".repeat(maxSessionLength),
7052
7060
  "─".repeat(12),
7053
7061
  "─".repeat(12),
7054
7062
  "─".repeat(12),
@@ -7057,6 +7065,7 @@ const sessionCommand = define({
7057
7065
  ]);
7058
7066
  table.push([
7059
7067
  import_picocolors.default.yellow("Total"),
7068
+ "",
7060
7069
  import_picocolors.default.yellow(formatNumber(totals.inputTokens)),
7061
7070
  import_picocolors.default.yellow(formatNumber(totals.outputTokens)),
7062
7071
  import_picocolors.default.yellow(formatNumber(totals.inputTokens + totals.outputTokens)),
Binary file
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "0.1.4",
4
- "author": "ryoppippi <ryoppippi.el@gmail.com> (https://github.com/ryoppippi)",
5
- "license": "MIT",
6
- "funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
3
+ "version": "0.1.6",
4
+ "description": "Usage analysis tool for Claude Code",
5
+ "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/ryoppippi/ccusage/issues"
8
+ },
7
9
  "repository": {
8
10
  "type": "git",
9
11
  "url": "git+https://github.com/ryoppippi/ccusage.git"
10
12
  },
11
- "bugs": {
12
- "url": "https://github.com/ryoppippi/ccusage/issues"
13
- },
14
- "homepage": "https://github.com/ryoppippi/ccusage#readme",
15
- "bin": "./dist/index.js",
16
- "description": "Usage analysis tool for Claude Code",
13
+ "funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
14
+ "license": "MIT",
15
+ "author": "ryoppippi <ryoppippi.el@gmail.com> (https://github.com/ryoppippi)",
17
16
  "type": "module",
17
+ "bin": "./dist/index.js",
18
18
  "files": [
19
19
  "dist",
20
20
  "docs"