Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills-codex/.agentops-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@
{
"name": "skill-builder",
"source_skill": "skills/skill-builder",
"source_hash": "941104f935c7d69640bcc42dcd83768f634c6150502746110c1028861e802b0b",
"source_hash": "09ca51bcec58dd8d144bf8a244deec9f716178bc0fc3ebd444b6ccbe314cdfe2",
"generated_hash": "4d8b01766df9b10099f4f669e60c74dede37bd604e70d7b6a9a732cb5b2a5c05"
},
{
Expand Down
2 changes: 1 addition & 1 deletion skills-codex/skill-builder/.agentops-generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"generator": "manual-maintained",
"source_skill": "skills/skill-builder",
"layout": "modular",
"source_hash": "941104f935c7d69640bcc42dcd83768f634c6150502746110c1028861e802b0b",
"source_hash": "09ca51bcec58dd8d144bf8a244deec9f716178bc0fc3ebd444b6ccbe314cdfe2",
"generated_hash": "4d8b01766df9b10099f4f669e60c74dede37bd604e70d7b6a9a732cb5b2a5c05"
}
9 changes: 9 additions & 0 deletions skills/skill-builder/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ if [[ -f "$REPO_ROOT/scripts/append-codex-override-entry.sh" ]]; then
bash "$REPO_ROOT/scripts/append-codex-override-entry.sh" "$SKILL_NAME" "$REPO_ROOT" \
|| echo "init.sh: WARN could not add codex override catalog entry — add one manually" >&2
fi
# 4. registry.json SKU catalog — else contracts-sync + correctness(ubuntu) BOTH
# fail ("registry.json is stale" / "SKU_CATALOG: DRIFT"). This is the 5th
# one-shot-green surface ag-cw2y missed; it cost /burndown #600 a 2nd
# fix-and-repush (ag-ekyq). MUST run last — it scans the whole skills/ tree,
# so the new skeleton must already exist on disk.
if [[ -f "$REPO_ROOT/scripts/generate-registry.sh" ]]; then
bash "$REPO_ROOT/scripts/generate-registry.sh" >/dev/null 2>&1 \
|| echo "init.sh: WARN could not regen registry.json — run scripts/generate-registry.sh manually" >&2
fi

echo "init.sh: created skill skeleton at $NEW_DIR"
echo "init.sh: codex parity at $CODEX_DIR"
Expand Down
42 changes: 42 additions & 0 deletions tests/scripts/scaffold-registry-regen.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bats
# ag-ekyq: skill-builder init.sh must regenerate registry.json (the SKU catalog)
# as part of new-skill scaffolding — the 5th one-shot-green surface ag-cw2y missed.
# A stale registry.json trips contracts-sync ("registry.json is stale") AND
# correctness(ubuntu) ("SKU_CATALOG: DRIFT") together; it cost /burndown #600 a
# 2nd fix-and-repush. generate-registry.sh scans the whole skills/ tree (not
# repo-root-injectable), so the contract we lock here is the WIRING + ORDERING:
# init.sh must invoke the canonical generator, AFTER the skeleton + the other
# three plumbing surfaces exist on disk.

INIT="$BATS_TEST_DIRNAME/../../skills/skill-builder/scripts/init.sh"

@test "init.sh invokes the canonical generate-registry.sh during scaffolding" {
run grep -E 'scripts/generate-registry\.sh' "$INIT"
[ "$status" -eq 0 ]
}

@test "the registry regen is guarded with a WARN fallback like its sibling steps" {
# Must not hard-fail the scaffold if regen has trouble — same || echo WARN shape
# as the dispositions / counts / override-catalog steps.
run grep -E 'generate-registry\.sh.*>/dev/null|WARN could not regen registry' "$INIT"
[ "$status" -eq 0 ]
}

@test "registry regen runs AFTER the codex override-catalog step (skeleton must exist first)" {
override_line=$(grep -n 'append-codex-override-entry\.sh' "$INIT" | head -1 | cut -d: -f1)
registry_line=$(grep -n 'generate-registry\.sh' "$INIT" | head -1 | cut -d: -f1)
[ -n "$override_line" ]
[ -n "$registry_line" ]
# registry regen must come later in the file (it scans the whole tree, so every
# other artifact — skill dir, dispositions, counts, codex catalog — must be in
# place first).
[ "$registry_line" -gt "$override_line" ]
}

@test "registry regen runs BEFORE the final 'created skill skeleton' echo (inside the plumbing block)" {
registry_line=$(grep -n 'generate-registry\.sh' "$INIT" | head -1 | cut -d: -f1)
echo_line=$(grep -n 'created skill skeleton at' "$INIT" | head -1 | cut -d: -f1)
[ -n "$registry_line" ]
[ -n "$echo_line" ]
[ "$registry_line" -lt "$echo_line" ]
}
Loading