From bf348dc594f89d70313f2f9ad0fbb9e187224711 Mon Sep 17 00:00:00 2001 From: JP <21163267+jpke@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:06:33 -0400 Subject: [PATCH 1/4] feat: add self-disable step to template setup workflow - Add final step to change alwaysApply from true to false after template initialization - Prevents detailed template setup instructions from consuming context window space - Ensures template setup rules are visible during one-time setup but hidden afterwards - Maintains accessibility via reference in workflow.mdc if needed later --- .cursor/rules/template_setup.mdc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.cursor/rules/template_setup.mdc b/.cursor/rules/template_setup.mdc index 36a978a..fb8b1d0 100644 --- a/.cursor/rules/template_setup.mdc +++ b/.cursor/rules/template_setup.mdc @@ -1,6 +1,6 @@ --- description: Detailed steps for template setup workflow when initializing a project -alwaysApply: false +alwaysApply: true --- # Template Setup Workflow @@ -30,3 +30,8 @@ When a user prompts "initialize this project as ", I will **ONL ## 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 From a4c67dfa8551499824089e7aee129a0a7b44c0b0 Mon Sep 17 00:00:00 2001 From: JP <21163267+jpke@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:16:02 -0400 Subject: [PATCH 2/4] feat(template): Add branch protection and issues setup to template workflow - Add GitHub CLI commands to enable issues in new repos - Include complete branch protection rules that match template repo - Provide both CLI and manual setup instructions - Document all protection settings for consistency across projects --- .cursor/rules/template_setup.mdc | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.cursor/rules/template_setup.mdc b/.cursor/rules/template_setup.mdc index fb8b1d0..5635c1c 100644 --- a/.cursor/rules/template_setup.mdc +++ b/.cursor/rules/template_setup.mdc @@ -28,6 +28,52 @@ When a user prompts "initialize this project as ", I will **ONL - **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. From 5c5d70092e0581cd05255c9ec14d0705fe722475 Mon Sep 17 00:00:00 2001 From: JP <21163267+jpke@users.noreply.github.com> Date: Sat, 5 Jul 2025 07:21:43 -0400 Subject: [PATCH 3/4] refactor(template): Reorganize template setup workflow for better clarity - Nest Environment File Distinction under step 2 (Remove template content) - Nest Branch Protection Rules Summary and Manual Setup under step 4 - Eliminate duplicate sections and improve contextual flow - Group related information with their respective steps - Reduce cognitive load for agents following the workflow --- .cursor/rules/template_setup.mdc | 99 +++++++++++++------------------- 1 file changed, 40 insertions(+), 59 deletions(-) diff --git a/.cursor/rules/template_setup.mdc b/.cursor/rules/template_setup.mdc index 5635c1c..7d64e25 100644 --- a/.cursor/rules/template_setup.mdc +++ b/.cursor/rules/template_setup.mdc @@ -16,68 +16,49 @@ When a user prompts "initialize this project as ", 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 From e9217fa7e84b1542f1044f0b18c4f9beac9971b4 Mon Sep 17 00:00:00 2001 From: JP <21163267+jpke@users.noreply.github.com> Date: Sat, 5 Jul 2025 07:40:31 -0400 Subject: [PATCH 4/4] docs: add step to return to main after creating PR - Added step 6 to git workflow: 'Return to Main' - Ensures developers always checkout main and pull after creating PR - Prevents feature mixing and keeps local environment current - Renumbered final step to 7 for clarity --- .cursor/rules/workflow.mdc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.cursor/rules/workflow.mdc b/.cursor/rules/workflow.mdc index 28c2198..58d7ba2 100644 --- a/.cursor/rules/workflow.mdc +++ b/.cursor/rules/workflow.mdc @@ -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