Skip to content

yzsp-studio/mediakit-shared-suite / verifier-hub

verifier-hub

Verified

Deterministic artifact verifier CLI (file/xlsx/docx/pdf/pptx/text/archive/rubric) for pre-delivery artifact checks and agentic judges. 58 subcommands callable as `verifier {family} {subcmd} [args]`. Use before delivering or uploading a file, or whenever you need to check file format, sheet/section presence, cell values, formulas, keywords, character counts, page counts, placeholders, signatures or zip contents, instead of guessing from an LLM reading. Every call prints one JSON object with a quotable `evidence` field.

FileKindSize
README.mdmarkdown3.9 KB
SKILL.mdskill md8.5 KB
bin/verifierother8.2 KB
bin/verifier.cmdscript482 B
lib/__init__.pyscript299 B
lib/_common.pyscript14.3 KB
lib/_pdf_backend.pyscript8.1 KB
lib/archive.pyscript6.2 KB
lib/docx.pyscript32.2 KB
lib/file_io.pyscript10.3 KB
lib/pdf.pyscript8.9 KB
lib/pptx.pyscript11.1 KB
lib/rubric.pyscript17.9 KB
lib/text.pyscript21.9 KB
lib/xlsx.pyscript25.7 KB
references/questionnaire.mdmarkdown4.1 KB
references/subcommands.mdmarkdown11.0 KB
requirements.txtmanifest2.3 KB

lib/archive.py

View on GitHub
"""archive — ZIP archive inspection (read-only, stdlib only).

2 subcommands
-------------
zip-list           List archive entries with size, kind classification (subset of detect_kind).
zip-check-entries  Assert all expected entry names exist (subset semantics; mode = contains/exact/regex).

Why a dedicated family: GDPval ships a non-trivial number of ".zip with these
files inside" rubrics ("Exactly one top-level ZIP archive ... with WAV stems").
``file artifact-list`` only walks the filesystem, not zip contents; building a
specific zip primitive avoids fragile "extract → walk → cleanup" sequences.
"""
from __future__ import annotations

import argparse
import os
import re
import zipfile
from typing import Any

from . import _common as C

_ZIP_EXTS = (".zip",)


def register(sub: argparse._SubParsersAction) -> None:
    p = sub.add_parser("zip-list",
                       help="List archive entries (name/size/kind), with optional ext filter.")
    p.add_argument("file")
    p.add_argument("--ext", default=None,
                   help="comma-separated extensions to include (e.g. .wav,.mp3)")
    p.add_argument("--max-entries", type=int, default=200)

    p = sub.add_parser("zip-check-entries",
                       help="Assert all --expected names exist inside the archive.")
    p.add_argument("file")
    p.add_argument("--expected", nargs="+", required=True,
                   help="entry names / patterns to look for")
    p.add_argument("--mode", choices=("contains", "exact", "regex"), default="contains",
                   help="match mode against entry full path inside the archive")
    p.add_argument("--ignore-case", action="store_true")


# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------

def _open(path: str) -> tuple[zipfile.ZipFile, str]:
    abs_path = C.require_file(path, _ZIP_EXTS)
    if not zipfile.is_zipfile(abs_path):
        raise C.VerifierError(C.ErrCode.PARSE_ERROR,
                              f"file {abs_path} is not a valid ZIP archive")
    try:
        return zipfile.ZipFile(abs_path, "r"), abs_path
    except zipfile.BadZipFile as e:
        raise C.VerifierError(C.ErrCode.PARSE_ERROR,
                              f"BadZipFile({abs_path}): {e}") from e


def _classify(name: str) -> str:
    # Trailing-slash entries are directories.
    if name.endswith("/"):
        return "dir"
    return C.detect_kind(name)


# ---------------------------------------------------------------------------
# zip-list
# ---------------------------------------------------------------------------

def cmd_zip_list(args: argparse.Namespace) -> dict:
    exts: set[str] | None = None
    if args.ext:
        exts = {
            (e if e.startswith(".") else "." + e).lower()
            for e in args.ext.split(",") if e.strip()
        }

    zf, abs_path = _open(args.file)
    entries: list[dict] = []
    summary_kinds: dict[str, int] = {}
    truncated = False
    try:
        for info in zf.infolist():
            ext = os.path.splitext(info.filename)[1].lower()
            if exts is not None and ext not in exts:
                continue
            kind = _classify(info.filename)
            entries.append({
                "name": info.filename,
                "size": info.file_size,
                "compressed": info.compress_size,
                "is_dir": info.is_dir(),
                "kind": kind,
            })
            summary_kinds[kind] = summary_kinds.get(kind, 0) + 1
            if len(entries) >= args.max_entries:
                truncated = True
                break
    finally:
        zf.close()

    summary = ", ".join(f"{k}={v}" for k, v in sorted(summary_kinds.items())) or "(empty)"
    return {
        "file": abs_path,
        "entry_count": len(entries),
        "ext_filter": sorted(exts) if exts else None,
        "truncated": truncated,
        "entries": entries,
        "_evidence": C.evidence(file=abs_path,
                                quote=f"{len(entries)} entries: {summary}"
                                + (" (truncated)" if truncated else "")),
    }


# ---------------------------------------------------------------------------
# zip-check-entries
# ---------------------------------------------------------------------------

def cmd_zip_check_entries(args: argparse.Namespace) -> dict:
    zf, abs_path = _open(args.file)
    try:
        names = [info.filename for info in zf.infolist()]
    finally:
        zf.close()

    if args.ignore_case:
        haystack = [n.lower() for n in names]
        wants = [w.lower() for w in args.expected]
    else:
        haystack = names
        wants = list(args.expected)

    matched: list[dict] = []
    missing: list[str] = []
    for orig, w in zip(args.expected, wants):
        hit_idx: int | None = None
        if args.mode == "exact":
            for i, n in enumerate(haystack):
                if n == w:
                    hit_idx = i
                    break
        elif args.mode == "contains":
            for i, n in enumerate(haystack):
                if w in n:
                    hit_idx = i
                    break
        else:  # regex
            try:
                rx = re.compile(w, re.IGNORECASE if args.ignore_case else 0)
            except re.error as e:
                raise C.VerifierError(C.ErrCode.BAD_ARGS,
                                      f"invalid regex {orig!r}: {e}") from e
            for i, n in enumerate(haystack):
                if rx.search(n):
                    hit_idx = i
                    break
        if hit_idx is None:
            missing.append(orig)
        else:
            matched.append({"expected": orig, "matched_entry": names[hit_idx]})

    passed = not missing
    return {
        "file": abs_path,
        "mode": args.mode,
        "ignore_case": args.ignore_case,
        "entry_count": len(names),
        "expected": args.expected,
        "matched": matched,
        "missing": missing,
        "passed": passed,
        "available_entries_sample": names[:50],
        "_evidence": C.evidence(file=abs_path,
                                quote=f"matched {len(matched)}/{len(args.expected)}"
                                + (f"; missing={missing}" if missing else "")),
    }
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall