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_delivery_common.py
View on GitHub"""Portable local delivery helpers; no platform checkout or third-party imports."""
from __future__ import annotations
import hashlib
import json
import os
from pathlib import Path, PurePosixPath
import tempfile
MAX_FILES = 10000
MAX_BYTES = 512 * 1024 * 1024
MAX_FILE_BYTES = 64 * 1024 * 1024
SKIP_DIRECTORIES = {".git", ".hg", ".svn", ".codex", ".ssh", "__pycache__", ".pytest_cache", "node_modules"}
def sha256(data: bytes) -> str:
return "sha256:" + hashlib.sha256(data).hexdigest()
def encoded(value) -> bytes:
return json.dumps(value, sort_keys=True, separators=(",", ":"),
ensure_ascii=False, allow_nan=False).encode("utf-8")
def relative(value: str) -> str:
if (not isinstance(value, str) or not value or "\\" in value or ":" in value
or "\x00" in value or len(value) > 512):
raise ValueError("Use a relative POSIX file path.")
path = PurePosixPath(value)
if path.is_absolute() or any(p in {"", ".", ".."} for p in value.split("/")):
raise ValueError("A file path escapes or aliases its intake.")
return path.as_posix()
def no_links(path: Path):
for item in (path, *path.parents):
if item.is_symlink() or getattr(item, "is_junction", lambda: False)():
raise ValueError("Delivery paths must not contain links.")
def collect(root):
"""Collect selected context with the server's transport limits and path rules."""
root = Path(root).absolute()
no_links(root)
if not root.exists():
raise ValueError("The selected intake does not exist.")
paths = []
if root.is_dir():
for directory, dirs, names in os.walk(root, followlinks=False):
for name in dirs:
no_links(Path(directory) / name)
dirs[:] = sorted(d for d in dirs if d not in SKIP_DIRECTORIES)
paths.extend(Path(directory) / name for name in sorted(names))
else:
paths = [root]
files, total = {}, 0
for path in sorted(paths):
no_links(path)
if path.name in SKIP_DIRECTORIES:
continue
if not path.is_file():
continue
if (path.name.startswith(".env") or path.name in {"auth.json", "credentials.json"}
or path.suffix.lower() in {".pem", ".key", ".sqlite3"}):
raise ValueError("Choose credential-free source/runtime context for delivery.")
size = path.stat().st_size
total += size
if len(files) >= MAX_FILES or size > MAX_FILE_BYTES or total > MAX_BYTES:
raise ValueError("Intake exceeds the server transport bound.")
name = path.relative_to(root).as_posix() if root.is_dir() else path.name
files[relative(name)] = path.read_bytes()
if not files:
raise ValueError("Select at least one reusable intake file.")
return files
def transfer_digest(files):
return sha256(encoded([{"path": name, "bytes": len(data), "digest": sha256(data)}
for name, data in sorted(files.items())]))
def immutable(path: Path, data: bytes):
"""Publish atomically without replacement, including Windows drives without hardlinks."""
no_links(path)
path.parent.mkdir(parents=True, exist_ok=True)
with tempfile.NamedTemporaryFile(dir=path.parent, delete=False) as handle:
temporary = Path(handle.name)
handle.write(data)
handle.flush()
os.fsync(handle.fileno())
try:
try:
if os.name == "nt":
os.rename(temporary, path) # Windows rename refuses an existing destination.
else:
os.link(temporary, path)
except FileExistsError:
if path.read_bytes() != data:
raise ValueError("The existing export has different bytes; choose a new output path.")
finally:
temporary.unlink(missing_ok=True)
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 |