monoco-toolkit 0.3.9__py3-none-any.whl → 0.3.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- monoco/core/config.py +7 -0
- monoco/core/hooks/builtin/git_cleanup.py +1 -1
- monoco/core/injection.py +63 -29
- monoco/core/integrations.py +2 -2
- monoco/core/output.py +5 -5
- monoco/core/registry.py +7 -1
- monoco/core/resource/__init__.py +5 -0
- monoco/core/resource/finder.py +98 -0
- monoco/core/resource/manager.py +91 -0
- monoco/core/resource/models.py +35 -0
- monoco/core/resources/en/{SKILL.md → skills/monoco_core/SKILL.md} +2 -0
- monoco/core/resources/zh/{SKILL.md → skills/monoco_core/SKILL.md} +2 -0
- monoco/core/skill_framework.py +292 -0
- monoco/core/skills.py +471 -371
- monoco/core/sync.py +73 -1
- monoco/core/workflow_converter.py +420 -0
- monoco/features/agent/__init__.py +2 -2
- monoco/features/agent/adapter.py +31 -0
- monoco/features/agent/apoptosis.py +44 -0
- monoco/features/agent/cli.py +101 -144
- monoco/features/agent/config.py +35 -21
- monoco/features/agent/defaults.py +6 -49
- monoco/features/agent/engines.py +32 -6
- monoco/features/agent/manager.py +6 -1
- monoco/features/agent/models.py +2 -2
- monoco/features/agent/resources/atoms/atom-code-dev.yaml +61 -0
- monoco/features/agent/resources/atoms/atom-issue-lifecycle.yaml +73 -0
- monoco/features/agent/resources/atoms/atom-knowledge.yaml +55 -0
- monoco/features/agent/resources/atoms/atom-review.yaml +60 -0
- monoco/features/agent/resources/en/skills/flow_engineer/SKILL.md +94 -0
- monoco/features/agent/resources/en/skills/flow_manager/SKILL.md +93 -0
- monoco/features/agent/resources/en/skills/flow_planner/SKILL.md +85 -0
- monoco/features/agent/resources/en/skills/flow_reviewer/SKILL.md +114 -0
- monoco/features/agent/resources/roles/role-engineer.yaml +49 -0
- monoco/features/agent/resources/roles/role-manager.yaml +46 -0
- monoco/features/agent/resources/roles/role-planner.yaml +46 -0
- monoco/features/agent/resources/roles/role-reviewer.yaml +47 -0
- monoco/features/agent/resources/workflows/workflow-dev.yaml +83 -0
- monoco/features/agent/resources/workflows/workflow-issue-create.yaml +72 -0
- monoco/features/agent/resources/workflows/workflow-review.yaml +94 -0
- monoco/features/agent/resources/zh/skills/flow_planner/SKILL.md +259 -0
- monoco/features/agent/resources/zh/skills/flow_reviewer/SKILL.md +137 -0
- monoco/features/agent/worker.py +38 -2
- monoco/features/glossary/__init__.py +0 -0
- monoco/features/glossary/adapter.py +31 -0
- monoco/features/glossary/config.py +5 -0
- monoco/features/glossary/resources/en/AGENTS.md +29 -0
- monoco/features/glossary/resources/en/skills/monoco_glossary/SKILL.md +35 -0
- monoco/features/glossary/resources/zh/AGENTS.md +29 -0
- monoco/features/glossary/resources/zh/skills/monoco_glossary/SKILL.md +35 -0
- monoco/features/i18n/resources/en/skills/i18n_scan_workflow/SKILL.md +105 -0
- monoco/features/i18n/resources/en/{SKILL.md → skills/monoco_i18n/SKILL.md} +2 -0
- monoco/features/i18n/resources/zh/{SKILL.md → skills/monoco_i18n/SKILL.md} +2 -0
- monoco/features/issue/core.py +45 -6
- monoco/features/issue/engine/machine.py +5 -2
- monoco/features/issue/models.py +1 -0
- monoco/features/issue/resources/en/skills/issue_create_workflow/SKILL.md +167 -0
- monoco/features/issue/resources/en/skills/issue_develop_workflow/SKILL.md +224 -0
- monoco/features/issue/resources/en/skills/issue_lifecycle_workflow/SKILL.md +159 -0
- monoco/features/issue/resources/en/skills/issue_refine_workflow/SKILL.md +203 -0
- monoco/features/issue/resources/en/{SKILL.md → skills/monoco_issue/SKILL.md} +2 -0
- monoco/features/issue/resources/zh/skills/issue_create_workflow/SKILL.md +167 -0
- monoco/features/issue/resources/zh/skills/issue_develop_workflow/SKILL.md +224 -0
- monoco/features/issue/resources/zh/skills/issue_refine_workflow/SKILL.md +203 -0
- monoco/features/issue/resources/zh/{SKILL.md → skills/monoco_issue/SKILL.md} +2 -0
- monoco/features/memo/resources/en/skills/monoco_memo/SKILL.md +77 -0
- monoco/features/memo/resources/en/skills/note_processing_workflow/SKILL.md +140 -0
- monoco/features/memo/resources/zh/{SKILL.md → skills/monoco_memo/SKILL.md} +2 -0
- monoco/features/spike/resources/en/{SKILL.md → skills/monoco_spike/SKILL.md} +2 -0
- monoco/features/spike/resources/en/skills/research_workflow/SKILL.md +121 -0
- monoco/features/spike/resources/zh/{SKILL.md → skills/monoco_spike/SKILL.md} +2 -0
- monoco_toolkit-0.3.10.dist-info/METADATA +124 -0
- monoco_toolkit-0.3.10.dist-info/RECORD +156 -0
- monoco/features/agent/reliability.py +0 -106
- monoco/features/agent/resources/skills/flow_reviewer/SKILL.md +0 -114
- monoco_toolkit-0.3.9.dist-info/METADATA +0 -127
- monoco_toolkit-0.3.9.dist-info/RECORD +0 -115
- /monoco/features/agent/resources/{skills → zh/skills}/flow_engineer/SKILL.md +0 -0
- /monoco/features/agent/resources/{skills → zh/skills}/flow_manager/SKILL.md +0 -0
- /monoco/features/i18n/resources/{skills → zh/skills}/i18n_scan_workflow/SKILL.md +0 -0
- /monoco/features/issue/resources/{skills → zh/skills}/issue_lifecycle_workflow/SKILL.md +0 -0
- /monoco/features/memo/resources/{skills → zh/skills}/note_processing_workflow/SKILL.md +0 -0
- /monoco/features/spike/resources/{skills → zh/skills}/research_workflow/SKILL.md +0 -0
- {monoco_toolkit-0.3.9.dist-info → monoco_toolkit-0.3.10.dist-info}/WHEEL +0 -0
- {monoco_toolkit-0.3.9.dist-info → monoco_toolkit-0.3.10.dist-info}/entry_points.txt +0 -0
- {monoco_toolkit-0.3.9.dist-info → monoco_toolkit-0.3.10.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: role-planner
|
|
3
|
+
type: role
|
|
4
|
+
description: Planner 角色 - 负责架构设计、技术规划和交接
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Monoco Toolkit
|
|
7
|
+
|
|
8
|
+
# 默认工作流
|
|
9
|
+
workflow: workflow-dev
|
|
10
|
+
|
|
11
|
+
# 默认执行模式
|
|
12
|
+
default_mode: copilot
|
|
13
|
+
|
|
14
|
+
# 触发条件
|
|
15
|
+
trigger: "issue.needs_refine"
|
|
16
|
+
goal: 产出清晰的架构设计和可执行的计划
|
|
17
|
+
|
|
18
|
+
# 角色偏好 / Mindset
|
|
19
|
+
preferences:
|
|
20
|
+
- "Evidence Based: 所有架构决策必须有代码或文档证据支持"
|
|
21
|
+
- "Incremental Design: 优先采用增量式设计,避免过度设计"
|
|
22
|
+
- "Clear Boundaries: 明确模块边界和接口契约"
|
|
23
|
+
- "Document First: 先写设计文档,再创建实现任务"
|
|
24
|
+
- "Review Loop: 复杂设计应经过 Review 后再交接"
|
|
25
|
+
|
|
26
|
+
# 系统提示
|
|
27
|
+
system_prompt: |
|
|
28
|
+
# Identity
|
|
29
|
+
你是由 Monoco Toolkit 驱动的 **Planner Agent**,负责架构设计和技术规划。
|
|
30
|
+
|
|
31
|
+
# Core Workflow
|
|
32
|
+
你的工作流包含以下阶段:
|
|
33
|
+
1. **analyze**: 充分理解需求和上下文
|
|
34
|
+
2. **design**: 产出架构设计方案 (ADR)
|
|
35
|
+
3. **plan**: 制定可执行的任务计划
|
|
36
|
+
4. **handoff**: 将任务交接给 Engineer
|
|
37
|
+
|
|
38
|
+
# Mindset
|
|
39
|
+
- **Evidence Based**: 所有决策必须有证据支持
|
|
40
|
+
- **Incremental**: 优先增量设计,避免过度设计
|
|
41
|
+
- **Clear Interfaces**: 明确模块边界和接口契约
|
|
42
|
+
|
|
43
|
+
# Rules
|
|
44
|
+
- 先写设计文档,再创建实现任务
|
|
45
|
+
- 复杂设计应经过 Review 后再交接
|
|
46
|
+
- 为 Engineer 提供完整的上下文和实现指南
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: role-reviewer
|
|
3
|
+
type: role
|
|
4
|
+
description: Reviewer 角色 - 负责代码质量检查和对抗性测试
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Monoco Toolkit
|
|
7
|
+
|
|
8
|
+
# 默认工作流
|
|
9
|
+
workflow: workflow-review
|
|
10
|
+
|
|
11
|
+
# 默认执行模式
|
|
12
|
+
default_mode: autopilot
|
|
13
|
+
|
|
14
|
+
# 触发条件
|
|
15
|
+
trigger: "issue.submitted"
|
|
16
|
+
goal: 确保代码质量和流程合规
|
|
17
|
+
|
|
18
|
+
# 角色偏好 / Mindset
|
|
19
|
+
preferences:
|
|
20
|
+
- "Double Defense: 双层防御体系 - Engineer 自证 (Verify) + Reviewer 对抗 (Challenge)"
|
|
21
|
+
- "Try to Break It: 尝试破坏代码,寻找边界情况"
|
|
22
|
+
- "No Approve Without Test: 禁止未经测试直接 Approve"
|
|
23
|
+
- "Challenge Tests: 保留有价值的 Challenge Tests 并提交到代码库"
|
|
24
|
+
|
|
25
|
+
# 系统提示
|
|
26
|
+
system_prompt: |
|
|
27
|
+
# Identity
|
|
28
|
+
你是由 Monoco Toolkit 驱动的 **Reviewer Agent**,负责代码质量检查。
|
|
29
|
+
|
|
30
|
+
# Core Workflow
|
|
31
|
+
你的核心工作流定义在 `workflow-review` 中,采用**双层防御体系**:
|
|
32
|
+
1. **checkout**: 获取待评审的代码
|
|
33
|
+
2. **verify**: 验证 Engineer 提交的测试 (White-box)
|
|
34
|
+
3. **challenge**: 对抗测试,尝试破坏代码 (Black-box)
|
|
35
|
+
4. **review**: 代码审查,检查质量和可维护性
|
|
36
|
+
5. **decide**: 做出批准、拒绝或请求修改的决定
|
|
37
|
+
|
|
38
|
+
# Mindset
|
|
39
|
+
- **Double Defense**: Verify + Challenge
|
|
40
|
+
- **Try to Break It**: 寻找边界情况和安全漏洞
|
|
41
|
+
- **Quality First**: 质量是第一优先级
|
|
42
|
+
|
|
43
|
+
# Rules
|
|
44
|
+
- 必须先通过 Engineer 的测试 (Verify),再进行对抗测试 (Challenge)
|
|
45
|
+
- 必须尝试编写至少一个边界测试用例
|
|
46
|
+
- 禁止未经测试直接 Approve
|
|
47
|
+
- 合并价值高的 Challenge Tests 到代码库
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-dev
|
|
3
|
+
type: workflow
|
|
4
|
+
description: 开发工作流编排 - 从准备环境到提交评审的完整流程
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Monoco Toolkit
|
|
7
|
+
|
|
8
|
+
# 依赖的原子技能
|
|
9
|
+
dependencies:
|
|
10
|
+
- atom-issue-lifecycle
|
|
11
|
+
- atom-code-dev
|
|
12
|
+
|
|
13
|
+
# 工作流阶段定义
|
|
14
|
+
stages:
|
|
15
|
+
- name: setup
|
|
16
|
+
atom_skill: atom-issue-lifecycle
|
|
17
|
+
operation: start
|
|
18
|
+
description: 准备开发环境,创建功能分支
|
|
19
|
+
reminder: "确保使用 --branch 创建功能分支,禁止在 main/master 上开发"
|
|
20
|
+
next_stages:
|
|
21
|
+
success: investigate
|
|
22
|
+
branch_conflict: setup
|
|
23
|
+
|
|
24
|
+
- name: investigate
|
|
25
|
+
atom_skill: atom-code-dev
|
|
26
|
+
operation: investigate
|
|
27
|
+
description: 理解需求与上下文
|
|
28
|
+
reminder: "深入理解 Issue 需求,识别相关代码和依赖"
|
|
29
|
+
next_stages:
|
|
30
|
+
requirements_clear: implement
|
|
31
|
+
requirements_fuzzy: investigate
|
|
32
|
+
|
|
33
|
+
- name: implement
|
|
34
|
+
atom_skill: atom-code-dev
|
|
35
|
+
operation: implement
|
|
36
|
+
description: 实现代码变更
|
|
37
|
+
reminder: "遵循项目代码规范,小步提交,处理边界情况"
|
|
38
|
+
next_stages:
|
|
39
|
+
coding_complete: test
|
|
40
|
+
|
|
41
|
+
- name: test
|
|
42
|
+
atom_skill: atom-code-dev
|
|
43
|
+
operation: test
|
|
44
|
+
description: 运行测试确保代码质量
|
|
45
|
+
reminder: "所有测试必须通过,检查测试覆盖率"
|
|
46
|
+
next_stages:
|
|
47
|
+
test_passed: report
|
|
48
|
+
test_failed: implement
|
|
49
|
+
|
|
50
|
+
- name: report
|
|
51
|
+
atom_skill: atom-issue-lifecycle
|
|
52
|
+
operation: sync
|
|
53
|
+
description: 记录变更,更新文件追踪
|
|
54
|
+
reminder: "同步文件追踪,编写变更摘要"
|
|
55
|
+
next_stages:
|
|
56
|
+
report_complete: submit
|
|
57
|
+
|
|
58
|
+
- name: submit
|
|
59
|
+
atom_skill: atom-issue-lifecycle
|
|
60
|
+
operation: submit
|
|
61
|
+
description: 提交代码进行评审
|
|
62
|
+
reminder: "确保所有测试通过,lint 无错误后再提交"
|
|
63
|
+
next_stages:
|
|
64
|
+
submit_success: "[END]"
|
|
65
|
+
lint_failed: submit
|
|
66
|
+
|
|
67
|
+
# 执行模式配置
|
|
68
|
+
mode_config:
|
|
69
|
+
copilot:
|
|
70
|
+
behavior: "人类主导,AI 协助。每个 stage 前询问确认,在关键检查点暂停等待人类输入"
|
|
71
|
+
pause_on:
|
|
72
|
+
- setup
|
|
73
|
+
- implement
|
|
74
|
+
- submit
|
|
75
|
+
auto_execute: false
|
|
76
|
+
|
|
77
|
+
autopilot:
|
|
78
|
+
behavior: "AI 自动执行,按状态机流转,失败时暂停等待人类决策"
|
|
79
|
+
pause_on:
|
|
80
|
+
- test_failed
|
|
81
|
+
- lint_failed
|
|
82
|
+
- requirements_fuzzy
|
|
83
|
+
auto_execute: true
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-issue-create
|
|
3
|
+
type: workflow
|
|
4
|
+
description: Issue 创建工作流编排 - 从 Memo 提取到 Issue 创建
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Monoco Toolkit
|
|
7
|
+
|
|
8
|
+
# 依赖的原子技能
|
|
9
|
+
dependencies:
|
|
10
|
+
- atom-knowledge
|
|
11
|
+
- atom-issue-lifecycle
|
|
12
|
+
|
|
13
|
+
# 工作流阶段定义
|
|
14
|
+
stages:
|
|
15
|
+
- name: extract
|
|
16
|
+
atom_skill: atom-knowledge
|
|
17
|
+
operation: process
|
|
18
|
+
description: 从 Memo 中提取改进线索
|
|
19
|
+
reminder: "运行 monoco memo list,分析每个 Memo 的改进类型和影响范围"
|
|
20
|
+
next_stages:
|
|
21
|
+
has_value: classify
|
|
22
|
+
no_value: archive
|
|
23
|
+
|
|
24
|
+
- name: classify
|
|
25
|
+
atom_skill: atom-issue-lifecycle
|
|
26
|
+
operation: create
|
|
27
|
+
description: 确定 Issue 类型和优先级
|
|
28
|
+
reminder: "判断类型 (Epic/Feature/Chore/Fix),评估是否需要前置架构设计"
|
|
29
|
+
next_stages:
|
|
30
|
+
needs_design: design
|
|
31
|
+
direct_create: create
|
|
32
|
+
|
|
33
|
+
- name: design
|
|
34
|
+
atom_skill: atom-code-dev
|
|
35
|
+
operation: investigate
|
|
36
|
+
description: 对复杂改进进行初步架构设计
|
|
37
|
+
reminder: "分析现有架构继承性,确定技术方案方向"
|
|
38
|
+
next_stages:
|
|
39
|
+
design_complete: create
|
|
40
|
+
|
|
41
|
+
- name: create
|
|
42
|
+
atom_skill: atom-issue-lifecycle
|
|
43
|
+
operation: create
|
|
44
|
+
description: 创建符合规范的 Issue
|
|
45
|
+
reminder: "编写清晰的描述和验收标准,确保至少 2 个 Checkbox"
|
|
46
|
+
next_stages:
|
|
47
|
+
create_success: "[END]"
|
|
48
|
+
|
|
49
|
+
- name: archive
|
|
50
|
+
atom_skill: atom-knowledge
|
|
51
|
+
operation: archive
|
|
52
|
+
description: 归档无直接改进价值的 Memo
|
|
53
|
+
reminder: "确认 Memo 内容为纯参考资料,记录归档原因"
|
|
54
|
+
next_stages:
|
|
55
|
+
archive_complete: "[END]"
|
|
56
|
+
|
|
57
|
+
# 执行模式配置
|
|
58
|
+
mode_config:
|
|
59
|
+
copilot:
|
|
60
|
+
behavior: "人类主导,AI 协助。主动提问、提供选项、协助起草、提醒合规"
|
|
61
|
+
pause_on:
|
|
62
|
+
- extract
|
|
63
|
+
- classify
|
|
64
|
+
- create
|
|
65
|
+
auto_execute: false
|
|
66
|
+
|
|
67
|
+
autopilot:
|
|
68
|
+
behavior: "AI 根据规则自动分类和创建,异常情况暂停"
|
|
69
|
+
pause_on:
|
|
70
|
+
- classification_unclear
|
|
71
|
+
- needs_human_decision
|
|
72
|
+
auto_execute: true
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-review
|
|
3
|
+
type: workflow
|
|
4
|
+
description: 代码评审工作流编排 - 双层防御体系 (Verify + Challenge)
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Monoco Toolkit
|
|
7
|
+
|
|
8
|
+
# 依赖的原子技能
|
|
9
|
+
dependencies:
|
|
10
|
+
- atom-review
|
|
11
|
+
|
|
12
|
+
# 工作流阶段定义
|
|
13
|
+
stages:
|
|
14
|
+
- name: checkout
|
|
15
|
+
atom_skill: atom-review
|
|
16
|
+
operation: checkout
|
|
17
|
+
description: 获取待评审的代码
|
|
18
|
+
reminder: "检出 PR/Branch,确认与 Base 分支的差异"
|
|
19
|
+
next_stages:
|
|
20
|
+
success: verify
|
|
21
|
+
|
|
22
|
+
- name: verify
|
|
23
|
+
atom_skill: atom-review
|
|
24
|
+
operation: verify
|
|
25
|
+
description: 验证 Engineer 提交的测试 (White-box)
|
|
26
|
+
reminder: "先运行 Engineer 编写的测试,验证功能正确性"
|
|
27
|
+
next_stages:
|
|
28
|
+
tests_passed: challenge
|
|
29
|
+
tests_failed: reject
|
|
30
|
+
|
|
31
|
+
- name: challenge
|
|
32
|
+
atom_skill: atom-review
|
|
33
|
+
operation: challenge
|
|
34
|
+
description: 对抗测试,尝试破坏代码 (Black-box)
|
|
35
|
+
reminder: "Try to break it - 寻找边界情况和安全漏洞"
|
|
36
|
+
next_stages:
|
|
37
|
+
challenge_passed: review
|
|
38
|
+
vulnerability_found: reject
|
|
39
|
+
|
|
40
|
+
- name: review
|
|
41
|
+
atom_skill: atom-review
|
|
42
|
+
operation: feedback
|
|
43
|
+
description: 代码审查,检查质量和可维护性
|
|
44
|
+
reminder: "检查功能、设计、可读性、文档、合规"
|
|
45
|
+
next_stages:
|
|
46
|
+
code_ok: approve
|
|
47
|
+
quality_issues: reject
|
|
48
|
+
minor_issues: request_changes
|
|
49
|
+
|
|
50
|
+
- name: approve
|
|
51
|
+
atom_skill: atom-review
|
|
52
|
+
operation: feedback
|
|
53
|
+
description: 批准代码合并
|
|
54
|
+
reminder: "代码健壮且符合规范,包含所有通过的 Challenge Tests"
|
|
55
|
+
next_stages:
|
|
56
|
+
success: cleanup
|
|
57
|
+
|
|
58
|
+
- name: reject
|
|
59
|
+
description: 拒绝,需要修改
|
|
60
|
+
reminder: "提供具体反馈,附带失败的 Test Case 或 Log"
|
|
61
|
+
next_stages:
|
|
62
|
+
success: "[END]"
|
|
63
|
+
|
|
64
|
+
- name: request_changes
|
|
65
|
+
description: 请求修改(小问题)
|
|
66
|
+
reminder: "小问题,可快速修复"
|
|
67
|
+
next_stages:
|
|
68
|
+
success: "[END]"
|
|
69
|
+
|
|
70
|
+
- name: cleanup
|
|
71
|
+
atom_skill: atom-review
|
|
72
|
+
operation: feedback
|
|
73
|
+
description: 完成评审后的清理
|
|
74
|
+
reminder: "提交新增的测试用例,删除本地临时分支,更新 Issue 状态"
|
|
75
|
+
next_stages:
|
|
76
|
+
success: "[END]"
|
|
77
|
+
|
|
78
|
+
# 执行模式配置
|
|
79
|
+
mode_config:
|
|
80
|
+
copilot:
|
|
81
|
+
behavior: "人类主导评审,AI 协助执行验证和对抗测试"
|
|
82
|
+
pause_on:
|
|
83
|
+
- verify
|
|
84
|
+
- challenge
|
|
85
|
+
- review
|
|
86
|
+
auto_execute: false
|
|
87
|
+
|
|
88
|
+
autopilot:
|
|
89
|
+
behavior: "AI 自动执行验证和对抗测试,人类仅在最终决策时介入"
|
|
90
|
+
pause_on:
|
|
91
|
+
- review
|
|
92
|
+
- tests_failed
|
|
93
|
+
- vulnerability_found
|
|
94
|
+
auto_execute: true
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-planner
|
|
3
|
+
description: Planner 角色的标准化工作流 (Flow Skill),负责分析、设计、规划和交接。
|
|
4
|
+
type: flow
|
|
5
|
+
role: planner
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
author: Monoco Toolkit
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# flow_planner
|
|
11
|
+
|
|
12
|
+
Planner 角色的标准化工作流 (Flow Skill),负责分析、设计、规划和交接。
|
|
13
|
+
|
|
14
|
+
## 工作流状态机
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
stateDiagram-v2
|
|
18
|
+
[*] --> Analyze: 接收输入
|
|
19
|
+
|
|
20
|
+
Analyze --> Design: 需求清晰
|
|
21
|
+
Analyze --> Analyze: 信息不足<br/>(收集更多)
|
|
22
|
+
|
|
23
|
+
Design --> Plan: 设计完成
|
|
24
|
+
Design --> Design: 方案冲突<br/>(重新设计)
|
|
25
|
+
|
|
26
|
+
Plan --> Handoff: 规划完成
|
|
27
|
+
Plan --> Plan: 依赖复杂<br/>(调整计划)
|
|
28
|
+
|
|
29
|
+
Handoff --> [*]: 交接成功
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 执行步骤
|
|
35
|
+
|
|
36
|
+
### 1. Analyze (分析)
|
|
37
|
+
|
|
38
|
+
**目标**: 充分理解需求和上下文
|
|
39
|
+
|
|
40
|
+
**入口条件**:
|
|
41
|
+
- 接收到 Memo 或 Issue 输入
|
|
42
|
+
- 或检测到需要细化的任务
|
|
43
|
+
|
|
44
|
+
**自动执行检查点**:
|
|
45
|
+
|
|
46
|
+
- [ ] **读取输入**: 读取 Memo 或 Issue 的完整内容
|
|
47
|
+
- [ ] **识别上下文**: 识别相关代码文件、模块和依赖
|
|
48
|
+
- [ ] **检查架构**: 检查现有架构和技术栈
|
|
49
|
+
- [ ] **评估范围**: 评估影响范围和复杂度
|
|
50
|
+
- [ ] **记录发现**: 将分析结果记录到 Issue 或创建新的研究 Issue
|
|
51
|
+
|
|
52
|
+
**退出条件**:
|
|
53
|
+
- 需求清晰明确 → 进入 Design
|
|
54
|
+
- 信息不足 → 返回 Analyze,收集更多信息
|
|
55
|
+
|
|
56
|
+
**命令参考**:
|
|
57
|
+
```bash
|
|
58
|
+
# 读取 Memo
|
|
59
|
+
monoco memo list
|
|
60
|
+
monoco memo open <id>
|
|
61
|
+
|
|
62
|
+
# 读取 Issue
|
|
63
|
+
cat Issues/<type>/<status>/<issue-file>.md
|
|
64
|
+
|
|
65
|
+
# 检查相关代码
|
|
66
|
+
grep -r "pattern" monoco/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### 2. Design (设计)
|
|
72
|
+
|
|
73
|
+
**目标**: 产出架构设计方案
|
|
74
|
+
|
|
75
|
+
**入口条件**:
|
|
76
|
+
- Analyze 阶段完成,需求清晰
|
|
77
|
+
|
|
78
|
+
**自动执行检查点**:
|
|
79
|
+
|
|
80
|
+
- [ ] **系统架构**: 设计系统架构和组件关系
|
|
81
|
+
- [ ] **继承性评估**: 评估与现有系统的兼容性
|
|
82
|
+
- [ ] **安全评估**: 识别安全风险和缓解措施
|
|
83
|
+
- [ ] **性能评估**: 评估性能影响和优化方案
|
|
84
|
+
- [ ] **可维护性**: 考虑可维护性和扩展性
|
|
85
|
+
- [ ] **设计文档**: 编写架构设计文档 (Architecture Decision Record)
|
|
86
|
+
|
|
87
|
+
**退出条件**:
|
|
88
|
+
- 设计完成且通过自评 → 进入 Plan
|
|
89
|
+
- 架构冲突 → 返回 Design,重新设计方案
|
|
90
|
+
|
|
91
|
+
**设计输出模板**:
|
|
92
|
+
```markdown
|
|
93
|
+
## Architecture Design
|
|
94
|
+
|
|
95
|
+
### 1. 系统架构
|
|
96
|
+
[架构图或描述]
|
|
97
|
+
|
|
98
|
+
### 2. 组件关系
|
|
99
|
+
- Component A → Component B
|
|
100
|
+
- 接口定义: ...
|
|
101
|
+
|
|
102
|
+
### 3. 技术选型
|
|
103
|
+
- 语言/框架: ...
|
|
104
|
+
- 依赖库: ...
|
|
105
|
+
|
|
106
|
+
### 4. 风险评估
|
|
107
|
+
| 风险 | 影响 | 缓解措施 |
|
|
108
|
+
|------|------|----------|
|
|
109
|
+
| ... | ... | ... |
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 3. Plan (规划)
|
|
115
|
+
|
|
116
|
+
**目标**: 制定可执行的任务计划
|
|
117
|
+
|
|
118
|
+
**入口条件**:
|
|
119
|
+
- Design 阶段完成,架构方案确定
|
|
120
|
+
|
|
121
|
+
**自动执行检查点**:
|
|
122
|
+
|
|
123
|
+
- [ ] **任务分解**: 将工作分解为可执行的单元 (Issue/Feature)
|
|
124
|
+
- [ ] **依赖分析**: 识别任务间的依赖关系
|
|
125
|
+
- [ ] **工作量估算**: 估算每个任务的工作量和优先级
|
|
126
|
+
- [ ] **创建 Issue**: 使用 `monoco issue create` 创建子任务
|
|
127
|
+
- [ ] **更新父 Issue**: 更新原始 Issue 的任务列表和依赖
|
|
128
|
+
|
|
129
|
+
**退出条件**:
|
|
130
|
+
- 规划完成 → 进入 Handoff
|
|
131
|
+
- 依赖复杂 → 返回 Plan,调整任务分解
|
|
132
|
+
|
|
133
|
+
**命令参考**:
|
|
134
|
+
```bash
|
|
135
|
+
# 创建子任务
|
|
136
|
+
monoco issue create feature -t "子任务标题" --parent <parent-id>
|
|
137
|
+
|
|
138
|
+
# 更新 Issue
|
|
139
|
+
monoco issue edit <id> --add-task "任务描述"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### 4. Handoff (交接)
|
|
145
|
+
|
|
146
|
+
**目标**: 将任务交接给 Engineer
|
|
147
|
+
|
|
148
|
+
**入口条件**:
|
|
149
|
+
- Plan 阶段完成,任务已分解为可执行单元
|
|
150
|
+
|
|
151
|
+
**自动执行检查点**:
|
|
152
|
+
|
|
153
|
+
- [ ] **上下文摘要**: 生成完整的上下文摘要 (Context Summary)
|
|
154
|
+
- [ ] **更新 Issue**: 更新 Issue 描述,包含技术设计和执行步骤
|
|
155
|
+
- [ ] **标记状态**: 标记 Issue 为 `ready_for_dev`
|
|
156
|
+
- [ ] **通知 Engineer**: 如系统支持,通知 Engineer 有新任务
|
|
157
|
+
|
|
158
|
+
**交接文档模板**:
|
|
159
|
+
```markdown
|
|
160
|
+
## Handoff Document
|
|
161
|
+
|
|
162
|
+
### Context
|
|
163
|
+
[任务背景和目标的简要描述]
|
|
164
|
+
|
|
165
|
+
### Architecture
|
|
166
|
+
[架构设计的关键点]
|
|
167
|
+
|
|
168
|
+
### Implementation Guide
|
|
169
|
+
[实现步骤和注意事项]
|
|
170
|
+
|
|
171
|
+
### Acceptance Criteria
|
|
172
|
+
- [ ] 验收标准 1
|
|
173
|
+
- [ ] 验收标准 2
|
|
174
|
+
|
|
175
|
+
### Related Files
|
|
176
|
+
- `path/to/file1.py`
|
|
177
|
+
- `path/to/file2.py`
|
|
178
|
+
|
|
179
|
+
### Dependencies
|
|
180
|
+
- 依赖 Issue: #XXX
|
|
181
|
+
- 阻塞 Issue: #YYY
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**退出条件**:
|
|
185
|
+
- 交接成功 → 工作流结束
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 决策分支
|
|
190
|
+
|
|
191
|
+
| 条件 | 动作 | 说明 |
|
|
192
|
+
|------|------|------|
|
|
193
|
+
| 信息不足 | 返回 Analyze | 收集更多信息,可能创建 Spike Issue |
|
|
194
|
+
| 架构冲突 | 返回 Design | 重新设计方案,记录决策理由 |
|
|
195
|
+
| 依赖复杂 | 返回 Plan | 调整任务分解,简化依赖关系 |
|
|
196
|
+
| 规划完成 | 进入 Handoff | 交接给 Engineer |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 与 Engineer 的协作
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Planner (Analyze → Design → Plan)
|
|
204
|
+
↓
|
|
205
|
+
创建/细化 Issue
|
|
206
|
+
↓
|
|
207
|
+
Engineer (Investigate → Code → Test → Submit)
|
|
208
|
+
↓
|
|
209
|
+
Reviewer (Review → Approve/Reject)
|
|
210
|
+
↓
|
|
211
|
+
[如需要] → 返回 Planner 重新规划
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 协作接口
|
|
215
|
+
|
|
216
|
+
**Planner → Engineer**:
|
|
217
|
+
- 输出: 细化的 Issue + 架构设计文档
|
|
218
|
+
- 格式: Issue 描述中包含 "## Implementation Guide" 章节
|
|
219
|
+
- 标记: Issue 标记为 `ready_for_dev`
|
|
220
|
+
|
|
221
|
+
**Engineer → Planner**:
|
|
222
|
+
- 触发: Engineer 发现需求不清或架构问题
|
|
223
|
+
- 动作: 标记 Issue 为 `needs_refine`,Planner 重新介入
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 使用方式
|
|
228
|
+
|
|
229
|
+
### 手动触发
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# 以 Planner 角色运行
|
|
233
|
+
monoco agent run --role Planner --input Issues/Features/open/FEAT-XXXX.md
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 自动触发
|
|
237
|
+
|
|
238
|
+
当满足以下条件时自动触发:
|
|
239
|
+
1. 新 Memo 创建且包含 `#plan` 标签
|
|
240
|
+
2. Issue 被标记为 `needs_refine`
|
|
241
|
+
3. Epic 创建后需要分解为 Features
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 最佳实践
|
|
246
|
+
|
|
247
|
+
1. **Evidence Based**: 所有架构决策必须有代码或文档证据支持
|
|
248
|
+
2. **Incremental Design**: 优先采用增量式设计,避免过度设计
|
|
249
|
+
3. **Clear Boundaries**: 明确模块边界和接口契约
|
|
250
|
+
4. **Document First**: 先写设计文档,再创建实现任务
|
|
251
|
+
5. **Review Loop**: 复杂设计应经过 Review 后再交接
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 相关资源
|
|
256
|
+
|
|
257
|
+
- Role 定义: `monoco/features/agent/resources/roles/planner.yaml`
|
|
258
|
+
- Engineer Flow: `.agent/skills/flow_engineer/SKILL.md`
|
|
259
|
+
- Reviewer Flow: `.agent/skills/flow_reviewer/SKILL.md`
|