|
|
|
@@ -14,7 +14,7 @@ permissions:
|
|
|
|
|
contents: write
|
|
|
|
|
issues: write
|
|
|
|
|
pull-requests: write
|
|
|
|
|
actions: write
|
|
|
|
|
actions: read
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
agent-dispatch:
|
|
|
|
@@ -26,15 +26,7 @@ jobs:
|
|
|
|
|
(contains(github.event.comment.body, '/plan') ||
|
|
|
|
|
contains(github.event.comment.body, '/implement') ||
|
|
|
|
|
contains(github.event.comment.body, '/fix'))
|
|
|
|
|
runs-on: [self-hosted, eliza]
|
|
|
|
|
container:
|
|
|
|
|
image: node:20-bookworm
|
|
|
|
|
options: --add-host host.docker.internal:host-gateway
|
|
|
|
|
env:
|
|
|
|
|
HTTP_PROXY: http://host.docker.internal:1080
|
|
|
|
|
HTTPS_PROXY: http://host.docker.internal:1080
|
|
|
|
|
ALL_PROXY: http://host.docker.internal:1080
|
|
|
|
|
NO_PROXY: localhost,127.0.0.1
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
timeout-minutes: 30
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
@@ -48,13 +40,6 @@ jobs:
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
- name: Ensure GitHub CLI is Installed
|
|
|
|
|
run: |
|
|
|
|
|
if ! command -v gh &> /dev/null; then
|
|
|
|
|
echo "Installing GitHub CLI..."
|
|
|
|
|
curl -fsSL https://github.com/cli/cli/releases/download/v2.67.0/gh_2.67.0_linux_amd64.tar.gz | tar -xz -C /usr/local --strip-components=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
- name: Acknowledge Command (Add Eyes Reaction)
|
|
|
|
|
if: success()
|
|
|
|
|
env:
|
|
|
|
@@ -98,48 +83,19 @@ jobs:
|
|
|
|
|
|
|
|
|
|
- name: Setup Antigravity CLI & Credentials
|
|
|
|
|
env:
|
|
|
|
|
GH_TOKEN: ${{ secrets.GITOPS_TOKEN || secrets.GITHUB_TOKEN }}
|
|
|
|
|
AGY_AUTH_TOKEN: ${{ secrets.AGY_AUTH_TOKEN }}
|
|
|
|
|
run: |
|
|
|
|
|
# 1. Download official Antigravity CLI binary from google-antigravity/antigravity-cli
|
|
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
|
# 1. Install Antigravity CLI (agy) if not present
|
|
|
|
|
if ! command -v agy &> /dev/null; then
|
|
|
|
|
echo "Fetching Antigravity CLI from google-antigravity/antigravity-cli..."
|
|
|
|
|
gh release download --repo google-antigravity/antigravity-cli -p "agy_cli_linux_x64.tar.gz" -O - | tar -xz -C "$HOME/.local/bin"
|
|
|
|
|
if [ -f "$HOME/.local/bin/antigravity" ] && [ ! -f "$HOME/.local/bin/agy" ]; then
|
|
|
|
|
mv "$HOME/.local/bin/antigravity" "$HOME/.local/bin/agy"
|
|
|
|
|
fi
|
|
|
|
|
ln -sf "$HOME/.local/bin/agy" "$HOME/.local/bin/antigravity"
|
|
|
|
|
chmod +x "$HOME/.local/bin/agy" "$HOME/.local/bin/antigravity"
|
|
|
|
|
echo "Installing Antigravity CLI (agy)..."
|
|
|
|
|
curl -fsSL https://antigravity.google/install.sh | bash || true
|
|
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
echo "$HOME/.gemini/antigravity-cli/bin" >> $GITHUB_PATH
|
|
|
|
|
export PATH="$HOME/.local/bin:$HOME/.gemini/antigravity-cli/bin:$PATH"
|
|
|
|
|
fi
|
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
echo "$HOME/.gemini/antigravity-cli/bin" >> $GITHUB_PATH
|
|
|
|
|
export PATH="$HOME/.local/bin:$HOME/.gemini/antigravity-cli/bin:$PATH"
|
|
|
|
|
|
|
|
|
|
# 2. Patch location eligibility check (open-antigravity-patcher CLI_GATE_X64)
|
|
|
|
|
node -e '
|
|
|
|
|
const fs = require("fs");
|
|
|
|
|
const file = process.env.HOME + "/.local/bin/agy";
|
|
|
|
|
if (!fs.existsSync(file)) process.exit(0);
|
|
|
|
|
const buf = fs.readFileSync(file);
|
|
|
|
|
let count = 0;
|
|
|
|
|
for (let i = 0; i < buf.length - 18; i++) {
|
|
|
|
|
if (buf[i] === 0x48 && buf[i+1] === 0x85 && buf[i+2] === 0xc0 && buf[i+3] === 0x0f && buf[i+4] === 0x84 &&
|
|
|
|
|
buf[i+9] === 0x80 && buf[i+10] === 0x78 && buf[i+11] === 0x08 && buf[i+12] === 0x00 &&
|
|
|
|
|
buf[i+13] === 0x0f && buf[i+14] === 0x85) {
|
|
|
|
|
buf[i+9] = 0x48; buf[i+10] = 0x85; buf[i+11] = 0xc0; buf[i+12] = 0x90;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
fs.writeFileSync(file, buf);
|
|
|
|
|
console.log(`Applied open-antigravity-patcher: ${count} gates patched.`);
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Antigravity CLI is already patched or signature not found.");
|
|
|
|
|
}
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
# 3. Inject OAuth Token
|
|
|
|
|
# 2. Inject OAuth Token
|
|
|
|
|
mkdir -p ~/.gemini/antigravity-cli
|
|
|
|
|
if [ -n "$AGY_AUTH_TOKEN" ]; then
|
|
|
|
|
if echo "$AGY_AUTH_TOKEN" | base64 --decode >/dev/null 2>&1; then
|
|
|
|
@@ -154,9 +110,8 @@ jobs:
|
|
|
|
|
|
|
|
|
|
- name: Configure Git Bot Identity
|
|
|
|
|
run: |
|
|
|
|
|
git config --global user.name "Adam Jensen [bot]"
|
|
|
|
|
git config --global user.email "adam@ermnvldmr.com"
|
|
|
|
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
|
git config --global user.name "AI Assistant Bot"
|
|
|
|
|
git config --global user.email "bot@users.noreply.github.com"
|
|
|
|
|
|
|
|
|
|
# --- COMMAND: /plan ---
|
|
|
|
|
- name: Handle /plan (Issue Planning)
|
|
|
|
@@ -174,9 +129,9 @@ jobs:
|
|
|
|
|
CONTINUE_FLAG="--continue"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
PROMPT="You are operating via GitHub Actions in non-interactive headless mode on Issue #${ISSUE_NUMBER}.\n\nIssue Context:\n${ISSUE_DATA}\n\nLatest instruction:\n${COMMENT_BODY}\n\nPlease generate/update a detailed technical implementation plan adhering to project GEMINI.md guidelines."
|
|
|
|
|
|
|
|
|
|
PLAN_OUTPUT=$(agy $CONTINUE_FLAG --mode plan --print-timeout 20m -p "$PROMPT" || echo "Agent encountered an error generating the plan.")
|
|
|
|
|
PROMPT="You are operating via GitHub Actions on Issue #${ISSUE_NUMBER}.\n\nIssue Context:\n${ISSUE_DATA}\n\nLatest instruction:\n${COMMENT_BODY}\n\nPlease generate/update a detailed technical implementation plan adhering to project GEMINI.md guidelines."
|
|
|
|
|
|
|
|
|
|
PLAN_OUTPUT=$(agy $CONTINUE_FLAG --mode plan -p "$PROMPT" || echo "Agent encountered an error generating the plan.")
|
|
|
|
|
|
|
|
|
|
DISCLOSURE="\n\n---\n*Disclosure: I'm an AI assistant helping deytenit; I'm not deytenit.*"
|
|
|
|
|
gh issue comment "$ISSUE_NUMBER" --body "${PLAN_OUTPUT}${DISCLOSURE}"
|
|
|
|
@@ -199,8 +154,8 @@ jobs:
|
|
|
|
|
CONTINUE_FLAG="--continue"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
PROMPT="You are operating via GitHub Actions in non-interactive headless mode to implement Issue #${ISSUE_NUMBER}.\n\nContext:\n${ISSUE_DATA}\n\nLatest instruction:\n${COMMENT_BODY}\n\nTask: Inspect relevant files, implement the necessary code changes directly in the workspace adhering to GEMINI.md rules, and verify them. Do not exit or stop before applying edits to the source code."
|
|
|
|
|
agy $CONTINUE_FLAG --dangerously-skip-permissions --print-timeout 25m -p "$PROMPT"
|
|
|
|
|
PROMPT="You are operating via GitHub Actions to implement Issue #${ISSUE_NUMBER}.\n\nContext:\n${ISSUE_DATA}\n\nLatest instruction:\n${COMMENT_BODY}\n\nImplement the changes cleanly in the repository according to GEMINI.md rules."
|
|
|
|
|
agy $CONTINUE_FLAG --dangerously-skip-permissions -p "$PROMPT"
|
|
|
|
|
|
|
|
|
|
echo "Running repository verification gates..."
|
|
|
|
|
pnpm typecheck
|
|
|
|
@@ -235,7 +190,6 @@ jobs:
|
|
|
|
|
run: |
|
|
|
|
|
IS_PR="${{ github.event.issue.pull_request != null }}"
|
|
|
|
|
if [ "$IS_PR" = "true" ]; then
|
|
|
|
|
# Verify PR is not from an untrusted cross-repository fork
|
|
|
|
|
IS_CROSS_REPO=$(gh pr view "$ISSUE_OR_PR_NUMBER" --json isCrossRepository -q .isCrossRepository)
|
|
|
|
|
if [ "$IS_CROSS_REPO" = "true" ]; then
|
|
|
|
|
echo "::error::Cross-repository fork PRs cannot be automatically processed in privileged context."
|
|
|
|
@@ -258,8 +212,8 @@ jobs:
|
|
|
|
|
CONTINUE_FLAG="--continue"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
PROMPT="You are operating via GitHub Actions in non-interactive headless mode to fix/adjust PR #${ISSUE_OR_PR_NUMBER} on branch ${BRANCH_NAME}.\n\nFeedback / Comment:\n${COMMENT_BODY}\n\nPR Diff:\n${PR_DIFF}\n\nFailed CI Logs (if any):\n${CI_LOGS}\n\nTask: Apply the necessary fixes directly to the files, ensuring all lint, typecheck, and test checks pass. Do not exit without applying the changes."
|
|
|
|
|
agy $CONTINUE_FLAG --dangerously-skip-permissions --print-timeout 25m -p "$PROMPT"
|
|
|
|
|
PROMPT="You are operating via GitHub Actions to fix/adjust PR #${ISSUE_OR_PR_NUMBER} on branch ${BRANCH_NAME}.\n\nFeedback / Comment:\n${COMMENT_BODY}\n\nPR Diff:\n${PR_DIFF}\n\nFailed CI Logs (if any):\n${CI_LOGS}\n\nApply the necessary fixes, making sure all lint, typecheck, and test checks pass."
|
|
|
|
|
agy $CONTINUE_FLAG --dangerously-skip-permissions -p "$PROMPT"
|
|
|
|
|
|
|
|
|
|
echo "Running repository verification gates..."
|
|
|
|
|
pnpm typecheck
|
|
|
|
@@ -283,8 +237,8 @@ jobs:
|
|
|
|
|
git checkout -b "$BRANCH_NAME"
|
|
|
|
|
|
|
|
|
|
ISSUE_DATA=$(gh issue view "$ISSUE_OR_PR_NUMBER" --comments --json title,body,comments)
|
|
|
|
|
PROMPT="You are operating via GitHub Actions in non-interactive headless mode to fix issue #${ISSUE_OR_PR_NUMBER}.\n\nContext:\n${ISSUE_DATA}\n\nInstruction:\n${COMMENT_BODY}\n\nTask: Apply the necessary fixes directly to the files adhering to GEMINI.md rules."
|
|
|
|
|
agy --dangerously-skip-permissions --print-timeout 25m -p "$PROMPT"
|
|
|
|
|
PROMPT="Fix issue #${ISSUE_OR_PR_NUMBER}.\n\nContext:\n${ISSUE_DATA}\n\nInstruction:\n${COMMENT_BODY}"
|
|
|
|
|
agy --dangerously-skip-permissions -p "$PROMPT"
|
|
|
|
|
|
|
|
|
|
pnpm typecheck
|
|
|
|
|
pnpm lint
|
|
|
|
|