ai-heatmap 1.17.0 → 1.17.2

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/bin/cli.mjs CHANGED
@@ -136,7 +136,12 @@ switch (command) {
136
136
  for (const file of files) {
137
137
  // 현재 컴퓨터 파일은 generate에서 새로 생성하므로 건너뜀
138
138
  if (file.name === `data-${machineName}.json`) continue;
139
- const decoded = Buffer.from(file.content.replace(/\n/g, ""), "base64").toString("utf-8");
139
+ // 디렉토리 목록 API는 content 포함하지 않으므로 파일별로 개별 fetch
140
+ const content = execSync(
141
+ `gh api repos/${repo}/contents/${file.path} --jq .content`,
142
+ { encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"] },
143
+ ).trim();
144
+ const decoded = Buffer.from(content.replace(/\n/g, ""), "base64").toString("utf-8");
140
145
  writeFileSync(resolve(outDir, file.name), decoded);
141
146
  console.log(` Fetched ${file.name}`);
142
147
  }
@@ -145,7 +150,11 @@ switch (command) {
145
150
  }
146
151
 
147
152
  // 2. generate: 이 컴퓨터 데이터 수집 + 모든 data-*.json 합산 → data.json 생성
148
- execSync(`node ${genScript} ${genArgs.join(" ")}`, { stdio: "inherit" });
153
+ // machineName을 명시적으로 전달해 cli.mjs와 generate.mjs가 동일한 값을 사용하도록 보장
154
+ const genArgsWithName = genArgs.some((a) => a.startsWith("--name="))
155
+ ? genArgs
156
+ : [`--name=${machineName}`, ...genArgs];
157
+ execSync(`node ${genScript} ${genArgsWithName.join(" ")}`, { stdio: "inherit" });
149
158
 
150
159
  // 3. data-{name}.json push (이 컴퓨터 개별 파일)
151
160
  const machineFile = `data-${machineName}.json`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-heatmap",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "AI usage cost heatmap powered by ccusage + react-activity-calendar",
5
5
  "type": "module",
6
6
  "bin": {
@@ -74,7 +74,7 @@ if (!mergeOnly) {
74
74
  for (let i = 364; i >= 0; i--) {
75
75
  const d = new Date(today);
76
76
  d.setDate(d.getDate() - i);
77
- const date = d.toISOString().slice(0, 10);
77
+ const date = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
78
78
  const entry = dataMap.get(date);
79
79
  if (entry) {
80
80
  const cacheReadTokens = entry.cacheReadTokens ?? 0;