Files
boshu2__agentops/scripts/append-skill-disposition.sh
T
Bo 5918fd559f feat(skills): skill-builder scaffolds dispositions row + narrative counts (ag-cw2y items 1-scaffold + 2) (#610)
## What

Completes **ag-cw2y item 1's scaffold-half + item 2**. A
newly-scaffolded skill is now one-shot-green against the two gates that
silently tripped `/burndown` #600:
1. missing `skill-dispositions.yaml` row → `heal.sh` Check 12
(`MISSING_DISPOSITION`, shipped #609)
2. stale `"N checked-in skills"` narrative counts →
`check-registry-drift`

## How
- **`scripts/append-skill-disposition.sh`** — idempotent helper that
appends a dispositions row (valid `BC4 Factory` placeholder + TODO
rationale, so `check-bounded-contexts-drift` passes; author refines
during content fill). Repo-root-injectable → fixture-testable.
- **`init.sh`** — after scaffolding, calls the helper *and* runs
`check-registry-drift.sh --fix-counts` to bump the narrative skill-count
tokens. Both calls are guarded + WARN-on-failure so they never break the
scaffold.

## Discovery (scope-narrowing)
Item 2's **check + `--fix-counts` already existed** and were wired into
both the fast pre-push gate (line 1330) and CI (line 803). The only gap
was that **skill-builder never invoked them** — so the fix is wiring,
not a new check.

## Tests (TDD, red→green)
`tests/scripts/append-skill-disposition.bats` — appends row / valid BC +
TODO / idempotent / no-dup-on-existing. 4/4 green. shellcheck clean.

## Codex artifact
Refreshed **only skill-builder's** source/generated hash (6 unrelated
pre-existing `main` drifts left untouched). PR-scope
`validate-codex-generated-artifacts --scope head` passes.

## ag-cw2y remaining
Item 1 (check #609 + scaffold here) ✅ · Item 2 (here) ✅ · **Item 3**
(codex desc budget / `ag-vzbt`) and **Item 4** (override-catalog
scaffold + `test-codex-override-coverage`) remain — then `ag-hdqu0.8`
and `/burndown` #600 are fully one-shot-green.

Closes-scenario: ag-cw2y#skillbuilder-scaffold-dispositions-counts
Bounded-context: BC4-factory
Evidence: tests/scripts/append-skill-disposition.bats
2026-05-29 19:49:20 -04:00

37 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# append-skill-disposition.sh — ensure a new skill has a row in
# docs/contracts/skill-dispositions.yaml (ag-cw2y item-1 scaffold-half).
#
# Idempotent: appends a placeholder row only if the skill has none, so a
# newly-scaffolded skill is one-shot-green against heal.sh Check 12
# (MISSING_DISPOSITION). The placeholder uses a real bounded context so
# check-bounded-contexts-drift.sh passes; the author refines domain /
# hexagonal_role / disposition / rationale during content fill (mirrors the
# "manual content fill required" contract of the SKILL.md skeleton).
#
# Usage: append-skill-disposition.sh <skill-name> [repo-root]
set -euo pipefail
SKILL="${1:?usage: append-skill-disposition.sh <skill-name> [repo-root]}"
REPO_ROOT="${2:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
FILE="$REPO_ROOT/docs/contracts/skill-dispositions.yaml"
if [[ ! -f "$FILE" ]]; then
echo "append-skill-disposition: no dispositions file at $FILE" >&2
exit 1
fi
if grep -qE "^[[:space:]]*-[[:space:]]+skill:[[:space:]]+${SKILL}[[:space:]]*$" "$FILE"; then
echo "append-skill-disposition: '$SKILL' already present — no-op"
exit 0
fi
cat >> "$FILE" <<EOF
- skill: $SKILL
domain: "BC4 Factory"
hexagonal_role: supporting
disposition: keep
rationale: "TODO: refine BC/hexagonal_role/disposition/rationale for $SKILL"
EOF
echo "append-skill-disposition: added placeholder row for '$SKILL' (refine before finalizing)"