---
name: weekly-report
description: 生成周报，根据 Git 记录汇总，支持自定义存储路径。
---

# 📊 周报生成工作流 (/weekly-report)

> **简化用法**：`/briefing --weekly` 在标准简报中追加周报内容。
> 仅在需要**单独生成完整周报文件**时使用此 workflow。

当你需要生成开发周报时，执行此流程：

## 1. 核心参数获取

- **日期区间**: 请告诉我你要生成的日期范围（例如：`1.24-1.31`）。
- **自定义路径**: (可选) 如果你想存到特定文件夹，请提供路径（默认存储在 `~/.agent/reports/`）。

## 2. 数据采集与处理

- **Git 日志读取**:
  - 我将根据输入的日期（默认为今年），自动执行 `git log --since="YYYY-MM-DD" --until="YYYY-MM-DD"`。
- **信息脱敏**: 自动移除 Commit Hash 和邮箱，保留作者、日期和提交信息。

## 3. 内容生成

- **智能分类**:
  - 🚀 **新功能 (Features)**
  - 🐛 **问题修复 (Fixes)**
  - 🔧 **维护与构建 (Chore/Build)**
- **价值提炼**: 对凌乱的提交记录进行一句话总结。

## 4. 存储与归档

// turbo

- **文件检查**: 如果指定的文件夹不存在，我会自动创建它。
- **保存路径**:
  - 项目名称：从 `package.json` 或目录名提取。
  - 文件名格式：`weekly-report_[项目名]_[日期].md`。
- **持久化**: 写入文件并提供完整路径。

## 5. 提示

> 此周报存储在全局目录下的 `reports` 文件夹，方便跨项目管理。

---

## 6. Activity-first Evidence Contract

Before reading Git or filesystem timestamps, discover the project query contract and request the inclusive activity projection:

```bash
cortex-agent help query --json --project .
cortex-agent query activity --project . --since <start> --until <end>
```

Classify the result explicitly:

- non-empty activity: generate the report from structured Task, Run, Decision, validation, and delivery facts;
- empty / 为空: report that the query succeeded and returned no structured activity in the interval;
- unavailable: record the diagnostic, then use `direct-state-fallback` and label the lower-confidence source.

`direct-state-fallback` may inspect project-local Task/Run/Decision records, then Git history, and finally file `mtime`. Git and `mtime` are reconciliation evidence only: they must not invent approval, validation PASS, or task completion. Do not rewrite historical reports while collecting evidence.
