Skip to content

aiskillstore/marketplace / skills/89jobrien/dependency-management

dependency-management

Verified

Dependency management specialist. Use when updating dependencies, scanning for vulnerabilities, analyzing dependency trees, or ensuring license compliance. Handles npm, pip, maven, and other package managers.

FileKindSize
SKILL.mdskill md4.2 KB
references/dependency-audit.template.mdmarkdown3.4 KB
references/package-managers.mdmarkdown4.1 KB
scripts/parse-dependencies.pyexecutablescript4.3 KB
skill-report.jsonconfig29.2 KB

scripts/parse-dependencies.py

View on GitHub
#!/usr/bin/env python3
"""Dependency parser for dependency-management skill.
Parses package.json, requirements.txt, pyproject.toml, etc.
"""

import json
import re
import sys
from pathlib import Path


def parse_package_json(file_path: Path) -> dict:
    """Parse package.json file."""
    try:
        data = json.loads(file_path.read_text())
        dependencies = {}

        # Combine all dependency types
        for dep_type in [
            "dependencies",
            "devDependencies",
            "peerDependencies",
            "optionalDependencies",
        ]:
            if dep_type in data:
                dependencies.update(data[dep_type])

        return {
            "file": str(file_path),
            "type": "npm",
            "dependencies": dependencies,
            "package_name": data.get("name", "unknown"),
            "version": data.get("version", "unknown"),
        }
    except json.JSONDecodeError as e:
        return {
            "file": str(file_path),
            "error": f"JSON parse error: {e}",
        }
    except Exception as e:
        return {
            "file": str(file_path),
            "error": f"Error: {e}",
        }


def parse_requirements_txt(file_path: Path) -> dict:
    """Parse requirements.txt file."""
    try:
        content = file_path.read_text()
        dependencies = {}

        for line in content.split("\n"):
            line = line.strip()
            if not line or line.startswith("#"):
                continue

            # Parse package==version or package>=version, etc.
            match = re.match(r"^([a-zA-Z0-9_-]+)([<>=!]+)?(.+)?$", line.split("#")[0].strip())
            if match:
                package = match.group(1)
                version = match.group(3) if match.group(3) else None
                dependencies[package] = version or "unknown"

        return {
            "file": str(file_path),
            "type": "pip",
            "dependencies": dependencies,
        }
    except Exception as e:
        return {
            "file": str(file_path),
            "error": f"Error: {e}",
        }


def parse_pyproject_toml(file_path: Path) -> dict:
    """Parse pyproject.toml file (basic parsing)."""
    try:
        content = file_path.read_text()
        dependencies = {}

        # Simple regex-based parsing for dependencies
        # This is basic - for full parsing, use tomli or tomllib
        in_dependencies = False
        for line in content.split("\n"):
            line = line.strip()
            if "dependencies" in line and "=" in line:
                in_dependencies = True
                continue
            if in_dependencies:
                if line.startswith("["):
                    break
                if line and not line.startswith("#"):
                    # Parse dependency line
                    match = re.match(r'^"([^"]+)"', line)
                    if match:
                        dep = match.group(1)
                        package = dep.split(">=")[0].split("==")[0].split("~=")[0]
                        dependencies[package] = dep

        return {
            "file": str(file_path),
            "type": "pyproject",
            "dependencies": dependencies,
        }
    except Exception as e:
        return {
            "file": str(file_path),
            "error": f"Error: {e}",
        }


def detect_and_parse(file_path: Path) -> dict:
    """Detect file type and parse accordingly."""
    file_name = file_path.name.lower()

    if file_name == "package.json":
        return parse_package_json(file_path)
    if file_name == "requirements.txt":
        return parse_requirements_txt(file_path)
    if file_name == "pyproject.toml":
        return parse_pyproject_toml(file_path)
    return {
        "file": str(file_path),
        "error": f"Unknown file type: {file_name}",
    }


def main():
    """Main entry point."""
    if len(sys.argv) < 2:
        print("Usage: parse_dependencies.py <dependency_file> [<dependency_file>...]")
        sys.exit(1)

    results = []
    for file_path_str in sys.argv[1:]:
        file_path = Path(file_path_str)
        if not file_path.exists():
            print(f"Warning: File not found: {file_path}", file=sys.stderr)
            continue

        result = detect_and_parse(file_path)
        results.append(result)

    print(json.dumps(results, indent=2))


if __name__ == "__main__":
    main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall