Commit Graph
545 Commits
Author SHA1 Message Date
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
GitHub Actions ade221fd1c chore: bump Claude Code to 2.1.56 and Agent SDK to 0.2.56 2026-02-25 06:37:46 +00:00
GitHub Actions 48fe7dd592 chore: bump Claude Code to 2.1.55 and Agent SDK to 0.2.55 2026-02-25 03:21:10 +00:00
GitHub Actions 6ae1b29ba2 chore: bump Claude Code to 2.1.53 and Agent SDK to 0.2.53 2026-02-25 00:18:46 +00:00
Octavian Guzu 7af3506741 Add non-write users check workflow (#973) 2026-02-24 19:47:33 +00:00
GitHub Actions 35a9e0292d chore: bump Claude Code to 2.1.52 and Agent SDK to 0.2.52 2026-02-24 06:44:55 +00:00
GitHub Actions fa3312a107 chore: bump Claude Code to 2.1.51 and Agent SDK to 0.2.51 2026-02-24 01:47:14 +00:00
Octavian Guzu dd8541688d Use wrapper script for label operations in issue triage (#968)
* Use wrapper script for label operations in issue triage

Updates /label-issue command and examples to use a dedicated
edit-issue-labels.sh script for label operations instead of raw
gh issue edit. The script validates labels against the repo's existing
labels before applying them. Also tightens gh search permission to
gh search issues.

* Show multiple --add-label flags in label-issue example
2026-02-23 17:16:07 +00:00
GitHub Actions edd85d6153 chore: bump Claude Code to 2.1.49 and Agent SDK to 0.2.49 2026-02-19 23:33:09 +00:00
GitHub Actions 0cf5eeec4f chore: bump Claude Code to 2.1.47 and Agent SDK to 0.2.47 2026-02-18 21:44:15 +00:00
GitHub Actions e6cb7a7ce3 chore: bump Claude Code to 2.1.45 and Agent SDK to 0.2.45 2026-02-17 18:58:59 +00:00
GitHub Actions 2f8ba26a21 chore: bump Claude Code to 2.1.44 and Agent SDK to 0.2.44 2026-02-16 21:40:14 +00:00
cc5ef44546 feat: add display_report option to disable step summary (#952)
Add a `display_report` input parameter (default: "true") that controls
whether the Claude Code Report is written to the GitHub Step Summary.
Setting it to "false" allows users with custom formatting solutions to
avoid duplicate output in the step summary.

Closes #206

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Ashwin Bhat <ashwin-ant@users.noreply.github.com>
2026-02-15 15:49:49 -08:00
Ashwin Bhat f6a1c4c1b4 fix: grant write permissions and use @main in claude workflow (#950)
Give the workflow contents/pull-requests/issues write permissions so
the OIDC app token can push. Also point to @main instead of @v1.
2026-02-15 15:13:59 -08:00
Ashwin Bhat 68cfeead18 Revert "fix: replace deprecated :* with modern * wildcard in git permissions (#929)" (#949)
This reverts commit 1bb0e7464b.
2026-02-15 14:39:25 -08:00
Ashwin Bhat f5088835af Fix stale claudeCodeVersion in run.ts and update bump automation (#943) 2026-02-13 15:12:56 -08:00
GitHub Actions ea36d6abde chore: bump Claude Code to 2.1.42 and Agent SDK to 0.2.42 2026-02-13 19:55:13 +00:00
Ashwin BhatandClaude Opus 4.6 c22f7c3f9d revert: undo PR checkout fork support and unique branch naming (#937)
Reverts the following commits:
- f669191 fix: use unique local branch names for PR checkout to avoid conflicts (#931)
- 21e3fe0 Fix PR checkout to support fork PRs (#851)

Simplifies PR branch checkout back to using headRefName directly instead
of the pr-{number} local branch naming scheme introduced in #931 and the
GitHub pull ref fetch approach introduced in #851.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:45:01 -08:00
f669191d7d fix: use unique local branch names for PR checkout to avoid conflicts (#931)
The previous implementation used the PR's original branch name when
fetching, which could conflict with existing local or remote branches
of the same name. This caused checkout failures for PRs with common
branch names like 'main' or 'feature/xyz'.

Changes:
- Use 'pr-{number}' format for local branch names (e.g., pr-385)
- Preserve original branch name for logging purposes
- Add detailed logging showing original -> local branch mapping

This ensures uniqueness since PR numbers are unique per repository,
while maintaining support for both same-repo and fork PRs via
GitHub's pull/{number}/head refs.

Fixes the issue introduced in #851 where fork PR support was added.

Co-authored-by: Yi-Cheng Wang <yicheng.wang@heph-ai.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 19:30:25 -08:00
Octavian Guzu 8c383c5de3 fix: skip CI MCP server installation when actions:read permission is missing (#933) 2026-02-11 11:02:49 -08:00
1bb0e7464b fix: replace deprecated :* with modern * wildcard in git permissions (#929)
Replace `Bash(git add:*)` syntax with `Bash(git add *)` in default
tool permissions for tag mode and create-prompt. The colon-prefixed
wildcard syntax is deprecated and causes SDK validation errors.

Closes #856

Co-authored-by: Dave-London <hello@os4us.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 21:26:10 -08:00
GitHub Actions 23ed4cb53d chore: bump Claude Code to 2.1.39 and Agent SDK to 0.2.39 2026-02-10 23:10:22 +00:00
Sol Redfern 21e3fe0542 Fix PR checkout to support fork PRs (#851)
Use GitHub's PR refs (pull/NUMBER/head) instead of fetching branch
by name. This works for both same-repo and fork PRs because GitHub
automatically creates these refs in the base repository for all PRs.

The branch name doesn't exist on origin for fork PRs, causing:
  fatal: couldn't find remote ref <branch-name>

Using pull/${entityNumber}/head:${branchName} fetches the PR head
and creates a local branch with the correct name.

Fixes issues with tag mode failing on fork PRs.
2026-02-10 08:52:32 -08:00
GitHub Actions b433f16b30 chore: bump Claude Code to 2.1.38 and Agent SDK to 0.2.38 2026-02-10 00:52:13 +00:00
7695f7866a fix: skip dev dependencies in CI install step (#919)
Use `bun install --production` instead of `bun install` in both
action.yml and base-action/action.yml to skip installing devDependencies
(@types/*, prettier, typescript) that are not needed at runtime.

Bun runs TypeScript natively without needing the typescript compiler
or type definition packages. This reduces installed packages from 151
to 135 and speeds up the install step.

Fixes #895

Co-authored-by: Dave-London <hello@os4us.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:09:41 -08:00
Ashwin BhatandClaude d5b01b6843 Update claude-opus-4-5 to claude-opus-4-6 in workflow (#909)
* Update claude-opus-4-5 to claude-opus-4-6 in workflow

* Fix whitespace formatting in docs and commands

* Fix whitespace formatting in docs and commands

* Add claude-opus-4-6 model to PR review workflow

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-07 14:18:08 -08:00
GitHub Actions 6c61301d8e chore: bump Claude Code to 2.1.37 and Agent SDK to 0.2.37 2026-02-07 19:08:42 +00:00
GitHub Actions db388438c1 chore: bump Claude Code to 2.1.36 and Agent SDK to 0.2.36 2026-02-07 18:00:59 +00:00
GitHub Actions b113f49a56 chore: bump Claude Code to 2.1.33 and Agent SDK to 0.2.33 2026-02-06 01:46:07 +00:00
Ashwin Bhat 7057f3318b refactor: simplify mode system by removing Mode interface and registry (#899)
Replace the over-engineered Mode interface/registry/detector pattern with
straightforward inline logic. There are only 2 modes (tag and agent) and
the complexity wasn't justified.

- Delete Mode interface, registry, and prepare pass-through modules
- Export prepareTagMode() and prepareAgentMode() as standalone functions
- Inline trigger checking and mode dispatch in run.ts/prepare.ts
- Change generatePrompt/createPrompt to take modeName string instead of Mode
- Remove dead code (extractGitHubContext, unused detector helpers)
- Update CLAUDE.md to reflect new architecture
2026-02-05 17:22:30 -08:00
David Dworken f09dc9a6a3 fix: use original body from webhook payload for TOCTOU hardening (#904)
* fix: use original body from webhook payload for TOCTOU hardening

* test: add null originalBody + edited GraphQL body TOCTOU scenario
2026-02-05 10:54:51 -08:00
GitHub Actions 006aaf2935 chore: bump Claude Code to 2.1.32 and Agent SDK to 0.2.32 2026-02-05 17:46:38 +00:00
Ashwin Bhat 9a3c761f54 refactor: unify action into single composite step with run.ts entrypoint (#898)
* refactor: unify action into single composite step with run.ts entrypoint

Consolidate the prepare and base-action phases into a single composite
step that runs src/entrypoints/run.ts. This simplifies the action.yml
from multiple steps to one execution step, while keeping the same
behavior.

Key changes:
- Add src/entrypoints/run.ts as unified entrypoint
- Simplify action.yml to single 'Run Claude Code Action' step
- Pass all inputs via environment variables
- Update base-action to accept inputs via env vars
- Support agent mode auto-detection from prompt input

* refactor: keep SSH signing cleanup and token revocation as separate action steps

Move SSH signing key cleanup and app token revocation back to separate
composite action steps in action.yml with always() conditions, rather
than handling them inside run.ts. This keeps these cleanup concerns
as independently visible steps in the workflow.

* fix: address PR review feedback

- Use path.dirname() instead of manual string slicing for executable path
- Differentiate prepare vs execution errors in catch block so tracking
  comment accurately reflects which phase failed
- Update CLAUDE.md architecture docs to reflect unified run.ts entrypoint
  and four-phase design

* fix: address PR review feedback

- Use path.dirname() instead of manual string slicing for executable path
- Differentiate prepare vs execution errors in catch block so tracking
  comment accurately reflects which phase failed
- Rewrite CLAUDE.md to focus on mental model, key concepts, and gotchas
  instead of exhaustive file listings
2026-02-03 20:09:43 -08:00
GitHub Actions 6867bb3ab0 chore: bump Claude Code to 2.1.31 and Agent SDK to 0.2.31 2026-02-04 00:42:58 +00:00