Commit 581f357
authored
feat(registry): automate component generation and migrate to OCX V2 schema (#315)
* feat(registry): migrate build-registry and registry.jsonc to OCX V2 schema
- Drop ocx: prefix from component types (skill, agent, bundle, profile, plugin)
- Add string shorthand support for file entries (path === target)
- Simplify resolveComponentFilePath to a uniform path.join(PROJECT_ROOT, file.path)
- Remove OCX_TARGET_REWRITES and normalizeTargetPath singularization
- Update schema URL to V2
- Migrate registry.jsonc V1 entries to V2 format
Build script now accepts both string shorthand and {path, target} object entries.
Generated entries (skills/agents) use string shorthand; profile entries keep
object form since their install target differs from source path.
* feat(registry): add generate-registry script with auto-population from filesystem
Generates skill and agent components in registry.jsonc from skills/ and agents/
directories. Bundles, profiles, and plugin entries stay hand-curated; bundles
named 'skills' or 'agents' get their dependencies arrays auto-populated with
all components of the matching type.
- Skill component name = directory basename (with underscores replaced by hyphens)
to satisfy V2 schema pattern. generate_command -> generate-command.
- Agent component name = 'agent-' + filename stem.
- File entries use V2 string shorthand (path === target).
- Generator exits with error on any component with empty description.
- Excludes .DS_Store, .gitkeep, AGENTS.md, .bak/.tmp/~ files, and node_modules/
__pycache__/.pytest_cache directories from skill file lists.
- Fresh header comment block written on each generation.
Skill validator updated to derive skill directory from SKILL.md path so unlisted-
file checks work even when component name differs from directory basename due to
sanitization.
Registry now contains 100 components (45 skills + 50 agents + 5 curated).
* feat(registry): remove unused skills and agents symlinks from registry/files/
The build script no longer uses these symlinks \u2014 file paths in registry.jsonc
now resolve directly from the repo root (V2 string shorthand). The symlinks
were left over from earlier path-resolution logic that prepended registry/files/
to component file paths.
registry/files/profiles/ stays untouched \u2014 those are real files that profile
components reference.
* feat(registry): add --check drift mode and wire into CI build job
The generator now supports --check that exits 0 if registry.jsonc matches what
would be generated, exit 1 otherwise. Trailing whitespace is normalized before
comparison to avoid false positives.
CI build job runs `bun scripts/generate-registry.ts --check` after the content-
integrity gate. Adding a new skill or agent without regenerating the registry
will now block the build automatically.
* test(registry): add 29-test suite for generator + match Biome JSON formatting
Tests cover:
- sanitizeComponentName underscore->hyphen transformation
- isExcludedFile (.DS_Store, .gitkeep, AGENTS.md, .bak/.tmp/~, node_modules)
- countComponents and normalizeForCompare helpers
- Skill discovery with files, references/, templates/ structure
- Agent discovery with agent- prefix
- Curated entry preservation (bundle/profile/plugin) with V1 to V2 type migration
- Bundle dependency auto-population for skills/agents bundles only
- Component sort order: generated alphabetical, then curated
- Fresh header comment block (does not preserve V1-era stale comments)
- Empty-description error path for skills and agents
- Idempotence and drift detection
Refactored the generator to accept rootDir as a parameter so tests can use
synthetic temp-dir fixtures without mocking the filesystem. main() guards
the script-only entry point with import.meta.main.
The generator now inlines single-element string arrays in its output to match
Biome's JSON formatter, keeping the drift check stable under bun run lint.
Also fixed a pre-existing useOptionalChain warning in skills/onboarding/scripts/
inventory.mjs that biome auto-fix surfaced.
* fix(registry): address Fro Bot review feedback on PR #315
Blocking:
- Replace GenerationError class with a tagged-error factory function and
isGenerationError type guard. Keeps the codebase class-free per project
convention.
Non-blocking improvements:
- Replace inlineSingleStringArrays regex with a real Biome subprocess call
(`biome format --stdin-file-path`). Generator output now inherits any
future Biome formatting changes for free instead of duplicating the
inlining heuristic. Also drops the regex's brittleness if Biome's
line-length threshold ever changes.
- normalizeForCompare now strips CRLF before trailing whitespace so the
drift check works on Windows / git autocrlf checkouts.
- Add a regression test that round-trips generator output through Biome
and asserts byte-identical equality, catching future Biome format
changes before the drift check ever sees them.1 parent 5cf7167 commit 581f357
8 files changed
Lines changed: 1739 additions & 471 deletions
File tree
- .github/workflows
- registry
- files
- scripts
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
33 | 47 | | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
38 | | - | |
| 52 | + | |
39 | 53 | | |
40 | 54 | | |
41 | 55 | | |
42 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
43 | 64 | | |
44 | 65 | | |
45 | 66 | | |
| |||
175 | 196 | | |
176 | 197 | | |
177 | 198 | | |
178 | | - | |
179 | | - | |
| 199 | + | |
| 200 | + | |
180 | 201 | | |
181 | 202 | | |
182 | | - | |
| 203 | + | |
183 | 204 | | |
184 | 205 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 206 | + | |
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
| |||
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
218 | 221 | | |
219 | | - | |
220 | | - | |
| 222 | + | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| |||
251 | 254 | | |
252 | 255 | | |
253 | 256 | | |
254 | | - | |
255 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
259 | | - | |
| 265 | + | |
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| |||
265 | 271 | | |
266 | 272 | | |
267 | 273 | | |
268 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
269 | 279 | | |
270 | 280 | | |
271 | | - | |
| 281 | + | |
272 | 282 | | |
273 | 283 | | |
274 | | - | |
275 | | - | |
276 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
| |||
290 | 302 | | |
291 | 303 | | |
292 | 304 | | |
293 | | - | |
| 305 | + | |
| 306 | + | |
294 | 307 | | |
295 | 308 | | |
296 | 309 | | |
| |||
315 | 328 | | |
316 | 329 | | |
317 | 330 | | |
318 | | - | |
| 331 | + | |
| 332 | + | |
319 | 333 | | |
320 | 334 | | |
321 | 335 | | |
| |||
368 | 382 | | |
369 | 383 | | |
370 | 384 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 385 | | |
387 | 386 | | |
388 | 387 | | |
| |||
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | | - | |
| 411 | + | |
413 | 412 | | |
414 | | - | |
| 413 | + | |
415 | 414 | | |
416 | 415 | | |
417 | 416 | | |
| |||
434 | 433 | | |
435 | 434 | | |
436 | 435 | | |
437 | | - | |
| 436 | + | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
0 commit comments