Initial curated ITWorx_MCP_Hub source from 368fba691ea8d23403b4d56b53b5ec670d7c5020
This commit is contained in:
commit
cb5be898ea
663 files changed
+82674
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_ROOT_DIR = Path(__file__).resolve().parents[1]
|
||||
if str(_ROOT_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(_ROOT_DIR))
|
||||
|
||||
from scripts.packlib import PackError, load_plan, load_state, select_next_packet # noqa: E402
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Select the next ready ITWorx MCP Hub work packet."
|
||||
)
|
||||
parser.add_argument("--json", action="store_true", help="emit JSON")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
selection = select_next_packet(load_plan(), load_state())
|
||||
except PackError as exc:
|
||||
print(f"ERROR: {exc}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
if selection.packet is None:
|
||||
payload = {"packet": None, "reason": selection.reason}
|
||||
print(json.dumps(payload, indent=2) if args.json else selection.reason)
|
||||
return 0 if selection.reason == "all packets completed" else 3
|
||||
|
||||
packet = selection.packet
|
||||
payload = {
|
||||
"packet": packet["id"],
|
||||
"title": packet.get("title"),
|
||||
"effort": packet.get("effort"),
|
||||
"dependencies": packet.get("deps", []),
|
||||
"reason": selection.reason,
|
||||
"document": f"implementation/work-packets/{packet['id']}.md",
|
||||
}
|
||||
if args.json:
|
||||
print(json.dumps(payload, indent=2))
|
||||
else:
|
||||
print(
|
||||
f"{packet['id']} — {packet.get('title')} [{packet.get('effort')}] ({selection.reason})"
|
||||
)
|
||||
print(payload["document"])
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user