feat(cli): add box work command for unified worker signals and task orchestration

This commit is contained in:
operator
2026-10-09 18:57:16 -04:00
parent ef2a4c419a
commit 35c59bfcb2
3 changed files with 585 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
import os
import sys
import unittest
import tempfile
import json
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO_ROOT / "bin"))
import box_work
class TestBoxWork(unittest.TestCase):
def test_workers_topology(self):
worker_names = [w["name"] for w in box_work.WORKERS]
self.assertIn("opm", worker_names)
self.assertIn("646", worker_names)
self.assertIn("dev", worker_names)
self.assertIn("pip", worker_names)
self.assertIn("def", worker_names)
self.assertIn("muse", worker_names)
self.assertIn("muse-main", worker_names)
def test_gitea_config_resolution(self):
api_base, token = box_work.get_gitea_config()
self.assertTrue(api_base.startswith("http"))
self.assertTrue(len(token) > 10)
def test_color_helpers(self):
self.assertTrue(len(box_work.c_bold("test")) >= 4)
self.assertTrue(len(box_work.c_green("test")) >= 4)
self.assertTrue(len(box_work.c_red("test")) >= 4)
def test_find_repo_root(self):
root = box_work.find_repo_root()
self.assertTrue(root.exists())
def test_claimed_tasks_empty_or_dict(self):
res = box_work.get_claimed_tasks()
self.assertIsInstance(res, dict)
def test_recent_done_tasks_list(self):
res = box_work.get_recent_done_tasks(limit=5)
self.assertIsInstance(res, list)
if __name__ == "__main__":
unittest.main()