@xingyu.wang/evoskills 3.0.0 → 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.
Files changed (3) hide show
  1. package/README.md +8 -8
  2. package/evoskills +125 -65
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -49,17 +49,17 @@ This will:
49
49
  - ✅ Create `.agent/skills/` directory (skills installed from GitHub)
50
50
  - ✅ Generate `AGENTS.md` at project root (openskills-compatible skill registry)
51
51
  - ✅ Download `.github/AI_CONSTITUTION.md` (core evolution mechanism)
52
- - ✅ Download `.github/EXECUTION_RULES.md` (optional safety guardrails)
52
+ - ✅ Download `.github/AI_INITIALIZATION.md` (mandatory 4-skill initialization protocol)
53
53
  - ✅ Create `.github/copilot-instructions.md` (entry point for the system)
54
54
  - ✅ Save configuration to `.evoskills-config.json`
55
55
 
56
- **Three-layer architecture:**
57
- 1. **AI Constitution** - Evolution principles (always active, cannot be disabled)
58
- 2. **Execution Rules** - 4 optional safety guardrails (can be removed if not needed)
56
+ **Architecture:**
57
+ 1. **AI Constitution** - Core evolution principles (always active)
58
+ 2. **Initialization Protocol** - Mandatory 4-skill execution sequence with verifiable markers
59
59
  3. **Skills** - Reusable capabilities with 3 tiers:
60
- - Core (2): always installed
61
- - Required System (4): safety/runtime baseline
62
- - Optional (8): user-selectable workflow skills
60
+ - Core (2): evolution infrastructure
61
+ - Required System (4): safety/runtime baseline (enforced by initialization protocol)
62
+ - Optional (8): user-selectable workflow enhancements
63
63
 
64
64
  ## 📚 Usage
65
65
 
@@ -144,7 +144,7 @@ evoskills intelligently preserves your customizations during updates:
144
144
 
145
145
  ### copilot-instructions.md Protection
146
146
  - New file: Creates standard template with required references
147
- - Existing file: Checks for `AI_CONSTITUTION.md` and `AGENTS.md` references
147
+ - Existing file: Checks for `AI_CONSTITUTION.md`, `AI_INITIALIZATION.md`, and `AGENTS.md` references
148
148
  - Only appends missing references, never overwrites existing content
149
149
 
150
150
  **Example**: You can safely add your own skill groups to `AGENTS.md` - evoskills updates won't touch them.
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.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"
@@ -90,6 +90,15 @@ ensure_layout() {
90
90
  mkdir -p ".github"
91
91
  }
92
92
 
93
+ github_raw_url() {
94
+ local repo_url="$1"
95
+ local path="$2"
96
+ # Convert https://github.com/user/repo to https://raw.githubusercontent.com/user/repo/main/path
97
+ local raw_repo
98
+ raw_repo=$(echo "$repo_url" | sed 's|https://github.com/|https://raw.githubusercontent.com/|' | sed 's|\.git$||')
99
+ echo "$raw_repo/main/$path"
100
+ }
101
+
93
102
  get_config_value() {
94
103
  local key="$1"
95
104
 
@@ -134,37 +143,91 @@ set_config_value() {
134
143
  print_success "Config saved: $key = $value"
135
144
  }
136
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
+
137
177
  create_constitution_if_missing() {
138
178
  if [ ! -f ".github/AI_CONSTITUTION.md" ]; then
139
179
  local skills_repo
140
180
  skills_repo=$(get_config_value "skillsRepo")
141
-
142
- if curl -sf "$skills_repo/raw/main/.github/AI_CONSTITUTION.md" > ".github/AI_CONSTITUTION.md" 2>/dev/null; then
143
- print_success "Downloaded .github/AI_CONSTITUTION.md"
144
- else
145
- cat > ".github/AI_CONSTITUTION.md" << 'EOF'
146
- # AI Constitution
147
-
148
- Please add your project constitution here or configure the skills repository URL.
149
- EOF
150
- 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
151
185
  fi
152
186
  fi
153
187
  }
154
188
 
155
- create_execution_rules_if_missing() {
156
- if [ ! -f ".github/EXECUTION_RULES.md" ]; then
189
+ create_initialization_if_missing() {
190
+ if [ ! -f ".github/AI_INITIALIZATION.md" ]; then
157
191
  local skills_repo
158
192
  skills_repo=$(get_config_value "skillsRepo")
159
-
160
- if curl -sf "$skills_repo/raw/main/.github/EXECUTION_RULES.md" > ".github/EXECUTION_RULES.md" 2>/dev/null; then
161
- print_success "Downloaded .github/EXECUTION_RULES.md"
162
- else
163
- print_warn "Could not download execution rules (optional)"
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
164
197
  fi
165
198
  fi
166
199
  }
167
200
 
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
+ }
215
+
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
228
+ fi
229
+ }
230
+
168
231
  create_copilot_instructions_if_missing() {
169
232
  if [ ! -f ".github/copilot-instructions.md" ]; then
170
233
  cat > ".github/copilot-instructions.md" << 'EOF'
@@ -177,10 +240,10 @@ applyTo: "**"
177
240
  Please read and follow the AI evolution principle:
178
241
  - `.github/AI_CONSTITUTION.md` - Core evolution mechanism (always active, cannot be disabled)
179
242
 
180
- ## Optional Execution Rules
243
+ ## Mandatory Initialization Protocol
181
244
 
182
- For additional safety guardrails, see:
183
- - `.github/EXECUTION_RULES.md` - 4 optional rules (can be disabled if not needed for your use case)
245
+ For enforced execution sequence:
246
+ - `.github/AI_INITIALIZATION.md` - 4-skill initialization protocol (mandatory before each response)
184
247
 
185
248
  ## Skills Registry
186
249
 
@@ -193,41 +256,19 @@ For available skills and how they work:
193
256
  EOF
194
257
  print_success "Created .github/copilot-instructions.md"
195
258
  else
196
- # Check if file already contains required references
197
- local has_constitution=false
198
- local has_execution=false
199
- local has_agents=false
200
-
201
- if grep -q "AI_CONSTITUTION.md" ".github/copilot-instructions.md"; then
202
- has_constitution=true
203
- fi
204
-
205
- if grep -q "EXECUTION_RULES.md" ".github/copilot-instructions.md"; then
206
- has_execution=true
207
- fi
208
-
209
- if grep -q "AGENTS.md" ".github/copilot-instructions.md"; then
210
- has_agents=true
211
- fi
212
-
213
- # Append missing references
214
- 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
215
264
  echo "" >> ".github/copilot-instructions.md"
216
- echo "<!-- evoskills: auto-generated references -->" >> ".github/copilot-instructions.md"
217
-
218
- if [ "$has_constitution" = false ]; then
219
- echo "- Please read and follow AI_CONSTITUTION.md (core evolution mechanism)" >> ".github/copilot-instructions.md"
220
- fi
221
-
222
- if [ "$has_execution" = false ]; then
223
- echo "- See EXECUTION_RULES.md for optional safety guardrails" >> ".github/copilot-instructions.md"
224
- fi
225
-
226
- if [ "$has_agents" = false ]; then
227
- echo "- Refer to AGENTS.md for skills registry" >> ".github/copilot-instructions.md"
228
- fi
229
-
230
- 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"
231
272
  fi
232
273
  fi
233
274
  }
@@ -391,25 +432,35 @@ install_skill_github() {
391
432
  mkdir -p "$SKILLS_DIR/$skill"
392
433
 
393
434
  # Try to download SKILL.md and references from GitHub
394
- if curl -sf "$skills_repo/raw/main/.agent/skills/$skill/SKILL.md" > "$SKILLS_DIR/$skill/SKILL.md" 2>/dev/null; then
435
+ local raw_url
436
+ raw_url=$(github_raw_url "$skills_repo" ".agent/skills/$skill/SKILL.md")
437
+ if curl -sf "$raw_url" > "$SKILLS_DIR/$skill/SKILL.md" 2>/dev/null; then
395
438
  print_success "Installed skill: $skill"
396
439
 
397
440
  # Try to download references/ if present
398
- if curl -sf "$skills_repo/raw/main/.agent/skills/$skill/references/" &>/dev/null; then
441
+ local ref_url
442
+ ref_url=$(github_raw_url "$skills_repo" ".agent/skills/$skill/references/")
443
+ if curl -sf "$ref_url" &>/dev/null; then
399
444
  print_info "Downloading skill references..."
400
445
  mkdir -p "$SKILLS_DIR/$skill/references"
401
446
  # Download common reference files
402
447
  for ref_file in "*.md"; do
403
- curl -sf "$skills_repo/raw/main/.agent/skills/$skill/references/$ref_file" > "$SKILLS_DIR/$skill/references/$ref_file" 2>/dev/null || true
448
+ local ref_file_url
449
+ ref_file_url=$(github_raw_url "$skills_repo" ".agent/skills/$skill/references/$ref_file")
450
+ curl -sf "$ref_file_url" > "$SKILLS_DIR/$skill/references/$ref_file" 2>/dev/null || true
404
451
  done
405
452
  fi
406
453
 
407
454
  # Try to download scripts/ if present
408
- if curl -sf "$skills_repo/raw/main/.agent/skills/$skill/scripts/" &>/dev/null; then
455
+ local script_url
456
+ script_url=$(github_raw_url "$skills_repo" ".agent/skills/$skill/scripts/")
457
+ if curl -sf "$script_url" &>/dev/null; then
409
458
  print_info "Downloading skill scripts..."
410
459
  mkdir -p "$SKILLS_DIR/$skill/scripts"
411
460
  for script_file in "*.sh"; do
412
- curl -sf "$skills_repo/raw/main/.agent/skills/$skill/scripts/$script_file" > "$SKILLS_DIR/$skill/scripts/$script_file" 2>/dev/null || true
461
+ local script_file_url
462
+ script_file_url=$(github_raw_url "$skills_repo" ".agent/skills/$skill/scripts/$script_file")
463
+ curl -sf "$script_file_url" > "$SKILLS_DIR/$skill/scripts/$script_file" 2>/dev/null || true
413
464
  done
414
465
  fi
415
466
  else
@@ -461,20 +512,29 @@ cmd_init() {
461
512
 
462
513
  ensure_layout
463
514
 
515
+ # Initialize config with default repository if not already set
516
+ local skills_repo
517
+ if [ -z "$custom_repo" ]; then
518
+ skills_repo="$DEFAULT_SKILLS_REPO"
519
+ else
520
+ skills_repo="$custom_repo"
521
+ fi
522
+
464
523
  cat > "$PROJECT_CONFIG_FILE" << EOF
465
524
  {
466
- "version": "3.0.0",
525
+ "version": "3.1.0",
467
526
  "installedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
468
527
  "skillsDir": ".agent/skills",
469
528
  "openskillsCompatible": true,
470
- "skillsRepo": "$(get_config_value 'skillsRepo')"
529
+ "skillsRepo": "$skills_repo"
471
530
  }
472
531
  EOF
473
532
 
474
533
  create_constitution_if_missing
475
- create_execution_rules_if_missing
534
+ create_initialization_if_missing
476
535
  create_copilot_instructions_if_missing
477
536
 
537
+ print_success "Core framework files downloaded and verified"
478
538
  print_info "Installing core skills..."
479
539
  for skill in "${CORE_SKILLS[@]}"; do
480
540
  install_skill_github "$skill"
@@ -600,8 +660,8 @@ cmd_update() {
600
660
  fi
601
661
 
602
662
  ensure_layout
603
- create_constitution_if_missing
604
- create_execution_rules_if_missing
663
+ update_constitution
664
+ update_initialization
605
665
  create_copilot_instructions_if_missing
606
666
 
607
667
  if [ -n "$skill" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xingyu.wang/evoskills",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Evolution Skills CLI for installing and managing openskills-compatible AI skills.",
5
5
  "license": "MIT",
6
6
  "bin": {