fix: forgejo remote detection fallback + add mcd-tracker board #149

Merged
forgejo_admin merged 1 commit from 148-fix-forgejo-remote-detection-add-mcd-tra into main 2026-03-22 09:51:21 +00:00
Contributor

Summary

Fixes remote detection for repos that don't use origin as their remote name (e.g., pal-e-platform uses forgejo), and adds the mcd-tracker board to the shared boards config.

Changes

  • hooks/session-start-context.sh: line 71 now falls back to the first available remote when origin doesn't exist, so project detection works for pal-e-platform
  • hooks/boards-config.sh: added "board-mcd-tracker" to the BOARDS array

Test Plan

  • Verify session-start-context.sh correctly detects the remote URL when run from ~/pal-e-platform (which uses forgejo as its remote name)
  • Verify mcd-tracker board items appear in session start context output

Review Checklist

  • Shell syntax validated (bash -n) for both modified files
  • Change is scoped to exactly what the issue specifies
  • No secrets or credentials included
## Summary Fixes remote detection for repos that don't use `origin` as their remote name (e.g., pal-e-platform uses `forgejo`), and adds the mcd-tracker board to the shared boards config. ## Changes - `hooks/session-start-context.sh`: line 71 now falls back to the first available remote when `origin` doesn't exist, so project detection works for pal-e-platform - `hooks/boards-config.sh`: added `"board-mcd-tracker"` to the BOARDS array ## Test Plan - Verify `session-start-context.sh` correctly detects the remote URL when run from `~/pal-e-platform` (which uses `forgejo` as its remote name) - Verify mcd-tracker board items appear in session start context output ## Review Checklist - [x] Shell syntax validated (`bash -n`) for both modified files - [x] Change is scoped to exactly what the issue specifies - [x] No secrets or credentials included ## Related - Closes #148
session-start-context.sh: fall back to first available remote when
`origin` doesn't exist (handles pal-e-platform which uses `forgejo`
as its remote name).

boards-config.sh: add board-mcd-tracker to the BOARDS array.

Closes #148

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Contributor

Self-Review: LGTM

Files changed: 2 (2 additions, 1 deletion)

session-start-context.sh

  • Fallback logic is correct: tries origin first, falls back to first available remote via git remote | head -1
  • Edge case handled: if no remotes exist at all, the inner git remote get-url "" fails silently and the outer || true ensures no error propagation
  • Fail-open behavior preserved

boards-config.sh

  • "board-mcd-tracker" added in correct position (after last entry, before closing paren)
  • Formatting consistent with existing entries

Syntax

Both files pass bash -n syntax check. No issues found.

## Self-Review: LGTM **Files changed:** 2 (2 additions, 1 deletion) ### session-start-context.sh - Fallback logic is correct: tries `origin` first, falls back to first available remote via `git remote | head -1` - Edge case handled: if no remotes exist at all, the inner `git remote get-url ""` fails silently and the outer `|| true` ensures no error propagation - Fail-open behavior preserved ### boards-config.sh - `"board-mcd-tracker"` added in correct position (after last entry, before closing paren) - Formatting consistent with existing entries ### Syntax Both files pass `bash -n` syntax check. No issues found.
Author
Contributor

PR #149 Review

DOMAIN REVIEW

Tech stack: Bash (shell hooks for Claude Code session management)

Change 1 -- Remote detection fallback (hooks/session-start-context.sh line 71):
The fix adds a fallback chain: try origin first, then fall back to the first available remote (git remote | head -1). This correctly solves project detection for repos like pal-e-platform where the remote is named forgejo instead of origin.

  • The nested command substitution is syntactically correct.
  • Error handling is sound: 2>/dev/null on both inner commands, outer || true ensures fail-open behavior consistent with the script's design philosophy (line 9: "Fail-open: any error exits 0 silently").
  • Edge case (zero remotes): git remote | head -1 returns empty, git remote get-url "" fails silently via 2>/dev/null, cwd_remote stays empty, and the if [[ -n "$cwd_remote" ]] guard on line 73 prevents further processing. Safe.
  • Edge case (multiple non-origin remotes): head -1 picks the first one. For the specific use case (pal-e-platform has forgejo as its only remote), this is correct.

Change 2 -- Board addition (hooks/boards-config.sh):
Adding "board-mcd-tracker" to the BOARDS array. Format matches existing entries. Trivially correct.

Pre-existing observation: The inline fallback functions at lines 22 and 29 of session-start-context.sh still hardcode origin for platform detection (Forgejo vs GitHub). However, these fallbacks only execute when forgejo-helper.sh is unavailable, and the real forgejo-helper.sh already checks ALL remotes (line 39). This is out of scope for this PR but worth noting for the nit-bundle issue #147.

BLOCKERS

None.

  • Test coverage: No automated tests, but this repo has no test framework for shell hooks. The changes are a 1-line remote detection fallback and a 1-line config array addition. Manual test plan is described in the PR body and is appropriate for this scope.
  • No unvalidated user input: The script only processes git remote URLs from the local filesystem.
  • No secrets: No credentials in the diff.
  • No DRY violations in auth/security paths: Not applicable.

NITS

  1. Pre-existing origin hardcoding in inline fallbacks (lines 22, 29): The inline is_forgejo_repo and is_github_repo fallbacks still use git remote get-url origin. If forgejo-helper.sh is unavailable AND the repo uses a non-origin remote name, platform detection would fail. This is pre-existing and out of scope, but should be tracked. Issue #147 may already cover this.

  2. Line length: The new line 71 is quite long (~110 chars) due to the nested fallback. A multi-line approach using a helper variable would improve readability, e.g.:

    cwd_remote=$(git -C "$cwd" remote get-url origin 2>/dev/null) || \
        cwd_remote=$(git -C "$cwd" remote get-url "$(git -C "$cwd" remote | head -1)" 2>/dev/null) || true
    

    Non-blocking -- current form is functionally correct.

SOP COMPLIANCE

  • Branch named after issue (148-fix-forgejo-remote-detection-add-mcd-tra starts with 148)
  • PR body follows template (Summary, Changes, Test Plan, Related sections present)
  • Related references plan slug -- PR body says "Closes #148" but does not reference plan-pal-e-agency
  • No secrets committed
  • No scope creep -- changes are tightly scoped to the two items described

PROCESS OBSERVATIONS

  • Change failure risk: Very low. Both changes are additive/fallback-only. The remote detection change cannot regress existing behavior (it only activates when origin doesn't exist). The board config addition is append-only.
  • Deployment frequency: No deployment needed -- these are local hook files synced via the claude-custom repo.
  • Missing plan slug reference: The Related section should reference plan-pal-e-agency per SOP. This is a minor process gap, not a code quality issue.

VERDICT: APPROVED

## PR #149 Review ### DOMAIN REVIEW **Tech stack:** Bash (shell hooks for Claude Code session management) **Change 1 -- Remote detection fallback (`hooks/session-start-context.sh` line 71):** The fix adds a fallback chain: try `origin` first, then fall back to the first available remote (`git remote | head -1`). This correctly solves project detection for repos like `pal-e-platform` where the remote is named `forgejo` instead of `origin`. - The nested command substitution is syntactically correct. - Error handling is sound: `2>/dev/null` on both inner commands, outer `|| true` ensures fail-open behavior consistent with the script's design philosophy (line 9: "Fail-open: any error exits 0 silently"). - Edge case (zero remotes): `git remote | head -1` returns empty, `git remote get-url ""` fails silently via `2>/dev/null`, `cwd_remote` stays empty, and the `if [[ -n "$cwd_remote" ]]` guard on line 73 prevents further processing. Safe. - Edge case (multiple non-origin remotes): `head -1` picks the first one. For the specific use case (pal-e-platform has `forgejo` as its only remote), this is correct. **Change 2 -- Board addition (`hooks/boards-config.sh`):** Adding `"board-mcd-tracker"` to the BOARDS array. Format matches existing entries. Trivially correct. **Pre-existing observation:** The inline fallback functions at lines 22 and 29 of `session-start-context.sh` still hardcode `origin` for platform detection (Forgejo vs GitHub). However, these fallbacks only execute when `forgejo-helper.sh` is unavailable, and the real `forgejo-helper.sh` already checks ALL remotes (line 39). This is out of scope for this PR but worth noting for the nit-bundle issue #147. ### BLOCKERS None. - **Test coverage:** No automated tests, but this repo has no test framework for shell hooks. The changes are a 1-line remote detection fallback and a 1-line config array addition. Manual test plan is described in the PR body and is appropriate for this scope. - **No unvalidated user input:** The script only processes git remote URLs from the local filesystem. - **No secrets:** No credentials in the diff. - **No DRY violations in auth/security paths:** Not applicable. ### NITS 1. **Pre-existing `origin` hardcoding in inline fallbacks (lines 22, 29):** The inline `is_forgejo_repo` and `is_github_repo` fallbacks still use `git remote get-url origin`. If `forgejo-helper.sh` is unavailable AND the repo uses a non-`origin` remote name, platform detection would fail. This is pre-existing and out of scope, but should be tracked. Issue #147 may already cover this. 2. **Line length:** The new line 71 is quite long (~110 chars) due to the nested fallback. A multi-line approach using a helper variable would improve readability, e.g.: ```bash cwd_remote=$(git -C "$cwd" remote get-url origin 2>/dev/null) || \ cwd_remote=$(git -C "$cwd" remote get-url "$(git -C "$cwd" remote | head -1)" 2>/dev/null) || true ``` Non-blocking -- current form is functionally correct. ### SOP COMPLIANCE - [x] Branch named after issue (`148-fix-forgejo-remote-detection-add-mcd-tra` starts with `148`) - [x] PR body follows template (Summary, Changes, Test Plan, Related sections present) - [ ] Related references plan slug -- PR body says "Closes #148" but does not reference `plan-pal-e-agency` - [x] No secrets committed - [x] No scope creep -- changes are tightly scoped to the two items described ### PROCESS OBSERVATIONS - **Change failure risk:** Very low. Both changes are additive/fallback-only. The remote detection change cannot regress existing behavior (it only activates when `origin` doesn't exist). The board config addition is append-only. - **Deployment frequency:** No deployment needed -- these are local hook files synced via the claude-custom repo. - **Missing plan slug reference:** The Related section should reference `plan-pal-e-agency` per SOP. This is a minor process gap, not a code quality issue. ### VERDICT: APPROVED
forgejo_admin deleted branch 148-fix-forgejo-remote-detection-add-mcd-tra 2026-03-22 09:51:21 +00:00
Sign in to join this conversation.
No description provided.