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,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-reviewer
|
|
3
|
+
description: Reviewer 角色的标准化工作流 (Flow Skill)。定义从代码检出、对抗性测试到评审完成的标准操作流程,确保代码质量和流程合规。
|
|
4
|
+
type: flow
|
|
5
|
+
role: reviewer
|
|
6
|
+
version: 1.1.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Reviewer Flow
|
|
10
|
+
|
|
11
|
+
Reviewer 角色的标准化工作流,确保 "Checkout → Verify → Challenge → Review → Decide → Cleanup" 流程。核心理念是**双层防御体系**:Engineer 负责自证 (Verify),Reviewer 负责对抗 (Challenge)。
|
|
12
|
+
|
|
13
|
+
## 工作流状态机
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Checkout: 收到评审请求
|
|
18
|
+
|
|
19
|
+
Checkout --> Verify: 检出完成
|
|
20
|
+
Checkout --> Checkout: 检出失败<br/>(环境检查)
|
|
21
|
+
|
|
22
|
+
Verify --> Challenge: 现有测试通过
|
|
23
|
+
Verify --> Verify: 现有测试失败<br/>(记录问题)
|
|
24
|
+
|
|
25
|
+
Challenge --> Review: 对抗测试完成
|
|
26
|
+
Challenge --> Reject: 发现致命漏洞
|
|
27
|
+
|
|
28
|
+
Review --> Approve: 代码 & 架构 OK
|
|
29
|
+
Review --> Reject: 发现质量问题
|
|
30
|
+
|
|
31
|
+
Reject --> Checkout: 修复后重审
|
|
32
|
+
|
|
33
|
+
Approve --> Cleanup: 批准
|
|
34
|
+
|
|
35
|
+
Cleanup --> [*]: 清理完成
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 执行步骤
|
|
39
|
+
|
|
40
|
+
### 1. Checkout (检出)
|
|
41
|
+
|
|
42
|
+
- **目标**: 获取待评审的代码
|
|
43
|
+
- **检查点**:
|
|
44
|
+
- [ ] 检出 PR/Branch
|
|
45
|
+
- [ ] 确认与 Base 分支的差异
|
|
46
|
+
- [ ] 检查环境配置
|
|
47
|
+
|
|
48
|
+
### 2. Verify (验证)
|
|
49
|
+
|
|
50
|
+
- **目标**: 验证 Engineer 提交的功能正确性和测试覆盖 (White-box)
|
|
51
|
+
- **检查点**:
|
|
52
|
+
- [ ] 运行 **Engineer 编写的** 单元测试
|
|
53
|
+
- [ ] 运行集成测试 (如适用)
|
|
54
|
+
- [ ] 检查测试覆盖率报告
|
|
55
|
+
- [ ] **决策**: 如果现有测试失败,直接进入 `Reject` 流程。
|
|
56
|
+
|
|
57
|
+
### 3. Challenge (对抗测试)
|
|
58
|
+
|
|
59
|
+
- **目标**: 尝试破坏代码,寻找边界情况和安全漏洞 (Black-box / Edge Cases)
|
|
60
|
+
- **思维模式**: "Try to break it"
|
|
61
|
+
- **操作**:
|
|
62
|
+
1. 分析代码逻辑,寻找 Engineer 视角的盲区(并发、大/小数值、注入攻击等)。
|
|
63
|
+
2. 编写新的 **Challenge Test Cases**。
|
|
64
|
+
3. 运行这些新测试。
|
|
65
|
+
- **检查点**:
|
|
66
|
+
- [ ] **漏洞发现**: 如果新测试导致 Crash 或逻辑错误 -> **Reject** (并将测试用例作为反馈)。
|
|
67
|
+
- [ ] **鲁棒性验证**: 如果新测试通过 -> **保留测试用例** (提交到代码库) 并进入下一步。
|
|
68
|
+
|
|
69
|
+
### 4. Review (代码审查)
|
|
70
|
+
|
|
71
|
+
- **目标**: 检查代码质量、架构设计和可维护性
|
|
72
|
+
- **检查清单**:
|
|
73
|
+
- [ ] **功能**: 代码是否实现了需求?
|
|
74
|
+
- [ ] **设计**: 架构是否合理?是否遵循 KISS 原则?
|
|
75
|
+
- [ ] **可读性**: 命名和注释是否清晰?
|
|
76
|
+
- [ ] **文档**: 文档是否同步更新?
|
|
77
|
+
- [ ] **合规**: 是否遵循项目 Lint 规范?
|
|
78
|
+
|
|
79
|
+
### 5. Decide (决策)
|
|
80
|
+
|
|
81
|
+
- **目标**: 做出批准或拒绝的决定
|
|
82
|
+
- **选项**:
|
|
83
|
+
- **Approve**: 代码健壮且符合规范 (包含所有通过的 Challenge Tests)
|
|
84
|
+
- **Reject**: 需要修改,提供具体反馈 (附带失败的 Test Case 或 Log)
|
|
85
|
+
- **Request Changes**: 小问题,可快速修复
|
|
86
|
+
|
|
87
|
+
### 6. Cleanup (清理)
|
|
88
|
+
|
|
89
|
+
- **目标**: 完成评审后的环境清理
|
|
90
|
+
- **检查点**:
|
|
91
|
+
- [ ] 提交新增的测试用例 (如有)
|
|
92
|
+
- [ ] 删除本地临时分支
|
|
93
|
+
- [ ] 更新 Issue 状态
|
|
94
|
+
- [ ] 记录评审意见到 Review Comments
|
|
95
|
+
|
|
96
|
+
## 决策分支
|
|
97
|
+
|
|
98
|
+
| 条件 | 动作 |
|
|
99
|
+
| ------------------------- | --------------------------------------- |
|
|
100
|
+
| 现有测试 (Verify) 失败 | Reject,要求 Engineer 修复 |
|
|
101
|
+
| 对抗测试 (Challenge) 崩溃 | Reject,提交该测试用例证明漏洞 |
|
|
102
|
+
| 代码风格问题 | Request Changes 或提供建议 |
|
|
103
|
+
| 设计问题 | Reject,要求重新设计 |
|
|
104
|
+
| 一切正常 | Approve,并合并价值高的 Challenge Tests |
|
|
105
|
+
|
|
106
|
+
## 评审意见模板
|
|
107
|
+
|
|
108
|
+
```markdown
|
|
109
|
+
## Review Comments
|
|
110
|
+
|
|
111
|
+
### 🛡️ Challenge Reports
|
|
112
|
+
|
|
113
|
+
- [Pass/Fail] Test Case: `test_concurrency_limit`
|
|
114
|
+
- [Pass/Fail] Test Case: `test_invalid_inputs`
|
|
115
|
+
|
|
116
|
+
### ✅ 优点
|
|
117
|
+
|
|
118
|
+
-
|
|
119
|
+
|
|
120
|
+
### ⚠️ 建议
|
|
121
|
+
|
|
122
|
+
-
|
|
123
|
+
|
|
124
|
+
### ❌ 必须修改
|
|
125
|
+
|
|
126
|
+
-
|
|
127
|
+
|
|
128
|
+
### 📝 其他
|
|
129
|
+
|
|
130
|
+
-
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 合规要求
|
|
134
|
+
|
|
135
|
+
- **必须**: 先通过 Engineer 的测试 (Verify),再进行对抗测试 (Challenge)
|
|
136
|
+
- **必须**: 试图编写至少一个边界测试用例
|
|
137
|
+
- **禁止**: 未经测试直接 Approve
|
monoco/features/agent/worker.py
CHANGED
|
@@ -8,12 +8,14 @@ class Worker:
|
|
|
8
8
|
Represents an active or pending agent session assigned to a specific role and issue.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
def __init__(self, role: RoleTemplate, issue_id: str):
|
|
11
|
+
def __init__(self, role: RoleTemplate, issue_id: str, timeout: Optional[int] = None):
|
|
12
12
|
self.role = role
|
|
13
13
|
self.issue_id = issue_id
|
|
14
|
+
self.timeout = timeout
|
|
14
15
|
self.status = "pending" # pending, running, suspended, terminated
|
|
15
16
|
self.process_id: Optional[int] = None
|
|
16
17
|
self._process = None
|
|
18
|
+
self.start_at: Optional[float] = None
|
|
17
19
|
|
|
18
20
|
def start(self, context: Optional[dict] = None):
|
|
19
21
|
"""
|
|
@@ -26,6 +28,8 @@ class Worker:
|
|
|
26
28
|
print(f"Starting worker {self.role.name} for issue {self.issue_id}")
|
|
27
29
|
|
|
28
30
|
try:
|
|
31
|
+
import time
|
|
32
|
+
self.start_at = time.time()
|
|
29
33
|
self._execute_work(context)
|
|
30
34
|
self.status = "running"
|
|
31
35
|
except Exception as e:
|
|
@@ -97,6 +101,23 @@ class Worker:
|
|
|
97
101
|
if not self._process:
|
|
98
102
|
return self.status
|
|
99
103
|
|
|
104
|
+
# Check timeout
|
|
105
|
+
if (
|
|
106
|
+
self.status == "running"
|
|
107
|
+
and self.timeout
|
|
108
|
+
and self.start_at
|
|
109
|
+
):
|
|
110
|
+
import time
|
|
111
|
+
|
|
112
|
+
elapsed = time.time() - self.start_at
|
|
113
|
+
if elapsed > self.timeout:
|
|
114
|
+
print(
|
|
115
|
+
f"\n[{self.role.name}] [bold red]Timeout exceeded[/bold red] ({self.timeout}s). Terminating process..."
|
|
116
|
+
)
|
|
117
|
+
self.stop()
|
|
118
|
+
self.status = "timeout"
|
|
119
|
+
return self.status
|
|
120
|
+
|
|
100
121
|
returncode = self._process.poll()
|
|
101
122
|
if returncode is None:
|
|
102
123
|
return "running"
|
|
@@ -118,14 +139,29 @@ class Worker:
|
|
|
118
139
|
|
|
119
140
|
def stop(self):
|
|
120
141
|
"""
|
|
121
|
-
Stop the worker session.
|
|
142
|
+
Stop the worker session and kill the process if running.
|
|
122
143
|
"""
|
|
123
144
|
if self.status == "terminated":
|
|
124
145
|
return
|
|
125
146
|
|
|
126
147
|
print(f"Stopping worker {self.role.name} for issue {self.issue_id}")
|
|
148
|
+
|
|
149
|
+
if self._process:
|
|
150
|
+
try:
|
|
151
|
+
# Try graceful termination
|
|
152
|
+
self._process.terminate()
|
|
153
|
+
# Wait a bit
|
|
154
|
+
try:
|
|
155
|
+
self._process.wait(timeout=2)
|
|
156
|
+
except Exception:
|
|
157
|
+
# Force kill if still running
|
|
158
|
+
self._process.kill()
|
|
159
|
+
except Exception as e:
|
|
160
|
+
print(f"Error stopping process: {e}")
|
|
161
|
+
|
|
127
162
|
self.status = "terminated"
|
|
128
163
|
self.process_id = None
|
|
164
|
+
self._process = None
|
|
129
165
|
|
|
130
166
|
def __repr__(self):
|
|
131
167
|
return (
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Dict
|
|
3
|
+
from monoco.core.feature import MonocoFeature, IntegrationData
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GlossaryFeature(MonocoFeature):
|
|
7
|
+
@property
|
|
8
|
+
def name(self) -> str:
|
|
9
|
+
return "glossary"
|
|
10
|
+
|
|
11
|
+
def initialize(self, root: Path, config: Dict) -> None:
|
|
12
|
+
# Glossary does not require file initialization in the workspace
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
def integrate(self, root: Path, config: Dict) -> IntegrationData:
|
|
16
|
+
# Determine language from config, default to 'en'
|
|
17
|
+
lang = config.get("i18n", {}).get("source_lang", "en")
|
|
18
|
+
|
|
19
|
+
# Resource path: monoco/features/glossary/resources/{lang}/AGENTS.md
|
|
20
|
+
base_dir = Path(__file__).parent / "resources"
|
|
21
|
+
|
|
22
|
+
# Try specific language, fallback to 'en'
|
|
23
|
+
prompt_file = base_dir / lang / "AGENTS.md"
|
|
24
|
+
if not prompt_file.exists():
|
|
25
|
+
prompt_file = base_dir / "en" / "AGENTS.md"
|
|
26
|
+
|
|
27
|
+
content = ""
|
|
28
|
+
if prompt_file.exists():
|
|
29
|
+
content = prompt_file.read_text(encoding="utf-8").strip()
|
|
30
|
+
|
|
31
|
+
return IntegrationData(system_prompts={"Glossary": content})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
### Glossary
|
|
2
|
+
|
|
3
|
+
#### Monoco Glossary
|
|
4
|
+
|
|
5
|
+
##### Core Architecture Metaphor: "Linux Distro"
|
|
6
|
+
|
|
7
|
+
| Term | Definition | Metaphor |
|
|
8
|
+
| :--------------- | :-------------------------------------------------------------------------------------------------- | :---------------------------------- |
|
|
9
|
+
| **Monoco** | The Agent Operating System Distribution. Managed policy, workflow, and package system. | **Distro** (e.g., Ubuntu, Arch) |
|
|
10
|
+
| **Kimi CLI** | The core runtime execution engine. Handles LLM interaction, tool execution, and process management. | **Kernel** (Linux Kernel) |
|
|
11
|
+
| **Session** | An initialized instance of the Agent Kernel, managed by Monoco. Has state and context. | **Init System / Daemon** (systemd) |
|
|
12
|
+
| **Issue** | An atomic unit of work with state (Open/Done) and strict lifecycle. | **Unit File** (systemd unit) |
|
|
13
|
+
| **Skill** | A package of capabilities (tools, prompts, flows) that extends the Agent. | **Package** (apt/pacman package) |
|
|
14
|
+
| **Context File** | Configuration files (e.g., `GEMINI.md`, `AGENTS.md`) defining environment rules and preferences. | **Config** (`/etc/config`) |
|
|
15
|
+
| **Agent Client** | The user interface connecting to Monoco (CLI, VSCode, Zed). | **Desktop Environment** (GNOME/KDE) |
|
|
16
|
+
|
|
17
|
+
##### Key Concepts
|
|
18
|
+
|
|
19
|
+
###### Context File
|
|
20
|
+
|
|
21
|
+
Files like `GEMINI.md` that provide the "Constitution" for the Agent. They define the role, scope, and behavioral policies of the Agent within a specific context (Root, Directory, Project).
|
|
22
|
+
|
|
23
|
+
###### Headless
|
|
24
|
+
|
|
25
|
+
Monoco is designed to run without a native GUI. It exposes its capabilities via standard protocols (LSP, ACP) to be consumed by various Clients (IDEs, Terminals).
|
|
26
|
+
|
|
27
|
+
###### Universal Shell
|
|
28
|
+
|
|
29
|
+
The concept that the CLI is the universal interface for all workflows. Monoco acts as an intelligent layer over the shell.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: monoco-glossary
|
|
3
|
+
description: Official Monoco Glossary and Operational Laws
|
|
4
|
+
tags: [core, definition]
|
|
5
|
+
type: standard
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Monoco Glossary
|
|
10
|
+
|
|
11
|
+
## Core Architecture Metaphor: "Linux Distro"
|
|
12
|
+
|
|
13
|
+
| Term | Definition | Metaphor |
|
|
14
|
+
| :--------------- | :-------------------------------------------------------------------------------------------------- | :---------------------------------- |
|
|
15
|
+
| **Monoco** | The Agent Operating System Distribution. Managed policy, workflow, and package system. | **Distro** (e.g., Ubuntu, Arch) |
|
|
16
|
+
| **Kimi CLI** | The core runtime execution engine. Handles LLM interaction, tool execution, and process management. | **Kernel** (Linux Kernel) |
|
|
17
|
+
| **Session** | An initialized instance of the Agent Kernel, managed by Monoco. Has state and context. | **Init System / Daemon** (systemd) |
|
|
18
|
+
| **Issue** | An atomic unit of work with state (Open/Done) and strict lifecycle. | **Unit File** (systemd unit) |
|
|
19
|
+
| **Skill** | A package of capabilities (tools, prompts, flows) that extends the Agent. | **Package** (apt/pacman package) |
|
|
20
|
+
| **Context File** | Configuration files (e.g., `GEMINI.md`, `AGENTS.md`) defining environment rules and preferences. | **Config** (`/etc/config`) |
|
|
21
|
+
| **Agent Client** | The user interface connecting to Monoco (CLI, VSCode, Zed). | **Desktop Environment** (GNOME/KDE) |
|
|
22
|
+
|
|
23
|
+
## Key Concepts
|
|
24
|
+
|
|
25
|
+
### Context File
|
|
26
|
+
|
|
27
|
+
Files like `GEMINI.md` that provide the "Constitution" for the Agent. They define the role, scope, and behavioral policies of the Agent within a specific context (Root, Directory, Project).
|
|
28
|
+
|
|
29
|
+
### Headless
|
|
30
|
+
|
|
31
|
+
Monoco is designed to run without a native GUI. It exposes its capabilities via standard protocols (LSP, ACP) to be consumed by various Clients (IDEs, Terminals).
|
|
32
|
+
|
|
33
|
+
### Universal Shell
|
|
34
|
+
|
|
35
|
+
The concept that the CLI is the universal interface for all workflows. Monoco acts as an intelligent layer over the shell.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
### 术语表
|
|
2
|
+
|
|
3
|
+
#### Monoco 术语表
|
|
4
|
+
|
|
5
|
+
##### 核心架构隐喻: "Linux 发行版"
|
|
6
|
+
|
|
7
|
+
| 术语 | 定义 | 隐喻 |
|
|
8
|
+
| :--- | :--- | :--- |
|
|
9
|
+
| **Monoco** | 智能体操作系统发行版。管理策略、工作流和包系统。 | **发行版** (如 Ubuntu, Arch) |
|
|
10
|
+
| **Kimi CLI** | 核心运行时执行引擎。处理 LLM 交互、工具执行和进程管理。 | **内核** (Linux Kernel) |
|
|
11
|
+
| **Session** | 由 Monoco 管理的智能体内核初始化实例。具有状态和上下文。 | **初始化系统/守护进程** (systemd) |
|
|
12
|
+
| **Issue** | 具有状态(Open/Done)和严格生命周期的原子工作单元。 | **单元文件** (systemd unit) |
|
|
13
|
+
| **Skill** | 扩展智能体功能的工具、提示词和流程包。 | **软件包** (apt/pacman package) |
|
|
14
|
+
| **Context File** | 定义环境规则和行为偏好的配置文件(如 `GEMINI.md`, `AGENTS.md`)。 | **配置** (`/etc/config`) |
|
|
15
|
+
| **Agent Client** | 连接 Monoco 的用户界面(CLI, VSCode, Zed)。 | **桌面环境** (GNOME/KDE) |
|
|
16
|
+
|
|
17
|
+
##### 关键概念
|
|
18
|
+
|
|
19
|
+
###### Context File
|
|
20
|
+
|
|
21
|
+
像 `GEMINI.md` 这样的文件,为智能体提供"宪法"。它们定义了特定上下文(根目录、目录、项目)中智能体的角色、范围和行为策略。
|
|
22
|
+
|
|
23
|
+
###### Headless
|
|
24
|
+
|
|
25
|
+
Monoco 设计为无需原生 GUI 即可运行。它通过标准协议(LSP, ACP)暴露其能力,供各种客户端(IDE、终端)使用。
|
|
26
|
+
|
|
27
|
+
###### Universal Shell
|
|
28
|
+
|
|
29
|
+
CLI 是所有工作流的通用接口的概念。Monoco 作为 shell 的智能层。
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: monoco-glossary
|
|
3
|
+
description: Monoco 官方术语表和操作法则
|
|
4
|
+
tags: [core, definition]
|
|
5
|
+
type: standard
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Monoco 术语表
|
|
10
|
+
|
|
11
|
+
## 核心架构隐喻: "Linux 发行版"
|
|
12
|
+
|
|
13
|
+
| 术语 | 定义 | 隐喻 |
|
|
14
|
+
| :--- | :--- | :--- |
|
|
15
|
+
| **Monoco** | 智能体操作系统发行版。管理策略、工作流和包系统。 | **发行版** (如 Ubuntu, Arch) |
|
|
16
|
+
| **Kimi CLI** | 核心运行时执行引擎。处理 LLM 交互、工具执行和进程管理。 | **内核** (Linux Kernel) |
|
|
17
|
+
| **Session** | 由 Monoco 管理的智能体内核初始化实例。具有状态和上下文。 | **初始化系统/守护进程** (systemd) |
|
|
18
|
+
| **Issue** | 具有状态(Open/Done)和严格生命周期的原子工作单元。 | **单元文件** (systemd unit) |
|
|
19
|
+
| **Skill** | 扩展智能体功能的工具、提示词和流程包。 | **软件包** (apt/pacman package) |
|
|
20
|
+
| **Context File** | 定义环境规则和行为偏好的配置文件(如 `GEMINI.md`, `AGENTS.md`)。 | **配置** (`/etc/config`) |
|
|
21
|
+
| **Agent Client** | 连接 Monoco 的用户界面(CLI, VSCode, Zed)。 | **桌面环境** (GNOME/KDE) |
|
|
22
|
+
|
|
23
|
+
## 关键概念
|
|
24
|
+
|
|
25
|
+
### Context File
|
|
26
|
+
|
|
27
|
+
像 `GEMINI.md` 这样的文件,为智能体提供"宪法"。它们定义了特定上下文(根目录、目录、项目)中智能体的角色、范围和行为策略。
|
|
28
|
+
|
|
29
|
+
### Headless
|
|
30
|
+
|
|
31
|
+
Monoco 设计为无需原生 GUI 即可运行。它通过标准协议(LSP, ACP)暴露其能力,供各种客户端(IDE、终端)使用。
|
|
32
|
+
|
|
33
|
+
### Universal Shell
|
|
34
|
+
|
|
35
|
+
CLI 是所有工作流的通用接口的概念。Monoco 作为 shell 的智能层。
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: i18n-scan-workflow
|
|
3
|
+
description: I18n Scan Workflow (Flow Skill). Defines the standard operational process from scanning missing translations to generating translation tasks, ensuring multilingual documentation quality.
|
|
4
|
+
type: flow
|
|
5
|
+
domain: i18n
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# I18n Scan Workflow
|
|
10
|
+
|
|
11
|
+
Standardized workflow for I18n scanning, ensuring the "Scan → Identify → Generate Tasks" process.
|
|
12
|
+
|
|
13
|
+
## Workflow State Machine
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Scan: Trigger scan
|
|
18
|
+
|
|
19
|
+
Scan --> Identify: Scan completed
|
|
20
|
+
Scan --> Scan: Configuration error<br/>(fix configuration)
|
|
21
|
+
|
|
22
|
+
Identify --> GenerateTasks: Missing found
|
|
23
|
+
Identify --> [*]: No missing<br/>(completed)
|
|
24
|
+
|
|
25
|
+
GenerateTasks --> [*]: Task generation completed
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Execution Steps
|
|
29
|
+
|
|
30
|
+
### 1. Scan (Scanning)
|
|
31
|
+
|
|
32
|
+
- **Goal**: Scan all documents in the project, identify translation coverage
|
|
33
|
+
- **Input**: Project files, i18n configuration
|
|
34
|
+
- **Output**: Scan report
|
|
35
|
+
- **Checkpoints**:
|
|
36
|
+
- [ ] Check i18n configuration in `.monoco/config.yaml`
|
|
37
|
+
- [ ] Run `monoco i18n scan`
|
|
38
|
+
- [ ] Confirm source and target language settings are correct
|
|
39
|
+
- [ ] Verify exclusion rules (.gitignore, build directories, etc.)
|
|
40
|
+
|
|
41
|
+
### 2. Identify (Identify Missing)
|
|
42
|
+
|
|
43
|
+
- **Goal**: Analyze scan results, identify specific missing translations
|
|
44
|
+
- **Strategy**: Compare source and target files
|
|
45
|
+
- **Checkpoints**:
|
|
46
|
+
- [ ] List all source files with missing translations
|
|
47
|
+
- [ ] Identify missing target languages
|
|
48
|
+
- [ ] Assess impact scope of missing translations
|
|
49
|
+
- [ ] Sort by priority (core documents first)
|
|
50
|
+
|
|
51
|
+
### 3. Generate Tasks (Generate Tasks)
|
|
52
|
+
|
|
53
|
+
- **Goal**: Create tracking tasks for missing translations
|
|
54
|
+
- **Strategy**: Create Issue or memo based on missing status
|
|
55
|
+
- **Checkpoints**:
|
|
56
|
+
- [ ] Create Feature Issue for core document missing translations
|
|
57
|
+
- [ ] Create Memo reminder for secondary document missing translations
|
|
58
|
+
- [ ] Annotate file paths requiring translation in the Issue
|
|
59
|
+
- [ ] Set reasonable priority and deadline
|
|
60
|
+
|
|
61
|
+
## Decision Branches
|
|
62
|
+
|
|
63
|
+
| Condition | Action |
|
|
64
|
+
|-----------|--------|
|
|
65
|
+
| Configuration error | Fix `.monoco/config.yaml`, rescan |
|
|
66
|
+
| No missing translations | Process completed, no further action needed |
|
|
67
|
+
| Large amount missing | Create Epic, split into multiple Features |
|
|
68
|
+
| Critical document missing | High priority, create Issue immediately |
|
|
69
|
+
|
|
70
|
+
## Compliance Requirements
|
|
71
|
+
|
|
72
|
+
- **Required**: Verify i18n configuration is correct before scanning
|
|
73
|
+
- **Required**: All core documents must have corresponding translations
|
|
74
|
+
- **Recommended**: Run scans regularly (e.g., weekly)
|
|
75
|
+
- **Recommended**: Bind translation tasks with feature development
|
|
76
|
+
|
|
77
|
+
## Related Commands
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Scan for missing translations
|
|
81
|
+
monoco i18n scan
|
|
82
|
+
|
|
83
|
+
# Create translation task
|
|
84
|
+
monoco issue create feature -t "Translate {filename} to {lang}"
|
|
85
|
+
|
|
86
|
+
# Add memo
|
|
87
|
+
monoco memo add "Needs translation: {filepath}"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output Example
|
|
91
|
+
|
|
92
|
+
After scanning completes, a report like the following should be generated:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
I18n Scan Report
|
|
96
|
+
================
|
|
97
|
+
Source Language: en
|
|
98
|
+
Target Languages: zh, ja
|
|
99
|
+
|
|
100
|
+
Missing Translations:
|
|
101
|
+
- docs/guide.md → zh/guide.md [MISSING]
|
|
102
|
+
- docs/api.md → ja/api.md [MISSING]
|
|
103
|
+
|
|
104
|
+
Coverage: 85%
|
|
105
|
+
```
|
monoco/features/issue/core.py
CHANGED
|
@@ -515,7 +515,7 @@ def update_issue(
|
|
|
515
515
|
temp_meta = IssueMetadata(**data)
|
|
516
516
|
|
|
517
517
|
# Use engine to validate the transition
|
|
518
|
-
engine.validate_transition(
|
|
518
|
+
transition = engine.validate_transition(
|
|
519
519
|
from_status=current_status,
|
|
520
520
|
from_stage=current_stage,
|
|
521
521
|
to_status=target_status,
|
|
@@ -659,6 +659,8 @@ def update_issue(
|
|
|
659
659
|
path.write_text(new_content)
|
|
660
660
|
|
|
661
661
|
# 3. Handle physical move if status changed
|
|
662
|
+
# Save old path before move for git tracking
|
|
663
|
+
old_path_before_move = path
|
|
662
664
|
if status and status != current_status:
|
|
663
665
|
# Move file
|
|
664
666
|
prefix = issue_id.split("-")[0].upper()
|
|
@@ -702,17 +704,16 @@ def update_issue(
|
|
|
702
704
|
# Only auto-commit if we're in a git repo
|
|
703
705
|
git_service = IssueGitService(project_root)
|
|
704
706
|
if git_service.is_git_repository():
|
|
705
|
-
#
|
|
707
|
+
# Use the saved old path before file move for git tracking
|
|
706
708
|
old_path_for_git = None
|
|
707
|
-
if status and status != current_status:
|
|
708
|
-
|
|
709
|
-
old_path_for_git = find_issue_path(issues_root, issue_id)
|
|
709
|
+
if status and status != current_status and old_path_before_move != path:
|
|
710
|
+
old_path_for_git = old_path_before_move
|
|
710
711
|
|
|
711
712
|
commit_result = git_service.commit_issue_change(
|
|
712
713
|
issue_id=issue_id,
|
|
713
714
|
action=action,
|
|
714
715
|
issue_file_path=path,
|
|
715
|
-
old_file_path=old_path_for_git
|
|
716
|
+
old_file_path=old_path_for_git,
|
|
716
717
|
no_commit=no_commit,
|
|
717
718
|
)
|
|
718
719
|
# Attach commit result to metadata for optional inspection
|
|
@@ -721,9 +722,47 @@ def update_issue(
|
|
|
721
722
|
# Update returned metadata with final absolute path
|
|
722
723
|
updated_meta.path = str(path.absolute())
|
|
723
724
|
updated_meta.actions = get_available_actions(updated_meta)
|
|
725
|
+
|
|
726
|
+
# Execute Post Actions (Trigger)
|
|
727
|
+
if transition and hasattr(transition, "post_actions") and transition.post_actions:
|
|
728
|
+
_execute_post_actions(transition.post_actions, updated_meta)
|
|
729
|
+
|
|
724
730
|
return updated_meta
|
|
725
731
|
|
|
726
732
|
|
|
733
|
+
def _execute_post_actions(actions: List[str], meta: IssueMetadata):
|
|
734
|
+
"""
|
|
735
|
+
Execute a list of shell commands as post-actions.
|
|
736
|
+
Supports template substitution with issue metadata.
|
|
737
|
+
"""
|
|
738
|
+
import shlex
|
|
739
|
+
import subprocess
|
|
740
|
+
from rich.console import Console
|
|
741
|
+
|
|
742
|
+
console = Console()
|
|
743
|
+
data = meta.model_dump(mode="json")
|
|
744
|
+
|
|
745
|
+
for action in actions:
|
|
746
|
+
try:
|
|
747
|
+
# Safe template substitution
|
|
748
|
+
cmd = action.format(**data)
|
|
749
|
+
except KeyError as e:
|
|
750
|
+
console.print(f"[yellow]Trigger Warning:[/yellow] Missing key for template '{action}': {e}")
|
|
751
|
+
continue
|
|
752
|
+
|
|
753
|
+
console.print(f"[bold cyan]Triggering:[/bold cyan] {cmd}")
|
|
754
|
+
|
|
755
|
+
args = shlex.split(cmd)
|
|
756
|
+
|
|
757
|
+
try:
|
|
758
|
+
# Run in foreground to allow interaction if needed (e.g. agent output)
|
|
759
|
+
subprocess.run(args, check=True)
|
|
760
|
+
except subprocess.CalledProcessError as e:
|
|
761
|
+
console.print(f"[red]Trigger Failed:[/red] Command '{cmd}' exited with code {e.returncode}")
|
|
762
|
+
except Exception as e:
|
|
763
|
+
console.print(f"[red]Trigger Error:[/red] {e}")
|
|
764
|
+
|
|
765
|
+
|
|
727
766
|
def start_issue_isolation(
|
|
728
767
|
issues_root: Path, issue_id: str, mode: str, project_root: Path
|
|
729
768
|
) -> IssueMetadata:
|
|
@@ -134,13 +134,14 @@ class StateMachine:
|
|
|
134
134
|
to_stage: Optional[str],
|
|
135
135
|
solution: Optional[str] = None,
|
|
136
136
|
meta: Optional[IssueMetadata] = None,
|
|
137
|
-
) ->
|
|
137
|
+
) -> Optional[TransitionConfig]:
|
|
138
138
|
"""
|
|
139
139
|
Validate if a transition is allowed. Raises ValueError if not.
|
|
140
140
|
If meta is provided, also validates criticality-based policies.
|
|
141
|
+
Returns the TransitionConfig if a transition occurred, None if no change.
|
|
141
142
|
"""
|
|
142
143
|
if from_status == to_status and from_stage == to_stage:
|
|
143
|
-
return # No change is always allowed (unless we want to enforce specific updates)
|
|
144
|
+
return None # No change is always allowed (unless we want to enforce specific updates)
|
|
144
145
|
|
|
145
146
|
transition = self.find_transition(
|
|
146
147
|
from_status, from_stage, to_status, to_stage, solution
|
|
@@ -160,6 +161,8 @@ class StateMachine:
|
|
|
160
161
|
# Criticality-based policy checks
|
|
161
162
|
if meta and meta.criticality:
|
|
162
163
|
self._validate_criticality_policy(meta, from_stage, to_stage)
|
|
164
|
+
|
|
165
|
+
return transition
|
|
163
166
|
|
|
164
167
|
def _validate_criticality_policy(
|
|
165
168
|
self,
|