@orbit-build/cli 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/commands/cumcm-draft.md +11 -0
- package/commands/math-draft.md +4 -8
- package/dist/index.js +671 -397
- package/package.json +1 -1
- package/skills/{math-model-draft → cumcm-draft}/SKILL.md +124 -27
- package/skills/cumcm-draft/agents/openai.yaml +6 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/config.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/data.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/plotting.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/validation.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/finalize.py +9 -3
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/AI/345/267/245/345/205/267/344/275/277/347/224/250/350/257/246/346/203/205.tex +12 -3
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/contest-profile.json +7 -4
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/main.tex +28 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/ai-disclosure.tex +3 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/appendix.tex +3 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/references.tex +12 -0
- package/skills/{math-model-draft → cumcm-draft}/references/code-and-output-style.md +37 -6
- package/skills/cumcm-draft/references/cumcm-compliance.md +64 -0
- package/skills/{math-model-draft → cumcm-draft}/references/latex-figures-tables.md +5 -0
- package/skills/cumcm-draft/references/modeling-quality.md +161 -0
- package/skills/{math-model-draft → cumcm-draft}/references/paper-architecture.md +51 -5
- package/skills/cumcm-draft/references/project-architecture.md +124 -0
- package/skills/{math-model-draft → cumcm-draft}/scripts/audit_paper.py +40 -0
- package/skills/{math-model-draft → cumcm-draft}/scripts/bootstrap_project.py +44 -42
- package/skills/{math-model-draft → cumcm-draft}/scripts/build_paper.py +76 -5
- package/skills/{math-model-draft → cumcm-draft}/scripts/clean_project.py +7 -1
- package/skills/{math-model-draft → cumcm-draft}/scripts/package_support.py +8 -1
- package/skills/{math-model-draft → cumcm-draft}/scripts/project_utils.py +12 -9
- package/skills/{math-model-draft → cumcm-draft}/scripts/validate_project.py +191 -6
- package/skills/mcm-draft/SKILL.md +11 -0
- package/skills/mcm-draft/agents/openai.yaml +6 -0
- package/skills/math-model-draft/agents/openai.yaml +0 -6
- package/skills/math-model-draft/assets/project-template/paper/sections/ai-disclosure.tex +0 -3
- package/skills/math-model-draft/assets/project-template/paper/sections/appendix.tex +0 -9
- package/skills/math-model-draft/assets/project-template/paper/sections/references.tex +0 -6
- package/skills/math-model-draft/references/cumcm-compliance.md +0 -56
- package/skills/math-model-draft/references/modeling-quality.md +0 -91
- package/skills/math-model-draft/references/project-architecture.md +0 -65
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/__init__.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/requirements.txt +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/ai-use-log.md +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/abstract.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/assumptions.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/data.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/evaluation.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/problem-analysis.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/problem-restatement.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/source-code.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/support-files.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/references/paper-revision.md +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/capture_environment.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/evidence_freeze.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/finalize_project.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/inspect_inputs.py +0 -0
|
@@ -5,7 +5,13 @@ import shutil
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
CACHE_DIR_NAMES = {
|
|
8
|
+
CACHE_DIR_NAMES = {
|
|
9
|
+
"__pycache__",
|
|
10
|
+
".pytest_cache",
|
|
11
|
+
".mypy_cache",
|
|
12
|
+
".ruff_cache",
|
|
13
|
+
".ipynb_checkpoints",
|
|
14
|
+
}
|
|
9
15
|
TEX_CACHE_SUFFIXES = {".aux", ".bbl", ".bcf", ".blg", ".fdb_latexmk", ".fls", ".log", ".out", ".run.xml", ".synctex.gz", ".toc", ".xdv"}
|
|
10
16
|
|
|
11
17
|
|
|
@@ -7,7 +7,14 @@ from pathlib import Path
|
|
|
7
7
|
from project_utils import iter_regular_files, load_profile, numeric_limit
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
EXCLUDED_PARTS = {
|
|
10
|
+
EXCLUDED_PARTS = {
|
|
11
|
+
"__pycache__",
|
|
12
|
+
".pytest_cache",
|
|
13
|
+
".mypy_cache",
|
|
14
|
+
".ruff_cache",
|
|
15
|
+
".ipynb_checkpoints",
|
|
16
|
+
"build",
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
def main() -> None:
|
|
@@ -8,19 +8,22 @@ from typing import Any, Iterable
|
|
|
8
8
|
|
|
9
9
|
DEFAULT_PROFILE: dict[str, Any] = {
|
|
10
10
|
"schema_version": 1,
|
|
11
|
-
"profile": "
|
|
11
|
+
"profile": "cumcm-2026",
|
|
12
|
+
"rules_checked_at": "2026-08-11",
|
|
12
13
|
"paper": {
|
|
13
|
-
"max_pdf_mb":
|
|
14
|
-
"max_body_pages":
|
|
15
|
-
"include_support_file_list":
|
|
16
|
-
"include_source_appendix":
|
|
14
|
+
"max_pdf_mb": 20,
|
|
15
|
+
"max_body_pages": 30,
|
|
16
|
+
"include_support_file_list": True,
|
|
17
|
+
"include_source_appendix": True,
|
|
17
18
|
},
|
|
18
|
-
"support": {"max_archive_mb":
|
|
19
|
+
"support": {"max_archive_mb": 20, "include_ai_log": False},
|
|
19
20
|
"ai": {
|
|
20
|
-
"policy": "
|
|
21
|
+
"policy": "cumcm-2025-trial",
|
|
21
22
|
"used": True,
|
|
22
|
-
"
|
|
23
|
-
"
|
|
23
|
+
"inline_markers_required": True,
|
|
24
|
+
"reference_entry_required": True,
|
|
25
|
+
"reference_key": "ai-tool",
|
|
26
|
+
"details_pdf_required": True,
|
|
24
27
|
},
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -15,6 +15,23 @@ from evidence_freeze import evidence_differences
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
INPUT_SUFFIXES = {".pdf", ".doc", ".docx", ".csv", ".tsv", ".xls", ".xlsx"}
|
|
18
|
+
SUPPORT_EXCLUDED_PARTS = {
|
|
19
|
+
"__pycache__",
|
|
20
|
+
".pytest_cache",
|
|
21
|
+
".mypy_cache",
|
|
22
|
+
".ruff_cache",
|
|
23
|
+
".ipynb_checkpoints",
|
|
24
|
+
"build",
|
|
25
|
+
}
|
|
26
|
+
NESTED_ARCHIVE_SUFFIXES = {".zip", ".rar", ".7z"}
|
|
27
|
+
SCRATCH_DELIVERY_NAMES = {
|
|
28
|
+
"audit_results.py",
|
|
29
|
+
"build_support_zip.ps1",
|
|
30
|
+
"cleanup_workspace.ps1",
|
|
31
|
+
"make_pdf_contacts.py",
|
|
32
|
+
"rebuild_support.ps1",
|
|
33
|
+
"verify_results.py",
|
|
34
|
+
}
|
|
18
35
|
|
|
19
36
|
|
|
20
37
|
def sha256(path: Path) -> str:
|
|
@@ -32,6 +49,51 @@ def read_json(path: Path) -> dict[str, Any]:
|
|
|
32
49
|
return payload
|
|
33
50
|
|
|
34
51
|
|
|
52
|
+
def centimeters(value: str) -> float | None:
|
|
53
|
+
match = re.fullmatch(r"\s*([0-9]+(?:\.[0-9]+)?)\s*(cm|mm|in)\s*", value)
|
|
54
|
+
if not match:
|
|
55
|
+
return None
|
|
56
|
+
number = float(match.group(1))
|
|
57
|
+
return number if match.group(2) == "cm" else number / 10 if match.group(2) == "mm" else number * 2.54
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def cumcm_margin_error(main_tex: str) -> str | None:
|
|
61
|
+
match = re.search(r"\\usepackage\[([^]]+)]\{geometry}", main_tex)
|
|
62
|
+
if not match:
|
|
63
|
+
return "CUMCM paper must declare explicit geometry margins"
|
|
64
|
+
options = {}
|
|
65
|
+
for item in match.group(1).split(","):
|
|
66
|
+
if "=" in item:
|
|
67
|
+
key, value = item.split("=", 1)
|
|
68
|
+
options[key.strip()] = value.strip()
|
|
69
|
+
uniform = centimeters(options.get("margin", ""))
|
|
70
|
+
if uniform is not None:
|
|
71
|
+
return None if uniform >= 2.5 else f"CUMCM paper margin is {uniform:g} cm; minimum is 2.5 cm"
|
|
72
|
+
values = [centimeters(options.get(key, "")) for key in ("top", "bottom", "left", "right")]
|
|
73
|
+
if any(value is None for value in values):
|
|
74
|
+
return "CUMCM paper must declare top, bottom, left, and right margins or one uniform margin"
|
|
75
|
+
if min(value for value in values if value is not None) < 2.5:
|
|
76
|
+
return "every CUMCM paper margin must be at least 2.5 cm"
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def expected_support_names(root: Path, ai_profile: dict[str, object], support_profile: dict[str, object]) -> set[str]:
|
|
81
|
+
names: set[str] = set()
|
|
82
|
+
for directory in ("code", "results", "figures"):
|
|
83
|
+
base = root / directory
|
|
84
|
+
if not base.is_dir() or base.is_symlink():
|
|
85
|
+
continue
|
|
86
|
+
for path in base.rglob("*"):
|
|
87
|
+
if path.is_file() and not path.is_symlink() and not any(part in SUPPORT_EXCLUDED_PARTS for part in path.relative_to(root).parts):
|
|
88
|
+
names.add(path.relative_to(root).as_posix())
|
|
89
|
+
if bool(ai_profile.get("used")) and bool(ai_profile.get("details_pdf_required")):
|
|
90
|
+
names.add("paper/AI工具使用详情.pdf")
|
|
91
|
+
if bool(support_profile.get("include_ai_log")) and (root / "paper" / "ai-use-log.md").is_file():
|
|
92
|
+
names.add("paper/ai-use-log.md")
|
|
93
|
+
names.add("paper/evidence-freeze.json")
|
|
94
|
+
return names
|
|
95
|
+
|
|
96
|
+
|
|
35
97
|
def load_evidence_yaml(path: Path) -> dict[str, Any]:
|
|
36
98
|
try:
|
|
37
99
|
import yaml
|
|
@@ -135,6 +197,79 @@ def validate_evidence(root: Path, count: int, errors: list[str], warnings: list[
|
|
|
135
197
|
warnings.append(f"unresolved evidence claim: {claim_id or location}")
|
|
136
198
|
|
|
137
199
|
|
|
200
|
+
def code_architecture_warnings(root: Path, count: int) -> list[str]:
|
|
201
|
+
"""Find review-hostile Python layouts without prescribing one fixed architecture."""
|
|
202
|
+
warnings: list[str] = []
|
|
203
|
+
for number in range(1, count + 1):
|
|
204
|
+
question_dir = root / "code" / f"q{number}"
|
|
205
|
+
if not question_dir.is_dir():
|
|
206
|
+
continue
|
|
207
|
+
modules = sorted(
|
|
208
|
+
path
|
|
209
|
+
for path in question_dir.glob("*.py")
|
|
210
|
+
if path.name != "__init__.py" and path.is_file()
|
|
211
|
+
)
|
|
212
|
+
names = {path.name for path in modules}
|
|
213
|
+
if names == {"main.py", "model.py", "output.py"}:
|
|
214
|
+
warnings.append(
|
|
215
|
+
f"q{number} uses the generic main.py + model.py + output.py trio; "
|
|
216
|
+
"split substantial logic by actual responsibility"
|
|
217
|
+
)
|
|
218
|
+
for path in modules:
|
|
219
|
+
lines = path.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
220
|
+
code_lines = [line for line in lines if line.strip()]
|
|
221
|
+
comments = [line for line in lines if line.lstrip().startswith("#")]
|
|
222
|
+
if len(code_lines) >= 80 and not comments:
|
|
223
|
+
warnings.append(
|
|
224
|
+
f"{path.relative_to(root).as_posix()} has {len(code_lines)} nonblank "
|
|
225
|
+
"lines but no review-oriented # comments"
|
|
226
|
+
)
|
|
227
|
+
main_path = question_dir / "main.py"
|
|
228
|
+
if main_path.is_file():
|
|
229
|
+
main_lines = [
|
|
230
|
+
line
|
|
231
|
+
for line in main_path.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
232
|
+
if line.strip()
|
|
233
|
+
]
|
|
234
|
+
if len(main_lines) >= 150:
|
|
235
|
+
warnings.append(
|
|
236
|
+
f"code/q{number}/main.py has {len(main_lines)} nonblank lines; "
|
|
237
|
+
"keep the entry point orchestral"
|
|
238
|
+
)
|
|
239
|
+
return warnings
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def delivery_hygiene_warnings(root: Path) -> list[str]:
|
|
243
|
+
"""Flag authoring leftovers that should not enter a compact submission."""
|
|
244
|
+
warnings: list[str] = []
|
|
245
|
+
bases = [root / directory for directory in ("code", "results", "figures")]
|
|
246
|
+
bases.extend(root / "produce" / directory for directory in ("code", "results", "figures"))
|
|
247
|
+
for base in bases:
|
|
248
|
+
if not base.is_dir() or base.is_symlink():
|
|
249
|
+
continue
|
|
250
|
+
for path in base.rglob("*"):
|
|
251
|
+
if not path.is_file() or path.is_symlink():
|
|
252
|
+
continue
|
|
253
|
+
relative = path.relative_to(root).as_posix()
|
|
254
|
+
if path.suffix.lower() in NESTED_ARCHIVE_SUFFIXES:
|
|
255
|
+
warnings.append(f"nested project archive should be removed before handoff: {relative}")
|
|
256
|
+
if path.name.lower() in SCRATCH_DELIVERY_NAMES:
|
|
257
|
+
warnings.append(f"authoring-only helper should not be delivered as model code: {relative}")
|
|
258
|
+
for directory in ("produce", "code", "results", "figures"):
|
|
259
|
+
if not (root / directory).is_dir():
|
|
260
|
+
continue
|
|
261
|
+
for suffix in NESTED_ARCHIVE_SUFFIXES:
|
|
262
|
+
duplicate = root / f"{directory}{suffix}"
|
|
263
|
+
if duplicate.is_file() and not duplicate.is_symlink():
|
|
264
|
+
warnings.append(
|
|
265
|
+
f"duplicate directory archive should be removed before handoff: {duplicate.name}"
|
|
266
|
+
)
|
|
267
|
+
temporary = root / "tmp"
|
|
268
|
+
if temporary.is_dir() and any(temporary.iterdir()):
|
|
269
|
+
warnings.append("non-empty tmp/ directory should be cleaned before handoff")
|
|
270
|
+
return warnings
|
|
271
|
+
|
|
272
|
+
|
|
138
273
|
def main() -> None:
|
|
139
274
|
parser = argparse.ArgumentParser(description="Audit a modeling project and active contest profile.")
|
|
140
275
|
parser.add_argument("project_root", type=Path)
|
|
@@ -242,6 +377,8 @@ def main() -> None:
|
|
|
242
377
|
compile_result = subprocess.run([sys.executable, "-m", "compileall", "-q", str(root / "code")], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, check=False)
|
|
243
378
|
if compile_result.returncode:
|
|
244
379
|
errors.append("Python compile failed: " + compile_result.stdout.strip())
|
|
380
|
+
warnings.extend(code_architecture_warnings(root, count))
|
|
381
|
+
warnings.extend(delivery_hygiene_warnings(root))
|
|
245
382
|
validate_evidence(root, count, errors, warnings)
|
|
246
383
|
try:
|
|
247
384
|
frozen_differences = evidence_differences(root)
|
|
@@ -260,12 +397,30 @@ def main() -> None:
|
|
|
260
397
|
if re.search(r"(姓名|学号|学校|指导教师)\s*[::]\s*\S+", tex):
|
|
261
398
|
warnings.append("paper may contain identifying information")
|
|
262
399
|
main_tex = root / "paper" / "main.tex"
|
|
263
|
-
if
|
|
400
|
+
if main_tex.is_file():
|
|
264
401
|
content = main_tex.read_text(encoding="utf-8", errors="replace")
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
402
|
+
if profile.get("profile") == "cumcm-2026":
|
|
403
|
+
margin_error = cumcm_margin_error(content)
|
|
404
|
+
if margin_error:
|
|
405
|
+
errors.append(margin_error)
|
|
406
|
+
if r"\tableofcontents" in content:
|
|
407
|
+
errors.append("CUMCM paper must not contain a table of contents")
|
|
408
|
+
if bool(ai_profile.get("used")):
|
|
409
|
+
if bool(ai_profile.get("inline_markers_required")) and tex.count(r"\AIUseMark") < 2:
|
|
410
|
+
errors.append("AI-assisted body content must carry corresponding inline markers")
|
|
411
|
+
if bool(ai_profile.get("reference_entry_required")):
|
|
412
|
+
reference_key = str(ai_profile.get("reference_key") or "ai-tool")
|
|
413
|
+
if f"\\bibitem{{{reference_key}}}" not in tex:
|
|
414
|
+
errors.append(f"AI tool reference entry is missing: {reference_key}")
|
|
415
|
+
|
|
416
|
+
if bool(paper_profile.get("include_support_file_list")):
|
|
417
|
+
support_tex = root / "paper" / "sections" / "support-files.tex"
|
|
418
|
+
if not support_tex.is_file() or "支撑材料文件列表" not in support_tex.read_text(encoding="utf-8", errors="replace"):
|
|
419
|
+
errors.append("CUMCM appendix is missing the required support-material file list")
|
|
420
|
+
if bool(paper_profile.get("include_source_appendix")):
|
|
421
|
+
source_tex = root / "paper" / "sections" / "source-code.tex"
|
|
422
|
+
if not source_tex.is_file() or r"\lstinputlisting" not in source_tex.read_text(encoding="utf-8", errors="replace"):
|
|
423
|
+
errors.append("CUMCM appendix is missing complete runnable source listings")
|
|
269
424
|
|
|
270
425
|
pdf = root / "paper" / "main.pdf"
|
|
271
426
|
if not pdf.is_file():
|
|
@@ -275,6 +430,22 @@ def main() -> None:
|
|
|
275
430
|
errors.append(f"paper/main.pdf exceeds active {pdf_limit:g} MB limit")
|
|
276
431
|
if any(path.stat().st_mtime > pdf.stat().st_mtime for path in tex_files):
|
|
277
432
|
warnings.append("paper/main.pdf is older than at least one TeX source")
|
|
433
|
+
if profile.get("profile") == "cumcm-2026":
|
|
434
|
+
try:
|
|
435
|
+
from pypdf import PdfReader
|
|
436
|
+
from pypdf.errors import PdfReadError
|
|
437
|
+
except ImportError as error:
|
|
438
|
+
if "摘要" not in tex or "关键词" not in tex:
|
|
439
|
+
errors.append(f"could not verify CUMCM first-page content without pypdf: {error}")
|
|
440
|
+
else:
|
|
441
|
+
try:
|
|
442
|
+
first_page = (PdfReader(pdf).pages[0].extract_text() or "").strip()
|
|
443
|
+
if "摘要" not in first_page or "关键词" not in first_page:
|
|
444
|
+
errors.append("CUMCM electronic paper first page must contain the abstract and keywords")
|
|
445
|
+
if "目录" in first_page:
|
|
446
|
+
errors.append("CUMCM electronic paper first page must not be a table of contents")
|
|
447
|
+
except (IndexError, OSError, PdfReadError, ValueError) as error:
|
|
448
|
+
warnings.append(f"could not verify CUMCM first-page content: {error}")
|
|
278
449
|
|
|
279
450
|
archive = root / "paper" / "support-materials.zip"
|
|
280
451
|
if not archive.is_file():
|
|
@@ -284,7 +455,7 @@ def main() -> None:
|
|
|
284
455
|
errors.append(f"support-materials.zip exceeds active {archive_limit:g} MB limit")
|
|
285
456
|
try:
|
|
286
457
|
with zipfile.ZipFile(archive) as bundle:
|
|
287
|
-
names = bundle.namelist()
|
|
458
|
+
names = [name for name in bundle.namelist() if not name.endswith("/")]
|
|
288
459
|
unsafe = [name for name in names if PurePosixPath(name.replace("\\", "/")).is_absolute() or ".." in PurePosixPath(name.replace("\\", "/")).parts or re.match(r"^[A-Za-z]:", name)]
|
|
289
460
|
if unsafe:
|
|
290
461
|
errors.append("support archive contains unsafe absolute/traversal paths")
|
|
@@ -296,6 +467,14 @@ def main() -> None:
|
|
|
296
467
|
errors.append("support archive is missing paper/evidence-freeze.json")
|
|
297
468
|
if bool(ai_profile.get("used")) and bool(ai_profile.get("details_pdf_required")) and "paper/AI工具使用详情.pdf" not in names:
|
|
298
469
|
errors.append("support archive is missing required AI工具使用详情.pdf")
|
|
470
|
+
expected_names = expected_support_names(root, ai_profile, support_profile)
|
|
471
|
+
actual_names = set(names)
|
|
472
|
+
missing_names = sorted(expected_names - actual_names)
|
|
473
|
+
extra_names = sorted(actual_names - expected_names)
|
|
474
|
+
if missing_names:
|
|
475
|
+
errors.append("support archive is missing listed project files: " + ", ".join(missing_names[:12]))
|
|
476
|
+
if extra_names:
|
|
477
|
+
errors.append("support archive contains unlisted project files: " + ", ".join(extra_names[:12]))
|
|
299
478
|
except zipfile.BadZipFile:
|
|
300
479
|
errors.append("paper/support-materials.zip is not a valid ZIP archive")
|
|
301
480
|
|
|
@@ -317,6 +496,12 @@ def main() -> None:
|
|
|
317
496
|
warnings.append("internal AI use log is missing")
|
|
318
497
|
if bool(ai_profile.get("details_pdf_required")) and not (root / "paper" / "AI工具使用详情.pdf").is_file():
|
|
319
498
|
errors.append("AI tool disclosure PDF is required but missing")
|
|
499
|
+
details_source = root / "paper" / "AI工具使用详情.tex"
|
|
500
|
+
if bool(ai_profile.get("details_pdf_required")) and (
|
|
501
|
+
not details_source.is_file()
|
|
502
|
+
or "关键交互记录" not in details_source.read_text(encoding="utf-8", errors="replace")
|
|
503
|
+
):
|
|
504
|
+
errors.append("AI details source must include key prompt-and-response interactions")
|
|
320
505
|
|
|
321
506
|
print(f"[RUN] Validation summary: {len(errors)} error(s), {len(warnings)} warning(s)")
|
|
322
507
|
for message in errors:
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcm-draft
|
|
3
|
+
description: Reserved placeholder for a future MCM/ICM-specific English mathematical-modeling paper workflow. Use only when explicitly invoked as $mcm-draft; do not use it for CUMCM, Chinese national-contest papers, or generic modeling work yet.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MCM/ICM draft placeholder
|
|
7
|
+
|
|
8
|
+
This package intentionally contains no MCM/ICM workflow, rules, scripts, or
|
|
9
|
+
templates yet. If invoked, state that the dedicated workflow is not implemented
|
|
10
|
+
and do not fall back to `$cumcm-draft`, because CUMCM and MCM/ICM have different
|
|
11
|
+
submission formats, language conventions, and contest policies.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Mathematical Modeling Draft"
|
|
3
|
-
short_description: "One-click complete modeling paper, code, PDF, and compliance package"
|
|
4
|
-
default_prompt: "Use $math-model-draft to read every problem and attachment in this project, complete all modeling and runnable q1/q2 code, generate verified results and figures, write the full evidence-linked LaTeX paper, add the current AI-use declaration, compile with local TeX Live, inspect every PDF page, and package the final delivery. Do not stop at scaffolding or an outline."
|
|
5
|
-
policy:
|
|
6
|
-
allow_implicit_invocation: false
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# CUMCM 2026 compliance profile
|
|
2
|
-
|
|
3
|
-
Checked against official pages on 2026-08-05. If the organizer publishes a
|
|
4
|
-
newer rule or the project supplies its own rule file, the newer supplied source
|
|
5
|
-
wins and `paper/contest-profile.json` must record the change.
|
|
6
|
-
|
|
7
|
-
## Paper and support material
|
|
8
|
-
|
|
9
|
-
- A4 paper; all margins at least 2.5 cm.
|
|
10
|
-
- The electronic first page contains the title, abstract, and keywords; no
|
|
11
|
-
table of contents.
|
|
12
|
-
- Main body is at most 30 pages and the paper PDF at most 20 MB.
|
|
13
|
-
- Support material is ZIP/RAR at most 20 MB, contains a file list, and includes
|
|
14
|
-
complete runnable source code when code is used.
|
|
15
|
-
- Do not expose team identity, school, instructor, or other identifying data in
|
|
16
|
-
paper or support material.
|
|
17
|
-
|
|
18
|
-
Source: <https://www.mcm.edu.cn/html_cn/node/4cd596519c9eb9fbd866398f6df0caa3.html>
|
|
19
|
-
|
|
20
|
-
## AI tools — rules effective 2026-09-01
|
|
21
|
-
|
|
22
|
-
The rule covers large-language models, generative AI, code assistants, and AI
|
|
23
|
-
agents. Core modeling and analysis must be team-led, and all AI output used in
|
|
24
|
-
the work must be manually reviewed.
|
|
25
|
-
|
|
26
|
-
Immediately before references, include an `AI工具使用声明`:
|
|
27
|
-
|
|
28
|
-
- If used: `本参赛队在竞赛过程中使用了AI工具,主要用于〖简要用途,如语言润色、代码调试等〗,详细使用情况见支撑材料。`
|
|
29
|
-
- If unused: use the official unused declaration. Do not choose this path if
|
|
30
|
-
this Skill or another AI system contributed to the submitted work.
|
|
31
|
-
|
|
32
|
-
When AI was used, support material must include `AI工具使用详情.pdf` stating:
|
|
33
|
-
|
|
34
|
-
1. tool name, version, and model;
|
|
35
|
-
2. purpose and stage;
|
|
36
|
-
3. main prompting method and process (typical examples may be included);
|
|
37
|
-
4. adopted content, manual changes, and verification (language polishing is
|
|
38
|
-
excepted from the detailed adoption/verification description).
|
|
39
|
-
|
|
40
|
-
Concealment, false declarations, unreviewed AI output, or handing core work to
|
|
41
|
-
AI can affect or cancel awards.
|
|
42
|
-
|
|
43
|
-
Source: <https://www.mcm.edu.cn/html_cn/node/fef94648f2836ab6cc81586f4c38512b.html>
|
|
44
|
-
|
|
45
|
-
## Interpretation guardrails
|
|
46
|
-
|
|
47
|
-
- AI is auxiliary; the team remains responsible for originality, legality,
|
|
48
|
-
truthfulness, and accuracy.
|
|
49
|
-
- Do not discuss a live problem with outsiders or on public platforms.
|
|
50
|
-
- The frequently repeated “AIGC/AIDC below 20%” suggestion is not present in
|
|
51
|
-
the official 2026 AI-use rule above. It may be a risk-management heuristic,
|
|
52
|
-
but must not be encoded or reported as an official threshold unless a newer
|
|
53
|
-
primary rule explicitly adds it.
|
|
54
|
-
|
|
55
|
-
Participation source:
|
|
56
|
-
<https://www.mcm.edu.cn/html_cn/node/9d8e511fe7a1447b35f53a82c908e2e0.html>
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Modeling and evidence quality
|
|
2
|
-
|
|
3
|
-
## Translate the task
|
|
4
|
-
|
|
5
|
-
For every subproblem record:
|
|
6
|
-
|
|
7
|
-
- target quantity or decision;
|
|
8
|
-
- observational unit and time/space scale;
|
|
9
|
-
- controllable and uncontrollable variables;
|
|
10
|
-
- constraints, units, and required deliverable;
|
|
11
|
-
- dependence on earlier subproblems;
|
|
12
|
-
- acceptable error or comparison criterion.
|
|
13
|
-
|
|
14
|
-
## Audit data before modeling
|
|
15
|
-
|
|
16
|
-
- Inventory sheets, tables, row counts, columns, units, formulas, and blanks.
|
|
17
|
-
- Preserve identifiers as strings when leading zeros matter.
|
|
18
|
-
- Distinguish structural zeros, measured zeros, missing values, and below-limit
|
|
19
|
-
values.
|
|
20
|
-
- Check duplicate entities, inconsistent units, impossible ranges, leakage,
|
|
21
|
-
and repeated measurements.
|
|
22
|
-
- Explain every exclusion or imputation and save an audit table.
|
|
23
|
-
- Fit preprocessing on training data only when evaluating predictions.
|
|
24
|
-
- Use compositional-data methods for constrained proportions when ordinary
|
|
25
|
-
correlations or Euclidean distances would be misleading.
|
|
26
|
-
|
|
27
|
-
## Select models by the problem
|
|
28
|
-
|
|
29
|
-
Start with a transparent baseline. Add complexity only when it improves a
|
|
30
|
-
defined criterion or resolves a structural limitation.
|
|
31
|
-
|
|
32
|
-
Compare candidates on:
|
|
33
|
-
|
|
34
|
-
- compatibility with assumptions and data volume;
|
|
35
|
-
- interpretability required by the question;
|
|
36
|
-
- constraint handling;
|
|
37
|
-
- uncertainty quantification;
|
|
38
|
-
- stability and computational cost;
|
|
39
|
-
- out-of-sample or scenario performance.
|
|
40
|
-
|
|
41
|
-
Do not combine algorithms merely to appear innovative.
|
|
42
|
-
|
|
43
|
-
## Validate at the right level
|
|
44
|
-
|
|
45
|
-
Choose evidence appropriate to the claim:
|
|
46
|
-
|
|
47
|
-
- regression: residual structure, error metrics, intervals, collinearity;
|
|
48
|
-
- classification: class counts, confusion matrix, per-class precision/recall,
|
|
49
|
-
F1, calibration, stratified or grouped validation;
|
|
50
|
-
- clustering: stability, silhouette or domain separation, sensitivity to k;
|
|
51
|
-
- optimization: feasibility, optimality gap/bounds, baseline comparison,
|
|
52
|
-
parameter sensitivity, multiple starts;
|
|
53
|
-
- time series: rolling-origin validation, residual autocorrelation, intervals;
|
|
54
|
-
- simulation: convergence, Monte Carlo error, scenario coverage;
|
|
55
|
-
- mechanistic model: dimensional checks, conservation, limiting cases,
|
|
56
|
-
parameter identifiability;
|
|
57
|
-
- ranking/evaluation: weight sensitivity, rank stability, consistency checks.
|
|
58
|
-
|
|
59
|
-
Respect grouped, temporal, or spatial dependence. Do not randomly split rows
|
|
60
|
-
that share the same entity or leak future information.
|
|
61
|
-
|
|
62
|
-
## Quantify uncertainty and robustness
|
|
63
|
-
|
|
64
|
-
- Perturb influential inputs over defensible ranges.
|
|
65
|
-
- Refit or rerun the full pipeline rather than perturbing only the final table.
|
|
66
|
-
- Report which conclusions are invariant and which change.
|
|
67
|
-
- Use bootstrap or simulation when analytic intervals are unavailable.
|
|
68
|
-
- Distinguish parameter uncertainty, measurement error, model-form error, and
|
|
69
|
-
scenario uncertainty.
|
|
70
|
-
|
|
71
|
-
## Maintain evidence lineage
|
|
72
|
-
|
|
73
|
-
Every paper claim must map to:
|
|
74
|
-
|
|
75
|
-
- generating module/function;
|
|
76
|
-
- input dataset or upstream result;
|
|
77
|
-
- result file and field/table;
|
|
78
|
-
- validation evidence;
|
|
79
|
-
- paper section and figure/table label.
|
|
80
|
-
|
|
81
|
-
Keep this mapping in `paper/evidence-map.yaml`. Do not type important numbers
|
|
82
|
-
into LaTeX from memory.
|
|
83
|
-
|
|
84
|
-
## Prevent unsupported output
|
|
85
|
-
|
|
86
|
-
- Never invent sample sizes, parameter values, citations, or performance.
|
|
87
|
-
- Never call a result significant without a defined statistical test.
|
|
88
|
-
- Never infer causality from association without an identification argument.
|
|
89
|
-
- Never claim generalization beyond observed conditions without scenarios or
|
|
90
|
-
external evidence.
|
|
91
|
-
- Preserve an explicit `TODO` when evidence cannot be obtained.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Project architecture
|
|
2
|
-
|
|
3
|
-
Use one stable project root. Keep inputs, code, paper, results, and figures
|
|
4
|
-
separate so a human can replace any layer without reorganizing the project.
|
|
5
|
-
|
|
6
|
-
```text
|
|
7
|
-
project-root/
|
|
8
|
-
├── question/ # Immutable problem PDF/DOCX and source data
|
|
9
|
-
├── code/
|
|
10
|
-
│ ├── requirements.txt
|
|
11
|
-
│ ├── run_all.py
|
|
12
|
-
│ ├── always/ # Shared configuration, data, plotting, checks
|
|
13
|
-
│ ├── q1/
|
|
14
|
-
│ ├── q2/
|
|
15
|
-
│ └── ...
|
|
16
|
-
├── results/
|
|
17
|
-
│ ├── q1/ # Tables, metrics, filled workbooks, models
|
|
18
|
-
│ ├── q2/
|
|
19
|
-
│ └── ...
|
|
20
|
-
├── figures/
|
|
21
|
-
│ ├── q1/ # Final paper-ready figures only
|
|
22
|
-
│ ├── q2/
|
|
23
|
-
│ └── ...
|
|
24
|
-
└── paper/
|
|
25
|
-
├── main.tex
|
|
26
|
-
├── references.bib
|
|
27
|
-
├── evidence-map.yaml
|
|
28
|
-
├── sections/
|
|
29
|
-
│ ├── q1.tex
|
|
30
|
-
│ ├── q2.tex
|
|
31
|
-
│ └── ...
|
|
32
|
-
└── build/ # LaTeX intermediates and final PDF
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Ownership rules
|
|
36
|
-
|
|
37
|
-
- `question/` is read-only. Never normalize, rename, fill, or save over input.
|
|
38
|
-
- Ignore blank workbooks/sheets unless the statement explicitly assigns them a
|
|
39
|
-
role. Record that they were blank.
|
|
40
|
-
- A required filled table belongs in `results/qN`, even when its blank template
|
|
41
|
-
came from `question/`.
|
|
42
|
-
- `code/always` contains only logic used by two or more subproblems.
|
|
43
|
-
- Each `code/qN/main.py` must run independently after its prerequisites exist.
|
|
44
|
-
- `code/run_all.py` runs subproblems in dependency order.
|
|
45
|
-
- `results/qN` owns numeric and tabular evidence for subproblem N.
|
|
46
|
-
- `figures/qN` owns final visuals for subproblem N. Put diagnostic-only images
|
|
47
|
-
in a temporary build directory and remove them before handoff.
|
|
48
|
-
- `paper/sections/qN.tex` may consume only declared evidence from matching or
|
|
49
|
-
explicitly upstream result directories.
|
|
50
|
-
|
|
51
|
-
## Naming
|
|
52
|
-
|
|
53
|
-
- Use `q1`, `q2`, ... exactly; do not mix `Q1`, `question1`, or Chinese folder
|
|
54
|
-
names.
|
|
55
|
-
- Prefer descriptive Chinese artifact names when they improve hand editing.
|
|
56
|
-
- Use stable ASCII Python module names.
|
|
57
|
-
- Use UTF-8 for text and UTF-8 with BOM for CSV intended for Excel.
|
|
58
|
-
- Include units in column labels or metadata.
|
|
59
|
-
|
|
60
|
-
## Compatibility with legacy reproduction folders
|
|
61
|
-
|
|
62
|
-
Some existing projects place `question/` next to a `reproduce/` directory.
|
|
63
|
-
Read those inputs in place, but do not move them automatically. For a new
|
|
64
|
-
project, make `question/` a peer of `code/`, `results/`, `figures/`, and
|
|
65
|
-
`paper/` as the canonical structure above.
|
/package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/__init__.py
RENAMED
|
File without changes
|
/package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/requirements.txt
RENAMED
|
File without changes
|
/package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/ai-use-log.md
RENAMED
|
File without changes
|
/package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/abstract.tex
RENAMED
|
File without changes
|
|
File without changes
|
/package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/data.tex
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|