monoco-toolkit 0.3.11__py3-none-any.whl → 0.4.0__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/automation/__init__.py +40 -0
- monoco/core/automation/field_watcher.py +296 -0
- monoco/core/automation/handlers.py +805 -0
- monoco/core/config.py +29 -11
- monoco/core/daemon/__init__.py +5 -0
- monoco/core/daemon/pid.py +290 -0
- monoco/core/git.py +15 -0
- monoco/core/hooks/context.py +74 -13
- monoco/core/injection.py +86 -8
- monoco/core/integrations.py +0 -24
- monoco/core/router/__init__.py +17 -0
- monoco/core/router/action.py +202 -0
- monoco/core/scheduler/__init__.py +63 -0
- monoco/core/scheduler/base.py +152 -0
- monoco/core/scheduler/engines.py +175 -0
- monoco/core/scheduler/events.py +197 -0
- monoco/core/scheduler/local.py +377 -0
- monoco/core/setup.py +9 -0
- monoco/core/sync.py +199 -4
- monoco/core/watcher/__init__.py +63 -0
- monoco/core/watcher/base.py +382 -0
- monoco/core/watcher/dropzone.py +152 -0
- monoco/core/watcher/im.py +460 -0
- monoco/core/watcher/issue.py +303 -0
- monoco/core/watcher/memo.py +192 -0
- monoco/core/watcher/task.py +238 -0
- monoco/daemon/app.py +3 -60
- monoco/daemon/commands.py +459 -25
- monoco/daemon/events.py +34 -0
- monoco/daemon/scheduler.py +157 -201
- monoco/daemon/services.py +42 -243
- monoco/features/agent/__init__.py +25 -7
- monoco/features/agent/cli.py +91 -57
- monoco/features/agent/engines.py +31 -170
- monoco/features/agent/resources/en/AGENTS.md +14 -14
- monoco/features/agent/resources/en/skills/monoco_role_engineer/SKILL.md +101 -0
- monoco/features/agent/resources/en/skills/monoco_role_manager/SKILL.md +95 -0
- monoco/features/agent/resources/en/skills/monoco_role_planner/SKILL.md +177 -0
- monoco/features/agent/resources/en/skills/monoco_role_reviewer/SKILL.md +139 -0
- monoco/features/agent/resources/zh/skills/monoco_role_engineer/SKILL.md +101 -0
- monoco/features/agent/resources/zh/skills/monoco_role_manager/SKILL.md +95 -0
- monoco/features/agent/resources/zh/skills/monoco_role_planner/SKILL.md +177 -0
- monoco/features/agent/resources/zh/skills/monoco_role_reviewer/SKILL.md +139 -0
- monoco/features/agent/worker.py +1 -1
- monoco/features/hooks/__init__.py +61 -6
- monoco/features/hooks/commands.py +281 -271
- monoco/features/hooks/dispatchers/__init__.py +23 -0
- monoco/features/hooks/dispatchers/agent_dispatcher.py +486 -0
- monoco/features/hooks/dispatchers/git_dispatcher.py +478 -0
- monoco/features/hooks/manager.py +357 -0
- monoco/features/hooks/models.py +262 -0
- monoco/features/hooks/parser.py +322 -0
- monoco/features/hooks/universal_interceptor.py +503 -0
- monoco/features/im/__init__.py +67 -0
- monoco/features/im/core.py +782 -0
- monoco/features/im/models.py +311 -0
- monoco/features/issue/commands.py +133 -60
- monoco/features/issue/core.py +385 -40
- monoco/features/issue/domain_commands.py +0 -19
- monoco/features/issue/resources/en/AGENTS.md +17 -122
- monoco/features/issue/resources/hooks/agent/before-tool.sh +102 -0
- monoco/features/issue/resources/hooks/agent/session-start.sh +88 -0
- monoco/features/issue/resources/hooks/{post-checkout.sh → git/git-post-checkout.sh} +10 -9
- monoco/features/issue/resources/hooks/git/git-pre-commit.sh +31 -0
- monoco/features/issue/resources/hooks/{pre-push.sh → git/git-pre-push.sh} +7 -13
- monoco/features/issue/resources/zh/AGENTS.md +18 -123
- monoco/features/memo/cli.py +15 -64
- monoco/features/memo/core.py +6 -34
- monoco/features/memo/models.py +24 -15
- monoco/features/memo/resources/en/AGENTS.md +31 -0
- monoco/features/memo/resources/zh/AGENTS.md +28 -5
- monoco/features/spike/commands.py +5 -3
- monoco/main.py +5 -3
- {monoco_toolkit-0.3.11.dist-info → monoco_toolkit-0.4.0.dist-info}/METADATA +1 -1
- monoco_toolkit-0.4.0.dist-info/RECORD +170 -0
- monoco/core/execution.py +0 -67
- monoco/features/agent/apoptosis.py +0 -44
- monoco/features/agent/manager.py +0 -127
- monoco/features/agent/resources/atoms/atom-code-dev.yaml +0 -61
- monoco/features/agent/resources/atoms/atom-issue-lifecycle.yaml +0 -73
- monoco/features/agent/resources/atoms/atom-knowledge.yaml +0 -55
- monoco/features/agent/resources/atoms/atom-review.yaml +0 -60
- monoco/features/agent/resources/en/skills/monoco_atom_core/SKILL.md +0 -99
- monoco/features/agent/resources/en/skills/monoco_workflow_agent_engineer/SKILL.md +0 -94
- monoco/features/agent/resources/en/skills/monoco_workflow_agent_manager/SKILL.md +0 -93
- monoco/features/agent/resources/en/skills/monoco_workflow_agent_planner/SKILL.md +0 -85
- monoco/features/agent/resources/en/skills/monoco_workflow_agent_reviewer/SKILL.md +0 -114
- monoco/features/agent/resources/workflows/workflow-dev.yaml +0 -83
- monoco/features/agent/resources/workflows/workflow-issue-create.yaml +0 -72
- monoco/features/agent/resources/workflows/workflow-review.yaml +0 -94
- monoco/features/agent/resources/zh/roles/monoco_role_engineer.yaml +0 -49
- monoco/features/agent/resources/zh/roles/monoco_role_manager.yaml +0 -46
- monoco/features/agent/resources/zh/roles/monoco_role_planner.yaml +0 -46
- monoco/features/agent/resources/zh/roles/monoco_role_reviewer.yaml +0 -47
- monoco/features/agent/resources/zh/skills/monoco_atom_core/SKILL.md +0 -99
- monoco/features/agent/resources/zh/skills/monoco_workflow_agent_engineer/SKILL.md +0 -94
- monoco/features/agent/resources/zh/skills/monoco_workflow_agent_manager/SKILL.md +0 -88
- monoco/features/agent/resources/zh/skills/monoco_workflow_agent_planner/SKILL.md +0 -259
- monoco/features/agent/resources/zh/skills/monoco_workflow_agent_reviewer/SKILL.md +0 -137
- monoco/features/agent/session.py +0 -169
- monoco/features/artifact/resources/zh/skills/monoco_atom_artifact/SKILL.md +0 -278
- monoco/features/glossary/resources/en/skills/monoco_atom_glossary/SKILL.md +0 -35
- monoco/features/glossary/resources/zh/skills/monoco_atom_glossary/SKILL.md +0 -35
- monoco/features/hooks/adapter.py +0 -67
- monoco/features/hooks/core.py +0 -441
- monoco/features/i18n/resources/en/skills/monoco_atom_i18n/SKILL.md +0 -96
- monoco/features/i18n/resources/en/skills/monoco_workflow_i18n_scan/SKILL.md +0 -105
- monoco/features/i18n/resources/zh/skills/monoco_atom_i18n/SKILL.md +0 -96
- monoco/features/i18n/resources/zh/skills/monoco_workflow_i18n_scan/SKILL.md +0 -105
- monoco/features/issue/resources/en/skills/monoco_atom_issue/SKILL.md +0 -165
- monoco/features/issue/resources/en/skills/monoco_workflow_issue_creation/SKILL.md +0 -167
- monoco/features/issue/resources/en/skills/monoco_workflow_issue_development/SKILL.md +0 -224
- monoco/features/issue/resources/en/skills/monoco_workflow_issue_management/SKILL.md +0 -159
- monoco/features/issue/resources/en/skills/monoco_workflow_issue_refinement/SKILL.md +0 -203
- monoco/features/issue/resources/hooks/pre-commit.sh +0 -41
- monoco/features/issue/resources/zh/skills/monoco_atom_issue_lifecycle/SKILL.md +0 -190
- monoco/features/issue/resources/zh/skills/monoco_workflow_issue_creation/SKILL.md +0 -167
- monoco/features/issue/resources/zh/skills/monoco_workflow_issue_development/SKILL.md +0 -224
- monoco/features/issue/resources/zh/skills/monoco_workflow_issue_management/SKILL.md +0 -159
- monoco/features/issue/resources/zh/skills/monoco_workflow_issue_refinement/SKILL.md +0 -203
- monoco/features/memo/resources/en/skills/monoco_atom_memo/SKILL.md +0 -77
- monoco/features/memo/resources/en/skills/monoco_workflow_note_processing/SKILL.md +0 -140
- monoco/features/memo/resources/zh/skills/monoco_atom_memo/SKILL.md +0 -77
- monoco/features/memo/resources/zh/skills/monoco_workflow_note_processing/SKILL.md +0 -140
- monoco/features/spike/resources/en/skills/monoco_atom_spike/SKILL.md +0 -76
- monoco/features/spike/resources/en/skills/monoco_workflow_research/SKILL.md +0 -121
- monoco/features/spike/resources/zh/skills/monoco_atom_spike/SKILL.md +0 -76
- monoco/features/spike/resources/zh/skills/monoco_workflow_research/SKILL.md +0 -121
- monoco_toolkit-0.3.11.dist-info/RECORD +0 -181
- {monoco_toolkit-0.3.11.dist-info → monoco_toolkit-0.4.0.dist-info}/WHEEL +0 -0
- {monoco_toolkit-0.3.11.dist-info → monoco_toolkit-0.4.0.dist-info}/entry_points.txt +0 -0
- {monoco_toolkit-0.3.11.dist-info → monoco_toolkit-0.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from .manager import SessionManager
|
|
2
|
-
from .models import RoleTemplate
|
|
3
|
-
|
|
4
|
-
class ApoptosisManager:
|
|
5
|
-
"""
|
|
6
|
-
Manages the controlled shutdown (Apoptosis) and investigation (Autopsy)
|
|
7
|
-
of failed agent sessions.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
def __init__(self, session_manager: SessionManager):
|
|
11
|
-
self.session_manager = session_manager
|
|
12
|
-
|
|
13
|
-
def trigger_apoptosis(self, session_id: str, failure_reason: str = "Unknown") -> None:
|
|
14
|
-
"""
|
|
15
|
-
Trigger the apoptosis process for a given session.
|
|
16
|
-
1. Mark session as crashed.
|
|
17
|
-
2. Spin up a Coroner agent to diagnose.
|
|
18
|
-
"""
|
|
19
|
-
session = self.session_manager.get_session(session_id)
|
|
20
|
-
if not session:
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
# 1. Mark as crashed
|
|
24
|
-
session.model.status = "crashed"
|
|
25
|
-
|
|
26
|
-
# 2. Start Coroner
|
|
27
|
-
self._perform_autopsy(session, failure_reason)
|
|
28
|
-
|
|
29
|
-
def _perform_autopsy(self, victim_session, failure_reason: str):
|
|
30
|
-
coroner_role = RoleTemplate(
|
|
31
|
-
name="Coroner",
|
|
32
|
-
description="Investigates cause of death for failed agents.",
|
|
33
|
-
trigger="system.crash",
|
|
34
|
-
goal=f"Determine why the previous agent failed. Reason: {failure_reason}",
|
|
35
|
-
system_prompt="You are the Coroner. Analyze the logs.",
|
|
36
|
-
engine="gemini"
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
coroner_session = self.session_manager.create_session(
|
|
40
|
-
issue_id=victim_session.model.issue_id,
|
|
41
|
-
role=coroner_role
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
coroner_session.start()
|
monoco/features/agent/manager.py
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
from typing import Dict, List, Optional
|
|
2
|
-
import uuid
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
from .models import RoleTemplate
|
|
6
|
-
from .worker import Worker
|
|
7
|
-
from .session import Session, RuntimeSession
|
|
8
|
-
from monoco.core.hooks import HookRegistry, get_registry
|
|
9
|
-
from monoco.core.config import find_monoco_root, MonocoConfig
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class SessionManager:
|
|
13
|
-
"""
|
|
14
|
-
Manages the lifecycle of sessions.
|
|
15
|
-
Responsible for creating, tracking, and retrieving sessions.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
def __init__(
|
|
19
|
-
self,
|
|
20
|
-
project_root: Optional[Path] = None,
|
|
21
|
-
hook_registry: Optional[HookRegistry] = None,
|
|
22
|
-
config: Optional[MonocoConfig] = None,
|
|
23
|
-
):
|
|
24
|
-
# In-memory storage for now. In prod, this might be a DB or file-backed.
|
|
25
|
-
self._sessions: Dict[str, RuntimeSession] = {}
|
|
26
|
-
self.project_root = project_root or find_monoco_root()
|
|
27
|
-
self.config = config
|
|
28
|
-
|
|
29
|
-
self.sessions_dir = self.project_root / ".monoco" / "sessions"
|
|
30
|
-
self.sessions_dir.mkdir(parents=True, exist_ok=True)
|
|
31
|
-
|
|
32
|
-
# Initialize hook registry
|
|
33
|
-
self.hook_registry = hook_registry or get_registry()
|
|
34
|
-
|
|
35
|
-
# Load hooks from config if available
|
|
36
|
-
self._load_hooks_from_config()
|
|
37
|
-
|
|
38
|
-
# Load persisted sessions
|
|
39
|
-
self._load_sessions()
|
|
40
|
-
|
|
41
|
-
def _load_sessions(self):
|
|
42
|
-
"""Load sessions from disk."""
|
|
43
|
-
import json
|
|
44
|
-
|
|
45
|
-
for session_file in self.sessions_dir.glob("*.json"):
|
|
46
|
-
try:
|
|
47
|
-
data = json.loads(session_file.read_text())
|
|
48
|
-
session_model = Session(**data)
|
|
49
|
-
# Rehydrate as Observer
|
|
50
|
-
runtime = RuntimeSession(
|
|
51
|
-
session_model,
|
|
52
|
-
worker=None, # No worker for loaded sessions initially (Observer mode)
|
|
53
|
-
hook_registry=self.hook_registry,
|
|
54
|
-
project_root=self.project_root,
|
|
55
|
-
save_callback=self._save_session,
|
|
56
|
-
)
|
|
57
|
-
self._sessions[session_model.id] = runtime
|
|
58
|
-
# Check status immediately to see if it's still running
|
|
59
|
-
runtime.refresh_status()
|
|
60
|
-
except Exception as e:
|
|
61
|
-
print(f"Failed to load session {session_file}: {e}")
|
|
62
|
-
|
|
63
|
-
def _save_session(self, session: Session):
|
|
64
|
-
"""Save session to disk."""
|
|
65
|
-
file_path = self.sessions_dir / f"{session.id}.json"
|
|
66
|
-
file_path.write_text(session.model_dump_json(indent=2))
|
|
67
|
-
|
|
68
|
-
def _load_hooks_from_config(self) -> None:
|
|
69
|
-
"""Load and register hooks from configuration."""
|
|
70
|
-
if self.config is None:
|
|
71
|
-
try:
|
|
72
|
-
from monoco.core.config import get_config
|
|
73
|
-
|
|
74
|
-
self.config = get_config(str(self.project_root))
|
|
75
|
-
except Exception:
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
# Load hooks from config
|
|
79
|
-
if self.config and hasattr(self.config, "session_hooks"):
|
|
80
|
-
hooks_config = self.config.session_hooks
|
|
81
|
-
if hooks_config:
|
|
82
|
-
self.hook_registry.load_from_config(hooks_config, self.project_root)
|
|
83
|
-
|
|
84
|
-
def create_session(self, issue_id: str, role: RoleTemplate) -> RuntimeSession:
|
|
85
|
-
session_id = str(uuid.uuid4())
|
|
86
|
-
branch_name = (
|
|
87
|
-
f"agent/{issue_id}/{session_id[:8]}" # Simple branch naming strategy
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
session_model = Session(
|
|
91
|
-
id=session_id,
|
|
92
|
-
issue_id=issue_id,
|
|
93
|
-
role_name=role.name,
|
|
94
|
-
branch_name=branch_name,
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
# Get timeout from config
|
|
98
|
-
timeout = 900
|
|
99
|
-
if self.config and hasattr(self.config, "agent"):
|
|
100
|
-
timeout = self.config.agent.timeout_seconds
|
|
101
|
-
|
|
102
|
-
worker = Worker(role, issue_id, timeout=timeout)
|
|
103
|
-
runtime = RuntimeSession(
|
|
104
|
-
session_model,
|
|
105
|
-
worker,
|
|
106
|
-
hook_registry=self.hook_registry,
|
|
107
|
-
project_root=self.project_root,
|
|
108
|
-
save_callback=self._save_session,
|
|
109
|
-
)
|
|
110
|
-
self._sessions[session_id] = runtime
|
|
111
|
-
self._save_session(session_model)
|
|
112
|
-
return runtime
|
|
113
|
-
|
|
114
|
-
def get_session(self, session_id: str) -> Optional[RuntimeSession]:
|
|
115
|
-
return self._sessions.get(session_id)
|
|
116
|
-
|
|
117
|
-
def list_sessions(self, issue_id: Optional[str] = None) -> List[RuntimeSession]:
|
|
118
|
-
if issue_id:
|
|
119
|
-
return [s for s in self._sessions.values() if s.model.issue_id == issue_id]
|
|
120
|
-
return list(self._sessions.values())
|
|
121
|
-
|
|
122
|
-
def terminate_session(self, session_id: str):
|
|
123
|
-
session = self.get_session(session_id)
|
|
124
|
-
if session:
|
|
125
|
-
session.terminate()
|
|
126
|
-
# We keep the record for history
|
|
127
|
-
# del self._sessions[session_id]
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: atom-code-dev
|
|
3
|
-
type: atom
|
|
4
|
-
domain: code
|
|
5
|
-
description: 代码开发的原子操作 - 调研、实现、测试、文档
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
author: Monoco Toolkit
|
|
8
|
-
|
|
9
|
-
# 系统级合规规则
|
|
10
|
-
compliance_rules:
|
|
11
|
-
- rule: "遵循项目代码规范"
|
|
12
|
-
severity: warning
|
|
13
|
-
|
|
14
|
-
- rule: "优先编写测试"
|
|
15
|
-
severity: warning
|
|
16
|
-
mindset: "TDD"
|
|
17
|
-
|
|
18
|
-
- rule: "保持代码简单直观"
|
|
19
|
-
severity: info
|
|
20
|
-
mindset: "KISS"
|
|
21
|
-
|
|
22
|
-
# 原子操作定义
|
|
23
|
-
operations:
|
|
24
|
-
- name: investigate
|
|
25
|
-
description: 理解需求与上下文,识别相关代码和依赖
|
|
26
|
-
reminder: "理解需求后再开始编码,识别相关文件和依赖 Issue"
|
|
27
|
-
checkpoints:
|
|
28
|
-
- "阅读并理解 Issue 描述"
|
|
29
|
-
- "识别相关代码文件"
|
|
30
|
-
- "检查依赖 Issue 状态"
|
|
31
|
-
- "评估技术可行性"
|
|
32
|
-
output: "技术方案草稿、风险清单"
|
|
33
|
-
|
|
34
|
-
- name: implement
|
|
35
|
-
description: 实现代码变更
|
|
36
|
-
reminder: "遵循项目代码规范,小步提交,处理边界情况"
|
|
37
|
-
checkpoints:
|
|
38
|
-
- "遵循项目代码规范"
|
|
39
|
-
- "编写/更新必要的文档"
|
|
40
|
-
- "处理边界情况"
|
|
41
|
-
- "保持代码可审查性(单次提交 < 400 行)"
|
|
42
|
-
|
|
43
|
-
- name: test
|
|
44
|
-
description: 运行测试确保代码质量
|
|
45
|
-
reminder: "所有测试必须通过,检查测试覆盖率"
|
|
46
|
-
checkpoints:
|
|
47
|
-
- "编写/更新单元测试"
|
|
48
|
-
- "运行测试套件 (pytest, cargo test, etc.)"
|
|
49
|
-
- "修复失败的测试"
|
|
50
|
-
- "检查测试覆盖率"
|
|
51
|
-
compliance_rules:
|
|
52
|
-
- rule: "所有单元测试必须通过后才能提交"
|
|
53
|
-
severity: error
|
|
54
|
-
|
|
55
|
-
- name: document
|
|
56
|
-
description: 更新文档
|
|
57
|
-
reminder: "代码变更必须同步更新文档"
|
|
58
|
-
checkpoints:
|
|
59
|
-
- "更新代码注释"
|
|
60
|
-
- "更新相关文档"
|
|
61
|
-
- "更新 CHANGELOG(如适用)"
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: atom-issue-lifecycle
|
|
3
|
-
type: atom
|
|
4
|
-
domain: issue
|
|
5
|
-
description: Issue 生命周期管理的原子操作 - 创建、启动、提交、关闭工作单元
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
author: Monoco Toolkit
|
|
8
|
-
|
|
9
|
-
# 系统级合规规则(定义一次,全局生效)
|
|
10
|
-
compliance_rules:
|
|
11
|
-
- rule: "禁止在 main/master 分支直接修改代码"
|
|
12
|
-
severity: error
|
|
13
|
-
check: "git branch --show-current"
|
|
14
|
-
fail_if: "main|master"
|
|
15
|
-
|
|
16
|
-
- rule: "必须使用 feature 分支进行开发"
|
|
17
|
-
severity: error
|
|
18
|
-
command: "monoco issue start <ID> --branch"
|
|
19
|
-
|
|
20
|
-
- rule: "提交前必须通过 lint 检查"
|
|
21
|
-
severity: error
|
|
22
|
-
command: "monoco issue lint"
|
|
23
|
-
|
|
24
|
-
- rule: "每个 Issue 必须至少包含 2 个 Checkbox"
|
|
25
|
-
severity: error
|
|
26
|
-
check: "checkbox_count >= 2"
|
|
27
|
-
|
|
28
|
-
- rule: "Review/Done 阶段必须包含 Review Comments"
|
|
29
|
-
severity: warning
|
|
30
|
-
check: "review_comments_section exists"
|
|
31
|
-
|
|
32
|
-
# 原子操作定义
|
|
33
|
-
operations:
|
|
34
|
-
- name: create
|
|
35
|
-
description: 创建新的 Issue 工作单元
|
|
36
|
-
command: "monoco issue create <type> -t <title>"
|
|
37
|
-
reminder: "选择合适的类型 (epic/feature/chore/fix),编写清晰的描述"
|
|
38
|
-
checkpoints:
|
|
39
|
-
- "必须包含至少 2 个 Checkbox"
|
|
40
|
-
- "标题必须与 Front Matter 一致"
|
|
41
|
-
|
|
42
|
-
- name: start
|
|
43
|
-
description: 启动开发,创建功能分支
|
|
44
|
-
command: "monoco issue start <ID> --branch"
|
|
45
|
-
reminder: "确保使用 --branch 创建功能分支,禁止在 main/master 上开发"
|
|
46
|
-
checkpoints:
|
|
47
|
-
- "禁止在 main/master 分支直接修改代码"
|
|
48
|
-
- "必须创建 feature 分支"
|
|
49
|
-
|
|
50
|
-
- name: sync
|
|
51
|
-
description: 同步文件追踪,记录修改的文件
|
|
52
|
-
command: "monoco issue sync-files"
|
|
53
|
-
reminder: "定期同步文件追踪,保持 Issue 与代码变更同步"
|
|
54
|
-
|
|
55
|
-
- name: lint
|
|
56
|
-
description: 检查 Issue 合规性
|
|
57
|
-
command: "monoco issue lint"
|
|
58
|
-
reminder: "提交前必须运行 lint 检查"
|
|
59
|
-
checkpoints:
|
|
60
|
-
- "必须通过所有合规检查"
|
|
61
|
-
|
|
62
|
-
- name: submit
|
|
63
|
-
description: 提交代码进行评审
|
|
64
|
-
command: "monoco issue submit <ID>"
|
|
65
|
-
reminder: "确保所有测试通过,lint 无错误后再提交"
|
|
66
|
-
checkpoints:
|
|
67
|
-
- "所有单元测试必须通过"
|
|
68
|
-
- "必须通过 lint 检查"
|
|
69
|
-
|
|
70
|
-
- name: close
|
|
71
|
-
description: 关闭 Issue,清理环境
|
|
72
|
-
command: "monoco issue close <ID> --solution completed --prune"
|
|
73
|
-
reminder: "代码合并后及时关闭 Issue,清理 feature 分支"
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: atom-knowledge
|
|
3
|
-
type: atom
|
|
4
|
-
domain: knowledge
|
|
5
|
-
description: 知识管理的原子操作 - 捕获、处理、转化、归档
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
author: Monoco Toolkit
|
|
8
|
-
|
|
9
|
-
# 系统级合规规则
|
|
10
|
-
compliance_rules:
|
|
11
|
-
- rule: "Memo 是临时的,不应无限堆积"
|
|
12
|
-
severity: warning
|
|
13
|
-
|
|
14
|
-
- rule: "可执行的想法必须转为 Issue 追踪"
|
|
15
|
-
severity: error
|
|
16
|
-
|
|
17
|
-
# 原子操作定义
|
|
18
|
-
operations:
|
|
19
|
-
- name: capture
|
|
20
|
-
description: 快速捕获 fleeting ideas
|
|
21
|
-
command: "monoco memo add <content>"
|
|
22
|
-
reminder: "保持简洁,不中断当前工作流,添加上下文"
|
|
23
|
-
checkpoints:
|
|
24
|
-
- "使用简洁的描述"
|
|
25
|
-
- "添加上下文(-c file:line 如适用)"
|
|
26
|
-
- "不中断当前任务流"
|
|
27
|
-
|
|
28
|
-
- name: process
|
|
29
|
-
description: 定期处理 Memo,评估价值
|
|
30
|
-
command: "monoco memo list"
|
|
31
|
-
reminder: "定期回顾和分类 Memo(建议每周)"
|
|
32
|
-
checkpoints:
|
|
33
|
-
- "运行 monoco memo list 查看所有 Memo"
|
|
34
|
-
- "评估每个 Memo 的价值"
|
|
35
|
-
- "分类:可执行 / 纯参考 / 无价值"
|
|
36
|
-
|
|
37
|
-
- name: convert
|
|
38
|
-
description: 将可执行的 Memo 转化为 Issue
|
|
39
|
-
command: "monoco issue create <type> -t <title>"
|
|
40
|
-
reminder: "有价值的想法尽快转为 Issue"
|
|
41
|
-
checkpoints:
|
|
42
|
-
- "判断 Issue 类型 (feature/chore/fix)"
|
|
43
|
-
- "编写清晰的描述和验收标准"
|
|
44
|
-
- "关联原始 Memo"
|
|
45
|
-
compliance_rules:
|
|
46
|
-
- rule: "可执行的想法必须转为 Issue 追踪"
|
|
47
|
-
severity: error
|
|
48
|
-
|
|
49
|
-
- name: archive
|
|
50
|
-
description: 归档纯参考资料
|
|
51
|
-
reminder: "纯参考资料归档保存,无价值的直接删除"
|
|
52
|
-
checkpoints:
|
|
53
|
-
- "确认 Memo 内容为纯参考资料"
|
|
54
|
-
- "移动到知识库或文档"
|
|
55
|
-
- "从 Memo 列表中移除"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: atom-review
|
|
3
|
-
type: atom
|
|
4
|
-
domain: review
|
|
5
|
-
description: 代码评审的原子操作 - 检出、验证、对抗、反馈
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
author: Monoco Toolkit
|
|
8
|
-
|
|
9
|
-
# 系统级合规规则
|
|
10
|
-
compliance_rules:
|
|
11
|
-
- rule: "必须先通过 Engineer 的测试 (Verify),再进行对抗测试 (Challenge)"
|
|
12
|
-
severity: error
|
|
13
|
-
|
|
14
|
-
- rule: "必须尝试编写至少一个边界测试用例"
|
|
15
|
-
severity: warning
|
|
16
|
-
|
|
17
|
-
- rule: "禁止未经测试直接 Approve"
|
|
18
|
-
severity: error
|
|
19
|
-
|
|
20
|
-
# 原子操作定义
|
|
21
|
-
operations:
|
|
22
|
-
- name: checkout
|
|
23
|
-
description: 检出待评审的代码
|
|
24
|
-
reminder: "获取待评审的 PR/Branch,确认与 Base 分支的差异"
|
|
25
|
-
checkpoints:
|
|
26
|
-
- "检出 PR/Branch"
|
|
27
|
-
- "确认与 Base 分支的差异"
|
|
28
|
-
- "检查环境配置"
|
|
29
|
-
|
|
30
|
-
- name: verify
|
|
31
|
-
description: 验证 Engineer 提交的测试 (White-box)
|
|
32
|
-
reminder: "先运行 Engineer 编写的测试,验证功能正确性"
|
|
33
|
-
checkpoints:
|
|
34
|
-
- "运行 Engineer 编写的单元测试"
|
|
35
|
-
- "运行集成测试(如适用)"
|
|
36
|
-
- "检查测试覆盖率报告"
|
|
37
|
-
compliance_rules:
|
|
38
|
-
- rule: "如果现有测试失败,直接进入 Reject 流程"
|
|
39
|
-
severity: error
|
|
40
|
-
|
|
41
|
-
- name: challenge
|
|
42
|
-
description: 对抗测试,尝试破坏代码 (Black-box / Edge Cases)
|
|
43
|
-
reminder: "Try to break it - 寻找边界情况和安全漏洞"
|
|
44
|
-
checkpoints:
|
|
45
|
-
- "分析代码逻辑,寻找盲区(并发、大/小数值、注入攻击等)"
|
|
46
|
-
- "编写新的 Challenge Test Cases"
|
|
47
|
-
- "运行这些新测试"
|
|
48
|
-
compliance_rules:
|
|
49
|
-
- rule: "必须尝试编写至少一个边界测试用例"
|
|
50
|
-
severity: warning
|
|
51
|
-
|
|
52
|
-
- name: feedback
|
|
53
|
-
description: 提供评审反馈
|
|
54
|
-
reminder: "明确批准、拒绝或请求修改,提供具体反馈"
|
|
55
|
-
checkpoints:
|
|
56
|
-
- "功能是否正确实现"
|
|
57
|
-
- "代码是否符合设计规范"
|
|
58
|
-
- "测试是否充分"
|
|
59
|
-
- "文档是否同步更新"
|
|
60
|
-
- "是否遵循项目规范"
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: monoco_atom_core
|
|
3
|
-
description: Core skill for Monoco Toolkit. Provides essential commands for project initialization, configuration, and workspace management.
|
|
4
|
-
type: atom
|
|
5
|
-
version: 1.0.0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Monoco Core
|
|
9
|
-
|
|
10
|
-
Core functionality and commands for the Monoco Toolkit.
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
Monoco is a developer productivity toolkit that provides:
|
|
15
|
-
|
|
16
|
-
- **Project initialization** with standardized structure
|
|
17
|
-
- **Configuration management** at global and project levels
|
|
18
|
-
- **Workspace management** for multi-project setups
|
|
19
|
-
|
|
20
|
-
## Key Commands
|
|
21
|
-
|
|
22
|
-
### Project Setup
|
|
23
|
-
|
|
24
|
-
- **`monoco init`**: Initialize a new Monoco project
|
|
25
|
-
- Creates `.monoco/` directory with default configuration
|
|
26
|
-
- Sets up project structure (Issues/, .references/, etc.)
|
|
27
|
-
- Generates initial documentation
|
|
28
|
-
|
|
29
|
-
### Configuration
|
|
30
|
-
|
|
31
|
-
- **`monoco config`**: Manage configuration
|
|
32
|
-
- `monoco config get <key>`: View configuration value
|
|
33
|
-
- `monoco config set <key> <value>`: Update configuration
|
|
34
|
-
- Supports both global (`~/.monoco/config.yaml`) and project (`.monoco/config.yaml`) scopes
|
|
35
|
-
|
|
36
|
-
### Agent Integration
|
|
37
|
-
|
|
38
|
-
- **`monoco sync`**: Synchronize with agent environments
|
|
39
|
-
- Injects system prompts into agent configuration files (GEMINI.md, CLAUDE.md, etc.)
|
|
40
|
-
- Distributes skills to agent framework directories
|
|
41
|
-
- Respects language configuration from `i18n.source_lang`
|
|
42
|
-
|
|
43
|
-
- **`monoco uninstall`**: Clean up agent integrations
|
|
44
|
-
- Removes managed blocks from agent configuration files
|
|
45
|
-
- Cleans up distributed skills
|
|
46
|
-
|
|
47
|
-
### Git Workflow Integration
|
|
48
|
-
|
|
49
|
-
Monoco enforces a **Feature Branch Workflow** to ensure code isolation and quality:
|
|
50
|
-
|
|
51
|
-
- **`monoco init`**: Automatically installs Git Hooks
|
|
52
|
-
- **pre-commit**: Runs Issue Linter and code formatting checks
|
|
53
|
-
- **pre-push**: Executes test suite and integrity validation
|
|
54
|
-
- All hooks configurable via `.monoco/config.yaml`
|
|
55
|
-
|
|
56
|
-
- **Branch Isolation Strategy**:
|
|
57
|
-
- ⚠️ **Required**: Use `monoco issue start <ID> --branch` to create isolated environment
|
|
58
|
-
- Auto-generates normalized branch names: `feat/<id>-<slug>`
|
|
59
|
-
- **Main Protection**: Linter blocks direct code modifications on `main`/`master` branches
|
|
60
|
-
|
|
61
|
-
- **File Tracking**: `monoco issue sync-files` auto-syncs Git changes to Issue metadata
|
|
62
|
-
|
|
63
|
-
> 📖 **Detailed Workflow**: See `monoco-issue` skill for complete Issue lifecycle management guide.
|
|
64
|
-
|
|
65
|
-
## Configuration Structure
|
|
66
|
-
|
|
67
|
-
Configuration is stored in YAML format at:
|
|
68
|
-
|
|
69
|
-
- **Global**: `~/.monoco/config.yaml`
|
|
70
|
-
- **Project**: `.monoco/config.yaml`
|
|
71
|
-
|
|
72
|
-
Key configuration sections:
|
|
73
|
-
|
|
74
|
-
- `core`: Log level, author
|
|
75
|
-
- `paths`: Directory paths (issues, spikes, specs)
|
|
76
|
-
- `project`: Project metadata, spike repos, workspace members
|
|
77
|
-
- `i18n`: Internationalization settings
|
|
78
|
-
- `agent`: Agent framework integration settings
|
|
79
|
-
|
|
80
|
-
## Best Practices
|
|
81
|
-
|
|
82
|
-
### Basic Operations
|
|
83
|
-
|
|
84
|
-
1. **Use CLI commands** instead of manual file editing when possible
|
|
85
|
-
2. **Run `monoco sync`** after configuration changes to update agent environments
|
|
86
|
-
3. **Commit `.monoco/config.yaml`** to version control for team consistency
|
|
87
|
-
4. **Keep global config minimal** - most settings should be project-specific
|
|
88
|
-
|
|
89
|
-
### Git Workflow (⚠️ CRITICAL for Agents)
|
|
90
|
-
|
|
91
|
-
5. **Strictly follow branch isolation**:
|
|
92
|
-
- ✅ Always use: `monoco issue start <ID> --branch`
|
|
93
|
-
- ❌ Never modify code directly on `main`/`master` branches
|
|
94
|
-
- 📝 Before commit: Run `monoco issue sync-files` to update file tracking
|
|
95
|
-
|
|
96
|
-
6. **Quality Gates**:
|
|
97
|
-
- Git Hooks will auto-run checks, don't bypass (`--no-verify`)
|
|
98
|
-
- Ensure `monoco issue lint` passes before committing
|
|
99
|
-
- Use `monoco issue submit` to generate delivery reports
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: monoco_workflow_agent_engineer
|
|
3
|
-
description: Standardized workflow for the Engineer role (Flow Skill). Defines the standard operating procedure from requirement investigation to code submission, ensuring test coverage and code quality.
|
|
4
|
-
type: workflow
|
|
5
|
-
role: engineer
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Engineer Flow
|
|
10
|
-
|
|
11
|
-
Standardized workflow for the Engineer role, ensuring code development follows the "Investigate → Code → Test → Report → Submit" process.
|
|
12
|
-
|
|
13
|
-
## Workflow State Machine
|
|
14
|
-
|
|
15
|
-
```mermaid
|
|
16
|
-
stateDiagram-v2
|
|
17
|
-
[*] --> Investigate: Receive Task
|
|
18
|
-
|
|
19
|
-
Investigate --> Code: Requirements Clear
|
|
20
|
-
Investigate --> Investigate: Requirements Fuzzy<br/>(Request Clarification)
|
|
21
|
-
|
|
22
|
-
Code --> Test: Coding Complete
|
|
23
|
-
|
|
24
|
-
Test --> Test: Test Failed<br/>(Fix Code)
|
|
25
|
-
Test --> Report: Test Passed
|
|
26
|
-
|
|
27
|
-
Report --> Submit: Report Complete
|
|
28
|
-
|
|
29
|
-
Submit --> [*]: Submission Successful
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Execution Steps
|
|
33
|
-
|
|
34
|
-
### 1. Investigate
|
|
35
|
-
|
|
36
|
-
- **Goal**: Fully understand requirements, identify technical risks and dependencies
|
|
37
|
-
- **Input**: Issue description, relevant code, dependent Issues
|
|
38
|
-
- **Output**: Technical solution draft, risk checklist
|
|
39
|
-
- **Checkpoints**:
|
|
40
|
-
- [ ] Read and understand Issue description
|
|
41
|
-
- [ ] Identify relevant code files
|
|
42
|
-
- [ ] Check dependent Issue status
|
|
43
|
-
- [ ] Assess technical feasibility
|
|
44
|
-
|
|
45
|
-
### 2. Code
|
|
46
|
-
|
|
47
|
-
- **Goal**: Implement feature or fix defect
|
|
48
|
-
- **Prerequisites**: Requirements are clear, branch is created (`monoco issue start <ID> --branch`)
|
|
49
|
-
- **Checkpoints**:
|
|
50
|
-
- [ ] Follow project coding standards
|
|
51
|
-
- [ ] Write/update necessary documentation
|
|
52
|
-
- [ ] Handle edge cases
|
|
53
|
-
|
|
54
|
-
### 3. Test
|
|
55
|
-
|
|
56
|
-
- **Goal**: Ensure code quality and functional correctness
|
|
57
|
-
- **Strategy**: Loop testing until passed
|
|
58
|
-
- **Checkpoints**:
|
|
59
|
-
- [ ] Write/update unit tests
|
|
60
|
-
- [ ] Run test suite (`pytest`, `cargo test`, etc.)
|
|
61
|
-
- [ ] Fix failed tests
|
|
62
|
-
- [ ] Check test coverage
|
|
63
|
-
|
|
64
|
-
### 4. Report
|
|
65
|
-
|
|
66
|
-
- **Goal**: Document changes, update Issue status
|
|
67
|
-
- **Checkpoints**:
|
|
68
|
-
- [ ] Update Issue file tracking (`monoco issue sync-files`)
|
|
69
|
-
- [ ] Write change summary
|
|
70
|
-
- [ ] Update task checklist (Checkboxes)
|
|
71
|
-
|
|
72
|
-
### 5. Submit
|
|
73
|
-
|
|
74
|
-
- **Goal**: Complete code submission, enter review process
|
|
75
|
-
- **Checkpoints**:
|
|
76
|
-
- [ ] Run `monoco issue lint` for compliance check
|
|
77
|
-
- [ ] Run `monoco issue submit <ID>`
|
|
78
|
-
- [ ] Wait for review results
|
|
79
|
-
|
|
80
|
-
## Decision Branches
|
|
81
|
-
|
|
82
|
-
| Condition | Action |
|
|
83
|
-
|-----------|--------|
|
|
84
|
-
| Requirements unclear | Return to Investigate, request clarification |
|
|
85
|
-
| Test failed | Return to Code, fix issues |
|
|
86
|
-
| Lint failed | Fix compliance issues, resubmit |
|
|
87
|
-
| Review rejected | Return to Code, modify according to feedback |
|
|
88
|
-
|
|
89
|
-
## Compliance Requirements
|
|
90
|
-
|
|
91
|
-
- **Prohibited**: Skip tests and submit directly
|
|
92
|
-
- **Prohibited**: Modify code directly on main/master branch
|
|
93
|
-
- **Required**: Use `monoco issue start --branch` to create feature branch
|
|
94
|
-
- **Required**: All unit tests must pass before Submit
|