update "brand rules" to "rules"

This commit is contained in:
Joe Danziger
2025-05-22 14:26:08 -04:00
parent 0c64e9a739
commit c5c46e0cf8
9 changed files with 54 additions and 115 deletions

View File

@@ -2,14 +2,14 @@
'task-master-ai': patch 'task-master-ai': patch
--- ---
Added flexible brand rules management: Added flexible rules management:
- New `init` flag: You can now specify which brands to include rules for at project initialization using `--rules <brands>` or `-r <brands>` (e.g., `task-master init -r cursor,roo`). Only the selected brands' rules and configuration are included. - New `init` flag: You can now specify which rules to include at project initialization using `--rules <rules>` or `-r <rules>` (e.g., `task-master init -r cursor,roo`). Only the selected rules and configuration are included.
- New commands: `task-master rules add <brands>` and `task-master rules remove <brands>` let you add or remove brand-specific rules and MCP config after initialization, supporting multiple brands at once. - New commands: `task-master rules add <rules>` and `task-master rules remove <rules>` let you add or remove specific rules and MCP config after initialization, supporting multiple rules at once.
- New command: `task-master rules setup` launches an interactive prompt to select which brand rules to apply to your project. This does **not** re-initialize your project or affect shell aliases; it only manages rules. The list of brands is always up-to-date with available profiles, so you never have to update the CLI when adding a new brand. - New command: `task-master rules setup` launches an interactive prompt to select which rules to apply to your project. This does **not** re-initialize your project or affect shell aliases; it only manages rules. The list of rules is always up-to-date with available profiles, so you never have to update the CLI when adding a new rule set.
- The interactive rules setup flow is also used during `init` if you don't specify brands with `--rules`. - The interactive rules setup flow is also used during `init` if you don't specify rules with `--rules`.
- Documentation and tests were updated to reflect these changes. - Documentation and tests were updated to reflect these changes.
This enables more flexible, brand-specific project setups and makes rules management much easier. You can update or switch brands at any time after initialization using the interactive setup. This enables more flexible, rule-specific project setups and makes rules management much easier. You can update or switch rules at any time after initialization using the interactive setup.
- Resolves #338 - Resolves #338

View File

@@ -17,12 +17,12 @@ This document provides a detailed reference for interacting with Taskmaster, cov
### 1. Initialize Project (`init`) ### 1. Initialize Project (`init`)
* **Brand Rules Option:** * **Rules Option:**
* `--rules <brands>` or `-r <brands>`: Comma-separated list of brand rule sets to apply at initialization (e.g., `cursor,windsurf,roo`). * `--rules <rules>` or `-r <rules>`: Comma-separated list of rule sets to apply at initialization (e.g., `cursor,windsurf,roo`).
* Example: `task-master init --rules cursor,windsurf` * Example: `task-master init --rules cursor,windsurf`
* Example: `task-master init -r roo` * Example: `task-master init -r roo`
* **What happens:** * **What happens:**
* For each brand, creates the appropriate rules directory (e.g., `.roo/rules`) and MCP config (e.g., `.roo/mcp.json`). * For each, creates the appropriate rules directory (e.g., `.roo/rules`) and MCP config (e.g., `.roo/mcp.json`).
* If not specified, only Cursor rules are initialized by default. * If not specified, only Cursor rules are initialized by default.
@@ -93,15 +93,15 @@ This document provides a detailed reference for interacting with Taskmaster, cov
--- ---
### Add or Remove Brand Rules After Initialization ### Add or Remove Rules After Initialization
* **CLI Command:** * **CLI Command:**
* `task-master rules add <brands>`: Add one or more brand rule sets to your project (e.g., `task-master rules add windsurf,roo`). * `task-master rules add <rules>`: Add one or more rule sets to your project (e.g., `task-master rules add windsurf,roo`).
* `task-master rules remove <brands>`: Remove one or more brand rule sets (e.g., `task-master rules remove windsurf`). * `task-master rules remove <rules>`: Remove one or more rule sets (e.g., `task-master rules remove windsurf`).
* **What happens:** * **What happens:**
* Adding rules creates the brand rules directory (e.g., `.roo/rules`) and MCP config. * Adding rules creates the rules directory (e.g., `.roo/rules`) and MCP config (if appropriate).
* Removing rules deletes the brand rules directory and associated MCP config. * Removing rules deletes the rules directory and associated MCP config.
* You can use multiple comma-separated brands in a single command. * You can use multiple comma-separated rules in a single command.
--- ---

View File

@@ -93,14 +93,12 @@ task-master init
# If installed locally # If installed locally
npx task-master init npx task-master init
# Initialize project with specific rules
task-master init --rules cursor,windsurf
``` ```
This will prompt you for project details and set up a new project with the necessary files and structure. This will prompt you for project details and set up a new project with the necessary files and structure.
You can also specify brand rules to apply during initialization:
```bash
task-master init --rules cursor,windsurf
```
#### Common Commands #### Common Commands
@@ -108,81 +106,22 @@ task-master init --rules cursor,windsurf
# Initialize a new project # Initialize a new project
task-master init task-master init
# Initialize a new project applying specific brand rules
task-master init --rules cursor,windsurf
# Parse a PRD and generate tasks # Parse a PRD and generate tasks
task-master parse-prd your-prd.txt task-master parse-prd your-prd.txt
# Add, remove, or set up brand rules after initialization
You can add or remove brand rules at any time after project initialization:
```
task-master rules add windsurf,roo
# Adds the specified brand rule sets (e.g., .windsurf/rules, .roo/rules) to your project.
# Also sets up the corresponding MCP configuration in the brand directory.
task-master rules remove windsurf
# Removes the specified brand rule sets and their MCP config from your project.
task-master rules setup
# Launches an interactive prompt to select which brand rules to apply to your project.
# This does NOT re-initialize the project or ask about shell aliases.
# Useful for updating/enforcing rules or switching brands at any time.
# The list of brands is always up-to-date with available profiles.
````
- Adding rules creates the brand rules directory (e.g., `.roo/rules`) and copies/initializes the brand's rules.
- Removing rules deletes the brand rules directory and associated MCP config.
- You can use multiple comma-separated brands in a single command.
- Use the `--force` flag to bypass the confirmation prompt when removing rules (dangerous, irreversible):
```bash
task-master rules remove windsurf --force
````
:warning: **Warning:** The `--force` flag will immediately and permanently delete brand rules and configuration without asking for confirmation.
task-master rules add windsurf,roo
task-master rules remove windsurf --force
# List all tasks # List all tasks
task-master list task-master list
# Show the next task to work on # Show the next task to work on
task-master next task-master next
# Generate task files # Generate task files
task-master generate task-master generate
```` # Add rules after initialization
task-master rules add windsurf,roo
### Interactive Rules Setup
You can launch the interactive rules setup at any time with:
```bash
task-master rules setup
``` ```
This command opens a prompt where you can select which brand rules (e.g., Cursor, Roo, Windsurf) you want to apply to your project. The list of brands is always current with the available profiles—no manual updates needed. This does **not** re-initialize your project or ask about shell aliases; it only manages rules.
- Use this command to update, enforce, or switch brand rules interactively after project creation.
- The same interactive prompt is also used during `init` if you don't specify brands with `--rules`.
## Documentation ## Documentation
For more detailed information, check out the documentation in the `docs` directory: For more detailed information, check out the documentation in the `docs` directory:

View File

@@ -17,12 +17,12 @@ This document provides a detailed reference for interacting with Taskmaster, cov
### 1. Initialize Project (`init`) ### 1. Initialize Project (`init`)
* **Brand Rules Option:** * **Rules Option:**
* `--rules <brands>` or `-r <brands>`: Comma-separated list of brand rule sets to apply at initialization (e.g., `cursor,windsurf,roo`). * `--rules <rules>` or `-r <rules>`: Comma-separated list of rule sets to apply at initialization (e.g., `cursor,windsurf,roo`).
* Example: `task-master init --rules cursor,windsurf` * Example: `task-master init --rules cursor,windsurf`
* Example: `task-master init -r roo` * Example: `task-master init -r roo`
* **What happens:** * **What happens:**
* For each brand, creates the appropriate rules directory (e.g., `.roo/rules`) and MCP config (e.g., `.roo/mcp.json`). * For each, creates the appropriate rules directory (e.g., `.roo/rules`) and MCP config (e.g., `.roo/mcp.json`).
* If not specified, only Cursor rules are initialized by default. * If not specified, only Cursor rules are initialized by default.
@@ -93,15 +93,15 @@ This document provides a detailed reference for interacting with Taskmaster, cov
--- ---
### Add or Remove Brand Rules After Initialization ### Add or Remove Rules After Initialization
* **CLI Command:** * **CLI Command:**
* `task-master rules add <brands>`: Add one or more brand rule sets to your project (e.g., `task-master rules add windsurf,roo`). * `task-master rules add <rules>`: Add one or more rule sets to your project (e.g., `task-master rules add windsurf,roo`).
* `task-master rules remove <brands>`: Remove one or more brand rule sets (e.g., `task-master rules remove windsurf`). * `task-master rules remove <rules>`: Remove one or more rule sets (e.g., `task-master rules remove windsurf`).
* **What happens:** * **What happens:**
* Adding rules creates the brand rules directory (e.g., `.roo/rules`) and MCP config. * Adding rules creates the rules directory (e.g., `.roo/rules`) and MCP config (if appropriate).
* Removing rules deletes the brand rules directory and associated MCP config. * Removing rules deletes the rules directory and associated MCP config.
* You can use multiple comma-separated brands in a single command. * You can use multiple comma-separated rules in a single command.
--- ---

View File

@@ -209,13 +209,13 @@ task-master add-task --prompt="Description" --priority=high
# Initialize a new project with Task Master structure # Initialize a new project with Task Master structure
task-master init task-master init
# Initialize a new project applying specific brand rules # Initialize a new project applying specific rules
task-master init --rules cursor,windsurf task-master init --rules cursor,windsurf
``` ```
- The `--rules` flag allows you to specify one or more brand rule sets (e.g., `cursor`, `roo`, `windsurf`) to apply during initialization. - The `--rules` flag allows you to specify one or more rule sets (e.g., `cursor`, `roo`, `windsurf`) to apply during initialization.
- If omitted, the default is `cursor`. - If omitted, the default is `cursor`.
- You can use multiple comma-separated brands in a single command. - You can use multiple comma-separated rules in a single command.
**Example:** **Example:**
@@ -223,25 +223,25 @@ task-master init --rules cursor,windsurf
task-master init --rules cursor,roo task-master init --rules cursor,roo
``` ```
## Manage Brand Rules ## Manage Rules
```bash ```bash
# Add brand rule sets to your project # Add rule sets to your project
# (e.g., .roo/rules, .windsurf/rules) # (e.g., .roo/rules, .windsurf/rules)
task-master rules add <brand1,brand2,...> task-master rules add <rules1,rules2,...>
# Remove brand rule sets from your project # Remove rule sets from your project
task-master rules remove <brand1,brand2,...> task-master rules remove <rules1,rules2,...>
# Launch interactive rules setup to select brands # Launch interactive rules setup to select rules
# (does not re-initialize project or ask about shell aliases) # (does not re-initialize project or ask about shell aliases)
task-master rules setup task-master rules setup
``` ```
- Adding rules creates the brand rules directory (e.g., `.roo/rules`) and copies/initializes the brand's rules. - Adding rules creates the rules directory (e.g., `.roo/rules`) and copies/initializes the rules.
- Removing rules deletes the brand rules directory and associated MCP config. - Removing rules deletes the rules directory and associated MCP config.
- You can use multiple comma-separated brands in a single command. - You can use multiple comma-separated rules in a single command.
- The `setup` action launches an interactive prompt to select which brand rules to apply. The list of brands is always current with the available profiles, and no manual updates are needed. This command does **not** re-initialize your project or affect shell aliases; it only manages rules interactively. - The `setup` action launches an interactive prompt to select which rules to apply. The list of rules is always current with the available profiles, and no manual updates are needed. This command does **not** re-initialize your project or affect shell aliases; it only manages rules interactively.
**Examples:** **Examples:**
@@ -259,10 +259,10 @@ You can launch the interactive rules setup at any time with:
task-master rules setup task-master rules setup
``` ```
This command opens a prompt where you can select which brand rules (e.g., Cursor, Roo, Windsurf) you want to apply to your project. The list of brands is always current with the available profiles—no manual updates needed. This does **not** re-initialize your project or ask about shell aliases; it only manages rules. This command opens a prompt where you can select which rules (e.g., Cursor, Roo, Windsurf) you want to apply to your project. The list of rules is always current with the available profiles—no manual updates needed. This does **not** re-initialize your project or ask about shell aliases; it only manages rules.
- Use this command to update, enforce, or switch brand rules interactively after project creation. - Use this command to add rules interactively after project creation.
- The same interactive prompt is also used during `init` if you don't specify brands with `--rules`. - The same interactive prompt is also used during `init` if you don't specify rules with `--rules`.
## Configure AI Models ## Configure AI Models

View File

@@ -72,7 +72,7 @@ export async function initializeProjectDirect(args, log, context = {}) {
// Handle rules option just like CLI // Handle rules option just like CLI
if (Array.isArray(args.rules) && args.rules.length > 0) { if (Array.isArray(args.rules) && args.rules.length > 0) {
options.rules = args.rules; options.rules = args.rules;
log.info(`Including brand rules: ${args.rules.join(', ')}`); log.info(`Including rules: ${args.rules.join(', ')}`);
} else { } else {
options.rules = ['cursor']; options.rules = ['cursor'];
log.info(`No rules specified, defaulting to: cursor`); log.info(`No rules specified, defaulting to: cursor`);

View File

@@ -1,6 +1,6 @@
/** /**
* rules.js * rules.js
* Direct function implementation for adding or removing brand rules * Direct function implementation for adding or removing rules
*/ */
import { import {
@@ -18,10 +18,10 @@ import path from 'path';
import fs from 'fs'; import fs from 'fs';
/** /**
* Direct function wrapper for adding or removing brand rules. * Direct function wrapper for adding or removing rules.
* @param {Object} args - Command arguments * @param {Object} args - Command arguments
* @param {"add"|"remove"} args.action - Action to perform: add or remove rules * @param {"add"|"remove"} args.action - Action to perform: add or remove rules
* @param {string[]} args.rules - List of brand rules to add or remove * @param {string[]} args.rules - List of rules to add or remove
* @param {string} args.projectRoot - Absolute path to the project root * @param {string} args.projectRoot - Absolute path to the project root
* @param {boolean} [args.yes=true] - Run non-interactively * @param {boolean} [args.yes=true] - Run non-interactively
* @param {Object} log - Logger object * @param {Object} log - Logger object

View File

@@ -40,7 +40,7 @@ export function registerInitializeProjectTool(server) {
.array(z.string()) .array(z.string())
.optional() .optional()
.describe( .describe(
'List of brand rules to include at initialization (e.g., ["cursor", "roo"]). If omitted, defaults to ["cursor"].' 'List of rules to include at initialization (e.g., ["cursor", "roo"]). If omitted, defaults to ["cursor"].'
) )
}), }),
execute: withNormalizedProjectRoot(async (args, context) => { execute: withNormalizedProjectRoot(async (args, context) => {

View File

@@ -1,6 +1,6 @@
/** /**
* tools/rules.js * tools/rules.js
* Tool to add or remove brand rules from a project (MCP server) * Tool to add or remove rules from a project (MCP server)
*/ */
import { z } from 'zod'; import { z } from 'zod';
@@ -19,16 +19,16 @@ export function registerRulesTool(server) {
server.addTool({ server.addTool({
name: 'rules', name: 'rules',
description: description:
'Add or remove brand rules and MCP config from the project (mirrors CLI rules add/remove).', 'Add or remove rules and MCP config from the project (mirrors CLI rules add/remove).',
parameters: z.object({ parameters: z.object({
action: z action: z
.enum(['add', 'remove']) .enum(['add', 'remove'])
.describe('Whether to add or remove brand rules.'), .describe('Whether to add or remove rules.'),
rules: z rules: z
.array(z.string()) .array(z.string())
.min(1) .min(1)
.describe( .describe(
'List of brand rules to add or remove (e.g., ["roo", "windsurf"]).' 'List of rules to add or remove (e.g., ["roo", "windsurf"]).'
), ),
projectRoot: z projectRoot: z
.string() .string()