agent/claude/ci/scripts/detect-forge.sh
Snider e3eac36b05 feat: migrate CI commands to Forge API, add hooks.json, fix prefer-core heredoc handling
- Update CI skill commands (status, fix, run, workflow) to detect Forge vs GitHub
  and use Forge API with curl + FORGE_TOKEN instead of gh CLI
- Add detect-forge.sh script for CI provider detection from git remote
- Add hooks.json with PreToolUse, PostToolUse, PreCompact, SessionStart hooks
- Fix prefer-core.sh false positives: strip heredoc content before checking commands,
  tighten wildcard matching for mv/cp to only block bare wildcards
- Update plugin.json: rename to "code", bump to v0.1.3, point URLs to Forge
- Update block-docs.sh with improved blocking rules

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-12 18:55:04 +00:00

21 lines
788 B
Bash
Executable file

#!/bin/bash
# Detect CI provider from git remote
# Outputs: "forgejo" or "github" or "unknown"
# Also exports FORGE_API, FORGE_OWNER, FORGE_REPO
REMOTE_URL=$(git remote get-url origin 2>/dev/null)
if echo "$REMOTE_URL" | grep -q "forge.lthn.ai"; then
echo "forgejo"
# Extract owner/repo from SSH or HTTPS URL
# SSH: ssh://git@forge.lthn.ai:2223/core/go.git
# HTTPS: https://forge.lthn.ai/core/go.git
OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's#.*forge\.lthn\.ai[:/]+([0-9]+/)?##; s#\.git$##')
export FORGE_API="https://forge.lthn.ai/api/v1"
export FORGE_OWNER=$(echo "$OWNER_REPO" | cut -d'/' -f1)
export FORGE_REPO=$(echo "$OWNER_REPO" | cut -d'/' -f2)
elif echo "$REMOTE_URL" | grep -qE "github\.com"; then
echo "github"
else
echo "unknown"
fi