43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
|
|
"""glas-harness CLI — minimal gateway invocation (GLAS-WP-0001-T04)."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import argparse
|
||
|
|
import json
|
||
|
|
import sys
|
||
|
|
|
||
|
|
|
||
|
|
def main(argv: list[str] | None = None) -> int:
|
||
|
|
parser = argparse.ArgumentParser(prog="glas-harness")
|
||
|
|
sub = parser.add_subparsers(dest="command", required=True)
|
||
|
|
|
||
|
|
run = sub.add_parser("run", help="Run one task through a rein inside a sand-boxer sandbox")
|
||
|
|
run.add_argument("--sandbox-profile", required=True, help="e.g. profile.bwrap-local")
|
||
|
|
run.add_argument("--repo", required=True, help="Local repo path to mirror into the sandbox")
|
||
|
|
run.add_argument("--title", required=True)
|
||
|
|
run.add_argument("--description", required=True)
|
||
|
|
run.add_argument("--actor", default="agt")
|
||
|
|
run.add_argument("--project", default="glas-harness")
|
||
|
|
|
||
|
|
args = parser.parse_args(argv)
|
||
|
|
|
||
|
|
if args.command == "run":
|
||
|
|
from glas_harness.gateway import run_task_through_rein
|
||
|
|
|
||
|
|
result = run_task_through_rein(
|
||
|
|
sandbox_profile=args.sandbox_profile,
|
||
|
|
repo=args.repo,
|
||
|
|
title=args.title,
|
||
|
|
description=args.description,
|
||
|
|
actor=args.actor,
|
||
|
|
project=args.project,
|
||
|
|
)
|
||
|
|
print(json.dumps(result, indent=2))
|
||
|
|
return 0 if result["tool_ok"] else 1
|
||
|
|
|
||
|
|
return 1
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
sys.exit(main())
|