Lucasuiii/modeling-workbench / .agents/skills/cumcm-workflow
cumcm-workflow
VerifiedBuild or resume mathematical-modeling competition work, including CUMCM, MCM/ICM, graduate and regional contests, data challenges, and open-topic statistical modeling. Guide problem framing, modeling, computation, validation, Chinese or English LaTeX writing, and reviewed PDF/source delivery using current official requirements. Not for ordinary paper polishing.
scripts/inventory_artifacts.py
View on GitHub#!/usr/bin/env python3
"""Inventory official input files and record automatic byte identity without modifying them."""
from __future__ import annotations
import argparse
import hashlib
import json
import mimetypes
from datetime import datetime, timezone
from pathlib import Path
EXCLUDED_PARTS = {".git", "__pycache__", ".pytest_cache"}
def sha256(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as stream:
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()
def inventory(root: Path, output: Path) -> list[dict]:
output_resolved = output.resolve()
records = []
for path in sorted(root.rglob("*")):
if not path.is_file() or any(part in EXCLUDED_PARTS for part in path.parts):
continue
if path.resolve() == output_resolved:
continue
records.append(
{
"path": path.relative_to(root).as_posix(),
"size": path.stat().st_size,
"sha256": sha256(path),
}
)
return records
def inventory_sources(source_root: Path, project_root: Path, output: Path, origin: str) -> list[dict]:
output_resolved = output.resolve()
records = []
for path in sorted(source_root.rglob("*")):
if not path.is_file() or any(part in EXCLUDED_PARTS for part in path.parts):
continue
if path.resolve() == output_resolved:
continue
try:
rel = path.resolve().relative_to(project_root.resolve()).as_posix()
except ValueError as exc:
raise ValueError(f"source file is outside project root: {path}") from exc
records.append(
{
"source_id": f"SRC-{len(records) + 1:03d}",
"path": rel,
"size": path.stat().st_size,
"sha256": sha256(path),
"media_type": mimetypes.guess_type(path.name)[0] or "application/octet-stream",
"origin": origin,
"acquisition": {
"method": "user_local_file" if origin in {"official", "organizer_attachment", "external_reference"} else "derived",
"provided_by_user": origin in {"official", "organizer_attachment", "external_reference"},
"source_reference": None,
},
"authoritative_for": [],
"derived_from": None,
"mutable": origin not in {"official", "organizer_attachment"},
}
)
return records
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--root", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--project-root", type=Path, required=True)
parser.add_argument("--project-id", required=True)
parser.add_argument(
"--origin",
choices=("official", "organizer_attachment", "external_reference", "team_created"),
default="official",
)
args = parser.parse_args()
root = args.root.resolve()
if not root.is_dir():
parser.error(f"root is not a directory: {root}")
project_root = args.project_root.resolve()
if not project_root.is_dir():
parser.error(f"project root is not a directory: {project_root}")
try:
records = inventory_sources(root, project_root, args.output, args.origin)
except ValueError as exc:
parser.error(str(exc))
payload = {
"schema_version": "0.6.0",
"artifact_type": "source_manifest",
"project_id": args.project_id,
"updated_at": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
"producer": {"kind": "script", "name": "inventory_artifacts.py", "version": "0.6.0"},
"sources": records,
}
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(f"inventoried {len(records)} files -> {args.output}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |