diff --git a/README.md b/README.md index 60ad723..274375e 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,6 @@ repository suffix; membership and order come from Brain’s board registry. Use the [local setup guide](docs/setup.md) to preview and create empty user-owned data, resume interrupted setup and validate a local board/feed. Publication and Scientist connection follow as explicit steps. + +Prepare a [standalone publication bundle](docs/publication.md) for an independent +Pages repository, then validate its real feed through Scientist before connecting. diff --git a/broca/__main__.py b/broca/__main__.py index dc1f93f..b81a1ec 100644 --- a/broca/__main__.py +++ b/broca/__main__.py @@ -19,6 +19,14 @@ def main(argv=None): setup.add_argument("--pages-url", required=True) setup.add_argument("--brain", type=Path, required=True) setup.add_argument("--apply", action="store_true") + publication = sub.add_parser("publication", help="prepare a static Pages bundle") + publication.add_argument("--repos", type=Path, required=True) + publication.add_argument("--repo", required=True) + publication.add_argument("--pages-url", required=True) + publication.add_argument("--brain", type=Path, required=True) + publication.add_argument("--output", type=Path, required=True) + publication.add_argument("--branch", default="main") + publication.add_argument("--apply", action="store_true") add = sub.add_parser("ingest") add.add_argument("record", type=Path) collect = sub.add_parser("refresh") @@ -41,6 +49,16 @@ def main(argv=None): print(("Created: " if args.apply else "Would create: ") + (", ".join(missing) or "nothing")) print("Local setup only; publication and Scientist connection remain separate.") return 0 + if args.command == "publication": + from .publication import prepare, apply + prepared = prepare(args.root, args.repos, args.repo, args.pages_url, + args.brain, args.output, args.branch) + if args.apply: + apply(prepared) + print(("Created: " if args.apply else "Would create: ") + str(prepared[0])) + print("\n".join(prepared[1])) + print("Review rendered content before publishing; no remote changes made.") + return 0 names = config(args.root)["assistants"] if args.command == "check": records = load_records(args.root, names) @@ -63,7 +81,7 @@ def main(argv=None): raise ValueError("HTML and state output paths must differ") from .state import build state = build(args.root, args.brain, args.repository, args.pages_url) - page = render(args.root, args.brain) + page = render(args.root, args.brain, repository=args.repository or "PyAutoLabs/PyAutoBroca") args.output.parent.mkdir(parents=True, exist_ok=True) args.output.write_text(page) if state is not None: diff --git a/broca/board.py b/broca/board.py index bc14c6f..216cd5e 100644 --- a/broca/board.py +++ b/broca/board.py @@ -41,7 +41,9 @@ def latest_benchmark(runs): key=lambda r: {"passed": 0, "unscored": 1, "failed": 2}[r["status"]], default=None) -def render(root, brain): +def render(root, brain, repository="PyAutoLabs/PyAutoBroca"): + if not isinstance(repository, str) or not re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", repository): + raise ValueError("invalid board repository identity") theme = theme_from(brain) cfg = config(root) board_base = cfg.get("board_base_url") @@ -119,7 +121,7 @@ def render(root, brain): {"href": "#history", "label": "Evaluations", "count": len(history)}, {"href": "#maintenance", "label": "Maintenance"}] panel = theme.orchestration_panel("broca-checkin", "Check in with Broca", "", prompt, - organ="broca", work_links=[{"label": "PyAutoBroca", "href": "https://github.com/PyAutoLabs/PyAutoBroca"}], + organ="broca", work_links=[{"label": repository.split("/")[-1], "href": "https://github.com/" + repository}], refreshed_at=snapshot.get("refreshed_at"), refresh_url=None) table = ('
| Assistant / benchmark | Date / model | Outcome / score | Evidence / comparison | Record |
|---|