Skip to content

flurdy/agent-skills / skills/release-manager

release-manager

Verified

Attended release gatekeeper: consume shared readiness verdicts, offer confirmed single-service pushes (publish_commit in Pi), track CI failures and rollouts, and recommend watch cadence. Maintenance and restarts are separately owned.

FileKindSize
SKILL.mdskill md16.8 KB
scripts/pact-graphexecutablescript5.9 KB
scripts/release-ciexecutablescript27.5 KB
scripts/release-orderexecutablescript10.0 KB
scripts/release-stateexecutablescript13.1 KB
tests/test-skill-contract.shexecutablescript3.4 KB
tests/test_release_ci.pyscript20.6 KB
tests/test_release_order.pyscript6.0 KB
tests/test_release_state.pyscript14.3 KB

scripts/release-order

View on GitHub
#!/usr/bin/env python3
"""Resolve the effective deploy-order map without requiring a specific source.

Providers are selected from project evidence:
- pact: live pact edges or a pact-generated manifest block;
- manifest: order.manual entries without a pact provider;
- none: no manifest and no pact edges.

The effective graph is (accepted provider edges union order.manual) minus
order.suppress. A pact-generated manifest block remains the accepted graph until
explicit reconciliation, preserving current gates while drift is reviewed. The
manifest parser intentionally supports only the small flow-list map used by
release-manifest.yaml; unsupported non-empty inline maps fail rather than being
silently ignored.
"""
import os
import re
import subprocess
import sys


SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
PACT_GRAPH = os.path.join(SCRIPT_DIR, "pact-graph")
GENERATED_START = "# >>> GENERATED by scripts/pact-graph"
GENERATED_END = "# <<< END GENERATED"
NAME = r"[A-Za-z0-9._-]+"
EDGE_LINE = re.compile(rf"^({NAME}):\s*\[([^]]*)\]\s*$")


class OrderConfigError(ValueError):
    pass


def find_project_root():
    configured = os.environ.get("RELEASE_PROJECT_ROOT")
    if configured:
        return os.path.abspath(configured)

    current = os.path.abspath(os.getcwd())
    ancestors = []
    while True:
        ancestors.append(current)
        parent = os.path.dirname(current)
        if parent == current:
            break
        current = parent

    for marker in (
        ".mgit.conf",
        os.path.join("docs", "release-manifest.yaml"),
        ".git",
    ):
        for directory in ancestors:
            if os.path.exists(os.path.join(directory, marker)):
                return directory
    return os.path.abspath(os.getcwd())


def strip_comment(line):
    return line.split("#", 1)[0].rstrip()


def section_lines(text, section):
    order_indent = None
    section_indent = None
    inline_value = None
    body = []

    for raw in text.splitlines():
        clean = strip_comment(raw)
        if not clean.strip():
            continue
        indent = len(clean) - len(clean.lstrip(" "))
        stripped = clean.strip()

        if order_indent is None:
            if indent == 0 and re.fullmatch(r"order:\s*", stripped):
                order_indent = indent
            continue

        if indent <= order_indent:
            break

        if section_indent is None:
            if indent != order_indent + 2:
                continue
            match = re.fullmatch(rf"({NAME}):\s*(.*)", stripped)
            if match and match.group(1) == section:
                section_indent = indent
                inline_value = match.group(2).strip()
            continue

        if indent <= section_indent:
            break
        body.append(stripped)

    return inline_value, body


def parse_names(value, context):
    value = value.strip()
    if not value.startswith("[") or not value.endswith("]"):
        raise OrderConfigError(f"{context} must use [provider, ...] flow-list syntax")
    names = []
    for item in value[1:-1].split(","):
        item = item.strip()
        if not item:
            continue
        if not re.fullmatch(NAME, item):
            raise OrderConfigError(f"invalid service name {item!r} in {context}")
        names.append(item)
    return names


def has_generated_block(text):
    in_order = False
    derived_indent = None
    found_start = False
    found_end = False

    for raw in text.splitlines():
        stripped = raw.strip()
        indent = len(raw) - len(raw.lstrip(" "))
        if not in_order:
            if indent == 0 and stripped == "order:":
                in_order = True
            continue
        if stripped and not stripped.startswith("#") and indent == 0:
            break
        if derived_indent is None:
            if indent == 2 and stripped.startswith("derived:"):
                derived_indent = indent
            continue
        if stripped and not stripped.startswith("#") and indent <= derived_indent:
            break
        found_start = found_start or stripped.startswith(GENERATED_START)
        found_end = found_end or stripped.startswith(GENERATED_END)

    return found_start and found_end


def parse_edge_section(text, section):
    inline, body = section_lines(text, section)
    if inline is None:
        return set()
    if inline and inline not in ("{}", "[]"):
        raise OrderConfigError(
            f"order.{section}: use a block map; non-empty inline maps are unsupported"
        )

    edges = set()
    for line in body:
        match = EDGE_LINE.fullmatch(line)
        if not match:
            raise OrderConfigError(
                f"order.{section}: unsupported line {line!r}; use 'consumer: [provider, ...]'"
            )
        consumer = match.group(1)
        providers = parse_names(f"[{match.group(2)}]", f"order.{section}.{consumer}")
        edges.update((consumer, provider) for provider in providers)
    return edges


def parse_graph(output):
    lines = output.splitlines()
    try:
        start = lines.index("---GRAPH---") + 1
        end = lines.index("---DRIFT---", start)
    except ValueError as error:
        raise RuntimeError("pact provider returned an invalid contract") from error

    edges = set()
    for line in lines[start:end]:
        match = EDGE_LINE.fullmatch(line.strip())
        if not match:
            raise RuntimeError(f"pact provider returned invalid graph line {line!r}")
        consumer = match.group(1)
        providers = parse_names(f"[{match.group(2)}]", f"pact graph {consumer}")
        edges.update((consumer, provider) for provider in providers)
    return edges


def parse_drift(output):
    lines = output.splitlines()
    try:
        start = lines.index("---DRIFT---") + 1
    except ValueError as error:
        raise RuntimeError("pact provider returned no drift section") from error

    drift = []
    for line in lines[start:]:
        if line.startswith("---") or line.startswith("#"):
            break
        if line.strip():
            drift.append(line.strip())
    if not drift:
        raise RuntimeError("pact provider returned an empty drift section")
    return drift


def run_pact_provider(root, write=False):
    env = os.environ.copy()
    env["RELEASE_PROJECT_ROOT"] = root
    command = [PACT_GRAPH]
    if write:
        command.append("--write")
    return subprocess.run(
        command,
        cwd=root,
        env=env,
        text=True,
        capture_output=True,
        check=False,
    )


def graph_by_consumer(edges):
    graph = {}
    for consumer, provider in edges:
        graph.setdefault(consumer, set()).add(provider)
    return graph


def render_graph(edges):
    for consumer, providers in sorted(graph_by_consumer(edges).items()):
        print(f"{consumer}: [{','.join(sorted(providers))}]")


def main():
    args = sys.argv[1:]
    if any(arg not in ("--write", "--help") for arg in args):
        sys.stderr.write("usage: release-order [--write]\n")
        return 2
    if "--help" in args:
        print("usage: release-order [--write]")
        return 0

    root = find_project_root()
    manifest_path = os.path.join(root, "docs", "release-manifest.yaml")
    manifest_present = os.path.isfile(manifest_path)
    manifest_text = ""
    if manifest_present:
        with open(manifest_path, encoding="utf-8") as manifest_file:
            manifest_text = manifest_file.read()

    try:
        derived = parse_edge_section(manifest_text, "derived")
        manual = parse_edge_section(manifest_text, "manual")
        suppress = parse_edge_section(manifest_text, "suppress")
    except OrderConfigError as error:
        sys.stderr.write(f"release-order: {error}\n")
        return 2

    provider_result = run_pact_provider(root)
    if provider_result.returncode != 0:
        sys.stderr.write(provider_result.stderr or "release-order: pact provider failed\n")
        return 1

    try:
        pact_edges = parse_graph(provider_result.stdout)
        pact_drift = parse_drift(provider_result.stdout)
    except (OrderConfigError, RuntimeError) as error:
        sys.stderr.write(f"release-order: {error}\n")
        return 1

    generated_block_present = has_generated_block(manifest_text)
    if pact_edges or generated_block_present:
        provider = "pact"
        if generated_block_present:
            graph_source = "generated"
            provider_edges = derived
        else:
            graph_source = "live"
            provider_edges = pact_edges
    elif manifest_present:
        provider = "manifest"
        graph_source = "manual"
        provider_edges = set()
    else:
        provider = "none"
        graph_source = "none"
        provider_edges = set()

    if "--write" in args:
        if provider != "pact":
            sys.stderr.write("release-order: pact provider is not active; nothing to reconcile\n")
            return 1
        if not manifest_present:
            sys.stderr.write(
                "release-order: cannot reconcile without docs/release-manifest.yaml\n"
            )
            return 1
        write_result = run_pact_provider(root, write=True)
        sys.stdout.write(write_result.stdout)
        sys.stderr.write(write_result.stderr)
        return write_result.returncode

    effective = (provider_edges | manual) - suppress

    print("---SOURCE---")
    print(f"provider={provider}")
    print(f"graph={graph_source}")
    print(f"manifest={'present' if manifest_present else 'absent'}")
    print("---GRAPH---")
    render_graph(effective)
    print("---DRIFT---")
    if provider == "pact" and not manifest_present:
        print("status: unmanaged (no release manifest)")
    elif provider == "pact" and pact_drift == ["status: no-generated-block"]:
        print("status: unmanaged (manifest has no pact-generated block)")
    elif provider == "pact":
        for line in pact_drift:
            print(line)
    elif provider == "manifest":
        print("status: not-applicable (manifest-declared)")
    else:
        print("status: not-applicable (no ordering configured)")
    return 0


if __name__ == "__main__":
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall