feat(skills): add uncle-bob-craft third-party skill

This commit is contained in:
csh
2026-05-31 13:43:49 +08:00
parent 7db5e4a697
commit 7656ee2907
8 changed files with 146 additions and 5 deletions
+41 -2
View File
@@ -1,3 +1,5 @@
import json
import shutil
import subprocess
import sys
import tempfile
@@ -380,6 +382,34 @@ skills = ["brainstorming"]
)
self.assertEqual(clone_mirror.returncode, 0, msg=clone_mirror.stderr)
thirdparty_ref = subprocess.run(
[
"git",
f"--git-dir={mirror}",
"rev-parse",
"refs/remotes/origin/thirdparty/skill",
],
capture_output=True,
text=True,
)
self.assertEqual(thirdparty_ref.returncode, 0, msg=thirdparty_ref.stderr)
expose_thirdparty_branch = subprocess.run(
[
"git",
f"--git-dir={mirror}",
"update-ref",
"refs/heads/thirdparty/skill",
thirdparty_ref.stdout.strip(),
],
capture_output=True,
text=True,
)
self.assertEqual(
expose_thirdparty_branch.returncode,
0,
msg=expose_thirdparty_branch.stderr,
)
clone_repo = subprocess.run(
["git", "clone", str(mirror), str(repo)],
capture_output=True,
@@ -396,10 +426,19 @@ skills = ["brainstorming"]
manifest_src = ROOT / ".gitea" / "ci" / "thirdparty_skills.json"
manifest_dst = repo / ".gitea" / "ci" / "thirdparty_skills.json"
manifest_dst.write_text(manifest_src.read_text(encoding="utf-8"), encoding="utf-8")
manifest_data = json.loads(manifest_src.read_text(encoding="utf-8"))
manifest_data["sources"] = [
entry
for entry in manifest_data["sources"]
if entry["id"] == "andrej-karpathy-skills"
]
manifest_dst.write_text(
json.dumps(manifest_data, indent=2) + "\n",
encoding="utf-8",
)
sync_src = ROOT / ".gitea" / "ci" / "sync_thirdparty_skills.sh"
sync_dst = repo / ".gitea" / "ci" / "sync_thirdparty_skills.sh"
sync_dst.write_text(sync_src.read_text(encoding="utf-8"), encoding="utf-8")
shutil.copy2(sync_src, sync_dst)
sync_result = subprocess.run(
["bash", ".gitea/ci/sync_thirdparty_skills.sh"],