2026-07-26 22:41:51 +02:00
|
|
|
"""glas-harness CLI — thin wrapper around CLIChannel (GLAS-WP-0003)."""
|
2026-07-26 13:02:59 +02:00
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
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")
|
2026-07-26 20:20:17 +02:00
|
|
|
run.add_argument("--no-hub", action="store_true", help="Skip the gateway's own hub reporting")
|
2026-07-26 13:02:59 +02:00
|
|
|
|
|
|
|
|
args = parser.parse_args(argv)
|
|
|
|
|
|
|
|
|
|
if args.command == "run":
|
2026-07-26 22:41:51 +02:00
|
|
|
from glas_harness.channels.cli_channel import CLIChannel
|
2026-07-26 13:02:59 +02:00
|
|
|
from glas_harness.gateway import run_task_through_rein
|
|
|
|
|
|
2026-07-26 22:41:51 +02:00
|
|
|
channel = CLIChannel()
|
|
|
|
|
invocation = channel.parse_invocation(args)
|
2026-07-26 13:02:59 +02:00
|
|
|
result = run_task_through_rein(
|
2026-07-26 22:41:51 +02:00
|
|
|
sandbox_profile=invocation.sandbox_profile,
|
|
|
|
|
repo=invocation.repo,
|
|
|
|
|
title=invocation.title,
|
|
|
|
|
description=invocation.description,
|
|
|
|
|
actor=invocation.actor,
|
|
|
|
|
project=invocation.project,
|
|
|
|
|
report_to_hub=invocation.report_to_hub,
|
2026-07-26 13:02:59 +02:00
|
|
|
)
|
2026-07-26 22:41:51 +02:00
|
|
|
print(channel.render_result(result))
|
2026-07-26 13:02:59 +02:00
|
|
|
return 0 if result["tool_ok"] else 1
|
|
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
sys.exit(main())
|