- scripts/role-code-mapper: echoes role-code for a given role name - install.sh now: 1. Copies ClawRoles to ~/.openclaw/ClawRoles 2. Copies role-code-mapper to ~/.openclaw/bin 3. Installs routers to PrismFacet (if present) 4. Registers rules in PrismFacet rules.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
574 B
Bash
Executable File
28 lines
574 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROLES_DIR="${HOME}/.openclaw/ClawRoles/roles"
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
echo "Usage: role-code-mapper <role>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ROLE="$1"
|
|
ROLE_FILE="${ROLES_DIR}/${ROLE}/ROLE.md"
|
|
|
|
if [[ ! -f "$ROLE_FILE" ]]; then
|
|
echo "Error: ROLE.md not found for role '${ROLE}'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Extract role-code from YAML frontmatter
|
|
CODE=$(sed -n '/^---$/,/^---$/{ /^role-code:/{ s/^role-code:[[:space:]]*//; p; q; } }' "$ROLE_FILE")
|
|
|
|
if [[ -z "$CODE" ]]; then
|
|
echo "Error: role-code not found in ${ROLE_FILE}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$CODE"
|