Skip to content

Commit ce3d99d

Browse files
committed
feat: 更新任务管理器,新增 JSON Schema 验证功能,增强任务数据的有效性和一致性,同时添加多个请求和响应的示例,优化错误处理和字段转换工具,提升系统的健壮性和可维护性
1 parent 6216454 commit ce3d99d

22 files changed

Lines changed: 4050 additions & 3 deletions

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"prepare": "husky",
6060
"prepack": "pnpm run build",
6161
"prepublishOnly": "pnpm run ci && pnpm run build",
62-
"ci": "pnpm run type-check && pnpm run lint && pnpm run test",
62+
"validate:schemas": "node scripts/validate-schemas.js",
63+
"ci": "pnpm run type-check && pnpm run lint && pnpm run test && pnpm run validate:schemas",
6364
"ci:full": "pnpm run clean && pnpm run ci && pnpm run build && pnpm run test:coverage",
6465
"release": "pnpm run ci:full",
6566
"health": "node -e \"console.log('Node.js version:', process.version); console.log('Platform:', process.platform); console.log('Architecture:', process.arch);\"",
@@ -86,6 +87,8 @@
8687
"@typescript-eslint/eslint-plugin": "^6.0.0",
8788
"@typescript-eslint/parser": "^6.0.0",
8889
"@vitest/coverage-v8": "^1.6.1",
90+
"ajv": "^8.17.1",
91+
"ajv-formats": "^2.1.1",
8992
"eslint": "^8.0.0",
9093
"husky": "^9.1.7",
9194
"lint-staged": "^16.1.6",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://waveforge.dev/schemas/current_task_complete_request.schema.json",
4+
"title": "Current Task Complete Request",
5+
"description": "Request schema for current_task_complete MCP tool",
6+
"type": "object",
7+
"properties": {
8+
"summary": {
9+
"type": "string",
10+
"minLength": 1,
11+
"maxLength": 2000,
12+
"description": "Task completion summary"
13+
},
14+
"generate_docs": {
15+
"type": "boolean",
16+
"default": true,
17+
"description": "Whether to generate documentation"
18+
},
19+
"project_id": {
20+
"type": "string",
21+
"pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
22+
"description": "Project ID (optional, overrides default binding)"
23+
}
24+
},
25+
"required": ["summary"],
26+
"additionalProperties": false
27+
}
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://waveforge.dev/schemas/current_task_complete_response.schema.json",
4+
"title": "Current Task Complete Response",
5+
"description": "Response schema for current_task_complete MCP tool",
6+
"type": "object",
7+
"properties": {
8+
"completed": {
9+
"type": "boolean",
10+
"description": "Whether the task was successfully completed"
11+
},
12+
"evr_summary": {
13+
"type": "object",
14+
"properties": {
15+
"total": {
16+
"type": "integer",
17+
"minimum": 0
18+
},
19+
"passed": {
20+
"type": "array",
21+
"items": {
22+
"type": "string",
23+
"pattern": "^evr-\\d+$"
24+
}
25+
},
26+
"skipped": {
27+
"type": "array",
28+
"items": {
29+
"type": "string",
30+
"pattern": "^evr-\\d+$"
31+
}
32+
},
33+
"failed": {
34+
"type": "array",
35+
"items": {
36+
"type": "string",
37+
"pattern": "^evr-\\d+$"
38+
}
39+
},
40+
"unknown": {
41+
"type": "array",
42+
"items": {
43+
"type": "string",
44+
"pattern": "^evr-\\d+$"
45+
}
46+
},
47+
"unreferenced": {
48+
"type": "array",
49+
"items": {
50+
"type": "string",
51+
"pattern": "^evr-\\d+$"
52+
}
53+
}
54+
},
55+
"required": [
56+
"total",
57+
"passed",
58+
"skipped",
59+
"failed",
60+
"unknown",
61+
"unreferenced"
62+
],
63+
"description": "EVR summary at completion"
64+
},
65+
"evr_required_final": {
66+
"type": "array",
67+
"items": {
68+
"type": "object",
69+
"properties": {
70+
"evr_id": {
71+
"type": "string",
72+
"pattern": "^evr-\\d+$"
73+
},
74+
"reason": {
75+
"type": "string",
76+
"enum": ["need_reason_for_skip", "status_unknown", "failed"]
77+
}
78+
},
79+
"required": ["evr_id", "reason"]
80+
},
81+
"description": "EVRs that need final verification (empty if task can complete)"
82+
},
83+
"evr_unreferenced": {
84+
"type": "array",
85+
"items": {
86+
"type": "object",
87+
"properties": {
88+
"evr_id": {
89+
"type": "string",
90+
"pattern": "^evr-\\d+$"
91+
},
92+
"reason": {
93+
"type": "string",
94+
"description": "Reason why EVR is unreferenced"
95+
}
96+
},
97+
"required": ["evr_id", "reason"]
98+
},
99+
"description": "Unreferenced EVRs with suggestions"
100+
},
101+
"task_completed_at": {
102+
"type": "string",
103+
"format": "date-time",
104+
"description": "Task completion timestamp"
105+
},
106+
"generated_docs": {
107+
"type": "array",
108+
"items": {
109+
"type": "string"
110+
},
111+
"description": "Paths to generated documentation files"
112+
},
113+
"logs_highlights": {
114+
"type": "array",
115+
"items": {
116+
"type": "object",
117+
"properties": {
118+
"ts": {
119+
"type": "string",
120+
"format": "date-time"
121+
},
122+
"level": {
123+
"type": "string",
124+
"enum": ["INFO", "WARN", "ERROR"]
125+
},
126+
"category": {
127+
"type": "string",
128+
"enum": [
129+
"TEST",
130+
"TASK",
131+
"EXCEPTION",
132+
"DISCUSSION",
133+
"PLAN",
134+
"SYSTEM",
135+
"HEALTH"
136+
]
137+
},
138+
"action": {
139+
"type": "string",
140+
"enum": [
141+
"UPDATE",
142+
"CREATE",
143+
"MODIFY",
144+
"SWITCH",
145+
"HANDLE",
146+
"COMPLETE"
147+
]
148+
},
149+
"message": {
150+
"type": "string",
151+
"minLength": 1
152+
}
153+
},
154+
"required": ["ts", "level", "category", "action", "message"]
155+
},
156+
"maxItems": 10,
157+
"description": "Recent log highlights"
158+
}
159+
},
160+
"required": ["completed"],
161+
"allOf": [
162+
{
163+
"if": {
164+
"properties": {
165+
"completed": {
166+
"const": true
167+
}
168+
}
169+
},
170+
"then": {
171+
"required": ["evr_summary", "task_completed_at", "logs_highlights"]
172+
}
173+
},
174+
{
175+
"if": {
176+
"properties": {
177+
"completed": {
178+
"const": false
179+
}
180+
}
181+
},
182+
"then": {
183+
"required": ["evr_required_final"]
184+
}
185+
}
186+
],
187+
"additionalProperties": false
188+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://waveforge.dev/schemas/current_task_modify_request.schema.json",
4+
"title": "Current Task Modify Request",
5+
"description": "Request schema for current_task_modify MCP tool",
6+
"type": "object",
7+
"properties": {
8+
"field": {
9+
"type": "string",
10+
"enum": [
11+
"title",
12+
"goal",
13+
"requirements",
14+
"plan",
15+
"steps",
16+
"evr",
17+
"issues",
18+
"hints"
19+
],
20+
"description": "Field to modify: goal=acceptance criteria, plan=overall plan, steps=plan steps, evr=EVR content, hints=user hints"
21+
},
22+
"content": {
23+
"oneOf": [
24+
{
25+
"type": "string",
26+
"minLength": 1
27+
},
28+
{
29+
"type": "array",
30+
"items": {
31+
"type": "string",
32+
"minLength": 1
33+
},
34+
"minItems": 1
35+
},
36+
{
37+
"type": "object",
38+
"properties": {
39+
"items": {
40+
"type": "array",
41+
"items": {
42+
"type": "object",
43+
"properties": {
44+
"evr_id": {
45+
"type": "string",
46+
"pattern": "^evr-\\d+$"
47+
},
48+
"title": {
49+
"type": "string",
50+
"minLength": 1,
51+
"maxLength": 200
52+
},
53+
"verify": {
54+
"oneOf": [
55+
{
56+
"type": "string",
57+
"minLength": 1
58+
},
59+
{
60+
"type": "array",
61+
"items": {
62+
"type": "string",
63+
"minLength": 1
64+
},
65+
"minItems": 1
66+
}
67+
]
68+
},
69+
"expect": {
70+
"oneOf": [
71+
{
72+
"type": "string",
73+
"minLength": 1
74+
},
75+
{
76+
"type": "array",
77+
"items": {
78+
"type": "string",
79+
"minLength": 1
80+
},
81+
"minItems": 1
82+
}
83+
]
84+
},
85+
"class": {
86+
"type": "string",
87+
"enum": ["runtime", "static"],
88+
"default": "runtime"
89+
}
90+
}
91+
},
92+
"minItems": 1
93+
},
94+
"evr_ids": {
95+
"type": "array",
96+
"items": {
97+
"type": "string",
98+
"pattern": "^evr-\\d+$"
99+
},
100+
"description": "EVR IDs for remove/rebind operations"
101+
}
102+
}
103+
}
104+
],
105+
"description": "Modification content (string, string array, or EVR object)"
106+
},
107+
"reason": {
108+
"type": "string",
109+
"minLength": 1,
110+
"maxLength": 500,
111+
"description": "Reason for modification"
112+
},
113+
"plan_id": {
114+
"type": "string",
115+
"pattern": "^plan-\\d+$",
116+
"description": "Plan ID for plan-specific modifications"
117+
},
118+
"step_id": {
119+
"type": "string",
120+
"pattern": "^step-\\d+$",
121+
"description": "Step ID for step-specific modifications"
122+
},
123+
"change_type": {
124+
"type": "string",
125+
"enum": [
126+
"generate_steps",
127+
"plan_adjustment",
128+
"steps_adjustment",
129+
"refine_goal",
130+
"bug_fix_replan",
131+
"user_request",
132+
"scope_change"
133+
],
134+
"description": "Type of change"
135+
},
136+
"project_id": {
137+
"type": "string",
138+
"pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
139+
"description": "Project ID (optional, overrides default binding)"
140+
}
141+
},
142+
"required": ["field", "content", "reason", "change_type"],
143+
"additionalProperties": false
144+
}

0 commit comments

Comments
 (0)