agent-manifesto-kit 1.8.3 → 1.8.4

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.
Files changed (44) hide show
  1. package/README.md +29 -2
  2. package/collection/bundles/game-dev/README.md +69 -0
  3. package/collection/bundles/game-dev/RECOMMENDS.md +24 -0
  4. package/collection/bundles/game-dev/agents/game-code-reviewer.md +36 -0
  5. package/collection/bundles/game-dev/agents/game-image-generator.md +34 -0
  6. package/collection/bundles/game-dev/agents/game-visual-reviewer.md +34 -0
  7. package/collection/bundles/game-dev/skills/game-code/SKILL.md +54 -0
  8. package/collection/bundles/game-dev/skills/game-code/agents/openai.yaml +4 -0
  9. package/collection/bundles/game-dev/skills/game-code/references/engine-godot.md +45 -0
  10. package/collection/bundles/game-dev/skills/game-code/references/engine-threejs.md +47 -0
  11. package/collection/bundles/game-dev/skills/game-delegation/SKILL.md +58 -0
  12. package/collection/bundles/game-dev/skills/game-delegation/agents/openai.yaml +4 -0
  13. package/collection/bundles/game-dev/skills/game-dev-setup/SKILL.md +103 -0
  14. package/collection/bundles/game-dev/skills/game-dev-setup/agents/openai.yaml +4 -0
  15. package/collection/bundles/game-dev/skills/game-dev-setup/assets/agents-section.md +20 -0
  16. package/collection/bundles/game-dev/skills/game-dev-setup/references/config.md +46 -0
  17. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/audit.py +202 -0
  18. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/balance.py +197 -0
  19. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/check.py +62 -0
  20. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/delegate.py +350 -0
  21. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/gamedev_config.py +163 -0
  22. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/install.py +172 -0
  23. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/instruction_size.py +75 -0
  24. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/code_review.md +19 -0
  25. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/image.md +5 -0
  26. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/visual_review.md +13 -0
  27. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/pyramid.py +84 -0
  28. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/test_game_dev.py +309 -0
  29. package/collection/bundles/game-dev/skills/game-planning/SKILL.md +80 -0
  30. package/collection/bundles/game-dev/skills/game-planning/agents/openai.yaml +4 -0
  31. package/collection/bundles/game-dev/skills/game-testing/SKILL.md +58 -0
  32. package/collection/bundles/game-dev/skills/game-testing/agents/openai.yaml +4 -0
  33. package/collection/bundles/kit-adopt/conventions/recommended-companions.md +1 -1
  34. package/collection/skills/astro-preview/SKILL.md +97 -41
  35. package/collection/skills/astro-preview/references/manifest.md +42 -0
  36. package/collection/skills/astro-preview/scripts/portal.py +686 -0
  37. package/collection/skills/astro-preview/scripts/test_portal.py +576 -0
  38. package/collection/skills/mixamo/SKILL.md +109 -0
  39. package/collection/skills/mixamo/agents/openai.yaml +4 -0
  40. package/collection/skills/mixamo/scripts/mixamo.py +264 -0
  41. package/collection/skills/mixamo/scripts/test_mixamo.py +108 -0
  42. package/collection/skills/sfx-creator/SKILL.md +160 -0
  43. package/collection/skills/sfx-creator/agents/openai.yaml +4 -0
  44. package/package.json +1 -1
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: mixamo
3
+ description: Rig a humanoid 3D model and download animations from Mixamo through its web API with the user's token - upload a character, auto-rig it with markers, search the animation library, download FBX clips. Use when a humanoid model needs a skeleton or animations from Mixamo, or the user mentions Mixamo.
4
+ ---
5
+
6
+ # Mixamo
7
+
8
+ ## Scope
9
+
10
+ A humanoid model needs a skeleton, skin weights or animations from Mixamo. Only humanoids: Mixamo's auto-rigger
11
+ knows no other body. Not for non-humanoid rigs, hand animation or retargeting between skeletons.
12
+
13
+ ## Prerequisites
14
+
15
+ - Python 3.9 or later; the script uses only the standard library. Verify with `python3 --version`.
16
+ - A Mixamo account (Adobe ID) of the user's own, signed in at [mixamo.com](https://www.mixamo.com/) in their browser.
17
+ - The user's Mixamo bearer token, supplied by the user. The agent never signs in, never types credentials and
18
+ never extracts the token from a browser itself. The user copies it from their own signed-in session (the
19
+ `Authorization: Bearer ...` header of a mixamo.com API request in the browser's developer tools) and stores it
20
+ in one of these places; the script uses the first that is set:
21
+ 1. `--token-file PATH` on any command;
22
+ 2. the `MIXAMO_TOKEN` environment variable, set by the user in their own shell (the token itself);
23
+ 3. the `MIXAMO_TOKEN_FILE` environment variable (a path);
24
+ 4. `~/.config/mixamo/token`.
25
+
26
+ A token file holds the raw token or a line `token=...`; keep it outside every repository and readable only by
27
+ the user (`chmod 600`).
28
+ - Verify with `python3 .claude/skills/mixamo/scripts/mixamo.py token` (a local check, no network).
29
+ - The skill's resources, installed with it under `.claude/skills/mixamo/` (other tools use their own skills
30
+ directory): `scripts/mixamo.py` and its network-free tests `scripts/test_mixamo.py`.
31
+
32
+ ## Token rules
33
+
34
+ - The token expires after about a day. The script refuses a token file older than 23 hours (`TOKEN_STALE`), reports
35
+ a missing one as `TOKEN_MISSING` and a 401 as `TOKEN_REJECTED`; a `MIXAMO_TOKEN` value has no known age, so only a
36
+ 401 shows it expired. In every one of these cases ask the user to replace the token and stop.
37
+ - Never print, `cat`, `grep` or `awk` the token file; never put the token in a command line (do not set
38
+ `MIXAMO_TOKEN=...` yourself), a log, a commit or a reply. The script never prints it, redacts it from response
39
+ text and sends it only to `https://*.mixamo.com`.
40
+
41
+ ## Stop conditions
42
+
43
+ - No token configured, `TOKEN_STALE`, `TOKEN_REJECTED`: ask the user for a fresh token, stop.
44
+ - The model is not humanoid, or the user did not ask for this model to be uploaded: stop and say why.
45
+ - A command fails in a way that suggests the unofficial API changed: inspect it with `raw` (below), report what
46
+ changed, and do not guess request bodies against the user's account.
47
+
48
+ ## Mechanism
49
+
50
+ `scripts/mixamo.py` makes the calls the mixamo.com page makes. The API is unofficial and may change;
51
+ `mixamo.py raw <METHOD> <path> [json]` is for looking at an endpoint when a command breaks, and the page's own
52
+ script (`https://www.mixamo.com/`, the `js/mixamo.min.*.js` it loads) shows what the page sends.
53
+
54
+ ```text
55
+ mixamo.py token is a token configured and fresh
56
+ mixamo.py upload <model.fbx> -> character id and its bounds
57
+ mixamo.py rig <character-id> <markers.json> auto-rig; fails unless the character ends "ready"
58
+ mixamo.py status <character-id>
59
+ mixamo.py search <words> [--limit N] id | name | description
60
+ mixamo.py download <character-id> <product-id|name> <out.fbx> [--skin] [--in-place] [--fps 30]
61
+ ```
62
+
63
+ ### Model for upload
64
+
65
+ - One mesh, no armature, FBX. A-pose or T-pose, arms away from the body, legs apart, facing the viewer.
66
+ - Take off what must not bend with the body (weapon, shield, cloak) and attach it to a bone after rigging.
67
+ - Exported from Blender with the default axes the character stands Y up and faces +Z on Mixamo.
68
+
69
+ ### Markers
70
+
71
+ `markers.json` holds eight points, each `[x, y]`: `chin`, `larm` and `rarm` (wrists), `lelbow`, `relbow`, `lknee`,
72
+ `rknee`, `groin`. They are in the uploaded model's own space as `upload` prints its bounds: Y up, X to the
73
+ character's left, the units of the file. Measure them on the mesh (in Blender: x is X, y is Z), do not guess from
74
+ a picture. Skeleton detail is `--lod`: `""` (default), `ThumbIndexRing`, `ThumbIndex`, `NoFingers`.
75
+
76
+ ### Animations
77
+
78
+ `download --skin` returns the mesh, skeleton, weights and the clip in one FBX: take one clip this way, the rest
79
+ without skin and apply their actions to the same armature. `--in-place` removes travel where the animation offers
80
+ it (walks, runs); the script prints whether it applied. Bones are named `mixamorig:<Name>`.
81
+
82
+ ## Outcomes
83
+
84
+ - Look at the result before relying on it: import into Blender, render frames of every clip, check the mesh
85
+ bends where the joints are and nothing tears.
86
+ - Record beside the downloaded files which Mixamo animation each one is (name and product id).
87
+
88
+ ## Invariants
89
+
90
+ - Uploading sends the user's model to Adobe. Do it only for models the user asked to rig.
91
+ - Mixamo's licence allows using characters and animations in a game, royalty free, but not redistributing the
92
+ raw animation files as a library. Check the project's own rules on third-party assets before committing them.
93
+ - This is one user's account: no bulk scraping of the library, download what the task needs.
94
+ - Follow the project's Git rules; commit downloaded files only when the user asks. Never push.
95
+
96
+ ## Known gaps
97
+
98
+ - With `--lod ""` a stylised, large-headed character came back with 41 bones (thumb and one finger chain), not the
99
+ 65 of the standard skeleton. Whether the page sends something else for the full skeleton is not verified.
100
+ - Downloading the bare rigged character without an animation is not implemented; use `download --skin`.
101
+
102
+ ## Output Contract
103
+
104
+ Emit `Skill: mixamo - output below`, then state:
105
+
106
+ - character id, rig status and skeleton LOD (bone count if checked);
107
+ - every downloaded file with its Mixamo animation name, product id, skin and in-place flags;
108
+ - what was checked visually and what was not;
109
+ - any token or API problem, with the status code (`TOKEN_MISSING`, `TOKEN_STALE`, `TOKEN_REJECTED`, HTTP code).
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Mixamo"
3
+ short_description: "Auto-rig a humanoid model and download Mixamo animations through its web API with the user's own token"
4
+ default_prompt: "Use $mixamo to rig this humanoid model on Mixamo and download the animations it needs, using my Mixamo token."
@@ -0,0 +1,264 @@
1
+ #!/usr/bin/env python3
2
+ """Client for Mixamo's web API (unofficial: the calls the mixamo.com page makes).
3
+
4
+ mixamo.py token is a token configured and fresh (local check, no network)
5
+ mixamo.py raw GET|POST|PUT <path> [json] one call, prints status and body (for exploring)
6
+ mixamo.py primary the account's current character
7
+ mixamo.py search <words> [--limit N] animations by name
8
+ mixamo.py upload <model.fbx|obj|zip> upload a character; prints its id and its bounds in marker space
9
+ mixamo.py bounds <character-id> bounds of an uploaded, not yet rigged character
10
+ mixamo.py rig <character-id> <markers.json> [--lod ""|ThumbIndexRing|ThumbIndex|NoFingers]
11
+ mixamo.py status <character-id> needs_rigging | ready
12
+ mixamo.py download <character-id> <product-id|name> <out.fbx> [--skin] [--in-place] [--fps 30]
13
+
14
+ Every command accepts --token-file PATH. The token is taken from the first of: --token-file, the MIXAMO_TOKEN
15
+ environment variable (the token itself), the MIXAMO_TOKEN_FILE environment variable, ~/.config/mixamo/token.
16
+ A token file holds the raw bearer token or a line `token=...`. The token is never printed and is only sent to
17
+ mixamo.com. It lives about a day; a file's modification time says how old it is.
18
+ """
19
+ import json, os, sys, time, urllib.request, urllib.error, urllib.parse, uuid, mimetypes
20
+
21
+ API = "https://www.mixamo.com/api/v1"
22
+ DEFAULT_TOKEN_FILE = "~/.config/mixamo/token"
23
+ MAX_AGE_HOURS = 23
24
+ MARKERS = ("chin", "larm", "rarm", "lelbow", "relbow", "lknee", "rknee", "groin")
25
+ LODS = ("", "ThumbIndexRing", "ThumbIndex", "NoFingers")
26
+
27
+ _token_flag = None # --token-file, set by main
28
+ _token = None # cached after the first read
29
+
30
+
31
+ def token_source(flag=None, env=None):
32
+ """Where the token comes from: ("file", path) or ("env", "MIXAMO_TOKEN"). Never returns the token."""
33
+ env = os.environ if env is None else env
34
+ if flag:
35
+ return "file", os.path.expanduser(flag)
36
+ if env.get("MIXAMO_TOKEN", "").strip():
37
+ return "env", "MIXAMO_TOKEN"
38
+ return "file", os.path.expanduser(env.get("MIXAMO_TOKEN_FILE") or DEFAULT_TOKEN_FILE)
39
+
40
+
41
+ def parse_token(text):
42
+ """The bearer token in a token file's text (raw, `token=...` or `Bearer ...`), or None."""
43
+ for line in text.splitlines():
44
+ line = line.strip()
45
+ if not line or line.startswith("#"):
46
+ continue
47
+ if "=" in line.split(".")[0]:
48
+ line = line.split("=", 1)[1].strip()
49
+ line = line.removeprefix("Bearer ").strip()
50
+ return line or None
51
+ return None
52
+
53
+
54
+ def file_age_hours(path, now=None):
55
+ return ((time.time() if now is None else now) - os.path.getmtime(path)) / 3600
56
+
57
+
58
+ def load_token(flag=None, env=None, now=None):
59
+ """(token, age in hours or None). Exits with TOKEN_MISSING / TOKEN_STALE; messages never contain the token."""
60
+ env = os.environ if env is None else env
61
+ kind, where = token_source(flag, env)
62
+ if kind == "env":
63
+ return env["MIXAMO_TOKEN"].strip().removeprefix("Bearer ").strip(), None
64
+ if not os.path.isfile(where):
65
+ sys.exit(f"TOKEN_MISSING: no token file at {where}; ask the user to save a fresh Mixamo token there "
66
+ "or to set MIXAMO_TOKEN_FILE")
67
+ age = file_age_hours(where, now)
68
+ if age > MAX_AGE_HOURS:
69
+ sys.exit(f"TOKEN_STALE: {where} is {age:.1f} h old; ask the user to replace the token")
70
+ with open(where, encoding="utf-8") as handle:
71
+ token = parse_token(handle.read())
72
+ if not token:
73
+ sys.exit(f"TOKEN_MISSING: {where} holds no token")
74
+ return token, age
75
+
76
+
77
+ def read_token():
78
+ global _token
79
+ if _token is None:
80
+ _token = load_token(_token_flag)[0]
81
+ return _token
82
+
83
+
84
+ def redact(text, token=None):
85
+ """Text with every occurrence of the token replaced, for anything printed."""
86
+ token = token if token is not None else _token
87
+ return text.replace(token, "<redacted>") if token else text
88
+
89
+
90
+ def api_url(path):
91
+ """Absolute URL for an API path. The bearer token goes to mixamo.com only, never to another host."""
92
+ if not path.startswith(("http://", "https://")):
93
+ return API + ("" if path.startswith("/") else "/") + path
94
+ parts = urllib.parse.urlsplit(path)
95
+ host = (parts.hostname or "").lower()
96
+ if parts.scheme != "https" or not (host == "mixamo.com" or host.endswith(".mixamo.com")):
97
+ sys.exit(f"REFUSED: the token is only sent to https://*.mixamo.com, not {parts.scheme}://{host}")
98
+ return path
99
+
100
+
101
+ def call(method, path, body=None, files=None, raw=False):
102
+ url = api_url(path)
103
+ headers = {"Authorization": "Bearer " + read_token(), "X-Api-Key": "mixamo2", "Accept": "application/json",
104
+ "X-Requested-With": "XMLHttpRequest"}
105
+ data = None
106
+ if files:
107
+ boundary = uuid.uuid4().hex
108
+ parts = []
109
+ for name, value in (body or {}).items():
110
+ parts.append(f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"\r\n\r\n{value}\r\n'.encode())
111
+ for name, filepath in files.items():
112
+ ctype = mimetypes.guess_type(filepath)[0] or "application/octet-stream"
113
+ with open(filepath, "rb") as handle:
114
+ content = handle.read()
115
+ parts.append(f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"; filename="{os.path.basename(filepath)}"\r\n'
116
+ f'Content-Type: {ctype}\r\n\r\n'.encode() + content + b"\r\n")
117
+ data = b"".join(parts) + f"--{boundary}--\r\n".encode()
118
+ headers["Content-Type"] = f"multipart/form-data; boundary={boundary}"
119
+ elif body is not None:
120
+ data = json.dumps(body).encode()
121
+ headers["Content-Type"] = "application/json"
122
+ request = urllib.request.Request(url, data=data, method=method, headers=headers)
123
+ try:
124
+ with urllib.request.urlopen(request, timeout=120) as response:
125
+ status, text = response.status, response.read().decode("utf-8", "replace")
126
+ except urllib.error.HTTPError as error:
127
+ status, text = error.code, error.read().decode("utf-8", "replace")
128
+ text = redact(text)
129
+ if raw:
130
+ return status, text
131
+ if status == 401:
132
+ sys.exit("TOKEN_REJECTED: Mixamo answered 401 (the token expired or is wrong); ask the user to replace it")
133
+ if status >= 400:
134
+ sys.exit(f"HTTP {status} {method} {path}: {text[:600]}")
135
+ return json.loads(text) if text.strip() else {}
136
+
137
+
138
+ def monitor(character_id, what="job", timeout=600):
139
+ start = time.time()
140
+ while time.time() - start < timeout:
141
+ state = call("GET", f"/characters/{character_id}/monitor")
142
+ if state.get("status") == "completed":
143
+ return state
144
+ if state.get("status") == "failed":
145
+ sys.exit(f"{what} failed: {redact(json.dumps(state))[:600]}")
146
+ time.sleep(4)
147
+ sys.exit(f"{what} timed out")
148
+
149
+
150
+ def search(words, limit=24, kind="Motion"):
151
+ query = urllib.parse.urlencode({"page": 1, "limit": limit, "order": "", "type": kind, "query": words})
152
+ return call("GET", f"/products?{query}").get("results", [])
153
+
154
+
155
+ def is_product_id(value):
156
+ return len(value) == 36 and value.count("-") == 4
157
+
158
+
159
+ def download_animation(character_id, product, out, skin=False, in_place=False, fps=30):
160
+ if not is_product_id(product):
161
+ found = [r for r in search(product, 48) if r["name"].lower() == product.lower()] or search(product, 1)
162
+ if not found:
163
+ sys.exit(f"no animation named {product}")
164
+ product = found[0]["id"]
165
+ detail = call("GET", f"/products/{product}?similar=0&character_id={character_id}")
166
+ gms = detail["details"]["gms_hash"]
167
+ gms["params"] = ",".join(str(p[1]) for p in gms["params"])
168
+ gms["overdrive"] = 0
169
+ if in_place and "inplace" in gms:
170
+ gms["inplace"] = True
171
+ body = {"character_id": character_id, "gms_hash": [gms], "product_name": detail["name"], "type": "Motion",
172
+ "preferences": {"format": "fbx7_2019", "skin": "true" if skin else "false", "fps": str(fps), "reducekf": "0"}}
173
+ call("POST", "/animations/export", body)
174
+ result = monitor(character_id, "export")
175
+ urllib.request.urlretrieve(result["job_result"], out) # a signed download link; no token is sent with it
176
+ return detail["name"], gms.get("inplace")
177
+
178
+
179
+ def bounds(character_id):
180
+ for asset in call("GET", f"/characters/{character_id}/assets/unrigged/verold.json"):
181
+ box = asset.get("payload", {}).get("boundingbox")
182
+ if box and "modelData" in asset["payload"]:
183
+ return box
184
+ sys.exit("no bounding box in the unrigged asset")
185
+
186
+
187
+ def upload(path):
188
+ job = call("POST", "/characters", files={"file": path})
189
+ monitor(job["uuid"], "upload")
190
+ return job["uuid"]
191
+
192
+
193
+ def rig_inputs(markers, lod=""):
194
+ """The rigging_inputs body for eight [x, y] markers in the uploaded model's space."""
195
+ missing = [m for m in MARKERS if m not in markers]
196
+ if missing:
197
+ sys.exit(f"markers missing: {missing}")
198
+ if lod not in LODS:
199
+ sys.exit(f"--lod must be one of {list(LODS)}")
200
+ inputs = {m: {"x": markers[m][0], "y": markers[m][1], "z": 0} for m in MARKERS}
201
+ inputs.update({"orientation": {"x": 0, "y": 0, "z": 0, "w": 1}, "symmetric": True, "for": "both", "skeleton-lod": lod})
202
+ return inputs
203
+
204
+
205
+ def rig(character_id, markers, lod=""):
206
+ call("PUT", f"/characters/{character_id}/rig", {"rigging_inputs": rig_inputs(markers, lod)})
207
+ monitor(character_id, "rig")
208
+ status = call("GET", f"/characters/{character_id}")["status"]
209
+ if status != "ready":
210
+ sys.exit(f"rig finished but the character is {status}: move the markers and try again")
211
+ return status
212
+
213
+
214
+ def main(argv):
215
+ global _token_flag
216
+ args = list(argv)
217
+ flag = lambda name: name in args and (args.remove(name) or True)
218
+ def option(name, default):
219
+ if name in args:
220
+ i = args.index(name)
221
+ if i + 1 >= len(args):
222
+ sys.exit(f"{name} needs a value")
223
+ value = args[i + 1]; del args[i:i + 2]; return value
224
+ return default
225
+ _token_flag = option("--token-file", None)
226
+ if not args:
227
+ sys.exit(__doc__)
228
+ command, args = args[0], args[1:]
229
+ if command == "token":
230
+ kind, where = token_source(_token_flag)
231
+ _, age = load_token(_token_flag)
232
+ if kind == "env":
233
+ print("TOKEN_OK: from MIXAMO_TOKEN (age unknown; a 401 means it expired)")
234
+ else:
235
+ print(f"TOKEN_OK: {where} is {age:.1f} h old")
236
+ elif command == "raw":
237
+ status, text = call(args[0], args[1], json.loads(args[2]) if len(args) > 2 else None, raw=True)
238
+ print(status); print(text[:6000])
239
+ elif command == "primary":
240
+ print(json.dumps(call("GET", "/characters/primary"), indent=1))
241
+ elif command == "upload":
242
+ cid = upload(args[0]); print("character", cid); print("bounds", json.dumps(bounds(cid)))
243
+ elif command == "bounds":
244
+ print(json.dumps(bounds(args[0])))
245
+ elif command == "status":
246
+ print(call("GET", f"/characters/{args[0]}")["status"])
247
+ elif command == "rig":
248
+ lod = option("--lod", "")
249
+ with open(args[1], encoding="utf-8") as handle:
250
+ print(rig(args[0], json.load(handle), lod))
251
+ elif command == "search":
252
+ limit = int(option("--limit", 24))
253
+ for r in search(" ".join(args), limit):
254
+ print(r["id"], "|", r["name"], "|", r.get("description", ""))
255
+ elif command == "download":
256
+ skin, in_place, fps = flag("--skin"), flag("--in-place"), int(option("--fps", 30))
257
+ name, inplace = download_animation(args[0], args[1], args[2], skin, in_place, fps)
258
+ print(f"saved {args[2]} ({name}, in place: {inplace}, {os.path.getsize(args[2])} bytes)")
259
+ else:
260
+ sys.exit(__doc__)
261
+
262
+
263
+ if __name__ == "__main__":
264
+ main(sys.argv[1:])
@@ -0,0 +1,108 @@
1
+ """Network-free tests for mixamo.py: token location precedence, token parsing, staleness, redaction, the host
2
+ guard for the bearer token and the rigging body. No call reaches Mixamo; nothing here needs a real token."""
3
+ import contextlib
4
+ import importlib.util
5
+ import io
6
+ import os
7
+ import pathlib
8
+ import sys
9
+ import tempfile
10
+ import time
11
+ import unittest
12
+
13
+ HERE = pathlib.Path(__file__).resolve().parent
14
+ spec = importlib.util.spec_from_file_location("mixamo", HERE / "mixamo.py")
15
+ mixamo = importlib.util.module_from_spec(spec)
16
+ spec.loader.exec_module(mixamo)
17
+
18
+ FAKE = "eyJfake.header.signature-0123456789"
19
+
20
+
21
+ class TokenTest(unittest.TestCase):
22
+ def setUp(self):
23
+ self.tmp = tempfile.TemporaryDirectory()
24
+ self.dir = pathlib.Path(self.tmp.name)
25
+ mixamo._token, mixamo._token_flag = None, None
26
+
27
+ def tearDown(self):
28
+ mixamo._token, mixamo._token_flag = None, None
29
+ self.tmp.cleanup()
30
+
31
+ def write(self, name, text, age_hours=0):
32
+ path = self.dir / name
33
+ path.write_text(text, encoding="utf-8")
34
+ stamp = time.time() - age_hours * 3600
35
+ os.utime(path, (stamp, stamp))
36
+ return str(path)
37
+
38
+ def test_precedence_flag_then_env_token_then_env_file_then_default(self):
39
+ env = {"MIXAMO_TOKEN": FAKE, "MIXAMO_TOKEN_FILE": "/elsewhere/token"}
40
+ self.assertEqual(mixamo.token_source("/flag/token", env), ("file", "/flag/token"))
41
+ self.assertEqual(mixamo.token_source(None, env), ("env", "MIXAMO_TOKEN"))
42
+ self.assertEqual(mixamo.token_source(None, {"MIXAMO_TOKEN": " ", "MIXAMO_TOKEN_FILE": "/elsewhere/token"}),
43
+ ("file", "/elsewhere/token"))
44
+ self.assertEqual(mixamo.token_source(None, {}), ("file", os.path.expanduser(mixamo.DEFAULT_TOKEN_FILE)))
45
+
46
+ def test_parse_token_forms(self):
47
+ self.assertEqual(mixamo.parse_token(FAKE + "\n"), FAKE)
48
+ self.assertEqual(mixamo.parse_token(f"# comment\n\ntoken={FAKE}\n"), FAKE)
49
+ self.assertEqual(mixamo.parse_token(f"token = Bearer {FAKE}"), FAKE)
50
+ self.assertEqual(mixamo.parse_token(f"Bearer {FAKE}"), FAKE)
51
+ self.assertIsNone(mixamo.parse_token("# only a comment\n\n"))
52
+
53
+ def test_fresh_file_loads_and_env_token_strips_bearer(self):
54
+ path = self.write("token", f"token={FAKE}", age_hours=1)
55
+ token, age = mixamo.load_token(path, {})
56
+ self.assertEqual(token, FAKE)
57
+ self.assertLess(age, 2)
58
+ self.assertEqual(mixamo.load_token(None, {"MIXAMO_TOKEN": f"Bearer {FAKE}"}), (FAKE, None))
59
+
60
+ def test_stale_missing_and_empty_files_exit_without_the_token(self):
61
+ stale = self.write("stale", FAKE, age_hours=mixamo.MAX_AGE_HOURS + 1)
62
+ empty = self.write("empty", "# nothing\n")
63
+ for path, code in ((stale, "TOKEN_STALE"), (str(self.dir / "absent"), "TOKEN_MISSING"), (empty, "TOKEN_MISSING")):
64
+ with self.assertRaises(SystemExit) as raised:
65
+ mixamo.load_token(path, {})
66
+ self.assertIn(code, str(raised.exception.code))
67
+ self.assertNotIn(FAKE, str(raised.exception.code))
68
+
69
+ def test_token_command_never_prints_the_token(self):
70
+ path = self.write("token", FAKE, age_hours=0)
71
+ out = io.StringIO()
72
+ with contextlib.redirect_stdout(out):
73
+ mixamo.main(["token", "--token-file", path])
74
+ self.assertIn("TOKEN_OK", out.getvalue())
75
+ self.assertNotIn(FAKE, out.getvalue())
76
+
77
+ def test_redact(self):
78
+ self.assertEqual(mixamo.redact(f"echo {FAKE} twice {FAKE}", FAKE), "echo <redacted> twice <redacted>")
79
+ self.assertEqual(mixamo.redact("no token here", None), "no token here")
80
+
81
+
82
+ class RequestTest(unittest.TestCase):
83
+ def test_api_url_keeps_the_token_on_mixamo(self):
84
+ self.assertEqual(mixamo.api_url("/characters/primary"), mixamo.API + "/characters/primary")
85
+ self.assertEqual(mixamo.api_url("products"), mixamo.API + "/products")
86
+ self.assertEqual(mixamo.api_url("https://www.mixamo.com/api/v1/x"), "https://www.mixamo.com/api/v1/x")
87
+ for url in ("https://example.com/api", "http://www.mixamo.com/api", "https://mixamo.com.example.com/x"):
88
+ with self.assertRaises(SystemExit) as raised:
89
+ mixamo.api_url(url)
90
+ self.assertIn("REFUSED", str(raised.exception.code))
91
+
92
+ def test_rig_inputs(self):
93
+ markers = {m: [i, i + 0.5] for i, m in enumerate(mixamo.MARKERS)}
94
+ inputs = mixamo.rig_inputs(markers, "NoFingers")
95
+ self.assertEqual(inputs["chin"], {"x": 0, "y": 0.5, "z": 0})
96
+ self.assertEqual(inputs["skeleton-lod"], "NoFingers")
97
+ with self.assertRaises(SystemExit):
98
+ mixamo.rig_inputs({"chin": [0, 1]})
99
+ with self.assertRaises(SystemExit):
100
+ mixamo.rig_inputs(markers, "AllFingers")
101
+
102
+ def test_product_id(self):
103
+ self.assertTrue(mixamo.is_product_id("0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0"))
104
+ self.assertFalse(mixamo.is_product_id("Walking"))
105
+
106
+
107
+ if __name__ == "__main__":
108
+ sys.exit(unittest.main())
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: sfx-creator
3
+ description: Create game sound effects with the local sfx-factory - search its licensed library, generate candidates with Stable Audio 3 (MLX, Small-SFX or Medium), clean one-shots, build seamless loops, layer ingredients into composite sounds, check spectrograms, put candidates on a listening board for the user's thumbs and comments, import that feedback, iterate, and export approved WAVs with attribution into a game project. Use whenever a game needs new or better sounds (footsteps, weapons, impacts, explosions, engines, ambience, UI), the user asks to generate or replace SFX, or pastes ratings/comments copied from an sfx board.
4
+ ---
5
+
6
+ # SFX creator
7
+
8
+ The user's ears decide; you prepare candidates, rule out obvious failures by looking, and do the bookkeeping.
9
+ Never claim a sound is good. Spectrograms and metrics only show that it is *not obviously broken*.
10
+
11
+ ## Prerequisites
12
+
13
+ - A local checkout of **sfx-factory** (FACTORY below). It is not shipped with this skill; the user supplies it.
14
+ Resolve its location in this order and use the first that is set:
15
+ 1. the `SFX_FACTORY` environment variable;
16
+ 2. `paths.sfx_factory` in the project's `game-dev.json` (optional file; `~` expands, a relative path is relative
17
+ to the project root).
18
+
19
+ If neither is set, stop and ask the user where the factory lives. Never search the disk for it or guess a path.
20
+ - The factory's own runtime in `FACTORY/.venv`. If it is missing: `cd FACTORY && UV_CACHE_DIR=$PWD/.cache/uv uv sync --extra mlx`
21
+ (needs [uv](https://docs.astral.sh/uv/); the MLX generator needs Apple Silicon).
22
+ - Verify with `FACTORY/.venv/bin/sfx --home FACTORY --help`: it prints one JSON object with `"ok": true`.
23
+
24
+ ## The factory
25
+
26
+ It is one CLI with one SQLite library, immutable originals, recorded DSP lineage and licence evidence. Read
27
+ `FACTORY/AGENTS.md` once per session: it holds the rules (licences, lineage, what never to do) and every
28
+ command's contract. Call it from any project like this:
29
+
30
+ ```sh
31
+ SFX="FACTORY/.venv/bin/sfx --home FACTORY" # every reply is one JSON object on stdout
32
+ ```
33
+
34
+ - All writes stay inside FACTORY (`runs/`, `exports/`, `library/`). Destinations for `board`/`export` must be new directories.
35
+ - Weights are local and pinned (`docs/data/model_files.json`); there are no implicit downloads.
36
+ - Never edit `stability_licence` in `FACTORY/config.toml`. Check its value there; only the user changes it.
37
+ - Generation needs `--allow-generator`, and it holds the machine-wide `~/.cache/local-3d/generate.lock`.
38
+ - If you change factory code, run `FACTORY/.venv/bin/python -m pytest --basetemp .cache/pytest -q` there.
39
+
40
+ ## Stop conditions
41
+
42
+ - FACTORY is not configured, or the configured path has no `AGENTS.md` or no `.venv/bin/sfx`: ask the user, stop.
43
+ - The generation lock is held by another process: wait or report it; never delete the lock.
44
+ - `export` refuses an unverified licence: report the asset; never edit licence evidence to get past it.
45
+ - No ratings from the user yet: do not mark anything approved and do not deliver it as final.
46
+
47
+ ## Git
48
+
49
+ Follow the project's and the factory's own Git rules. This skill creates no commits, tags or branches by itself;
50
+ commit in either repository only when the user asks, and only files this run created. Never push.
51
+
52
+ ## Workflow
53
+
54
+ ### 1. Brief per sound slot
55
+
56
+ Before generating, write a short table, one row per slot: the slot id the game uses (`step.heavy`, `shot.ML`,
57
+ `jet.loop`); what it is and where it plays; one-shot or loop; target length; how many variants the game
58
+ randomises between. Read the project's audio code to see how it plays sounds: buffers or files, mono or stereo,
59
+ positional or not.
60
+
61
+ ### 2. Library first
62
+
63
+ Run `$SFX find "words" --limit 10`. You can add `--type library`, `--license-status verified` and duration filters.
64
+ Licensed CC0 packs (impact, UI, interface) often cover UI and simple foley; generated UI clicks tend to come out
65
+ harsh, so prefer the packs for UI. Put matching library sounds on the same board as the generated ones.
66
+
67
+ ### 3. Generate a round (batch → one run)
68
+
69
+ Write a batch JSON, an array of items, and run `$SFX generate --batch FILE.json --allow-generator`. Each item:
70
+
71
+ ```json
72
+ {"prompt": "TrackType: SFX, ...", "duration": 2, "seeds": 2, "seed_start": 0,
73
+ "model": "medium", "cfg": 3, "negative": "music, repeated hits, ambience",
74
+ "group": "Heavy step", "label": "medium p1", "tags": ["step.heavy", "<project>"]}
75
+ ```
76
+
77
+ - **Models.** `sm-sfx` is the fast one (well under a second per clip on Apple Silicon): textures, noise beds and
78
+ layer ingredients. `medium` is about 2–3× slower: tonal or sci-fi sounds (lasers, energy), clean single impacts
79
+ and anything that must follow the prompt closely.
80
+ - **CFG.** `cfg: 3` with a `negative` prompt follows the description much better than `cfg: 1`, at twice the cost.
81
+ The negative prompt is ignored when cfg is 1.
82
+ - **Prompt wording.** Write like Freesound metadata: start with `TrackType: SFX`, name the source object, the action
83
+ and the recording ("single", "one-shot", "close microphone", "dry", "isolated"). Realistic durations:
84
+ 1.5–2.5 s for one-shots, 6–8 s of source for a loop.
85
+ - **A round:** 3 prompt variants × 2 seeds per slot. Vary the wording, not only the seed; seed-only variants sound alike.
86
+ - **Known failures and their fixes:**
87
+ - Giant or mechanical footsteps from one prompt come out as a texture of several hits plus a hum. Generate the
88
+ ingredients instead (deep boom impact, short clank or hydraulic burst) and layer them (step 4).
89
+ - Walking sequences are useless: a game needs one take per foot plant.
90
+ - Heavy-machine steps on soil often land best as an ordinary heavy step: a deep thud, slowed for mass, quiet,
91
+ with no metallic tail. Offer that variant beside any metallic one and let the ratings decide.
92
+ - "Seamless" in a prompt does not make a loop.
93
+ - `FACTORY/docs/prompting.md` holds the user-rated prompt notes; read it before a round and add to it after every rated round.
94
+
95
+ ### 4. Process (each step is a recorded run; take the new ids from the results)
96
+
97
+ - **One-shot:** `$SFX process ID --clean --first-event` removes hum and pre-clicks, keeps the strongest event and
98
+ fades out. The board pairs the cleaned version with its original automatically.
99
+ - **Loop:** `$SFX process ID --make-loop 2.5 --crossfade 0.3 --loop-gain-db -3` takes the steady middle section and
100
+ crossfades the tail into the head (equal power). Raise the gain margin if flagged `PEAK_ABOVE_FULL_SCALE`.
101
+ - **Layered composite:** write a spec and run `$SFX mix SPEC.json`. A mix inherits the strictest licence of its layers.
102
+
103
+ ```json
104
+ {"layers": [{"asset_id": "<boom clean>", "gain_db": 0, "rate": 0.85},
105
+ {"asset_id": "<clank clean>", "gain_db": -8, "delay_s": 0.005, "rate": 0.8},
106
+ {"asset_id": "<servo clean>", "gain_db": -16, "delay_s": 0.12, "trim": [0, 0.3]}],
107
+ "peak_dbfs": -1, "fade_out_s": 0.06, "group": "...", "label": "mix-A"}
108
+ ```
109
+
110
+ - `rate` below 1 is varispeed: lower and heavier, which reads as mass.
111
+ - Level-match the layers first: subtract each layer's own peak (in dB) from the gain you intend.
112
+ - If `FACTORY/docs/` holds a worked round script (clean, loop, mix and board), read it before the first round.
113
+
114
+ ### 5. Look before the user listens
115
+
116
+ Run `$SFX check ID... [--loop]`, then open the `inspection.mel_png` and `waveform_png` images.
117
+ - Drop anything silent, with several events in a one-shot, in the wrong band entirely, or clipped into a plateau.
118
+ - An impact needs a sharp broadband attack, then a decay. A laser shows a falling pitch sweep. A loop's mel image
119
+ should be flat across time.
120
+ - Technical flags are advisory. `LOOP_BOUNDARY_JUMP` on broadband noise is usually normal sample-to-sample movement;
121
+ compare it with the signal's median step before calling it a click.
122
+
123
+ ### 6. Board → the user's ears
124
+
125
+ 1. Write a selection manifest `{"results": [{"asset_id", "board_group", "board_label"}, ...]}`. List originals for
126
+ cleaned pairs and the derivatives themselves for loops and mixes (they carry their own group, label and hint).
127
+ 2. Run `$SFX board MANIFEST.json --out runs/<project>-<round>`.
128
+ 3. Serve the folder over loopback, because browser panes often show only static snapshots of `file://` pages:
129
+ `python3 -m http.server 8765 --bind 127.0.0.1 --directory FACTORY/runs`. Use a system Python if a version-manager
130
+ shim fails under your tool's server launcher; register the server with that launcher when the tool has one.
131
+ 4. Open `http://localhost:8765/<board>/listening.html`.
132
+
133
+ On each card the user plays the sound (↻ loops it), switches original/cleaned, gives a thumb up or down and writes
134
+ a comment. The hint line shows the prompt or the mix recipe. The board's copy button for ratings and comments
135
+ copies `{schema_version, ratings, comments, labels}`, and the user pastes it into the chat.
136
+
137
+ ### 7. Import and iterate
138
+
139
+ 1. Save the pasted JSON exactly, as `runs/<board>/ratings-<date>.json`, and run `$SFX ratings import FILE`. It records
140
+ approved or rejected status plus comments; a comment without a thumb keeps the status.
141
+ 2. Read the comments together with `labels`; change prompts, layers, gains or rates for the next round.
142
+ 3. Record what worked in `docs/prompting.md`. Never re-rate a sound yourself.
143
+
144
+ ### 8. Deliver to the game
145
+
146
+ 1. Run `$SFX export ID... --out exports/<project>-<name> --rate 48000 --pcm16`: stereo PCM16 with sidecars,
147
+ `ATTRIBUTION.txt` and the Stability notices. Export refuses unverified licences.
148
+ 2. Copy the WAVs into the project's asset folder under game slot names, with `ATTRIBUTION.txt` and the notice files.
149
+ 3. Convert to mono or another format only in the project, and say so.
150
+ 4. Wire the files into the project's audio code: keep its spatial mixing and variants, replace only the buffers.
151
+ 5. Report any sound you ship whose listening status is still `unreviewed`.
152
+
153
+ ## Output Contract
154
+
155
+ Emit `Skill: sfx-creator - output below`, then state:
156
+
157
+ - the factory location used and where it came from (`SFX_FACTORY` or `game-dev.json`);
158
+ - what was generated, with run ids, models and counts; what you rejected by looking, and why;
159
+ - the board URL; after import, how many approved, rejected and commented; what the next round changes;
160
+ - after delivery, which files went where, and any shipped sound still `unreviewed`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SFX Creator"
3
+ short_description: "Generate, clean, loop and layer game sound effects with a local sfx-factory, rated by the user on a listening board"
4
+ default_prompt: "Use $sfx-creator to make the sounds this game needs with the sfx-factory: brief the slots, search the library, generate a round, put it on a listening board and export what I approve."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-manifesto-kit",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "CLI to discover and adopt Agent Manifesto Kit capabilities (skills, agents, pipelines) into your project for Claude, Codex, or AI-agnostic targets.",
5
5
  "type": "module",
6
6
  "bin": {