Align skill package checks and include notices in archives
Check instruction packages / check (push) Successful in 2s
Check instruction packages / check (push) Successful in 2s
This commit is contained in:
1 parent
6e6a691b68
commit
370416b87b
3 files changed
+42
-7
No files matched your search
@@ -3,6 +3,7 @@ import hashlib
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from tools.packages import PackageError, check_package, package_archive
|
||||
@@ -70,6 +71,31 @@ class PackageTests(unittest.TestCase):
|
||||
with self.assertRaises(PackageError):
|
||||
check_package(package)
|
||||
|
||||
def test_rejects_owner_incompatible_frontmatter_values(self):
|
||||
for old, new in (
|
||||
("metadata:\n", "disable-model-invocation: yes\nmetadata:\n"),
|
||||
("description: Check a Planner's issue scope and evidence before drafting a Plan.", "description: "),
|
||||
):
|
||||
with self.subTest(new=new), tempfile.TemporaryDirectory() as directory:
|
||||
package = Path(directory) / "planner-scope"
|
||||
shutil.copytree(ROOT / "packages/planner-scope", package)
|
||||
skill = package / "SKILL.md"
|
||||
skill.write_text(skill.read_text().replace(old, new))
|
||||
manifest = package / "relayview-skill.json"
|
||||
data = json.loads(manifest.read_text())
|
||||
next(item for item in data["files"] if item["path"] == "SKILL.md")["sha256"] = hashlib.sha256(skill.read_bytes()).hexdigest()
|
||||
manifest.write_text(json.dumps(data))
|
||||
with self.assertRaises(PackageError):
|
||||
check_package(package)
|
||||
|
||||
def test_archive_carries_license_and_notice(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
archive_path = Path(directory) / "planner-scope.zip"
|
||||
package_archive(ROOT / "packages/planner-scope", archive_path)
|
||||
with zipfile.ZipFile(archive_path) as archive:
|
||||
self.assertEqual(archive.read("LICENSE"), (ROOT / "LICENSE").read_bytes())
|
||||
self.assertEqual(archive.read("NOTICE.md"), (ROOT / "NOTICE.md").read_bytes())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user