src — skills-registry

Module: src-skills-registry Cohesion: 0.80 Members: 0

src — skills-registry

The src/skills-registry module provides a robust, ClawHub-like system for discovering, installing, managing, and updating "skills" within the Code Buddy ecosystem. It acts as the central authority for skill lifecycle management, offering both interaction with an external registry (mocked for now) and local management of installed skills.

1. Overview

The Skills Registry is a core component responsible for handling all aspects of skill management. It allows developers to:

It's designed to be extensible, with a clear separation between the registry interaction (currently mocked) and local skill state management. The module uses an EventEmitter pattern to notify other parts of the application about significant skill lifecycle events.

2. Core Concepts and Data Structures

The module defines several key interfaces that represent the different facets of a skill:

3. The SkillsRegistry Class

The SkillsRegistry class is the central component of this module. It extends Node.js's EventEmitter, allowing it to publish events for skill lifecycle changes.

3.1. Initialization and Configuration

The SkillsRegistry constructor accepts a Partial to override default settings. It initializes internal state, including:

This section provides methods for finding skills available in the registry.

3.3. Skill Installation and Management

These methods handle the lifecycle of skills on the local system.

3.4. Installed Skill Lifecycle

Methods for querying and modifying the state of locally installed skills.

3.5. Update Checking

Functionality for monitoring and notifying about skill updates.

3.6. Configuration and Utilities

General utility methods for the registry.

4. Singleton Access

The module provides a singleton pattern for accessing the SkillsRegistry instance, ensuring that only one instance manages skills across the application.

graph TD
    subgraph Application
        A[Other Modules] --> B(getSkillsRegistry)
    end

    subgraph Skills Registry Module
        B --> C{skillsRegistryInstance is null?}
        C -- Yes --> D[new SkillsRegistry(config)]
        C -- No --> E[Return existing instance]
        D --> F[skillsRegistryInstance]
        E --> F
        F --> B
        G(resetSkillsRegistry) --> H[skillsRegistryInstance.shutdown()]
        H --> I[Set skillsRegistryInstance = null]
    end

5. Integration Points

The skills-registry module is designed to be a central service. Based on the provided call graph, its primary interactions are currently with its own test suite (registry.test.ts).

Current Interactions (from call graph):

Intended Interactions (how other modules would use it):

The EventEmitter pattern is crucial for loose coupling, allowing other parts of the application to react to skill changes without direct dependencies on the registry's internal state.