monoco-toolkit 0.2.5__py3-none-any.whl → 0.2.8__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/agent/adapters.py +24 -1
- monoco/core/config.py +77 -17
- monoco/core/integrations.py +8 -0
- monoco/core/lsp.py +7 -0
- monoco/core/output.py +8 -1
- monoco/core/resources/zh/SKILL.md +6 -7
- monoco/core/setup.py +8 -0
- monoco/features/i18n/resources/zh/SKILL.md +5 -5
- monoco/features/issue/commands.py +179 -55
- monoco/features/issue/core.py +263 -124
- monoco/features/issue/domain/__init__.py +0 -0
- monoco/features/issue/domain/lifecycle.py +126 -0
- monoco/features/issue/domain/models.py +170 -0
- monoco/features/issue/domain/parser.py +223 -0
- monoco/features/issue/domain/workspace.py +104 -0
- monoco/features/issue/engine/__init__.py +22 -0
- monoco/features/issue/engine/config.py +172 -0
- monoco/features/issue/engine/machine.py +185 -0
- monoco/features/issue/engine/models.py +18 -0
- monoco/features/issue/linter.py +118 -12
- monoco/features/issue/lsp/__init__.py +3 -0
- monoco/features/issue/lsp/definition.py +72 -0
- monoco/features/issue/models.py +27 -9
- monoco/features/issue/resources/en/AGENTS.md +5 -0
- monoco/features/issue/resources/en/SKILL.md +26 -2
- monoco/features/issue/resources/zh/AGENTS.md +5 -0
- monoco/features/issue/resources/zh/SKILL.md +34 -10
- monoco/features/issue/validator.py +252 -66
- monoco/features/spike/core.py +5 -22
- monoco/features/spike/resources/zh/SKILL.md +2 -2
- monoco/main.py +2 -26
- monoco_toolkit-0.2.8.dist-info/METADATA +136 -0
- {monoco_toolkit-0.2.5.dist-info → monoco_toolkit-0.2.8.dist-info}/RECORD +36 -30
- monoco/features/agent/commands.py +0 -166
- monoco/features/agent/doctor.py +0 -30
- monoco/features/pty/core.py +0 -185
- monoco/features/pty/router.py +0 -138
- monoco/features/pty/server.py +0 -56
- monoco_toolkit-0.2.5.dist-info/METADATA +0 -93
- {monoco_toolkit-0.2.5.dist-info → monoco_toolkit-0.2.8.dist-info}/WHEEL +0 -0
- {monoco_toolkit-0.2.5.dist-info → monoco_toolkit-0.2.8.dist-info}/entry_points.txt +0 -0
- {monoco_toolkit-0.2.5.dist-info → monoco_toolkit-0.2.8.dist-info}/licenses/LICENSE +0 -0
monoco/features/issue/models.py
CHANGED
|
@@ -78,16 +78,16 @@ class IsolationType(str, Enum):
|
|
|
78
78
|
WORKTREE = "worktree"
|
|
79
79
|
|
|
80
80
|
class IssueIsolation(BaseModel):
|
|
81
|
-
type:
|
|
81
|
+
type: str
|
|
82
82
|
ref: str # Git branch name
|
|
83
83
|
path: Optional[str] = None # Worktree path (relative to repo root or absolute)
|
|
84
84
|
created_at: datetime = Field(default_factory=current_time)
|
|
85
85
|
|
|
86
86
|
class IssueAction(BaseModel):
|
|
87
87
|
label: str
|
|
88
|
-
target_status: Optional[
|
|
89
|
-
target_stage: Optional[
|
|
90
|
-
target_solution: Optional[
|
|
88
|
+
target_status: Optional[str] = None
|
|
89
|
+
target_stage: Optional[str] = None
|
|
90
|
+
target_solution: Optional[str] = None
|
|
91
91
|
icon: Optional[str] = None
|
|
92
92
|
|
|
93
93
|
# Generic execution extensions
|
|
@@ -99,9 +99,9 @@ class IssueMetadata(BaseModel):
|
|
|
99
99
|
|
|
100
100
|
id: str
|
|
101
101
|
uid: Optional[str] = None # Global unique identifier for cross-project identity
|
|
102
|
-
type:
|
|
103
|
-
status:
|
|
104
|
-
stage: Optional[
|
|
102
|
+
type: str
|
|
103
|
+
status: str = "open"
|
|
104
|
+
stage: Optional[str] = None
|
|
105
105
|
title: str
|
|
106
106
|
|
|
107
107
|
# Time Anchors
|
|
@@ -112,21 +112,39 @@ class IssueMetadata(BaseModel):
|
|
|
112
112
|
|
|
113
113
|
parent: Optional[str] = None
|
|
114
114
|
sprint: Optional[str] = None
|
|
115
|
-
solution: Optional[
|
|
115
|
+
solution: Optional[str] = None
|
|
116
116
|
isolation: Optional[IssueIsolation] = None
|
|
117
117
|
dependencies: List[str] = []
|
|
118
118
|
related: List[str] = []
|
|
119
119
|
tags: List[str] = []
|
|
120
|
+
files: List[str] = []
|
|
120
121
|
path: Optional[str] = None # Absolute path to the issue file
|
|
121
122
|
|
|
122
123
|
# Proxy UI Actions (Excluded from file persistence)
|
|
123
|
-
|
|
124
|
+
# Modified: Remove exclude=True to allow API/CLI inspection. Must be manually excluded during YAML Dump.
|
|
125
|
+
actions: List[IssueAction] = Field(default=[])
|
|
124
126
|
|
|
125
127
|
|
|
126
128
|
@model_validator(mode='before')
|
|
127
129
|
@classmethod
|
|
128
130
|
def normalize_fields(cls, v: Any) -> Any:
|
|
129
131
|
if isinstance(v, dict):
|
|
132
|
+
# Handle common capitalization variations for robustness
|
|
133
|
+
field_map = {
|
|
134
|
+
"ID": "id",
|
|
135
|
+
"Type": "type",
|
|
136
|
+
"Status": "status",
|
|
137
|
+
"Stage": "stage",
|
|
138
|
+
"Title": "title",
|
|
139
|
+
"Parent": "parent",
|
|
140
|
+
"Solution": "solution",
|
|
141
|
+
"Sprint": "sprint",
|
|
142
|
+
}
|
|
143
|
+
for old_k, new_k in field_map.items():
|
|
144
|
+
if old_k in v and new_k not in v:
|
|
145
|
+
v[new_k] = v[old_k] # Don't pop yet to avoid mutation issues if used elsewhere, or pop if safe.
|
|
146
|
+
# Pydantic v2 mode='before' is usually a copy if we want to be safe, but let's just add it.
|
|
147
|
+
|
|
130
148
|
# Normalize type and status to lowercase for compatibility
|
|
131
149
|
if "type" in v and isinstance(v["type"], str):
|
|
132
150
|
v["type"] = v["type"].lower()
|
|
@@ -8,8 +8,13 @@ System for managing tasks using `monoco issue`.
|
|
|
8
8
|
- **Status**: `monoco issue open|close|backlog <id>`
|
|
9
9
|
- **Check**: `monoco issue lint` (Must run after manual edits)
|
|
10
10
|
- **Lifecycle**: `monoco issue start|submit|delete <id>`
|
|
11
|
+
- **Sync Context**: `monoco issue sync-files [id]` (Update file tracking)
|
|
11
12
|
- **Structure**: `Issues/{CapitalizedPluralType}/{lowercase_status}/` (e.g. `Issues/Features/open/`). Do not deviate.
|
|
12
13
|
- **Rules**:
|
|
13
14
|
1. **Heading**: Must have `## {ID}: {Title}` (matches metadata).
|
|
14
15
|
2. **Checkboxes**: Min 2 using `- [ ]`, `- [x]`, `- [-]`, `- [/]`.
|
|
15
16
|
3. **Review**: `## Review Comments` section required for Review/Done stages.
|
|
17
|
+
4. **Environment Policies**:
|
|
18
|
+
- Must use `monoco issue start --branch`.
|
|
19
|
+
- 🛑 **NO** direct coding on `main`/`master` (Linter will fail).
|
|
20
|
+
- Must update `files` field after coding (via `sync-files` or manual).
|
|
@@ -23,6 +23,24 @@ Use this skill to create and manage **Issues** (Universal Atoms) in Monoco proje
|
|
|
23
23
|
- **🧹 CHORE**: Engineering maintenance, no direct user value. Mindset: Builder.
|
|
24
24
|
- **🐞 FIX**: Correcting deviations. Mindset: Debugger.
|
|
25
25
|
|
|
26
|
+
## Workflow Policies
|
|
27
|
+
|
|
28
|
+
### 1. Strict Git Workflow
|
|
29
|
+
|
|
30
|
+
Monoco enforces a **Feature Branch** model.
|
|
31
|
+
|
|
32
|
+
- **Start**: Must use `monoco issue start <ID> --branch` to start working. This creates a `feat/<ID>-<slug>` branch.
|
|
33
|
+
- **Protected Main**: **NO** direct modification on `main`, `master`, or `production` branches. Linter will block this.
|
|
34
|
+
- **Submit**: Run `monoco issue submit <ID>` before PR to clean up and validate.
|
|
35
|
+
|
|
36
|
+
### 2. File Tracking
|
|
37
|
+
|
|
38
|
+
Agents must track modified files to maintain Self-Contained Context.
|
|
39
|
+
|
|
40
|
+
- **Mechanism**: Issue Ticket Front Matter contains a `files: []` field.
|
|
41
|
+
- **Automated (Recommended)**: Run `monoco issue sync-files` inside the Feature Branch. It diffs against the base branch.
|
|
42
|
+
- **Manual (Fallback)**: If working without branches, Agent MUST **actively** append modified paths to the `files` list.
|
|
43
|
+
|
|
26
44
|
## Guidelines
|
|
27
45
|
|
|
28
46
|
### Directory Structure & Naming
|
|
@@ -45,7 +63,6 @@ Issues are validated via `monoco issue lint`. key constraints:
|
|
|
45
63
|
Use `monoco issue`:
|
|
46
64
|
|
|
47
65
|
1. **Create**: `monoco issue create <type> --title "..."`
|
|
48
|
-
|
|
49
66
|
- Params: `--parent <id>`, `--dependency <id>`, `--related <id>`, `--sprint <id>`, `--tags <tag>`
|
|
50
67
|
|
|
51
68
|
2. **Transition**: `monoco issue open/close/backlog <id>`
|
|
@@ -56,7 +73,8 @@ Use `monoco issue`:
|
|
|
56
73
|
|
|
57
74
|
5. **Modification**: `monoco issue start/submit/delete <id>`
|
|
58
75
|
|
|
59
|
-
6. **
|
|
76
|
+
6. **Sync**: `monoco issue sync-files [id]` (Sync code changes to Issue file)
|
|
77
|
+
|
|
60
78
|
7. **Validation**: `monoco issue lint` (Enforces compliance)
|
|
61
79
|
|
|
62
80
|
## Validation Rules (FEAT-0082)
|
|
@@ -85,3 +103,9 @@ The `status` (folder) and `stage` (front matter) must be compatible:
|
|
|
85
103
|
- **open**: Draft, Doing, Review, Done
|
|
86
104
|
- **backlog**: Draft, Doing, Review
|
|
87
105
|
- **closed**: Done
|
|
106
|
+
|
|
107
|
+
### 5. Environment Policy
|
|
108
|
+
|
|
109
|
+
Linter includes environment-aware guardrails:
|
|
110
|
+
|
|
111
|
+
- 🛑 **Dirty Main Protection**: Fails if uncommitted changes are detected on protected branches (`main`/`master`).
|
|
@@ -8,8 +8,13 @@
|
|
|
8
8
|
- **状态**: `monoco issue open|close|backlog <id>`
|
|
9
9
|
- **检查**: `monoco issue lint` (手动编辑后必须运行)
|
|
10
10
|
- **生命周期**: `monoco issue start|submit|delete <id>`
|
|
11
|
+
- **上下文同步**: `monoco issue sync-files [id]` (更新文件追踪)
|
|
11
12
|
- **结构**: `Issues/{CapitalizedPluralType}/{lowercase_status}/` (如 `Issues/Features/open/`)。
|
|
12
13
|
- **强制规则**:
|
|
13
14
|
1. **标题**: 必须包含 `## {ID}: {Title}` 标题(与 Front Matter 一致)。
|
|
14
15
|
2. **内容**: 至少 2 个 Checkbox,使用 `- [ ]`, `- [x]`, `- [-]`, `- [/]`。
|
|
15
16
|
3. **评审**: `review`/`done` 阶段必须包含 `## Review Comments` 章节且内容不为空。
|
|
17
|
+
4. **环境策略**:
|
|
18
|
+
- 必须使用 `monoco issue start --branch` 创建 Feature 分支。
|
|
19
|
+
- 🛑 **禁止**直接在 `main`/`master` 分支修改代码 (Linter 会报错)。
|
|
20
|
+
- 修改代码后**必须**更新 `files` 字段(通过 `sync-files` 或手动)。
|
|
@@ -38,7 +38,7 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
38
38
|
- **Focus**: "How" (为了支撑系统运转,必须做什么)。
|
|
39
39
|
- **Prefix**: `CHORE-`
|
|
40
40
|
|
|
41
|
-
>
|
|
41
|
+
> 注: 取代了传统的 Task 概念。
|
|
42
42
|
|
|
43
43
|
#### 🐞 FIX (修复)
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
47
47
|
- **Focus**: "Fix" (恢复原状)。
|
|
48
48
|
- **Prefix**: `FIX-`
|
|
49
49
|
|
|
50
|
-
>
|
|
50
|
+
> 注: 取代了传统的 Bug 概念。
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -57,6 +57,24 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
57
57
|
- **次要**: `CHORE` (工程维护/支撑) - 通常独立存在。
|
|
58
58
|
- **原子性原则**: Feature = Design + Dev + Test + Doc + i18n。它们是一体的。
|
|
59
59
|
|
|
60
|
+
## 工作流策略 (Workflow Policies)
|
|
61
|
+
|
|
62
|
+
### 1. 严格 Git 工作流 (Strict Git Workflow)
|
|
63
|
+
|
|
64
|
+
Monoco 强制采用 **Feature Branch** 模式。
|
|
65
|
+
|
|
66
|
+
- **Start**: 必须使用 `monoco issue start <ID> --branch` 启动任务。这会自动创建 `feat/<ID>-<slug>` 分支。
|
|
67
|
+
- **禁止主干开发**: **严禁** 直接在 `main`, `master`, `production` 分支上修改代码。Linter 会拦截此类行为。
|
|
68
|
+
- **Submit**: 在提交 PR 前,运行 `monoco issue submit <ID>` 进行清理和预发布检查。
|
|
69
|
+
|
|
70
|
+
### 2. 文件追踪 (File Tracking)
|
|
71
|
+
|
|
72
|
+
为了保证上下文的自包含性 (Self-Contained Context),Agent 必须记录修改过的文件。
|
|
73
|
+
|
|
74
|
+
- **机制**: Issue Ticket 的 Front Matter 包含 `files: []` 字段。
|
|
75
|
+
- **自动化 (推荐)**: 在 Feature Branch 中运行 `monoco issue sync-files`。它会自动对比当前分支与 Base 分支的差异并更新列表。
|
|
76
|
+
- **手动 (备选)**: 如果进行非分支开发,Agent 必须**主动**将修改的文件路径写入 `files` 列表。
|
|
77
|
+
|
|
60
78
|
## 准则 (Guidelines)
|
|
61
79
|
|
|
62
80
|
### 目录结构
|
|
@@ -68,10 +86,9 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
68
86
|
|
|
69
87
|
### 路径流转
|
|
70
88
|
|
|
71
|
-
使用 `monoco issue
|
|
89
|
+
使用 `monoco issue`:
|
|
72
90
|
|
|
73
91
|
1. **Create**: `monoco issue create <type> --title "..."`
|
|
74
|
-
|
|
75
92
|
- Params: `--parent <id>`, `--dependency <id>`, `--related <id>`, `--sprint <id>`, `--tags <tag>`
|
|
76
93
|
|
|
77
94
|
2. **Transition**: `monoco issue open/close/backlog <id>`
|
|
@@ -82,18 +99,19 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
82
99
|
|
|
83
100
|
5. **Modification**: `monoco issue start/submit/delete <id>`
|
|
84
101
|
|
|
85
|
-
6. **
|
|
102
|
+
6. **Sync**: `monoco issue sync-files [id]` (同步代码变更到 Issue 文件)
|
|
103
|
+
|
|
86
104
|
7. **Validation**: `monoco issue lint` (强制执行合规性检查)
|
|
87
105
|
|
|
88
106
|
## 合规与结构校验 (Validation Rules)
|
|
89
107
|
|
|
90
|
-
为了确保数据严谨性,所有 Issue Ticket
|
|
108
|
+
为了确保数据严谨性,所有 Issue Ticket 必须遵循以下强制规则:
|
|
91
109
|
|
|
92
110
|
### 1. 结构一致性 (Structural Consistency)
|
|
93
111
|
|
|
94
112
|
- 必须包含一个二级标题 (`##`),内容必须与 Front Matter 中的 ID 和 Title 严格匹配。
|
|
95
|
-
-
|
|
96
|
-
-
|
|
113
|
+
- 格式: `## {ID}: {Title}`
|
|
114
|
+
- 示例: `## FEAT-0082: Issue Ticket Validator`
|
|
97
115
|
|
|
98
116
|
### 2. 内容完整性 (Content Completeness)
|
|
99
117
|
|
|
@@ -103,12 +121,18 @@ Monoco 不仅仅复刻 Jira,而是基于 **"思维模式 (Mindset)"** 重新
|
|
|
103
121
|
### 3. Checkbox 语法与层级 (Checkbox Matrix)
|
|
104
122
|
|
|
105
123
|
- 仅限使用: `- [ ]`, `- [x]`, `- [-]`, `- [/]`。
|
|
106
|
-
- **层级继承**: 若存在嵌套 Checkbox
|
|
124
|
+
- **层级继承**: 若存在嵌套 Checkbox,父项状态必须正确反映子项的聚合结果(例如: 任一子项为 `[/]` 则父项必为 `[/]`;子项全选则父项为 `[x]`)。
|
|
107
125
|
|
|
108
126
|
### 4. 状态矩阵 (State Matrix)
|
|
109
127
|
|
|
110
|
-
`status` (物理存放目录) 与 `stage` (Front Matter 字段)
|
|
128
|
+
`status` (物理存放目录) 与 `stage` (Front Matter 字段) 必须兼容:
|
|
111
129
|
|
|
112
130
|
- **open**: Draft, Doing, Review, Done
|
|
113
131
|
- **backlog**: Draft, Doing, Review
|
|
114
132
|
- **closed**: Done
|
|
133
|
+
|
|
134
|
+
### 5. 环境策略 (Environment Policy)
|
|
135
|
+
|
|
136
|
+
Linter 包含环境感知防护:
|
|
137
|
+
|
|
138
|
+
- 🛑 **Dirty Main Protection**: 当检测到处于受保护分支 (`main`/`master`) 且存在未提交变更时,Lint 将失败并阻止操作。
|