feat: 补 MIT 许可、自动抓取工具与学科覆盖元数据
一些检查失败了
ci / lint (push) Failing after 52s

登记 chinese-poetry / ck12 / phet,并让 source schema、lint 与 INDEX 能按学科和抓取进度消费。

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
2026-08-22 01:27:25 +08:00
父节点 4c054340dc
当前提交 a006c8c504
共有 23 个文件被更改,包括 2510 次插入 和 111 次删除

查看文件

@@ -16,6 +16,9 @@
"""
import os, sys, glob, json, hashlib, datetime, argparse, yaml
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from yaml_patch import patch_item_fields, patch_source_fields
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SHA_RE = __import__("re").compile(r"^[a-f0-9]{64}$")
@@ -87,19 +90,16 @@ def main():
for path, sid, iid, local, oss_key, sha, size in pending:
b.put_object_from_file(oss_key, local)
print(f" uploaded {oss_key}")
# 回填
doc = yaml.safe_load(open(path, encoding="utf-8"))
for s in doc["sources"]:
if s.get("id") == sid:
for it in s.get("items", []):
if it.get("id") == iid:
it["oss_key"] = oss_key
it["sha256"] = sha
it["size"] = size
it["fetch_date"] = today
it["status"] = "fetched"
yaml.safe_dump(doc, open(path, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False)
print("已回填 sha256/size 到 sources YAML。请 git commit。")
# 回填(行级替换,保留 YAML 注释;勿用 safe_dump 整file重写)
patch_item_fields(path, sid, iid, {
"oss_key": oss_key,
"sha256": sha,
"size": size,
"fetch_date": today,
"status": "fetched",
})
patch_source_fields(path, sid, {"status": "fetched", "fetched_at": today})
print("已回填 oss_key/sha256/size 到 sources YAML(注释保留)。请 git commit。")
if __name__ == "__main__":
main()