diff --git a/.env.example b/.env.example index 0acc9f9..d35bff2 100644 --- a/.env.example +++ b/.env.example @@ -22,27 +22,29 @@ CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-vervang-mij # Als deze ge-revoked wordt: rebuild + redeploy (zie README). SCRUM4ME_TOKEN=vervang-mij -# ----- GitHub credentials ----------------------------------- -# Personal Access Token (fine-grained) met: -# - Repository access op madhura68/Scrum4Me + madhura68/scrum4me-mcp -# - Permissions: Contents (read/write), Pull requests (read/write), -# Metadata (read) +# ----- Forgejo credentials (PBI-86 hybride model) ----------- +# Personal Access Token van je Forgejo-account met scope read+write +# op de Scrum4Me-repos. Variabele heet historisch nog `GH_TOKEN`; +# in het hybride model bevat 'ie een Forgejo-PAT. # # Gebruikt voor: # 1. Pre-clone van de repos in /home/agent/Projects// bij # container-start (entrypoint.sh) -# 2. `git push` van agent feature-branches via HTTPS -# 3. `gh pr create` (auto_pr=true) — gh CLI leest GH_TOKEN uit env +# 2. `git push` van agent feature-branches naar Forgejo via HTTPS # -# Genereer op github.com → Settings → Developer settings → -# Personal access tokens → Fine-grained tokens. -GH_TOKEN=ghp_vervang-mij +# `gh pr create` is uit de worker-flow verwijderd (PBI-86, T-1005); +# de GitHub-PR ontstaat via de handmatig getriggerde promote-Action +# in Forgejo. +# +# Genereer in Forgejo: avatar → Settings → Applications → +# Generate New Token; scope minimaal `write:repository`. +GH_TOKEN=vervang-mij # Lijst (komma-gescheiden) van repos om vooraf te clonen naar # ~agent/Projects/. resolveRepoRoot in scrum4me-mcp valt -# automatisch terug op die conventie. Voeg meer toe als je nieuwe -# producten/repos toevoegt aan Scrum4Me. -GH_PRECLONE_REPOS=madhura68/Scrum4Me,madhura68/scrum4me-mcp +# automatisch terug op die conventie. `/` zoals 'ie op +# Forgejo staat. Voeg meer toe als je nieuwe producten/repos toevoegt. +GH_PRECLONE_REPOS=janpeter/Scrum4Me,janpeter/scrum4me-mcp # ----- Git commit-author ------------------------------------- # Verplicht — Vercel weigert deploys waarvan de commit-author email diff --git a/Dockerfile b/Dockerfile index 98fe2b2..683202d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ RUN curl -fsSL https://claude.ai/install.sh | bash -s ${CLAUDE_CODE_VERSION} \ # Clone zonder submodules — de Prisma-schema zit al gecommit in het repo. # De vendor/scrum4me submodule is alleen nodig om het schema te updaten, # niet om te builden. Pin via build-arg; default = main. -ARG MCP_GIT_REPO=https://github.com/madhura68/scrum4me-mcp.git +ARG MCP_GIT_REPO=https://git.jp-visser.nl/janpeter/scrum4me-mcp.git ARG MCP_GIT_REF=main # Cache-bust voor de clone-laag: hetzelfde MCP_GIT_REF kan tussen rebuilds # een ander commit aanwijzen (bv. main na een merge). Geef als build-arg diff --git a/README.md b/README.md index 825abe7..0f9cd3d 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ fouten. `/share/Agent → /share/CACHEDEV1_DATA/Agent`. - Drie subdirs onder die share: `/share/Agent/cache`, `/share/Agent/logs`, `/share/Agent/state`. Aanmaken via File Station of via SSH na share-creatie. -- Internet-uitgang naar `api.anthropic.com`, `github.com`, je Neon-host, `registry.npmjs.org`. +- Internet-uitgang naar `api.anthropic.com`, `git.jp-visser.nl` (Forgejo HTTPS-clone/push), `cli.github.com` (build-time voor de gh CLI), je Neon-host, `registry.npmjs.org`. > **Verifieer** vóór je deployt dat `/share/Agent` echt op disk staat: > ```bash @@ -85,18 +85,21 @@ fouten. # b. SCRUM4ME_TOKEN → log in als de dedicated agent-user in # Scrum4Me, /settings/tokens, label "NAS-runner" # c. DATABASE_URL/DIRECT_URL → Neon dashboard -# d. GH_TOKEN → github.com → Settings → Developer settings → -# Personal access tokens → Fine-grained. -# Repository access op madhura68/Scrum4Me + -# madhura68/scrum4me-mcp; Permissions: -# Contents (RW), Pull requests (RW), -# Metadata (R). Wordt gebruikt voor clone, -# push en `gh pr create` (auto_pr). +# d. GH_TOKEN → Forgejo → avatar → Settings → +# Applications → Generate New Token; scope +# minimaal `write:repository` op de twee +# repos (janpeter/Scrum4Me + janpeter/ +# scrum4me-mcp). Wordt gebruikt voor clone +# en push naar Forgejo. PBI-86 (hybride +# model): `gh pr create` is uit de +# worker-flow verwijderd — de GitHub-PR +# komt via de handmatige promote-Action +# in Forgejo. # 2. Repo op de NAS plaatsen ssh admin@nas cd /share/Agent -git clone https://github.com//scrum4me-agent-runner.git +git clone https://git.jp-visser.nl//scrum4me-agent-runner.git cd scrum4me-agent-runner # 3. Env aanmaken @@ -326,7 +329,8 @@ Bij elke container-start runt `bin/repo-bootstrap.sh` (als de `agent`-user, ná drop-privileges) en zet zo'n setup neer: 1. Configureert git's credential-helper met `GH_TOKEN` zodat - `git clone`/`push` naar `https://github.com/...` zonder prompt werkt. + `git clone`/`push` naar `https://git.jp-visser.nl/...` (Forgejo) zonder + prompt werkt. 2. Voor elke repo in `GH_PRECLONE_REPOS` (komma-gescheiden owner/name): - Bestaat `~/Projects//.git` al? → `git fetch origin --prune` - Anders → fresh `git clone` @@ -337,8 +341,10 @@ voor jobs landen vervolgens onder `~/.scrum4me-agent-worktrees//` zodat de hoofd-clone niet wordt aangeraakt. Push gaat over dezelfde token: `git push -u origin feat/story-` -slaagt zonder prompt. `gh pr create` (voor producten met `auto_pr=true`) -gebruikt dezelfde `GH_TOKEN` via de `gh` CLI's standaard env-detect. +slaagt zonder prompt. **`gh pr create` is in PBI-86 (T-1005) verwijderd +uit de worker-flow** — de GitHub-PR ontstaat via een handmatig +getriggerde promote-Action in Forgejo (zie de Scrum4Me-repo +`docs/runbooks/forgejo-hybrid-flow.md`). ## Veelvoorkomende issues diff --git a/bin/job-prepare.sh b/bin/job-prepare.sh index 96f54c4..f3ec175 100644 --- a/bin/job-prepare.sh +++ b/bin/job-prepare.sh @@ -28,7 +28,7 @@ if [[ -z "$JOB_ID" || -z "$REPO_URL" ]]; then exit 2 fi -# Slug uit repo_url voor de cache-naam: "github.com/foo/bar.git" → "foo_bar" +# Slug uit repo_url voor de cache-naam: "git.jp-visser.nl/foo/bar.git" → "foo_bar" SLUG=$(echo "$REPO_URL" \ | sed -E 's#^.*[:/]([^/]+/[^/]+?)(\.git)?/?$#\1#' \ | tr '/' '_') diff --git a/bin/repo-bootstrap.sh b/bin/repo-bootstrap.sh index 850c42f..7f71c53 100644 --- a/bin/repo-bootstrap.sh +++ b/bin/repo-bootstrap.sh @@ -32,8 +32,8 @@ fi mkdir -p "$HOME" git config --global credential.helper store CREDS_FILE="$HOME/.git-credentials" -if [[ ! -f "$CREDS_FILE" ]] || ! grep -q "oauth2:${GH_TOKEN}@github.com" "$CREDS_FILE" 2>/dev/null; then - printf 'https://oauth2:%s@github.com\n' "$GH_TOKEN" > "$CREDS_FILE" +if [[ ! -f "$CREDS_FILE" ]] || ! grep -q "oauth2:${GH_TOKEN}@git.jp-visser.nl" "$CREDS_FILE" 2>/dev/null; then + printf 'https://oauth2:%s@git.jp-visser.nl\n' "$GH_TOKEN" > "$CREDS_FILE" chmod 600 "$CREDS_FILE" log "git credentials helper configured at ${CREDS_FILE}" fi @@ -71,7 +71,7 @@ for repo in "${REPOS[@]}"; do else log "cloning ${repo} into ${target}" rm -rf "$target" - git clone --quiet "https://github.com/${repo}.git" "$target" \ + git clone --quiet "https://git.jp-visser.nl/${repo}.git" "$target" \ || { log "ERROR: clone failed for ${repo}"; continue; } fi done