@xingyu.wang/evoskills 3.0.1 → 3.1.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/evoskills +88 -64
- package/package.json +1 -1
package/evoskills
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
set -e
|
|
4
4
|
|
|
5
5
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
6
|
-
CLI_VERSION="3.0
|
|
6
|
+
CLI_VERSION="3.1.0"
|
|
7
7
|
|
|
8
8
|
# Project config file (in current directory)
|
|
9
9
|
PROJECT_CONFIG_FILE=".evoskills-config.json"
|
|
@@ -143,22 +143,45 @@ set_config_value() {
|
|
|
143
143
|
print_success "Config saved: $key = $value"
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
# Download file from GitHub with strict error handling
|
|
147
|
+
# Usage: github_download <skills_repo> <file_path> <output_file> <allow_stub>
|
|
148
|
+
# allow_stub: if 'true', fail fast on error; if 'false', skip on error
|
|
149
|
+
github_download() {
|
|
150
|
+
local skills_repo="$1"
|
|
151
|
+
local file_path="$2"
|
|
152
|
+
local output_file="$3"
|
|
153
|
+
local allow_stub="$4"
|
|
154
|
+
local raw_url
|
|
155
|
+
local temp_file
|
|
156
|
+
|
|
157
|
+
raw_url=$(github_raw_url "$skills_repo" "$file_path")
|
|
158
|
+
temp_file=$(mktemp)
|
|
159
|
+
|
|
160
|
+
if curl -sf "$raw_url" > "$temp_file" 2>/dev/null; then
|
|
161
|
+
mv "$temp_file" "$output_file"
|
|
162
|
+
print_success "Downloaded $file_path"
|
|
163
|
+
return 0
|
|
164
|
+
else
|
|
165
|
+
rm -f "$temp_file"
|
|
166
|
+
if [ "$allow_stub" = "true" ]; then
|
|
167
|
+
print_error "Failed to download $file_path from $skills_repo"
|
|
168
|
+
print_error "Cannot initialize project without critical files"
|
|
169
|
+
return 1
|
|
170
|
+
else
|
|
171
|
+
print_warn "Could not download $file_path; skipping update"
|
|
172
|
+
return 2
|
|
173
|
+
fi
|
|
174
|
+
fi
|
|
175
|
+
}
|
|
176
|
+
|
|
146
177
|
create_constitution_if_missing() {
|
|
147
178
|
if [ ! -f ".github/AI_CONSTITUTION.md" ]; then
|
|
148
179
|
local skills_repo
|
|
149
180
|
skills_repo=$(get_config_value "skillsRepo")
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
print_success "Downloaded .github/AI_CONSTITUTION.md"
|
|
155
|
-
else
|
|
156
|
-
cat > ".github/AI_CONSTITUTION.md" << 'EOF'
|
|
157
|
-
# AI Constitution
|
|
158
|
-
|
|
159
|
-
Please add your project constitution here or configure the skills repository URL.
|
|
160
|
-
EOF
|
|
161
|
-
print_warn "Could not download constitution; created minimal .github/AI_CONSTITUTION.md"
|
|
181
|
+
github_download "$skills_repo" ".github/AI_CONSTITUTION.md" ".github/AI_CONSTITUTION.md" "true"
|
|
182
|
+
if [ $? -ne 0 ]; then
|
|
183
|
+
print_error "AI_CONSTITUTION.md is required for initialization"
|
|
184
|
+
exit 1
|
|
162
185
|
fi
|
|
163
186
|
fi
|
|
164
187
|
}
|
|
@@ -167,19 +190,41 @@ create_initialization_if_missing() {
|
|
|
167
190
|
if [ ! -f ".github/AI_INITIALIZATION.md" ]; then
|
|
168
191
|
local skills_repo
|
|
169
192
|
skills_repo=$(get_config_value "skillsRepo")
|
|
170
|
-
|
|
171
|
-
|
|
193
|
+
github_download "$skills_repo" ".github/AI_INITIALIZATION.md" ".github/AI_INITIALIZATION.md" "true"
|
|
194
|
+
if [ $? -ne 0 ]; then
|
|
195
|
+
print_error "AI_INITIALIZATION.md is required for initialization"
|
|
196
|
+
exit 1
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
}
|
|
172
200
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
201
|
+
update_constitution() {
|
|
202
|
+
local skills_repo
|
|
203
|
+
skills_repo=$(get_config_value "skillsRepo")
|
|
204
|
+
local raw_url
|
|
205
|
+
raw_url=$(github_raw_url "$skills_repo" ".github/AI_CONSTITUTION.md")
|
|
206
|
+
|
|
207
|
+
if curl -sf "$raw_url" > ".github/AI_CONSTITUTION.md" 2>/dev/null; then
|
|
208
|
+
print_success "Updated .github/AI_CONSTITUTION.md"
|
|
209
|
+
return 0
|
|
210
|
+
else
|
|
211
|
+
print_warn "Could not update .github/AI_CONSTITUTION.md from remote"
|
|
212
|
+
return 1
|
|
213
|
+
fi
|
|
214
|
+
}
|
|
178
215
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
216
|
+
update_initialization() {
|
|
217
|
+
local skills_repo
|
|
218
|
+
skills_repo=$(get_config_value "skillsRepo")
|
|
219
|
+
local raw_url
|
|
220
|
+
raw_url=$(github_raw_url "$skills_repo" ".github/AI_INITIALIZATION.md")
|
|
221
|
+
|
|
222
|
+
if curl -sf "$raw_url" > ".github/AI_INITIALIZATION.md" 2>/dev/null; then
|
|
223
|
+
print_success "Updated .github/AI_INITIALIZATION.md"
|
|
224
|
+
return 0
|
|
225
|
+
else
|
|
226
|
+
print_warn "Could not update .github/AI_INITIALIZATION.md from remote"
|
|
227
|
+
return 1
|
|
183
228
|
fi
|
|
184
229
|
}
|
|
185
230
|
|
|
@@ -195,10 +240,10 @@ applyTo: "**"
|
|
|
195
240
|
Please read and follow the AI evolution principle:
|
|
196
241
|
- `.github/AI_CONSTITUTION.md` - Core evolution mechanism (always active, cannot be disabled)
|
|
197
242
|
|
|
198
|
-
##
|
|
243
|
+
## Mandatory Initialization Protocol
|
|
199
244
|
|
|
200
|
-
For
|
|
201
|
-
- `.github/
|
|
245
|
+
For enforced execution sequence:
|
|
246
|
+
- `.github/AI_INITIALIZATION.md` - 4-skill initialization protocol (mandatory before each response)
|
|
202
247
|
|
|
203
248
|
## Skills Registry
|
|
204
249
|
|
|
@@ -211,41 +256,19 @@ For available skills and how they work:
|
|
|
211
256
|
EOF
|
|
212
257
|
print_success "Created .github/copilot-instructions.md"
|
|
213
258
|
else
|
|
214
|
-
# Check if
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if grep -q "AI_CONSTITUTION.md" ".github/copilot-instructions.md"; then
|
|
220
|
-
has_constitution=true
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
if grep -q "EXECUTION_RULES.md" ".github/copilot-instructions.md"; then
|
|
224
|
-
has_execution=true
|
|
225
|
-
fi
|
|
226
|
-
|
|
227
|
-
if grep -q "AGENTS.md" ".github/copilot-instructions.md"; then
|
|
228
|
-
has_agents=true
|
|
229
|
-
fi
|
|
230
|
-
|
|
231
|
-
# Append missing references
|
|
232
|
-
if [ "$has_constitution" = false ] || [ "$has_execution" = false ] || [ "$has_agents" = false ]; then
|
|
259
|
+
# Check if copilot-instructions already has evoskills entries
|
|
260
|
+
if ! grep -q "AI_CONSTITUTION.md" ".github/copilot-instructions.md" && \
|
|
261
|
+
! grep -q "AI_INITIALIZATION.md" ".github/copilot-instructions.md" && \
|
|
262
|
+
! grep -q "AGENTS.md" ".github/copilot-instructions.md"; then
|
|
263
|
+
# Only add if none of the evoskills references exist
|
|
233
264
|
echo "" >> ".github/copilot-instructions.md"
|
|
234
|
-
echo "
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
echo "- See EXECUTION_RULES.md for optional safety guardrails" >> ".github/copilot-instructions.md"
|
|
242
|
-
fi
|
|
243
|
-
|
|
244
|
-
if [ "$has_agents" = false ]; then
|
|
245
|
-
echo "- Refer to AGENTS.md for skills registry" >> ".github/copilot-instructions.md"
|
|
246
|
-
fi
|
|
247
|
-
|
|
248
|
-
print_success "Updated .github/copilot-instructions.md with evoskills references"
|
|
265
|
+
echo "## Embedded AI Skills Framework" >> ".github/copilot-instructions.md"
|
|
266
|
+
echo "" >> ".github/copilot-instructions.md"
|
|
267
|
+
echo "This project uses evoskills for AI-assisted development:" >> ".github/copilot-instructions.md"
|
|
268
|
+
echo "- `.github/AI_CONSTITUTION.md` - Core evolution mechanism (always active)" >> ".github/copilot-instructions.md"
|
|
269
|
+
echo "- `.github/AI_INITIALIZATION.md` - Mandatory 4-skill initialization protocol" >> ".github/copilot-instructions.md"
|
|
270
|
+
echo "- `AGENTS.md` - Skill registry (core, required system, and optional skills)" >> ".github/copilot-instructions.md"
|
|
271
|
+
print_success "Updated .github/copilot-instructions.md with evoskills framework"
|
|
249
272
|
fi
|
|
250
273
|
fi
|
|
251
274
|
}
|
|
@@ -499,7 +522,7 @@ cmd_init() {
|
|
|
499
522
|
|
|
500
523
|
cat > "$PROJECT_CONFIG_FILE" << EOF
|
|
501
524
|
{
|
|
502
|
-
"version": "3.
|
|
525
|
+
"version": "3.1.0",
|
|
503
526
|
"installedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
|
504
527
|
"skillsDir": ".agent/skills",
|
|
505
528
|
"openskillsCompatible": true,
|
|
@@ -511,6 +534,7 @@ EOF
|
|
|
511
534
|
create_initialization_if_missing
|
|
512
535
|
create_copilot_instructions_if_missing
|
|
513
536
|
|
|
537
|
+
print_success "Core framework files downloaded and verified"
|
|
514
538
|
print_info "Installing core skills..."
|
|
515
539
|
for skill in "${CORE_SKILLS[@]}"; do
|
|
516
540
|
install_skill_github "$skill"
|
|
@@ -636,8 +660,8 @@ cmd_update() {
|
|
|
636
660
|
fi
|
|
637
661
|
|
|
638
662
|
ensure_layout
|
|
639
|
-
|
|
640
|
-
|
|
663
|
+
update_constitution
|
|
664
|
+
update_initialization
|
|
641
665
|
create_copilot_instructions_if_missing
|
|
642
666
|
|
|
643
667
|
if [ -n "$skill" ]; then
|