---
phase: quick
plan: 260331-ta2
type: execute
wave: 1
depends_on: []
files_modified:
  - justfile
autonomous: true
requirements: []
must_haves:
  truths:
    - "Running `just release` updates description.yml ref and version, copies to CE fork, commits, pushes, and opens a PR"
    - "CE fork path is configurable via CE_REPO env var with sensible default"
    - "Recipe fails fast with clear error if not on main branch or if gh CLI is not available"
  artifacts:
    - path: "justfile"
      provides: "release recipe"
      contains: "release"
  key_links:
    - from: "justfile release recipe"
      to: "description.yml"
      via: "sed in-place edit of ref and version fields"
    - from: "justfile release recipe"
      to: "CE fork description.yml"
      via: "cp to $CE_REPO/extensions/semantic_views/"
---

<objective>
Add a `just release` recipe that automates the CE registry release process described in MAINTAINER.md.

Purpose: Replace the current 6-step manual release process with a single command. After squash-merging a milestone branch to main, running `just release` should update description.yml, copy it to the CE fork, commit+push in the fork, and open a PR to duckdb/community-extensions.

Output: Updated justfile with the new `release` recipe.
</objective>

<execution_context>
@$HOME/.claude/get-shit-done/workflows/execute-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@justfile
@description.yml
@MAINTAINER.md (section: Publishing to Community Extension Registry > Submitting a New Release)
</context>

<tasks>

<task type="auto">
  <name>Task 1: Add release recipe to justfile</name>
  <files>justfile</files>
  <action>
Add a `release` recipe to the justfile that automates the full CE release process. The recipe should:

1. **Precondition checks** (fail fast with clear errors):
   - Verify current branch is `main` (`git branch --show-current`)
   - Verify `gh` CLI is available (`command -v gh`)
   - Verify working tree is clean (`git diff --quiet && git diff --cached --quiet`)

2. **Extract values from this repo:**
   - `SHA` = `git rev-parse HEAD` (the squash-merge commit on main)
   - `VERSION` = extract version from line 3 of Cargo.toml using: `sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml`

3. **Update description.yml in this repo:**
   - Use `sed -i ''` (macOS compatible) to replace the `ref:` line: `sed -i '' "s/^  ref: .*/  ref: $SHA/" description.yml`
   - Use `sed -i ''` to replace the `version:` line: `sed -i '' "s/^  version: .*/  version: $VERSION/" description.yml`
   - Commit the updated description.yml: `git add description.yml && git commit -m "chore: update description.yml for v$VERSION release"`

4. **Copy to CE fork and open PR:**
   - Use env var `CE_REPO` with default `~/Documents/Dev/Sources/community-extensions`
   - Verify CE_REPO directory exists, fail with helpful message if not
   - `cp description.yml "$CE_REPO/extensions/semantic_views/description.yml"`
   - `cd "$CE_REPO"` then:
     - `git checkout semantic-views` (the fork branch)
     - `git add extensions/semantic_views/description.yml`
     - `git commit -m "Update semantic_views to v$VERSION"`
     - `git push origin semantic-views`
     - `gh pr create --repo duckdb/community-extensions --head anentropic:semantic-views --base main --title "Update semantic_views to v$VERSION" --body "Update semantic_views extension to v$VERSION (ref: $SHA)"`

5. **Print summary** at the end: the SHA used, the version, and the PR URL.

**Style conventions to follow** (match existing justfile patterns):
- Use `#` comment above the recipe name for description
- Use `@` prefix on echo lines for clean output
- Use backslash line continuations for multi-line shell blocks (see `_ensure-test-deps` and `update-headers` for examples)
- Place the recipe after `docs-serve` (at the end of the file)

**Environment variable for CE fork path:**
- Declare at recipe level using just's `env_var_or_default` or shell fallback: `CE_REPO=${CE_REPO:-$HOME/Documents/Dev/Sources/community-extensions}`

**Important:** The `sed -i ''` syntax is macOS-specific. This is acceptable since the user's dev machine is macOS (darwin). Add a comment noting this.
  </action>
  <verify>
    <automated>just --list | grep -q release && echo "release recipe found" || echo "MISSING"</automated>
  </verify>
  <done>
- `just --list` shows the `release` recipe with a description
- The recipe includes all 6 steps from the MAINTAINER.md release process
- CE_REPO is configurable via env var with default path
- Precondition checks for branch, clean tree, and gh CLI are present
- Recipe uses macOS-compatible sed syntax matching existing justfile conventions
  </done>
</task>

</tasks>

<verification>
- `just --list` includes the `release` recipe
- `just --dry-run release 2>&1` or visual inspection confirms the recipe structure
- The recipe handles: precondition checks, SHA extraction, version extraction, description.yml update, CE fork copy, git commit+push in fork, gh pr create
</verification>

<success_criteria>
The justfile contains a working `release` recipe that automates the full CE registry release process in a single command, with proper error handling and configurable CE fork path.
</success_criteria>

<output>
After completion, create `.planning/quick/260331-ta2-write-a-justfile-recipe-for-the-release-/260331-ta2-SUMMARY.md`
</output>
