Skip to content

Feature/update from template - #721

Merged
blooop merged 72 commits into
mainfrom
feature/update_from_template
Mar 1, 2026
Merged

blooop merged 72 commits into
mainfrom
feature/update_from_template

Conversation

@blooop

@blooop blooop commented Mar 1, 2026 •

Copy link
Copy Markdown
Owner

Summary by Sourcery

Update development tooling, devcontainer workflow, and Claude/Ralph integration to align the project with the latest template and improve automation.

New Features:

  • Add Ralph orchestrator as a development dependency with configuration and prompt files for autonomous task management.
  • Introduce scripts to toggle devcontainer usage between a locally built image and a prebuilt GHCR image, including optional package visibility management.
  • Add a GitHub Actions workflow to build and publish the devcontainer image to GHCR, and configure Dependabot to monitor devcontainer Docker dependencies.
  • Add Claude Code configuration and documentation for automated environment setup in Claude sessions.

Bug Fixes:

  • Make rename and setup scripts robust to special characters, safer shell behavior, and correct devcontainer and git merge driver handling.
  • Fix and harden various shell scripts by enabling pipefail, quoting variables, and adding shellcheck annotations.

Enhancements:

  • Update Pixi, GitHub CLI, and test tooling versions to align with the latest template and improve compatibility.
  • Extend pixi task definitions with new helper commands for Ralph and devcontainer image selection.
  • Exclude the main devcontainer.json image reference from template renaming to preserve template image URLs.
  • Enable shellcheck in pre-commit to enforce shell script quality.

CI:

  • Add a dedicated CI workflow to build, cache, and push the devcontainer image on pushes, PRs, and manual triggers.

Documentation:

  • Document Claude Code and Ralph orchestrator usage and workflows in the repository.

blooop and others added 30 commits January 16, 2026 10:38
Adds <3.0 upper bound to the gh dependency to match the pattern used by
other tooling dependencies (shellcheck, devpod) and reduce risk of
unexpected breaking changes from future major versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Clarify that ty is a type checker (not a typo) in PROMPT.md
- Remove hardcoded path from @AGENT.md for template portability

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add ralph-claude-code integration and agent documentation
Add upper version bound for gh dependency
Replace previous ralph implementation with ralph-orchestrator from
the blooop conda channel. Adds configuration files and documentation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bumps [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) from 0.9.3 to 0.9.4.
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](prefix-dev/setup-pixi@v0.9.3...v0.9.4)

---
updated-dependencies:
- dependency-name: prefix-dev/setup-pixi
  dependency-version: 0.9.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Updates the requirements on [ty](https://github.com/astral-sh/ty) to permit the latest version.

Updates `ty` to 0.0.14
- [Release notes](https://github.com/astral-sh/ty/releases)
- [Changelog](https://github.com/astral-sh/ty/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ty@0.0.12...0.0.14)

---
updated-dependencies:
- dependency-name: ty
  dependency-version: 0.0.14
  dependency-type: direct:development
  dependency-group: lib-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
…deb95912b

build(deps-dev): update ty requirement from <=0.0.12,>=0.0.12 to >=0.0.12,<=0.0.14 in the lib-dependencies group
Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis), [ruff](https://github.com/astral-sh/ruff), [coverage](https://github.com/coveragepy/coveragepy) and [prek](https://github.com/j178/prek) to permit the latest version.

Updates `hypothesis` to 6.151.4
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](HypothesisWorks/hypothesis@hypothesis-python-6.104.2...hypothesis-python-6.151.4)

Updates `ruff` to 0.14.14
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.5.0...0.14.14)

Updates `coverage` to 7.13.2
- [Release notes](https://github.com/coveragepy/coveragepy/releases)
- [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst)
- [Commits](coveragepy/coveragepy@7.5.4...7.13.2)

Updates `prek` to 0.3.1
- [Release notes](https://github.com/j178/prek/releases)
- [Changelog](https://github.com/j178/prek/blob/master/CHANGELOG.md)
- [Commits](j178/prek@v0.2.28...v0.3.1)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.151.4
  dependency-type: direct:development
  dependency-group: dev-dependencies
- dependency-name: ruff
  dependency-version: 0.14.14
  dependency-type: direct:development
  dependency-group: dev-dependencies
- dependency-name: coverage
  dependency-version: 7.13.2
  dependency-type: direct:development
  dependency-group: dev-dependencies
- dependency-name: prek
  dependency-version: 0.3.1
  dependency-type: direct:development
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
…169ddd55f

build(deps-dev): bump the dev-dependencies group with 4 updates
- Add CI workflow to build and publish devcontainer image to ghcr.io
  on changes to .devcontainer/ files (with PR validation builds)
- Create .devcontainer/ci/ config for CI image builds with features baked in
- Update devcontainer.json to pull prebuilt image instead of building locally
  (local build instructions preserved as comments)
- Absorb claude-code feature runtime config (mount, extension) into
  devcontainer.json since features are pre-baked in the image
- Add docker ecosystem to dependabot for base image update tracking

https://claude.ai/code/session_01P15jZtANbd9QQm4SiY3Nzh
…dev/setup-pixi-0.9.4

build(deps): bump prefix-dev/setup-pixi from 0.9.3 to 0.9.4
…er-tuiW0

Add prebuilt devcontainer image support via GHCR
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis), [ruff](https://github.com/astral-sh/ruff) and [coverage](https://github.com/coveragepy/coveragepy) to permit the latest version.

Updates `hypothesis` to 6.151.5
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](HypothesisWorks/hypothesis@hypothesis-python-6.104.2...hypothesis-python-6.151.5)

Updates `ruff` to 0.15.0
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.5.0...0.15.0)

Updates `coverage` to 7.13.4
- [Release notes](https://github.com/coveragepy/coveragepy/releases)
- [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst)
- [Commits](coveragepy/coveragepy@7.5.4...7.13.4)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.151.5
  dependency-type: direct:development
  dependency-group: dev-dependencies
- dependency-name: ruff
  dependency-version: 0.15.0
  dependency-type: direct:development
  dependency-group: dev-dependencies
- dependency-name: coverage
  dependency-version: 7.13.4
  dependency-type: direct:development
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
…/checkout-6

build(deps): bump actions/checkout from 4 to 6
Updates the requirements on [ty](https://github.com/astral-sh/ty) to permit the latest version.

Updates `ty` to 0.0.15
- [Release notes](https://github.com/astral-sh/ty/releases)
- [Changelog](https://github.com/astral-sh/ty/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ty@0.0.12...0.0.15)

---
updated-dependencies:
- dependency-name: ty
  dependency-version: 0.0.15
  dependency-type: direct:development
  dependency-group: lib-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
GHCR packages are private by default, which causes MANIFEST_UNKNOWN
errors when pulling the prebuilt devcontainer image. Add documentation
explaining the issue and providing instructions for making the package
public via the GitHub UI or CLI.

Also fix missing commas in the commented-out features block in
devcontainer.json that would cause JSON parse errors if uncommented.
Switch devcontainer.json from prebuilt GHCR image to local builds as
the default. This ensures the template works out of the box for forks
and new projects without depending on a pre-existing GHCR image.

The prebuilt image is preserved as a commented-out option with
instructions in the README for enabling it, including the requirement
to make the GHCR package public (private by default).
…ad0c9d8fd

build(deps-dev): bump the dev-dependencies group with 3 updates
…efcf0f305

build(deps-dev): update ty requirement from <=0.0.14,>=0.0.12 to >=0.0.12,<=0.0.15 in the lib-dependencies group
blooop added 24 commits March 1, 2026 09:50
…ab445de5a

build(deps-dev): bump the dev-dependencies group with 3 updates
Resolve conflicts keeping ralph-orchestrator over ralph-claude-code:
- pyproject.toml: keep ralph-orchestrator dependency, drop ralph-claude-code and gh
- .gitignore: keep .ralph/ ignore, add .claude/settings.local.json from main
- PROMPT.md: keep clean ralph-orchestrator template
- .claude/README.md: keep ralph-orchestrator documentation
- pixi.lock: regenerated with updated dependencies
Add ralph-orchestrator as pixi dependency
The local system hook using `pixi run shellcheck` fails in CI because
pixi is not available in the prek-action environment. Switch to the
official shellcheck-precommit repo which bundles its own binary.
turn off features in ci devcontainer
@sourcery-ai

sourcery-ai Bot commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Updates the project template integration by hardening shell scripts, adding devcontainer CI and prebuilt/local image switch scripts, integrating Ralph Orchestrator and Claude Code configuration, and adjusting dependencies and automation around devcontainers and tooling.

Flow diagram for devcontainer_use_prebuilt.sh behavior

flowchart TD
    A[Start_devcontainer_use_prebuilt] --> B[Set_DEVCONTAINER_JSON_path]
    B --> C{gh_CLI_available?}
    C -- yes --> D[GH_AVAILABLE=true]
    C -- no --> E[GH_AVAILABLE=false_and_warn]
    D --> F
    E --> F
    F[Get_origin_remote_URL] --> G{origin_found?}
    G -- no --> H[Exit_with_error]
    G -- yes --> I[Parse_owner_repo_from_URL]
    I --> J{Valid_owner/repo?}
    J -- no --> H
    J -- yes --> K[Build_IMAGE_ghcr.io/owner/repo/devcontainer:latest]
    K --> L{devcontainer.json_already_uses_IMAGE?}
    L -- yes --> M[Print_nothing_to_do_and_exit]
    L -- no --> N[Transform_devcontainer.json_with_awk]
    N -->|comment_build_block| N1[Comment_features_block]
    N1 --> N2[Set_image_line_to_repo_IMAGE]
    N2 --> O[Write_back_devcontainer.json]
    O --> P[Print_updated_message]
    P --> Q[Attempt_to_make_GHCR_package_public]
    Q --> R[Derive_OWNER_and_PACKAGE]
    R --> S{GH_AVAILABLE?}
    S -- no --> T[Print_manual_visibility_instructions_and_exit]
    S -- yes --> U[Check_if_OWNER_is_org_or_user]
    U --> V[Set_API_PATH_and_SETTINGS_URL]
    V --> W{gh_api_PATCH_visibility_public_success?}
    W -- yes --> X[Print_package_public]
    W -- no --> Y[Print_API_error_and_manual_steps]
    X --> Z[End]
    Y --> Z
Loading

Flow diagram for devcontainer_use_local.sh behavior

flowchart TD
    A[Start_devcontainer_use_local] --> B[Set_DEVCONTAINER_JSON_path]
    B --> C{Has_uncommented_build_block?}
    C -- yes --> D[Print_already_using_local_and_exit]
    C -- no --> E[Run_awk_on_devcontainer.json]
    E --> F[Uncomment_build_block]
    F --> G[Uncomment_features_block]
    G --> H[Comment_out_uncommented_image_line]
    H --> I[Write_back_devcontainer.json_tmp_to_file]
    I --> J[Print_switched_to_local_build]
    J --> K[End]
Loading

File-Level Changes

Change Details Files
Harden and shellcheck-clean existing shell scripts used for project setup and template updates.
  • Enable strict error handling (set -eo pipefail / -euo pipefail) in shell scripts
  • Add helper function to safely escape sed replacement values when renaming project, author name, email, and GitHub username
  • Exclude main devcontainer.json from certain text replacements to preserve template image URL while still updating its name field
  • Quote variable expansions and add shellcheck disable comments where needed in launch and setup scripts
scripts/rename_project.sh
scripts/launch_vscode.sh
scripts/setup_host.sh
scripts/update_from_template.sh
.devcontainer/claude-code/install.sh
Introduce tooling and configuration for shell linting, Ralph Orchestrator, and Claude Code integration.
  • Add shellcheck pre-commit hook for shell script linting
  • Add Ralph Orchestrator as a dependency and expose a pixi task alias
  • Add Claude Code configuration README and wire Claude session hooks via existing install script
.pre-commit-config.yaml
pyproject.toml
.claude/README.md
Enhance devcontainer workflow with CI builds to GHCR and scripts to toggle between prebuilt and local devcontainer images.
  • Add GitHub Actions workflow to build and push devcontainer images to GHCR with metadata tags and caching
  • Add script to switch devcontainer.json to use the repo’s own prebuilt GHCR image and optionally make the package public via gh
  • Add script to switch devcontainer.json back to local Dockerfile build by uncommenting build/features blocks and commenting image field
  • Bump pixi version used in the devcontainer Dockerfile and add dependabot config for devcontainer Docker dependencies
.github/workflows/devcontainer.yml
scripts/devcontainer_use_prebuilt.sh
scripts/devcontainer_use_local.sh
.devcontainer/Dockerfile
.github/dependabot.yml
Adjust Python and CLI tooling dependencies and pixi tasks to align with the updated template.
  • Update gh CLI version constraint and fine-tune version caps for pylint, hypothesis, ruff, and coverage
  • Add new pixi tasks for running Ralph and toggling devcontainer image usage
  • Change git merge driver config task to use a new driver name and add minor whitespace cleanup in task definitions
pyproject.toml
Add project-level orchestration and prompt scaffolding for Ralph and Claude Code and update various configuration/ignore files from the template.
  • Add Ralph configuration file describing backend, event loop, and optional hats
  • Add a starter PROMPT.md describing project context and commands for Ralph/Claude usage
  • Update gitignore, devcontainer.json, pixi.lock, and Claude SessionStart hook from the upstream template
ralph.yml
PROMPT.md
.gitignore
.devcontainer/devcontainer.json
pixi.lock
.claude/hooks/SessionStart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues, and left some high level feedback:

  • The setup-git-merge-driver pixi task was changed from git config merge.ours.driver true to git config merge.ourslock.driver true, which looks like a typo (ourslock instead of ours) and will likely break the intended merge driver configuration.
  • In scripts/setup_host.sh, sudo groupadd docker will now run under set -eo pipefail and will fail if the docker group already exists; consider adding || true or checking for the group before creating it to keep the script idempotent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `setup-git-merge-driver` pixi task was changed from `git config merge.ours.driver true` to `git config merge.ourslock.driver true`, which looks like a typo (`ourslock` instead of `ours`) and will likely break the intended merge driver configuration.
- In `scripts/setup_host.sh`, `sudo groupadd docker` will now run under `set -eo pipefail` and will fail if the `docker` group already exists; consider adding `|| true` or checking for the group before creating it to keep the script idempotent.

## Individual Comments

### Comment 1
<location path="pyproject.toml" line_range="151" />
<code_context>
 clear-pixi = "rm -rf .pixi pixi.lock"
-setup-git-merge-driver = "git config merge.ours.driver true"
+ralph = "ralph"
+setup-git-merge-driver = "git config merge.ourslock.driver true"
 update-from-template-repo = "./scripts/update_from_template.sh"
+dev-use-prebuilt = "./scripts/devcontainer_use_prebuilt.sh"
</code_context>
<issue_to_address>
**issue (bug_risk):** Typo in git merge driver config key (`merge.ourslock.driver` vs `merge.ours.driver`)

Changing `merge.ours.driver` to `merge.ourslock.driver` appears to be a typo and will configure a merge driver that doesn’t exist, so the intended merge behavior won’t apply. Unless you’ve added a custom `ourslock` driver, this should stay as `merge.ours.driver`.
</issue_to_address>

### Comment 2
<location path="scripts/devcontainer_use_prebuilt.sh" line_range="41-50" />
<code_context>
+fi
+
+# --- Transform devcontainer.json ---
+awk -v image="$IMAGE" '
+    # Comment out uncommented build block
+    /^    "build": \{/ { in_build=1 }
+    in_build {
+        sub(/^    /, "    // ")
+        if (/^    \/\/ \}/) in_build=0
+        print; next
+    }
+
+    # Comment out uncommented features block
+    /^    "features": \{/ { in_features=1 }
+    in_features {
+        sub(/^    /, "    // ")
+        if (/^    \/\/ \}/) in_features=0
+        print; next
+    }
+
+    # Uncomment commented image line and set repo URL
+    /^    \/\/ "image":/ {
+        printf "    \"image\": \"%s\",\n", image
+        next
+    }
+
+    # Replace uncommented image line (e.g. template URL) with repo URL
+    /^    "image":/ {
+        printf "    \"image\": \"%s\",\n", image
+        next
+    }
+
+    { print }
+' "$DEVCONTAINER_JSON" > "${DEVCONTAINER_JSON}.tmp" && mv "${DEVCONTAINER_JSON}.tmp" "$DEVCONTAINER_JSON"
+
</code_context>
<issue_to_address>
**suggestion (bug_risk):** The AWK transforms are tightly coupled to exact indentation and block shapes in devcontainer.json

The `awk` logic depends on exact spacing, brace placement, and comment style for the `build` and `features` blocks. Any reformatting (e.g., prettier or VS Code) could break the transform without obvious errors. Please either make the patterns more tolerant (e.g., flexible whitespace) or add checks that fail with a clear message when the expected structure isn’t found, so we avoid silent partial updates.

Suggested implementation:

```
# --- Transform devcontainer.json ---
awk -v image="$IMAGE" '
    # Return 1 if the line is already commented with //
    function is_commented(line) {
        return match(line, /^[[:space:]]*\/\//)
    }

    # Comment out an uncommented object block starting at "build": { ... }
    /^[[:space:]]*"build"[[:space:]]*:[[:space:]]*\{/ {
        if (!is_commented($0)) {
            in_build = 1
        }
    }
    in_build {
        # Prefix // after existing indentation, but only if not already commented
        if (!is_commented($0)) {
            sub(/^([[:space:]]*)/, "&// ")
        }
        # Close block when we hit a closing brace line
        if ($0 ~ /^[[:space:]]*}[[:space:]]*(,)?[[:space:]]*$/) {
            in_build = 0
        }
        print
        next
    }

    # Comment out an uncommented object block starting at "features": { ... }
    /^[[:space:]]*"features"[[:space:]]*:[[:space:]]*\{/ {
        if (!is_commented($0)) {
            in_features = 1
        }
    }
    in_features {
        if (!is_commented($0)) {
            sub(/^([[:space:]]*)/, "&// ")
        }
        if ($0 ~ /^[[:space:]]*}[[:space:]]*(,)?[[:space:]]*$/) {
            in_features = 0
        }
        print
        next
    }

    # Uncomment commented image line and set repo URL (preserve indentation)
    /^[[:space:]]*\/\/[[:space:]]*"image"[[:space:]]*:/ {
        match($0, /^([[:space:]]*)/)
        indent = substr($0, RSTART, RLENGTH)
        printf "%s\"image\": \"%s\",\n", indent, image
        next
    }

    # Replace uncommented image line (e.g. template URL) with repo URL (preserve indentation)
    /^[[:space:]]*"image"[[:space:]]*:/ {
        match($0, /^([[:space:]]*)/)
        indent = substr($0, RSTART, RLENGTH)
        printf "%s\"image\": \"%s\",\n", indent, image
        next
    }

    { print }
' "$DEVCONTAINER_JSON" > "${DEVCONTAINER_JSON}.tmp" && mv "${DEVCONTAINER_JSON}.tmp" "$DEVCONTAINER_JSON" && {
    # Verify that the expected image line was actually written; fail loudly if not
    if ! grep -q '^[[:space:]]*"image"[[:space:]]*:[[:space:]]*"'\""$IMAGE"\"'"' "$DEVCONTAINER_JSON"; then
        echo "ERROR: Failed to update devcontainer.json to use image $IMAGE. Check the devcontainer.json structure and try again." >&2
        exit 1
    fi
}

```

If there are any other helper scripts or tests that assert specific spacing for the `"build"`, `"features"`, or `"image"` lines in `devcontainer.json`, they may need to be updated to tolerate the more flexible whitespace handling introduced here.
</issue_to_address>

### Comment 3
<location path=".claude/README.md" line_range="94" />
<code_context>
+Edit `ralph.yml` to customize:
+- `event_loop.max_iterations` - Maximum iterations before stopping
+- `event_loop.max_runtime_seconds` - Maximum runtime
+- `cli.backend` - AI backend (claude, gemini, codex, etc.)
+- `hats` - Define custom personas for multi-agent workflows
+
</code_context>
<issue_to_address>
**nitpick (typo):** Consider capitalizing AI backend names (Claude, Gemini, Codex) as proper nouns.

Using proper capitalization for these product names will keep the docs correct and consistent.

```suggestion
- `cli.backend` - AI backend (Claude, Gemini, Codex, etc.)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread pyproject.toml
clear-pixi = "rm -rf .pixi pixi.lock"
setup-git-merge-driver = "git config merge.ours.driver true"
ralph = "ralph"
setup-git-merge-driver = "git config merge.ourslock.driver true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Typo in git merge driver config key (merge.ourslock.driver vs merge.ours.driver)

Changing merge.ours.driver to merge.ourslock.driver appears to be a typo and will configure a merge driver that doesn’t exist, so the intended merge behavior won’t apply. Unless you’ve added a custom ourslock driver, this should stay as merge.ours.driver.

Comment on lines +41 to +50
awk -v image="$IMAGE" '
# Comment out uncommented build block
/^ "build": \{/ { in_build=1 }
in_build {
sub(/^ /, " // ")
if (/^ \/\/ \}/) in_build=0
print; next
}

# Comment out uncommented features block

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): The AWK transforms are tightly coupled to exact indentation and block shapes in devcontainer.json

The awk logic depends on exact spacing, brace placement, and comment style for the build and features blocks. Any reformatting (e.g., prettier or VS Code) could break the transform without obvious errors. Please either make the patterns more tolerant (e.g., flexible whitespace) or add checks that fail with a clear message when the expected structure isn’t found, so we avoid silent partial updates.

Suggested implementation:

# --- Transform devcontainer.json ---
awk -v image="$IMAGE" '
    # Return 1 if the line is already commented with //
    function is_commented(line) {
        return match(line, /^[[:space:]]*\/\//)
    }

    # Comment out an uncommented object block starting at "build": { ... }
    /^[[:space:]]*"build"[[:space:]]*:[[:space:]]*\{/ {
        if (!is_commented($0)) {
            in_build = 1
        }
    }
    in_build {
        # Prefix // after existing indentation, but only if not already commented
        if (!is_commented($0)) {
            sub(/^([[:space:]]*)/, "&// ")
        }
        # Close block when we hit a closing brace line
        if ($0 ~ /^[[:space:]]*}[[:space:]]*(,)?[[:space:]]*$/) {
            in_build = 0
        }
        print
        next
    }

    # Comment out an uncommented object block starting at "features": { ... }
    /^[[:space:]]*"features"[[:space:]]*:[[:space:]]*\{/ {
        if (!is_commented($0)) {
            in_features = 1
        }
    }
    in_features {
        if (!is_commented($0)) {
            sub(/^([[:space:]]*)/, "&// ")
        }
        if ($0 ~ /^[[:space:]]*}[[:space:]]*(,)?[[:space:]]*$/) {
            in_features = 0
        }
        print
        next
    }

    # Uncomment commented image line and set repo URL (preserve indentation)
    /^[[:space:]]*\/\/[[:space:]]*"image"[[:space:]]*:/ {
        match($0, /^([[:space:]]*)/)
        indent = substr($0, RSTART, RLENGTH)
        printf "%s\"image\": \"%s\",\n", indent, image
        next
    }

    # Replace uncommented image line (e.g. template URL) with repo URL (preserve indentation)
    /^[[:space:]]*"image"[[:space:]]*:/ {
        match($0, /^([[:space:]]*)/)
        indent = substr($0, RSTART, RLENGTH)
        printf "%s\"image\": \"%s\",\n", indent, image
        next
    }

    { print }
' "$DEVCONTAINER_JSON" > "${DEVCONTAINER_JSON}.tmp" && mv "${DEVCONTAINER_JSON}.tmp" "$DEVCONTAINER_JSON" && {
    # Verify that the expected image line was actually written; fail loudly if not
    if ! grep -q '^[[:space:]]*"image"[[:space:]]*:[[:space:]]*"'\""$IMAGE"\"'"' "$DEVCONTAINER_JSON"; then
        echo "ERROR: Failed to update devcontainer.json to use image $IMAGE. Check the devcontainer.json structure and try again." >&2
        exit 1
    fi
}

If there are any other helper scripts or tests that assert specific spacing for the "build", "features", or "image" lines in devcontainer.json, they may need to be updated to tolerate the more flexible whitespace handling introduced here.

Comment thread .claude/README.md
Edit `ralph.yml` to customize:
- `event_loop.max_iterations` - Maximum iterations before stopping
- `event_loop.max_runtime_seconds` - Maximum runtime
- `cli.backend` - AI backend (claude, gemini, codex, etc.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (typo): Consider capitalizing AI backend names (Claude, Gemini, Codex) as proper nouns.

Using proper capitalization for these product names will keep the docs correct and consistent.

Suggested change
- `cli.backend` - AI backend (claude, gemini, codex, etc.)
- `cli.backend` - AI backend (Claude, Gemini, Codex, etc.)

@blooop
blooop merged commit 1ec1b3f into main Mar 1, 2026
8 of 9 checks passed
@blooop
blooop deleted the feature/update_from_template branch March 1, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants