Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/COMPLETE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,36 @@ cp -r blueprint/setup/ ./setup/
rm -rf blueprint
```

#### Step 1.5: Configure Git Remote

**CRITICAL**: The blueprint is a template. You must use it in YOUR own repository.

**If you cloned the template directly**:
```bash
# Check current remote
git remote get-url origin
# If it shows: https://github.com/alirezarezvani/claude-code-github-workflow.git
# You need to update it!

# Option A: Create new GitHub repository and update remote
gh repo create my-project --public --source=. --remote=origin

# Option B: Manually update to existing repository
git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO.git

# Verify the change
git remote get-url origin
# Should show YOUR repository, not the template
```

**Why this matters**:
- ❌ **Wrong**: Pushing to template repository (you don't have permission)
- ✅ **Right**: Pushing to your own repository
- The setup wizard will detect and help fix this automatically

**If you copied files to existing repository**:
- No action needed - your git remote is already correct ✅

#### Step 2: Configure for Your Project Type

**For Web Projects**:
Expand Down
12 changes: 10 additions & 2 deletions docs/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Before you begin, ensure you have:

### Step 1: Clone and Setup

Copy this blueprint into your project:
**Important**: This blueprint is a template. You need to use it in YOUR own repository.

```bash
# Option A: Add to existing repository
Expand All @@ -51,11 +51,19 @@ cp -r .blueprint-temp/.claude/ .
cp -r .blueprint-temp/setup/ .
rm -rf .blueprint-temp

# Option B: Start new project with blueprint
# Option B: Clone template, then create your own repository
git clone https://github.com/alirezarezvani/claude-code-github-workflow.git my-project
cd my-project

# Create your own GitHub repository
gh repo create my-project --public --source=. --remote=origin

# Or manually update git remote
git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
```

**Note**: The setup wizard (see below) will detect if you're still pointing to the template repository and help you update it automatically.

### Step 2: Configure Secrets

Add required secrets to your repository:
Expand Down
49 changes: 49 additions & 0 deletions setup/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,54 @@ This script validates your repository configuration.
EOF
}

# ─────────────────────────────────────────────────────────────────
# 0. Git Remote Validation
# ─────────────────────────────────────────────────────────────────

validate_git_remote() {
log_section "0. Checking Git Remote Configuration"

# Check if in git repository
if ! git rev-parse --git-dir &> /dev/null; then
log_fail "Not in a git repository"
return 1
fi

# Get current remote URL
local current_remote=$(git remote get-url origin 2>/dev/null || echo "")

if [[ -z "$current_remote" ]]; then
log_fail "No git remote 'origin' configured"
log_info "Configure with: git remote add origin <repo-url>"
return 1
fi

# Check if pointing to template repository
local template_repo="alirezarezvani/claude-code-github-workflow"

if [[ "$current_remote" == *"$template_repo"* ]]; then
log_fail "Git remote is still pointing to template repository!"
echo ""
echo -e "${RED}⚠️ CRITICAL: You are using the blueprint template repository directly!${NC}"
echo ""
echo " Current remote: $current_remote"
echo ""
echo " This will cause issues:"
echo " • Cannot push changes (permission denied)"
echo " • Secrets set on wrong repository"
echo " • Workflows run on template, not your project"
echo ""
echo " To fix, update git remote to YOUR repository:"
echo " git remote set-url origin https://github.com/<your-username>/<your-repo>.git"
echo ""
echo " Or run the setup wizard again: ./setup/wizard.sh"
echo ""
else
log_pass "Git remote configured correctly"
log_info "Remote: $current_remote"
fi
}

# ─────────────────────────────────────────────────────────────────
# 1. Branch Validation
# ─────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -618,6 +666,7 @@ main() {
show_header

# Run all validation checks
validate_git_remote
validate_branches
validate_secrets
validate_workflows
Expand Down
97 changes: 97 additions & 0 deletions setup/wizard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,100 @@ check_prerequisites() {
return 0
}

# ─────────────────────────────────────────────────────────────────
# Step 1.5: Repository Remote Setup
# ─────────────────────────────────────────────────────────────────

update_git_remote() {
log_step "Step 1.5: Repository Remote Setup"

# Get current remote URL
local current_remote=$(git remote get-url origin 2>/dev/null || echo "")

if [[ -z "$current_remote" ]]; then
log_error "No git remote 'origin' found"
log_info "This should not happen if prerequisites passed"
return 1
fi

log_info "Current remote: $current_remote"

# Check if pointing to template repository
local template_repo="alirezarezvani/claude-code-github-workflow"

if [[ "$current_remote" == *"$template_repo"* ]]; then
log_warning "Git remote is still pointing to the template repository!"
echo ""
echo "⚠️ You need to update the remote URL to YOUR repository."
echo ""
echo "This blueprint is a template - you should be using it in YOUR"
echo "own repository, not the original template repository."
echo ""

# Prompt for user's repository
echo "📋 Please provide your GitHub repository information:"
echo ""

local user_owner=""
local user_repo=""

while [[ -z "$user_owner" ]]; do
read -p "$(echo -e "${YELLOW}?${NC} Repository owner (your username or org): ")" user_owner
if [[ -z "$user_owner" ]]; then
log_error "Repository owner cannot be empty"
fi
done

while [[ -z "$user_repo" ]]; do
read -p "$(echo -e "${YELLOW}?${NC} Repository name: ")" user_repo
if [[ -z "$user_repo" ]]; then
log_error "Repository name cannot be empty"
fi
done

# Construct new remote URL (using HTTPS)
local new_remote="https://github.com/$user_owner/$user_repo.git"

echo ""
log_info "New remote URL: $new_remote"
echo ""

if ! confirm "Update git remote to this URL?"; then
log_warning "Git remote not updated."
echo ""
log_error "You MUST update the git remote before proceeding!"
echo ""
echo "To update manually, run:"
echo " git remote set-url origin https://github.com/<owner>/<repo>.git"
echo ""
echo "Then run this wizard again."
return 1
fi

# Update remote URL
if git remote set-url origin "$new_remote"; then
log "Git remote updated successfully!"

# Verify the change
local updated_remote=$(git remote get-url origin)
log_info "Verified remote: $updated_remote"

# Update global variables
REPO_OWNER="$user_owner"
REPO_NAME="$user_repo"
else
log_error "Failed to update git remote"
return 1
fi
else
log "Git remote is already configured correctly"
log_info "Remote: $current_remote"
fi

echo ""
return 0
}

# ─────────────────────────────────────────────────────────────────
# Step 2: Detect Project Type
# ─────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -966,6 +1060,9 @@ main() {
# Step 1: Check prerequisites
check_prerequisites || exit 1

# Step 1.5: Update git remote if needed
update_git_remote || exit 1

# Step 2: Detect project type
detect_project_type

Expand Down
Loading