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
36 changes: 36 additions & 0 deletions scripts/append-skill-disposition.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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)"
2 changes: 1 addition & 1 deletion skills-codex/.agentops-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@
{
"name": "skill-builder",
"source_skill": "skills/skill-builder",
"source_hash": "6dd778f1556db4ebafd566a01a34d1f02004fe8ef10caf08242359de73b22c09",
"source_hash": "816d7c6f9f2e409c6568ef8a7d5d163917074a76f8931ccfd91cfcea96746b11",
"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": "6dd778f1556db4ebafd566a01a34d1f02004fe8ef10caf08242359de73b22c09",
"source_hash": "816d7c6f9f2e409c6568ef8a7d5d163917074a76f8931ccfd91cfcea96746b11",
"generated_hash": "4d8b01766df9b10099f4f669e60c74dede37bd604e70d7b6a9a732cb5b2a5c05"
}
15 changes: 15 additions & 0 deletions skills/skill-builder/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,21 @@ cat > "$BUILD_REPORT" <<EOF
}
EOF

# --- New-skill plumbing (ag-cw2y): make the scaffold one-shot-green ----------
# The local/CI gates that silently tripped /burndown #600 are pre-empted here:
# 1. Dispositions row — else heal.sh Check 12 (MISSING_DISPOSITION).
if [[ -f "$REPO_ROOT/scripts/append-skill-disposition.sh" ]]; then
bash "$REPO_ROOT/scripts/append-skill-disposition.sh" "$SKILL_NAME" "$REPO_ROOT" \
|| echo "init.sh: WARN could not append dispositions row — add one manually" >&2
fi
# 2. Narrative skill counts — --fix-counts bumps the "N checked-in skills" tokens
# in the domain-map + bdd Gherkin so the new skill doesn't trip registry-drift.
if [[ -x "$REPO_ROOT/scripts/check-registry-drift.sh" ]]; then
bash "$REPO_ROOT/scripts/check-registry-drift.sh" --fix-counts >/dev/null 2>&1 \
|| echo "init.sh: WARN registry-drift --fix-counts could not run — bump counts manually" >&2
fi

echo "init.sh: created skill skeleton at $NEW_DIR"
echo "init.sh: codex parity at $CODEX_DIR"
echo "init.sh: build report at $BUILD_REPORT"
echo "init.sh: dispositions row + narrative counts scaffolded (refine the placeholder row)"
49 changes: 49 additions & 0 deletions tests/scripts/append-skill-disposition.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bats
# ag-cw2y item-1 scaffold-half: skill-builder must append a skill-dispositions.yaml
# row for a new skill so it is one-shot-green against heal.sh Check 12. The helper
# is idempotent and repo-root-injectable (so init.sh can call it and tests can
# fixture it).

setup() {
HELPER="$BATS_TEST_DIRNAME/../../scripts/append-skill-disposition.sh"
FIX="$(mktemp -d)"
mkdir -p "$FIX/docs/contracts"
cat > "$FIX/docs/contracts/skill-dispositions.yaml" <<'EOF'
dispositions:
- skill: existing
domain: "BC1 Corpus"
hexagonal_role: domain
disposition: keep
rationale: "already here"
EOF
}

teardown() { rm -rf "$FIX"; }

@test "appends a dispositions row for a new skill" {
run bash "$HELPER" newskill "$FIX"
[ "$status" -eq 0 ]
grep -qE "^[[:space:]]*-[[:space:]]+skill:[[:space:]]+newskill[[:space:]]*$" "$FIX/docs/contracts/skill-dispositions.yaml"
}

@test "appended row carries a valid BC domain and a TODO rationale" {
bash "$HELPER" newskill "$FIX"
# The row's domain must be a real bounded context (so check-bounded-contexts-drift passes)
run grep -A4 'skill: newskill' "$FIX/docs/contracts/skill-dispositions.yaml"
[[ "$output" == *"BC4 Factory"* ]]
[[ "$output" == *"TODO"* ]]
}

@test "is idempotent — running twice does not duplicate the row" {
bash "$HELPER" newskill "$FIX"
bash "$HELPER" newskill "$FIX"
count=$(grep -cE "^[[:space:]]*-[[:space:]]+skill:[[:space:]]+newskill[[:space:]]*$" "$FIX/docs/contracts/skill-dispositions.yaml")
[ "$count" -eq 1 ]
}

@test "does not touch an already-present skill" {
run bash "$HELPER" existing "$FIX"
[ "$status" -eq 0 ]
count=$(grep -cE "^[[:space:]]*-[[:space:]]+skill:[[:space:]]+existing[[:space:]]*$" "$FIX/docs/contracts/skill-dispositions.yaml")
[ "$count" -eq 1 ]
}
Loading