@comate/zulu 1.2.1-beta.2 → 1.3.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/comate-engine/assets/skills/auto-commit-comate/SKILL.md +260 -0
- package/comate-engine/assets/skills/auto-commit-comate/references/data_structures.md +189 -0
- package/comate-engine/assets/skills/auto-commit-comate/references/new_version_instruction.md +209 -0
- package/comate-engine/assets/skills/auto-commit-comate/references/old_version_instruction.md +208 -0
- package/comate-engine/assets/skills/auto-commit-comate/scripts/git_diff_cli.py +196 -0
- package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/git_utils.py +20 -10
- package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/icafe/client.py +69 -40
- package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/icafe/farseer.py +8 -9
- package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/icafe/matching.py +65 -9
- package/comate-engine/assets/skills/auto-commit-comate/scripts/match_card_cli.py +37 -0
- package/comate-engine/assets/skills/cnap-comate/SKILL.md +157 -0
- package/comate-engine/assets/skills/cnap-comate/references/cases.md +198 -0
- package/comate-engine/assets/skills/cnap-comate/references/deploy-troubleshoot.md +15 -0
- package/comate-engine/assets/skills/cnap-comate/references/install.md +43 -0
- package/comate-engine/assets/skills/cnap-comate/references/kubectl.md +55 -0
- package/comate-engine/assets/skills/cnap-comate/references/login.md +125 -0
- package/comate-engine/assets/skills/cnap-comate/references/oncall.md +24 -0
- package/comate-engine/assets/skills/cnap-comate/scripts/install_cnap_cli.sh +36 -0
- package/comate-engine/assets/skills/code-security/SKILL.md +176 -0
- package/comate-engine/assets/skills/code-security/references/credential_hosting.md +102 -0
- package/comate-engine/assets/skills/code-security/references/vul_repair_sensitive.md +219 -0
- package/comate-engine/assets/skills/code-security/scripts/build_repair_info.py +0 -0
- package/comate-engine/assets/skills/code-security/scripts/credential_hosting.py +99 -0
- package/comate-engine/assets/skills/code-security/scripts/credential_poll.py +350 -0
- package/comate-engine/assets/skills/code-security/scripts/http_client.py +173 -0
- package/comate-engine/assets/skills/code-security/scripts/parse_scan_result.py +301 -0
- package/comate-engine/assets/skills/code-security/scripts/repair_vulnerability.py +261 -0
- package/comate-engine/assets/skills/code-security/scripts/report_chat.py +198 -0
- package/comate-engine/assets/skills/code-security/scripts/scan_vulnerability.py +316 -0
- package/comate-engine/assets/skills/code-security-comate/SKILL.md +219 -0
- package/comate-engine/assets/skills/code-security-comate/references/credential_hosting.md +102 -0
- package/comate-engine/assets/skills/code-security-comate/references/vul_repair-go_sql_injection.md +399 -0
- package/comate-engine/assets/skills/code-security-comate/references/vul_repair-java_sql_injection.md +591 -0
- package/comate-engine/assets/skills/code-security-comate/references/vul_repair-php_sql_injection.md +318 -0
- package/comate-engine/assets/skills/code-security-comate/references/vul_repair-python_sql_injection.md +198 -0
- package/comate-engine/assets/skills/code-security-comate/references/vul_repair_sensitive.md +219 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/credential_hosting.py +87 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/credential_poll.py +345 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/http_client.py +173 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/parse_scan_result.py +392 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/repair_vulnerability.py +245 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/report_chat.py +145 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/scan_vulnerability.py +444 -0
- package/comate-engine/assets/skills/code-security-comate/scripts/utils.py +153 -0
- package/comate-engine/assets/skills/comate-docs-comate/SKILL.md +148 -0
- package/comate-engine/assets/skills/comate-docs-comate/references/doc-map-extended.md +78 -0
- package/comate-engine/assets/skills/comate-docs-comate/references/models-and-billing.md +51 -0
- package/comate-engine/assets/skills/comate-docs-comate/references/product-overview.md +73 -0
- package/comate-engine/assets/skills/comate-docs-comate/references/query_content.md +83 -0
- package/comate-engine/assets/skills/comate-docs-comate/references/query_repo.md +57 -0
- package/comate-engine/assets/skills/comate-docs-comate/scripts/ku_operator.py +1575 -0
- package/comate-engine/assets/skills/create-image-comate/SKILL.md +278 -0
- package/comate-engine/assets/skills/create-skill-comate/SKILL.md +308 -217
- package/comate-engine/assets/skills/create-skill-comate/agents/analyzer.md +274 -0
- package/comate-engine/assets/skills/create-skill-comate/agents/comparator.md +202 -0
- package/comate-engine/assets/skills/create-skill-comate/agents/grader.md +223 -0
- package/comate-engine/assets/skills/create-skill-comate/assets/eval_review.html +146 -0
- package/comate-engine/assets/skills/create-skill-comate/eval-viewer/generate_review.py +489 -0
- package/comate-engine/assets/skills/create-skill-comate/eval-viewer/viewer.html +1325 -0
- package/comate-engine/assets/skills/create-skill-comate/references/schemas.md +430 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/__init__.py +0 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/__pycache__/aggregate_benchmark.cpython-311.pyc +0 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/aggregate_benchmark.py +412 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/generate_report.py +334 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/package_skill.py +140 -0
- package/comate-engine/assets/skills/create-skill-comate/scripts/utils.py +53 -0
- package/comate-engine/assets/skills/find-skills-comate/SKILL.md +15 -12
- package/comate-engine/assets/skills/find-skills-comate/scripts/fetch_skills.py +32 -3
- package/comate-engine/assets/skills/get-ugate-token-comate/SKILL.md +159 -0
- package/comate-engine/assets/skills/get-ugate-token-comate/getUgateToken.py +150 -0
- package/comate-engine/assets/skills/icafe-comate/SKILL.md +240 -0
- package/comate-engine/assets/skills/icafe-comate/references/ai-workflows.md +233 -0
- package/comate-engine/assets/skills/icafe-comate/references/commands.md +1147 -0
- package/comate-engine/assets/skills/icafe-comate/references/error-handling.md +164 -0
- package/comate-engine/assets/skills/icafe-comate/references/git-auto-bindcard-workflow.md +201 -0
- package/comate-engine/assets/skills/icafe-comate/references/git-bindcard-workflow.md +327 -0
- package/comate-engine/assets/skills/icafe-comate/references/iql-syntax.md +327 -0
- package/comate-engine/assets/skills/icafe-comate/references/platform-concepts.md +317 -0
- package/comate-engine/assets/skills/icafe-comate/references/smart-create-workflow.md +171 -0
- package/comate-engine/assets/skills/icafe-comate/references/smart-find-workflow.md +127 -0
- package/comate-engine/assets/skills/icafe-comate/references/smart-update-workflow.md +118 -0
- package/comate-engine/assets/skills/icode-comate/SKILL.md +366 -0
- package/comate-engine/assets/skills/icode-comate/references/api/add_reviewers.md +44 -0
- package/comate-engine/assets/skills/icode-comate/references/api/build_fetch_command.md +89 -0
- package/comate-engine/assets/skills/icode-comate/references/api/check_repo_permission.md +89 -0
- package/comate-engine/assets/skills/icode-comate/references/api/create_branch.md +79 -0
- package/comate-engine/assets/skills/icode-comate/references/api/create_draft_comment.md +109 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_ai_cr_result.md +190 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_ai_review.md +97 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_diff_content.md +92 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_diff_file.md +88 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_machine_check.md +73 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_my_reviews.md +115 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_person_commit.md +89 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_person_repo.md +63 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_repo_branch.md +62 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_repo_config.md +91 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_repo_members.md +118 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_repo_reviews.md +91 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_review_comments.md +87 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_review_info.md +81 -0
- package/comate-engine/assets/skills/icode-comate/references/api/get_submit_settings.md +105 -0
- package/comate-engine/assets/skills/icode-comate/references/api/icode-api.md +86 -0
- package/comate-engine/assets/skills/icode-comate/references/api/publish_comments.md +72 -0
- package/comate-engine/assets/skills/icode-comate/references/api/set_review_score.md +58 -0
- package/comate-engine/assets/skills/icode-comate/references/api/start_ai_review.md +77 -0
- package/comate-engine/assets/skills/icode-comate/references/api/submit_review.md +50 -0
- package/comate-engine/assets/skills/icode-comate/references/api/trigger_ai_cr.md +63 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/add-reviewer.md +92 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/fix-machine-check.md +144 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/merge-cr.md +100 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/ssh-setup.md +106 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/submit-acr.md +135 -0
- package/comate-engine/assets/skills/icode-comate/references/feature/submit-cr.md +123 -0
- package/comate-engine/assets/skills/icode-comate/references/git/clone.md +67 -0
- package/comate-engine/assets/skills/icode-comate/references/git/icode-git.md +68 -0
- package/comate-engine/assets/skills/icode-comate/references/git/push.md +64 -0
- package/comate-engine/assets/skills/icode-comate/references/git/push_cr.md +103 -0
- package/comate-engine/assets/skills/icode-comate/references/install.md +144 -0
- package/comate-engine/assets/skills/icode-comate/references/login.md +111 -0
- package/comate-engine/assets/skills/icode-comate/scripts/add-reviewer.sh +154 -0
- package/comate-engine/assets/skills/icode-comate/scripts/common.sh +145 -0
- package/comate-engine/assets/skills/icode-comate/scripts/fix-machine-check.sh +131 -0
- package/comate-engine/assets/skills/icode-comate/scripts/merge-cr.sh +105 -0
- package/comate-engine/assets/skills/icode-comate/scripts/ssh-setup.sh +159 -0
- package/comate-engine/assets/skills/icode-comate/scripts/submit-acr.sh +236 -0
- package/comate-engine/assets/skills/icode-comate/scripts/submit-cr.sh +104 -0
- package/comate-engine/assets/skills/icode-comate/scripts/test-preflight.sh +89 -0
- package/comate-engine/assets/skills/ku-operator-comate/SKILL.md +121 -0
- package/comate-engine/assets/skills/ku-operator-comate/examples.md +190 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/add_member.md +49 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/change_scope.md +38 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/copy_doc.md +50 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/create_doc.md +61 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/delete_doc.md +31 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/edit_content.md +568 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/move_doc.md +45 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_comment.md +79 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_content.md +83 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_flowchart.md +84 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_permission.md +38 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_recent_view.md +67 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_repo.md +57 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/query_user_info.md +37 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/update_member.md +41 -0
- package/comate-engine/assets/skills/ku-operator-comate/references/upload_attachment.md +52 -0
- package/comate-engine/assets/skills/ku-operator-comate/scripts/ku_operator.py +1575 -0
- package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +2 -2
- package/comate-engine/node_modules/tree-sitter-bash/node_modules/.bin/node-gyp-build +2 -2
- package/comate-engine/node_modules/tree-sitter-bash/node_modules/.bin/node-gyp-build-optional +2 -2
- package/comate-engine/node_modules/tree-sitter-bash/node_modules/.bin/node-gyp-build-test +2 -2
- package/comate-engine/package.json +2 -0
- package/comate-engine/server.js +263 -79
- package/dist/bundle/index.js +3 -3
- package/package.json +1 -1
- package/comate-engine/assets/skills/figma2code-comate/codeConnect.md +0 -37
- package/comate-engine/assets/skills/figma2code-comate/designToken.md +0 -3
- package/comate-engine/assets/skills/figma2code-comate/f2cMcp.md +0 -59
- package/comate-engine/assets/skills/smart-commit/SKILL.md +0 -646
- package/comate-engine/node_modules/@comate/plugin-host/dist/index-AZIho4HV.js +0 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/user-BIpzRUfb.js +0 -44
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/references/issue_type_mapping.json +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/references/query_reference.md +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/compat.py +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/create_card_cli.py +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/icafe/__init__.py +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/logger.py +0 -0
- /package/comate-engine/assets/skills/{smart-commit → auto-commit-comate}/scripts/recognize_card_cli.py +0 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate an HTML report from output.
|
|
3
|
+
|
|
4
|
+
Takes the JSON output and generates a visual HTML report
|
|
5
|
+
showing each description attempt with check/x for each test case.
|
|
6
|
+
Distinguishes between train and test queries.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import html
|
|
11
|
+
import json
|
|
12
|
+
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def generate_html(data: dict, auto_refresh: bool = False, skill_name: str = "") -> str:
|
|
17
|
+
"""Generate HTML report from loop output data. If auto_refresh is True, adds a meta refresh tag."""
|
|
18
|
+
history = data.get("history", [])
|
|
19
|
+
holdout = data.get("holdout", 0)
|
|
20
|
+
title_prefix = html.escape(skill_name + " \u2014 ") if skill_name else ""
|
|
21
|
+
|
|
22
|
+
# Get all unique queries from train and test sets, with should_trigger info
|
|
23
|
+
train_queries: list[dict] = []
|
|
24
|
+
test_queries: list[dict] = []
|
|
25
|
+
if history:
|
|
26
|
+
for r in history[0].get("train_results", history[0].get("results", [])):
|
|
27
|
+
train_queries.append({"query": r["query"], "should_trigger": r.get("should_trigger", True)})
|
|
28
|
+
if history[0].get("test_results"):
|
|
29
|
+
for r in history[0].get("test_results", []):
|
|
30
|
+
test_queries.append({"query": r["query"], "should_trigger": r.get("should_trigger", True)})
|
|
31
|
+
|
|
32
|
+
refresh_tag = ' <meta http-equiv="refresh" content="5">\n' if auto_refresh else ""
|
|
33
|
+
|
|
34
|
+
html_parts = ["""<!DOCTYPE html>
|
|
35
|
+
<html>
|
|
36
|
+
<head>
|
|
37
|
+
<meta charset="utf-8">
|
|
38
|
+
""" + refresh_tag + """ <title>""" + title_prefix + """Skill Description Optimization</title>
|
|
39
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
40
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
41
|
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&family=Lora:wght@400;500&display=swap" rel="stylesheet">
|
|
42
|
+
<style>
|
|
43
|
+
body {
|
|
44
|
+
font-family: 'Lora', Georgia, serif;
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
padding: 20px;
|
|
48
|
+
background: #faf9f5;
|
|
49
|
+
color: #141413;
|
|
50
|
+
}
|
|
51
|
+
h1 { font-family: 'Poppins', sans-serif; color: #141413; }
|
|
52
|
+
.explainer {
|
|
53
|
+
background: white;
|
|
54
|
+
padding: 15px;
|
|
55
|
+
border-radius: 6px;
|
|
56
|
+
margin-bottom: 20px;
|
|
57
|
+
border: 1px solid #e8e6dc;
|
|
58
|
+
color: #b0aea5;
|
|
59
|
+
font-size: 0.875rem;
|
|
60
|
+
line-height: 1.6;
|
|
61
|
+
}
|
|
62
|
+
.summary {
|
|
63
|
+
background: white;
|
|
64
|
+
padding: 15px;
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
margin-bottom: 20px;
|
|
67
|
+
border: 1px solid #e8e6dc;
|
|
68
|
+
}
|
|
69
|
+
.summary p { margin: 5px 0; }
|
|
70
|
+
.best { color: #788c5d; font-weight: bold; }
|
|
71
|
+
.table-container {
|
|
72
|
+
overflow-x: auto;
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
table {
|
|
76
|
+
border-collapse: collapse;
|
|
77
|
+
background: white;
|
|
78
|
+
border: 1px solid #e8e6dc;
|
|
79
|
+
border-radius: 6px;
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
min-width: 100%;
|
|
82
|
+
}
|
|
83
|
+
th, td {
|
|
84
|
+
padding: 8px;
|
|
85
|
+
text-align: left;
|
|
86
|
+
border: 1px solid #e8e6dc;
|
|
87
|
+
white-space: normal;
|
|
88
|
+
word-wrap: break-word;
|
|
89
|
+
}
|
|
90
|
+
th {
|
|
91
|
+
font-family: 'Poppins', sans-serif;
|
|
92
|
+
background: #141413;
|
|
93
|
+
color: #faf9f5;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
}
|
|
96
|
+
th.test-col {
|
|
97
|
+
background: #6a9bcc;
|
|
98
|
+
}
|
|
99
|
+
th.query-col { min-width: 200px; }
|
|
100
|
+
td.description {
|
|
101
|
+
font-family: monospace;
|
|
102
|
+
font-size: 11px;
|
|
103
|
+
word-wrap: break-word;
|
|
104
|
+
max-width: 400px;
|
|
105
|
+
}
|
|
106
|
+
td.result {
|
|
107
|
+
text-align: center;
|
|
108
|
+
font-size: 16px;
|
|
109
|
+
min-width: 40px;
|
|
110
|
+
}
|
|
111
|
+
td.test-result {
|
|
112
|
+
background: #f0f6fc;
|
|
113
|
+
}
|
|
114
|
+
.pass { color: #788c5d; }
|
|
115
|
+
.fail { color: #c44; }
|
|
116
|
+
.rate {
|
|
117
|
+
font-size: 9px;
|
|
118
|
+
color: #b0aea5;
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
tr:hover { background: #faf9f5; }
|
|
122
|
+
.score {
|
|
123
|
+
display: inline-block;
|
|
124
|
+
padding: 2px 6px;
|
|
125
|
+
border-radius: 4px;
|
|
126
|
+
font-weight: bold;
|
|
127
|
+
font-size: 11px;
|
|
128
|
+
}
|
|
129
|
+
.score-good { background: #eef2e8; color: #788c5d; }
|
|
130
|
+
.score-ok { background: #fef3c7; color: #d97706; }
|
|
131
|
+
.score-bad { background: #fceaea; color: #c44; }
|
|
132
|
+
.train-label { color: #b0aea5; font-size: 10px; }
|
|
133
|
+
.test-label { color: #6a9bcc; font-size: 10px; font-weight: bold; }
|
|
134
|
+
.best-row { background: #f5f8f2; }
|
|
135
|
+
th.positive-col { border-bottom: 3px solid #788c5d; }
|
|
136
|
+
th.negative-col { border-bottom: 3px solid #c44; }
|
|
137
|
+
th.test-col.positive-col { border-bottom: 3px solid #788c5d; }
|
|
138
|
+
th.test-col.negative-col { border-bottom: 3px solid #c44; }
|
|
139
|
+
.legend { font-family: 'Poppins', sans-serif; display: flex; gap: 20px; margin-bottom: 10px; font-size: 13px; align-items: center; }
|
|
140
|
+
.legend-item { display: flex; align-items: center; gap: 6px; }
|
|
141
|
+
.legend-swatch { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }
|
|
142
|
+
.swatch-positive { background: #141413; border-bottom: 3px solid #788c5d; }
|
|
143
|
+
.swatch-negative { background: #141413; border-bottom: 3px solid #c44; }
|
|
144
|
+
.swatch-test { background: #6a9bcc; }
|
|
145
|
+
.swatch-train { background: #141413; }
|
|
146
|
+
</style>
|
|
147
|
+
</head>
|
|
148
|
+
<body>
|
|
149
|
+
<h1>""" + title_prefix + """Skill Description Optimization</h1>
|
|
150
|
+
<div class="explainer">
|
|
151
|
+
<strong>Optimizing your skill's description.</strong> This page updates automatically as Comate tests different versions of your skill's description. Each row is an iteration — a new description attempt. The columns show test queries: green checkmarks mean the skill triggered correctly (or correctly didn't trigger), red crosses mean it got it wrong. The "Train" score shows performance on queries used to improve the description; the "Test" score shows performance on held-out queries the optimizer hasn't seen. When it's done, Comate will apply the best-performing description to your skill.
|
|
152
|
+
</div>
|
|
153
|
+
"""]
|
|
154
|
+
|
|
155
|
+
# Summary section
|
|
156
|
+
best_test_score = data.get('best_test_score')
|
|
157
|
+
best_train_score = data.get('best_train_score')
|
|
158
|
+
html_parts.append(f"""
|
|
159
|
+
<div class="summary">
|
|
160
|
+
<p><strong>Original:</strong> {html.escape(data.get('original_description', 'N/A'))}</p>
|
|
161
|
+
<p class="best"><strong>Best:</strong> {html.escape(data.get('best_description', 'N/A'))}</p>
|
|
162
|
+
<p><strong>Best Score:</strong> {data.get('best_score', 'N/A')} {'(test)' if best_test_score else '(train)'}</p>
|
|
163
|
+
<p><strong>Iterations:</strong> {data.get('iterations_run', 0)} | <strong>Train:</strong> {data.get('train_size', '?')} | <strong>Test:</strong> {data.get('test_size', '?')}</p>
|
|
164
|
+
</div>
|
|
165
|
+
""")
|
|
166
|
+
|
|
167
|
+
# Legend
|
|
168
|
+
html_parts.append("""
|
|
169
|
+
<div class="legend">
|
|
170
|
+
<span style="font-weight:600">Query columns:</span>
|
|
171
|
+
<span class="legend-item"><span class="legend-swatch swatch-positive"></span> Should trigger</span>
|
|
172
|
+
<span class="legend-item"><span class="legend-swatch swatch-negative"></span> Should NOT trigger</span>
|
|
173
|
+
<span class="legend-item"><span class="legend-swatch swatch-train"></span> Train</span>
|
|
174
|
+
<span class="legend-item"><span class="legend-swatch swatch-test"></span> Test</span>
|
|
175
|
+
</div>
|
|
176
|
+
""")
|
|
177
|
+
|
|
178
|
+
# Table header
|
|
179
|
+
html_parts.append("""
|
|
180
|
+
<div class="table-container">
|
|
181
|
+
<table>
|
|
182
|
+
<thead>
|
|
183
|
+
<tr>
|
|
184
|
+
<th>Iter</th>
|
|
185
|
+
<th>Train</th>
|
|
186
|
+
<th>Test</th>
|
|
187
|
+
<th class="query-col">Description</th>
|
|
188
|
+
""")
|
|
189
|
+
|
|
190
|
+
# Add column headers for train queries
|
|
191
|
+
for qinfo in train_queries:
|
|
192
|
+
polarity = "positive-col" if qinfo["should_trigger"] else "negative-col"
|
|
193
|
+
html_parts.append(f' <th class="{polarity}">{html.escape(qinfo["query"])}</th>\n')
|
|
194
|
+
|
|
195
|
+
# Add column headers for test queries (different color)
|
|
196
|
+
for qinfo in test_queries:
|
|
197
|
+
polarity = "positive-col" if qinfo["should_trigger"] else "negative-col"
|
|
198
|
+
html_parts.append(f' <th class="test-col {polarity}">{html.escape(qinfo["query"])}</th>\n')
|
|
199
|
+
|
|
200
|
+
html_parts.append(""" </tr>
|
|
201
|
+
</thead>
|
|
202
|
+
<tbody>
|
|
203
|
+
""")
|
|
204
|
+
|
|
205
|
+
# Find best iteration for highlighting
|
|
206
|
+
if test_queries:
|
|
207
|
+
best_iter = max(history, key=lambda h: h.get("test_passed") or 0).get("iteration")
|
|
208
|
+
else:
|
|
209
|
+
best_iter = max(history, key=lambda h: h.get("train_passed", h.get("passed", 0))).get("iteration")
|
|
210
|
+
|
|
211
|
+
# Add rows for each iteration
|
|
212
|
+
for h in history:
|
|
213
|
+
iteration = h.get("iteration", "?")
|
|
214
|
+
train_passed = h.get("train_passed", h.get("passed", 0))
|
|
215
|
+
train_total = h.get("train_total", h.get("total", 0))
|
|
216
|
+
test_passed = h.get("test_passed")
|
|
217
|
+
test_total = h.get("test_total")
|
|
218
|
+
description = h.get("description", "")
|
|
219
|
+
train_results = h.get("train_results", h.get("results", []))
|
|
220
|
+
test_results = h.get("test_results", [])
|
|
221
|
+
|
|
222
|
+
# Create lookups for results by query
|
|
223
|
+
train_by_query = {r["query"]: r for r in train_results}
|
|
224
|
+
test_by_query = {r["query"]: r for r in test_results} if test_results else {}
|
|
225
|
+
|
|
226
|
+
# Compute aggregate correct/total runs across all retries
|
|
227
|
+
def aggregate_runs(results: list[dict]) -> tuple[int, int]:
|
|
228
|
+
correct = 0
|
|
229
|
+
total = 0
|
|
230
|
+
for r in results:
|
|
231
|
+
runs = r.get("runs", 0)
|
|
232
|
+
triggers = r.get("triggers", 0)
|
|
233
|
+
total += runs
|
|
234
|
+
if r.get("should_trigger", True):
|
|
235
|
+
correct += triggers
|
|
236
|
+
else:
|
|
237
|
+
correct += runs - triggers
|
|
238
|
+
return correct, total
|
|
239
|
+
|
|
240
|
+
train_correct, train_runs = aggregate_runs(train_results)
|
|
241
|
+
test_correct, test_runs = aggregate_runs(test_results)
|
|
242
|
+
|
|
243
|
+
# Determine score classes
|
|
244
|
+
def score_class(correct: int, total: int) -> str:
|
|
245
|
+
if total > 0:
|
|
246
|
+
ratio = correct / total
|
|
247
|
+
if ratio >= 0.8:
|
|
248
|
+
return "score-good"
|
|
249
|
+
elif ratio >= 0.5:
|
|
250
|
+
return "score-ok"
|
|
251
|
+
return "score-bad"
|
|
252
|
+
|
|
253
|
+
train_class = score_class(train_correct, train_runs)
|
|
254
|
+
test_class = score_class(test_correct, test_runs)
|
|
255
|
+
|
|
256
|
+
row_class = "best-row" if iteration == best_iter else ""
|
|
257
|
+
|
|
258
|
+
html_parts.append(f""" <tr class="{row_class}">
|
|
259
|
+
<td>{iteration}</td>
|
|
260
|
+
<td><span class="score {train_class}">{train_correct}/{train_runs}</span></td>
|
|
261
|
+
<td><span class="score {test_class}">{test_correct}/{test_runs}</span></td>
|
|
262
|
+
<td class="description">{html.escape(description)}</td>
|
|
263
|
+
""")
|
|
264
|
+
|
|
265
|
+
# Add result for each train query
|
|
266
|
+
for qinfo in train_queries:
|
|
267
|
+
r = train_by_query.get(qinfo["query"], {})
|
|
268
|
+
did_pass = r.get("pass", False)
|
|
269
|
+
triggers = r.get("triggers", 0)
|
|
270
|
+
runs = r.get("runs", 0)
|
|
271
|
+
|
|
272
|
+
icon = "✓" if did_pass else "✗"
|
|
273
|
+
css_class = "pass" if did_pass else "fail"
|
|
274
|
+
|
|
275
|
+
html_parts.append(
|
|
276
|
+
f' <td class="result {css_class}">{icon}<span '
|
|
277
|
+
f'class="rate">{triggers}/{runs}</span></td>\n')
|
|
278
|
+
|
|
279
|
+
# Add result for each test query (with different background)
|
|
280
|
+
for qinfo in test_queries:
|
|
281
|
+
r = test_by_query.get(qinfo["query"], {})
|
|
282
|
+
did_pass = r.get("pass", False)
|
|
283
|
+
triggers = r.get("triggers", 0)
|
|
284
|
+
runs = r.get("runs", 0)
|
|
285
|
+
|
|
286
|
+
icon = "✓" if did_pass else "✗"
|
|
287
|
+
css_class = "pass" if did_pass else "fail"
|
|
288
|
+
|
|
289
|
+
html_parts.append(
|
|
290
|
+
f' <td class="result test-result {css_class}">{icon}<span class="rate">'
|
|
291
|
+
f'{triggers}/{runs}</span></td>\n')
|
|
292
|
+
|
|
293
|
+
html_parts.append(" </tr>\n")
|
|
294
|
+
|
|
295
|
+
html_parts.append(""" </tbody>
|
|
296
|
+
</table>
|
|
297
|
+
</div>
|
|
298
|
+
""")
|
|
299
|
+
|
|
300
|
+
html_parts.append("""
|
|
301
|
+
</body>
|
|
302
|
+
</html>
|
|
303
|
+
""")
|
|
304
|
+
|
|
305
|
+
return "".join(html_parts)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def main():
|
|
309
|
+
"""
|
|
310
|
+
Main entry point for the script.
|
|
311
|
+
:return:
|
|
312
|
+
"""
|
|
313
|
+
parser = argparse.ArgumentParser(description="Generate HTML report from output")
|
|
314
|
+
parser.add_argument("input", help="Path to JSON output from (or - for stdin)")
|
|
315
|
+
parser.add_argument("-o", "--output", default=None, help="Output HTML file (default: stdout)")
|
|
316
|
+
parser.add_argument("--skill-name", default="", help="Skill name to include in the report title")
|
|
317
|
+
args = parser.parse_args()
|
|
318
|
+
|
|
319
|
+
if args.input == "-":
|
|
320
|
+
data = json.load(sys.stdin)
|
|
321
|
+
else:
|
|
322
|
+
data = json.loads(Path(args.input).read_text())
|
|
323
|
+
|
|
324
|
+
html_output = generate_html(data, skill_name=args.skill_name)
|
|
325
|
+
|
|
326
|
+
if args.output:
|
|
327
|
+
Path(args.output).write_text(html_output)
|
|
328
|
+
print(f"Report written to {args.output}", file=sys.stderr)
|
|
329
|
+
else:
|
|
330
|
+
print(html_output)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
if __name__ == "__main__":
|
|
334
|
+
main()
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Packager - Creates a distributable .skill file of a skill folder
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python utils/package_skill.py <path/to/skill-folder> [output-directory]
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
python utils/package_skill.py skills/public/my-skill
|
|
10
|
+
python utils/package_skill.py skills/public/my-skill ./dist
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import fnmatch
|
|
14
|
+
import sys
|
|
15
|
+
import zipfile
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from scripts.quick_validate import validate_skill
|
|
18
|
+
|
|
19
|
+
# Patterns to exclude when packaging skills.
|
|
20
|
+
EXCLUDE_DIRS = {"__pycache__", "node_modules"}
|
|
21
|
+
EXCLUDE_GLOBS = {"*.pyc"}
|
|
22
|
+
EXCLUDE_FILES = {".DS_Store"}
|
|
23
|
+
# Directories excluded only at the skill root (not when nested deeper).
|
|
24
|
+
ROOT_EXCLUDE_DIRS = {"evals"}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def should_exclude(rel_path: Path) -> bool:
|
|
28
|
+
"""Check if a path should be excluded from packaging."""
|
|
29
|
+
parts = rel_path.parts
|
|
30
|
+
if any(part in EXCLUDE_DIRS for part in parts):
|
|
31
|
+
return True
|
|
32
|
+
# rel_path is relative to skill_path.parent, so parts[0] is the skill
|
|
33
|
+
# folder name and parts[1] (if present) is the first subdir.
|
|
34
|
+
if len(parts) > 1 and parts[1] in ROOT_EXCLUDE_DIRS:
|
|
35
|
+
return True
|
|
36
|
+
name = rel_path.name
|
|
37
|
+
if name in EXCLUDE_FILES:
|
|
38
|
+
return True
|
|
39
|
+
return any(fnmatch.fnmatch(name, pat) for pat in EXCLUDE_GLOBS)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def package_skill(skill_path, output_dir=None):
|
|
43
|
+
"""
|
|
44
|
+
Package a skill folder into a .skill file.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
skill_path: Path to the skill folder
|
|
48
|
+
output_dir: Optional output directory for the .skill file (defaults to current directory)
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Path to the created .skill file, or None if error
|
|
52
|
+
"""
|
|
53
|
+
skill_path = Path(skill_path).resolve()
|
|
54
|
+
|
|
55
|
+
# Validate skill folder exists
|
|
56
|
+
if not skill_path.exists():
|
|
57
|
+
print(f"❌ Error: Skill folder not found: {skill_path}")
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
if not skill_path.is_dir():
|
|
61
|
+
print(f"❌ Error: Path is not a directory: {skill_path}")
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
# Validate SKILL.md exists
|
|
65
|
+
skill_md = skill_path / "SKILL.md"
|
|
66
|
+
if not skill_md.exists():
|
|
67
|
+
print(f"❌ Error: SKILL.md not found in {skill_path}")
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
# Run validation before packaging
|
|
71
|
+
print("🔍 Validating skill...")
|
|
72
|
+
valid, message = validate_skill(skill_path)
|
|
73
|
+
if not valid:
|
|
74
|
+
print(f"❌ Validation failed: {message}")
|
|
75
|
+
print(" Please fix the validation errors before packaging.")
|
|
76
|
+
return None
|
|
77
|
+
print(f"✅ {message}\n")
|
|
78
|
+
|
|
79
|
+
# Determine output location
|
|
80
|
+
skill_name = skill_path.name
|
|
81
|
+
if output_dir:
|
|
82
|
+
output_path = Path(output_dir).resolve()
|
|
83
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
84
|
+
else:
|
|
85
|
+
output_path = Path.cwd()
|
|
86
|
+
|
|
87
|
+
skill_filename = output_path / f"{skill_name}.skill"
|
|
88
|
+
|
|
89
|
+
# Create the .skill file (zip format)
|
|
90
|
+
try:
|
|
91
|
+
with zipfile.ZipFile(skill_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
92
|
+
# Walk through the skill directory, excluding build artifacts
|
|
93
|
+
for file_path in skill_path.rglob('*'):
|
|
94
|
+
if not file_path.is_file():
|
|
95
|
+
continue
|
|
96
|
+
arcname = file_path.relative_to(skill_path.parent)
|
|
97
|
+
if should_exclude(arcname):
|
|
98
|
+
print(f" Skipped: {arcname}")
|
|
99
|
+
continue
|
|
100
|
+
zipf.write(file_path, arcname)
|
|
101
|
+
print(f" Added: {arcname}")
|
|
102
|
+
|
|
103
|
+
print(f"\n✅ Successfully packaged skill to: {skill_filename}")
|
|
104
|
+
return skill_filename
|
|
105
|
+
|
|
106
|
+
except Exception as e:
|
|
107
|
+
print(f"❌ Error creating .skill file: {e}")
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def main():
|
|
112
|
+
"""
|
|
113
|
+
Main entry point for the script.
|
|
114
|
+
:return:
|
|
115
|
+
"""
|
|
116
|
+
if len(sys.argv) < 2:
|
|
117
|
+
print("Usage: python utils/package_skill.py <path/to/skill-folder> [output-directory]")
|
|
118
|
+
print("\nExample:")
|
|
119
|
+
print(" python utils/package_skill.py skills/public/my-skill")
|
|
120
|
+
print(" python utils/package_skill.py skills/public/my-skill ./dist")
|
|
121
|
+
sys.exit(1)
|
|
122
|
+
|
|
123
|
+
skill_path = sys.argv[1]
|
|
124
|
+
output_dir = sys.argv[2] if len(sys.argv) > 2 else None
|
|
125
|
+
|
|
126
|
+
print(f"📦 Packaging skill: {skill_path}")
|
|
127
|
+
if output_dir:
|
|
128
|
+
print(f" Output directory: {output_dir}")
|
|
129
|
+
print()
|
|
130
|
+
|
|
131
|
+
result = package_skill(skill_path, output_dir)
|
|
132
|
+
|
|
133
|
+
if result:
|
|
134
|
+
sys.exit(0)
|
|
135
|
+
else:
|
|
136
|
+
sys.exit(1)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
main()
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Shared utilities for skill-creator scripts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def parse_skill_md(skill_path: Path) -> tuple[str, str, str]:
|
|
8
|
+
"""
|
|
9
|
+
Parse the name, description, and content of a skill from its SKILL.md file.
|
|
10
|
+
:param skill_path:
|
|
11
|
+
:return:
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
content = (skill_path / "SKILL.md").read_text()
|
|
15
|
+
lines = content.split("\n")
|
|
16
|
+
|
|
17
|
+
if lines[0].strip() != "---":
|
|
18
|
+
raise ValueError("SKILL.md missing frontmatter (no opening ---)")
|
|
19
|
+
|
|
20
|
+
end_idx = None
|
|
21
|
+
for i, line in enumerate(lines[1:], start=1):
|
|
22
|
+
if line.strip() == "---":
|
|
23
|
+
end_idx = i
|
|
24
|
+
break
|
|
25
|
+
|
|
26
|
+
if end_idx is None:
|
|
27
|
+
raise ValueError("SKILL.md missing frontmatter (no closing ---)")
|
|
28
|
+
|
|
29
|
+
name = ""
|
|
30
|
+
description = ""
|
|
31
|
+
frontmatter_lines = lines[1:end_idx]
|
|
32
|
+
i = 0
|
|
33
|
+
while i < len(frontmatter_lines):
|
|
34
|
+
line = frontmatter_lines[i]
|
|
35
|
+
if line.startswith("name:"):
|
|
36
|
+
name = line[len("name:"):].strip().strip('"').strip("'")
|
|
37
|
+
elif line.startswith("description:"):
|
|
38
|
+
value = line[len("description:"):].strip()
|
|
39
|
+
# Handle YAML multiline indicators (>, |, >-, |-)
|
|
40
|
+
if value in (">", "|", ">-", "|-"):
|
|
41
|
+
continuation_lines: list[str] = []
|
|
42
|
+
i += 1
|
|
43
|
+
while i < len(frontmatter_lines) and (frontmatter_lines[i].startswith(" ") or
|
|
44
|
+
frontmatter_lines[i].startswith("\t")):
|
|
45
|
+
continuation_lines.append(frontmatter_lines[i].strip())
|
|
46
|
+
i += 1
|
|
47
|
+
description = " ".join(continuation_lines)
|
|
48
|
+
continue
|
|
49
|
+
else:
|
|
50
|
+
description = value.strip('"').strip("'")
|
|
51
|
+
i += 1
|
|
52
|
+
|
|
53
|
+
return name, description, content
|
|
@@ -4,6 +4,7 @@ description: 当用户提出可能需要专业能力的问题,且本地已安
|
|
|
4
4
|
metadata:
|
|
5
5
|
enableWhen:
|
|
6
6
|
- isInternal
|
|
7
|
+
version: 20260410
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# Skill搜索器
|
|
@@ -28,10 +29,10 @@ metadata:
|
|
|
28
29
|
|
|
29
30
|
优先使用Comate内部平台,不可用时自动降级到开源生态:
|
|
30
31
|
|
|
31
|
-
| 来源 | 获取方式
|
|
32
|
-
| ------------------
|
|
33
|
-
| Comate内部平台 | `python3 scripts/fetch_skills.py` | Comate用户,内网环境 |
|
|
34
|
-
| 开源生态(skills.sh) | `npx skills find [query]`
|
|
32
|
+
| 来源 | 获取方式 | 适用场景 |
|
|
33
|
+
| ------------------ |--------------------------------------------------------------------------------| ---------------------- |
|
|
34
|
+
| Comate内部平台 | `python3 ${COMATE_SKILL_DIR}/scripts/fetch_skills.py --page 1 --page-size 200` | Comate用户,内网环境 |
|
|
35
|
+
| 开源生态(skills.sh) | `npx skills find [query]` | 通用场景,内网不可达时 |
|
|
35
36
|
|
|
36
37
|
> 若两个来源均不可用,告知用户并直接用现有能力处理请求。
|
|
37
38
|
|
|
@@ -39,10 +40,10 @@ metadata:
|
|
|
39
40
|
|
|
40
41
|
根据用户意图和skill来源确定安装位置:
|
|
41
42
|
|
|
42
|
-
| 意图 | 来源
|
|
43
|
+
| 意图 | 来源 | 安装路径 | 说明 |
|
|
43
44
|
| --------------- |------| -------------------------------- | -------------------------- |
|
|
44
|
-
| 安装到当前项目 | Comate
|
|
45
|
-
| 安装到全局/个人 | Comate
|
|
45
|
+
| 安装到当前项目 | Comate | `.comate/skills/<skill_name>/` | 仅当前项目可用,随仓库共享 |
|
|
46
|
+
| 安装到全局/个人 | Comate | `~/.comate/skills/<skill_name>/` | 所有项目可用,个人专属 |
|
|
46
47
|
| 安装到当前项目 | 开源生态 | `.agents/skills/<skill_name>/` | 仅当前项目可用,随仓库共享 |
|
|
47
48
|
| 安装到全局/个人 | 开源生态 | `~/.agents/skills/<skill_name>/` | 所有项目可用,个人专属 |
|
|
48
49
|
|
|
@@ -70,8 +71,10 @@ metadata:
|
|
|
70
71
|
|
|
71
72
|
**优先尝试Comate内部平台:**
|
|
72
73
|
|
|
74
|
+
注意:如果第一页(page=1)没有找到,请继续遍历下一页,直到展示出Comate平台所有的skill之后再判断skill是否存在
|
|
75
|
+
|
|
73
76
|
```bash
|
|
74
|
-
python3 scripts/fetch_skills.py
|
|
77
|
+
python3 ${COMATE_SKILL_DIR}/scripts/fetch_skills.py --page 1 --page-size 200
|
|
75
78
|
```
|
|
76
79
|
|
|
77
80
|
脚本输出包含skill名称和描述的JSON。
|
|
@@ -116,7 +119,7 @@ npx skills find [query]
|
|
|
116
119
|
### 步骤5:获取下载链接(仅Comate来源)
|
|
117
120
|
|
|
118
121
|
```bash
|
|
119
|
-
python3 scripts/get_download_url.py <skill_name>
|
|
122
|
+
python3 ${COMATE_SKILL_DIR}/scripts/get_download_url.py <skill_name>
|
|
120
123
|
```
|
|
121
124
|
|
|
122
125
|
> 开源来源跳过此步骤,直接进入预览。
|
|
@@ -128,7 +131,7 @@ python3 scripts/get_download_url.py <skill_name>
|
|
|
128
131
|
**Comate来源:**
|
|
129
132
|
|
|
130
133
|
```bash
|
|
131
|
-
python3 scripts/preview_skill.py <skill_name> <download_url>
|
|
134
|
+
python3 ${COMATE_SKILL_DIR}/scripts/preview_skill.py <skill_name> <download_url>
|
|
132
135
|
```
|
|
133
136
|
|
|
134
137
|
**开源来源:**
|
|
@@ -167,10 +170,10 @@ https://skills.sh/<owner>/<repo>/<skill-name>
|
|
|
167
170
|
|
|
168
171
|
```bash
|
|
169
172
|
# 安装到当前项目
|
|
170
|
-
python3 scripts/install_skill.py <skill_name> <download_url> --scope project
|
|
173
|
+
python3 ${COMATE_SKILL_DIR}/scripts/install_skill.py <skill_name> <download_url> --scope project
|
|
171
174
|
|
|
172
175
|
# 安装到全局个人目录
|
|
173
|
-
python3 scripts/install_skill.py <skill_name> <download_url> --scope global
|
|
176
|
+
python3 ${COMATE_SKILL_DIR}/scripts/install_skill.py <skill_name> <download_url> --scope global
|
|
174
177
|
```
|
|
175
178
|
|
|
176
179
|
**开源来源(skills.sh):**
|
|
@@ -2,23 +2,33 @@
|
|
|
2
2
|
"""
|
|
3
3
|
从Comate Skills中心获取所有可用的skills。
|
|
4
4
|
"""
|
|
5
|
+
import argparse
|
|
5
6
|
import sys
|
|
6
7
|
import json
|
|
7
8
|
import urllib.request
|
|
8
9
|
import urllib.error
|
|
10
|
+
import urllib.parse
|
|
9
11
|
|
|
10
12
|
API_BASE_URL = "http://10.11.152.208:8101/api/v1/skills/metadata"
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
def fetch_skills():
|
|
15
|
+
def fetch_skills(page=1, page_size=200):
|
|
14
16
|
"""
|
|
15
17
|
从API获取所有可用skills的列表。
|
|
16
18
|
|
|
19
|
+
参数:
|
|
20
|
+
page: 页码,默认 1
|
|
21
|
+
page_size: 每页数量,默认 200
|
|
22
|
+
|
|
17
23
|
返回:
|
|
18
24
|
list: 包含'name'和'description'字段的skill字典列表
|
|
19
25
|
None: 如果API调用失败
|
|
20
26
|
"""
|
|
21
|
-
|
|
27
|
+
params = urllib.parse.urlencode({
|
|
28
|
+
"page": page,
|
|
29
|
+
"pageSize": page_size,
|
|
30
|
+
})
|
|
31
|
+
url = f"{API_BASE_URL}?{params}"
|
|
22
32
|
|
|
23
33
|
try:
|
|
24
34
|
with urllib.request.urlopen(url, timeout=10) as response:
|
|
@@ -44,7 +54,25 @@ def fetch_skills():
|
|
|
44
54
|
|
|
45
55
|
def main():
|
|
46
56
|
"""获取所有可用skills并以JSON格式输出。"""
|
|
47
|
-
|
|
57
|
+
parser = argparse.ArgumentParser(
|
|
58
|
+
description="Fetch Comate platform skills"
|
|
59
|
+
)
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--page",
|
|
62
|
+
type=int,
|
|
63
|
+
default=1,
|
|
64
|
+
help="Page number (default: 1)"
|
|
65
|
+
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"--page-size",
|
|
68
|
+
type=int,
|
|
69
|
+
default=200,
|
|
70
|
+
help="Number of skills per page (default: 600)"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
args = parser.parse_args()
|
|
74
|
+
|
|
75
|
+
skills = fetch_skills(page=args.page, page_size=args.page_size)
|
|
48
76
|
|
|
49
77
|
if skills is None:
|
|
50
78
|
print("Failed to fetch skills from the platform.", file=sys.stderr)
|
|
@@ -53,5 +81,6 @@ def main():
|
|
|
53
81
|
# 输出JSON格式,方便Comate解析
|
|
54
82
|
print(json.dumps(skills, ensure_ascii=False, indent=2))
|
|
55
83
|
|
|
84
|
+
|
|
56
85
|
if __name__ == "__main__":
|
|
57
86
|
main()
|