Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/community/contributing-clanker/skills/contribute-prepare

contribute-prepare

Verified

Prepare an OSS contribution locally after a read-only contribution audit. Creates explicitly scoped candidate records, repository dossiers, worktrees, test evidence, and gate results, but never publishes to GitHub. Use when the user has selected an issue and asks to set up, research, implement, test, or draft the contribution. Trigger with "/contribute-prepare" or "prepare this contribution locally".

FileKindSize
SKILL.mdskill md5.1 KB
agents/draft-writer.mdmarkdown2.0 KB
agents/repo-analyzer.mdmarkdown3.1 KB
agents/researcher.mdmarkdown10.5 KB
agents/scout.mdmarkdown7.5 KB
agents/test-runner.mdmarkdown3.5 KB
assets/claim-template.mdmarkdown714 B
assets/evidence-template.mdmarkdown532 B
assets/pr-template.mdmarkdown890 B
references/candidate-file-format.mdmarkdown9.3 KB
references/workflow-guide.mdmarkdown3.9 KB
scripts/audit-overrides.shexecutablescript7.3 KB
scripts/catalog-coverage.shexecutablescript4.0 KB
scripts/check.shexecutablescript1.1 KB
scripts/gate-runner.shexecutablescript8.9 KB
scripts/gates/a01-already-assigned.shexecutablescript1.1 KB
scripts/gates/a02-already-shipped.shexecutablescript1.3 KB
scripts/gates/a03-duplicate-flagged.shexecutablescript851 B
scripts/gates/a04-issue-age.shexecutablescript3.8 KB
scripts/gates/a05-issue-still-open.shexecutablescript1.6 KB
scripts/gates/a06-claim-etiquette-required.shexecutablescript1.6 KB
scripts/gates/a09-mention-routing.shexecutablescript2.1 KB
scripts/gates/b01-base-branch.shexecutablescript969 B
scripts/gates/b02-branch-naming.shexecutablescript1.0 KB
scripts/gates/b03-clone-fresh.shexecutablescript1.0 KB
scripts/gates/b05-dco-signoff.shexecutablescript1.5 KB
scripts/gates/b06-commit-format.shexecutablescript1.4 KB
scripts/gates/b07-scope-files.shexecutablescript2.1 KB
scripts/gates/b12-new-deps.shexecutablescript1.7 KB
scripts/gates/b14-local-checks.shexecutablescript1.7 KB
scripts/gates/b16-local-check-allowlist.shexecutablescript1.8 KB
scripts/gates/c01-draft-first.shexecutablescript902 B
scripts/gates/c02-pr-title-format.shexecutablescript1.2 KB
scripts/gates/c03-pr-body-sections.shexecutablescript2.0 KB
scripts/gates/c04-ui-screenshots.shexecutablescript1.6 KB
scripts/gates/c05-test-evidence.shexecutablescript1.4 KB
scripts/gates/c07-coauthor-banned.shexecutablescript1.2 KB
scripts/gates/c09-issue-link.shexecutablescript1.5 KB
scripts/gates/c11-no-force-push.shexecutablescript1.3 KB
scripts/gates/c12-ci-green.shexecutablescript1.2 KB
scripts/gates/c13-bots-passed.shexecutablescript2.1 KB
scripts/gates/c16-no-self-merge.shexecutablescript914 B
scripts/gates/c19-body-claim-vs-diff.shexecutablescript2.9 KB
scripts/gates/d02-no-ai-bug-reports.shexecutablescript1.4 KB
scripts/gates/d03-no-ai-pr-reviews.shexecutablescript1.1 KB
scripts/gates/d05-no-reopen.shexecutablescript1.1 KB
scripts/gates/e02-ai-strike-track.shexecutablescript2.7 KB
scripts/gates/e04-fork-target.shexecutablescript1.5 KB
scripts/gates/f01-license-compat.shexecutablescript3.5 KB
scripts/gates/f03-fixtures-clean.shexecutablescript1.2 KB
scripts/gates/f04-override-disclosure.shexecutablescript2.4 KB
scripts/gates/g01-no-vendored-edits.shexecutablescript1.9 KB
scripts/gates/g02-protected-paths.shexecutablescript1.2 KB
scripts/gates/g03-no-changelog-edits.shexecutablescript1.4 KB
scripts/gates/g04-no-version-bump.shexecutablescript1.4 KB
scripts/gates/g06-override-rate-limit.shexecutablescript1.5 KB
scripts/gates/lib/preamble.shexecutablescript4.8 KB
scripts/lint-candidate.shexecutablescript5.1 KB
scripts/researcher-build.shexecutablescript17.6 KB
scripts/researcher-refresh.pyscript4.9 KB
scripts/setup.shexecutablescript1.7 KB
scripts/test-known-traps.shexecutablescript5.4 KB
scripts/test-override-audit.shexecutablescript3.5 KB
scripts/test-plug-in.shexecutablescript4.0 KB
scripts/test-scout-refresh.shexecutablescript4.9 KB
scripts/test-stale-dossier-refresh.shexecutablescript3.7 KB
scripts/transition.shexecutablescript10.3 KB

scripts/researcher-refresh.py

View on GitHub
#!/usr/bin/env python3
"""Preserve dossier manual sections and publish a complete refresh."""

import argparse
import os
from pathlib import Path
import re
import stat
import sys
import tempfile


HEADINGS = (b"Pet peeves & known triggers", b"Failure log", b"Notes")
H2 = re.compile(rb" {0,3}##(?:[ \t]+(.*?))?[ \t]*$")
FENCE = re.compile(rb" {0,3}(`{3,}|~{3,})(.*)$")


def sections(data):
    """Return byte spans of the three bodies; refuse unclear boundaries."""
    data.decode("utf-8")  # Invalid text must never be silently replaced.
    found = {}
    active = None
    fence = None
    offset = 0
    for line in data.splitlines(keepends=True):
        text = line.rstrip(b"\r\n")
        marker = FENCE.fullmatch(text)
        if fence is not None:
            if marker and marker[1][:1] == fence[:1] and len(marker[1]) >= len(fence) and not marker[2].strip():
                fence = None
        elif marker:
            if marker[1].startswith(b"`") and b"`" in marker[2]:
                raise ValueError("ambiguous backtick fence")
            fence = marker[1]
        else:
            heading = H2.fullmatch(text)
            if heading:
                if active is not None:
                    found[active][1] = offset
                    active = None
                name = heading[1]
                if name in HEADINGS:
                    if name in found:
                        raise ValueError("duplicate manual heading: " + name.decode())
                    found[name] = [offset + len(line), len(data)]
                    active = name
        offset += len(line)
    if fence is not None:
        raise ValueError("unclosed fenced block")
    if set(found) != set(HEADINGS):
        raise ValueError("expected exactly one of each manual heading")
    return found


def merge(generated, existing):
    placeholders = sections(generated)
    if existing is None:
        return generated
    preserved = sections(existing)
    result = generated
    for name, (start, end) in sorted(placeholders.items(), key=lambda item: item[1][0], reverse=True):
        old_start, old_end = preserved[name]
        result = result[:start] + existing[old_start:old_end] + result[end:]
    # For example, a manual body without a final newline could swallow a heading.
    sections(result)
    return result


def snapshot(path):
    try:
        info = path.lstat()
    except FileNotFoundError:
        return None
    if not stat.S_ISREG(info.st_mode):
        raise ValueError("dossier must be a regular file, not a symlink or directory")
    with os.fdopen(os.open(path, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK), "rb") as stream:
        opened = os.fstat(stream.fileno())
        if not stat.S_ISREG(opened.st_mode):
            raise ValueError("dossier changed to a nonregular file")
        if (info.st_dev, info.st_ino) != (opened.st_dev, opened.st_ino):
            raise ValueError("dossier changed while opening")
        data = stream.read()
    return data, opened


def identity(saved):
    if saved is None:
        return None
    data, info = saved
    return data, info.st_dev, info.st_ino, info.st_mode, info.st_mtime_ns, info.st_ctime_ns


def refresh(generated, destination, stdout=False):
    original = snapshot(destination)
    result = merge(generated, None if original is None else original[0])
    if stdout:
        sys.stdout.buffer.write(result)
        sys.stdout.buffer.flush()
        return
    destination.parent.mkdir(parents=True, exist_ok=True)
    descriptor, temporary = tempfile.mkstemp(prefix=".researcher-", dir=destination.parent)
    try:
        with os.fdopen(descriptor, "wb") as stream:
            if original is not None:
                os.fchmod(stream.fileno(), stat.S_IMODE(original[1].st_mode))
            stream.write(result)
            stream.flush()
            os.fsync(stream.fileno())
        if identity(snapshot(destination)) != identity(original):
            raise ValueError("dossier changed during refresh; retry after edits finish")
        if original is None:
            # Creation cannot overwrite a file that appeared after the check.
            os.link(temporary, destination)
        else:
            # Atomic publication; an uncooperative editor can still race this
            # final check-to-replace window. Coordinate simultaneous writers.
            os.replace(temporary, destination)
    finally:
        try:
            os.unlink(temporary)
        except FileNotFoundError:
            pass


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("generated", type=Path)
    parser.add_argument("destination", type=Path)
    parser.add_argument("--stdout", action="store_true")
    args = parser.parse_args()
    try:
        refresh(args.generated.read_bytes(), args.destination, args.stdout)
    except (OSError, ValueError) as error:
        print(f"researcher-refresh: refused refresh: {error}", file=sys.stderr)
        return 1
    return 0


if __name__ == "__main__":
    sys.exit(main())
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall