✨ feat(skills): add uncle-bob-craft third-party skill
This commit is contained in:
@@ -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"],
|
||||
|
||||
@@ -38,6 +38,7 @@ class SkillsReadmeTests(unittest.TestCase):
|
||||
self.assertIn("codebase-recon", text)
|
||||
self.assertIn("pathfinding", text)
|
||||
self.assertIn("codebase-migrate", text)
|
||||
self.assertIn("uncle-bob-craft", text)
|
||||
self.assertIn("已登记待同步", text)
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ class ThirdpartySkillCurationTests(unittest.TestCase):
|
||||
self.assertIn("upstream_path: codebase-migrate", text)
|
||||
self.assertIn("large codebase migrations", text)
|
||||
|
||||
self.assertIn("id: uncle-bob-craft", text)
|
||||
self.assertIn("upstream_repo: https://github.com/sickn33/antigravity-awesome-skills", text)
|
||||
self.assertIn("upstream_path: skills/uncle-bob-craft", text)
|
||||
self.assertIn("design-pattern misuse checks", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -56,6 +56,7 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
"brooks-lint",
|
||||
"codebase-recon",
|
||||
"codebase-migrate",
|
||||
"uncle-bob-craft",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -115,6 +116,22 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(migrate["include_skill_dirs"], ["codebase-migrate"])
|
||||
|
||||
craft = next(
|
||||
item for item in data["sources"] if item["id"] == "uncle-bob-craft"
|
||||
)
|
||||
self.assertEqual(
|
||||
craft["upstream_repo"],
|
||||
"https://github.com/sickn33/antigravity-awesome-skills.git",
|
||||
)
|
||||
self.assertEqual(craft["upstream_ref"], "main")
|
||||
self.assertEqual(craft["sync_mode"], "copy_skill_dirs")
|
||||
self.assertEqual(craft["snapshot_dir"], "antigravity-awesome-skills")
|
||||
self.assertEqual(craft["skills_subdir"], "skills")
|
||||
self.assertEqual(
|
||||
craft["source_list"], "skills/thirdparty/.sources/uncle-bob-craft.list"
|
||||
)
|
||||
self.assertEqual(craft["include_skill_dirs"], ["uncle-bob-craft"])
|
||||
|
||||
def test_superpowers_manifest_prunes_non_superpowers_paths(self):
|
||||
data = load_manifest()
|
||||
superpowers = next(item for item in data["sources"] if item["id"] == "superpowers")
|
||||
@@ -209,6 +226,26 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
clone_mirror = run_command("git", "clone", "--mirror", str(ROOT), str(mirror))
|
||||
self.assertEqual(clone_mirror.returncode, 0, msg=clone_mirror.stderr)
|
||||
|
||||
thirdparty_ref = run_command(
|
||||
"git",
|
||||
f"--git-dir={mirror}",
|
||||
"rev-parse",
|
||||
"refs/remotes/origin/thirdparty/skill",
|
||||
)
|
||||
self.assertEqual(thirdparty_ref.returncode, 0, msg=thirdparty_ref.stderr)
|
||||
expose_thirdparty_branch = run_command(
|
||||
"git",
|
||||
f"--git-dir={mirror}",
|
||||
"update-ref",
|
||||
"refs/heads/thirdparty/skill",
|
||||
thirdparty_ref.stdout.strip(),
|
||||
)
|
||||
self.assertEqual(
|
||||
expose_thirdparty_branch.returncode,
|
||||
0,
|
||||
msg=expose_thirdparty_branch.stderr,
|
||||
)
|
||||
|
||||
clone_work = run_command("git", "clone", str(mirror), str(work))
|
||||
self.assertEqual(clone_work.returncode, 0, msg=clone_work.stderr)
|
||||
|
||||
@@ -217,7 +254,16 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(set_remote.returncode, 0, msg=set_remote.stderr)
|
||||
|
||||
shutil.copy2(MANIFEST, work / ".gitea" / "ci" / "thirdparty_skills.json")
|
||||
manifest_data = load_manifest()
|
||||
manifest_data["sources"] = [
|
||||
entry
|
||||
for entry in manifest_data["sources"]
|
||||
if entry["id"] == "andrej-karpathy-skills"
|
||||
]
|
||||
(work / ".gitea" / "ci" / "thirdparty_skills.json").write_text(
|
||||
json.dumps(manifest_data, indent=2) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
shutil.copy2(SYNC_SCRIPT, work / ".gitea" / "ci" / "sync_thirdparty_skills.sh")
|
||||
|
||||
sync_result = run_command("bash", ".gitea/ci/sync_thirdparty_skills.sh", cwd=work)
|
||||
|
||||
Reference in New Issue
Block a user