@hongmaple0820/scale-engine 0.15.1 → 0.17.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/agents/LeadershipPresets.d.ts +16 -0
- package/dist/agents/LeadershipPresets.js +152 -0
- package/dist/agents/LeadershipPresets.js.map +1 -0
- package/dist/api/cli.js +774 -8
- package/dist/api/cli.js.map +1 -1
- package/dist/artifact/types.d.ts +4 -0
- package/dist/artifact/types.js.map +1 -1
- package/dist/cli/phaseCommands.d.ts +14 -0
- package/dist/cli/phaseCommands.js +187 -6
- package/dist/cli/phaseCommands.js.map +1 -1
- package/dist/cli/vibeCommands.d.ts +20 -0
- package/dist/cli/vibeCommands.js +150 -173
- package/dist/cli/vibeCommands.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts/VibeTemplateGallery.d.ts +25 -0
- package/dist/prompts/VibeTemplateGallery.js +295 -0
- package/dist/prompts/VibeTemplateGallery.js.map +1 -0
- package/dist/skills/SkillRepository.d.ts +63 -0
- package/dist/skills/SkillRepository.js +365 -0
- package/dist/skills/SkillRepository.js.map +1 -0
- package/dist/tools/ToolCapabilityRegistry.d.ts +46 -0
- package/dist/tools/ToolCapabilityRegistry.js +223 -0
- package/dist/tools/ToolCapabilityRegistry.js.map +1 -0
- package/dist/tools/ToolEvidenceGate.d.ts +39 -0
- package/dist/tools/ToolEvidenceGate.js +117 -0
- package/dist/tools/ToolEvidenceGate.js.map +1 -0
- package/dist/tools/ToolEvidenceStore.d.ts +58 -0
- package/dist/tools/ToolEvidenceStore.js +129 -0
- package/dist/tools/ToolEvidenceStore.js.map +1 -0
- package/dist/tools/ToolOrchestrator.d.ts +67 -0
- package/dist/tools/ToolOrchestrator.js +246 -0
- package/dist/tools/ToolOrchestrator.js.map +1 -0
- package/dist/tools/ToolPolicy.d.ts +33 -0
- package/dist/tools/ToolPolicy.js +157 -0
- package/dist/tools/ToolPolicy.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/workflow/ContextGovernance.d.ts +51 -0
- package/dist/workflow/ContextGovernance.js +233 -0
- package/dist/workflow/ContextGovernance.js.map +1 -0
- package/dist/workflow/DiagnosticLoop.d.ts +40 -0
- package/dist/workflow/DiagnosticLoop.js +105 -0
- package/dist/workflow/DiagnosticLoop.js.map +1 -0
- package/dist/workflow/EngineeringStandards.d.ts +69 -0
- package/dist/workflow/EngineeringStandards.js +348 -6
- package/dist/workflow/EngineeringStandards.js.map +1 -1
- package/dist/workflow/GovernanceTemplatePacks.js +11 -9
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/GovernanceTemplates.js +15 -4
- package/dist/workflow/GovernanceTemplates.js.map +1 -1
- package/dist/workflow/TaskArtifactScaffolder.d.ts +22 -0
- package/dist/workflow/TaskArtifactScaffolder.js +55 -0
- package/dist/workflow/TaskArtifactScaffolder.js.map +1 -1
- package/dist/workflow/TddLoop.d.ts +47 -0
- package/dist/workflow/TddLoop.js +76 -0
- package/dist/workflow/TddLoop.js.map +1 -0
- package/dist/workflow/WorkflowGuidance.d.ts +26 -0
- package/dist/workflow/WorkflowGuidance.js +173 -0
- package/dist/workflow/WorkflowGuidance.js.map +1 -0
- package/dist/workflow/WorkflowOpenTasks.d.ts +16 -0
- package/dist/workflow/WorkflowOpenTasks.js +37 -0
- package/dist/workflow/WorkflowOpenTasks.js.map +1 -0
- package/dist/workflow/index.d.ts +5 -0
- package/dist/workflow/index.js +5 -0
- package/dist/workflow/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
const DEFAULT_REQUIRED_CHECKS = [
|
|
2
|
+
'review-skill-frontmatter',
|
|
3
|
+
'inspect-scripts-directory',
|
|
4
|
+
'verify-license-and-source',
|
|
5
|
+
'pin-source-revision',
|
|
6
|
+
];
|
|
7
|
+
export const SKILL_REPOSITORY = [
|
|
8
|
+
skill({
|
|
9
|
+
id: 'frontend-design',
|
|
10
|
+
name: 'Frontend Design',
|
|
11
|
+
category: 'ui',
|
|
12
|
+
description: '用于生成有审美约束的生产级前端界面方案。',
|
|
13
|
+
sourceUrl: 'https://github.com/anthropics/skills/tree/main/skills/frontend-design',
|
|
14
|
+
installCommand: 'npx skills add anthropics/skills --skill frontend-design',
|
|
15
|
+
trust: 'official',
|
|
16
|
+
primaryUse: 'UI 视觉方向、布局、组件状态和前端实现约束。',
|
|
17
|
+
combineWith: ['awesome-design-md', 'ui-ux-pro-max', 'webapp-testing'],
|
|
18
|
+
evidence: ['ui-spec', 'visual-review'],
|
|
19
|
+
}),
|
|
20
|
+
skill({
|
|
21
|
+
id: 'awesome-design-md',
|
|
22
|
+
name: 'Awesome Design.md',
|
|
23
|
+
category: 'ui',
|
|
24
|
+
description: '用于沉淀 DESIGN.md、品牌、设计系统和产品体验参考。',
|
|
25
|
+
sourceUrl: 'https://github.com/VoltAgent/awesome-design-md',
|
|
26
|
+
installCommand: 'npx skills add https://github.com/VoltAgent/awesome-design-md --skill awesome-design-md',
|
|
27
|
+
trust: 'ecosystem',
|
|
28
|
+
primaryUse: '建立产品级设计规范和视觉语言。',
|
|
29
|
+
combineWith: ['ui-ux-pro-max', 'frontend-design'],
|
|
30
|
+
evidence: ['design-spec', 'design-system'],
|
|
31
|
+
}),
|
|
32
|
+
skill({
|
|
33
|
+
id: 'ui-ux-pro-max',
|
|
34
|
+
name: 'UI/UX Pro Max',
|
|
35
|
+
category: 'ui',
|
|
36
|
+
description: '用于用户路径、交互、可访问性、响应式和审美质量检查。',
|
|
37
|
+
sourceUrl: 'https://github.com/nextlevelbuilder/ui-ux-pro-max-skill',
|
|
38
|
+
installCommand: 'npx skills add https://github.com/nextlevelbuilder/ui-ux-pro-max-skill --skill ui-ux-pro-max',
|
|
39
|
+
trust: 'ecosystem',
|
|
40
|
+
primaryUse: '补齐体验策略、交互状态和 UI 验收维度。',
|
|
41
|
+
combineWith: ['awesome-design-md', 'webapp-testing'],
|
|
42
|
+
evidence: ['ui-spec', 'accessibility-review'],
|
|
43
|
+
}),
|
|
44
|
+
skill({
|
|
45
|
+
id: 'webapp-testing',
|
|
46
|
+
name: 'Webapp Testing',
|
|
47
|
+
category: 'testing',
|
|
48
|
+
description: '基于 Playwright 的 Web 应用交互测试和截图证据。',
|
|
49
|
+
sourceUrl: 'https://github.com/anthropics/skills/tree/main/skills/webapp-testing',
|
|
50
|
+
installCommand: 'npx skills add anthropics/skills --skill webapp-testing',
|
|
51
|
+
trust: 'official',
|
|
52
|
+
primaryUse: '验证页面点击、表单、控制台、截图和端到端行为。',
|
|
53
|
+
combineWith: ['agent-browser', 'mcp-chrome-devtools'],
|
|
54
|
+
evidence: ['browser-evidence', 'screenshot', 'console-log'],
|
|
55
|
+
}),
|
|
56
|
+
skill({
|
|
57
|
+
id: 'web-access',
|
|
58
|
+
name: 'Web Access',
|
|
59
|
+
category: 'browser',
|
|
60
|
+
description: '用于联网搜索、动态页面、登录态页面和真实浏览器取证。',
|
|
61
|
+
sourceUrl: 'https://github.com/eze-is/web-access',
|
|
62
|
+
installCommand: 'npx skills add https://github.com/eze-is/web-access --skill web-access',
|
|
63
|
+
trust: 'ecosystem',
|
|
64
|
+
primaryUse: '获取一手资料、动态页面内容、网页证据和来源引用。',
|
|
65
|
+
combineWith: ['agent-browser', 'mcp-chrome-devtools'],
|
|
66
|
+
evidence: ['source-citation', 'browser-evidence'],
|
|
67
|
+
}),
|
|
68
|
+
skill({
|
|
69
|
+
id: 'agent-browser',
|
|
70
|
+
name: 'Agent Browser',
|
|
71
|
+
category: 'browser',
|
|
72
|
+
description: '用于浏览器自动化、页面操作、截图和交互验证。',
|
|
73
|
+
sourceUrl: 'https://github.com/vercel-labs/agent-browser',
|
|
74
|
+
installCommand: 'Install or configure Agent Browser from https://github.com/vercel-labs/agent-browser',
|
|
75
|
+
trust: 'ecosystem',
|
|
76
|
+
primaryUse: '与 Web 页面真实交互,补齐手工验收证据。',
|
|
77
|
+
combineWith: ['web-access', 'webapp-testing', 'mcp-chrome-devtools'],
|
|
78
|
+
evidence: ['browser-evidence', 'screenshot'],
|
|
79
|
+
}),
|
|
80
|
+
skill({
|
|
81
|
+
id: 'mcp-chrome-devtools',
|
|
82
|
+
name: 'Chrome DevTools MCP',
|
|
83
|
+
category: 'browser',
|
|
84
|
+
description: '用于控制台、网络、性能和浏览器状态检查。',
|
|
85
|
+
sourceUrl: 'https://github.com/ChromeDevTools/chrome-devtools-mcp',
|
|
86
|
+
installCommand: 'Configure Chrome DevTools MCP for the active agent platform',
|
|
87
|
+
trust: 'ecosystem',
|
|
88
|
+
primaryUse: '调试控制台错误、网络请求、页面状态和性能问题。',
|
|
89
|
+
combineWith: ['agent-browser', 'webapp-testing'],
|
|
90
|
+
evidence: ['network-console-check', 'browser-evidence'],
|
|
91
|
+
}),
|
|
92
|
+
skill({
|
|
93
|
+
id: 'cua',
|
|
94
|
+
name: 'CUA',
|
|
95
|
+
category: 'desktop',
|
|
96
|
+
description: '用于桌面应用、GUI、WPS、微信等端侧自动化验证。',
|
|
97
|
+
sourceUrl: 'https://github.com/trycua/cua',
|
|
98
|
+
installCommand: 'Install or configure CUA from https://github.com/trycua/cua',
|
|
99
|
+
trust: 'ecosystem',
|
|
100
|
+
primaryUse: '操作桌面应用并收集端侧截图、状态和副作用边界证据。',
|
|
101
|
+
combineWith: ['web-access', 'agent-browser'],
|
|
102
|
+
evidence: ['desktop-screenshot', 'operator-safety', 'side-effect-boundary'],
|
|
103
|
+
}),
|
|
104
|
+
skill({
|
|
105
|
+
id: 'code-reviewer',
|
|
106
|
+
name: 'Code Reviewer',
|
|
107
|
+
category: 'review',
|
|
108
|
+
description: '用于 Critical / Improvements / Nitpicks 分级代码审查。',
|
|
109
|
+
sourceUrl: 'https://github.com/google-gemini/gemini-cli/tree/main/.gemini/skills/code-reviewer',
|
|
110
|
+
installCommand: 'npx skills add https://github.com/google-gemini/gemini-cli --skill code-reviewer',
|
|
111
|
+
trust: 'official',
|
|
112
|
+
primaryUse: '合并前分级审查缺陷、安全、可维护性和测试风险。',
|
|
113
|
+
combineWith: ['security-and-hardening', 'update-docs'],
|
|
114
|
+
evidence: ['review-report'],
|
|
115
|
+
}),
|
|
116
|
+
skill({
|
|
117
|
+
id: 'fix',
|
|
118
|
+
name: 'Fix',
|
|
119
|
+
category: 'review',
|
|
120
|
+
description: '用于提交前格式化、lint 和简单自动修复。',
|
|
121
|
+
sourceUrl: 'https://github.com/facebook/react/tree/main/.claude/skills/fix',
|
|
122
|
+
installCommand: 'npx skills add https://github.com/facebook/react --skill fix',
|
|
123
|
+
trust: 'official',
|
|
124
|
+
primaryUse: '提交前清理格式和 lint 问题。',
|
|
125
|
+
combineWith: ['code-reviewer'],
|
|
126
|
+
evidence: ['lint-output'],
|
|
127
|
+
}),
|
|
128
|
+
skill({
|
|
129
|
+
id: 'pr-creator',
|
|
130
|
+
name: 'PR Creator',
|
|
131
|
+
category: 'review',
|
|
132
|
+
description: '用于按模板生成 PR 描述并检查分支边界。',
|
|
133
|
+
sourceUrl: 'https://github.com/google-gemini/gemini-cli/tree/main/.gemini/skills/pr-creator',
|
|
134
|
+
installCommand: 'npx skills add https://github.com/google-gemini/gemini-cli --skill pr-creator',
|
|
135
|
+
trust: 'official',
|
|
136
|
+
primaryUse: '生成标准 PR 描述和合并前说明。',
|
|
137
|
+
combineWith: ['code-reviewer', 'update-docs'],
|
|
138
|
+
evidence: ['pr-description'],
|
|
139
|
+
}),
|
|
140
|
+
skill({
|
|
141
|
+
id: 'update-docs',
|
|
142
|
+
name: 'Update Docs',
|
|
143
|
+
category: 'docs',
|
|
144
|
+
description: '用于代码变更后的文档影响分析和同步更新。',
|
|
145
|
+
sourceUrl: 'https://github.com/vercel/next.js/tree/canary/.claude/skills/update-docs',
|
|
146
|
+
installCommand: 'npx skills add https://github.com/vercel/next.js --skill update-docs',
|
|
147
|
+
trust: 'official',
|
|
148
|
+
primaryUse: '发现并更新受代码变更影响的长期文档。',
|
|
149
|
+
combineWith: ['documentation-and-adrs'],
|
|
150
|
+
evidence: ['docs-impact'],
|
|
151
|
+
}),
|
|
152
|
+
skill({
|
|
153
|
+
id: 'find-skills',
|
|
154
|
+
name: 'Find Skills',
|
|
155
|
+
category: 'discovery',
|
|
156
|
+
description: '用于发现当前任务缺失的 Skill 能力。',
|
|
157
|
+
sourceUrl: 'https://github.com/vercel-labs/skills/tree/main/skills/find-skills',
|
|
158
|
+
installCommand: 'npx skills add https://github.com/vercel-labs/skills --skill find-skills',
|
|
159
|
+
trust: 'ecosystem',
|
|
160
|
+
primaryUse: '按任务意图搜索合适 Skill,再进入安全扫描。',
|
|
161
|
+
combineWith: ['web-access'],
|
|
162
|
+
evidence: ['skill-candidate-list'],
|
|
163
|
+
}),
|
|
164
|
+
skill({
|
|
165
|
+
id: 'codex-cli',
|
|
166
|
+
name: 'Codex CLI',
|
|
167
|
+
category: 'agent-cli',
|
|
168
|
+
description: '用于外部 Agent 评审、对照实现或第二意见。',
|
|
169
|
+
sourceUrl: 'https://github.com/openai/codex',
|
|
170
|
+
installCommand: 'Install Codex CLI and verify with: codex --version',
|
|
171
|
+
trust: 'official',
|
|
172
|
+
primaryUse: '外部 CLI 审查和命令级证据。',
|
|
173
|
+
combineWith: ['gemini-cli', 'opencode-cli'],
|
|
174
|
+
evidence: ['cli-version-check', 'command-output'],
|
|
175
|
+
}),
|
|
176
|
+
skill({
|
|
177
|
+
id: 'gemini-cli',
|
|
178
|
+
name: 'Gemini CLI',
|
|
179
|
+
category: 'agent-cli',
|
|
180
|
+
description: '用于外部 Agent 评审、代码审查和交叉验证。',
|
|
181
|
+
sourceUrl: 'https://github.com/google-gemini/gemini-cli',
|
|
182
|
+
installCommand: 'Install Gemini CLI and verify with: gemini --version',
|
|
183
|
+
trust: 'official',
|
|
184
|
+
primaryUse: '外部 CLI 审查和命令级证据。',
|
|
185
|
+
combineWith: ['codex-cli', 'opencode-cli'],
|
|
186
|
+
evidence: ['cli-version-check', 'command-output'],
|
|
187
|
+
}),
|
|
188
|
+
skill({
|
|
189
|
+
id: 'opencode-cli',
|
|
190
|
+
name: 'OpenCode CLI',
|
|
191
|
+
category: 'agent-cli',
|
|
192
|
+
description: '用于外部 Agent 评审或跨工具验证。',
|
|
193
|
+
sourceUrl: 'https://github.com/sst/opencode',
|
|
194
|
+
installCommand: 'Install OpenCode CLI and verify with: opencode --version',
|
|
195
|
+
trust: 'ecosystem',
|
|
196
|
+
primaryUse: '外部 CLI 审查和命令级证据。',
|
|
197
|
+
combineWith: ['codex-cli', 'gemini-cli'],
|
|
198
|
+
evidence: ['cli-version-check', 'command-output'],
|
|
199
|
+
}),
|
|
200
|
+
skill({
|
|
201
|
+
id: 'agency-agents-zh',
|
|
202
|
+
name: 'Agency Agents ZH',
|
|
203
|
+
category: 'role-library',
|
|
204
|
+
description: '中文专家角色库,可借鉴精选安装和多平台转换方式。',
|
|
205
|
+
sourceUrl: 'https://github.com/jnMetaCode/agency-agents-zh',
|
|
206
|
+
installCommand: 'Review and selectively install role presets from https://github.com/jnMetaCode/agency-agents-zh',
|
|
207
|
+
trust: 'community',
|
|
208
|
+
primaryUse: '提供 CEO、CTO、工程、设计、产品等角色预设参考。',
|
|
209
|
+
combineWith: ['skill-safety-scan'],
|
|
210
|
+
evidence: ['selected-role-list', 'role-trigger-policy'],
|
|
211
|
+
}),
|
|
212
|
+
];
|
|
213
|
+
export function listSkillRepositoryEntries(filter) {
|
|
214
|
+
return SKILL_REPOSITORY.filter(entry => !filter?.category || entry.category === filter.category);
|
|
215
|
+
}
|
|
216
|
+
export function recommendSkillWorkflow(input) {
|
|
217
|
+
const text = `${input.description} ${input.phase ?? ''}`.toLowerCase();
|
|
218
|
+
const primary = new Set();
|
|
219
|
+
const supporting = new Set();
|
|
220
|
+
const evidence = new Set(['skill-safety-scan']);
|
|
221
|
+
const rationale = [];
|
|
222
|
+
if (matches(text, ['ui', 'ux', 'design', 'frontend', '视觉', '审美', '交互', '前端'])) {
|
|
223
|
+
add(primary, ['awesome-design-md', 'ui-ux-pro-max', 'frontend-design']);
|
|
224
|
+
add(supporting, ['webapp-testing', 'agent-browser', 'mcp-chrome-devtools']);
|
|
225
|
+
add(evidence, ['design-spec', 'browser-evidence']);
|
|
226
|
+
rationale.push('检测到 UI/UX 或前端体验任务,需要设计 Skill 和浏览器证据组合。');
|
|
227
|
+
}
|
|
228
|
+
if (matches(text, ['browser', 'e2e', 'playwright', '浏览器', '自动化', '网页', '联网'])) {
|
|
229
|
+
add(primary, ['web-access']);
|
|
230
|
+
add(supporting, ['agent-browser', 'mcp-chrome-devtools', 'webapp-testing']);
|
|
231
|
+
add(evidence, ['source-citation', 'browser-evidence', 'network-console-check']);
|
|
232
|
+
rationale.push('检测到联网或浏览器自动化任务,需要来源引用和浏览器取证。');
|
|
233
|
+
}
|
|
234
|
+
if (matches(text, ['desktop', 'gui', 'wps', 'wechat', '微信', '桌面', '端侧', '电脑'])) {
|
|
235
|
+
add(primary, ['cua']);
|
|
236
|
+
add(supporting, ['web-access', 'agent-browser']);
|
|
237
|
+
add(evidence, ['desktop-screenshot', 'operator-safety', 'side-effect-boundary']);
|
|
238
|
+
rationale.push('检测到桌面/GUI 自动化任务,需要操作安全边界和截图证据。');
|
|
239
|
+
}
|
|
240
|
+
if (matches(text, ['codex', 'gemini', 'opencode', 'cli', '外部 agent'])) {
|
|
241
|
+
add(supporting, ['codex-cli', 'gemini-cli', 'opencode-cli']);
|
|
242
|
+
add(evidence, ['cli-version-check', 'command-output', 'dry-run-or-safe-mode']);
|
|
243
|
+
rationale.push('检测到外部 Agent CLI 编排,需要记录版本和命令输出。');
|
|
244
|
+
}
|
|
245
|
+
if (primary.size === 0 && supporting.size === 0) {
|
|
246
|
+
add(primary, ['find-skills']);
|
|
247
|
+
add(supporting, ['web-access']);
|
|
248
|
+
add(evidence, ['skill-candidate-list']);
|
|
249
|
+
rationale.push('未检测到明确领域,先使用 find-skills 和联网研究进行能力发现。');
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
primarySkills: [...primary],
|
|
253
|
+
supportingSkills: [...supporting].filter(skillId => !primary.has(skillId)),
|
|
254
|
+
safetyRequired: true,
|
|
255
|
+
requiredEvidence: [...evidence],
|
|
256
|
+
rationale,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
export function evaluateSkillInstallSafety(input) {
|
|
260
|
+
const findings = [];
|
|
261
|
+
const sourceUrl = input.sourceUrl?.trim();
|
|
262
|
+
const command = input.installCommand?.trim() ?? '';
|
|
263
|
+
const corpus = [command, ...(input.files ?? []).map(file => `${file.path}\n${file.content}`)].join('\n');
|
|
264
|
+
if (sourceUrl && !sourceUrl.startsWith('https://')) {
|
|
265
|
+
findings.push({ rule: 'https-required', severity: 'block', message: 'Skill 来源必须使用 HTTPS。' });
|
|
266
|
+
}
|
|
267
|
+
if (/\b(curl|wget|iwr|Invoke-WebRequest)\b[\s\S]*(\|\s*(bash|sh)|\|\s*(iex|Invoke-Expression))/i.test(corpus)) {
|
|
268
|
+
findings.push({ rule: 'no-pipe-to-shell', severity: 'block', message: '禁止下载脚本后直接管道执行。' });
|
|
269
|
+
}
|
|
270
|
+
if (/\b(Invoke-Expression|iex)\b/i.test(corpus)) {
|
|
271
|
+
findings.push({ rule: 'no-download-exec', severity: 'block', message: '禁止使用 Invoke-Expression/iex 执行远程内容。' });
|
|
272
|
+
}
|
|
273
|
+
if (/\brm\s+-rf\s+\/(?:\s|$)|Remove-Item[\s\S]*-Recurse[\s\S]*-Force/i.test(corpus)) {
|
|
274
|
+
findings.push({ rule: 'no-destructive-install', severity: 'block', message: '安装过程不得包含危险递归删除。' });
|
|
275
|
+
}
|
|
276
|
+
if (/\bpostinstall\b|\bpreinstall\b|\binstall\s*:/i.test(corpus)) {
|
|
277
|
+
findings.push({ rule: 'review-package-lifecycle-scripts', severity: 'warn', message: '发现生命周期脚本,需要人工审查。' });
|
|
278
|
+
}
|
|
279
|
+
if (/\bnpx\b|\bnpm\b/i.test(command)) {
|
|
280
|
+
findings.push({ rule: 'npm-supply-chain-review', severity: 'warn', message: 'npm/npx 安装需要签名、来源和 lockfile 审查。' });
|
|
281
|
+
}
|
|
282
|
+
const requiredChecks = new Set(DEFAULT_REQUIRED_CHECKS);
|
|
283
|
+
if (/\bnpx\b|\bnpm\b/i.test(command))
|
|
284
|
+
requiredChecks.add('npm-audit-signatures');
|
|
285
|
+
if (sourceUrl?.includes('github.com'))
|
|
286
|
+
requiredChecks.add('review-repository-activity');
|
|
287
|
+
if (input.files?.some(file => file.path.includes('scripts/')))
|
|
288
|
+
requiredChecks.add('review-executable-scripts');
|
|
289
|
+
const blocked = findings.some(finding => finding.severity === 'block');
|
|
290
|
+
return {
|
|
291
|
+
blocked,
|
|
292
|
+
risk: blocked ? 'blocked' : findings.some(finding => finding.severity === 'warn') ? 'medium' : 'low',
|
|
293
|
+
findings,
|
|
294
|
+
requiredChecks: [...requiredChecks],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
export function renderSkillRepositoryMarkdown() {
|
|
298
|
+
const lines = [
|
|
299
|
+
'# SCALE Skill 仓库',
|
|
300
|
+
'',
|
|
301
|
+
'这个仓库视图用于让 Agent 按任务渐进式发现、激活和编排 skills/MCP/CLI,而不是一次性把所有能力塞进上下文。',
|
|
302
|
+
'',
|
|
303
|
+
'## 渐进式披露',
|
|
304
|
+
'',
|
|
305
|
+
'1. 启动时只读取 Skill 元数据和一句话描述。',
|
|
306
|
+
'2. 任务命中时才读取完整 SKILL.md。',
|
|
307
|
+
'3. scripts、references、assets 只在明确需要时懒加载。',
|
|
308
|
+
'',
|
|
309
|
+
'## 安全安装',
|
|
310
|
+
'',
|
|
311
|
+
'- 安装前必须执行安全扫描,阻断 `curl | bash`、`Invoke-Expression`、危险删除和非 HTTPS 来源。',
|
|
312
|
+
'- npm/npx 来源必须补充 `npm audit signatures`、来源仓库、许可证和版本/commit 固定检查。',
|
|
313
|
+
'- 任何第三方 Skill 都先进入隔离审查,再写入项目或全局 skills 目录。',
|
|
314
|
+
'',
|
|
315
|
+
'## 供应链防护清单',
|
|
316
|
+
'',
|
|
317
|
+
'- review-skill-frontmatter',
|
|
318
|
+
'- inspect-scripts-directory',
|
|
319
|
+
'- verify-license-and-source',
|
|
320
|
+
'- pin-source-revision',
|
|
321
|
+
'- npm-audit-signatures',
|
|
322
|
+
'',
|
|
323
|
+
'## Skill 目录',
|
|
324
|
+
'',
|
|
325
|
+
'| ID | 类别 | 信任 | 主要用途 | 组合建议 |',
|
|
326
|
+
'| --- | --- | --- | --- | --- |',
|
|
327
|
+
];
|
|
328
|
+
for (const entry of SKILL_REPOSITORY) {
|
|
329
|
+
lines.push(`| \`${entry.id}\` | ${entry.category} | ${entry.trust} | ${entry.orchestration.primaryUse} | ${entry.orchestration.combineWith.join(', ') || '-'} |`);
|
|
330
|
+
}
|
|
331
|
+
return lines.join('\n');
|
|
332
|
+
}
|
|
333
|
+
function skill(input) {
|
|
334
|
+
return {
|
|
335
|
+
id: input.id,
|
|
336
|
+
name: input.name,
|
|
337
|
+
category: input.category,
|
|
338
|
+
description: input.description,
|
|
339
|
+
sourceUrl: input.sourceUrl,
|
|
340
|
+
installCommand: input.installCommand,
|
|
341
|
+
trust: input.trust,
|
|
342
|
+
progressiveDisclosure: {
|
|
343
|
+
startup: '只读取 name、description、tags、sourceUrl 等元数据。',
|
|
344
|
+
activation: '任务意图命中后读取完整 SKILL.md。',
|
|
345
|
+
lazyResources: ['scripts/', 'references/', 'assets/'],
|
|
346
|
+
},
|
|
347
|
+
orchestration: {
|
|
348
|
+
primaryUse: input.primaryUse,
|
|
349
|
+
combineWith: input.combineWith,
|
|
350
|
+
requiredEvidence: input.evidence,
|
|
351
|
+
},
|
|
352
|
+
safety: {
|
|
353
|
+
requiresReview: input.trust !== 'official',
|
|
354
|
+
requiredChecks: [...DEFAULT_REQUIRED_CHECKS],
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function matches(text, keywords) {
|
|
359
|
+
return keywords.some(keyword => text.includes(keyword.toLowerCase()));
|
|
360
|
+
}
|
|
361
|
+
function add(target, values) {
|
|
362
|
+
for (const value of values)
|
|
363
|
+
target.add(value);
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=SkillRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillRepository.js","sourceRoot":"","sources":["../../src/skills/SkillRepository.ts"],"names":[],"mappings":"AAsEA,MAAM,uBAAuB,GAAG;IAC9B,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,qBAAqB;CACtB,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,KAAK,CAAC;QACJ,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,sBAAsB;QACnC,SAAS,EAAE,uEAAuE;QAClF,cAAc,EAAE,0DAA0D;QAC1E,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,yBAAyB;QACrC,WAAW,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,CAAC;QACrE,QAAQ,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;KACvC,CAAC;IACF,KAAK,CAAC;QACJ,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,gCAAgC;QAC7C,SAAS,EAAE,gDAAgD;QAC3D,cAAc,EAAE,yFAAyF;QACzG,KAAK,EAAE,WAAW;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,CAAC,eAAe,EAAE,iBAAiB,CAAC;QACjD,QAAQ,EAAE,CAAC,aAAa,EAAE,eAAe,CAAC;KAC3C,CAAC;IACF,KAAK,CAAC;QACJ,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,IAAI;Q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olCapabilityStatus = 'installed' | 'missing';
|
|
3
|
+
export interface ToolCatalogEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
category: ToolCapabilityCategory;
|
|
7
|
+
requiredFor: string[];
|
|
8
|
+
recommendedFor?: string[];
|
|
9
|
+
skillId?: string;
|
|
10
|
+
command?: string;
|
|
11
|
+
versionArgs?: string[];
|
|
12
|
+
envFlag?: string;
|
|
13
|
+
source?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ToolCapabilityEntry extends ToolCatalogEntry {
|
|
16
|
+
installed: boolean;
|
|
17
|
+
status: ToolCapabilityStatus;
|
|
18
|
+
checkedPaths: string[];
|
|
19
|
+
detectedPath?: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
missingReason?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ToolCapabilitySummary {
|
|
24
|
+
total: number;
|
|
25
|
+
installed: number;
|
|
26
|
+
missing: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ToolCapabilityReport {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
summary: ToolCapabilitySummary;
|
|
31
|
+
tools: ToolCapabilityEntry[];
|
|
32
|
+
}
|
|
33
|
+
export interface ToolCapabilityRegistryOptions {
|
|
34
|
+
projectDir?: string;
|
|
35
|
+
homeDir?: string;
|
|
36
|
+
toolIds?: string[];
|
|
37
|
+
env?: Record<string, string | undefined>;
|
|
38
|
+
commandExists?: (command: string) => boolean;
|
|
39
|
+
runVersion?: (command: string, args: string[]) => {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
stdout?: string;
|
|
42
|
+
stderr?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const TOOL_CAPABILITY_CATALOG: ToolCatalogEntry[];
|
|
46
|
+
export declare function inspectToolCapabilities(options?: ToolCapabilityRegistryOptions): ToolCapabilityReport;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join, resolve } from 'node:path';
|
|
5
|
+
export const TOOL_CAPABILITY_CATALOG = [
|
|
6
|
+
{
|
|
7
|
+
id: 'web-access',
|
|
8
|
+
name: 'Web Access',
|
|
9
|
+
category: 'skill',
|
|
10
|
+
skillId: 'web-access',
|
|
11
|
+
requiredFor: ['webResearch'],
|
|
12
|
+
recommendedFor: ['browserAutomation'],
|
|
13
|
+
source: 'https://github.com/eze-is/web-access',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'frontend-design',
|
|
17
|
+
name: 'Frontend Design',
|
|
18
|
+
category: 'skill',
|
|
19
|
+
skillId: 'frontend-design',
|
|
20
|
+
requiredFor: ['ui'],
|
|
21
|
+
source: 'https://github.com/anthropics/skills/tree/main/skills/frontend-design',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'ui-ux-pro-max',
|
|
25
|
+
name: 'UI/UX Pro Max',
|
|
26
|
+
category: 'skill',
|
|
27
|
+
skillId: 'ui-ux-pro-max',
|
|
28
|
+
requiredFor: ['ui'],
|
|
29
|
+
source: 'https://github.com/nextlevelbuilder/ui-ux-pro-max-skill',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'awesome-design-md',
|
|
33
|
+
name: 'Awesome Design.md',
|
|
34
|
+
category: 'skill',
|
|
35
|
+
skillId: 'awesome-design-md',
|
|
36
|
+
requiredFor: [],
|
|
37
|
+
recommendedFor: ['ui'],
|
|
38
|
+
source: 'https://github.com/VoltAgent/awesome-design-md',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'agent-browser',
|
|
42
|
+
name: 'Agent Browser',
|
|
43
|
+
category: 'cli',
|
|
44
|
+
command: 'agent-browser',
|
|
45
|
+
versionArgs: ['--version'],
|
|
46
|
+
requiredFor: ['browserAutomation'],
|
|
47
|
+
recommendedFor: ['ui', 'e2e'],
|
|
48
|
+
source: 'https://github.com/vercel-labs/agent-browser',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'playwright',
|
|
52
|
+
name: 'Playwright',
|
|
53
|
+
category: 'cli',
|
|
54
|
+
command: 'npx',
|
|
55
|
+
versionArgs: ['playwright', '--version'],
|
|
56
|
+
requiredFor: ['e2e'],
|
|
57
|
+
recommendedFor: ['browserAutomation', 'ui'],
|
|
58
|
+
source: 'https://playwright.dev',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'mcp-chrome-devtools',
|
|
62
|
+
name: 'Chrome DevTools MCP',
|
|
63
|
+
category: 'mcp',
|
|
64
|
+
envFlag: 'SCALE_MCP_CHROME_DEVTOOLS',
|
|
65
|
+
requiredFor: ['browserAutomation'],
|
|
66
|
+
recommendedFor: ['ui', 'e2e'],
|
|
67
|
+
source: 'https://github.com/ChromeDevTools/chrome-devtools-mcp',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'desktop-cua',
|
|
71
|
+
name: 'CUA',
|
|
72
|
+
category: 'cli',
|
|
73
|
+
command: 'cua',
|
|
74
|
+
versionArgs: ['--version'],
|
|
75
|
+
requiredFor: ['desktopAutomation'],
|
|
76
|
+
source: 'https://github.com/trycua/cua',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'codex-cli',
|
|
80
|
+
name: 'Codex CLI',
|
|
81
|
+
category: 'cli',
|
|
82
|
+
command: 'codex',
|
|
83
|
+
versionArgs: ['--version'],
|
|
84
|
+
requiredFor: [],
|
|
85
|
+
recommendedFor: ['externalCli', 'review'],
|
|
86
|
+
source: 'https://github.com/openai/codex',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'gemini-cli',
|
|
90
|
+
name: 'Gemini CLI',
|
|
91
|
+
category: 'cli',
|
|
92
|
+
command: 'gemini',
|
|
93
|
+
versionArgs: ['--version'],
|
|
94
|
+
requiredFor: [],
|
|
95
|
+
recommendedFor: ['externalCli', 'review'],
|
|
96
|
+
source: 'https://github.com/google-gemini/gemini-cli',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'opencode-cli',
|
|
100
|
+
name: 'OpenCode CLI',
|
|
101
|
+
category: 'cli',
|
|
102
|
+
command: 'opencode',
|
|
103
|
+
versionArgs: ['--version'],
|
|
104
|
+
requiredFor: [],
|
|
105
|
+
recommendedFor: ['externalCli', 'review'],
|
|
106
|
+
source: 'https://github.com/sst/opencode',
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
export function inspectToolCapabilities(options = {}) {
|
|
110
|
+
const projectDir = resolve(options.projectDir ?? process.cwd());
|
|
111
|
+
const homeDir = options.homeDir ?? homedir();
|
|
112
|
+
const env = options.env ?? process.env;
|
|
113
|
+
const selected = new Set(options.toolIds ?? TOOL_CAPABILITY_CATALOG.map(tool => tool.id));
|
|
114
|
+
const tools = TOOL_CAPABILITY_CATALOG
|
|
115
|
+
.filter(tool => selected.has(tool.id))
|
|
116
|
+
.map(tool => inspectToolCapability(tool, {
|
|
117
|
+
projectDir,
|
|
118
|
+
homeDir,
|
|
119
|
+
env,
|
|
120
|
+
commandExists: options.commandExists ?? defaultCommandExists,
|
|
121
|
+
runVersion: options.runVersion ?? defaultRunVersion,
|
|
122
|
+
}));
|
|
123
|
+
const installed = tools.filter(tool => tool.installed).length;
|
|
124
|
+
const missing = tools.length - installed;
|
|
125
|
+
return {
|
|
126
|
+
ok: missing === 0,
|
|
127
|
+
summary: {
|
|
128
|
+
total: tools.length,
|
|
129
|
+
installed,
|
|
130
|
+
missing,
|
|
131
|
+
},
|
|
132
|
+
tools,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function inspectToolCapability(tool, deps) {
|
|
136
|
+
if (tool.category === 'skill')
|
|
137
|
+
return inspectSkillTool(tool, deps);
|
|
138
|
+
if (tool.category === 'cli')
|
|
139
|
+
return inspectCliTool(tool, deps);
|
|
140
|
+
return inspectMcpTool(tool, deps);
|
|
141
|
+
}
|
|
142
|
+
function inspectSkillTool(tool, deps) {
|
|
143
|
+
const checkedPaths = skillCandidatePaths(tool.skillId ?? tool.id, deps.projectDir, deps.homeDir);
|
|
144
|
+
const detectedPath = checkedPaths.find(path => existsSync(path));
|
|
145
|
+
return {
|
|
146
|
+
...tool,
|
|
147
|
+
checkedPaths,
|
|
148
|
+
detectedPath,
|
|
149
|
+
installed: Boolean(detectedPath),
|
|
150
|
+
status: detectedPath ? 'installed' : 'missing',
|
|
151
|
+
missingReason: detectedPath ? undefined : 'SKILL.md was not found in project or user skill directories',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function inspectCliTool(tool, deps) {
|
|
155
|
+
const command = tool.command ?? tool.id;
|
|
156
|
+
const checkedPaths = [`PATH:${command}`];
|
|
157
|
+
if (!deps.commandExists(command)) {
|
|
158
|
+
return {
|
|
159
|
+
...tool,
|
|
160
|
+
checkedPaths,
|
|
161
|
+
installed: false,
|
|
162
|
+
status: 'missing',
|
|
163
|
+
missingReason: `Command not found: ${command}`,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
const version = deps.runVersion(command, tool.versionArgs ?? ['--version']);
|
|
167
|
+
return {
|
|
168
|
+
...tool,
|
|
169
|
+
checkedPaths,
|
|
170
|
+
installed: true,
|
|
171
|
+
status: 'installed',
|
|
172
|
+
version: version.ok ? (version.stdout ?? '').trim() : undefined,
|
|
173
|
+
missingReason: version.ok ? undefined : version.stderr ?? 'Version command failed',
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function inspectMcpTool(tool, deps) {
|
|
177
|
+
const envFlag = tool.envFlag ?? `SCALE_MCP_${tool.id.toUpperCase().replace(/[^A-Z0-9]/g, '_')}`;
|
|
178
|
+
const installed = truthy(deps.env[envFlag]);
|
|
179
|
+
return {
|
|
180
|
+
...tool,
|
|
181
|
+
checkedPaths: [`env:${envFlag}`],
|
|
182
|
+
installed,
|
|
183
|
+
status: installed ? 'installed' : 'missing',
|
|
184
|
+
missingReason: installed ? undefined : `MCP availability flag is not set: ${envFlag}`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function skillCandidatePaths(skillId, projectDir, homeDir) {
|
|
188
|
+
return [
|
|
189
|
+
join(projectDir, '.agents', 'skills', skillId, 'SKILL.md'),
|
|
190
|
+
join(projectDir, '.codex', 'skills', skillId, 'SKILL.md'),
|
|
191
|
+
join(projectDir, '.claude', 'skills', skillId, 'SKILL.md'),
|
|
192
|
+
join(homeDir, '.agents', 'skills', skillId, 'SKILL.md'),
|
|
193
|
+
join(homeDir, '.codex', 'skills', skillId, 'SKILL.md'),
|
|
194
|
+
join(homeDir, '.claude', 'skills', skillId, 'SKILL.md'),
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
function defaultCommandExists(command) {
|
|
198
|
+
try {
|
|
199
|
+
execFileSync(process.platform === 'win32' ? 'where.exe' : 'which', [command], { stdio: 'ignore' });
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function defaultRunVersion(command, args) {
|
|
207
|
+
try {
|
|
208
|
+
const stdout = execFileSync(command, args, { encoding: 'utf-8', timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
209
|
+
return { ok: true, stdout };
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return {
|
|
213
|
+
ok: false,
|
|
214
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function truthy(value) {
|
|
219
|
+
if (!value)
|
|
220
|
+
return false;
|
|
221
|
+
return ['1', 'true', 'yes', 'on', 'enabled'].includes(value.toLowerCase());
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=ToolCapabilityRegistry.js.map
|