Files
dodoxandClaude Sonnet 5 4c186ac677 Add the puga command and plan pull; document the UI plan workflow
- pyproject.toml + puga/cli.py: `pip install -e .` installs a `puga <tool>` command, so no
  venv path is needed (replaces requirements.txt)
- tools/plan_push.py: `pull <uuid>` reads a plan (incl. UI edits) back into a YAML spec;
  recipe entries may carry an amount so switched-off recipes round trip; fixes a variable
  that overwrote the plan name in build_payload, with a regression test
- README: usage with the puga command, and a section on working on the same plans in the
  PRUNplanner UI and from Claude (write, edit in UI, read back)
- CLAUDE.md updated accordingly

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 00:37:20 +02:00

30 lines
939 B
Python

"""`puga <tool> [args]`: run a tool from tools/ (installed as the `puga` command by pip install -e .)."""
import runpy, sys
from . import ROOT
ALIASES = {"plan": "plan_push"}
def _tools():
return sorted(p.stem for p in (ROOT / "tools").glob("*.py"))
def main():
args = sys.argv[1:]
if not args or args[0] in ("-h", "--help", "help"):
print("usage: puga <tool> [args]\n\ntools:")
for t in _tools():
print(" " + ("plan (plan_push)" if t == "plan_push" else t))
print(" test (run the test suite)")
return
tool, rest = args[0], args[1:]
if tool == "test":
import pytest
sys.exit(pytest.main(["-q", *rest]))
tool = ALIASES.get(tool, tool)
path = ROOT / "tools" / f"{tool}.py"
if not path.exists():
sys.exit(f"unknown tool '{tool}' (try: puga help)")
sys.argv = [str(path), *rest]
runpy.run_path(str(path), run_name="__main__")