INNER CODE UNIT · Python
save_json
softaworks/agent-toolkit · scripts/build_plugins.py:35
def save_json(path: Path, data: dict) -> None:
"""Save a JSON file with proper formatting."""
with open(path, "w") as f:
json.dump(data, f, indent=2)
f.write("\n")
def extract_paths(plugin: dict) -> list[tuple[str, str]]:
"""Extract (source_path, type) pairs from a plugin entry.
Returns list of (relative_path, component_type) where component_type
is 'skill_dir', 'agent_file', or 'command_file'.
"""
paths = []
for skill_path in plugin.get("skills", []):
# "./skills/mermaid-diagrams" -> "skills/mermaid-diagrams"
clean = skill_path.lstrip("./")