更新工作计划skill
This commit is contained in:
parent
dbced98449
commit
bc987567ac
|
|
@ -140,7 +140,31 @@ node scripts/work-weekly-report.js update-status --week "2026-W15" --plan-item "
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 功能6: 设置周报总结
|
### 功能6: 延期计划项
|
||||||
|
|
||||||
|
将某个计划项的预计完成日期延长到指定日期,并可记录延期原因。
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```
|
||||||
|
把任务A延期到下周三
|
||||||
|
任务B需要延期到4月20日
|
||||||
|
将计划项延长一周
|
||||||
|
```
|
||||||
|
|
||||||
|
**CLI 命令**:
|
||||||
|
```bash
|
||||||
|
# 延期计划项
|
||||||
|
node scripts/work-weekly-report.js extend-plan --plan-item "uuid" --new-date "2026-04-20"
|
||||||
|
|
||||||
|
# 带延期原因
|
||||||
|
node scripts/work-weekly-report.js extend-plan --plan-item "uuid" --new-date "2026-04-22" --reason "等待外部依赖"
|
||||||
|
```
|
||||||
|
|
||||||
|
**延期记录**: 每次延期都会记录延期次数和原因,可在周报中查看。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 功能7: 设置周报总结
|
||||||
|
|
||||||
为某周添加总结文字。
|
为某周添加总结文字。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ function getOrCreateWeeklyReport(weekNumber) {
|
||||||
/**
|
/**
|
||||||
* 制定/更新周计划
|
* 制定/更新周计划
|
||||||
*/
|
*/
|
||||||
function planWeek(weekNumber, tasks, priority = 'medium') {
|
function planWeek(weekNumber, tasks, priority = 'medium', expectedDate = null) {
|
||||||
const { data, report } = getOrCreateWeeklyReport(weekNumber);
|
const { data, report } = getOrCreateWeeklyReport(weekNumber);
|
||||||
const now = getCurrentISO();
|
const now = getCurrentISO();
|
||||||
|
|
||||||
|
|
@ -262,7 +262,7 @@ function planWeek(weekNumber, tasks, priority = 'medium') {
|
||||||
const planItem = {
|
const planItem = {
|
||||||
id: generateUUID(),
|
id: generateUUID(),
|
||||||
description: taskDesc,
|
description: taskDesc,
|
||||||
expectedDate: null,
|
expectedDate: expectedDate,
|
||||||
priority: priority,
|
priority: priority,
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
|
|
@ -429,6 +429,34 @@ function updatePlanItemStatus(weekNumber, planItemId, status) {
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延期计划项
|
||||||
|
* 将计划项的预计完成日期延长到指定日期
|
||||||
|
*/
|
||||||
|
function extendPlanItem(weekNumber, planItemId, newExpectedDate, reason = '') {
|
||||||
|
const { data, report } = getOrCreateWeeklyReport(weekNumber);
|
||||||
|
|
||||||
|
const planItem = report.plan.find(p => p.id === planItemId);
|
||||||
|
if (!planItem) {
|
||||||
|
throw new Error(`未找到计划项: ${planItemId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const oldDate = planItem.expectedDate;
|
||||||
|
planItem.expectedDate = newExpectedDate;
|
||||||
|
planItem.updatedAt = getCurrentISO();
|
||||||
|
|
||||||
|
// 如果传入了延期原因,记录在 extendedReason 字段
|
||||||
|
if (reason) {
|
||||||
|
planItem.extendedReason = reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加延期次数统计
|
||||||
|
planItem.extendCount = (planItem.extendCount || 0) + 1;
|
||||||
|
|
||||||
|
saveData(data);
|
||||||
|
return { report, planItem, oldDate, newDate: newExpectedDate };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置周报总结
|
* 设置周报总结
|
||||||
*/
|
*/
|
||||||
|
|
@ -475,7 +503,7 @@ if (require.main === module) {
|
||||||
const command = args[0];
|
const command = args[0];
|
||||||
|
|
||||||
// 已知的标志列表
|
// 已知的标志列表
|
||||||
const FLAGS = ['--week', '--tasks', '--priority', '--date', '--content', '--status', '--hours', '--plan-item', '--format'];
|
const FLAGS = ['--week', '--tasks', '--priority', '--date', '--content', '--status', '--hours', '--plan-item', '--format', '--expected-date'];
|
||||||
|
|
||||||
function getArgValue(flag) {
|
function getArgValue(flag) {
|
||||||
const index = args.indexOf(flag);
|
const index = args.indexOf(flag);
|
||||||
|
|
@ -525,11 +553,13 @@ if (require.main === module) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const priority = getArgValue('--priority') || 'medium';
|
const priority = getArgValue('--priority') || 'medium';
|
||||||
const report = planWeek(week, tasks, priority);
|
const expectedDate = getArgValue('--expected-date');
|
||||||
|
const report = planWeek(week, tasks, priority, expectedDate);
|
||||||
console.log(`已在 ${report.weekNumber} 创建 ${tasks.length} 个计划项`);
|
console.log(`已在 ${report.weekNumber} 创建 ${tasks.length} 个计划项`);
|
||||||
console.log('\n计划项:');
|
console.log('\n计划项:');
|
||||||
report.plan.slice(-tasks.length).forEach((item, i) => {
|
report.plan.slice(-tasks.length).forEach((item, i) => {
|
||||||
console.log(` ${i + 1}. [${item.priority}] ${item.description} (${item.id})`);
|
const dateStr = item.expectedDate ? ` [预计: ${item.expectedDate}]` : '';
|
||||||
|
console.log(` ${i + 1}. [${item.priority}] ${item.description}${dateStr} (${item.id})`);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -635,6 +665,27 @@ if (require.main === module) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'extend-plan': {
|
||||||
|
const weekIdentifier = getArgValue('--week') || '本周';
|
||||||
|
const planItemId = getArgValue('--plan-item');
|
||||||
|
const newDate = getArgValue('--new-date');
|
||||||
|
const reason = getArgValue('--reason') || '';
|
||||||
|
if (!planItemId || !newDate) {
|
||||||
|
console.error('错误: 请提供计划项ID (--plan-item) 和新日期 (--new-date YYYY-MM-DD)');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const weekNumber = parseWeekIdentifier(weekIdentifier);
|
||||||
|
const result = extendPlanItem(weekNumber, planItemId, newDate, reason);
|
||||||
|
const item = result.planItem;
|
||||||
|
console.log(`已将计划项延期:`);
|
||||||
|
console.log(` 任务: ${item.description}`);
|
||||||
|
console.log(` 原定日期: ${result.oldDate || '未设置'}`);
|
||||||
|
console.log(` 新日期: ${result.newDate}`);
|
||||||
|
if (reason) console.log(` 延期原因: ${reason}`);
|
||||||
|
console.log(` 延期次数: ${item.extendCount} 次`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'week-info': {
|
case 'week-info': {
|
||||||
const date = getArgValue('--date') || getCurrentDateStr();
|
const date = getArgValue('--date') || getCurrentDateStr();
|
||||||
const info = getWeekInfo(date);
|
const info = getWeekInfo(date);
|
||||||
|
|
@ -654,6 +705,7 @@ if (require.main === module) {
|
||||||
console.log(' node work-weekly-report.js update-status --plan-item UUID --status STATUS [--week YYYY-Www]');
|
console.log(' node work-weekly-report.js update-status --plan-item UUID --status STATUS [--week YYYY-Www]');
|
||||||
console.log(' node work-weekly-report.js summary --content "总结" [--week YYYY-Www]');
|
console.log(' node work-weekly-report.js summary --content "总结" [--week YYYY-Www]');
|
||||||
console.log(' node work-weekly-report.js remove-plan --plan-item UUID [--week YYYY-Www]');
|
console.log(' node work-weekly-report.js remove-plan --plan-item UUID [--week YYYY-Www]');
|
||||||
|
console.log(' node work-weekly-report.js extend-plan --plan-item UUID --new-date YYYY-MM-DD [--week YYYY-Www] [--reason "原因"]');
|
||||||
console.log(' node work-weekly-report.js week-info [--date YYYY-MM-DD]');
|
console.log(' node work-weekly-report.js week-info [--date YYYY-MM-DD]');
|
||||||
console.log('\n周标识: YYYY-Www, 本周, 上周, 上上周, 下周');
|
console.log('\n周标识: YYYY-Www, 本周, 上周, 上上周, 下周');
|
||||||
}
|
}
|
||||||
|
|
@ -674,6 +726,7 @@ module.exports = {
|
||||||
updatePlanItemStatus,
|
updatePlanItemStatus,
|
||||||
setSummary,
|
setSummary,
|
||||||
removePlanItem,
|
removePlanItem,
|
||||||
|
extendPlanItem,
|
||||||
getWorkdays,
|
getWorkdays,
|
||||||
parseWeekIdentifier,
|
parseWeekIdentifier,
|
||||||
isWorkday
|
isWorkday
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue