Commit Graph
20 Commits
Author SHA1 Message Date
Vlad Mocanu ef8657f2de Merge pull request 'feat(prd-1): Forgejo platform support' (#3) from feature/prd-1-forgejo-platform-support into main 2026-02-25 17:58:17 +00:00
Vlad MocanuandClaude Opus 4.6 bed5cd03c2 docs(prd-1): move completed PRD to prds/done/
PRD #1 (Forgejo Platform Support) is 100% complete.
All milestones M1-M9 implemented and validated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:56:02 +02:00
Vlad MocanuandClaude Opus 4.6 44f598ff11 feat(prd-1): complete M9 - documentation & upstream merge validation
- Created docs/forgejo.md: comprehensive setup guide (prerequisites,
  quick start, platform detection, GitHub differences, CI workflows,
  upstream merge process, known limitations, troubleshooting)
- Updated README.md with Forgejo support mention and docs link
- Updated CLAUDE.md with Forgejo architecture section
- Added platform input to docs/usage.md inputs table
- Added 5 Forgejo FAQ entries to docs/faq.md
- Upstream merge validated: zero conflicts (based on latest upstream)
- PRD #1 100% complete: all milestones M1-M9 done, 794 tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:55:25 +02:00
Vlad Mocanu 5daed4f9bf feat(prd-1): complete M8 - E2E testing on Forgejo
- Mark M8 as complete: agent mode E2E passes on Forgejo runner
- Update actor.ts table entry: skipped on Forgejo (read:user scope)
- Mark setup-bun risk as RESOLVED (replaced with curl install)
- Document M8 fixes: permission check, actor skip, curl bun, CI env

Progress: 89% complete - M9 (docs + upstream merge validation) remaining
2026-02-25 19:49:46 +02:00
Vlad MocanuandClaude Opus 4.6 f93e8a10d0 fix(prd-1): skip actor check on Forgejo + replace setup-bun with curl install
- Skip checkHumanActor on Forgejo (no bot accounts, avoids read:user scope)
- Replace oven-sh/setup-bun action with curl install in action.yml
  (Forgejo runner pre-fetches all uses: refs even when if: skips them)
- Mirror oven-sh/setup-bun created at xternal/setup-bun for future use

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:45:47 +02:00
Vlad Mocanu ead98f44f9 fix(prd-1): skip actor check on Forgejo (no bot accounts, avoids read:user scope) 2026-02-25 19:40:24 +02:00
Vlad Mocanu 6eb2e41510 fix(prd-1): remove debug output from CI test step 2026-02-25 18:54:24 +02:00
Vlad Mocanu 9be00086b9 debug(prd-1): add GITHUB_SERVER_URL debug output to CI test step 2026-02-25 18:51:27 +02:00
Vlad MocanuandClaude Opus 4.6 c9a6c56790 fix(prd-1): inline GITHUB_SERVER_URL export in CI test step
Forgejo runner re-injects GITHUB_SERVER_URL after step-level env is
set, so the env: key approach doesn't override it. Using inline export
in the run command ensures the override takes effect before bun loads
modules (config.ts module-level constants read process.env at import).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:43:40 +02:00
Vlad MocanuandClaude Opus 4.6 638645b8af fix(prd-1): handle undefined actor type on Forgejo
Forgejo's user API doesn't return a `type` field (GitHub returns
"User" or "Bot"). The undefined type was incorrectly treated as
non-human, blocking all Forgejo workflows. Now treat undefined/empty
type as human — Forgejo doesn't have GitHub-style bot accounts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:41:14 +02:00
Vlad MocanuandClaude Opus 4.6 e26d08e666 fix(prd-1): fix CI test failures and Forgejo permission check
Two issues found during M8 E2E testing on Forgejo:

1. CI test failures (31 tests): Unit tests assume GitHub context but
   Forgejo runner sets GITHUB_SERVER_URL=git.wxs.ro, causing
   detectPlatform() to return "forgejo" and module-level constants in
   config.ts to use Forgejo URLs. Fixed by setting GITHUB_SERVER_URL
   in the test step env. Forgejo-specific tests already override with
   PLATFORM=forgejo in their beforeEach.

2. Permission check 403: Forgejo's getCollaboratorPermissionLevel
   requires admin access. Added checkForgejoPermissions() that uses
   GET /repos/{owner}/{repo} instead — returns a permissions object
   with { admin, push, pull } booleans for the authenticated token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:39:18 +02:00
Vlad MocanuandClaude Opus 4.6 c61073da42 feat(prd-1): implement M3 - Forgejo CI workflows
- ci.yml: 3-job CI (test, prettier, typecheck) on grunt runner
- test-action.yml: agent-mode self-test (weekly + PR path triggers)
- upstream-sync.yml: weekly upstream check with labeled issue dedup
- Updated PRD checkboxes for M3 completion

Progress: 78% complete (7/9 milestones) - M8 (e2e testing) next

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:29:47 +02:00
Vlad MocanuandClaude Opus 4.6 88401255be feat(prd-1): implement M7 - entry point + mode handler integration
- Tag mode routes to fetchForgejoData vs fetchGitHubData based on platform
- createInitialComment auto-detects platform for Forgejo spinner/URL format
- update-comment-link uses updateForgejoCommentBody + Forgejo PR compare URL
- update-with-branch uses platform-aware branch/job-run link formatting
- Agent mode needed NO changes (token in run.ts, rest uses Octokit REST)
- 11 new integration tests in test/m7-integration.test.ts
- 785 tests pass, typecheck clean, format clean

Progress: 78% complete (7/9 milestones) - M3, M8, M9 remaining

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:22:27 +02:00
Vlad MocanuandClaude Opus 4.6 ce1459fe7f feat(prd-1): implement M6 - MCP server platform routing
- Add platform detection to prepareMcpConfig() via detectPlatform()
- Skip GitHub public MCP server (ghcr.io/github/github-mcp-server) on Forgejo
- Skip checkActionsReadPermission on Forgejo (workflow token has full access)
- Reuse existing github-actions-server.ts for both platforms (no duplication)
- Add 6 Forgejo-specific tests to install-mcp-server.test.ts
- Updated PRD checkboxes for M6

Progress: 67% complete (6/9 milestones) - M7 now unblocked

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:57:35 +02:00
Vlad MocanuandClaude Opus 4.6 0802ac18eb feat(prd-1): implement M5 - Forgejo comment URL formatting
- Create src/forgejo/comment-logic.ts with Forgejo-specific URL builders:
  - Unicode spinner (replaces GitHub CDN image)
  - PR compare URL with expand=1 (no quick_pull=1)
  - Dynamic extractOwnerRepoFromUrl() fixing hardcoded github.com regex
  - updateForgejoCommentBody() with cross-platform URL extraction
- 41 tests covering all URL patterns, spinner, and the critical regex fix
- No upstream files modified (lean adapter approach)

Progress: 56% complete (5/9) - next: M6 (MCP server platform routing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:48:16 +02:00
Vlad MocanuandClaude Opus 4.6 4b0737c54c feat(prd-1): implement M4b - Forgejo REST comment/review fetching
- Add 3 REST calls to Promise.all for PRs (listComments, listReviews,
  listReviewComments) and 1 for issues (listComments)
- Add mapping helpers: mapRestComments, mapRestReviewComments,
  mapRestReviews (groups inline comments by pull_request_review_id)
- Import and apply TOCTOU filtering (filterCommentsToTriggerTime,
  filterReviewsToTriggerTime) and actor filtering from GitHub fetcher
- Add image processing pipeline via downloadCommentImages (no-op on
  Forgejo due to URL pattern mismatch, architecturally correct)
- Deep-clone reviews before filtering to preserve contextData immutability
- Update test suite: 51 tests covering mapping helpers, full fetch
  flow, TOCTOU filtering, actor filtering, and contextData immutability
- Updated PRD checkboxes for M4b completion

Progress: 44% complete (4/9 milestones) - next: M5 or M3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:00:13 +02:00
Vlad MocanuandClaude Opus 4.6 6e104a33dc feat(prd-1): implement M4a - Forgejo REST data fetching (PR/issue basics)
- Add src/forgejo/data/fetcher.ts: REST-based data fetcher replacing
  GraphQL queries with parallel Octokit REST calls (PR details + files
  + commits via Promise.all, issue details, file status mapping, SHA
  computation, TOCTOU title/body protection, user display name)
- Add test/forgejo-data-fetcher.test.ts with 31 test cases covering
  field mapping, parallel fetch, null handling, and edge cases
- Output matches FetchDataResult type for downstream compatibility
- Comments/reviews left empty (M4b scope)

Progress: 33% complete (M1, M2, M4a done) - next: M4b or M5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:19:09 +02:00
Vlad MocanuandClaude Opus 4.6 385acacc32 feat(prd-1): implement M2 - Forgejo token handling
- Add src/forgejo/token.ts: synchronous token handler that returns
  OVERRIDE_GITHUB_TOKEN or DEFAULT_WORKFLOW_TOKEN directly (no OIDC)
- Wire platform-aware token setup into run.ts with early branch
  before existing setupGitHubToken() call
- Add test/forgejo-token.test.ts with 8 test cases covering
  override precedence, default fallback, and error handling
- GitHub token path remains completely unchanged

Progress: 22% complete (M1, M2 done) - next: M3 (CI workflows) or M5 (comment URLs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:10:00 +02:00
Vlad MocanuandClaude Opus 4.6 72f11f320c feat(prd-1): implement M1 - platform detection and action.yml modifications
- Add src/platform/detector.ts with 3-tier detection (explicit input,
  FORGEJO env var, GITHUB_SERVER_URL heuristic)
- Add 'platform' input to action.yml (auto/github/forgejo)
- Add 'Detect Platform' shell step as first composite action step
- Split bun installation: oven-sh/setup-bun for GitHub, curl fallback
  for Forgejo runners
- Condition 'Revoke app token' step to skip on Forgejo
- Pass resolved PLATFORM env var to run step
- Add 14 unit tests covering all detection paths

Progress: M1 complete (1/9 milestones) - M2 and M5 now unblocked

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:03:51 +02:00
Vlad MocanuandClaude Opus 4.6 411eb3d69d docs(prd-1): create PRD #1 - Forgejo platform support [skip ci]
- Lean adapter architecture: ~8 new files, reuse existing Octokit REST code
- REST-based data fetching to replace GitHub GraphQL queries
- Platform detection via explicit input + env-var auto-detection
- Custom Forgejo CI workflows with action self-test
- 10 milestones across 4 phases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:54:10 +02:00