Files
boshu2__agentops/scripts/append-codex-override-entry.sh
T
Bo 0023aa5acf feat(skills): skill-builder scaffolds codex override-catalog entry (ag-cw2y item 4) (#611)
## What
**ag-cw2y item 4** — the 4th and last new-skill gate that cost
`/burndown` #600 a CI round. A new skill previously tripped
`validate-codex-override-coverage` ("source skill missing from Codex
catalog"). skill-builder now adds the catalog entry automatically.

## How
- **`scripts/append-codex-override-entry.sh`** — idempotent, JSON-aware:
appends a `parity_only` entry
(`name`/`treatment`/`wave=catalog-parity`/`reason`) to
`skills-codex-overrides/catalog.json` if the skill is absent.
`parity_only` is correct for skill-builder's canonical-derived codex
form; author flips to `bespoke` + scaffolds the override dir only if a
Codex-only divergence is needed. Repo-root-injectable.
- **`init.sh`** — calls it in the new-skill plumbing block alongside the
dispositions row (#609/#610) and `--fix-counts` (#610). All three gates
now pre-empted at scaffold time.

## Tests (TDD, red→green)
`tests/scripts/append-codex-override-entry.bats` — appends parity_only /
stays valid JSON / idempotent / no-dup-on-existing. 4/4 green.
shellcheck clean.

## Codex artifact
Refreshed **only skill-builder's** hash (6 unrelated pre-existing `main`
drifts untouched). PR-scope codex validation passes.

## ag-cw2y status after this
Item 1 (#609 check + #610 scaffold) ✅ · Item 2 (#610) ✅ · **Item 4
(here)** ✅ · **Item 3** (codex desc token budget / `ag-vzbt`) is the
only remaining piece. Once item 3 lands, a new skill — and therefore
`ag-hdqu0.8` + `/burndown` #600 — is fully one-shot-green.

Closes-scenario: ag-cw2y#override-catalog-scaffold
Bounded-context: BC4-factory
Evidence: tests/scripts/append-codex-override-entry.bats
2026-05-29 20:03:37 -04:00

44 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# append-codex-override-entry.sh — ensure a new skill has a row in
# skills-codex-overrides/catalog.json (ag-cw2y item 4).
#
# Idempotent: appends a parity_only entry (canonical-derived codex form, which is
# what skill-builder produces by default) only if the skill is absent — so a
# newly-scaffolded skill is one-shot-green against validate-codex-override-coverage
# ("source skill missing from Codex catalog"). If the codex form is later made
# bespoke, the author flips treatment to "bespoke" and scaffolds the override dir.
#
# Usage: append-codex-override-entry.sh <skill-name> [repo-root]
set -euo pipefail
SKILL="${1:?usage: append-codex-override-entry.sh <skill-name> [repo-root]}"
REPO_ROOT="${2:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
CATALOG="$REPO_ROOT/skills-codex-overrides/catalog.json"
if [[ ! -f "$CATALOG" ]]; then
echo "append-codex-override-entry: no catalog at $CATALOG" >&2
exit 1
fi
SKILL="$SKILL" python3 - "$CATALOG" <<'PY'
import json, os, sys
path = sys.argv[1]
skill = os.environ["SKILL"]
with open(path) as f:
cat = json.load(f)
skills = cat.setdefault("skills", [])
if any(s.get("name") == skill for s in skills):
print(f"append-codex-override-entry: '{skill}' already cataloged — no-op")
sys.exit(0)
skills.append({
"name": skill,
"treatment": "parity_only",
"wave": "catalog-parity",
"reason": f"TODO: confirm parity_only or flip to bespoke (+scaffold override dir) for {skill}",
})
with open(path, "w") as f:
json.dump(cat, f, indent=2, ensure_ascii=False)
f.write("\n")
print(f"append-codex-override-entry: added parity_only entry for '{skill}'")
PY