ai-heatmap 1.1.0 → 1.2.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/README.md +19 -4
- package/bin/cli.mjs +2 -2
- package/bin/push.mjs +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,13 +30,16 @@ GitHub-style heatmap for your AI usage costs. Powered by [ccusage](https://githu
|
|
|
30
30
|
npx ai-heatmap generate
|
|
31
31
|
|
|
32
32
|
# Init a new GitHub Pages repo
|
|
33
|
+
npx ai-heatmap init
|
|
33
34
|
npx ai-heatmap init my-ai-heatmap
|
|
34
35
|
|
|
35
36
|
# Push data to repo
|
|
36
|
-
npx ai-heatmap push
|
|
37
|
+
npx ai-heatmap push
|
|
38
|
+
npx ai-heatmap push --repo my-ai-heatmap
|
|
37
39
|
|
|
38
40
|
# Generate + push in one step
|
|
39
|
-
npx ai-heatmap update
|
|
41
|
+
npx ai-heatmap update
|
|
42
|
+
npx ai-heatmap update --repo my-ai-heatmap
|
|
40
43
|
```
|
|
41
44
|
|
|
42
45
|
## SVG API (Vercel)
|
|
@@ -151,7 +154,7 @@ For the Vercel dynamic API, use query parameters instead (they override config).
|
|
|
151
154
|
|
|
152
155
|
```bash
|
|
153
156
|
# Generate + push in one step
|
|
154
|
-
npx ai-heatmap update
|
|
157
|
+
npx ai-heatmap update
|
|
155
158
|
|
|
156
159
|
# Or manually
|
|
157
160
|
npx ai-heatmap generate
|
|
@@ -162,7 +165,19 @@ For automated updates, use a local cron job or macOS LaunchAgent:
|
|
|
162
165
|
|
|
163
166
|
```bash
|
|
164
167
|
# crontab -e (runs daily at midnight)
|
|
165
|
-
0 0 * * *
|
|
168
|
+
0 0 * * * npx ai-heatmap update
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Upgrade
|
|
172
|
+
|
|
173
|
+
To use the latest version of ai-heatmap:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Always uses latest (npx caches, so clear if needed)
|
|
177
|
+
npx ai-heatmap@latest generate
|
|
178
|
+
|
|
179
|
+
# Clear npx cache and run
|
|
180
|
+
npx --yes ai-heatmap@latest update
|
|
166
181
|
```
|
|
167
182
|
|
|
168
183
|
## Deployment
|
package/bin/cli.mjs
CHANGED
|
@@ -24,8 +24,8 @@ Generate options:
|
|
|
24
24
|
Examples:
|
|
25
25
|
npx ai-heatmap init my-ai-heatmap
|
|
26
26
|
npx ai-heatmap generate --since 20260101
|
|
27
|
-
npx ai-heatmap push --repo
|
|
28
|
-
npx ai-heatmap update --repo
|
|
27
|
+
npx ai-heatmap push --repo my-ai-heatmap
|
|
28
|
+
npx ai-heatmap update --repo my-ai-heatmap
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
31
|
switch (command) {
|
package/bin/push.mjs
CHANGED
|
@@ -11,14 +11,18 @@ const args = process.argv.slice(2);
|
|
|
11
11
|
const repoIdx = args.indexOf("--repo");
|
|
12
12
|
let repo = repoIdx !== -1 ? args[repoIdx + 1] : null;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
try {
|
|
15
|
+
const owner = execSync("gh api user --jq .login", { encoding: "utf-8" }).trim();
|
|
16
|
+
if (!repo) {
|
|
17
17
|
repo = `${owner}/my-ai-heatmap`;
|
|
18
18
|
console.log(`No --repo specified, using default: ${repo}`);
|
|
19
|
-
}
|
|
19
|
+
} else if (!repo.includes("/")) {
|
|
20
|
+
repo = `${owner}/${repo}`;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
if (!repo || !repo.includes("/")) {
|
|
20
24
|
console.error("Usage: ai-heatmap push --repo <owner/repo>");
|
|
21
|
-
console.error("Example: ai-heatmap push --repo
|
|
25
|
+
console.error("Example: ai-heatmap push --repo <owner>/my-ai-heatmap");
|
|
22
26
|
process.exit(1);
|
|
23
27
|
}
|
|
24
28
|
}
|