Skip to content

WP4 Phase 2: Plugin Handler Updates for Hierarchical Skills#39

Merged
Steffen025 merged 1 commit intodevfrom
feature/wp4-phase2-plugins
Mar 5, 2026
Merged

WP4 Phase 2: Plugin Handler Updates for Hierarchical Skills#39
Steffen025 merged 1 commit intodevfrom
feature/wp4-phase2-plugins

Conversation

@Steffen025
Copy link
Owner

Summary

WP4 Phase 2: Update plugin handlers to support WP3's hierarchical skill structure.

Changes

Updated: plugins/handlers/skill-guard.ts

Problem: Skill guard used flat paths (skills/SkillName/) which broke after WP3 reorganization.

Solution: Added findSkillDir() function that searches both structures:

  1. Flat: skills/SkillName/ (backward compatibility)
  2. Hierarchical: skills/Category/SkillName/ (WP3)

Implementation:

function findSkillDir(skillName: string): string | null {
  // Try flat structure first
  const flatPath = path.join(skillsDir, skillName);
  if (fs.existsSync(flatPath)) return flatPath;
  
  // Search all categories
  for (const category of categories) {
    const nestedPath = path.join(skillsDir, category, skillName);
    if (fs.existsSync(nestedPath)) return nestedPath;
  }
  return null;
}

Functions Updated:

  • extractTriggers() - Now uses findSkillDir()
  • validateSkillInvocation() - Now uses findSkillDir()

Benefits

Backward Compatibility: Still finds skills in old flat structure
WP3 Support: Now finds skills in new hierarchical structure
Zero Breaking Changes: Existing skills continue to work
Better Error Messages: Indicates both structures were checked

Testing

// Test cases covered:
- Flat skill: skills/Research/  found 
- Hierarchical: skills/Security/Recon/  found 
- Missing skill: returns null with descriptive error

Files Changed

  • .opencode/plugins/handlers/skill-guard.ts (+40 lines, -5 lines)

Related

  • Part of WP4 Implementation Plan
  • Follows WP3 category reorganization
  • Enables proper skill validation with new structure

Next Steps

Phase 3 will add skill discovery validation scripts.

Updated skill-guard.ts to support WP3 hierarchical structure:

- Added findSkillDir() function that searches both:
  * Flat structure: skills/SkillName/ (backward compatibility)
  * Hierarchical: skills/Category/SkillName/ (WP3)

- Updated extractTriggers() to use findSkillDir()
- Updated validateSkillInvocation() to search recursively
- Improved error messages to indicate both structures checked

This ensures plugins work with the new category structure while
maintaining backward compatibility during transition.

Related: WP4 Phase 2 - Plugin System Updates
@Steffen025 Steffen025 merged commit 1d157d4 into dev Mar 5, 2026
1 check passed
@Steffen025 Steffen025 deleted the feature/wp4-phase2-plugins branch March 5, 2026 13:55
Steffen025 added a commit that referenced this pull request Mar 6, 2026
Der alte Plan war irreführend:
- Er durchnummerierte PRs neu (PR #1 = WP3, etc.)
- Ignorierte dass WP1-WP4 bereits vollständig erledigt sind
- Beschrieb WP5 falsch (Algorithm bereits in WP1 erledigt)

Korrigierte Darstellung:
- WP1 (Algorithm v3.7.0): PR #35, #36 ✅
- WP2 (Context Modernization): PR #34 ✅
- WP3 (Category Structure): PR #37 ✅
- WP4 (Integration & Validation): PR #38, #39, #40 ✅
- WP5 (Core PAI System): Noch offen - .opencode/PAI/ Verzeichnis
- WP6 (Installer & Migration): Noch offen - Final delivery

Ergebnis: Nur noch 2 PRs bis v3.0 statt 4!

Zeigt korrekt:
- Was fehlt (Core PAI Struktur, fehlende Tools, Installer)
- Dass .opencode/PAI/ neu erstellt werden muss
- Dass .opencode/skills/PAI/ reduziert wird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant