ai-heatmap 1.17.9 → 1.17.11
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 +7 -7
- package/bin/cli.mjs +12 -7
- package/bin/init.mjs +3 -3
- package/package.json +1 -1
- package/scripts/generate.mjs +1 -1
package/README.md
CHANGED
|
@@ -20,14 +20,14 @@ gh auth login
|
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# npx --yes ai-heatmap@latest delete
|
|
23
|
-
npx clear-npx-cache && npx --yes ai-heatmap@latest init
|
|
23
|
+
npx --yes clear-npx-cache && npx --yes ai-heatmap@latest init
|
|
24
24
|
|
|
25
25
|
USER=$(gh api user -q .login)
|
|
26
26
|
open "https://${USER}.github.io/${USER}-ai-heatmap/heatmap.svg"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npx clear-npx-cache && npx --yes ai-heatmap@latest deploy
|
|
30
|
+
npx --yes clear-npx-cache && npx --yes ai-heatmap@latest deploy
|
|
31
31
|
|
|
32
32
|
USER=$(gh api user -q .login)
|
|
33
33
|
open "https://${USER}-ai-heatmap.vercel.app/api/heatmap?colorScheme=dark"
|
|
@@ -187,7 +187,7 @@ For automated updates, use a local cron job or macOS LaunchAgent:
|
|
|
187
187
|
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-xxx
|
|
188
188
|
GH_TOKEN=ghp_xxx
|
|
189
189
|
|
|
190
|
-
0 0 * * * npx clear-npx-cache && npx --yes ai-heatmap@latest update
|
|
190
|
+
0 0 * * * npx --yes clear-npx-cache && npx --yes ai-heatmap@latest update
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
> **`npx: not found`?** cron uses a minimal PATH. Fix with:
|
|
@@ -196,7 +196,7 @@ GH_TOKEN=ghp_xxx
|
|
|
196
196
|
> which npx # e.g. /home/user/.local/bin/npx
|
|
197
197
|
>
|
|
198
198
|
> # Use full path in cron
|
|
199
|
-
> 0 0 * * * PATH=$HOME/.local/bin:$PATH npx clear-npx-cache && PATH=$HOME/.local/bin:$PATH npx --yes ai-heatmap@latest update
|
|
199
|
+
> 0 0 * * * PATH=$HOME/.local/bin:$PATH npx --yes clear-npx-cache && PATH=$HOME/.local/bin:$PATH npx --yes ai-heatmap@latest update
|
|
200
200
|
> ```
|
|
201
201
|
|
|
202
202
|
## Upgrade
|
|
@@ -204,12 +204,12 @@ GH_TOKEN=ghp_xxx
|
|
|
204
204
|
To use the latest version of ai-heatmap:
|
|
205
205
|
|
|
206
206
|
```bash
|
|
207
|
-
npx clear-npx-cache && npx --yes ai-heatmap@latest update
|
|
207
|
+
npx --yes clear-npx-cache && npx --yes ai-heatmap@latest update
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
> **Still running an old version?** npx caches packages locally. If the update command behaves unexpectedly after a release, clear the cache:
|
|
211
211
|
> ```bash
|
|
212
|
-
> npx clear-npx-cache
|
|
212
|
+
> npx --yes clear-npx-cache
|
|
213
213
|
> npx --yes ai-heatmap@latest update
|
|
214
214
|
> ```
|
|
215
215
|
|
|
@@ -228,7 +228,7 @@ npm publish
|
|
|
228
228
|
### Vercel (SVG API)
|
|
229
229
|
|
|
230
230
|
```bash
|
|
231
|
-
npx clear-npx-cache && npx --yes ai-heatmap@latest deploy
|
|
231
|
+
npx --yes clear-npx-cache && npx --yes ai-heatmap@latest deploy
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
Or manually:
|
package/bin/cli.mjs
CHANGED
|
@@ -127,16 +127,21 @@ switch (command) {
|
|
|
127
127
|
// 1. GitHub API로 다른 컴퓨터의 data-*.json 파일들을 로컬에 다운로드
|
|
128
128
|
console.log(`Fetching machine data files from ${repo}...`);
|
|
129
129
|
mkdirSync(outDir, { recursive: true });
|
|
130
|
+
let remoteFiles = [];
|
|
130
131
|
try {
|
|
131
132
|
const raw = execSync(
|
|
132
133
|
`gh api repos/${repo}/contents/public --jq '[.[] | select(.name | test("^data-.+\\.json$"))]'`,
|
|
133
134
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"] },
|
|
134
135
|
);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
remoteFiles = JSON.parse(raw);
|
|
137
|
+
} catch {
|
|
138
|
+
console.log(" No existing machine data files found (first run).");
|
|
139
|
+
}
|
|
140
|
+
for (const file of remoteFiles) {
|
|
141
|
+
// 현재 컴퓨터 파일은 generate에서 새로 생성하므로 건너뜀
|
|
142
|
+
if (file.name === `data-${machineName}.json`) continue;
|
|
143
|
+
// 디렉토리 목록 API는 content를 포함하지 않으므로 파일별로 개별 fetch
|
|
144
|
+
try {
|
|
140
145
|
const content = execSync(
|
|
141
146
|
`gh api repos/${repo}/contents/${file.path} --jq .content`,
|
|
142
147
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"] },
|
|
@@ -144,9 +149,9 @@ switch (command) {
|
|
|
144
149
|
const decoded = Buffer.from(content.replace(/\n/g, ""), "base64").toString("utf-8");
|
|
145
150
|
writeFileSync(resolve(outDir, file.name), decoded);
|
|
146
151
|
console.log(` Fetched ${file.name}`);
|
|
152
|
+
} catch {
|
|
153
|
+
console.log(` Failed to fetch ${file.name}, skipping.`);
|
|
147
154
|
}
|
|
148
|
-
} catch {
|
|
149
|
-
console.log(" No existing machine data files found (first run).");
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
// 2. generate: 이 컴퓨터 데이터 수집 + 모든 data-*.json 합산 → data.json 생성
|
package/bin/init.mjs
CHANGED
|
@@ -123,7 +123,7 @@ readmeLines.push(
|
|
|
123
123
|
"## Usage",
|
|
124
124
|
"",
|
|
125
125
|
"```bash",
|
|
126
|
-
"npx clear-npx-cache && npx --yes ai-heatmap@latest update",
|
|
126
|
+
"npx --yes clear-npx-cache && npx --yes ai-heatmap@latest update",
|
|
127
127
|
"```",
|
|
128
128
|
"",
|
|
129
129
|
"### Cron (daily update)",
|
|
@@ -132,7 +132,7 @@ readmeLines.push(
|
|
|
132
132
|
"CLAUDE_CODE_OAUTH_TOKEN=sk-ant-xxx",
|
|
133
133
|
"GH_TOKEN=ghp_xxx",
|
|
134
134
|
"",
|
|
135
|
-
"0 0 * * * npx clear-npx-cache && npx --yes ai-heatmap@latest update",
|
|
135
|
+
"0 0 * * * npx --yes clear-npx-cache && npx --yes ai-heatmap@latest update",
|
|
136
136
|
"```",
|
|
137
137
|
"",
|
|
138
138
|
`## [Dynamic SVG (by Vercel)](https://${repoName}.vercel.app/)`,
|
|
@@ -140,7 +140,7 @@ readmeLines.push(
|
|
|
140
140
|
``,
|
|
141
141
|
"",
|
|
142
142
|
"```bash",
|
|
143
|
-
"npx clear-npx-cache && npx --yes ai-heatmap@latest deploy",
|
|
143
|
+
"npx --yes clear-npx-cache && npx --yes ai-heatmap@latest deploy",
|
|
144
144
|
"```",
|
|
145
145
|
"",
|
|
146
146
|
);
|
package/package.json
CHANGED
package/scripts/generate.mjs
CHANGED
|
@@ -66,7 +66,7 @@ if (!mergeOnly) {
|
|
|
66
66
|
if (err.code === "ETIMEDOUT" || err.signal === "SIGTERM") {
|
|
67
67
|
console.error("\nError: ccusage timed out after 5 minutes.");
|
|
68
68
|
console.error("This may be caused by a slow network or npm registry issue.");
|
|
69
|
-
console.error("Try running manually: npx clear-npx-cache && npx --yes ccusage@latest daily --json");
|
|
69
|
+
console.error("Try running manually: npx --yes clear-npx-cache && npx --yes ccusage@latest daily --json");
|
|
70
70
|
} else {
|
|
71
71
|
console.error("\nError running ccusage:", err.message);
|
|
72
72
|
if (err.stderr) console.error(err.stderr);
|