rea-ci-tests-audit
MOmorluto/rea485k近 7 天新增 9,215 个 star
Sets up Caliber for automatic AI agent context sync. Installs pre-commit hooks so CLAUDE.md, Cursor rules, and Copilot instructions update automatically on every commit. Use when Caliber hooks are not yet installed or when the user asks about keeping agent configs in sync.
Dynamic onboarding for Caliber — automatic AI agent context sync. Run all diagnostic steps below on every invocation to determine what's already set up and what still needs to be done.
Run these checks in order. For each step, check the current state first, then only act if something is missing.
command -v caliber >/dev/null 2>&1 && caliber --version || echo "NOT_INSTALLED"
If a version prints → Caliber is installed globally. Set CALIBER="caliber" and move to Step 2.
If NOT_INSTALLED → Install it globally (faster for daily use since the pre-commit hook runs on every commit):
npm install -g @rely-ai/caliber
Set CALIBER="caliber".
If npm fails (permissions, no sudo, etc.), fall back to npx:
npx @rely-ai/caliber --version 2>/dev/null || echo "NO_NODE"
CALIBER="npx @rely-ai/caliber". This works but adds ~500ms per invocation.grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "HOOK_ACTIVE" || echo "NO_HOOK"
$CALIBER hooks --install
First, detect which coding agents are configured in this project:
AGENTS=""
[ -d .claude ] && AGENTS="claude"
[ -d .cursor ] && AGENTS="${AGENTS:+$AGENTS,}cursor"
[ -d .agents ] || [ -f AGENTS.md ] && AGENTS="${AGENTS:+$AGENTS,}codex"
[ -f .github/copilot-instructions.md ] && AGENTS="${AGENTS:+$AGENTS,}github-copilot"
echo "DETECTED_AGENTS=${AGENTS:-none}"
If no agents are detected, ask the user which coding agents they use (Claude Code, Cursor, Codex, GitHub Copilot). Build the agent list from their answer as a comma-separated string (e.g. "claude,cursor").
Then check if agent configs exist:
echo "CLAUDE_MD=$([ -f CLAUDE.md ] && echo exists || echo missing)"
echo "CURSOR_RULES=$([ -d .cursor/rules ] && ls .cursor/rules/*.mdc 2>/dev/null | wc -l | tr -d ' ' || echo 0)"
echo "AGENTS_MD=$([ -f AGENTS.md ] && echo exists || echo missing)"
echo "COPILOT=$([ -f .github/copilot-instructions.md ] && echo exists || echo missing)"
$CALIBER init --auto-approve --agent <comma-separated-agents>
For example: $CALIBER init --auto-approve --agent claude,cursor
This generates CLAUDE.md, Cursor rules, AGENTS.md, skills, and sync infrastructure for the specified agents.$CALIBER score --json --quiet 2>/dev/null | head -1
$CALIBER refresh
Ask the user: "Are you setting up for yourself only, or for your team too?"
If solo → Continue with solo setup:
Check if session learning is enabled:
$CALIBER learn status 2>/dev/null | head -3
$CALIBER learn install
Then tell the user: "You're all set! Here's what happens next:
$CALIBER skills anytime to discover community skills for your stack"Then show the summary (see below) and stop.
If team → Check if the GitHub Action already exists:
[ -f .github/workflows/caliber-sync.yml ] && echo "ACTION_EXISTS" || echo "NO_ACTION"
If ACTION_EXISTS → Tell the user: "GitHub Action is already configured."
If NO_ACTION → Tell the user: "I'll create a GitHub Action that syncs configs nightly and on every PR."
Write this file to .github/workflows/caliber-sync.yml:
name: Caliber Sync
on:
schedule:
- cron: '0 3 * * 1-5'
pull_request:
types: [opened, synchronize]
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: caliber-ai-org/ai-setup@v1
with:
mode: sync
auto-refresh: true
comment: true
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Now determine which LLM provider the team uses. Check the local Caliber config:
$CALIBER config --show 2>/dev/null || echo "NO_CONFIG"
Based on the provider, the GitHub Action needs the corresponding secret:
ANTHROPIC_API_KEYOPENAI_API_KEYVERTEX_PROJECT_ID and GOOGLE_APPLICATION_CREDENTIALS (service account JSON)Update the workflow env block to match the provider. For example, if using OpenAI:
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Then check if the gh CLI is available to set the secret:
command -v gh >/dev/null 2>&1 && echo "GH_AVAILABLE" || echo "NO_GH"
gh secret set ANTHROPIC_API_KEY
(This prompts for the value securely via stdin)Finally, offer to commit and push the workflow file:
git add .github/workflows/caliber-sync.yml
git commit -m "feat: add Caliber sync GitHub Action"
git push
After completing all steps, show the user what's configured:
Caliber Setup Complete:
✓ Caliber installed (vX.X.X)
✓ Pre-commit hook — configs sync on every commit
✓ Agent configs — CLAUDE.md, Cursor rules, AGENTS.md
✓ Config score: X/100
✓ GitHub Action — nightly sync + PR checks (team only)
From now on, every commit keeps all your agent configs in sync automatically.
MOmorluto/rea485k近 7 天新增 9,215 个 star
MOmorluto/rea485k近 7 天新增 9,215 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star
MAmattpocock/skills336k近 7 天新增 5,004 个 star