Skip to content
16 changes: 8 additions & 8 deletions .archon/commands/defaults/archon-auto-fix-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ argument-hint: (none - reads all review artifacts from $ARTIFACTS_DIR/review/)

## IMPORTANT: Output Behavior

**Your output will be posted as a GitHub comment.** Keep working output minimal:
**Your output will be posted as a $FORGE_NAME comment.** Keep working output minimal:
- Do NOT narrate each step
- Do NOT output verbose progress updates
- Only output the final structured report at the end
Expand All @@ -19,11 +19,11 @@ argument-hint: (none - reads all review artifacts from $ARTIFACTS_DIR/review/)

## Your Mission

Read all review artifacts produced in this workflow run and fix everything surfaced — unless a finding is a clear YAGNI violation or speculative over-engineering beyond the scope of the original fix. Validate, commit, push, write an artifact, and post a GitHub comment explaining what was fixed and why anything was skipped.
Read all review artifacts produced in this workflow run and fix everything surfaced — unless a finding is a clear YAGNI violation or speculative over-engineering beyond the scope of the original fix. Validate, commit, push, write an artifact, and post a $FORGE_NAME comment explaining what was fixed and why anything was skipped.

**Output artifact**: `$ARTIFACTS_DIR/review/fix-report.md`
**Git action**: Commit AND push fixes to the PR branch
**GitHub action**: Post fix report as a comment on the PR
**$FORGE_NAME action**: Post fix report as a comment on the PR

---

Expand All @@ -33,7 +33,7 @@ Read all review artifacts produced in this workflow run and fix everything surfa

```bash
PR_NUMBER=$(cat $ARTIFACTS_DIR/.pr-number)
HEAD_BRANCH=$(gh pr view $PR_NUMBER --json headRefName --jq '.headRefName')
HEAD_BRANCH=$(bun "$FORGE_CLI" pr view $PR_NUMBER --json headRefName --jq '.headRefName')
echo "PR: $PR_NUMBER, Branch: $HEAD_BRANCH"
```

Expand Down Expand Up @@ -261,12 +261,12 @@ Write to `$ARTIFACTS_DIR/review/fix-report.md`:

---

## Phase 7: POST — GitHub Comment
## Phase 7: POST — $FORGE_NAME Comment

Post the fix report as a PR comment:

```bash
gh pr comment $PR_NUMBER --body "$(cat <<'EOF'
bun "$FORGE_CLI" pr comment $PR_NUMBER --body "$(cat <<'EOF'
## ⚡ Auto-Fix Report

**Status**: {COMPLETE | PARTIAL}
Expand Down Expand Up @@ -313,7 +313,7 @@ EOF
```

**PHASE_7_CHECKPOINT:**
- [ ] GitHub comment posted
- [ ] $FORGE_NAME comment posted

---

Expand Down Expand Up @@ -371,4 +371,4 @@ Cannot proceed without findings.
- **ALL_FINDINGS_ADDRESSED**: Every finding is either fixed, skipped (with reason), or blocked (with reason)
- **VALIDATION_PASSED**: Type check, lint, and tests all pass
- **COMMITTED_AND_PUSHED**: Changes committed and pushed to PR branch
- **REPORTED**: Fix report artifact written and GitHub comment posted
- **REPORTED**: Fix report artifact written and $FORGE_NAME comment posted
2 changes: 1 addition & 1 deletion .archon/commands/defaults/archon-code-review-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Note:
### 1.3 Get PR Diff

```bash
gh pr diff {number}
bun "$FORGE_CLI" pr diff {number}
```

### 1.4 Read CLAUDE.md
Expand Down
2 changes: 1 addition & 1 deletion .archon/commands/defaults/archon-comment-quality-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cat $ARTIFACTS_DIR/review/scope.md
### 1.3 Get PR Diff

```bash
gh pr diff {number}
bun "$FORGE_CLI" pr diff {number}
```

Focus on:
Expand Down
31 changes: 16 additions & 15 deletions .archon/commands/defaults/archon-create-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ argument-hint: [base-branch] (default: auto-detected from config or repo)

**Base branch override**: $ARGUMENTS
**Default base branch**: $BASE_BRANCH
**Forge**: $FORGE_TYPE

> If a base branch was provided as argument above, use it for `--base`. Otherwise use the default base branch.

> **Forge note**: When `$FORGE_TYPE` is not `github`, use `bun "$FORGE_CLI"` instead of `gh` for all forge operations (e.g., `"$FORGE_CLI" pr create`, `"$FORGE_CLI" pr list`). The tool handles authentication and API differences automatically.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
---

## Pre-flight: Check for Existing PRs
Expand All @@ -24,7 +27,7 @@ ISSUE_NUM=$(echo "$BRANCH" | grep -oE '[0-9]+' | tail -1)
If an issue number was found, search for open PRs that already reference it:

```bash
gh pr list \
bun "$FORGE_CLI" pr list \
--search "Fixes #${ISSUE_NUM} OR Closes #${ISSUE_NUM}" \
--state open \
--json number,url,headRefName
Expand Down Expand Up @@ -130,7 +133,7 @@ Look for the project's PR template at `.github/pull_request_template.md`, `.gith

---

[If from a GitHub issue, add: Closes #XXX]
[If from a $FORGE_NAME issue, add: Closes #XXX]
```

### 3.2 Determine PR Title
Expand All @@ -147,31 +150,29 @@ cat > $ARTIFACTS_DIR/pr-body.md <<'EOF'
[body from above]
EOF

gh pr create \
bun "$FORGE_CLI" pr create \
--title "[title]" \
--body-file $ARTIFACTS_DIR/pr-body.md \
--body "$(<$ARTIFACTS_DIR/pr-body.md)" \
--base $BASE_BRANCH
```

Or if the content is simple:

```bash
gh pr create --fill --base $BASE_BRANCH
bun "$FORGE_CLI" pr create --fill --base $BASE_BRANCH
```

After creating the PR, capture its identifiers for downstream steps. Only write artifacts if PR creation succeeded — never persist stale data from a pre-existing PR:

```bash
# After creating the PR, capture and persist the PR number for downstream steps
# IMPORTANT: Only write artifacts after confirmed successful PR creation
if gh pr view --json number,url -q '.number,.url' > /dev/null 2>&1; then
PR_NUMBER=$(gh pr view --json number -q '.number')
PR_URL=$(gh pr view --json url -q '.url')
echo "$PR_NUMBER" > "$ARTIFACTS_DIR/.pr-number"
echo "$PR_URL" > "$ARTIFACTS_DIR/.pr-url"
else
echo "WARNING: Could not confirm PR creation; skipping .pr-number/.pr-url artifacts"
fi
## After creating the PR, extract the PR number from the create output above,
## then persist it for downstream steps:
PR_NUMBER={number from create output}
PR_URL=$(bun "$FORGE_CLI" pr view "$PR_NUMBER" --json url -q '.url')
echo "$PR_NUMBER" > "$ARTIFACTS_DIR/.pr-number"
echo "$PR_URL" > "$ARTIFACTS_DIR/.pr-url"
```

---
Expand Down Expand Up @@ -210,7 +211,7 @@ Nothing to create a PR for.
### Branch Already Has PR

```bash
gh pr view --web
bun "$FORGE_CLI" pr view {pr-number} --json url
```

Opens the existing PR instead of creating a duplicate.
Expand All @@ -219,4 +220,4 @@ Opens the existing PR instead of creating a duplicate.

1. Check if branch exists remotely: `git ls-remote --heads origin [branch]`
2. If conflicts: `git pull --rebase origin $BASE_BRANCH` then retry push
3. If permission issues: Check GitHub access
3. If permission issues: Check $FORGE_NAME access
2 changes: 1 addition & 1 deletion .archon/commands/defaults/archon-docs-impact-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cat $ARTIFACTS_DIR/review/scope.md
### 1.3 Get PR Diff

```bash
gh pr diff {number}
bun "$FORGE_CLI" pr diff {number}
```

### 1.4 Read Current Documentation
Expand Down
2 changes: 1 addition & 1 deletion .archon/commands/defaults/archon-error-handling-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cat $ARTIFACTS_DIR/review/scope.md
### 1.3 Get PR Diff

```bash
gh pr diff {number}
bun "$FORGE_CLI" pr diff {number}
```

### 1.4 Read CLAUDE.md Error Handling Rules
Expand Down
24 changes: 15 additions & 9 deletions .archon/commands/defaults/archon-finalize-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ argument-hint: (no arguments - reads from workflow artifacts)
# Finalize Pull Request

**Workflow ID**: $WORKFLOW_ID
**Forge**: $FORGE_TYPE

> **Forge note**: When `$FORGE_TYPE` is not `github`, use `bun "$FORGE_CLI"` instead of `gh` for all forge operations (e.g., `"$FORGE_CLI" pr create`, `"$FORGE_CLI" pr list`, `"$FORGE_CLI" pr edit`). The tool handles authentication and API differences automatically.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

---

Expand Down Expand Up @@ -47,7 +50,7 @@ Extract:
### 1.3 Check for Existing PR

```bash
gh pr list --head $(git branch --show-current) --json number,url,state
bun "$FORGE_CLI" pr list --head $(git branch --show-current) --json number,url,state
```

**If PR already exists**: Will update it instead of creating new one.
Expand Down Expand Up @@ -183,40 +186,43 @@ cat > $ARTIFACTS_DIR/pr-body.md <<'EOF'
{prepared-body}
EOF

gh pr create \
bun "$FORGE_CLI" pr create \
--title "{plan-title}" \
--body-file $ARTIFACTS_DIR/pr-body.md \
--body "$(<$ARTIFACTS_DIR/pr-body.md)" \
--base $BASE_BRANCH
```

**If PR already exists**, update it:

```bash
gh pr edit {pr-number} --body-file $ARTIFACTS_DIR/pr-body.md
bun "$FORGE_CLI" pr edit {pr-number} --body "$(<$ARTIFACTS_DIR/pr-body.md)"
```

### 3.3 Ensure Ready for Review

If PR was created as draft, mark ready:

```bash
gh pr ready {pr-number} 2>/dev/null || true
bun "$FORGE_CLI" pr ready {pr-number} 2>/dev/null || true
```

### 3.4 Capture PR Info

After creating the PR, capture and persist its number and URL for downstream steps.
Use the PR number from the create/list output above:

```bash
gh pr view --json number,url,headRefName,baseRefName
PR_NUMBER={pr-number from create or list output}
bun "$FORGE_CLI" pr view "$PR_NUMBER" --json number,url,headRefName,baseRefName
```

### 3.5 Write PR Number Registry

Write PR number for downstream review steps:

```bash
PR_NUMBER=$(gh pr view --json number -q '.number')
PR_URL=$(gh pr view --json url -q '.url')
echo "$PR_NUMBER" > $ARTIFACTS_DIR/.pr-number
PR_URL=$(bun "$FORGE_CLI" pr view "$PR_NUMBER" --json url -q '.url')
echo "$PR_URL" > $ARTIFACTS_DIR/.pr-url
```

Expand Down Expand Up @@ -381,7 +387,7 @@ Check:
❌ PR not found: #{number}

The draft PR may have been closed or deleted. Create a new one:
`gh pr create --title "..." --body "..."`
`bun "$FORGE_CLI" pr create --title "..." --body "..."`
```

### Template Parsing
Expand Down
10 changes: 5 additions & 5 deletions .archon/commands/defaults/archon-implement-issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ EOF

## Phase 8: PR - Create Pull Request

**Before creating a PR**, check if one already exists for this issue or branch using `gh pr list`. If a PR already exists, skip creation and use the existing one.
**Before creating a PR**, check if one already exists for this issue or branch using `bun "$FORGE_CLI" pr list`. If a PR already exists, skip creation and use the existing one.

### 8.1 Push to Remote

Expand All @@ -366,15 +366,15 @@ Look for the project's PR template at `.github/pull_request_template.md`, `.gith
Write the prepared body to `$ARTIFACTS_DIR/pr-body.md`, then:

```bash
gh pr create --title "Fix: {title} (#{number})" \
--body-file $ARTIFACTS_DIR/pr-body.md
bun "$FORGE_CLI" pr create --title "Fix: {title} (#{number})" \
--body "$(<$ARTIFACTS_DIR/pr-body.md)"
```

### 8.3 Get PR Number

```bash
PR_URL=$(gh pr view --json url -q '.url')
PR_NUMBER=$(gh pr view --json number -q '.number')
PR_URL=$(bun "$FORGE_CLI" pr view --json url -q '.url')
PR_NUMBER=$(bun "$FORGE_CLI" pr view --json number -q '.number')
```

**PHASE_8_CHECKPOINT:**
Expand Down
14 changes: 7 additions & 7 deletions .archon/commands/defaults/archon-implement-review-fixes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ argument-hint: (none - reads from consolidated review artifact)

## IMPORTANT: Output Behavior

**Your output will be posted as a GitHub comment.** Keep your working output minimal:
**Your output will be posted as a $FORGE_NAME comment.** Keep your working output minimal:
- Do NOT narrate each step ("Now I'll read the file...", "Let me check...")
- Do NOT output verbose progress updates
- Only output the final structured report at the end
Expand All @@ -23,7 +23,7 @@ Read the consolidated review artifact and implement all CRITICAL and HIGH priori

**Output artifact**: `$ARTIFACTS_DIR/review/fix-report.md`
**Git action**: Commit AND push fixes to the PR branch
**GitHub action**: Post fix report comment
**$FORGE_NAME action**: Post fix report comment

---

Expand All @@ -35,7 +35,7 @@ Read the consolidated review artifact and implement all CRITICAL and HIGH priori
PR_NUMBER=$(cat $ARTIFACTS_DIR/.pr-number)

# Get the PR's head branch name
HEAD_BRANCH=$(gh pr view $PR_NUMBER --json headRefName --jq '.headRefName')
HEAD_BRANCH=$(bun "$FORGE_CLI" pr view $PR_NUMBER --json headRefName --jq '.headRefName')
echo "PR: $PR_NUMBER, Branch: $HEAD_BRANCH"
```

Expand Down Expand Up @@ -325,12 +325,12 @@ Write to `$ARTIFACTS_DIR/review/fix-report.md`:

---

## Phase 6: POST - GitHub Comment
## Phase 6: POST - $FORGE_NAME Comment

### 6.1 Post Fix Report

```bash
gh pr comment {number} --body "$(cat <<'EOF'
bun "$FORGE_CLI" pr comment {number} --body "$(cat <<'EOF'
# ⚡ Auto-Fix Report

**Status**: {COMPLETE | PARTIAL}
Expand Down Expand Up @@ -393,7 +393,7 @@ EOF
```

**PHASE_6_CHECKPOINT:**
- [ ] GitHub comment posted
- [ ] $FORGE_NAME comment posted

---

Expand Down Expand Up @@ -451,4 +451,4 @@ See fix report: `$ARTIFACTS_DIR/review/fix-report.md`
- **HIGH_ADDRESSED**: All HIGH issues attempted
- **VALIDATION_PASSED**: Type check, lint, tests, build all pass
- **COMMITTED_AND_PUSHED**: Changes committed AND pushed to PR branch
- **REPORTED**: Fix report artifact and GitHub comment created
- **REPORTED**: Fix report artifact and $FORGE_NAME comment created
6 changes: 3 additions & 3 deletions .archon/commands/defaults/archon-implement.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: Execute an implementation plan with rigorous validation loops
argument-hint: <path/to/plan.md or GitHub issue URL>
argument-hint: <path/to/plan.md or $FORGE_NAME issue URL>
---

# Implement Plan
Expand Down Expand Up @@ -57,7 +57,7 @@ Check `package.json` (or equivalent) for available scripts:
cat $ARGUMENTS
```

If `$ARGUMENTS` is a GitHub issue URL or number (e.g., `#123`), fetch the issue body which contains the plan.
If `$ARGUMENTS` is a $FORGE_NAME issue URL or number (e.g., `#123`), fetch the issue body which contains the plan.

### 1.2 Extract Key Sections

Expand All @@ -77,7 +77,7 @@ Locate and understand:
```
Error: Plan not found at $ARGUMENTS

Provide a valid plan path or GitHub issue containing the plan.
Provide a valid plan path or $FORGE_NAME issue containing the plan.
```

**PHASE_1_CHECKPOINT:**
Expand Down
Loading