@punal_manalan/blender-project-harness 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.kilo/agent/blender-grader.md +197 -0
- package/.kilo/agent/blender-worker.md +127 -0
- package/.kilo/blender-project-harness/config.example.json +71 -0
- package/.kilo/blender-project-harness/tools/harness/EXPECTED_FLOW.md +656 -0
- package/.kilo/blender-project-harness/tools/harness/blender-operations.mjs +882 -0
- package/.kilo/blender-project-harness/tools/harness/blender-operations.test.mjs +550 -0
- package/.kilo/blender-project-harness/tools/harness/blender.mjs +301 -0
- package/.kilo/blender-project-harness/tools/harness/blender.test.mjs +87 -0
- package/.kilo/blender-project-harness/tools/harness/cli.mjs +127 -0
- package/.kilo/blender-project-harness/tools/harness/documents.mjs +201 -0
- package/.kilo/blender-project-harness/tools/harness/download.mjs +94 -0
- package/.kilo/blender-project-harness/tools/harness/download.test.mjs +63 -0
- package/.kilo/blender-project-harness/tools/harness/engine.mjs +1866 -0
- package/.kilo/blender-project-harness/tools/harness/engine.test.mjs +2219 -0
- package/.kilo/blender-project-harness/tools/harness/intake.mjs +571 -0
- package/.kilo/blender-project-harness/tools/harness/intake.test.mjs +181 -0
- package/.kilo/blender-project-harness/tools/harness/package-lock.json +1227 -0
- package/.kilo/blender-project-harness/tools/harness/package.json +15 -0
- package/.kilo/blender-project-harness/tools/harness/plugin.mjs +550 -0
- package/.kilo/blender-project-harness/tools/harness/plugin.test.mjs +526 -0
- package/.kilo/blender-project-harness/tools/harness/proxy.mjs +222 -0
- package/.kilo/blender-project-harness/tools/harness/proxy.test.mjs +217 -0
- package/.kilo/blender-project-harness/tools/harness/scaffold.mjs +83 -0
- package/.kilo/blender-project-harness/tools/harness/scaffold.test.mjs +74 -0
- package/.kilo/blender-project-harness/tools/harness/server.mjs +24 -0
- package/.kilo/blender-project-harness/tools/harness/shell-policy.mjs +196 -0
- package/.kilo/blender-project-harness/tools/harness/shell-policy.test.mjs +68 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/ASSETS.md +29 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/DECISIONS.md +8 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/Goals/01-project-brief.md +71 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/Goals/README.md +17 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/INTAKE.md +8 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/README.md +57 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/REQUIREMENTS.md +64 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/REVIEW.md +29 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/References/README.md +18 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/Reviews/README.md +48 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/TASKSTRACKER.md +10 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/Tasks/README.md +4 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/Documents/WORKFLOW.md +36 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/README.md +130 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/README.md +31 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/audio/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/external/README.md +43 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/external/SOURCE_TEMPLATE.md +18 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/hdri/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/models/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/assets/textures/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/backups/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/backups/README.md +5 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/exports/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/exports/README.md +11 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/renders/README.md +7 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/renders/final/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/renders/wip/.gitkeep +0 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/scenes/README.md +10 -0
- package/.kilo/blender-project-harness/tools/harness/templates/project/scripts/README.md +16 -0
- package/.kilo/blender-project-harness/tools/harness/test-fixture.mjs +91 -0
- package/.kilo/blender-project-harness/tools/harness/workspace.mjs +30 -0
- package/.kilo/blender-project-harness/tools/harness/workspace.test.mjs +31 -0
- package/.kilo/blender-project-harness/tools/test_blender_tools.py +427 -0
- package/.kilo/plugins/blender-workflow.js +3 -0
- package/.kilo/skills/blender-assets/SKILL.md +99 -0
- package/.kilo/skills/blender-mcp/SKILL.md +147 -0
- package/.kilo/skills/blender-mcp/references/README.md +22 -0
- package/.kilo/skills/blender-mcp/references/animation.md +83 -0
- package/.kilo/skills/blender-mcp/references/bpy.md +97 -0
- package/.kilo/skills/blender-mcp/references/level-design.md +53 -0
- package/.kilo/skills/blender-mcp/references/materials.md +80 -0
- package/.kilo/skills/blender-mcp/references/retopology.md +104 -0
- package/.kilo/skills/blender-mcp/references/rigging.md +123 -0
- package/.kilo/skills/blender-mcp/references/scene.md +72 -0
- package/.kilo/skills/blender-project-goal/SKILL.md +115 -0
- package/.kilo/skills/blender-project-grading/SKILL.md +184 -0
- package/.kilo/skills/blender-project-readme/SKILL.md +46 -0
- package/.kilo/skills/blender-project-requirements/SKILL.md +84 -0
- package/.kilo/skills/blender-project-scaffold/SKILL.md +59 -0
- package/.kilo/skills/blender-project-workflow/SKILL.md +96 -0
- package/.kilo/skills/blender-subagents/SKILL.md +204 -0
- package/.kilo/skills/blender-workflow-harness/SKILL.md +187 -0
- package/AGENTS.md +234 -0
- package/Blender/README.md +30 -0
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +368 -2
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/bin/blender-project-harness.mjs +4 -0
- package/installer/cli.mjs +116 -0
- package/installer/install.mjs +325 -0
- package/installer/install.test.mjs +134 -0
- package/package.json +58 -6
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import re
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import tempfile
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import yaml
|
|
13
|
+
except ImportError:
|
|
14
|
+
yaml = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
ROOT = Path(__file__).resolve().parents[3]
|
|
18
|
+
TEMPLATE = Path(".kilo/blender-project-harness/tools/harness/templates/project")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class IgnoreTests(unittest.TestCase):
|
|
22
|
+
def test_nested_asset_metadata_not_binaries_is_trackable(self):
|
|
23
|
+
for ignore in (ROOT / ".gitignore", ROOT / TEMPLATE / ".gitignore"):
|
|
24
|
+
with self.subTest(ignore=ignore), tempfile.TemporaryDirectory() as directory:
|
|
25
|
+
root = Path(directory)
|
|
26
|
+
shutil.copy2(ignore, root / ".gitignore")
|
|
27
|
+
subprocess.run(["git", "init", "-q", str(root)], check=True, capture_output=True)
|
|
28
|
+
for name, ignored in (
|
|
29
|
+
("assets/external/vendor/asset/SOURCE.md", False),
|
|
30
|
+
("assets/external/vendor/asset/LICENSE.txt", False),
|
|
31
|
+
("assets/external/vendor/asset/README.md", False),
|
|
32
|
+
("assets/external/vendor/asset/model.glb", True),
|
|
33
|
+
("scene.blend12", True),
|
|
34
|
+
(".env", True), (".env.local", True), (".env.example", False),
|
|
35
|
+
("renders/wip/frame.png", True), ("renders/final/frame.png", False),
|
|
36
|
+
):
|
|
37
|
+
result = subprocess.run(["git", "-C", str(root), "check-ignore", "-q", "--", name],
|
|
38
|
+
capture_output=True)
|
|
39
|
+
self.assertEqual(result.returncode, int(not ignored), name)
|
|
40
|
+
|
|
41
|
+
def test_review_evidence_ignored_reports_tracked(self):
|
|
42
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
43
|
+
root = Path(directory)
|
|
44
|
+
reviews = root / "Documents/Reviews"
|
|
45
|
+
reviews.mkdir(parents=True)
|
|
46
|
+
shutil.copy2(ROOT / TEMPLATE / ".gitignore", root / ".gitignore")
|
|
47
|
+
shutil.copy2(ROOT / TEMPLATE / "Documents/Reviews/.gitignore", reviews / ".gitignore")
|
|
48
|
+
subprocess.run(["git", "init", "-q", str(root)], check=True, capture_output=True)
|
|
49
|
+
for name, ignored in (
|
|
50
|
+
("Documents/Reviews/R01-20261031T081500Z/_evidence/camera.png", True),
|
|
51
|
+
("Documents/Reviews/R01-20261031T081500Z/_evidence/scene.txt", True),
|
|
52
|
+
("Documents/Reviews/R01-20261031T081500Z/visual/tmp/notes.md", True),
|
|
53
|
+
("Documents/Reviews/R01-20261031T081500Z/manifest.json", False),
|
|
54
|
+
("Documents/Reviews/R01-20261031T081500Z/REVIEW.md", False),
|
|
55
|
+
("Documents/Reviews/R01-20261031T081500Z/visual/REPORT.md", False),
|
|
56
|
+
):
|
|
57
|
+
result = subprocess.run(["git", "-C", str(root), "check-ignore", "-q", "--", name],
|
|
58
|
+
capture_output=True)
|
|
59
|
+
self.assertEqual(result.returncode, int(not ignored), name)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class WorkspaceContractTests(unittest.TestCase):
|
|
63
|
+
@staticmethod
|
|
64
|
+
def permission_action(permissions, tool, target="*"):
|
|
65
|
+
result = "ask"
|
|
66
|
+
for pattern, rules in permissions.items():
|
|
67
|
+
tool_pattern = re.escape(pattern).replace(r"\*", ".*").replace(r"\?", ".")
|
|
68
|
+
if not re.fullmatch(tool_pattern, tool):
|
|
69
|
+
continue
|
|
70
|
+
if isinstance(rules, str):
|
|
71
|
+
result = rules
|
|
72
|
+
continue
|
|
73
|
+
for path_pattern, action in rules.items():
|
|
74
|
+
expression = re.escape(path_pattern).replace(r"\*", ".*").replace(r"\?", ".")
|
|
75
|
+
if re.fullmatch(expression, target):
|
|
76
|
+
result = action
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
def test_python_tools_parse_without_creating_bytecode(self):
|
|
80
|
+
for path in (ROOT / "tools").glob("*.py"):
|
|
81
|
+
with self.subTest(path=path.name):
|
|
82
|
+
tree = ast.parse(path.read_text(encoding="utf-8-sig"), filename=str(path))
|
|
83
|
+
for node in ast.walk(tree):
|
|
84
|
+
if isinstance(node, ast.ClassDef):
|
|
85
|
+
methods = [item.name for item in node.body
|
|
86
|
+
if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef))]
|
|
87
|
+
self.assertEqual(len(methods), len(set(methods)), f"Duplicate method in {node.name}")
|
|
88
|
+
|
|
89
|
+
def test_template_tokens_and_internal_links(self):
|
|
90
|
+
allowed = {"PROJECT_NAME", "PROJECT_SLUG", "DATE", "DESCRIPTION", "GOAL", "GOAL_TITLE"}
|
|
91
|
+
for path in (ROOT / TEMPLATE).rglob("*.md"):
|
|
92
|
+
text = path.read_text(encoding="utf-8")
|
|
93
|
+
with self.subTest(path=str(path.relative_to(ROOT / TEMPLATE))):
|
|
94
|
+
self.assertLessEqual(set(re.findall(r"\{\{([A-Z_]+)\}\}", text)), allowed)
|
|
95
|
+
for target in re.findall(r"\]\(([^)]+)\)", text):
|
|
96
|
+
if "://" not in target and not target.startswith("#"):
|
|
97
|
+
self.assertTrue((path.parent / target.split("#", 1)[0]).exists(), target)
|
|
98
|
+
|
|
99
|
+
def test_skill_template_references_resolve(self):
|
|
100
|
+
references = {
|
|
101
|
+
"blender-assets": "../../../.kilo/blender-project-harness/tools/harness/templates/project/assets/external/SOURCE_TEMPLATE.md",
|
|
102
|
+
"blender-project-goal": "../../../.kilo/blender-project-harness/tools/harness/templates/project/Documents/Goals/01-project-brief.md",
|
|
103
|
+
"blender-project-readme": "../../../.kilo/blender-project-harness/tools/harness/templates/project/README.md",
|
|
104
|
+
}
|
|
105
|
+
for name, relative in references.items():
|
|
106
|
+
skill = ROOT / ".kilo/skills" / name
|
|
107
|
+
with self.subTest(skill=name):
|
|
108
|
+
self.assertTrue((skill / relative).is_file())
|
|
109
|
+
self.assertIn(relative, (skill / "SKILL.md").read_text(encoding="utf-8"))
|
|
110
|
+
|
|
111
|
+
def test_workspace_markdown_links_resolve(self):
|
|
112
|
+
tracked = subprocess.run(["git", "-C", str(ROOT), "ls-files", "-z", "--", "*.md"],
|
|
113
|
+
check=True, capture_output=True).stdout.decode("utf-8").split("\0")
|
|
114
|
+
for name in filter(None, tracked):
|
|
115
|
+
path = ROOT / name
|
|
116
|
+
if not path.is_file():
|
|
117
|
+
continue
|
|
118
|
+
for target in re.findall(r"\]\(([^)]+)\)", path.read_text(encoding="utf-8")):
|
|
119
|
+
if "://" in target or target.startswith("#"):
|
|
120
|
+
continue
|
|
121
|
+
with self.subTest(path=name, target=target):
|
|
122
|
+
self.assertTrue((path.parent / target.split("#", 1)[0]).exists())
|
|
123
|
+
|
|
124
|
+
@unittest.skipUnless(yaml, "PyYAML required for frontmatter validation")
|
|
125
|
+
def test_skill_frontmatter_matches_discovery_contract(self):
|
|
126
|
+
skills = list((ROOT / ".kilo/skills").glob("*/SKILL.md"))
|
|
127
|
+
self.assertTrue(skills)
|
|
128
|
+
for path in skills:
|
|
129
|
+
with self.subTest(skill=path.parent.name):
|
|
130
|
+
text = path.read_text(encoding="utf-8")
|
|
131
|
+
self.assertTrue(text.startswith("---\n"))
|
|
132
|
+
metadata = yaml.safe_load(text.split("---", 2)[1])
|
|
133
|
+
self.assertEqual(metadata["name"], path.parent.name)
|
|
134
|
+
self.assertRegex(metadata["name"], r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
|
|
135
|
+
self.assertLessEqual(len(metadata["name"]), 64)
|
|
136
|
+
self.assertIsInstance(metadata["description"], str)
|
|
137
|
+
self.assertTrue(metadata["description"].strip())
|
|
138
|
+
self.assertLessEqual(len(metadata["description"]), 1024)
|
|
139
|
+
self.assertLessEqual(set(metadata), {
|
|
140
|
+
"name", "description", "license", "compatibility", "metadata", "allowed-tools"
|
|
141
|
+
})
|
|
142
|
+
if "compatibility" in metadata:
|
|
143
|
+
self.assertIsInstance(metadata["compatibility"], str)
|
|
144
|
+
self.assertTrue(1 <= len(metadata["compatibility"]) <= 500)
|
|
145
|
+
if "metadata" in metadata:
|
|
146
|
+
self.assertIsInstance(metadata["metadata"], dict)
|
|
147
|
+
self.assertTrue(all(isinstance(key, str) and isinstance(value, str)
|
|
148
|
+
for key, value in metadata["metadata"].items()))
|
|
149
|
+
self.assertTrue(text.split("---", 2)[2].strip())
|
|
150
|
+
|
|
151
|
+
@unittest.skipUnless(yaml, "PyYAML required for agent frontmatter validation")
|
|
152
|
+
def test_agent_frontmatter_and_default_permissions(self):
|
|
153
|
+
supported = {"description", "mode", "steps", "hidden", "permission", "model", "variant",
|
|
154
|
+
"temperature", "top_p", "color", "disable", "options", "prompt"}
|
|
155
|
+
for path in (ROOT / ".kilo/agent").glob("*.md"):
|
|
156
|
+
with self.subTest(agent=path.stem):
|
|
157
|
+
text = path.read_text(encoding="utf-8")
|
|
158
|
+
self.assertTrue(text.startswith("---\n"))
|
|
159
|
+
metadata = yaml.safe_load(text.split("---", 2)[1])
|
|
160
|
+
self.assertLessEqual(set(metadata), supported)
|
|
161
|
+
self.assertIsInstance(metadata["description"], str)
|
|
162
|
+
self.assertTrue(metadata["description"].strip())
|
|
163
|
+
self.assertEqual(metadata["mode"], "subagent")
|
|
164
|
+
self.assertIs(metadata["hidden"], True)
|
|
165
|
+
self.assertIs(type(metadata["steps"]), int)
|
|
166
|
+
self.assertGreater(metadata["steps"], 0)
|
|
167
|
+
permissions = metadata["permission"]
|
|
168
|
+
self.assertEqual(next(iter(permissions.items())), ("*", "deny"))
|
|
169
|
+
for tool in ("future_mutation_tool", "notify_user", "send_file", "blender_import_asset",
|
|
170
|
+
"blender_disable_telemetry", "mediamcp_generate_video", "generate_image"):
|
|
171
|
+
self.assertEqual(self.permission_action(permissions, tool), "deny", tool)
|
|
172
|
+
for tool in ("read", "glob", "grep"):
|
|
173
|
+
target = "Blender/Example/Documents/Reviews/R01-20261031T081500Z/_evidence/scene.txt"
|
|
174
|
+
self.assertEqual(self.permission_action(permissions, tool, target), "allow", tool)
|
|
175
|
+
self.assertEqual(self.permission_action(permissions, tool, ".kilo/blender-project-harness/config.json"), "deny", tool)
|
|
176
|
+
self.assertEqual(self.permission_action(permissions, tool, ".git/config"), "deny", tool)
|
|
177
|
+
self.assertEqual(self.permission_action(permissions, "context7_query-docs"), "allow")
|
|
178
|
+
|
|
179
|
+
@unittest.skipUnless(yaml, "PyYAML required for worker validation")
|
|
180
|
+
def test_worker_budgets_and_protected_paths(self):
|
|
181
|
+
worker = ROOT / ".kilo/agent/blender-worker.md"
|
|
182
|
+
metadata = yaml.safe_load(worker.read_text(encoding="utf-8").split("---", 2)[1])
|
|
183
|
+
self.assertEqual(metadata["mode"], "subagent")
|
|
184
|
+
self.assertIs(metadata["hidden"], True)
|
|
185
|
+
self.assertIs(type(metadata["steps"]), int)
|
|
186
|
+
self.assertGreater(metadata["steps"], 0)
|
|
187
|
+
permissions = metadata["permission"]
|
|
188
|
+
for tool in ("task", "agent_manager", "goal", "goal_report", "question", "bash",
|
|
189
|
+
"external_directory", "blender_generate_3d", "mediamcp_*", "generate_image"):
|
|
190
|
+
self.assertEqual(permissions[tool], "deny", tool)
|
|
191
|
+
self.assertEqual(list(permissions["edit"].items()), [("*", "deny")])
|
|
192
|
+
for target in ("Blender/Example/example.blend", "Blender/Example/Documents/DECISIONS.md",
|
|
193
|
+
"Blender/Example/README.md", "AGENTS.md", ".kilo/blender-project-harness/tools/harness/plugin.mjs"):
|
|
194
|
+
self.assertEqual(self.permission_action(permissions, "edit", target), "deny", target)
|
|
195
|
+
for path in (ROOT / ".kilo/blender-project-harness/config.example.json", ROOT / ".kilo/blender-project-harness/config.json"):
|
|
196
|
+
if not path.exists():
|
|
197
|
+
continue
|
|
198
|
+
with self.subTest(config=path.name):
|
|
199
|
+
roles = json.loads(path.read_text(encoding="utf-8-sig"))["blender_subagents"]
|
|
200
|
+
if "workers" not in roles:
|
|
201
|
+
self.assertNotEqual(path.name, "config.example.json")
|
|
202
|
+
continue
|
|
203
|
+
config = roles["workers"]
|
|
204
|
+
self.assertEqual(config["agent"], "blender-worker")
|
|
205
|
+
for field in ("provider", "model", "variant"):
|
|
206
|
+
self.assertIsInstance(config[field], str)
|
|
207
|
+
self.assertTrue(config[field].strip(), field)
|
|
208
|
+
for field in ("max_minutes", "max_steps", "max_failed_attempts", "max_parallel"):
|
|
209
|
+
self.assertIs(type(config[field]), int, field)
|
|
210
|
+
self.assertGreater(config[field], 0, field)
|
|
211
|
+
self.assertLessEqual(config["max_steps"], metadata["steps"])
|
|
212
|
+
self.assertIn(config["max_failed_attempts"], (1, 2))
|
|
213
|
+
self.assertEqual(config["max_parallel"], 1)
|
|
214
|
+
|
|
215
|
+
def test_subagent_roles_share_namespace(self):
|
|
216
|
+
for path in (ROOT / ".kilo/blender-project-harness/config.example.json", ROOT / ".kilo/blender-project-harness/config.json"):
|
|
217
|
+
if not path.exists():
|
|
218
|
+
continue
|
|
219
|
+
with self.subTest(config=path.name):
|
|
220
|
+
config = json.loads(path.read_text(encoding="utf-8-sig"))
|
|
221
|
+
self.assertNotIn("blender_graders", config)
|
|
222
|
+
roles = config["blender_subagents"]
|
|
223
|
+
self.assertIsInstance(roles, dict)
|
|
224
|
+
self.assertLessEqual(set(roles), {"workers", "graders"})
|
|
225
|
+
if path.name == "config.example.json":
|
|
226
|
+
self.assertEqual(set(roles), {"workers", "graders"})
|
|
227
|
+
for role in roles.values():
|
|
228
|
+
self.assertIsInstance(role, dict)
|
|
229
|
+
|
|
230
|
+
@unittest.skipUnless(yaml, "PyYAML required for grader validation")
|
|
231
|
+
def test_grader_agent_is_read_only_and_bounded(self):
|
|
232
|
+
agent = yaml.safe_load(
|
|
233
|
+
(ROOT / ".kilo/agent/blender-grader.md").read_text(encoding="utf-8").split("---", 2)[1]
|
|
234
|
+
)
|
|
235
|
+
self.assertEqual(agent["mode"], "subagent")
|
|
236
|
+
self.assertIs(agent["hidden"], True)
|
|
237
|
+
self.assertIs(type(agent["steps"]), int)
|
|
238
|
+
self.assertGreater(agent["steps"], 0)
|
|
239
|
+
permissions = agent["permission"]
|
|
240
|
+
for tool in ("task", "agent_manager", "goal", "goal_report", "question", "bash",
|
|
241
|
+
"external_directory", "blender_execute_blender_code", "blender_import_asset",
|
|
242
|
+
"blender_generate_3d", "mediamcp_*", "generate_image"):
|
|
243
|
+
self.assertEqual(permissions[tool], "deny", tool)
|
|
244
|
+
self.assertEqual(list(permissions["edit"].items()), [("*", "deny")])
|
|
245
|
+
self.assertEqual(permissions["blender_document"], "allow")
|
|
246
|
+
base = "Blender/Example/Documents/Reviews/R01-20261031T081500Z"
|
|
247
|
+
for target in (base + "/visual/REPORT.md", base + "/REVIEW.md", base + "/manifest.json",
|
|
248
|
+
base + "/README.md", base + "/_evidence/visual/REPORT.md",
|
|
249
|
+
base + "/tmp/visual/REPORT.md", "AGENTS.md", "Blender/Example/example.blend"):
|
|
250
|
+
self.assertEqual(self.permission_action(permissions, "edit", target), "deny", target)
|
|
251
|
+
body = (ROOT / ".kilo/agent/blender-grader.md").read_text(encoding="utf-8")
|
|
252
|
+
for expected in ("REPORT.md", "PASS", "CHANGES_REQUIRED", "BLOCKED", "blender_document"):
|
|
253
|
+
self.assertIn(expected, body)
|
|
254
|
+
self.assertNotIn("Binary verdict", body)
|
|
255
|
+
self.assertNotIn("valid but unusual", body)
|
|
256
|
+
self.assertIn("do not read other graders' reports from the current round", body)
|
|
257
|
+
self.assertIn("Read only the prior reports explicitly named for re-review", body)
|
|
258
|
+
|
|
259
|
+
@unittest.skipUnless(yaml, "PyYAML required for embedded config validation")
|
|
260
|
+
def test_embedded_roster_examples_obey_parallel_budget(self):
|
|
261
|
+
for name in ("blender-subagents", "blender-project-grading"):
|
|
262
|
+
text = (ROOT / f".kilo/skills/{name}/SKILL.md").read_text(encoding="utf-8")
|
|
263
|
+
grader_examples = 0
|
|
264
|
+
for snippet in re.findall(r"```json\n(.*?)\n```", text, flags=re.DOTALL):
|
|
265
|
+
config = json.loads(snippet)
|
|
266
|
+
self.assertEqual(set(config), {"blender_subagents"}, name)
|
|
267
|
+
roles = config["blender_subagents"]
|
|
268
|
+
self.assertTrue(roles, name)
|
|
269
|
+
self.assertLessEqual(set(roles), {"workers", "graders"}, name)
|
|
270
|
+
if "graders" in roles:
|
|
271
|
+
grader_examples += 1
|
|
272
|
+
graders = roles["graders"]
|
|
273
|
+
self.assertLessEqual(graders["max_parallel"], len(graders["graders"]), name)
|
|
274
|
+
self.assertGreater(grader_examples, 0, name)
|
|
275
|
+
|
|
276
|
+
def test_review_round_names_and_approval_gates_are_dynamic(self):
|
|
277
|
+
paths = [ROOT / ".kilo/skills/blender-project-grading/SKILL.md",
|
|
278
|
+
ROOT / TEMPLATE / "Documents/Reviews/README.md"]
|
|
279
|
+
for path in paths:
|
|
280
|
+
with self.subTest(path=path.name):
|
|
281
|
+
text = path.read_text(encoding="utf-8")
|
|
282
|
+
self.assertIn("R<NN>-<yyyyMMddTHHmmssZ>", text)
|
|
283
|
+
self.assertIn("UTC", text)
|
|
284
|
+
self.assertNotRegex(text, r"R\d+-\d{8}T\d{6}Z")
|
|
285
|
+
grading = paths[0].read_text(encoding="utf-8")
|
|
286
|
+
self.assertIn("project-wide round number", grading)
|
|
287
|
+
self.assertIn("before the change commit", grading)
|
|
288
|
+
self.assertIn("NEVER permit peer report reads", grading)
|
|
289
|
+
self.assertNotIn("Round: R01", grading)
|
|
290
|
+
self.assertNotIn("Documents/Goals/01-project-brief.md", grading)
|
|
291
|
+
|
|
292
|
+
@unittest.skipUnless(yaml, "PyYAML required for grader validation")
|
|
293
|
+
def test_grader_config_example_is_valid(self):
|
|
294
|
+
agent = yaml.safe_load(
|
|
295
|
+
(ROOT / ".kilo/agent/blender-grader.md").read_text(encoding="utf-8").split("---", 2)[1]
|
|
296
|
+
)
|
|
297
|
+
graders = json.loads(
|
|
298
|
+
(ROOT / ".kilo/blender-project-harness/config.example.json").read_text(encoding="utf-8-sig")
|
|
299
|
+
)["blender_subagents"]["graders"]
|
|
300
|
+
self.assertEqual(graders["agent"], "blender-grader")
|
|
301
|
+
self.assertIs(type(graders["enabled"]), bool)
|
|
302
|
+
roster = graders["graders"]
|
|
303
|
+
self.assertTrue(1 <= len(roster) <= 7)
|
|
304
|
+
self.assertIs(type(graders["max_parallel"]), int)
|
|
305
|
+
self.assertTrue(1 <= graders["max_parallel"] <= len(roster))
|
|
306
|
+
self.assertIs(type(graders["max_rounds"]), int)
|
|
307
|
+
self.assertTrue(1 <= graders["max_rounds"] <= 4)
|
|
308
|
+
names = [item["name"] for item in roster]
|
|
309
|
+
self.assertEqual(len(names), len(set(names)))
|
|
310
|
+
for item in roster:
|
|
311
|
+
with self.subTest(grader=item["name"]):
|
|
312
|
+
self.assertRegex(item["name"], r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
|
|
313
|
+
self.assertTrue(item["focus"].strip())
|
|
314
|
+
for field in ("provider", "model", "variant"):
|
|
315
|
+
self.assertIsInstance(item[field], str)
|
|
316
|
+
self.assertTrue(item[field].strip(), field)
|
|
317
|
+
for field in ("max_minutes", "max_steps"):
|
|
318
|
+
self.assertIs(type(item[field]), int, field)
|
|
319
|
+
self.assertGreater(item[field], 0, field)
|
|
320
|
+
self.assertLessEqual(item["max_steps"], agent["steps"])
|
|
321
|
+
|
|
322
|
+
def test_review_mode_and_round_templates(self):
|
|
323
|
+
review = (ROOT / TEMPLATE / "Documents/REVIEW.md").read_text(encoding="utf-8")
|
|
324
|
+
for expected in ("Mode: Unset", "Single grader:", "`Off`", "`All`", "`Single`"):
|
|
325
|
+
self.assertIn(expected, review)
|
|
326
|
+
rounds = (ROOT / TEMPLATE / "Documents/Reviews/README.md").read_text(encoding="utf-8")
|
|
327
|
+
for expected in ("manifest.json", "REVIEW.md", "REPORT.md", "_evidence/"):
|
|
328
|
+
self.assertIn(expected, rounds)
|
|
329
|
+
ignore = (ROOT / TEMPLATE / "Documents/Reviews/.gitignore").read_text(encoding="utf-8")
|
|
330
|
+
self.assertIn("**/_evidence/", ignore)
|
|
331
|
+
self.assertIn("**/tmp/", ignore)
|
|
332
|
+
brief = (ROOT / TEMPLATE / "Documents/Goals/01-project-brief.md").read_text(encoding="utf-8")
|
|
333
|
+
self.assertIn("`../REVIEW.md`", brief)
|
|
334
|
+
self.assertIn("review answers", brief)
|
|
335
|
+
scaffold = (ROOT / ".kilo/skills/blender-project-scaffold/SKILL.md").read_text(encoding="utf-8")
|
|
336
|
+
self.assertIn("node .kilo/blender-project-harness/tools/harness/cli.mjs scaffold", scaffold)
|
|
337
|
+
self.assertIn(".kilo/blender-project-harness/tools/harness/templates/project", scaffold)
|
|
338
|
+
self.assertNotIn("## Project structure", scaffold)
|
|
339
|
+
|
|
340
|
+
def test_atomic_commit_policy_is_mandatory(self):
|
|
341
|
+
policy_files = [ROOT / "AGENTS.md", ROOT / "README.md",
|
|
342
|
+
*sorted((ROOT / ".kilo/skills").rglob("SKILL.md"))]
|
|
343
|
+
forbidden = re.compile(
|
|
344
|
+
r"commit only (?:when|if|after)|explicit user authorization|authorizes commits",
|
|
345
|
+
re.IGNORECASE,
|
|
346
|
+
)
|
|
347
|
+
for path in policy_files:
|
|
348
|
+
with self.subTest(path=str(path.relative_to(ROOT))):
|
|
349
|
+
self.assertNotRegex(path.read_text(encoding="utf-8"), forbidden)
|
|
350
|
+
self.assertIn("commit atomically", (ROOT / "AGENTS.md").read_text(encoding="utf-8").lower())
|
|
351
|
+
|
|
352
|
+
def test_questions_precede_goals_and_partial_mode_pauses(self):
|
|
353
|
+
goal = (ROOT / ".kilo/skills/blender-project-goal/SKILL.md").read_text(encoding="utf-8")
|
|
354
|
+
workflow = (ROOT / ".kilo/skills/blender-project-workflow/SKILL.md").read_text(encoding="utf-8")
|
|
355
|
+
brief = (ROOT / TEMPLATE / "Documents/Goals/01-project-brief.md").read_text(encoding="utf-8")
|
|
356
|
+
for text in (workflow, brief):
|
|
357
|
+
self.assertIn("blender-project-goal", text)
|
|
358
|
+
self.assertIn('goal_report(status="blocked"', goal)
|
|
359
|
+
self.assertIn('goal(action="resume")', goal)
|
|
360
|
+
self.assertIn('goal(action="start", objective=', goal)
|
|
361
|
+
self.assertIn("`question` is unavailable", workflow)
|
|
362
|
+
self.assertIn("ordinary chat", goal)
|
|
363
|
+
self.assertIn("entire filled prompt", goal)
|
|
364
|
+
self.assertIn("this entire filled prompt", brief)
|
|
365
|
+
|
|
366
|
+
def test_agent_instructions_keep_goal_controls_with_orchestrator(self):
|
|
367
|
+
paths = [ROOT / "AGENTS.md", *sorted((ROOT / ".kilo/skills").rglob("*.md"))]
|
|
368
|
+
for path in paths:
|
|
369
|
+
with self.subTest(path=str(path.relative_to(ROOT))):
|
|
370
|
+
text = path.read_text(encoding="utf-8")
|
|
371
|
+
self.assertFalse(re.search(r"(?<![\w])/goal(?:[\s`]|$)", text),
|
|
372
|
+
"Goal slash commands must not be assigned to the user")
|
|
373
|
+
self.assertFalse(re.search(r'goal\(action=["\'](?:pause|clear|update)["\']', text),
|
|
374
|
+
"Only supported goal actions may be documented")
|
|
375
|
+
goal = (ROOT / ".kilo/skills/blender-project-goal/SKILL.md").read_text(encoding="utf-8")
|
|
376
|
+
for expected in ("orchestrator owns", "already paused", "no successful action",
|
|
377
|
+
"next ordinary user turn", "not approval", "registration",
|
|
378
|
+
"A final response alone does not prove", "runtime receipt"):
|
|
379
|
+
self.assertIn(expected, goal)
|
|
380
|
+
|
|
381
|
+
def test_reference_guides_are_attributed(self):
|
|
382
|
+
references = ROOT / ".kilo/skills/blender-mcp/references"
|
|
383
|
+
index = (references / "README.md").read_text(encoding="utf-8")
|
|
384
|
+
guides = sorted(path.name for path in references.glob("*.md") if path.name != "README.md")
|
|
385
|
+
self.assertTrue(guides)
|
|
386
|
+
for guide in guides:
|
|
387
|
+
with self.subTest(guide=guide):
|
|
388
|
+
self.assertIn(f"`{guide}`", index)
|
|
389
|
+
notices = (ROOT / "THIRD_PARTY_NOTICES.md").read_text(encoding="utf-8")
|
|
390
|
+
self.assertIn("Copyright (c) 2025 Siddharth Ahuja", notices)
|
|
391
|
+
self.assertIn("MIT License", notices)
|
|
392
|
+
for guide in guides:
|
|
393
|
+
self.assertIn(guide, notices)
|
|
394
|
+
self.assertIn("Copyright (c) 2026 Punal Manalan",
|
|
395
|
+
(ROOT / "LICENSE").read_text(encoding="utf-8"))
|
|
396
|
+
|
|
397
|
+
def test_reference_python_examples_parse(self):
|
|
398
|
+
references = ROOT / ".kilo/skills/blender-mcp/references"
|
|
399
|
+
for path in references.glob("*.md"):
|
|
400
|
+
text = path.read_text(encoding="utf-8")
|
|
401
|
+
for index, snippet in enumerate(re.findall(
|
|
402
|
+
r"^[ \t]*```python\n(.*?)^[ \t]*```", text, flags=re.MULTILINE | re.DOTALL)):
|
|
403
|
+
lines = snippet.splitlines()
|
|
404
|
+
indentation = min((len(line) - len(line.lstrip()) for line in lines if line.strip()), default=0)
|
|
405
|
+
source = "\n".join(line[indentation:] for line in lines)
|
|
406
|
+
with self.subTest(path=path.name, example=index):
|
|
407
|
+
ast.parse(source, filename=f"{path.name}:example-{index}")
|
|
408
|
+
|
|
409
|
+
def test_animation_example_handles_missing_slot_without_import(self):
|
|
410
|
+
from types import SimpleNamespace
|
|
411
|
+
|
|
412
|
+
guide = (ROOT / ".kilo/skills/blender-mcp/references/animation.md").read_text(encoding="utf-8")
|
|
413
|
+
snippet = next(code for code in re.findall(r"```python\n(.*?)\n```", guide, flags=re.DOTALL)
|
|
414
|
+
if "def fcurves(obj):" in code)
|
|
415
|
+
namespace = {}
|
|
416
|
+
exec(compile(snippet, "animation.md:fcurves", "exec"), namespace)
|
|
417
|
+
fcurves = namespace["fcurves"]
|
|
418
|
+
self.assertEqual(fcurves(SimpleNamespace(animation_data=None)), [])
|
|
419
|
+
self.assertEqual(fcurves(SimpleNamespace(animation_data=SimpleNamespace(action=None))), [])
|
|
420
|
+
layered = SimpleNamespace(action=SimpleNamespace(is_action_layered=True), action_slot=None)
|
|
421
|
+
self.assertEqual(fcurves(SimpleNamespace(animation_data=layered)), [])
|
|
422
|
+
legacy = SimpleNamespace(action=SimpleNamespace(is_action_layered=False, fcurves=["curve"]))
|
|
423
|
+
self.assertEqual(fcurves(SimpleNamespace(animation_data=legacy)), ["curve"])
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
if __name__ == "__main__":
|
|
427
|
+
unittest.main()
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: blender-assets
|
|
3
|
+
description: Use when adding, importing, linking, packing, or delivering external Blender assets. Enforces registration, licences, relative paths, and delivery checks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Blender Assets
|
|
7
|
+
|
|
8
|
+
Project paths are relative to `Blender/<Project>/`. External assets and derivatives MUST be
|
|
9
|
+
registered before use.
|
|
10
|
+
|
|
11
|
+
## Folder policy
|
|
12
|
+
|
|
13
|
+
- Project-owned files: `assets/textures/`, `assets/hdri/`, `assets/models/`, `assets/audio/`.
|
|
14
|
+
- Third-party files and derivatives:
|
|
15
|
+
`assets/external/<source-or-vendor>/<asset>/`. Modification does not remove source or licence
|
|
16
|
+
duties.
|
|
17
|
+
- Register every third-party original and derivative in `Documents/ASSETS.md`.
|
|
18
|
+
- Keep `SOURCE.md` and a verbatim `LICENSE.txt` beside every external asset. Preserve original
|
|
19
|
+
licence files. Use
|
|
20
|
+
`../../../.kilo/blender-project-harness/tools/harness/templates/project/assets/external/SOURCE_TEMPLATE.md`
|
|
21
|
+
as the source metadata template.
|
|
22
|
+
|
|
23
|
+
## Harness intake
|
|
24
|
+
|
|
25
|
+
The user does not need to create folders or copy files. Use `blender_workflow {action:"intake"}`.
|
|
26
|
+
|
|
27
|
+
- `scan:true` inspects explicit files or folders without writing the project. Use it during
|
|
28
|
+
requirements discovery.
|
|
29
|
+
- `scan:false` copies accepted files into an open bounded change and adds their exact paths to the
|
|
30
|
+
change. It writes `SOURCE.md`, `LICENSE.txt`, `Documents/INTAKE.md`, `Documents/ASSETS.md`, and
|
|
31
|
+
`Documents/References/README.md` as applicable, including MIME type, bytes, dimensions, and
|
|
32
|
+
SHA-256. File signatures are checked against the extension.
|
|
33
|
+
- Rejections, hashes, and duplicates are reported. The original files are never moved or deleted.
|
|
34
|
+
- `download` fetches a public HTTPS asset into ignored `.temp/Intake/<project>/...` staging. It does
|
|
35
|
+
not import or register it. Pass the returned path to `intake` with source and licence details.
|
|
36
|
+
No credentials, private hosts, authentication bypass, CAPTCHA bypass, or unlimited scope.
|
|
37
|
+
- Browser/provider and user-assisted files return through `intake` with their actual local path.
|
|
38
|
+
Never ask the user to move a file into the project.
|
|
39
|
+
- Media generation belongs to the agent. Use the configured Media MCP only after explicit permission,
|
|
40
|
+
save the actual file, inspect it, and pass its path to `intake` with `generated` metadata. Display
|
|
41
|
+
it and ask before using it as a texture or reference. Never substitute a fake image.
|
|
42
|
+
- Project-owned models, textures, HDRIs, and audio use `source.external:false`; third-party files
|
|
43
|
+
require `source.license` and verbatim `source.licenseText` or `source.licenseFile`.
|
|
44
|
+
- Do not use shell copy, direct project writes, or manual Git for user files.
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
1. Ask how the user wants assets sourced: use supplied files, search/download, project-owned
|
|
49
|
+
primitives/materials, or a mix. Ask for exact paths when files are supplied.
|
|
50
|
+
2. If download is chosen, search first, inspect licence and size, then use `download` to stage. If the
|
|
51
|
+
provider is not supported, ask the user to supply the file rather than inventing a URL.
|
|
52
|
+
3. Scan with `intake`; resolve rejected files, missing licences, and ambiguous use.
|
|
53
|
+
4. Open the bounded change with the intake document path, then call `intake` with `scan:false`. The
|
|
54
|
+
action copies files and registers metadata.
|
|
55
|
+
5. Import a local model with the reviewed `import_asset` operation, link a `.blend` library with
|
|
56
|
+
`link_library`, import audio with `import_audio`, and use `image_texture` or `world_hdri` for local
|
|
57
|
+
images. Paths stay project-relative (`assets/...`). NEVER leave absolute paths. Declare the
|
|
58
|
+
import's parent Empty name in `begin.objects`; inspect the imported children after the apply and
|
|
59
|
+
use `extend` if later operations need to target them.
|
|
60
|
+
6. Check missing and packed files with `check_assets`; use `{strict:true}` on the final scene so a
|
|
61
|
+
missing external file fails the apply. Pack only when the licence permits redistribution with
|
|
62
|
+
`pack_assets`.
|
|
63
|
+
7. Record whether the `.blend` links, packs, or embeds the asset. Packed or embedded bytes remain
|
|
64
|
+
third-party data even when source binaries are ignored.
|
|
65
|
+
|
|
66
|
+
The raw `blender_import_asset`, `blender_generate_3d`, and arbitrary project Python remain blocked.
|
|
67
|
+
Asset search does not authorize a remote import. Generated images are registered with `intake`
|
|
68
|
+
using `generated` metadata; they are not automatically scene assets.
|
|
69
|
+
|
|
70
|
+
## Git and delivery
|
|
71
|
+
|
|
72
|
+
- External asset binaries are ignored by default.
|
|
73
|
+
- Commit only assets whose `SOURCE.md` says `Redistribution allowed: yes`. The harness rejects a
|
|
74
|
+
tracked or force-staged external binary without that clearance.
|
|
75
|
+
- Use Git LFS for large redistributable binaries.
|
|
76
|
+
- NEVER commit non-redistributable assets, credentials, or paid asset packs.
|
|
77
|
+
- A tracked `.blend` with packed or embedded third-party data is a redistribution. Verify licence,
|
|
78
|
+
attribution, and delivery rights before commit or delivery.
|
|
79
|
+
- Required metadata MUST be tracked with the project.
|
|
80
|
+
- Re-check missing files and packed/embedded data before delivery.
|
|
81
|
+
|
|
82
|
+
## Validation
|
|
83
|
+
|
|
84
|
+
- Run `check_assets` with `{strict:true}` on the final scene before sealing. It fails on missing
|
|
85
|
+
external files. Completion is denied after asset use until the strict receipt is sealed on the
|
|
86
|
+
final unchanged scene.
|
|
87
|
+
- Keep paths project-relative; verify moving the project folder does not break the scene.
|
|
88
|
+
- Run `pack_assets` only after licence review when packing is required.
|
|
89
|
+
- Require an `ASSETS.md` row for every third-party asset and derivative, with asset ID, type,
|
|
90
|
+
local path, source, licence, SHA-256, packaging, preview path when available, scene use, and
|
|
91
|
+
redistribution status.
|
|
92
|
+
- Require `SOURCE.md` and verbatim `LICENSE.txt` in every external asset folder.
|
|
93
|
+
- Require a registered source, licence, and packaging decision for every linked, packed, or embedded
|
|
94
|
+
third-party datablock.
|
|
95
|
+
- Require a harness export receipt with format, path, bytes, SHA-256, source scene, and signature for
|
|
96
|
+
every produced export. A missing or changed export blocks completion.
|
|
97
|
+
|
|
98
|
+
For delivery, pack external data only when its licence permits redistribution, or ship the documented
|
|
99
|
+
asset folders. Re-run missing-file checks and inspect packed/embedded data before delivery.
|