OpenParable
Skip to content
← Back to skills

Plugin Dependency Resolver

Development
plugin-dependency-resolver

Plugin Dependency Resolver is an Agent Skill for development published in the a5c-ai/babysitter repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Generate plugin dependency resolution logic with topological sorting.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/a5c-ai/babysitter/blob/HEAD/library/specializations/cli-mcp-development/skills/plugin-dependency-resolver/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/plugin-dependency-resolver, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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