Rename the `rails/` directory to `tools/` for agent discoverability — agents frequently failed to locate helper scripts due to the non-intuitive directory name. Add backward-compat symlink `rails/ → tools/`. New tool suites: - Authentik: auth-token, user-list, user-create, group-list, app-list, flow-list, admin-status (8 scripts) - Coolify: team-list, project-list, service-list, service-status, deploy, env-set (7 scripts) - Woodpecker: pipeline-list, pipeline-status, pipeline-trigger (3 stubs) - GLPI: session-init, computer-list, ticket-list, ticket-create, user-list (6 scripts) - Health: stack-health.sh — stack-wide connectivity check Infrastructure: - Shared credential loader at tools/_lib/credentials.sh - install.sh creates symlink + chmod on tool scripts - All ~253 rails/ path references updated across 68+ files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
1.5 KiB
Bash
Executable File
66 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# mosaic-context-loader.sh — SessionStart hook for Claude Code
|
|
# Injects mandatory Mosaic config files into agent context at session init.
|
|
# Stdout from this script is added to Claude's context before processing.
|
|
set -euo pipefail
|
|
|
|
MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
|
|
|
# Mandatory load order (per AGENTS.md contract)
|
|
MANDATORY_FILES=(
|
|
"$MOSAIC_HOME/SOUL.md"
|
|
"$MOSAIC_HOME/USER.md"
|
|
"$MOSAIC_HOME/STANDARDS.md"
|
|
"$MOSAIC_HOME/AGENTS.md"
|
|
"$MOSAIC_HOME/TOOLS.md"
|
|
)
|
|
|
|
# E2E delivery guide (case-insensitive lookup)
|
|
E2E_DELIVERY=""
|
|
for candidate in \
|
|
"$MOSAIC_HOME/guides/E2E-DELIVERY.md" \
|
|
"$MOSAIC_HOME/guides/e2e-delivery.md"; do
|
|
if [[ -f "$candidate" ]]; then
|
|
E2E_DELIVERY="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
|
|
# Runtime-specific reference
|
|
RUNTIME_FILE="$MOSAIC_HOME/runtime/claude/RUNTIME.md"
|
|
|
|
# Project-local AGENTS.md (cwd at session start)
|
|
PROJECT_AGENTS=""
|
|
if [[ -f "./AGENTS.md" ]]; then
|
|
PROJECT_AGENTS="./AGENTS.md"
|
|
fi
|
|
|
|
emit_file() {
|
|
local filepath="$1"
|
|
local label="${2:-$(basename "$filepath")}"
|
|
if [[ -f "$filepath" ]]; then
|
|
echo "=== MOSAIC: $label ==="
|
|
cat "$filepath"
|
|
echo ""
|
|
fi
|
|
}
|
|
|
|
echo "=== MOSAIC CONTEXT INJECTION (SessionStart) ==="
|
|
echo ""
|
|
|
|
for f in "${MANDATORY_FILES[@]}"; do
|
|
emit_file "$f"
|
|
done
|
|
|
|
if [[ -n "$E2E_DELIVERY" ]]; then
|
|
emit_file "$E2E_DELIVERY" "E2E-DELIVERY.md"
|
|
fi
|
|
|
|
if [[ -n "$PROJECT_AGENTS" ]]; then
|
|
emit_file "$PROJECT_AGENTS" "Project AGENTS.md ($(pwd))"
|
|
fi
|
|
|
|
emit_file "$RUNTIME_FILE" "Claude RUNTIME.md"
|
|
|
|
echo "=== END MOSAIC CONTEXT INJECTION ==="
|