vk_hackathon/run_codex.sh

41 lines
1.2 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
## 3) `bin/codex-start` чтобы всё поднималось само
`SKILL.md` сам по себе **не умеет магически запускать Codex при открытии терминала**. Для этого нужен обычный wrapper-скрипт. Вот рабочий вариант:
```bash
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
cd "$ROOT"
mkdir -p .ai_update/sessions
touch .ai_update/current_status.md
touch .ai_update/handoff.md
touch .ai_update/changelog.md
touch .ai_update/touched_files.md
COMPOSE_FILE=""
if [ -f docker-compose.yml ]; then
COMPOSE_FILE="docker-compose.yml"
elif [ -f compose.yaml ]; then
COMPOSE_FILE="compose.yaml"
elif [ -f compose.yml ]; then
COMPOSE_FILE="compose.yml"
fi
if [ -n "$COMPOSE_FILE" ] && command -v docker >/dev/null 2>&1; then
if ! docker compose ps --status running >/dev/null 2>&1; then
docker compose up -d --build || true
else
RUNNING_COUNT="$(docker compose ps --status running --services 2>/dev/null | wc -l | tr -d ' ')"
if [ "${RUNNING_COUNT:-0}" = "0" ]; then
docker compose up -d --build || true
fi
fi
fi
exec codex "$@"