month-log-summarylisted
Install: claude install-skill fongzhizhi/claude-skill-lab
# month-log-summary
为 month-log 格式的月工作日志(`logs/YYYY/YYYY-MM.md`)补写一个「AI月总结」章节,把月文档扩展为"人工 + 脚本 + AI"三合一:人工填记录、脚本算数据、AI 组织叙述,直接可作公司月总结汇报。
## 确定目标文档(按优先级,三选一)
### 方式 A:用户显式给了文件路径
直接用该路径(绝对/相对均可)。进入「校验」。
### 方式 B:用户只说了月份("上个月"、"7 月"、"2026-07")
先定位仓库,再解析月份 → `logs/<年份>/<YYYY-MM>.md`。
月份解析规则(基于"归属月",见方式 C):
- "当月 / 这月" → 归属月
- "上个月 / 上月" → 归属月的上一个月
- "X 月" / "YYYY-MM" / 年份+月份 → 直接解析
### 方式 C:什么都没说
默认月 = **今天所在周的归属月**(与 month-log `init` 的跨月周归属一致:周一~周日按各月占用天数判定,平分归周一所在月)。Windows / Git Bash 下运行:
```bash
node -e 'const d=new Date();const day=(d.getDay()+6)%7;const mon=new Date(d);mon.setDate(d.getDate()-day);let y=mon.getFullYear(),m=mon.getMonth()+1,days=0;const end=new Date(mon);end.setDate(mon.getDate()+6);while(mon<=end){if(mon.getMonth()+1===m)days++;mon.setDate(mon.getDate()+1)};const r=days>=4?String(y)+"-"+String(m).padStart(2,"0"):String(end.getFullYear())+"-"+String(end.getMonth()+1).padStart(2,"0");console.log(r)'
```
(示例:2026-08-31 是周一,该周 8 月仅占 1 天 → 归属月为 2026-09。)
### 定位仓库(方式 B/C 需要)
month-log 仓库通常已通过 `npm run link` 注册为全局命令 `month-log`。通过全局安装位置反查仓库真实路径(npm link 的全局模块是指向仓库的链接,realpath 解析):
```bash
node -e 'const{realpathSync}=require("fs"),p=require("path");try{const g=require("child_process").execSync("npm root -g",{encoding:"utf8"}).trim();console.log(realpathSync(p.join(g,"month-log")))}catch(e){process.exit(1)}'
```
- 输出为仓库根目录(如 `D:\MyWorking\github\month-log`),目标文档 = `<仓库根>/logs/<年份>/<YYYY-MM>.md`。
- 命令失败(未 link 或路径异常):直接询问用户文档地址,并可提示先 `npm run link` 注册