Commit Graph
54 Commits
Author SHA1 Message Date
Renovate Bot 61378aa2d1 Update dependency kcl-ci to v1.43.3 2026-03-16 10:25:21 +02:00
Vlad Mocanu 82785e2223 fix: add guardrail to upstream-sync prompt to prevent early stop
Claude was resolving merge conflicts but stopping before running tests,
committing, pushing, or creating the PR. Add explicit instruction that
the job is not done until the branch is pushed and PR is created.
2026-03-16 10:16:45 +02:00
forgejo-actions[bot] d52220657c chore: regenerate workflows from KCL [skip ci] 2026-03-16 06:25:30 +00:00
Renovate Bot 5ad834076c Update dependency kcl-ci to v1.43.2 2026-03-16 08:25:23 +02:00
Vlad Mocanu dfeb5ef7c0 chore: regenerate workflows from KCL [skip ci] 2026-03-09 22:12:17 +02:00
Renovate Bot 38f7294fba Update dependency kcl-ci to v1.43.0 2026-03-09 18:25:19 +02:00
forgejo-actions[bot] f257619d18 chore: regenerate workflows from KCL [skip ci] 2026-03-04 16:25:24 +00:00
Renovate Bot da5b998949 Update dependency kcl-ci to v1.42.0 2026-03-04 18:25:19 +02:00
forgejo-actions[bot] f8bb3fb562 chore: regenerate workflows from KCL [skip ci] 2026-03-02 18:25:23 +00:00
Renovate Bot 1073da9bb3 Update dependency kcl-ci to v1.41.1 2026-03-02 20:25:18 +02:00
Vlad MocanuandClaude Opus 4.6 b4fa3bbd24 chore: bump kcl-ci to v1.40.2
Use generic email for mirror commits (noreply@forgejo-actions)
to avoid exposing internal domain on Codeberg.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:00:25 +02:00
Vlad MocanuandClaude Opus 4.6 90a9904e9f feat: mirror to Codeberg via SSH deploy key
Push clean copy (without .forgejo/ and prds/) to Codeberg on
each push to main. Uses SSH deploy key for authentication.

Also bumps kcl-ci to v1.40.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:52:39 +02:00
Vlad MocanuandClaude Opus 4.6 0e082695c9 chore: bump kcl-ci to v1.38.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:39:26 +02:00
Vlad MocanuandClaude Opus 4.6 f7e1e41b49 feat: add mirror branch workflow for Codeberg sync
Adds a mirror-branch workflow that copies main to a `codeberg` branch
excluding .forgejo/ and prds/ directories. Configure Forgejo push mirror
on this branch to sync a clean copy to Codeberg.

Also picks up updated allowed_tools from kcl-ci (adds bunx/npx patterns).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:36:34 +02:00
forgejo-actions[bot] 3b8f84bb55 chore: regenerate workflows from KCL [skip ci] 2026-02-27 12:25:30 +00:00
Renovate Bot 1d17bd1825 Update dependency kcl-ci to v1.37.2 2026-02-27 14:25:22 +02:00
Vlad MocanuandClaude Opus 4.6 307af41a7f fix: allow test-action agent mode to run on claude bot PRs
The actor guard (github.actor != 'claude') was skipping test-agent-mode
on upstream-sync PRs. Refined the condition to only skip on non-PR events
(where tag mode loop risk exists) while allowing PR events through.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:52:28 +02:00
Vlad MocanuandClaude Opus 4.6 80082fbe8f fix: use label ID for Forgejo issue search and prevent duplicate labels
Forgejo's /issues?labels= filter requires integer IDs, not label names.
The workflow was searching by name (returning 0 results) then creating
a new issue every run.

Fix: look up label first, only create if missing, then use the ID for
both issue search and issue creation. This prevents both duplicate
issues and duplicate labels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:38:41 +02:00
Vlad MocanuandClaude Opus 4.6 841717842f fix: improve upstream-sync Claude prompt and permissions
- Add command execution rules to prompt (no env prefixes, no 2>&1)
- Document pre-existing test failures so Claude doesn't waste turns
- Add Bash(echo:*) and Bash(cat:*) to allowed_tools
- Delete stale remote branches before creating new ones

Addresses 24 permission denials in last run where Claude spent
~15 of 47 turns on blocked commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:34:19 +02:00
Vlad MocanuandClaude Opus 4.6 f3e800e254 fix: use integer label IDs for Forgejo issue creation
Forgejo's create-issue API expects `labels` as `[int64]` (label IDs),
not `[{"name": "..."}]` like GitHub. The previous format caused a JSON
unmarshal error, silently returning null instead of creating the issue.

Changes:
- Split label step to create-if-missing then look up the ID
- Pass label ID as integer to issue creation: `labels: [169]`
- Add error handling: log API response if issue creation returns null
- Also cleaned up another duplicate upstream-sync label

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:21:52 +02:00
Vlad MocanuandClaude Opus 4.6 432243def1 fix: skip test-action for PRs created by claude bot
When Claude creates a PR (e.g. upstream-sync), the pull_request event
fires with actor=claude. The self-trigger guard in actor.ts blocks
this because actor 'claude' matches bot_name 'claude[bot]', causing
test-action to fail with "Blocking self-trigger" error.

Add `if: github.actor != 'claude'` to the test-agent-mode job.
Claude-created PRs (upstream syncs) don't need the integration test
since they're merge commits, not action code changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:17:19 +02:00
Vlad MocanuandClaude Opus 4.6 b1524d7857 fix: handle existing sync PRs in upstream-sync workflow
Add idempotency to the merge-upstream job:

1. Check for existing open PR from chore/upstream-sync-* branch
2. If PR exists and branch is up to date with upstream → skip
3. If PR exists but upstream has new commits → checkout existing
   branch, merge new upstream commits, run Claude to review/test
4. If no PR exists → create new branch (existing behavior)

Also update Claude's prompt to handle both create and update PR
cases, so it knows to push to the existing PR branch instead of
creating a duplicate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:15:50 +02:00
Vlad MocanuandClaude Opus 4.6 88e7747d2f fix: use bot token for issue creation and link PRs to tracking issues
Three fixes in the upstream-sync workflow:

1. Replace github.token with CLAUDE_BOT_TOKEN in the check-upstream
   job. The default runner token on Forgejo doesn't have issue-write
   permissions, so issues were silently failing to create.

2. Output the tracking issue number from check-upstream and pass it
   to the merge-upstream job. Claude's prompt now includes the issue
   reference and instructs it to add "Closes #N" in the PR body.

3. Capture the issue number from both create and update paths so
   the merge job always has it available.

Also cleaned up 6 duplicate upstream-sync labels created by previous
runs that used the unprivileged token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:12:35 +02:00
Vlad MocanuandClaude Opus 4.6 bc063f62f0 fix: add bun install step and bunx/npx tool patterns to upstream-sync
Two fixes for the upstream-sync Claude workflow:

1. Add Bun install + bun install (deps) steps before Claude runs,
   so tsc, prettier, and other devDependencies are available.
   Previously node_modules/.bin/ didn't exist and typecheck/format
   commands failed with "command not found".

2. Add Bash(bunx:*), Bash(npx:*), Bash(./node_modules/.bin/*:*)
   to allowed_tools. The existing Bash(bun:*) only covers the `bun`
   binary, not `bunx` which is a separate binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:07:37 +02:00
Vlad MocanuandClaude Opus 4.6 ec1a718b2e chore: bump kcl-ci to v1.37.1 (Bash sub-patterns for claude.yml)
Picks up the allowed_tools fix from kcl-ci — claude.yml tag-mode
workflow now uses Bash(git:*),Bash(bun:*),Bash(curl:*) sub-patterns
instead of bare Bash, enabling auto-approval in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 12:49:01 +02:00
Vlad MocanuandClaude Opus 4.6 b308697d5e fix: use Bash sub-patterns in upstream-sync for CI auto-approval
Bare `Bash` in allowed_tools makes the tool available but individual
commands still require interactive approval. In CI there's nobody to
approve, so git push, bun test, and curl all fail with
"Error: This command requires approval".

Changes:
- Switch to Bash(git:*), Bash(bun:*), Bash(curl:*) sub-patterns
- Add GITHUB_SERVER_URL env var so Claude doesn't need `export`
- Update prompt to reflect env var is pre-set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 12:48:21 +02:00
forgejo-actions[bot] 15891b28df chore: regenerate workflows from KCL [skip ci] 2026-02-27 10:25:19 +00:00
Vlad MocanuandClaude Opus 4.6 ec92cf4c28 fix: enable verbose output and full tool access for Claude workflows
- Add show_full_output: true to both claude.yml and upstream-sync.yml
- Add allowed_tools (Bash, Read, Write, etc.) to upstream-sync merge step
- Upgrade kcl-ci to v1.37.0 (defaults show_full_output and full tools)

Fixes: Claude was burning 38 turns hitting sandbox permission denials
trying to run bun test and git push during upstream sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 12:25:13 +02:00
Vlad MocanuandClaude Opus 4.6 c47fc002c6 fix: simplify kcl-ci-build and exclude generated workflows from Prettier
Remove wait-for-checks from kcl-ci-build (not needed for this repo).
Add .forgejo/workflows/ to .prettierignore since KCL controls formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:59:42 +02:00
Vlad MocanuandClaude Opus 4.6 4954e96cc5 feat: add Claude auto-merge to upstream-sync workflow
- New merge-upstream job: creates branch, merges upstream, runs Claude
  agent mode to review, resolve conflicts, run tests, and create a PR
- Dynamic fork impact analysis: computes overlap between fork-modified
  files and upstream-changed files to assess conflict risk
- Claude reviews ALL upstream changes for fork compatibility (renamed
  imports, changed APIs, GitHub-only assumptions) not just conflicts
- Maintainability principle: minimize fork divergence, prefer adapters
- Remove ANTHROPIC_API_KEY (using OAuth token only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:55:51 +02:00
Vlad MocanuandClaude Opus 4.6 5c014823e0 feat: migrate workflows to kcl-ci standard
- Add .forgejo/kcl-ci/ with kcl.mod, main.k, Taskfile.yaml
- claude.yml: use claude.k module (fixes #comment YAML validation error,
  removes duplicate pull_request_comment trigger)
- ci.yml: add paths-ignore for kcl-ci paths, named jobs for check constants
- test-action.yml: regenerated from KCL (functionally identical)
- upstream-sync.yml: regenerated from KCL (functionally identical)
- kcl-ci-build.yml: new auto-regeneration workflow (waits for CI checks)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:40:47 +02:00
Vlad MocanuandClaude Opus 4.6 f83eed97de docs: document Forgejo event behavior in workflow and trigger.ts
Add inline comments explaining:
- Forgejo never fires pull_request_review (sends pull_request_comment)
- Why workflow if-condition cannot gate on @claude for these events
  (payload fields are empty, confirmed by run 12084 being skipped)
- The @claude check is handled in trigger.ts via payload inspection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 11:32:36 +02:00
Vlad MocanuandClaude Opus 4.6 a033ec873e revert: undo workflow if-condition gating for pull_request_comment
Forgejo's pull_request_comment payload does not populate
github.event.comment.body or github.event.review.body in a way
the workflow contains() expression can read, causing legitimate
@claude reviews to be skipped (run 12084).

Revert to unconditional pass at the workflow level. The @claude
check is handled properly in trigger.ts which inspects the actual
payload fields with fallback logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 11:32:36 +02:00
Vlad MocanuandClaude Opus 4.6 42f6508d49 fix: gate Forgejo review/comment triggers on @claude mention
Previously, all pull_request_comment events on Forgejo triggered the
full Claude pipeline unconditionally — both in the workflow if-condition
and in trigger.ts. This wasted CI resources and API credits on reviews
without @claude mentions (e.g. plain "LGTM" reviews).

Workflow: add @claude check via contains() on comment.body and review.body.
Trigger validation: replace blind auto-trigger with payload-aware check
that inspects available body fields, falling back only when no body exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 11:32:36 +02:00
Vlad MocanuandClaude Opus 4.6 f3c92a2821 fix: move comments out of workflow if: expression block
Forgejo runner's expression parser rejects '#' characters inside
if: | blocks (run 52778: "unexpected character '#' while lexing
expression"). Move all comments above the if: key and switch from
block scalar (|) to folded scalar (>-) to avoid multiline issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:45:15 +02:00
Vlad MocanuandClaude Opus 4.6 401c35fdd2 docs: document Forgejo event behavior in workflow and trigger.ts
Add inline comments explaining:
- Forgejo never fires pull_request_review (sends pull_request_comment)
- Why workflow if-condition cannot gate on @claude for these events
  (payload fields are empty, confirmed by run 12084 being skipped)
- The @claude check is handled in trigger.ts via payload inspection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:45:09 +02:00
Vlad MocanuandClaude Opus 4.6 231a31ca39 revert: undo workflow if-condition gating for pull_request_comment
Forgejo's pull_request_comment payload does not populate
github.event.comment.body or github.event.review.body in a way
the workflow contains() expression can read, causing legitimate
@claude reviews to be skipped (run 12084).

Revert to unconditional pass at the workflow level. The @claude
check is handled properly in trigger.ts which inspects the actual
payload fields with fallback logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:45:09 +02:00
Vlad MocanuandClaude Opus 4.6 71fb686885 fix: gate Forgejo review/comment triggers on @claude mention
Previously, all pull_request_comment events on Forgejo triggered the
full Claude pipeline unconditionally — both in the workflow if-condition
and in trigger.ts. This wasted CI resources and API credits on reviews
without @claude mentions (e.g. plain "LGTM" reviews).

Workflow: add @claude check via contains() on comment.body and review.body.
Trigger validation: replace blind auto-trigger with payload-aware check
that inspects available body fields, falling back only when no body exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:45:09 +02:00
Vlad MocanuandClaude Opus 4.6 a864b1636f fix: move comments out of workflow if: expression block
Forgejo runner's expression parser rejects '#' characters inside
if: | blocks (run 52778: "unexpected character '#' while lexing
expression"). Move all comments above the if: key and switch from
block scalar (|) to folded scalar (>-) to avoid multiline issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:21:23 +02:00
Vlad MocanuandClaude Opus 4.6 414c7053eb fix: let all issues events through workflow gate on Forgejo
Forgejo does not populate github.event.action in the workflow if:
context for issues events (run 12061 was skipped despite action
being 'labeled'). Same pattern as pull_request_comment (M3).

Remove the action/body/title gating from the workflow condition
and let trigger.ts handle all validation (label, assignee, mention).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:19:39 +02:00
Vlad MocanuandClaude Opus 4.6 910c843122 chore: remove debug-event job, merge into failure step
The separate debug-event job ran on every event, wasting a runner.
Merged the event payload dump into the existing "Debug on failure"
step so it only runs when the claude job actually fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 08:43:57 +02:00
Vlad MocanuandClaude Opus 4.6 b4bc36810d fix: let pull_request_review_comment events through unconditionally
Forgejo's pull_request_review_comment event does not populate
github.event.comment.body in the workflow context (it's always
empty), so the contains() check never matches. The action code
does its own trigger phrase validation, so it's safe to let these
events through based on event name alone.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:49:19 +02:00
Vlad Mocanu 97dd0863c7 chore: improve debug-event job payload dump [skip ci] 2026-02-25 23:47:04 +02:00
Vlad Mocanu a129a15f61 feat(prd-6): verify workflow triggers and add assignee_trigger (#13) 2026-02-25 21:43:37 +00:00
claude-botandvtmocanu 2d8753c3db docs: rename bot from claude-bot to claude in CI and docs
Update all runtime-relevant references to the Forgejo bot username
from 'claude-bot' to 'claude' following the bot account rename.

- .forgejo/workflows/claude.yml: bot_name input
- docs/forgejo.md: setup guide, examples, and inline references
- CLAUDE.md: bot identity description

Test fixtures and historical PRD files are left unchanged as they
use 'claude-bot' as arbitrary mock data or historical record.

Co-authored-by: vtmocanu <vtmocanu@users.noreply.github.com>
2026-02-25 20:22:38 +00:00
Vlad MocanuandClaude Opus 4.6 23f15aecb9 fix: use GITHUB_RUN_NUMBER for Forgejo job URLs and pin Bun version in CI
Forgejo uses the per-repo sequential run index (GITHUB_RUN_NUMBER) in
action URLs, not the internal DB run ID (GITHUB_RUN_ID). This caused
"View job" links to return 404. Fixed in all 4 URL construction sites:
create-initial comment, update-comment-link, and both prompt generators.

Also pins Bun to 1.2.21 in CI — Bun 1.3.9 broke spyOn(fs, ...) which
failed 18 upstream image-downloader tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:07:40 +02:00
Vlad MocanuandClaude Opus 4.6 b03ccb518c feat(prd-5): add dedicated claude-bot user for Forgejo
- Add bot_email action input for custom git commit email on Forgejo
- Update claude.yml to use CLAUDE_BOT_TOKEN with bot_id/bot_name/bot_email
- Update git-config.ts to use provided email over noreply format
- Add "Dedicated Bot User" setup guide to docs/forgejo.md
- Update CLAUDE.md with bot identity documentation

Infrastructure (done outside code):
- claude-bot user created (ID 48, non-admin, with avatar)
- Claude team with write access in all 12 orgs
- CLAUDE_BOT_TOKEN org-level secret in all 12 orgs

Progress: ~85% complete - pending E2E validation after merge

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:56:55 +02:00
Vlad MocanuandClaude Opus 4.6 efe30422e7 ci: switch claude.yml to use claude-bot token [skip ci]
Use CLAUDE_BOT_TOKEN (dedicated bot user) instead of FORGEJO_CLAUDE_TOKEN
(personal token). Comments and commits will now appear as claude-bot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:45:11 +02:00
Vlad MocanuandClaude Opus 4.6 c2ea0a6dba feat: add tag mode workflow for Forgejo
Enables @claude mentions on issues, PR review comments,
issue assignment, and label triggers on Forgejo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:00:26 +02:00
Vlad Mocanu 6eb2e41510 fix(prd-1): remove debug output from CI test step 2026-02-25 18:54:24 +02:00