dse120071750/m8m-harness-builder / skills/m8m/m8m-harness-builder
m8m-harness-builder
FlaggedBuild and edit M8M harnesses that coordinate existing tools and FlowSteps, validate milestone outputs, and track progress and resume. Reuse working implementations in place. Compile workflow changes without runtime packaging; build portable packages when requested and deliver server installations through the dedicated M8M server installer.
scripts/m8m_deploy.py
View on GitHub"""Local submission/status/continuation client for the durable server installer."""
import argparse
from io import BytesIO
import json
from pathlib import Path
import shlex
import subprocess
import sys
import uuid
import zipfile
sys.path.insert(0, str(Path(__file__).resolve().parent))
from m8m_delivery_common import collect, encoded, no_links, transfer_digest
def remote(target, *args, payload=None):
argv = target["remote_entrypoint"] + list(args)
if not isinstance(argv, list) or any(not isinstance(x, str) or "\x00" in x for x in argv):
raise ValueError("Invalid configured server installer entry point.")
result = subprocess.run(["ssh", "-o", "BatchMode=yes", "-o", "StrictHostKeyChecking=yes", target["ssh_alias"], shlex.join(argv)],
input=payload, capture_output=True, timeout=300 if payload else 60)
if result.returncode:
raise RuntimeError("Server installer entry failed: " + result.stderr[-4000:].decode(errors="replace"))
return json.loads(result.stdout)
def main(argv=None):
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8")
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter,
epilog='Configured target JSON (values come from the approved server configuration):\n'
'{"schema":"m8m.installer_target.v1","ssh_alias":"<approved alias>",\n'
' "tenant_id":"<canonical tenant>","environment":"<configured environment>",\n'
' "installation_owner":"<approved owner>",\n'
' "remote_entrypoint":["<trusted preconfigured tenant installer launcher>"]}\n'
'The launcher supplies the tenant OS identity, environment and server settings.\n'
'Target labels do not establish installation authority.')
parser.add_argument("--target", type=Path, required=True, help="Local server alias/environment/tenant/entry-point configuration")
commands = parser.add_subparsers(dest="command", required=True)
submit = commands.add_parser("submit")
submit.add_argument("--intake", type=Path, required=True)
submit.add_argument("--brief", type=Path, required=True)
submit.add_argument("--owner", help="Override the configured installation owner")
submit.add_argument("--operation-id", required=True)
submit.add_argument("--model", default="gpt-6-sol")
submit.add_argument("--reasoning-effort", default="xhigh")
status = commands.add_parser("status")
status.add_argument("--operation-id", required=True)
followup = commands.add_parser("continue")
followup.add_argument("--operation-id", required=True)
followup.add_argument("--message-id", required=True)
followup.add_argument("--text", type=Path, required=True)
args = parser.parse_args(argv)
target = json.loads(args.target.read_bytes())
if (not isinstance(target, dict) or not {"schema", "ssh_alias", "tenant_id", "environment", "remote_entrypoint"} <= set(target)
or set(target) - {"schema", "ssh_alias", "tenant_id", "environment", "remote_entrypoint", "incoming_root", "installation_owner"}
or target["schema"] != "m8m.installer_target.v1"):
raise ValueError("Select an explicit configured server, environment and canonical tenant.")
if (any(not isinstance(target[key], str) or not target[key] or "\x00" in target[key]
for key in ("ssh_alias", "tenant_id", "environment"))
or target["ssh_alias"].startswith("-")
or not isinstance(target["remote_entrypoint"], list) or not target["remote_entrypoint"]
or any(not isinstance(value, str) or not value or "\x00" in value for value in target["remote_entrypoint"])):
raise ValueError("The configured target must contain an SSH alias and an argument-list entry point.")
# The server resolves this target against its private policy. Client target
# labels never establish tenant/application authority.
if args.command == "status":
result = remote(target, "status", "--operation-id", args.operation_id)
elif args.command == "submit":
uuid.UUID(args.operation_id)
files = collect(args.intake)
no_links(args.brief.absolute())
owner = args.owner or target.get("installation_owner")
if not isinstance(owner, str) or not owner:
raise ValueError("Provide --owner or configure installation_owner in the target.")
header = {"owner": owner, "client_operation_id": args.operation_id,
"brief": args.brief.read_text(encoding="utf-8"), "transfer_digest": transfer_digest(files),
"model": args.model, "reasoning_effort": args.reasoning_effort}
archive = BytesIO()
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as transport:
for name, data in files.items():
transport.writestr(name, data)
# SSH stdin carries the transfer directly to the authenticated server
# entry point. It writes private staging as the installer identity.
result = remote(target, "submit-stdin", payload=encoded(header) + b"\n" + archive.getvalue())
else:
uuid.UUID(args.message_id)
no_links(args.text.absolute())
result = remote(target, "continue-stdin", payload=encoded({"operation_id": args.operation_id,
"client_message_id": args.message_id, "text": args.text.read_text(encoding="utf-8")}))
if result["tenant_id"] != target["tenant_id"]:
raise RuntimeError("The server installer receipt does not match the selected canonical tenant.")
print(encoded(result).decode())
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies. | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |
| meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要". | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |