Skip to content

refactor: flatten repo structure, fix CI and gitignore#1

Merged
CacinieP merged 1 commit into
mainfrom
refactor/v1.1-cleanup
May 26, 2026
Merged

refactor: flatten repo structure, fix CI and gitignore#1
CacinieP merged 1 commit into
mainfrom
refactor/v1.1-cleanup

Conversation

@CacinieP
Copy link
Copy Markdown
Owner

  • Move timekeeper/ contents to repo root (no more nested subdirectory)
  • Remove orphaned root package.json (timekeeper-260302)
  • Fix .gitignore: dist/ was indented under node_modules/ and not ignored
  • Fix CI: was running npm commands at root (wrong dir) with || true
  • Add Node 18/20/22 matrix to CI
  • Bump version to 1.1.0, add engines field
  • Rewrite README with install command, badges, and changelog

- Move timekeeper/ contents to repo root (no more nested subdirectory)
- Remove orphaned root package.json (timekeeper-260302)
- Fix .gitignore: dist/ was indented under node_modules/ and not ignored
- Fix CI: was running npm commands at root (wrong dir) with `|| true`
- Add Node 18/20/22 matrix to CI
- Bump version to 1.1.0, add engines field
- Rewrite README with install command, badges, and changelog

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@CacinieP
Copy link
Copy Markdown
Owner Author

Code Review — 10 findings (ranked by severity)

1. .gitignore 编码错误 — CRITICAL

.gitignore 是 UTF-16 LE + BOM 编码,git 无法解析(git 只支持 UTF-8)。且 dist/*.log 等模式有前导空格如 dist/,不会匹配真正的 dist/ 目录。PR diff 显示此文件为二进制变更,说明编码问题可能没有被正确修复为纯 UTF-8。后果: dist/ 编译产物仍不会被 gitignore,可能再次被提交进仓库。

建议: 将 .gitignore 转为 UTF-8 无 BOM,去掉模式前导空格。

2. 缺少 prepare 脚本 — HIGH

package.json 只有 prepublishOnly: "npm run build",没有 prepare 脚本。prepublishOnly 只在 npm publish 时运行,不在 npm install <git-url> 时运行。后果: 通过 git URL 安装的用户 dist/ 不存在,tk 命令无法执行。

建议: 添加 "prepare": "npm run build" 到 scripts。

3. README 效率评分表与代码不一致 — MEDIUM

README 写 "80-99% → 💪",但代码中 efficiency < 80 才映射到 💪,80-99% 范围落在默认分支显示 ⭐。

建议: 改 README 表格为 50-79% → 💪 稍超预估,或改代码阈值。

4. 无 estimate 时效率分默认 100 并显示 🏆 — MEDIUM

未传 --estimateefficiency 默认为 100,触发 🏆。没有预估的任务也显示"100% 🏆",误导用户。

建议: 未设置预估时跳过效率评分显示,或显示提示"未设置预估"。

5. package-lock.json 与 package.json 不一致 — MEDIUM

lockfile 手动编辑而非 npm install 重新生成。lockfile 中 bin 只有一个 entry (cace-timer),package.json 有两个 (tk + cace-timer)。

建议: 删除 lockfile 后重新 npm install 生成。

6. options.limit || 10 falsy-zero bug — LOW

--limit 00 || 10 结果为 10,用户期望 0 条记录却看到 10 条。

建议: 改为 options.limit ?? 10Number(options.limit) || 10

7. parseInt("--estimate abc") 返回 NaN — LOW

--estimate abcparseInt("abc") → NaN → 效率分默认 100 → 显示 🏆。

建议: 解析前验证是否为有效数字。

8. CI 无测试步骤 — LOW

CI 和 package.json 都没有 test 脚本,运行时错误可通过 CI。

建议: 添加 "test": "node dist/index.js help" 作为基本冒烟测试,CI 加上 npm test 步骤。

9. 缺少 types 字段 — LOW

tsconfig 有 declaration: true 但 package.json 没有 types 字段指向 dist/index.d.ts

建议: 添加 "types": "dist/index.d.ts"

10. README 大量内容丢失 — INFO

旧中文 README (333行) 有卸载指南、平台同步路径(Windows OneDrive)、数据格式、mascot 超开心帧等,新英文 README (147行) 全部缺失。

建议: 补充关键内容(至少卸载说明和 Windows 同步路径)。

@CacinieP CacinieP merged commit e918ab7 into main May 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant