monoco-toolkit 0.3.6__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.
Files changed (113) hide show
  1. monoco/cli/workspace.py +1 -1
  2. monoco/core/config.py +58 -0
  3. monoco/core/hooks/__init__.py +19 -0
  4. monoco/core/hooks/base.py +104 -0
  5. monoco/core/hooks/builtin/__init__.py +11 -0
  6. monoco/core/hooks/builtin/git_cleanup.py +266 -0
  7. monoco/core/hooks/builtin/logging_hook.py +78 -0
  8. monoco/core/hooks/context.py +131 -0
  9. monoco/core/hooks/registry.py +222 -0
  10. monoco/core/injection.py +63 -29
  11. monoco/core/integrations.py +8 -2
  12. monoco/core/output.py +5 -5
  13. monoco/core/registry.py +9 -1
  14. monoco/core/resource/__init__.py +5 -0
  15. monoco/core/resource/finder.py +98 -0
  16. monoco/core/resource/manager.py +91 -0
  17. monoco/core/resource/models.py +35 -0
  18. monoco/core/resources/en/{SKILL.md → skills/monoco_core/SKILL.md} +2 -0
  19. monoco/core/resources/zh/{SKILL.md → skills/monoco_core/SKILL.md} +2 -0
  20. monoco/core/setup.py +1 -1
  21. monoco/core/skill_framework.py +292 -0
  22. monoco/core/skills.py +538 -254
  23. monoco/core/sync.py +73 -1
  24. monoco/core/workflow_converter.py +420 -0
  25. monoco/features/{scheduler → agent}/__init__.py +5 -3
  26. monoco/features/agent/adapter.py +31 -0
  27. monoco/features/agent/apoptosis.py +44 -0
  28. monoco/features/agent/cli.py +296 -0
  29. monoco/features/agent/config.py +96 -0
  30. monoco/features/agent/defaults.py +12 -0
  31. monoco/features/{scheduler → agent}/engines.py +32 -6
  32. monoco/features/agent/flow_skills.py +281 -0
  33. monoco/features/agent/manager.py +91 -0
  34. monoco/features/{scheduler → agent}/models.py +6 -3
  35. monoco/features/agent/resources/atoms/atom-code-dev.yaml +61 -0
  36. monoco/features/agent/resources/atoms/atom-issue-lifecycle.yaml +73 -0
  37. monoco/features/agent/resources/atoms/atom-knowledge.yaml +55 -0
  38. monoco/features/agent/resources/atoms/atom-review.yaml +60 -0
  39. monoco/features/agent/resources/en/skills/flow_engineer/SKILL.md +94 -0
  40. monoco/features/agent/resources/en/skills/flow_manager/SKILL.md +93 -0
  41. monoco/features/agent/resources/en/skills/flow_planner/SKILL.md +85 -0
  42. monoco/features/agent/resources/en/skills/flow_reviewer/SKILL.md +114 -0
  43. monoco/features/agent/resources/roles/role-engineer.yaml +49 -0
  44. monoco/features/agent/resources/roles/role-manager.yaml +46 -0
  45. monoco/features/agent/resources/roles/role-planner.yaml +46 -0
  46. monoco/features/agent/resources/roles/role-reviewer.yaml +47 -0
  47. monoco/features/agent/resources/workflows/workflow-dev.yaml +83 -0
  48. monoco/features/agent/resources/workflows/workflow-issue-create.yaml +72 -0
  49. monoco/features/agent/resources/workflows/workflow-review.yaml +94 -0
  50. monoco/features/agent/resources/zh/skills/flow_engineer/SKILL.md +94 -0
  51. monoco/features/agent/resources/zh/skills/flow_manager/SKILL.md +88 -0
  52. monoco/features/agent/resources/zh/skills/flow_planner/SKILL.md +259 -0
  53. monoco/features/agent/resources/zh/skills/flow_reviewer/SKILL.md +137 -0
  54. monoco/features/{scheduler → agent}/session.py +36 -1
  55. monoco/features/{scheduler → agent}/worker.py +40 -4
  56. monoco/features/glossary/adapter.py +31 -0
  57. monoco/features/glossary/config.py +5 -0
  58. monoco/features/glossary/resources/en/AGENTS.md +29 -0
  59. monoco/features/glossary/resources/en/skills/monoco_glossary/SKILL.md +35 -0
  60. monoco/features/glossary/resources/zh/AGENTS.md +29 -0
  61. monoco/features/glossary/resources/zh/skills/monoco_glossary/SKILL.md +35 -0
  62. monoco/features/i18n/resources/en/skills/i18n_scan_workflow/SKILL.md +105 -0
  63. monoco/features/i18n/resources/en/{SKILL.md → skills/monoco_i18n/SKILL.md} +2 -0
  64. monoco/features/i18n/resources/zh/skills/i18n_scan_workflow/SKILL.md +105 -0
  65. monoco/features/i18n/resources/zh/{SKILL.md → skills/monoco_i18n/SKILL.md} +2 -0
  66. monoco/features/issue/commands.py +427 -21
  67. monoco/features/issue/core.py +140 -1
  68. monoco/features/issue/criticality.py +553 -0
  69. monoco/features/issue/domain/models.py +28 -2
  70. monoco/features/issue/engine/machine.py +75 -15
  71. monoco/features/issue/git_service.py +185 -0
  72. monoco/features/issue/linter.py +291 -62
  73. monoco/features/issue/models.py +50 -2
  74. monoco/features/issue/resources/en/skills/issue_create_workflow/SKILL.md +167 -0
  75. monoco/features/issue/resources/en/skills/issue_develop_workflow/SKILL.md +224 -0
  76. monoco/features/issue/resources/en/skills/issue_lifecycle_workflow/SKILL.md +159 -0
  77. monoco/features/issue/resources/en/skills/issue_refine_workflow/SKILL.md +203 -0
  78. monoco/features/issue/resources/en/{SKILL.md → skills/monoco_issue/SKILL.md} +50 -0
  79. monoco/features/issue/resources/zh/skills/issue_create_workflow/SKILL.md +167 -0
  80. monoco/features/issue/resources/zh/skills/issue_develop_workflow/SKILL.md +224 -0
  81. monoco/features/issue/resources/zh/skills/issue_lifecycle_workflow/SKILL.md +159 -0
  82. monoco/features/issue/resources/zh/skills/issue_refine_workflow/SKILL.md +203 -0
  83. monoco/features/issue/resources/zh/{SKILL.md → skills/monoco_issue/SKILL.md} +52 -0
  84. monoco/features/issue/validator.py +185 -65
  85. monoco/features/memo/__init__.py +2 -1
  86. monoco/features/memo/adapter.py +32 -0
  87. monoco/features/memo/cli.py +36 -14
  88. monoco/features/memo/core.py +59 -0
  89. monoco/features/memo/resources/en/skills/monoco_memo/SKILL.md +77 -0
  90. monoco/features/memo/resources/en/skills/note_processing_workflow/SKILL.md +140 -0
  91. monoco/features/memo/resources/zh/AGENTS.md +8 -0
  92. monoco/features/memo/resources/zh/skills/monoco_memo/SKILL.md +77 -0
  93. monoco/features/memo/resources/zh/skills/note_processing_workflow/SKILL.md +140 -0
  94. monoco/features/spike/resources/en/{SKILL.md → skills/monoco_spike/SKILL.md} +2 -0
  95. monoco/features/spike/resources/en/skills/research_workflow/SKILL.md +121 -0
  96. monoco/features/spike/resources/zh/{SKILL.md → skills/monoco_spike/SKILL.md} +2 -0
  97. monoco/features/spike/resources/zh/skills/research_workflow/SKILL.md +121 -0
  98. monoco/main.py +2 -3
  99. monoco_toolkit-0.3.10.dist-info/METADATA +124 -0
  100. monoco_toolkit-0.3.10.dist-info/RECORD +156 -0
  101. monoco/features/scheduler/cli.py +0 -285
  102. monoco/features/scheduler/config.py +0 -68
  103. monoco/features/scheduler/defaults.py +0 -54
  104. monoco/features/scheduler/manager.py +0 -49
  105. monoco/features/scheduler/reliability.py +0 -106
  106. monoco/features/skills/core.py +0 -102
  107. monoco_toolkit-0.3.6.dist-info/METADATA +0 -127
  108. monoco_toolkit-0.3.6.dist-info/RECORD +0 -97
  109. /monoco/core/{hooks.py → githooks.py} +0 -0
  110. /monoco/features/{skills → glossary}/__init__.py +0 -0
  111. {monoco_toolkit-0.3.6.dist-info → monoco_toolkit-0.3.10.dist-info}/WHEEL +0 -0
  112. {monoco_toolkit-0.3.6.dist-info → monoco_toolkit-0.3.10.dist-info}/entry_points.txt +0 -0
  113. {monoco_toolkit-0.3.6.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
@@ -1,7 +1,11 @@
1
1
  from datetime import datetime
2
2
  from typing import Optional
3
+ from pathlib import Path
3
4
  from pydantic import BaseModel, Field, ConfigDict
5
+
4
6
  from .worker import Worker
7
+ from monoco.core.hooks import HookContext, HookRegistry, get_registry
8
+ from monoco.core.config import find_monoco_root
5
9
 
6
10
 
7
11
  class Session(BaseModel):
@@ -32,9 +36,21 @@ class RuntimeSession:
32
36
  The in-memory wrapper around the Session model and the active Worker.
33
37
  """
34
38
 
35
- def __init__(self, session_model: Session, worker: Worker):
39
+ def __init__(
40
+ self,
41
+ session_model: Session,
42
+ worker: Worker,
43
+ hook_registry: Optional[HookRegistry] = None,
44
+ project_root: Optional[Path] = None,
45
+ ):
36
46
  self.model = session_model
37
47
  self.worker = worker
48
+ self.hook_registry = hook_registry or get_registry()
49
+ self.project_root = project_root or find_monoco_root()
50
+
51
+ def _create_hook_context(self) -> HookContext:
52
+ """Create a HookContext from the current session state."""
53
+ return HookContext.from_runtime_session(self, self.project_root)
38
54
 
39
55
  def start(self, context: Optional[dict] = None):
40
56
  print(
@@ -45,6 +61,10 @@ class RuntimeSession:
45
61
  self.model.updated_at = datetime.now()
46
62
 
47
63
  try:
64
+ # Execute on_session_start hooks
65
+ hook_context = self._create_hook_context()
66
+ self.hook_registry.execute_on_session_start(hook_context)
67
+
48
68
  self.worker.start(context)
49
69
  # Async mode: we assume it started running.
50
70
  # Use poll or refresh_status to check later.
@@ -81,6 +101,21 @@ class RuntimeSession:
81
101
 
82
102
  def terminate(self):
83
103
  print(f"Session {self.model.id}: Terminating")
104
+
105
+ # Execute on_session_end hooks before stopping worker
106
+ # This allows hooks to perform cleanup while session context is still valid
107
+ try:
108
+ hook_context = self._create_hook_context()
109
+ results = self.hook_registry.execute_on_session_end(hook_context)
110
+
111
+ # Log hook results
112
+ for result in results:
113
+ if result.status == "failure":
114
+ print(f" Hook warning: {result.message}")
115
+ except Exception as e:
116
+ # Don't let hook errors prevent session termination
117
+ print(f" Hook execution error: {e}")
118
+
84
119
  self.worker.stop()
85
120
  self.model.status = "terminated"
86
121
  self.model.updated_at = datetime.now()
@@ -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:
@@ -38,8 +42,8 @@ class Worker:
38
42
  import sys
39
43
 
40
44
  # Prepare the prompt
41
- # We treat 'crafter' as a drafter when context is provided (Draft Mode)
42
- if (self.role.name == "drafter" or self.role.name == "crafter") and context:
45
+ # We treat 'Planner' as a drafter when context is provided (Draft Mode)
46
+ if (self.role.name == "drafter" or self.role.name == "Planner") and context:
43
47
  issue_type = context.get("type", "feature")
44
48
  description = context.get("description", "No description")
45
49
  prompt = (
@@ -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 (
@@ -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,5 @@
1
+ from dataclasses import dataclass
2
+
3
+ @dataclass
4
+ class GlossaryConfig:
5
+ enabled: bool = True
@@ -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
+ ```
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: monoco-i18n
3
3
  description: Internationalization quality control for documentation. Ensures multi-language documentation stays synchronized.
4
+ type: standard
5
+ version: 1.0.0
4
6
  ---
5
7
 
6
8
  # Documentation I18n
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: i18n-scan-workflow
3
+ description: I18n 扫描工作流 (Flow Skill)。定义从扫描缺失翻译到生成翻译任务的标准操作流程,确保多语言文档质量。
4
+ type: flow
5
+ domain: i18n
6
+ version: 1.0.0
7
+ ---
8
+
9
+ # I18n Scan Workflow
10
+
11
+ I18n 扫描的标准化工作流,确保 "Scan → Identify → Generate Tasks" 流程。
12
+
13
+ ## 工作流状态机
14
+
15
+ ```mermaid
16
+ stateDiagram-v2
17
+ [*] --> Scan: 触发扫描
18
+
19
+ Scan --> Identify: 扫描完成
20
+ Scan --> Scan: 配置错误<br/>(修复配置)
21
+
22
+ Identify --> GenerateTasks: 发现缺失
23
+ Identify --> [*]: 无缺失<br/>(完成)
24
+
25
+ GenerateTasks --> [*]: 任务生成完成
26
+ ```
27
+
28
+ ## 执行步骤
29
+
30
+ ### 1. Scan (扫描)
31
+
32
+ - **目标**: 扫描项目中所有文档,识别翻译覆盖情况
33
+ - **输入**: 项目文件、i18n 配置
34
+ - **输出**: 扫描报告
35
+ - **检查点**:
36
+ - [ ] 检查 `.monoco/config.yaml` 中的 i18n 配置
37
+ - [ ] 运行 `monoco i18n scan`
38
+ - [ ] 确认源语言和目标语言设置正确
39
+ - [ ] 验证排除规则(.gitignore、build 目录等)
40
+
41
+ ### 2. Identify (识别缺失)
42
+
43
+ - **目标**: 分析扫描结果,识别具体缺失的翻译
44
+ - **策略**: 对比源文件和目标文件
45
+ - **检查点**:
46
+ - [ ] 列出所有缺失翻译的源文件
47
+ - [ ] 识别缺失的目标语言
48
+ - [ ] 评估缺失翻译的影响范围
49
+ - [ ] 按优先级排序(核心文档优先)
50
+
51
+ ### 3. Generate Tasks (生成任务)
52
+
53
+ - **目标**: 为缺失的翻译创建追踪任务
54
+ - **策略**: 根据缺失情况创建 Issue 或备忘录
55
+ - **检查点**:
56
+ - [ ] 为核心文档缺失创建 Feature Issue
57
+ - [ ] 为次要文档缺失创建 Memo 提醒
58
+ - [ ] 在 Issue 中标注需要翻译的文件路径
59
+ - [ ] 设置合理的优先级和截止日期
60
+
61
+ ## 决策分支
62
+
63
+ | 条件 | 动作 |
64
+ |------|------|
65
+ | 配置错误 | 修复 `.monoco/config.yaml`,重新扫描 |
66
+ | 无缺失翻译 | 流程完成,无需进一步操作 |
67
+ | 大量缺失 | 创建 Epic,拆分为多个 Feature |
68
+ | 关键文档缺失 | 高优先级,立即创建 Issue |
69
+
70
+ ## 合规要求
71
+
72
+ - **必须**: 扫描前验证 i18n 配置正确
73
+ - **必须**: 所有核心文档必须有对应翻译
74
+ - **建议**: 定期运行扫描(如每周)
75
+ - **建议**: 将翻译任务与功能开发绑定
76
+
77
+ ## 相关命令
78
+
79
+ ```bash
80
+ # 扫描缺失翻译
81
+ monoco i18n scan
82
+
83
+ # 创建翻译任务
84
+ monoco issue create feature -t "翻译 {filename} 到 {lang}"
85
+
86
+ # 添加备忘录
87
+ monoco memo add "需要翻译: {filepath}"
88
+ ```
89
+
90
+ ## 输出示例
91
+
92
+ 扫描完成后,应生成如下报告:
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
+ ```