a2zusage 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.
- package/LICENSE +190 -0
- package/README.md +247 -0
- package/bin/a2zusage +0 -0
- package/bin/a2zusage.js +31 -0
- package/package.json +62 -0
- package/scripts/install.js +142 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 aezizhu
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# a2zusage - AI Coding Tools Usage Tracker
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Query usage statistics from ALL your AI coding tools in one command</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="#installation">Installation</a> •
|
|
9
|
+
<a href="#supported-tools">Supported Tools</a> •
|
|
10
|
+
<a href="#usage">Usage</a> •
|
|
11
|
+
<a href="#why-this-tool">Why This Tool</a> •
|
|
12
|
+
<a href="#contributing">Contributing</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="https://img.shields.io/npm/v/a2zusage?style=flat-square" alt="npm version">
|
|
17
|
+
<img src="https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square" alt="license">
|
|
18
|
+
<img src="https://img.shields.io/badge/tools-14%2B-green?style=flat-square" alt="supported tools">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
╭────────────────┬──────────┬───────────────┬─────────────┬─────────────┬───────────────╮
|
|
25
|
+
│ Tool │ Status │ Today │ This Week │ This Month │ Total │
|
|
26
|
+
├────────────────┼──────────┼───────────────┼─────────────┼─────────────┼───────────────┤
|
|
27
|
+
│ Claude Code │ ✓ Active │ 321K tokens │ 1.4M tokens │ 6.1M tokens │ 24.2M tokens │
|
|
28
|
+
│ Cursor │ ✓ Active │ - │ - │ - │ 32.5K tokens │
|
|
29
|
+
│ Windsurf │ ✓ Active │ - │ - │ - │ 7.1M tokens │
|
|
30
|
+
│ Warp AI │ ✓ Active │ - │ - │ 8.2M tokens │ 167.1M tokens │
|
|
31
|
+
│ GitHub Copilot │ ○ N/A │ - │ - │ - │ - │
|
|
32
|
+
│ ... │ ... │ ... │ ... │ ... │ ... │
|
|
33
|
+
╰────────────────┴──────────┴───────────────┴─────────────┴─────────────┴───────────────╯
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
### Using npx (Recommended)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx a2zusage@latest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Install Globally
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g a2zusage
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Using Cargo (Rust)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cargo install a2zusage
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### From Source
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/aezizhu/a2zaiusage.git
|
|
60
|
+
cd a2zaiusage
|
|
61
|
+
cargo build --release
|
|
62
|
+
./target/release/a2zusage
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Supported Tools
|
|
66
|
+
|
|
67
|
+
a2zusage supports **14+ AI coding tools** out of the box:
|
|
68
|
+
|
|
69
|
+
| Tool | Data Source | Status |
|
|
70
|
+
|------|-------------|--------|
|
|
71
|
+
| **Claude Code** | Local JSONL (`~/.claude/projects/`) | ✅ Full Support |
|
|
72
|
+
| **Cursor** | SQLite database | ✅ Full Support |
|
|
73
|
+
| **GitHub Copilot** | GitHub API + Local logs | ✅ Full Support |
|
|
74
|
+
| **Windsurf** | Cascade logs (`~/.codeium/`) | ✅ Full Support |
|
|
75
|
+
| **Warp AI** | SQLite database | ✅ Full Support |
|
|
76
|
+
| **Cline / Roo Code** | VS Code extension storage | ✅ Full Support |
|
|
77
|
+
| **OpenCode** | Local JSON files | ✅ Full Support |
|
|
78
|
+
| **OpenAI Codex** | OpenAI Usage API | ✅ Full Support |
|
|
79
|
+
| **Gemini CLI** | Local telemetry (`~/.gemini/`) | ✅ Full Support |
|
|
80
|
+
| **Amazon Q Developer** | Local logs | ✅ Full Support |
|
|
81
|
+
| **Tabnine** | Local logs | ✅ Full Support |
|
|
82
|
+
| **Gemini Code Assist** | Google Cloud | ✅ Full Support |
|
|
83
|
+
| **Sourcegraph Cody** | VS Code extension | ✅ Full Support |
|
|
84
|
+
| **Replit Ghostwriter** | Web link | 🔗 Link Only |
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### Basic Usage
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Query all detected AI tools
|
|
92
|
+
a2zusage
|
|
93
|
+
|
|
94
|
+
# Or using npx
|
|
95
|
+
npx a2zusage@latest
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Filter by Tool
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
a2zusage -t claude-code # Only Claude Code
|
|
102
|
+
a2zusage -t cursor # Only Cursor
|
|
103
|
+
a2zusage -t warp # Only Warp AI
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Output Formats
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
a2zusage -f table # Pretty table (default)
|
|
110
|
+
a2zusage -f json # JSON output
|
|
111
|
+
a2zusage -f csv # CSV output
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Other Commands
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
a2zusage doctor # Check paths and configuration
|
|
118
|
+
a2zusage list # List all supported tools
|
|
119
|
+
a2zusage --help # Show help
|
|
120
|
+
a2zusage -v # Verbose mode with data sources
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### JSON Output Example
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
"name": "claude-code",
|
|
129
|
+
"display_name": "Claude Code",
|
|
130
|
+
"status": "active",
|
|
131
|
+
"usage": {
|
|
132
|
+
"today": { "input_tokens": 306929, "output_tokens": 14196, "request_count": 2709 },
|
|
133
|
+
"this_week": { "input_tokens": 1106656, "output_tokens": 278247, "request_count": 4663 },
|
|
134
|
+
"this_month": { "input_tokens": 3902283, "output_tokens": 2166653, "request_count": 32956 },
|
|
135
|
+
"total": { "input_tokens": 13648429, "output_tokens": 10593772, "request_count": 89580 }
|
|
136
|
+
},
|
|
137
|
+
"data_source": "/Users/you/.claude/projects"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Why This Tool?
|
|
143
|
+
|
|
144
|
+
### 🎯 Built for Hiring AI-Native Developers
|
|
145
|
+
|
|
146
|
+
We created this tool because we needed a way to **identify developers who truly embrace AI-assisted coding** (what we call "Vibe Coding").
|
|
147
|
+
|
|
148
|
+
When hiring, we found that:
|
|
149
|
+
|
|
150
|
+
- **Resume skills don't tell the whole story** - Many claim AI proficiency but rarely use it
|
|
151
|
+
- **Token usage reveals real habits** - High usage = deep integration into daily workflow
|
|
152
|
+
- **Multiple tool usage shows adaptability** - The best devs try everything and use what works
|
|
153
|
+
|
|
154
|
+
We used a2zusage in our hiring process and found it **incredibly effective** at identifying candidates who are genuinely productive with AI tools. Now we're open-sourcing it for the community.
|
|
155
|
+
|
|
156
|
+
### 📊 Quantify Your AI Usage
|
|
157
|
+
|
|
158
|
+
Ever wondered:
|
|
159
|
+
- How many tokens you've used across all AI coding tools?
|
|
160
|
+
- Which tool you use most frequently?
|
|
161
|
+
- How your usage has changed over time?
|
|
162
|
+
|
|
163
|
+
a2zusage answers all these questions in seconds.
|
|
164
|
+
|
|
165
|
+
### 🔒 Privacy-First Design
|
|
166
|
+
|
|
167
|
+
- **100% Local** - All data is read from local files on your machine
|
|
168
|
+
- **No Network Calls** - Unless you explicitly use API-based providers
|
|
169
|
+
- **No Data Collection** - We never see your usage data
|
|
170
|
+
- **Open Source** - Audit the code yourself
|
|
171
|
+
|
|
172
|
+
## Environment Variables
|
|
173
|
+
|
|
174
|
+
For API-based providers, set these environment variables:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# GitHub Copilot (or use `gh auth login`)
|
|
178
|
+
export GITHUB_TOKEN=ghp_xxx
|
|
179
|
+
|
|
180
|
+
# OpenAI Codex
|
|
181
|
+
export OPENAI_API_KEY=sk-xxx
|
|
182
|
+
|
|
183
|
+
# AWS (for Amazon Q)
|
|
184
|
+
export AWS_PROFILE=default
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Cross-Platform Support
|
|
188
|
+
|
|
189
|
+
| Platform | Status |
|
|
190
|
+
|----------|--------|
|
|
191
|
+
| macOS (Intel) | ✅ Supported |
|
|
192
|
+
| macOS (Apple Silicon) | ✅ Supported |
|
|
193
|
+
| Linux (x64) | ✅ Supported |
|
|
194
|
+
| Linux (ARM64) | ✅ Supported |
|
|
195
|
+
| Windows (x64) | ✅ Supported |
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
We welcome contributions! Here's how you can help:
|
|
200
|
+
|
|
201
|
+
### Add Support for More Tools
|
|
202
|
+
|
|
203
|
+
Know of an AI coding tool we don't support? We'd love to add it!
|
|
204
|
+
|
|
205
|
+
1. Fork the repository
|
|
206
|
+
2. Add a new provider in `src/providers/`
|
|
207
|
+
3. Update the provider registry in `src/providers/mod.rs`
|
|
208
|
+
4. Submit a pull request
|
|
209
|
+
|
|
210
|
+
### Improve Existing Providers
|
|
211
|
+
|
|
212
|
+
- Better token parsing
|
|
213
|
+
- More accurate cost estimation
|
|
214
|
+
- Additional data sources
|
|
215
|
+
|
|
216
|
+
### Report Issues
|
|
217
|
+
|
|
218
|
+
Found a bug or have a suggestion? [Open an issue](https://github.com/aezizhu/a2zaiusage/issues)!
|
|
219
|
+
|
|
220
|
+
## Citation
|
|
221
|
+
|
|
222
|
+
If you use a2zusage in your research, hiring process, or project, please cite:
|
|
223
|
+
|
|
224
|
+
```bibtex
|
|
225
|
+
@software{a2zusage,
|
|
226
|
+
author = {aezizhu},
|
|
227
|
+
title = {a2zusage: AI Coding Tools Usage Tracker},
|
|
228
|
+
url = {https://github.com/aezizhu/a2zaiusage},
|
|
229
|
+
year = {2025}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Or simply link to: `https://github.com/aezizhu/a2zaiusage`
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
<p align="center">
|
|
242
|
+
<strong>Built with ❤️ for the AI-native developer community</strong>
|
|
243
|
+
</p>
|
|
244
|
+
|
|
245
|
+
<p align="center">
|
|
246
|
+
<a href="https://github.com/aezizhu">@aezizhu</a>
|
|
247
|
+
</p>
|
package/bin/a2zusage
ADDED
|
Binary file
|
package/bin/a2zusage.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const BINARY_NAME = process.platform === 'win32' ? 'a2zusage.exe' : 'a2zusage';
|
|
8
|
+
const binaryPath = path.join(__dirname, BINARY_NAME);
|
|
9
|
+
|
|
10
|
+
// Check if binary exists
|
|
11
|
+
if (!fs.existsSync(binaryPath)) {
|
|
12
|
+
console.error('Error: a2zusage binary not found.');
|
|
13
|
+
console.error('Try reinstalling: npm install -g a2zusage');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Pass all arguments to the binary
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const child = spawn(binaryPath, args, {
|
|
20
|
+
stdio: 'inherit',
|
|
21
|
+
env: process.env
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
child.on('error', (err) => {
|
|
25
|
+
console.error('Failed to run a2zusage:', err.message);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
child.on('exit', (code) => {
|
|
30
|
+
process.exit(code || 0);
|
|
31
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "a2zusage",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Query usage statistics from all your AI coding tools in one command - Claude Code, Cursor, GitHub Copilot, Windsurf, Warp AI, and 14+ tools",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai-usage",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"cursor",
|
|
9
|
+
"github-copilot",
|
|
10
|
+
"windsurf",
|
|
11
|
+
"warp",
|
|
12
|
+
"cline",
|
|
13
|
+
"ai-coding",
|
|
14
|
+
"token-usage",
|
|
15
|
+
"developer-tools",
|
|
16
|
+
"coding-assistant",
|
|
17
|
+
"vibe-coding",
|
|
18
|
+
"ai-tools-tracker",
|
|
19
|
+
"usage-statistics",
|
|
20
|
+
"openai-codex",
|
|
21
|
+
"gemini-cli",
|
|
22
|
+
"tabnine",
|
|
23
|
+
"sourcegraph-cody",
|
|
24
|
+
"amazon-q"
|
|
25
|
+
],
|
|
26
|
+
"author": "aezizhu <https://github.com/aezizhu>",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/aezizhu/a2zaiusage.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/aezizhu/a2zaiusage#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/aezizhu/a2zaiusage/issues"
|
|
35
|
+
},
|
|
36
|
+
"bin": {
|
|
37
|
+
"a2zusage": "bin/a2zusage.js"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"bin/",
|
|
41
|
+
"scripts/",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"postinstall": "node scripts/install.js",
|
|
47
|
+
"build": "cargo build --release",
|
|
48
|
+
"test": "cargo test"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=14.0.0"
|
|
52
|
+
},
|
|
53
|
+
"os": [
|
|
54
|
+
"darwin",
|
|
55
|
+
"linux",
|
|
56
|
+
"win32"
|
|
57
|
+
],
|
|
58
|
+
"cpu": [
|
|
59
|
+
"x64",
|
|
60
|
+
"arm64"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const REPO = 'aezizhu/a2zaiusage';
|
|
9
|
+
const BINARY_NAME = process.platform === 'win32' ? 'a2zusage.exe' : 'a2zusage';
|
|
10
|
+
|
|
11
|
+
function getPlatformKey() {
|
|
12
|
+
const platform = process.platform;
|
|
13
|
+
const arch = process.arch;
|
|
14
|
+
|
|
15
|
+
if (platform === 'darwin') {
|
|
16
|
+
return arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
|
|
17
|
+
} else if (platform === 'linux') {
|
|
18
|
+
return arch === 'arm64' ? 'linux-arm64' : 'linux-x64';
|
|
19
|
+
} else if (platform === 'win32') {
|
|
20
|
+
return 'windows-x64';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function downloadFile(url, destPath) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const file = fs.createWriteStream(destPath);
|
|
29
|
+
|
|
30
|
+
const request = (url) => {
|
|
31
|
+
https.get(url, (response) => {
|
|
32
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
33
|
+
request(response.headers.location);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (response.statusCode !== 200) {
|
|
38
|
+
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
response.pipe(file);
|
|
43
|
+
file.on('finish', () => {
|
|
44
|
+
file.close();
|
|
45
|
+
resolve();
|
|
46
|
+
});
|
|
47
|
+
}).on('error', reject);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
request(url);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function getLatestRelease() {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const options = {
|
|
57
|
+
hostname: 'api.github.com',
|
|
58
|
+
path: `/repos/${REPO}/releases/latest`,
|
|
59
|
+
headers: { 'User-Agent': 'a2zusage-installer' }
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
https.get(options, (res) => {
|
|
63
|
+
let data = '';
|
|
64
|
+
res.on('data', chunk => data += chunk);
|
|
65
|
+
res.on('end', () => {
|
|
66
|
+
try {
|
|
67
|
+
resolve(JSON.parse(data));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
reject(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}).on('error', reject);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function install() {
|
|
77
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
78
|
+
const binaryPath = path.join(binDir, BINARY_NAME);
|
|
79
|
+
|
|
80
|
+
// Check if binary already exists
|
|
81
|
+
if (fs.existsSync(binaryPath)) {
|
|
82
|
+
console.log('a2zusage binary already installed');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const platformKey = getPlatformKey();
|
|
87
|
+
console.log(`Installing a2zusage for ${platformKey}...`);
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const release = await getLatestRelease();
|
|
91
|
+
const assetName = `a2zusage-${platformKey}${process.platform === 'win32' ? '.exe' : ''}`;
|
|
92
|
+
const asset = release.assets?.find(a => a.name === assetName);
|
|
93
|
+
|
|
94
|
+
if (asset) {
|
|
95
|
+
await downloadFile(asset.browser_download_url, binaryPath);
|
|
96
|
+
if (process.platform !== 'win32') {
|
|
97
|
+
fs.chmodSync(binaryPath, '755');
|
|
98
|
+
}
|
|
99
|
+
console.log('a2zusage installed successfully!');
|
|
100
|
+
} else {
|
|
101
|
+
console.log('Pre-built binary not found. Building from source...');
|
|
102
|
+
buildFromSource(binDir);
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log('Failed to download binary, building from source...');
|
|
106
|
+
buildFromSource(binDir);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function buildFromSource(binDir) {
|
|
111
|
+
try {
|
|
112
|
+
// Check if Rust is installed
|
|
113
|
+
execSync('cargo --version', { stdio: 'ignore' });
|
|
114
|
+
|
|
115
|
+
const projectRoot = path.join(__dirname, '..');
|
|
116
|
+
execSync('cargo build --release', {
|
|
117
|
+
cwd: projectRoot,
|
|
118
|
+
stdio: 'inherit'
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const sourceBinary = path.join(projectRoot, 'target', 'release', BINARY_NAME);
|
|
122
|
+
const destBinary = path.join(binDir, BINARY_NAME);
|
|
123
|
+
|
|
124
|
+
fs.copyFileSync(sourceBinary, destBinary);
|
|
125
|
+
if (process.platform !== 'win32') {
|
|
126
|
+
fs.chmodSync(destBinary, '755');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
console.log('a2zusage built and installed successfully!');
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error('Error: Rust is required to build a2zusage from source.');
|
|
132
|
+
console.error('Install Rust from https://rustup.rs/ and try again.');
|
|
133
|
+
console.error('Or download a pre-built binary from:');
|
|
134
|
+
console.error(`https://github.com/${REPO}/releases`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
install().catch(err => {
|
|
140
|
+
console.error('Installation failed:', err.message);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
});
|