Skill: jiahui220/feishu-weekly-generator (version 1.0.0)

--- name: feishu-weekly-generator description: Generate professional weekly work reports for Feishu/Lark users. Automatically collect work data from various sources and create formatted weekly reports compatible with Feishu document format. Use when user needs to create weekly work reports, summarize weekly achievements, or export weekly progress to Feishu docs. metadata: openclaw: emoji: 📝 --- # Feishu Weekly Report Generator Generate professional weekly work reports for Feishu users. ## Features - **Automatic Data Collection**: Gather work data from git commits, calendar events, task completions - **AI-Powered Summary**: Generate professional weekly summaries using AI - **Feishu Compatible**: Output in Feishu document format (markdown) - **Customizable Templates**: Multiple report styles available ## Quick Start ### Generate Weekly Report ```bash node scripts/generate-weekly.mjs ``` ### With Options ```bash # Specify date range node scripts/generate-weekly.mjs --start 2026-03-10 --end 2026-03-14 # Specify output file node scripts/generate-weekly.mjs --output my-weekly-report.md # Include git commits node scripts/generate-weekly.mjs --git ~/my-project # Full options node scripts/generate-weekly.mjs --start 2026-03-10 --end 2026-03-14 --git ~/projects --output weekly.md ``` ## Report Structure The generated report includes: 1. **本周工作总结** - Summary of week's work 2. **已完成工作** - Completed tasks with details 3. **进行中工作** - Work in progress 4. **下周计划** - Next week's plan 5. **遇到的问题** - Issues and blockers 6. **需要的支持** - Support needed ## Templates Available templates in `references/templates/`: - `standard.md` - Standard weekly report format - `detailed.md` - Detailed format with more sections - `minimal.md` - Minimal format for quick reports ## Feishu Integration After generating the report: 1. Copy the markdown content 2. Paste into Feishu document 3. Format will be preserved Or use Feishu API to directly create document (requires Feishu bot token). ## Options | Option | Description | Default | |--------|-------------|---------| | `--start` | Start date (YYYY-MM-DD) | Last Monday | | `--end` | End date (YYYY-MM-DD) | Last Friday | | `--git` | Git repository path | None | | `--template` | Template to use | standard | | `--output` | Output file path | weekly-report-YYYY-MM-DD.md | | `--name` | User name | Git user.name or 'User' | | `--department` | Department name | Optional | ## Examples ### Basic Usage ```bash node scripts/generate-weekly.mjs ``` ### With Git Integration ```bash node scripts/generate-weekly.mjs --git ~/projects/my-app --name "张三" --department "技术部" ``` ### Custom Date Range ```bash node scripts/generate-weekly.mjs --start 2026-03-01 --end 2026-03-07 --output march-week1.md ```

path: package.json
content: {
  "name": "feishu-weekly-generator",
  "version": "1.0.0",
  "description": "Generate professional weekly work reports for Feishu/Lark users",
  "main": "scripts/generate-weekly.mjs",
  "type": "module",
  "scripts": {
    "generate": "node scripts/generate-weekly.mjs"
  },
  "keywords": [
    "feishu",
    "lark",
    "weekly-report",
    "work-report",
    "automation"
  ],
  "author": "摸鱼大总管",
  "license": "MIT",
  "engines": {
    "node": ">=18.0.0"
  }
}


path: references/templates/detailed.md
content: # {{name}} - 周报 ({{start}} ~ {{end}})

**汇报人**: {{name}}{{department}}
**汇报周期**: {{start}} ~ {{end}}
**生成时间**: {{generatedAt}}

---

## 一、本周工作总结

{{summary}}

### 关键指标

| 指标 | 数值 | 环比 |
|------|------|------|
| 代码提交 | {{commitCount}} | - |
| 完成任务 | {{taskCount}} | - |
| 工作时长 | {{workHours}}h | - |

---

## 二、详细工作记录

### 2.1 已完成工作

{{completed}}

### 2.2 进行中工作

{{inProgress}}

### 2.3 代码提交明细

{{commitDetails}}

---

## 三、项目进展

{{projectProgress}}

---

## 四、技术分享与学习

{{learning}}

---

## 五、下周计划

{{nextWeek}}

---

## 六、遇到的问题与风险

{{issues}}

### 解决方案

{{solutions}}

---

## 七、需要的支持

{{support}}

---

## 八、其他事项

{{others}}

---

*Generated by Feishu Weekly Report Generator*


path: references/templates/minimal.md
content: # {{name}} - 周报 ({{start}} ~ {{end}})

**汇报人**: {{name}}{{department}}

---

## 本周工作

{{completed}}

## 下周计划

{{nextWeek}}

---

*Generated by Feishu Weekly Report Generator*


path: references/templates/standard.md
content: # {{name}} - 周报 ({{start}} ~ {{end}})

**汇报人**: {{name}}{{department}}
**汇报周期**: {{start}} ~ {{end}}

---

## 一、本周工作总结

{{summary}}

---

## 二、已完成工作

{{completed}}

---

## 三、进行中工作

{{inProgress}}

---

## 四、下周计划

{{nextWeek}}

---

## 五、遇到的问题与风险

{{issues}}

---

## 六、需要的支持

{{support}}

---

*Generated by Feishu Weekly Report Generator*


path: scripts/generate-weekly.mjs
content: #!/usr/bin/env node
/**
 * Feishu Weekly Report Generator
 * Generates professional weekly work reports
 */

import { execSync } from 'child_process';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));

// Parse command line arguments
function parseArgs() {
  const args = process.argv.slice(2);
  const options = {
    start: getLastMonday(),
    end: getLastFriday(),
    git: null,
    template: 'standard',
    output: null,
    name: null,
    department: null
  };

  for (let i = 0; i < args.length; i++) {
    const arg = args[i];
    switch (arg) {
      case '--start':
        options.start = args[++i];
        break;
      case '--end':
        options.end = args[++i];
        break;
      case '--git':
        options.git = args[++i];
        break;
      case '--template':
        options.template = args[++i];
        break;
      case '--output':
        options.output = args[++i];
        break;
      case '--name':
        options.name = args[++i];
        break;
      case '--department':
        options.department = args[++i];
        break;
      case '--help':
      case '-h':
        showHelp();
        process.exit(0);
        break;
    }
  }

  // Set default output filename
  if (!options.output) {
    options.output = `weekly-report-${options.end}.md`;
  }

  // Get user name from git if not provided
  if (!options.name) {
    try {
      options.name = execSync('git config user.name', { encoding: 'utf8' }).trim();
    } catch {
      options.name = '用户';
    }
  }

  return options;
}

function showHelp() {
  console.log(`
Feishu Weekly Report Generator

Usage: node generate-weekly.mjs [options]

Options:
  --start <date>      Start date (YYYY-MM-DD), default: last Monday
  --end <date>        End date (YYYY-MM-DD), default: last Friday
  --git <path>        Git repository path to collect commits
  --template <name>   Template name (standard|detailed|minimal), default: standard
  --output <path>     Output file path
  --name <name>       User name
  --department <dept> Department name
  --help, -h          Show this help

Examples:
  node generate-weekly.mjs
  node generate-weekly.mjs --git ~/my-project --name "张三"
  node generate-weekly.mjs --start 2026-03-10 --end 2026-03-14
`);
}

function getLastMonday() {
  const now = new Date();
  const day = now.getDay();
  const diff = now.getDate() - day + (day === 0 ? -6 : 1);
  const monday = new Date(now.setDate(diff));
  return formatDate(monday);
}

function getLastFriday() {
  const now = new Date();
  const day = now.getDay();
  const diff = now.getDate() - day + (day === 0 ? -2 : 5);
  const friday = new Date(now.setDate(diff));
  return formatDate(friday);
}

function formatDate(date) {
  return date.toISOString().split('T')[0];
}

function getWeekDates(start, end) {
  const dates = [];
  const startDate = new Date(start);
  const endDate = new Date(end);
  
  for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
    dates.push(formatDate(new Date(d)));
  }
  return dates;
}

function getWeekdayName(dateStr) {
  const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  const date = new Date(dateStr);
  return days[date.getDay()];
}

// Collect git commits
function collectGitCommits(gitPath, since, until) {
  if (!gitPath || !existsSync(gitPath)) {
    return [];
  }

  try {
    const format = '%H|%s|%ad';
    const output = execSync(
      `git -C "${gitPath}" log --since="${since} 00:00:00" --until="${until} 23:59:59" --format="${format}" --date=short`,
      { encoding: 'utf8', cwd: gitPath }
    );

    return output.trim().split('\n').filter(line => line).map(line => {
      const [hash, message, date] = line.split('|');
      return { hash: hash.slice(0, 7), message, date };
    });
  } catch (error) {
    console.warn('Warning: Could not collect git commits:', error.message);
    return [];
  }
}

// Load template
function loadTemplate(templateName) {
  const templatePath = resolve(__dirname, '../references/templates', `${templateName}.md`);
  
  if (existsSync(templatePath)) {
    return readFileSync(templatePath, 'utf8');
  }

  // Default template
  return `# {{name}} - 周报 ({{start}} ~ {{end}})

**汇报人**: {{name}}{{department}}
**汇报周期**: {{start}} ~ {{end}}

---

## 一、本周工作总结

本周主要完成了以下工作：

{{summary}}

---

## 二、已完成工作

{{completed}}

---

## 三、进行中工作

{{inProgress}}

---

## 四、下周计划

{{nextWeek}}

---

## 五、遇到的问题与风险

{{issues}}

---

## 六、需要的支持

{{support}}

---

*Generated by Feishu Weekly Report Generator*
`;
}

// Generate report content
function generateReport(options) {
  const weekDates = getWeekDates(options.start, options.end);
  const commits = options.git ? collectGitCommits(options.git, options.start, options.end) : [];

  // Build completed work section
  let completedWork = '';
  if (commits.length > 0) {
    completedWork += '### 代码提交\n\n';
    commits.forEach(commit => {
      completedWork += `- ${commit.date} ${commit.message}\n`;
    });
    completedWork += '\n';
  }
  completedWork += `- 完成项目相关开发任务\n- 参与团队技术讨论\n- 处理日常开发工作\n`;

  // Build summary based on commits
  let summary = '';
  if (commits.length > 0) {
    const categories = categorizeCommits(commits);
    summary = `本周共计提交代码 ${commits.length} 次，主要工作包括：`;
    if (categories.feature > 0) summary += ` 新增功能 ${categories.feature} 项，`;
    if (categories.fix > 0) summary += ` 修复问题 ${categories.fix} 个，`;
    if (categories.docs > 0) summary += ` 文档更新 ${categories.docs} 次，`;
    summary = summary.replace(/，$/, '。');
  } else {
    summary = '本周按计划完成了各项工作任务，项目进展顺利。';
  }

  // Build weekday sections
  let dailyWork = '';
  weekDates.forEach(date => {
    const weekday = getWeekdayName(date);
    const dayCommits = commits.filter(c => c.date === date);
    
    dailyWork += `### ${weekday} (${date})\n\n`;
    if (dayCommits.length > 0) {
      dayCommits.forEach(c => {
        dailyWork += `- ${c.message}\n`;
      });
    } else {
      dailyWork += `- 日常工作处理\n`;
    }
    dailyWork += '\n';
  });

  const template = loadTemplate(options.template);
  
  return template
    .replace(/{{name}}/g, options.name)
    .replace(/{{department}}/g, options.department ? ` | ${options.department}` : '')
    .replace(/{{start}}/g, options.start)
    .replace(/{{end}}/g, options.end)
    .replace(/{{summary}}/g, summary)
    .replace(/{{completed}}/g, completedWork)
    .replace(/{{inProgress}}/g, dailyWork)
    .replace(/{{nextWeek}}/g, `- 继续推进项目开发\n- 完成本周遗留任务\n- 准备下周迭代计划`)
    .replace(/{{issues}}/g, '- 暂无重大问题\n- 项目整体进展正常')
    .replace(/{{support}}/g, '- 暂无特殊支持需求');
}

function categorizeCommits(commits) {
  const categories = { feature: 0, fix: 0, docs: 0, other: 0 };
  
  commits.forEach(commit => {
    const msg = commit.message.toLowerCase();
    if (msg.includes('feat') || msg.includes('add') || msg.includes('new')) {
      categories.feature++;
    } else if (msg.includes('fix') || msg.includes('bug') || msg.includes('修复')) {
      categories.fix++;
    } else if (msg.includes('doc') || msg.includes('文档')) {
      categories.docs++;
    } else {
      categories.other++;
    }
  });
  
  return categories;
}

// Main
async function main() {
  try {
    const options = parseArgs();
    
    console.log('📝 Generating weekly report...');
    console.log(`   Period: ${options.start} ~ ${options.end}`);
    console.log(`   User: ${options.name}`);
    if (options.git) console.log(`   Git: ${options.git}`);
    
    const report = generateReport(options);
    
    writeFileSync(options.output, report, 'utf8');
    
    console.log('\n✅ Weekly report generated successfully!');
    console.log(`   Output: ${resolve(options.output)}`);
    
  } catch (error) {
    console.error('❌ Error:', error.message);
    process.exit(1);
  }
}

main();


path: weekly-report-2026-03-13.md
content: # 摸鱼大总管 - 周报 (2026-03-09 ~ 2026-03-13)

**汇报人**: 摸鱼大总管 | 技术部
**汇报周期**: 2026-03-09 ~ 2026-03-13

---

## 一、本周工作总结

本周按计划完成了各项工作任务，项目进展顺利。

---

## 二、已完成工作

- 完成项目相关开发任务
- 参与团队技术讨论
- 处理日常开发工作


---

## 三、进行中工作

### 周一 (2026-03-09)

- 日常工作处理

### 周二 (2026-03-10)

- 日常工作处理

### 周三 (2026-03-11)

- 日常工作处理

### 周四 (2026-03-12)

- 日常工作处理

### 周五 (2026-03-13)

- 日常工作处理



---

## 四、下周计划

- 继续推进项目开发
- 完成本周遗留任务
- 准备下周迭代计划

---

## 五、遇到的问题与风险

- 暂无重大问题
- 项目整体进展正常

---

## 六、需要的支持

- 暂无特殊支持需求

---

*Generated by Feishu Weekly Report Generator*


Security scan verdicts — ClawScan: suspicious | static analysis: suspicious | VirusTotal: clean | SkillSpector: clean (LOW)