{"id":47976864,"url":"https://github.com/ai-ecoverse/as-a-bot","last_synced_at":"2026-04-04T10:57:01.873Z","repository":{"id":312773191,"uuid":"1048681049","full_name":"ai-ecoverse/as-a-bot","owner":"ai-ecoverse","description":"If I were I bot, I'd…","archived":false,"fork":false,"pushed_at":"2026-03-12T08:44:39.000Z","size":236,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-12T15:33:50.444Z","etag":null,"topics":["ai","ai-agents","cloudflare-worker","github","github-app"],"latest_commit_sha":null,"homepage":"https://github.com/apps/as-a-bot","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ai-ecoverse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-01T21:10:35.000Z","updated_at":"2026-03-12T08:44:43.000Z","dependencies_parsed_at":"2025-09-01T23:33:32.196Z","dependency_job_id":"a68799ea-f235-4e24-9e63-509d24b1cdfb","html_url":"https://github.com/ai-ecoverse/as-a-bot","commit_stats":null,"previous_names":["trieloff/as-a-bot","ai-ecoverse/as-a-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ai-ecoverse/as-a-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-ecoverse%2Fas-a-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-ecoverse%2Fas-a-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-ecoverse%2Fas-a-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-ecoverse%2Fas-a-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ai-ecoverse","download_url":"https://codeload.github.com/ai-ecoverse/as-a-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-ecoverse%2Fas-a-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31397056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","cloudflare-worker","github","github-app"],"created_at":"2026-04-04T10:57:01.292Z","updated_at":"2026-04-04T10:57:01.864Z","avatar_url":"https://github.com/ai-ecoverse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub App Token Broker for ai-aligned-gh\n\n[![99% Vibe_Coded](https://img.shields.io/badge/99%25-Vibe_Coded-ff69b4?style=for-the-badge\u0026logo=claude\u0026logoColor=white)](https://github.com/ai-ecoverse/vibe-coded-badge-action)\n\nA minimal Cloudflare Worker that provides user-to-server GitHub tokens via device flow for `ai-aligned-gh`. \n\n**Key Feature**: Actions appear as the user (with app badge), not as \"app/as-a-bot\".\n\n## 🎯 Problem Solved\n\n- ❌ **Without this worker**: PRs show `app/as-a-bot` as author\n- ✅ **With this worker**: PRs show `username` + app badge as author\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n1. **GitHub App with Device Flow enabled**:\n   - Go to your GitHub App settings\n   - Check ✅ \"Enable Device Flow\"\n   - Note the Client ID\n\n2. **Cloudflare Workers account**\n\n### Deploy\n\n```bash\n# Clone and install\ngit clone https://github.com/ai-ecoverse/as-a-bot\ncd as-a-bot\nnpm install\n\n# Configure\nwrangler secret put GITHUB_CLIENT_ID  # Enter your GitHub App Client ID\n\n# Deploy\nwrangler deploy\n```\n\n## 🔌 API Endpoints\n\nOnly two endpoints needed for device flow:\n\n### Start Device Flow\n```bash\nPOST /user-token/start\nBody: {\"scopes\": \"repo\"}\n\nResponse:\n{\n  \"device_code\": \"...\",\n  \"user_code\": \"ABCD-1234\",\n  \"verification_uri\": \"https://github.com/login/device\",\n  \"expires_in\": 900,\n  \"interval\": 5\n}\n```\n\n### Poll for Token\n```bash\nPOST /user-token/poll\nBody: {\"device_code\": \"...\"}\n\nResponse:\n{\n  \"access_token\": \"ghu_...\",  # User-to-server token\n  \"token_type\": \"bearer\",\n  \"expires_at\": \"...\",\n  \"scope\": \"repo\"\n}\n```\n\n## 🔧 Integration with ai-aligned-gh\n\n`ai-aligned-gh` will automatically use this worker to get properly attributed tokens:\n\n```bash\n# Configure ai-aligned-gh with your worker URL\nexport AS_A_BOT_WORKER_URL=\"https://your-worker.workers.dev\"\n\n# Use ai-aligned-gh normally - it handles the device flow\nai-aligned-gh pr create --title \"My PR\" --body \"Properly attributed!\"\n```\n\n## 📝 Manual Testing\n\n```bash\n# Start device flow\nRESPONSE=$(curl -sS -X POST https://your-worker.workers.dev/user-token/start \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"scopes\": \"repo\"}')\n\n# Extract values\nUSER_CODE=$(echo $RESPONSE | jq -r .user_code)\nDEVICE_CODE=$(echo $RESPONSE | jq -r .device_code)\n\n# Show instructions\necho \"1. Go to: https://github.com/login/device\"\necho \"2. Enter code: $USER_CODE\"\necho \"3. Then run: curl -X POST https://your-worker.workers.dev/user-token/poll -d '{\\\"device_code\\\":\\\"$DEVICE_CODE\\\"}'\"\n```\n\n## 🔍 Verify Attribution\n\nCreate a test issue to verify proper attribution:\n\n```bash\n# Get token from device flow\nTOKEN=\"ghu_...\"  # Your user-to-server token\n\n# Create issue\ncurl -X POST https://api.github.com/repos/OWNER/REPO/issues \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"title\": \"Test\", \"body\": \"Should show me as author with app badge\"}'\n```\n\n**Expected**: Issue shows your username + app badge, NOT \"app/as-a-bot\"\n\n## ⚙️ Configuration\n\n| Variable | Description | Required |\n|----------|-------------|----------|\n| `GITHUB_CLIENT_ID` | GitHub App Client ID | Yes |\n| `GITHUB_API` | GitHub API URL (default: https://api.github.com) | No |\n\n## 🏗️ Architecture\n\n```\nai-aligned-gh\n     ↓\n[Device Flow Start] → User authorizes on GitHub\n     ↓\n[Device Flow Poll] → Receives user-to-server token\n     ↓\nGitHub API calls show proper user attribution\n```\n\n## Related Projects\n\nPart of the **[AI Ecoverse](https://github.com/ai-ecoverse/.github)** - a comprehensive ecosystem of tools for AI-assisted development:\n\n- **[yolo](https://github.com/ai-ecoverse/yolo)** - AI CLI launcher with worktree isolation\n- **[ai-aligned-git](https://github.com/ai-ecoverse/ai-aligned-git)** - Git wrapper for safe AI commit practices\n- **[ai-aligned-gh](https://github.com/ai-ecoverse/ai-aligned-gh)** - GitHub CLI wrapper for proper AI attribution\n- **[vibe-coded-badge-action](https://github.com/ai-ecoverse/vibe-coded-badge-action)** - Badge showing AI-generated code percentage\n- **[gh-workflow-peek](https://github.com/ai-ecoverse/gh-workflow-peek)** - Smarter GitHub Actions log filtering\n- **[upskill](https://github.com/ai-ecoverse/gh-upskill)** - Install Claude/Agent skills from other repositories\n\n## 📄 License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-ecoverse%2Fas-a-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fai-ecoverse%2Fas-a-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-ecoverse%2Fas-a-bot/lists"}