Removes tools from grouping.

This commit is contained in:
2026-02-22 21:31:21 -08:00
parent d43c49d219
commit a5e9835d55
77 changed files with 260 additions and 2497 deletions

View File

@@ -3,7 +3,6 @@
from __future__ import annotations
import argparse
from pathlib import Path
from castle_cli.config import load_config
@@ -28,7 +27,7 @@ def run_tool(args: argparse.Namespace) -> int:
def _tool_list() -> int:
"""List tools grouped by category."""
"""List all registered tools."""
config = load_config()
tools = {k: v for k, v in config.components.items() if v.tool}
@@ -36,24 +35,14 @@ def _tool_list() -> int:
print("No tools registered.")
return 0
by_group: dict[str, list[tuple[str, object]]] = {}
for name, manifest in tools.items():
if manifest.tool and manifest.tool.source:
group = Path(manifest.tool.source).name
else:
group = "standalone"
by_group.setdefault(group, []).append((name, manifest))
for group in sorted(by_group):
items = by_group[group]
print(f"\n{BOLD}{CYAN}{group}{RESET}")
print(f"{CYAN}{'' * 40}{RESET}")
for name, manifest in sorted(items):
desc = manifest.description or ""
deps = ""
if manifest.tool.system_dependencies:
deps = f" {DIM}[{', '.join(manifest.tool.system_dependencies)}]{RESET}"
print(f" {BOLD}{name:<20}{RESET} {desc}{deps}")
print(f"\n{BOLD}{CYAN}Tools{RESET}")
print(f"{CYAN}{'' * 40}{RESET}")
for name, manifest in sorted(tools.items()):
desc = manifest.description or ""
deps = ""
if manifest.tool and manifest.tool.system_dependencies:
deps = f" {DIM}[{', '.join(manifest.tool.system_dependencies)}]{RESET}"
print(f" {BOLD}{name:<20}{RESET} {desc}{deps}")
print()
return 0
@@ -83,39 +72,5 @@ def _tool_info(name: str) -> int:
if t.system_dependencies:
print(f" {BOLD}requires{RESET}: {', '.join(t.system_dependencies)}")
# Read and display .md documentation if available
if t.source:
md_path = _find_md_for_tool(config.root, t.source, name)
if md_path and md_path.exists():
content = md_path.read_text()
# Strip YAML frontmatter
if content.startswith("---\n"):
end = content.find("\n---\n", 4)
if end != -1:
content = content[end + 5:]
content = content.strip()
if content:
print(f"\n{BOLD}{CYAN}Documentation{RESET}")
print(f"{CYAN}{'' * 40}{RESET}")
print(f"{DIM}{content}{RESET}")
print()
return 0
def _find_md_for_tool(
root: Path, source: str, tool_name: str,
) -> Path | None:
"""Find the .md documentation file for a tool source path."""
source_path = root / source
if source_path.is_file():
md = source_path.with_suffix(".md")
if md.exists():
return md
elif source_path.is_dir():
py_name = tool_name.replace("-", "_")
pkg_name = source_path.name
md = source_path / "src" / pkg_name / f"{py_name}.md"
if md.exists():
return md
return None