@jayyuen66/dsh-dir-prep-organize 0.1.5 → 0.1.6
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/CHANGELOG.md +117 -0
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/agents/academic/academic-statistician.md +143 -0
- package/agents/design/design-inclusive-visuals-specialist.md +4 -3
- package/agents/design/design-ui-designer.md +6 -3
- package/agents/design/design-ux-architect.md +20 -7
- package/agents/design/design-whimsy-injector.md +23 -1
- package/agents/engineering/engineering-autonomous-optimization-architect.md +31 -22
- package/agents/engineering/engineering-backend-architect.md +43 -54
- package/agents/engineering/engineering-data-engineer.md +21 -6
- package/agents/engineering/engineering-database-optimizer.md +22 -10
- package/agents/engineering/engineering-devops-automator.md +12 -3
- package/agents/engineering/engineering-email-intelligence-engineer.md +41 -4
- package/agents/engineering/engineering-embedded-firmware-engineer.md +27 -5
- package/agents/engineering/engineering-feishu-integration-developer.md +10 -2
- package/agents/engineering/engineering-frontend-developer.md +24 -18
- package/agents/engineering/engineering-git-workflow-master.md +16 -4
- package/agents/engineering/engineering-incident-response-commander.md +3 -3
- package/agents/engineering/engineering-prompt-engineer.md +7 -2
- package/agents/engineering/engineering-rapid-prototyper.md +7 -3
- package/agents/engineering/engineering-security-engineer.md +2 -0
- package/agents/engineering/engineering-solidity-smart-contract-engineer.md +1 -1
- package/agents/engineering/engineering-technical-writer.md +4 -4
- package/agents/engineering/engineering-threat-detection-engineer.md +2 -0
- package/agents/engineering/engineering-voice-ai-integration-engineer.md +39 -16
- package/agents/engineering/engineering-wechat-mini-program-developer.md +7 -2
- package/agents/game-development/blender/blender-addon-engineer.md +12 -3
- package/agents/game-development/economy-designer.md +155 -0
- package/agents/game-development/godot/godot-gameplay-scripter.md +4 -0
- package/agents/game-development/godot/godot-multiplayer-engineer.md +6 -2
- package/agents/game-development/godot/godot-shader-developer.md +4 -3
- package/agents/game-development/roblox-studio/roblox-experience-designer.md +7 -6
- package/agents/game-development/roblox-studio/roblox-systems-scripter.md +7 -0
- package/agents/game-development/technical-artist.md +4 -0
- package/agents/game-development/unity/unity-multiplayer-engineer.md +67 -0
- package/agents/game-development/unreal-engine/unreal-multiplayer-architect.md +82 -31
- package/agents/game-development/unreal-engine/unreal-systems-engineer.md +13 -1
- package/agents/marketing/marketing-agentic-search-optimizer.md +50 -87
- package/agents/marketing/marketing-carousel-growth-engine.md +49 -35
- package/agents/marketing/marketing-private-domain-operator.md +2 -2
- package/agents/marketing/marketing-seo-specialist.md +22 -0
- package/agents/product/product-behavioral-nudge-engine.md +3 -0
- package/agents/project-management/project-management-jira-workflow-steward.md +5 -2
- package/agents/security/security-appsec-engineer.md +75 -43
- package/agents/security/security-threat-detection-engineer.md +6 -0
- package/agents/security/security-threat-intelligence-analyst.md +32 -15
- package/agents/specialized/accounts-payable-agent.md +39 -45
- package/agents/specialized/grant-writer.md +2 -2
- package/agents/specialized/healthcare-aging-parent-care-companion.md +396 -0
- package/agents/specialized/identity-graph-operator.md +24 -3
- package/agents/specialized/lsp-index-engineer.md +17 -15
- package/agents/specialized/recruitment-specialist.md +17 -11
- package/agents/specialized/specialized-developer-advocate.md +4 -4
- package/agents/specialized/specialized-fedramp-rmf-compliance.md +379 -0
- package/agents/specialized/specialized-focus-music-architect.md +176 -0
- package/agents/specialized/specialized-french-consulting-market.md +17 -15
- package/agents/specialized/specialized-model-qa.md +78 -34
- package/agents/specialized/specialized-salesforce-architect.md +17 -15
- package/agents/specialized/specialized-workflow-architect.md +2 -2
- package/agents/supply-chain/supply-chain-strategist.md +12 -3
- package/agents/support/support-analytics-reporter.md +48 -30
- package/agents/support/support-finance-tracker.md +36 -18
- package/agents/support/support-infrastructure-maintainer.md +2 -2
- package/agents/support/support-support-responder.md +43 -26
- package/agents/testing/testing-api-tester.md +37 -27
- package/agents/testing/testing-performance-benchmarker.md +82 -47
- package/agents/testing/testing-test-results-analyzer.md +37 -18
- package/agents/testing/testing-tool-evaluator.md +30 -10
- package/client.js +118 -82
- package/cordis.patch.yml +4 -23
- package/host.js +49 -18
- package/package.json +44 -43
- package/templates.data.mjs +9 -10
- package/types/host.d.ts +9 -4
- package/types/src/host-messages.d.ts +2 -0
- package/types/src/remote.d.ts +7 -1
- package/types/src/ui-messages.d.ts +10 -2
|
@@ -55,73 +55,108 @@ color: lime
|
|
|
55
55
|
### k6 压测脚本示例
|
|
56
56
|
|
|
57
57
|
```javascript
|
|
58
|
+
// 使用 k6 进行全面的性能测试
|
|
58
59
|
import http from 'k6/http';
|
|
59
60
|
import { check, sleep } from 'k6';
|
|
60
|
-
import { Rate, Trend } from 'k6/metrics';
|
|
61
|
+
import { Rate, Trend, Counter } from 'k6/metrics';
|
|
61
62
|
|
|
62
|
-
//
|
|
63
|
+
// 自定义指标,用于细粒度分析
|
|
63
64
|
const errorRate = new Rate('errors');
|
|
64
|
-
const
|
|
65
|
+
const responseTimeTrend = new Trend('response_time');
|
|
66
|
+
const throughputCounter = new Counter('requests_per_second');
|
|
65
67
|
|
|
66
|
-
// 测试配置:阶梯式负载
|
|
67
68
|
export const options = {
|
|
68
69
|
stages: [
|
|
69
|
-
{ duration: '2m', target:
|
|
70
|
-
{ duration: '5m', target:
|
|
71
|
-
{ duration: '
|
|
72
|
-
{ duration: '
|
|
73
|
-
{ duration: '
|
|
70
|
+
{ duration: '2m', target: 10 }, // 预热
|
|
71
|
+
{ duration: '5m', target: 50 }, // 常规负载
|
|
72
|
+
{ duration: '2m', target: 100 }, // 峰值负载
|
|
73
|
+
{ duration: '5m', target: 100 }, // 持续峰值
|
|
74
|
+
{ duration: '2m', target: 200 }, // 压力测试
|
|
75
|
+
{ duration: '3m', target: 0 }, // 冷却
|
|
74
76
|
],
|
|
75
77
|
thresholds: {
|
|
76
|
-
http_req_duration: ['p(95)<500',
|
|
77
|
-
|
|
78
|
+
http_req_duration: ['p(95)<500'], // 95% 的请求低于 500ms
|
|
79
|
+
http_req_failed: ['rate<0.01'], // 错误率低于 1%
|
|
80
|
+
'response_time': ['p(95)<200'], // 自定义指标阈值
|
|
81
|
+
checks: ['rate==1'], // 业务检查失败必须让 CI 失败,即使 HTTP 状态是 200
|
|
82
|
+
errors: ['rate<0.01'], // 自定义的应用错误指标也要卡住
|
|
78
83
|
},
|
|
79
84
|
};
|
|
80
85
|
|
|
81
|
-
const BASE_URL = __ENV.BASE_URL || 'https://api.example.com';
|
|
82
|
-
|
|
83
86
|
export default function () {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
const baseUrl = __ENV.BASE_URL || 'http://localhost:3000';
|
|
88
|
+
|
|
89
|
+
// 测试关键用户旅程
|
|
90
|
+
const loginResponse = http.post(`${baseUrl}/api/auth/login`, JSON.stringify({
|
|
91
|
+
email: 'test@example.com',
|
|
92
|
+
password: __ENV.TEST_USER_PASSWORD
|
|
93
|
+
}), { headers: { 'Content-Type': 'application/json' } });
|
|
94
|
+
|
|
95
|
+
// HTTP 状态成功,返回的也可能是无效 JSON 或没有 token。
|
|
96
|
+
let token;
|
|
97
|
+
try { token = loginResponse.json('token'); } catch (_) { /* 下面会检查 */ }
|
|
98
|
+
|
|
99
|
+
const loginOK = check(loginResponse, {
|
|
100
|
+
'login successful': (r) => r.status === 200,
|
|
101
|
+
'login token present': () => typeof token === 'string' && token.length > 0,
|
|
102
|
+
'login response time OK': (r) => r.timings.duration < 200,
|
|
88
103
|
});
|
|
89
104
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
errorRate.add(!loginOK);
|
|
106
|
+
responseTimeTrend.add(loginResponse.timings.duration);
|
|
107
|
+
throughputCounter.add(1);
|
|
108
|
+
|
|
109
|
+
if (loginOK) {
|
|
110
|
+
|
|
111
|
+
// 测试登录后 API 的性能
|
|
112
|
+
const apiResponse = http.get(`${baseUrl}/api/dashboard`, {
|
|
113
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
114
|
+
});
|
|
94
115
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (Math.random() < 0.33) {
|
|
102
|
-
const createResp = http.post(
|
|
103
|
-
`${BASE_URL}/api/v1/items`,
|
|
104
|
-
JSON.stringify({
|
|
105
|
-
name: `test-item-${Date.now()}`,
|
|
106
|
-
description: '性能测试数据',
|
|
107
|
-
}),
|
|
108
|
-
{
|
|
109
|
-
headers: {
|
|
110
|
-
'Content-Type': 'application/json',
|
|
111
|
-
Authorization: `Bearer ${__ENV.TOKEN}`,
|
|
112
|
-
},
|
|
113
|
-
tags: { name: 'POST /items' },
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
check(createResp, {
|
|
118
|
-
'create status is 201': (r) => r.status === 201,
|
|
116
|
+
let data;
|
|
117
|
+
try { data = apiResponse.json('data'); } catch (_) { /* 下面会检查 */ }
|
|
118
|
+
const dashboardOK = check(apiResponse, {
|
|
119
|
+
'dashboard load successful': (r) => r.status === 200,
|
|
120
|
+
'dashboard response time OK': (r) => r.timings.duration < 300,
|
|
121
|
+
'dashboard data complete': () => Array.isArray(data) && data.length > 0,
|
|
119
122
|
});
|
|
120
123
|
|
|
121
|
-
errorRate.add(
|
|
124
|
+
errorRate.add(!dashboardOK);
|
|
125
|
+
responseTimeTrend.add(apiResponse.timings.duration);
|
|
122
126
|
}
|
|
123
127
|
|
|
124
|
-
sleep(
|
|
128
|
+
sleep(1); // 模拟真实用户的思考时间
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function handleSummary(data) {
|
|
132
|
+
return {
|
|
133
|
+
'performance-report.json': JSON.stringify(data),
|
|
134
|
+
'performance-summary.html': generateHTMLReport(data),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function generateHTMLReport(data) {
|
|
139
|
+
const number = (metric, key, scale = 1) => {
|
|
140
|
+
const value = data.metrics[metric]?.values?.[key];
|
|
141
|
+
return typeof value === 'number' && Number.isFinite(value)
|
|
142
|
+
? (value * scale).toFixed(2) : 'N/A (no measurement)';
|
|
143
|
+
};
|
|
144
|
+
return `
|
|
145
|
+
<!DOCTYPE html>
|
|
146
|
+
<html>
|
|
147
|
+
<head><title>Performance Test Report</title></head>
|
|
148
|
+
<body>
|
|
149
|
+
<h1>Performance Test Results</h1>
|
|
150
|
+
<h2>Key Metrics</h2>
|
|
151
|
+
<ul>
|
|
152
|
+
<li>Average Response Time: ${number('http_req_duration', 'avg')}ms</li>
|
|
153
|
+
<li>95th Percentile: ${number('http_req_duration', 'p(95)')}ms</li>
|
|
154
|
+
<li>Error Rate: ${number('http_req_failed', 'rate', 100)}%</li>
|
|
155
|
+
<li>Total Requests: ${number('http_reqs', 'count')}</li>
|
|
156
|
+
</ul>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
`;
|
|
125
160
|
}
|
|
126
161
|
```
|
|
127
162
|
|
|
@@ -66,6 +66,8 @@ color: indigo
|
|
|
66
66
|
|
|
67
67
|
```python
|
|
68
68
|
# 带统计建模的全面测试结果分析
|
|
69
|
+
import json
|
|
70
|
+
import math
|
|
69
71
|
import pandas as pd
|
|
70
72
|
import numpy as np
|
|
71
73
|
from scipy import stats
|
|
@@ -76,32 +78,43 @@ from sklearn.model_selection import train_test_split
|
|
|
76
78
|
|
|
77
79
|
class TestResultsAnalyzer:
|
|
78
80
|
def __init__(self, test_results_path):
|
|
79
|
-
|
|
81
|
+
# 覆盖率报告是嵌套对象,不是二维 DataFrame。
|
|
82
|
+
with open(test_results_path, encoding='utf-8') as report:
|
|
83
|
+
self.test_results = json.load(report)
|
|
84
|
+
if not isinstance(self.test_results, dict):
|
|
85
|
+
raise ValueError('Expected one JSON report object')
|
|
80
86
|
self.quality_metrics = {}
|
|
81
87
|
self.risk_assessment = {}
|
|
82
88
|
|
|
83
89
|
def analyze_test_coverage(self):
|
|
84
90
|
"""全面的测试覆盖率分析,含缺口识别"""
|
|
91
|
+
coverage = self.test_results.get('coverage')
|
|
92
|
+
if not isinstance(coverage, dict):
|
|
93
|
+
raise ValueError('Missing coverage object; no coverage claim can be made')
|
|
94
|
+
|
|
95
|
+
def percentage(section, label):
|
|
96
|
+
value = section.get('pct') if isinstance(section, dict) else None
|
|
97
|
+
if (isinstance(value, bool) or not isinstance(value, (int, float))
|
|
98
|
+
or not math.isfinite(value) or not 0 <= value <= 100):
|
|
99
|
+
raise ValueError(f'{label}.pct must be a finite percentage in [0, 100]')
|
|
100
|
+
return value
|
|
101
|
+
|
|
85
102
|
coverage_stats = {
|
|
86
|
-
'
|
|
87
|
-
|
|
88
|
-
'
|
|
89
|
-
'statement_coverage': self.test_results['coverage']['statements']['pct']
|
|
103
|
+
f'{name[:-1] if name != "branches" else "branch"}_coverage':
|
|
104
|
+
percentage(coverage.get(name), name)
|
|
105
|
+
for name in ('lines', 'branches', 'functions', 'statements')
|
|
90
106
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
files = coverage.get('files')
|
|
108
|
+
if not isinstance(files, dict):
|
|
109
|
+
raise ValueError('coverage.files must map paths to coverage objects')
|
|
94
110
|
gap_analysis = []
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
'priority': self._calculate_coverage_priority(file_path, file_coverage)
|
|
103
|
-
})
|
|
104
|
-
|
|
111
|
+
for file_path, file_coverage in files.items():
|
|
112
|
+
if not isinstance(file_coverage, dict):
|
|
113
|
+
raise ValueError(f'Invalid coverage object for {file_path}')
|
|
114
|
+
line_pct = percentage(file_coverage.get('lines'), file_path)
|
|
115
|
+
if line_pct < 80:
|
|
116
|
+
gap_analysis.append({'file': file_path, 'coverage': line_pct})
|
|
117
|
+
# 覆盖缺口表示未执行的代码,风险等级需结合实际业务关键程度。
|
|
105
118
|
return coverage_stats, gap_analysis
|
|
106
119
|
|
|
107
120
|
def analyze_failure_patterns(self):
|
|
@@ -193,6 +206,12 @@ class TestResultsAnalyzer:
|
|
|
193
206
|
return report
|
|
194
207
|
```
|
|
195
208
|
|
|
209
|
+
覆盖率入口接受一个 JSON 报告对象,各总览字段包含 `pct` 数值,`files` 按路径映射到文件覆盖率对象。缺失或无效测量值会报错,不能当成零覆盖率。其余 `_...` 方法是项目需自行实现的适配器;覆盖率本身不能推出风险等级或发布置信度。
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{"coverage":{"lines":{"pct":90},"branches":{"pct":80},"functions":{"pct":95},"statements":{"pct":90},"files":{"src/payment.py":{"lines":{"pct":60}}}}}
|
|
213
|
+
```
|
|
214
|
+
|
|
196
215
|
## 工作流程
|
|
197
216
|
|
|
198
217
|
### 第一步:数据收集与校验
|
|
@@ -184,11 +184,21 @@ class ToolEvaluator:
|
|
|
184
184
|
for feature in optional_features:
|
|
185
185
|
score = self._test_feature(feature, tool_config)
|
|
186
186
|
optional_scores.append(score)
|
|
187
|
-
test_notes.append(f"{feature}
|
|
187
|
+
test_notes.append(f"{feature} (可选): {score}/10")
|
|
188
188
|
|
|
189
189
|
optional_avg = np.mean(optional_scores) if optional_scores else 0
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
# 缺少某类需求不等于该类测试失败,按实际存在的类别归一化权重。
|
|
192
|
+
active_scores = []
|
|
193
|
+
if feature_scores:
|
|
194
|
+
active_scores.append((required_avg, 0.8))
|
|
195
|
+
if optional_scores:
|
|
196
|
+
active_scores.append((optional_avg, 0.2))
|
|
197
|
+
if not active_scores:
|
|
198
|
+
raise ValueError("Define at least one feature before scoring functionality")
|
|
199
|
+
final_score = sum(score * weight for score, weight in active_scores) / sum(
|
|
200
|
+
weight for _, weight in active_scores
|
|
201
|
+
)
|
|
192
202
|
notes = "; ".join(test_notes)
|
|
193
203
|
|
|
194
204
|
return final_score, notes
|
|
@@ -197,17 +207,21 @@ class ToolEvaluator:
|
|
|
197
207
|
"""带量化指标的性能测试"""
|
|
198
208
|
api_endpoint = tool_config.get("api_endpoint")
|
|
199
209
|
if not api_endpoint:
|
|
200
|
-
return 5.0, "
|
|
210
|
+
return 5.0, "未提供用于性能测试的 API 端点"
|
|
201
211
|
|
|
202
212
|
# 响应时间测试
|
|
203
213
|
response_times = []
|
|
214
|
+
failed_requests = 0
|
|
204
215
|
for _ in range(10):
|
|
205
|
-
|
|
216
|
+
# 使用单调时钟,避免系统时间校正影响耗时。
|
|
217
|
+
start_time = time.perf_counter()
|
|
206
218
|
try:
|
|
207
219
|
response = requests.get(api_endpoint, timeout=10)
|
|
208
|
-
|
|
220
|
+
response.raise_for_status()
|
|
221
|
+
end_time = time.perf_counter()
|
|
209
222
|
response_times.append(end_time - start_time)
|
|
210
223
|
except requests.RequestException:
|
|
224
|
+
failed_requests += 1
|
|
211
225
|
response_times.append(10.0) # 超时惩罚
|
|
212
226
|
|
|
213
227
|
avg_response_time = np.mean(response_times)
|
|
@@ -225,11 +239,18 @@ class ToolEvaluator:
|
|
|
225
239
|
else:
|
|
226
240
|
speed_score = 2
|
|
227
241
|
|
|
228
|
-
notes = f"
|
|
242
|
+
notes = (f"含失败惩罚的平均耗时: {avg_response_time:.2f}s, P95: {p95_response_time:.2f}s; "
|
|
243
|
+
f"失败请求: {failed_requests}/{len(response_times)}")
|
|
229
244
|
return speed_score, notes
|
|
230
245
|
|
|
231
246
|
def calculate_total_cost_ownership(self, tool_config: Dict, years: int = 3) -> Dict:
|
|
232
|
-
"""
|
|
247
|
+
"""仅在采用年限和用户数为有效正值时计算总拥有成本。"""
|
|
248
|
+
users = tool_config.get("expected_users", 1)
|
|
249
|
+
if isinstance(years, bool) or not isinstance(years, int) or years <= 0:
|
|
250
|
+
raise ValueError("years must be a positive integer")
|
|
251
|
+
if (isinstance(users, bool) or not isinstance(users, (int, float))
|
|
252
|
+
or not np.isfinite(users) or users <= 0):
|
|
253
|
+
raise ValueError("expected_users must be a positive finite number")
|
|
233
254
|
costs = {
|
|
234
255
|
"licensing": tool_config.get("annual_license_cost", 0) * years,
|
|
235
256
|
"implementation": tool_config.get("implementation_cost", 0),
|
|
@@ -242,8 +263,7 @@ class ToolEvaluator:
|
|
|
242
263
|
|
|
243
264
|
total_cost = sum(costs.values())
|
|
244
265
|
|
|
245
|
-
#
|
|
246
|
-
users = tool_config.get("expected_users", 1)
|
|
266
|
+
# 计算每用户每年的成本
|
|
247
267
|
cost_per_user_year = total_cost / (users * years)
|
|
248
268
|
|
|
249
269
|
return {
|
|
@@ -266,7 +286,7 @@ class ToolEvaluator:
|
|
|
266
286
|
])
|
|
267
287
|
|
|
268
288
|
# 排名
|
|
269
|
-
comparison_df["Rank"] = comparison_df["Weighted Score"].rank(ascending=False)
|
|
289
|
+
comparison_df["Rank"] = comparison_df["Weighted Score"].rank(method="min", ascending=False)
|
|
270
290
|
|
|
271
291
|
# 找出各维度的优胜者
|
|
272
292
|
analysis = {
|