codex-work-receipt 0.7.3 → 0.7.4

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/CHANGELOG.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.4
4
+
5
+ - 修复部分 bug。
6
+
3
7
  ## 0.7.3
4
8
 
5
9
  - Codex 会话日志改为分块逐行解析,避免超大 `.jsonl` 在转成单个 JavaScript 字符串时触发 V8 长度上限。
6
10
  - 会话行解析后立即丢弃 Prompt、回复、图片和工具输出,只在内存中保留统计所需的时间、事件、模型与 Token 字段。
7
11
  - 单行异常过大时带文件路径和行号跳过;文件读取失败时补充路径与体积,便于定位具体日志。
8
12
  - 本地 `history.jsonl` 改为逐条写入,避免历史增长后形成同类的大字符串拼接风险。
9
- - 小票生成或票仔安装成功后在终端展示开源仓库地址,并用对应的中英文文案邀请用户为项目点 Star。
10
- - 修正 npm 包的 repository、homepage 和 issues 地址,使其统一指向 `a-bai-2026/codex-work-receipt`。
11
13
 
12
14
  ## 0.7.2
13
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-work-receipt",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "type": "module",
5
5
  "description": "Generate a privacy-first Codex work receipt from local session metadata.",
6
6
  "author": "a-bai-2026",
@@ -23,6 +23,11 @@ const PROMPTS = {
23
23
  },
24
24
  };
25
25
 
26
+ const HTML_STAR_LABELS = {
27
+ "zh-CN": "喜欢这个工具?点个 Star ⭐",
28
+ en: "Enjoying it? Star on GitHub ⭐",
29
+ };
30
+
26
31
  export function getOpenSourcePrompt(kind = "receipt", locale = "zh-CN") {
27
32
  const normalizedLocale = locale === "en" ? "en" : "zh-CN";
28
33
  const localized = PROMPTS[normalizedLocale];
@@ -35,6 +40,14 @@ export function getOpenSourcePrompt(kind = "receipt", locale = "zh-CN") {
35
40
  };
36
41
  }
37
42
 
43
+ export function getHtmlStarPrompt(locale = "zh-CN") {
44
+ const normalizedLocale = locale === "en" ? "en" : "zh-CN";
45
+ return {
46
+ url: OPEN_SOURCE_REPOSITORY_URL,
47
+ label: HTML_STAR_LABELS[normalizedLocale],
48
+ };
49
+ }
50
+
38
51
  export function printOpenSourcePrompt(kind, locale, writeLine = console.log) {
39
52
  const prompt = getOpenSourcePrompt(kind, locale);
40
53
  writeLine("");
@@ -10,6 +10,7 @@ import {
10
10
  getRollingSummaryNotice,
11
11
  getScopeLabel,
12
12
  } from "../core/presentation.mjs";
13
+ import { getHtmlStarPrompt } from "../core/open-source.mjs";
13
14
 
14
15
  const require = createRequire(import.meta.url);
15
16
  const DOM_TO_IMAGE_SOURCE = fs.readFileSync(require.resolve("dom-to-image-more"), "utf8");
@@ -63,6 +64,7 @@ function formatCopy(template, values) {
63
64
  export function renderHtml({ record, dataQrDataUrl = null, dataQrDataUrls = null, miniProgramCodeDataUrl = null }) {
64
65
  const locale = record.locale || DEFAULT_LOCALE;
65
66
  const copy = getReceiptCopy(locale);
67
+ const githubStarPrompt = getHtmlStarPrompt(locale);
66
68
  const startAt = new Date(record.period.start_at);
67
69
  const endAt = new Date(record.period.end_at);
68
70
  const timezone = record.period.timezone;
@@ -233,10 +235,34 @@ export function renderHtml({ record, dataQrDataUrl = null, dataQrDataUrls = null
233
235
  }
234
236
  .toolbar {
235
237
  display: grid;
238
+ width: 100%;
236
239
  justify-items: center;
237
240
  gap: 12px;
238
241
  margin-bottom: 22px;
239
242
  }
243
+ .github-star-link {
244
+ display: inline-flex;
245
+ justify-self: end;
246
+ align-items: center;
247
+ min-height: 32px;
248
+ padding: 7px 11px;
249
+ border: 1px solid color-mix(in srgb, var(--ink) 38%, transparent);
250
+ border-radius: 999px;
251
+ background: color-mix(in srgb, var(--paper) 78%, transparent);
252
+ color: var(--ink);
253
+ font-size: 11px;
254
+ font-weight: 700;
255
+ line-height: 1.35;
256
+ text-decoration: none;
257
+ transition: background .15s ease, color .15s ease, transform .15s ease;
258
+ }
259
+ .github-star-link:hover,
260
+ .github-star-link:focus-visible {
261
+ background: var(--ink);
262
+ color: var(--paper);
263
+ transform: translateY(-1px);
264
+ }
265
+ .github-star-link:active { transform: translateY(0); }
240
266
  .theme-switcher {
241
267
  display: flex;
242
268
  flex-wrap: wrap;
@@ -515,6 +541,7 @@ export function renderHtml({ record, dataQrDataUrl = null, dataQrDataUrls = null
515
541
  }
516
542
  @media (max-width: 420px) {
517
543
  .page { padding-inline: 10px; }
544
+ .github-star-link { justify-self: center; text-align: center; }
518
545
  .receipt { padding-inline: 20px; }
519
546
  .meta { grid-template-columns: 1fr; }
520
547
  .meta div:nth-child(even) { text-align: left; }
@@ -525,6 +552,7 @@ export function renderHtml({ record, dataQrDataUrl = null, dataQrDataUrls = null
525
552
  <body>
526
553
  <main class="page">
527
554
  <div class="toolbar">
555
+ <a class="github-star-link" href="${escapeHtml(githubStarPrompt.url)}" target="_blank" rel="noopener noreferrer">${escapeHtml(githubStarPrompt.label)}</a>
528
556
  <nav class="theme-switcher" aria-label="${escapeHtml(copy.themeAria)}">
529
557
  <button class="theme-button" type="button" data-theme-value="classic">${escapeHtml(copy.themes.classic)}</button>
530
558
  <button class="theme-button" type="button" data-theme-value="diner">${escapeHtml(copy.themes.diner)}</button>