feat: 每日积分模式与 Bark 完成提醒

- 按课时类型计分:文档 1 / 视频 3 / 音频 2 / 微课 2,每次 3 分,单日封顶 24 分;满额换类,无内容即停
- 积分计数落 localStorage,跨刷新/重启保留、跨天清零;面板与无头 TUI 都显示今日积分
- 运行器自己收尾时通过 Bark 推送今日积分、完成门数、用时和结束原因;手动停止与 --check 不推送
- 新增 --points-mode / --bark-* 参数及对应 YUN_XUE_TANG_* 环境变量
- 补充 points / notify 离线回归测试与 OpenSpec 配置

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
voidandClaude Sonnet 4.6 committed 2026-11-01 22:19:52 +08:00
1 parent 17217dbeb1
commit 0eb4c40629
31 files changed
+2954 -21

No files matched your search

+6
View File
@@ -181,6 +181,7 @@ export function createTui(opts = {}) {
studySeconds: 0, // 学习时长:只累加视频真正在播的时间
creditEarned: 0, // 获得学分:只算本次运行里完成(刷完)的课程
credit: null, // 当前课程可得多少学分(平台只在播放期间写在倒计时文案里)
points: null, // 每日积分:{ enabled, total, max, progress, text }
injected: 0,
logFile: opts.logFile || '',
startedAt: Date.now(),
@@ -296,6 +297,10 @@ export function createTui(opts = {}) {
const parts = [C.cyan('已学 ' + formatDuration(state.studySeconds))];
parts.push(C.green('学分 ' + study.creditText(state.creditEarned)));
const used = () => textWidth(parts.join(' · '));
if (state.points && state.points.enabled) {
const p = '积分 ' + state.points.total + '/' + state.points.max;
if (used() + 3 + textWidth(p) <= width) parts.push(C.cyan(p));
}
if (state.credit != null) {
const now = '本门 ' + study.creditText(state.credit);
if (used() + 3 + textWidth(now) <= width) parts.push(now);
@@ -529,6 +534,7 @@ export function createTui(opts = {}) {
state.studySeconds = st.studySeconds;
state.creditEarned = st.creditEarned;
state.credit = st.credit;
state.points = s.points || null;
state.course = pick(s.course, '');
state.lesson = pick(s.lesson, '');