executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
gantt-chart-builder根据任务列表和依赖关系生成交互式HTML甘特图,支持关键路径分析(CPM),可视化项目时间线、依赖关系和可延迟的浮动时间。当用户提到甘特图、项目时间线、关键路径、任务排期、项目进度图、依赖关系可视化、工期计算或直接说“帮我排一下项目时间”、“生成一个项目进度图”、“分析一下哪些任务是关键路径”时触发。
Independent GitHub snapshot · Automated classification · Original documentation governs
根据任务列表及其依赖关系,自动执行关键路径分析(CPM),生成可交互的 HTML 甘特图。支持缩放、关键路径筛选、悬停详情、依赖关系箭头可视化等功能。
最简用法——直接传入 JSON:
python3 scripts/gantt_generator.py --json '{
"project": "新产品上线",
"tasks": [
{"id": "T1", "name": "需求分析", "duration": 5, "dependencies": []},
{"id": "T2", "name": "UI 设计", "duration": 4, "dependencies": ["T1"]},
{"id": "T3", "name": "后端开发", "duration": 8, "dependencies": ["T1"]},
{"id": "T4", "name": "前端开发", "duration": 6, "dependencies": ["T2"]},
{"id": "T5", "name": "联调测试", "duration": 3, "dependencies": ["T3", "T4"]},
{"id": "T6", "name": "上线部署", "duration": 2, "dependencies": ["T5"]}
]
}' --output gantt.html
从文件读取并指定开始日期:
python3 scripts/gantt_generator.py --file tasks.json --start-date 2026-05-01 --output gantt.html
| 术语 | 英文 | 含义 |
|---|---|---|
| 最早开始 | ES (Earliest Start) | 任务最早可以开始的时间 |
| 最早完成 | EF (Earliest Finish) | 任务最早可以完成的时间(ES + 工期) |
| 最晚开始 | LS (Latest Start) | 不影响项目总工期的最晚开始时间 |
| 最晚完成 | LF (Latest Finish) | 不影响项目总工期的最晚完成时间 |
| 总浮动 | Total Float | LS - ES,可延迟天数 |
| 关键路径 | Critical Path | 浮动时间为 0 的任务序列,决定项目最短工期 |
ES = max(所有前置任务的 EF)EF = ES + 工期LF = min(所有后续任务的 LS)LS = LF - 工期JSON 对象,包含以下字段:
{
"project": "项目名称",
"start_date": "2026-05-01",
"tasks": [
{
"id": "T1",
"name": "任务名称",
"duration": 5,
"dependencies": ["T0"]
}
]
}
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| project | 否 | string | 项目标题,默认"项目甘特图" |
| start_date | 否 | string | YYYY-MM-DD 格式,可被 CLI --start-date 覆盖 |
| tasks | 是 | array | 任务列表 |
| tasks[].id | 是 | string | 任务唯一标识 |
| tasks[].name | 是 | string | 任务名称 |
| tasks[].duration | 是 | number | 工期(天),必须 > 0 |
| tasks[].dependencies | 否 | array | 前置任务 ID 列表,默认 [] |
生成的 HTML 文件是完全自包含的(无外部依赖),包含以下交互功能:
python3 scripts/gantt_generator.py [参数]
必填参数(二选一):
--json TEXT JSON 格式任务数据字符串
--file PATH JSON 文件路径
可选参数:
--start-date DATE 项目开始日期 (YYYY-MM-DD),默认今天
--output, -o PATH 输出 HTML 路径,默认输出到 stdout
--title TEXT 覆盖项目标题
{
"project": "CRM系统 v2.0 开发",
"start_date": "2026-05-05",
"tasks": [
{"id": "A", "name": "需求调研", "duration": 5, "dependencies": []},
{"id": "B", "name": "架构设计", "duration": 3, "dependencies": ["A"]},
{"id": "C", "name": "UI/UX 设计", "duration": 4, "dependencies": ["A"]},
{"id": "D", "name": "数据库设计", "duration": 2, "dependencies": ["B"]},
{"id": "E", "name": "后端 API 开发", "duration": 10, "dependencies": ["D"]},
{"id": "F", "name": "前端页面开发", "duration": 8, "dependencies": ["C", "D"]},
{"id": "G", "name": "单元测试", "duration": 3, "dependencies": ["E"]},
{"id": "H", "name": "集成测试", "duration": 4, "dependencies": ["F", "G"]},
{"id": "I", "name": "用户验收", "duration": 3, "dependencies": ["H"]},
{"id": "J", "name": "部署上线", "duration": 2, "dependencies": ["I"]}
]
}
分析结果: