@jahanxu/trellis 0.4.1 → 0.5.0
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.
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +58 -1
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +17 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +19 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/templates/claude/commands/trellis/handoff.md +90 -387
- package/dist/templates/claude/commands/trellis/pick-task.md +74 -444
- package/dist/templates/claude/hooks/inject-subagent-context.py +17 -101
- package/dist/templates/claude/hooks/ralph-loop.py +1 -0
- package/dist/templates/claude/hooks/session-start.py +170 -54
- package/dist/templates/iflow/commands/trellis/handoff.md +148 -0
- package/dist/templates/iflow/commands/trellis/pick-task.md +145 -0
- package/dist/templates/iflow/hooks/inject-subagent-context.py +1 -0
- package/dist/templates/iflow/hooks/ralph-loop.py +1 -0
- package/dist/templates/iflow/hooks/session-start.py +171 -0
- package/dist/templates/markdown/index.d.ts +9 -0
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +10 -0
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/roles/designer/index.md.txt +57 -0
- package/dist/templates/markdown/spec/roles/designer/mock-data-standards.md.txt +63 -0
- package/dist/templates/markdown/spec/roles/designer/prototype-guidelines.md.txt +49 -0
- package/dist/templates/markdown/spec/roles/frontend-impl/api-integration.md.txt +63 -0
- package/dist/templates/markdown/spec/roles/frontend-impl/index.md.txt +57 -0
- package/dist/templates/markdown/spec/roles/frontend-impl/prototype-to-production.md.txt +57 -0
- package/dist/templates/markdown/spec/roles/pm/index.md.txt +45 -0
- package/dist/templates/markdown/spec/roles/pm/prd-template.md.txt +64 -0
- package/dist/templates/markdown/spec/roles/pm/requirement-checklist.md.txt +43 -0
- package/dist/templates/trellis/index.d.ts +1 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +2 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +3 -2
- package/dist/templates/trellis/scripts/common/cli_adapter.py +4 -3
- package/dist/templates/trellis/scripts/common/developer.py +4 -3
- package/dist/templates/trellis/scripts/common/git_context.py +7 -7
- package/dist/templates/trellis/scripts/common/paths.py +64 -14
- package/dist/templates/trellis/scripts/common/phase.py +2 -2
- package/dist/templates/trellis/scripts/common/registry.py +16 -15
- package/dist/templates/trellis/scripts/common/task_queue.py +10 -10
- package/dist/templates/trellis/scripts/common/task_utils.py +5 -4
- package/dist/templates/trellis/scripts/common/worktree.py +8 -7
- package/dist/templates/trellis/scripts/pool.py +214 -265
- package/dist/templates/trellis/scripts/task.py +3 -116
- package/package.json +3 -3
- package/dist/templates/claude/commands/trellis/before-role-work.md +0 -364
- package/dist/templates/trellis/VERSION +0 -1
- package/dist/templates/trellis/deliverables/README.md +0 -51
- package/dist/templates/trellis/paths.README.md +0 -277
- package/dist/templates/trellis/paths.yaml +0 -41
- package/dist/templates/trellis/pool/implementations.json +0 -5
- package/dist/templates/trellis/pool/prototypes.json +0 -5
- package/dist/templates/trellis/pool/requirements.json +0 -5
- package/dist/templates/trellis/scripts/common/project_paths.py +0 -189
- package/dist/templates/trellis/scripts/handoff_generator.py +0 -380
- package/dist/templates/trellis/spec/roles/designer/index.md +0 -243
- package/dist/templates/trellis/spec/roles/designer/mock-data-standards.md +0 -481
- package/dist/templates/trellis/spec/roles/designer/prototype-guidelines.md +0 -429
- package/dist/templates/trellis/spec/roles/frontend-impl/api-integration.md +0 -565
- package/dist/templates/trellis/spec/roles/frontend-impl/index.md +0 -321
- package/dist/templates/trellis/spec/roles/frontend-impl/state-management.md +0 -599
- package/dist/templates/trellis/spec/roles/pm/index.md +0 -112
- package/dist/templates/trellis/spec/roles/pm/prd-template.md +0 -124
|
@@ -20,8 +20,9 @@ Usage:
|
|
|
20
20
|
python3 task.py list-archive [month] # List archived tasks
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
23
25
|
import sys
|
|
24
|
-
from typing import Optional
|
|
25
26
|
|
|
26
27
|
# IMPORTANT: Force stdout to use UTF-8 on Windows
|
|
27
28
|
# This fixes UnicodeEncodeError when outputting non-ASCII characters
|
|
@@ -83,7 +84,7 @@ def colored(text: str, color: str) -> str:
|
|
|
83
84
|
# Helper Functions
|
|
84
85
|
# =============================================================================
|
|
85
86
|
|
|
86
|
-
def _read_json_file(path: Path) ->
|
|
87
|
+
def _read_json_file(path: Path) -> dict | None:
|
|
87
88
|
"""Read and parse a JSON file."""
|
|
88
89
|
try:
|
|
89
90
|
return json.loads(path.read_text(encoding="utf-8"))
|
|
@@ -868,105 +869,6 @@ def cmd_set_scope(args: argparse.Namespace) -> int:
|
|
|
868
869
|
return 0
|
|
869
870
|
|
|
870
871
|
|
|
871
|
-
# =============================================================================
|
|
872
|
-
# Command: set-role
|
|
873
|
-
# =============================================================================
|
|
874
|
-
|
|
875
|
-
def cmd_set_role(args: argparse.Namespace) -> int:
|
|
876
|
-
"""Set role for three-role collaboration."""
|
|
877
|
-
repo_root = get_repo_root()
|
|
878
|
-
target_dir = _resolve_task_dir(args.dir, repo_root)
|
|
879
|
-
role = args.role
|
|
880
|
-
|
|
881
|
-
if not role:
|
|
882
|
-
print(colored("Error: Missing arguments", Colors.RED))
|
|
883
|
-
print("Usage: python3 task.py set-role <task-dir> <pm|designer|frontend>")
|
|
884
|
-
return 1
|
|
885
|
-
|
|
886
|
-
task_json = target_dir / FILE_TASK_JSON
|
|
887
|
-
if not task_json.is_file():
|
|
888
|
-
print(colored(f"Error: task.json not found at {target_dir}", Colors.RED))
|
|
889
|
-
return 1
|
|
890
|
-
|
|
891
|
-
data = _read_json_file(task_json)
|
|
892
|
-
if not data:
|
|
893
|
-
return 1
|
|
894
|
-
|
|
895
|
-
data["role"] = role
|
|
896
|
-
_write_json_file(task_json, data)
|
|
897
|
-
|
|
898
|
-
print(colored(f"✓ Role set to: {role}", Colors.GREEN))
|
|
899
|
-
print()
|
|
900
|
-
print(colored("Next steps:", Colors.BLUE))
|
|
901
|
-
print(f" 1. Read role spec: cat .trellis/spec/roles/{role}/index.md")
|
|
902
|
-
print(f" 2. Set as current: python3 task.py start {args.dir}")
|
|
903
|
-
return 0
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
# =============================================================================
|
|
907
|
-
# Command: set-source
|
|
908
|
-
# =============================================================================
|
|
909
|
-
|
|
910
|
-
def cmd_set_source(args: argparse.Namespace) -> int:
|
|
911
|
-
"""Set upstream source reference for three-role collaboration."""
|
|
912
|
-
repo_root = get_repo_root()
|
|
913
|
-
target_dir = _resolve_task_dir(args.dir, repo_root)
|
|
914
|
-
pool_type = args.pool_type
|
|
915
|
-
task_id = args.task_id
|
|
916
|
-
|
|
917
|
-
if not pool_type or not task_id:
|
|
918
|
-
print(colored("Error: Missing arguments", Colors.RED))
|
|
919
|
-
print("Usage: python3 task.py set-source <task-dir> <requirements|prototypes> <task-id>")
|
|
920
|
-
return 1
|
|
921
|
-
|
|
922
|
-
task_json = target_dir / FILE_TASK_JSON
|
|
923
|
-
if not task_json.is_file():
|
|
924
|
-
print(colored(f"Error: task.json not found at {target_dir}", Colors.RED))
|
|
925
|
-
return 1
|
|
926
|
-
|
|
927
|
-
# Read pool to find upstream task
|
|
928
|
-
import sys
|
|
929
|
-
sys.path.insert(0, str(Path(__file__).parent))
|
|
930
|
-
from pool import get_pool_file, read_pool, find_task_in_pool
|
|
931
|
-
|
|
932
|
-
pool_file = get_pool_file(pool_type, repo_root)
|
|
933
|
-
pool_data = read_pool(pool_file)
|
|
934
|
-
|
|
935
|
-
status, upstream_task = find_task_in_pool(pool_data, task_id)
|
|
936
|
-
|
|
937
|
-
if not status:
|
|
938
|
-
print(colored(f"Error: Task '{task_id}' not found in {pool_type} pool", Colors.RED))
|
|
939
|
-
return 1
|
|
940
|
-
|
|
941
|
-
if status == "consumed":
|
|
942
|
-
print(colored(f"Warning: Task '{task_id}' is already consumed", Colors.YELLOW))
|
|
943
|
-
confirm = input("Continue anyway? [y/N] ")
|
|
944
|
-
if confirm.lower() != 'y':
|
|
945
|
-
return 0
|
|
946
|
-
|
|
947
|
-
# Create source.json
|
|
948
|
-
source_data = {
|
|
949
|
-
"based_on": {
|
|
950
|
-
"type": pool_type.rstrip('s'), # requirements -> requirement
|
|
951
|
-
"id": task_id,
|
|
952
|
-
"path": upstream_task["path"],
|
|
953
|
-
"handoff_doc": upstream_task["handoff_doc"]
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
source_file = target_dir / "source.json"
|
|
958
|
-
source_file.write_text(json.dumps(source_data, indent=2, ensure_ascii=False), encoding="utf-8")
|
|
959
|
-
|
|
960
|
-
print(colored(f"✓ Source reference set", Colors.GREEN))
|
|
961
|
-
print(f" Type: {pool_type}")
|
|
962
|
-
print(f" ID: {task_id}")
|
|
963
|
-
print(f" Path: {upstream_task['path']}")
|
|
964
|
-
print()
|
|
965
|
-
print(colored("Upstream context will be auto-injected when you start this task", Colors.BLUE))
|
|
966
|
-
|
|
967
|
-
return 0
|
|
968
|
-
|
|
969
|
-
|
|
970
872
|
# =============================================================================
|
|
971
873
|
# Command: create-pr (delegates to multi-agent script)
|
|
972
874
|
# =============================================================================
|
|
@@ -1005,8 +907,6 @@ Usage:
|
|
|
1005
907
|
python3 task.py finish Clear current task
|
|
1006
908
|
python3 task.py set-branch <dir> <branch> Set git branch for multi-agent
|
|
1007
909
|
python3 task.py set-scope <dir> <scope> Set scope for PR title
|
|
1008
|
-
python3 task.py set-role <dir> <role> Set role (pm|designer|frontend)
|
|
1009
|
-
python3 task.py set-source <dir> <pool> <task-id> Set upstream source reference
|
|
1010
910
|
python3 task.py create-pr [dir] [--dry-run] Create PR from task
|
|
1011
911
|
python3 task.py archive <task-name> Archive completed task
|
|
1012
912
|
python3 task.py list [--mine] [--status <status>] List tasks
|
|
@@ -1097,17 +997,6 @@ def main() -> int:
|
|
|
1097
997
|
p_scope.add_argument("dir", help="Task directory")
|
|
1098
998
|
p_scope.add_argument("scope", help="Scope name")
|
|
1099
999
|
|
|
1100
|
-
# set-role
|
|
1101
|
-
p_role = subparsers.add_parser("set-role", help="Set role (pm|designer|frontend)")
|
|
1102
|
-
p_role.add_argument("dir", help="Task directory")
|
|
1103
|
-
p_role.add_argument("role", choices=["pm", "designer", "frontend"], help="Role type")
|
|
1104
|
-
|
|
1105
|
-
# set-source
|
|
1106
|
-
p_source = subparsers.add_parser("set-source", help="Set upstream source")
|
|
1107
|
-
p_source.add_argument("dir", help="Task directory")
|
|
1108
|
-
p_source.add_argument("pool_type", choices=["requirements", "prototypes"], help="Upstream pool type")
|
|
1109
|
-
p_source.add_argument("task_id", help="Upstream task ID")
|
|
1110
|
-
|
|
1111
1000
|
# create-pr
|
|
1112
1001
|
p_pr = subparsers.add_parser("create-pr", help="Create PR")
|
|
1113
1002
|
p_pr.add_argument("dir", nargs="?", help="Task directory")
|
|
@@ -1143,8 +1032,6 @@ def main() -> int:
|
|
|
1143
1032
|
"set-branch": cmd_set_branch,
|
|
1144
1033
|
"set-base-branch": cmd_set_base_branch,
|
|
1145
1034
|
"set-scope": cmd_set_scope,
|
|
1146
|
-
"set-role": cmd_set_role,
|
|
1147
|
-
"set-source": cmd_set_source,
|
|
1148
1035
|
"create-pr": cmd_create_pr,
|
|
1149
1036
|
"archive": cmd_archive,
|
|
1150
1037
|
"list": cmd_list,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahanxu/trellis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"memory",
|
|
25
25
|
"trellis"
|
|
26
26
|
],
|
|
27
|
-
"author": "
|
|
27
|
+
"author": "jahanxu",
|
|
28
28
|
"license": "AGPL-3.0-only",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"chalk": "^5.3.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
62
|
-
"url": "https://github.com/
|
|
62
|
+
"url": "https://github.com/mindfold-ai/trellis.git"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsc && pnpm run copy-templates",
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
# Before Role Work - 加载角色工作规范
|
|
2
|
-
|
|
3
|
-
在开始任务前,加载并展示当前角色的工作规范,帮助 AI 和用户理解角色职责和标准。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 使用场景
|
|
8
|
-
|
|
9
|
-
| 角色 | 何时使用 | 读取什么 |
|
|
10
|
-
|------|---------|---------|
|
|
11
|
-
| **PM** | 编写 PRD 前 | PM 工作规范、PRD 模板 |
|
|
12
|
-
| **Designer** | 创建原型前 | Designer 工作规范、原型标准 |
|
|
13
|
-
| **Frontend** | 补充逻辑前 | Frontend 工作规范、API 集成指南 |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 命令格式
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
/trellis:before-role-work
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**无需参数** - 自动检测当前任务的角色
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 执行流程
|
|
28
|
-
|
|
29
|
-
### Step 1: 检测当前任务
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
cat .trellis/.current-task
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**输出示例**:`.trellis/tasks/designer/02-28-user-login`
|
|
36
|
-
|
|
37
|
-
**如果没有当前任务**:
|
|
38
|
-
```
|
|
39
|
-
Error: 没有设置当前任务
|
|
40
|
-
|
|
41
|
-
请先执行以下命令之一:
|
|
42
|
-
- 创建新任务:python3 .trellis/scripts/task.py create "<title>"
|
|
43
|
-
- 或选择任务:/trellis:pick-task <pool-type> <task-id>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
### Step 2: 读取任务角色
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
cat <task_dir>/task.json | jq -r '.role'
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**输出示例**:`designer`
|
|
55
|
-
|
|
56
|
-
**如果 task.json 缺少 role 字段**:
|
|
57
|
-
```
|
|
58
|
-
Error: task.json 缺少 role 字段
|
|
59
|
-
|
|
60
|
-
请先设置角色:
|
|
61
|
-
python3 .trellis/scripts/task.py set-role <task-dir> <pm|designer|frontend>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
### Step 3: 读取角色规范
|
|
67
|
-
|
|
68
|
-
**规范文件路径**:
|
|
69
|
-
```python
|
|
70
|
-
role_spec_dir = f".trellis/spec/roles/{role}/"
|
|
71
|
-
index_file = f"{role_spec_dir}/index.md"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**角色规范映射**:
|
|
75
|
-
| Role | 规范目录 | 主文件 |
|
|
76
|
-
|------|---------|--------|
|
|
77
|
-
| `pm` | `.trellis/spec/roles/pm/` | `index.md` |
|
|
78
|
-
| `designer` | `.trellis/spec/roles/designer/` | `index.md` |
|
|
79
|
-
| `frontend` | `.trellis/spec/roles/frontend-impl/` | `index.md` |
|
|
80
|
-
|
|
81
|
-
**读取文件**:
|
|
82
|
-
```bash
|
|
83
|
-
cat <index_file>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**如果文件不存在**:
|
|
87
|
-
```
|
|
88
|
-
Warning: 角色规范文件未找到
|
|
89
|
-
|
|
90
|
-
路径: .trellis/spec/roles/<role>/index.md
|
|
91
|
-
|
|
92
|
-
建议:
|
|
93
|
-
1. 创建规范文件(参考 Trellis 设计文档)
|
|
94
|
-
2. 或跳过此步骤,直接开始开发
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
### Step 4: 读取补充文档(可选)
|
|
100
|
-
|
|
101
|
-
**根据角色加载额外文档**:
|
|
102
|
-
|
|
103
|
-
#### PM 角色
|
|
104
|
-
```bash
|
|
105
|
-
# PRD 模板
|
|
106
|
-
cat .trellis/spec/roles/pm/prd-template.md
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
#### Designer 角色
|
|
110
|
-
```bash
|
|
111
|
-
# 原型代码指南
|
|
112
|
-
cat .trellis/spec/roles/designer/prototype-guidelines.md
|
|
113
|
-
|
|
114
|
-
# Mock 数据标准
|
|
115
|
-
cat .trellis/spec/roles/designer/mock-data-standards.md
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### Frontend 角色
|
|
119
|
-
```bash
|
|
120
|
-
# API 集成指南
|
|
121
|
-
cat .trellis/spec/roles/frontend-impl/api-integration.md
|
|
122
|
-
|
|
123
|
-
# 状态管理规范
|
|
124
|
-
cat .trellis/spec/roles/frontend-impl/state-management.md
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**注意**:补充文档是可选的,如果文件不存在,跳过即可。
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
### Step 5: 展示给用户
|
|
132
|
-
|
|
133
|
-
**格式化输出**:
|
|
134
|
-
|
|
135
|
-
```markdown
|
|
136
|
-
=== PM 工作规范 ===
|
|
137
|
-
|
|
138
|
-
## 角色定位
|
|
139
|
-
产品经理(PM)是三角色协作流水线的第一环...
|
|
140
|
-
|
|
141
|
-
## 工作流程
|
|
142
|
-
1. 创建任务
|
|
143
|
-
2. 编写PRD
|
|
144
|
-
3. 完成并交接
|
|
145
|
-
|
|
146
|
-
## PRD标准
|
|
147
|
-
### 必需章节
|
|
148
|
-
1. 功能概述
|
|
149
|
-
2. 用户故事
|
|
150
|
-
...
|
|
151
|
-
|
|
152
|
-
[完整规范内容]
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
=== 补充文档 ===
|
|
157
|
-
|
|
158
|
-
## PRD 模板
|
|
159
|
-
[prd-template.md 内容...]
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
📖 阅读完毕。现在开始按照规范工作吧!
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
### Step 6: 可选 - 高亮关键信息
|
|
169
|
-
|
|
170
|
-
**AI 可以提取并高亮关键检查清单**:
|
|
171
|
-
|
|
172
|
-
#### PM 关键要点
|
|
173
|
-
```
|
|
174
|
-
📋 PM 工作检查清单:
|
|
175
|
-
|
|
176
|
-
在执行 /trellis:handoff 前,确保:
|
|
177
|
-
□ PRD包含所有必需章节
|
|
178
|
-
□ 用户故事清晰完整
|
|
179
|
-
□ 验收标准可测试
|
|
180
|
-
□ 非功能需求已明确
|
|
181
|
-
□ 相关资源链接有效
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
#### Designer 关键要点
|
|
185
|
-
```
|
|
186
|
-
📋 Designer 工作检查清单:
|
|
187
|
-
|
|
188
|
-
在执行 /trellis:handoff 前,确保:
|
|
189
|
-
□ 原型可运行(npm run dev 无报错)
|
|
190
|
-
□ 所有交互可操作
|
|
191
|
-
□ Mock数据结构合理
|
|
192
|
-
□ TODO注释清晰
|
|
193
|
-
□ 组件命名语义化
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
#### Frontend 关键要点
|
|
197
|
-
```
|
|
198
|
-
📋 Frontend 工作检查清单:
|
|
199
|
-
|
|
200
|
-
在执行 /trellis:handoff 前,确保:
|
|
201
|
-
□ 所有PRD要求的功能已实现
|
|
202
|
-
□ Mock API已全部替换为真实API
|
|
203
|
-
□ 错误处理完善
|
|
204
|
-
□ TypeScript编译无错误
|
|
205
|
-
□ 单元测试覆盖核心逻辑
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## 错误处理
|
|
211
|
-
|
|
212
|
-
### 错误场景1:没有当前任务
|
|
213
|
-
```
|
|
214
|
-
Error: 没有设置当前任务
|
|
215
|
-
|
|
216
|
-
请先创建或选择任务:
|
|
217
|
-
- 新任务:python3 .trellis/scripts/task.py create "<title>"
|
|
218
|
-
- 选择任务:/trellis:pick-task <pool-type> <task-id>
|
|
219
|
-
- 恢复任务:python3 .trellis/scripts/task.py start <task-dir>
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### 错误场景2:task.json 缺少 role 字段
|
|
223
|
-
```
|
|
224
|
-
Error: 无法确定任务角色
|
|
225
|
-
|
|
226
|
-
task.json 缺少 role 字段,请先设置:
|
|
227
|
-
python3 .trellis/scripts/task.py set-role <task-dir> <pm|designer|frontend>
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### 错误场景3:角色规范文件不存在
|
|
231
|
-
```
|
|
232
|
-
Warning: 角色规范文件未找到
|
|
233
|
-
|
|
234
|
-
路径: .trellis/spec/roles/<role>/index.md
|
|
235
|
-
|
|
236
|
-
可能原因:
|
|
237
|
-
- 项目尚未配置角色规范
|
|
238
|
-
- role 字段值错误
|
|
239
|
-
|
|
240
|
-
建议:
|
|
241
|
-
1. 检查 role 字段:pm | designer | frontend
|
|
242
|
-
2. 创建规范文件(参考设计文档)
|
|
243
|
-
3. 或跳过此步骤,直接开始工作
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## 示例执行流程
|
|
249
|
-
|
|
250
|
-
### Designer 开始工作前加载规范
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
# 用户执行命令
|
|
254
|
-
/trellis:before-role-work
|
|
255
|
-
|
|
256
|
-
# AI 执行流程
|
|
257
|
-
1. 读取当前任务:.trellis/tasks/designer/02-28-user-login
|
|
258
|
-
2. 读取 task.json:role=designer ✅
|
|
259
|
-
3. 读取规范:.trellis/spec/roles/designer/index.md
|
|
260
|
-
4. 读取补充文档:
|
|
261
|
-
- prototype-guidelines.md
|
|
262
|
-
- mock-data-standards.md
|
|
263
|
-
5. 展示给用户
|
|
264
|
-
|
|
265
|
-
# AI 输出
|
|
266
|
-
=== Designer 工作规范 ===
|
|
267
|
-
|
|
268
|
-
## 角色定位
|
|
269
|
-
交互设计师(Designer)是三角色协作流水线的第二环...
|
|
270
|
-
|
|
271
|
-
## 工作流程
|
|
272
|
-
1. 选择需求:/trellis:pick-task requirements <task-id>
|
|
273
|
-
2. 创建原型
|
|
274
|
-
3. 完成并交接:/trellis:handoff
|
|
275
|
-
|
|
276
|
-
## 原型代码标准
|
|
277
|
-
### 必需要素
|
|
278
|
-
1. 可运行性 - 原型可以直接 npm run dev 运行
|
|
279
|
-
2. Mock数据规范 - 集中管理,易于替换
|
|
280
|
-
3. Mock API位置标注 - 使用清晰的TODO注释
|
|
281
|
-
|
|
282
|
-
...
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
📋 Designer 工作检查清单:
|
|
287
|
-
|
|
288
|
-
在执行 /trellis:handoff 前,确保:
|
|
289
|
-
□ 原型可运行(npm run dev 无报错)
|
|
290
|
-
□ 所有交互可操作(按钮、表单、链接)
|
|
291
|
-
□ Mock数据结构合理(接近真实API)
|
|
292
|
-
□ TODO注释清晰(标注需要替换的Mock)
|
|
293
|
-
□ 组件命名语义化
|
|
294
|
-
□ 已测试关键交互流程
|
|
295
|
-
□ HANDOFF文档包含所有关键信息
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
📖 规范已加载。现在开始按照标准创建原型吧!
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## 高级功能(可选)
|
|
305
|
-
|
|
306
|
-
### 自动调用
|
|
307
|
-
```
|
|
308
|
-
在某些情况下,AI 可以自动调用此命令(无需用户明确请求):
|
|
309
|
-
|
|
310
|
-
触发条件:
|
|
311
|
-
- 用户首次开始任务(task.py start 后)
|
|
312
|
-
- 用户询问"我应该做什么"、"如何开始"
|
|
313
|
-
|
|
314
|
-
AI 主动提示:
|
|
315
|
-
"我注意到这是一个 Designer 任务,让我先加载工作规范..."
|
|
316
|
-
[自动执行 /trellis:before-role-work]
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### 只显示检查清单
|
|
320
|
-
```bash
|
|
321
|
-
# 用户可能只想看检查清单,不看完整规范
|
|
322
|
-
/trellis:before-role-work --checklist
|
|
323
|
-
|
|
324
|
-
AI 只输出检查清单部分
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
## 与其他命令的集成
|
|
330
|
-
|
|
331
|
-
### 与 /trellis:pick-task 集成
|
|
332
|
-
```
|
|
333
|
-
在 /trellis:pick-task 执行完成后,AI 可以提示:
|
|
334
|
-
|
|
335
|
-
"任务已创建。是否查看 Designer 工作规范?
|
|
336
|
-
执行:/trellis:before-role-work"
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### 与 /trellis:start 集成
|
|
340
|
-
```
|
|
341
|
-
在 /trellis:start 执行完成后,AI 可以自动加载规范:
|
|
342
|
-
|
|
343
|
-
"已设置当前任务。正在加载 PM 工作规范..."
|
|
344
|
-
[自动执行 /trellis:before-role-work]
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
## 注意事项
|
|
350
|
-
|
|
351
|
-
1. **规范更新**:角色规范文件应该随着项目演进而更新
|
|
352
|
-
2. **团队定制**:不同团队可以定制自己的角色规范
|
|
353
|
-
3. **版本控制**:规范文件应该提交到 git,团队共享
|
|
354
|
-
4. **可选性**:此命令是辅助性的,用户可以选择跳过
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## 命令别名(可选)
|
|
359
|
-
|
|
360
|
-
用户可能使用以下变体,AI 应识别并执行相同逻辑:
|
|
361
|
-
- `/trellis:before-role-work`
|
|
362
|
-
- `/before-work`
|
|
363
|
-
- "/加载工作规范"
|
|
364
|
-
- "我应该如何开始这个任务"(AI 主动调用)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.4.0
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Deliverables - 三角色产出物池
|
|
2
|
-
|
|
3
|
-
本目录存放PM、Designer、Frontend三个角色的产出物。
|
|
4
|
-
|
|
5
|
-
## 目录结构
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
deliverables/
|
|
9
|
-
├── requirements/ # PM产出池:需求文档
|
|
10
|
-
├── prototypes/ # Designer产出池:前端原型代码
|
|
11
|
-
└── production/ # Frontend产出池:生产代码
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## 工作流程
|
|
15
|
-
|
|
16
|
-
### PM角色
|
|
17
|
-
1. 在 `.trellis/tasks/pm/` 创建任务
|
|
18
|
-
2. 编写PRD和用户故事
|
|
19
|
-
3. 执行 `/trellis:handoff` 生成HANDOFF.md
|
|
20
|
-
4. 产出自动进入 `deliverables/requirements/{task-id}/`
|
|
21
|
-
|
|
22
|
-
### Designer角色
|
|
23
|
-
1. 执行 `/trellis:pick-task requirements {task-id}` 选择需求
|
|
24
|
-
2. 基于需求生成前端原型(带Mock数据)
|
|
25
|
-
3. 执行 `/trellis:handoff` 生成HANDOFF.md
|
|
26
|
-
4. 产出自动进入 `deliverables/prototypes/{task-id}/`
|
|
27
|
-
|
|
28
|
-
### Frontend角色
|
|
29
|
-
1. 执行 `/trellis:pick-task prototypes {task-id}` 选择原型
|
|
30
|
-
2. 补充真实API调用和业务逻辑
|
|
31
|
-
3. 执行 `/trellis:handoff` 生成HANDOFF.md
|
|
32
|
-
4. 产出自动进入 `deliverables/production/{task-id}/`
|
|
33
|
-
|
|
34
|
-
## 产出物要求
|
|
35
|
-
|
|
36
|
-
每个产出目录必须包含:
|
|
37
|
-
- `HANDOFF.md` - 交接文档(AI自动生成)
|
|
38
|
-
- 角色相关的产出文件(PRD、代码等)
|
|
39
|
-
|
|
40
|
-
## 任务池状态
|
|
41
|
-
|
|
42
|
-
产出物状态由 `.trellis/pool/{pool-type}.json` 管理:
|
|
43
|
-
- `available` - 可被下游消费
|
|
44
|
-
- `consumed` - 已被下游领取
|
|
45
|
-
|
|
46
|
-
查看任务池状态:
|
|
47
|
-
```bash
|
|
48
|
-
python3 .trellis/scripts/pool.py list requirements
|
|
49
|
-
python3 .trellis/scripts/pool.py list prototypes
|
|
50
|
-
python3 .trellis/scripts/pool.py list implementations
|
|
51
|
-
```
|