cto/install.sh
Svrnty 3a3503aa2e feat(cto): close Python+Angular stack gaps + PROFILE-DISTRIBUTION-PROTOCOL compliance
AGENT.md: REQUIRED T2 frontmatter per §2.1.
manifest.yaml: REQUIRED governance: block per §2.2. Register new toolkit skills.
install.sh: chmod +x.

skills/cto-python-toolkit/SKILL.md (v0.1): closes Python stack gap inline.
References real workspace projects as exemplars: scripts/sot-precommit.py
(single-file CLI), bte-mcp/server.py + bte_core.py (FastMCP server),
svrnty-hermes-webui-plugin (PEP 621 + pytest.ini_options), curator/sweep.py
(mode flags + dry-run + stdlib-heavy). Sandcastle prompt template + post-
run quality-gate routing via PG-svrnty.lib-quality-gates.

skills/cto-angular-toolkit/SKILL.md (v0.1): closes Angular stack gap inline.
Anchored to adwright/adwright-console as canonical Plan B Angular reference
(Angular 21.2 + signals + standalone components + inject() + gRPC-web via
@protobuf-ts/grpcweb-transport + L6-svrnty.lib-cqrs-datasource). Sandcastle
prompt template + DESIGN.md compliance check for UI work.

CONTRACT.md §6: Python+Angular promoted from  generic → 🟡 skill-only
(no more "gap" marker). Documents path to  deep when cortex/ libs extract.
skills/cto-agent/SKILL.md: routing table updated — Python/Angular rows now
route to the toolkit skills instead of falling through to generic.

CLAUDE.md: site-map footer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:37:11 -04:00

75 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# install.sh — wire CTO profile distribution into Hermes.
# Idempotent. Creates ~/.hermes/$PROFILE_NAME symlink + registers skills in profile config.
# v0.1 scaffold: schema applied, skill registered, but cto-agent skill is a non-executable stub.
set -euo pipefail
REPO="$(cd "$(dirname "$0")" && pwd)"
PROFILE_NAME="cto-planb" # Hermes profile name (org-scoped); matches distribution.yaml → name + manifest.yaml → profile
HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
PROFILE_CFG="$HERMES_HOME/profiles/$PROFILE_NAME/config.yaml"
# --dry-run flag for preflight without mutations
DRY_RUN=0
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=1 ;;
esac
done
echo "== preflight =="
command -v hermes >/dev/null || { echo "ERROR: hermes CLI not on PATH"; exit 1; }
command -v python3 >/dev/null || { echo "ERROR: python3 not on PATH"; exit 1; }
command -v sqlite3 >/dev/null || { echo "ERROR: sqlite3 not on PATH"; exit 1; }
if [ ! -d "$HERMES_HOME" ]; then
echo "ERROR: HERMES_HOME=$HERMES_HOME does not exist"
exit 1
fi
echo " hermes ✓ python3 ✓ sqlite3 ✓ HERMES_HOME ✓"
# Check sandcastle sibling exists (CTO's primary tool)
SANDCASTLE_REPO="${SANDCASTLE_REPO:-$REPO/../sandcastle}"
if [ ! -d "$SANDCASTLE_REPO" ]; then
echo "WARN: sandcastle sibling not found at $SANDCASTLE_REPO"
echo " CTO v1.0 will require it; v0.1 scaffold works without."
else
echo " sandcastle ✓ ($SANDCASTLE_REPO)"
fi
if [ "$DRY_RUN" -eq 1 ]; then
echo "== DRY RUN — no mutations =="
echo " would: ln -sfn $REPO $HERMES_HOME/$PROFILE_NAME"
echo " would: append $REPO/skills to $PROFILE_CFG → skills.external_dirs"
echo " would: sqlite3 $HERMES_HOME/$PROFILE_NAME/cto.db < $REPO/schema.sql"
exit 0
fi
echo "== link repo → ~/.hermes/$PROFILE_NAME =="
ln -sfn "$REPO" "$HERMES_HOME/$PROFILE_NAME"
echo "== register skills in $PROFILE_NAME profile config =="
SKILL_DIR="$REPO/skills"
mkdir -p "$(dirname "$PROFILE_CFG")"
python3 - "$PROFILE_CFG" "$SKILL_DIR" <<'PY'
import sys, os, yaml
cfg, sk = sys.argv[1], sys.argv[2]
d = yaml.safe_load(open(cfg).read()) if os.path.exists(cfg) else {}
d = d or {}
d.setdefault('skills', {}).setdefault('external_dirs', [])
if sk not in d['skills']['external_dirs']:
d['skills']['external_dirs'].append(sk)
open(cfg, 'w').write(yaml.dump(d, sort_keys=False, allow_unicode=True))
print(" +", sk)
else:
print(" already registered:", sk)
PY
echo "== ${PROFILE_NAME}.db =="
sqlite3 "$HERMES_HOME/$PROFILE_NAME/cto.db" < "$REPO/schema.sql"
echo "== done. canonical install: hermes profile install $REPO =="
echo "== verify: hermes -p $PROFILE_NAME skills list | grep cto-agent =="
echo ""
echo "NOTE: v0.1 is scaffold only. cto-agent skill is a stub — invocations no-op gracefully."
echo " v1.0 milestone wires sandcastle.run() into the orchestrator. See CONTRACT.md §4."