ai-heatmap 1.17.10 → 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.
Files changed (2) hide show
  1. package/bin/cli.mjs +12 -7
  2. package/package.json +1 -1
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
- const files = JSON.parse(raw);
136
- for (const file of files) {
137
- // 현재 컴퓨터 파일은 generate에서 새로 생성하므로 건너뜀
138
- if (file.name === `data-${machineName}.json`) continue;
139
- // 디렉토리 목록 API는 content를 포함하지 않으므로 파일별로 개별 fetch
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-heatmap",
3
- "version": "1.17.10",
3
+ "version": "1.17.11",
4
4
  "description": "AI usage cost heatmap powered by ccusage + react-activity-calendar",
5
5
  "type": "module",
6
6
  "bin": {