登记 chinese-poetry / ck12 / phet,并让 source schema、lint 与 INDEX 能按学科和抓取进度消费。 Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
@@ -2,7 +2,7 @@
|
||||
"""lint_sources.py — 校验 sources/ 资源清单合规。
|
||||
|
||||
检查项:
|
||||
- 每个 source 必填字段、id kebab-case 唯一、license/type/status 枚举合法
|
||||
- 每个 source 必填字段、id kebab-case 唯一、license/type/status/subjects 枚举合法
|
||||
- status=fetched 的 item 必须有 oss_key + 64位 sha256
|
||||
- license=unknown 且 fetched_at 距今 > 30 天 → warning
|
||||
|
||||
@@ -11,9 +11,12 @@
|
||||
import sys, os, glob, re, datetime, hashlib
|
||||
|
||||
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
LICENSES = {"official-free","cc-by","cc-by-sa","cc-nc-education","restricted","internal-only","llm-generated","unknown"}
|
||||
LICENSES = {"official-free","mit","cc-by","cc-by-sa","cc-nc-education","restricted","internal-only","llm-generated","unknown"}
|
||||
TYPES = {"dataset","website","book","internal","tool"}
|
||||
STATUSES = {"planned","fetching","fetched","failed","archived"}
|
||||
SUBJECTS = {"chinese","math","english","science","morality","physics","chemistry",
|
||||
"biology","history","geography","it","ket","pet","fce","amc8","cspj"}
|
||||
STAGES = {"primary","junior"}
|
||||
ID_RE = re.compile(r"^[a-z0-9][a-z0-9-]*$")
|
||||
SHA_RE = re.compile(r"^[a-f0-9]{64}$")
|
||||
|
||||
@@ -42,6 +45,13 @@ def main():
|
||||
if s.get("type") not in TYPES: err(f"{sid}: type 非法 {s.get('type')}"); errors += 1
|
||||
if s.get("license") not in LICENSES: err(f"{sid}: license 非法 {s.get('license')}"); errors += 1
|
||||
if s.get("status") not in STATUSES: err(f"{sid}: status 非法 {s.get('status')}"); errors += 1
|
||||
subs = s.get("subjects")
|
||||
if not subs: err(f"{sid}: 缺必填 subjects(覆盖学科,见 LICENSES.md 同级约定)"); errors += 1
|
||||
else:
|
||||
for x in subs:
|
||||
if x not in SUBJECTS: err(f"{sid}: subjects 含非法值 {x}"); errors += 1
|
||||
for x in (s.get("stages") or []):
|
||||
if x not in STAGES: err(f"{sid}: stages 含非法值 {x}"); errors += 1
|
||||
if s.get("license") == "unknown" and s.get("fetched_at"):
|
||||
try:
|
||||
d = datetime.date.fromisoformat(s["fetched_at"])
|
||||
|
||||
在新工单中引用
屏蔽一个用户