Agent Skills: Plugin Dependency Resolver

Generate plugin dependency resolution logic with topological sorting.

UncategorizedID: a5c-ai/babysitter/plugin-dependency-resolver

Install this agent skill to your local

pnpm dlx add-skill https://github.com/a5c-ai/babysitter/tree/HEAD/plugins/babysitter/skills/babysit/process/specializations/cli-mcp-development/skills/plugin-dependency-resolver

Skill Files

Browse the full folder contents for plugin-dependency-resolver.

Download Skill

Loading file tree…

plugins/babysitter/skills/babysit/process/specializations/cli-mcp-development/skills/plugin-dependency-resolver/SKILL.md

Skill Metadata

Name
plugin-dependency-resolver
Description
Generate plugin dependency resolution logic with topological sorting.

Plugin Dependency Resolver

Generate plugin dependency resolution logic.

Generated Patterns

interface PluginNode {
  name: string;
  dependencies: string[];
}

export function resolveDependencies(plugins: PluginNode[]): string[] {
  const graph = new Map<string, string[]>();
  const inDegree = new Map<string, number>();

  for (const plugin of plugins) {
    graph.set(plugin.name, plugin.dependencies);
    inDegree.set(plugin.name, 0);
  }

  for (const [, deps] of graph) {
    for (const dep of deps) {
      inDegree.set(dep, (inDegree.get(dep) || 0) + 1);
    }
  }

  const queue = [...inDegree.entries()].filter(([, d]) => d === 0).map(([n]) => n);
  const result: string[] = [];

  while (queue.length > 0) {
    const node = queue.shift()!;
    result.push(node);
    for (const dep of graph.get(node) || []) {
      inDegree.set(dep, inDegree.get(dep)! - 1);
      if (inDegree.get(dep) === 0) queue.push(dep);
    }
  }

  if (result.length !== plugins.length) {
    throw new Error('Circular dependency detected');
  }

  return result.reverse();
}

Target Processes

  • plugin-architecture-implementation