Skip to content
Merged
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
99 changes: 40 additions & 59 deletions .cursor/rules/template_setup.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -16,68 +16,49 @@ When a user prompts "initialize this project as <my project name>", I will **ONL
- Update `SECURITY.md` to remove template references
- Remove or update any hardcoded paths in configuration files

**Environment File Distinction:**
- **Template `.env.example`**: Contains TaskMaster CLI configuration (ANTHROPIC_API_KEY, PERPLEXITY_API_KEY, etc.)
- **Project `.env`**: Will contain application-specific configuration (database URLs, app API keys, etc.)
- **Never mix these**: TaskMaster configuration is separate from project application configuration
3. **Enable Issues** (if GitHub repository):
```bash
gh api repos/OWNER/REPO --method PATCH --field has_issues=true
```
4. **Set Branch Protection Rules** (if GitHub repository):
```bash
gh api repos/OWNER/REPO/branches/main/protection \
--method PUT \
--field required_status_checks='{"strict":true,"contexts":[],"checks":[]}' \
--field required_pull_request_reviews='{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"require_last_push_approval":false,"required_approving_review_count":1}' \
--field required_signatures='{"enabled":false}' \
--field enforce_admins='{"enabled":false}' \
--field required_linear_history='{"enabled":false}' \
--field allow_force_pushes='{"enabled":true}' \
--field allow_deletions='{"enabled":false}' \
--field block_creations='{"enabled":false}' \
--field required_conversation_resolution='{"enabled":false}' \
--field lock_branch='{"enabled":false}' \
--field allow_fork_syncing='{"enabled":false}'
```

**Branch Protection Rules Summary:**
- **Pull Request Reviews**: 1 approval required
- **Status Checks**: Strict mode enabled
- **Force Pushes**: Allowed
- **Branch Deletions**: Disabled
- **Admin Enforcement**: Disabled (admins can bypass)

**Manual Setup Alternative:**
If CLI commands fail, manually configure in GitHub:
1. Go to repository Settings → Branches
2. Add rule for `main` branch
3. Enable "Require a pull request before merging" (1 approval)
4. Enable "Require status checks to pass before merging" (strict mode)
5. **Remove from Context Window** - Change `alwaysApply: true` to `alwaysApply: false` in the frontmatter of `.cursor/rules/template_setup.mdc`

## What NOT to Include in Template Initialization
- **Do NOT set up TaskMaster** - This is a separate workflow that requires explicit user request
- **Do NOT create PRDs** - Project Requirements Documents are separate from template setup
- **Do NOT copy `.env.example` to `.env`** - Only do this if user specifically requests TaskMaster CLI setup
- **Do NOT initialize git repository** - Template initialization is separate from git setup
- **Do NOT create tasks or project management files** - Focus only on template structure

## Environment File Distinction
- **Template `.env.example`**: Contains TaskMaster CLI configuration (ANTHROPIC_API_KEY, PERPLEXITY_API_KEY, etc.)
- **Project `.env`**: Will contain application-specific configuration (database URLs, app API keys, etc.)
- **Never mix these**: TaskMaster configuration is separate from project application configuration

## Branch Protection Setup (Optional)
If the new project is a GitHub repository, consider setting up branch protection rules to match the template:

### Enable Issues
First, ensure issues are enabled in the repository:

```bash
# Enable issues in the repository
gh api repos/OWNER/REPO --method PATCH --field has_issues=true
```

### Required Branch Protection Rules
Apply these settings to the `main` branch:

```bash
# Enable branch protection with pull request reviews
gh api repos/OWNER/REPO/branches/main/protection \
--method PUT \
--field required_status_checks='{"strict":true,"contexts":[],"checks":[]}' \
--field required_pull_request_reviews='{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"require_last_push_approval":false,"required_approving_review_count":1}' \
--field required_signatures='{"enabled":false}' \
--field enforce_admins='{"enabled":false}' \
--field required_linear_history='{"enabled":false}' \
--field allow_force_pushes='{"enabled":true}' \
--field allow_deletions='{"enabled":false}' \
--field block_creations='{"enabled":false}' \
--field required_conversation_resolution='{"enabled":false}' \
--field lock_branch='{"enabled":false}' \
--field allow_fork_syncing='{"enabled":false}'
```

### Branch Protection Summary
- **Pull Request Reviews**: 1 approval required
- **Status Checks**: Strict mode enabled
- **Force Pushes**: Allowed
- **Branch Deletions**: Disabled
- **Admin Enforcement**: Disabled (admins can bypass)

### Alternative: Manual Setup
1. Go to repository Settings → Branches
2. Add rule for `main` branch
3. Enable "Require a pull request before merging"
4. Set "Required number of approvals before merging" to 1
5. Enable "Require status checks to pass before merging"
6. Check "Require branches to be up to date before merging"

## After Template Initialization
Template initialization is complete after customizing the project files. TaskMaster, PRD creation, and git setup are separate workflows that require explicit user requests.

### Final Step: Remove from Context Window
After completing template initialization, update this rule file to stop consuming context space:
- **Change `alwaysApply: true` to `alwaysApply: false`** in the frontmatter of `.cursor/rules/template_setup.mdc`
- This prevents the detailed template setup instructions from taking up context window space after the one-time setup is complete
3 changes: 2 additions & 1 deletion .cursor/rules/workflow.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ For detailed steps on initializing a git repository when cloning the template di
3. **Commit Changes**: `git add .` and `git commit -m "descriptive message"`
4. **Push Branch**: `git push -u origin feature/descriptive-name`
5. **🚨 CRITICAL: Open Pull Request**: `gh pr create --title "Title" --body "Description"` or use GitHub web interface - **THIS STEP IS MANDATORY**
6. **Merge via PR**: Never use `git push origin main` directly
6. **Return to Main**: `git checkout main && git pull origin main` - **ALWAYS do this after creating PR to prepare for next task**
7. **Merge via PR**: Never use `git push origin main` directly
- **Branch Naming Conventions**:
- `feature/feature-name` for new features
- `fix/bug-description` for bug fixes
Expand Down