From 499aa2b203967dce239b18da27f3799ae12477aa Mon Sep 17 00:00:00 2001 From: Joe Danziger Date: Fri, 23 May 2025 15:37:11 -0400 Subject: [PATCH] default to all rules --- docs/command-reference.md | 4 +-- .../direct-functions/initialize-project.js | 5 ++-- scripts/init.js | 29 ++----------------- scripts/modules/commands.js | 18 ++++++++---- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/docs/command-reference.md b/docs/command-reference.md index 9542d6c0..2d5c5a02 100644 --- a/docs/command-reference.md +++ b/docs/command-reference.md @@ -213,8 +213,8 @@ task-master init task-master init --rules cursor,windsurf ``` -- 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`. +- The `--rules` flag allows you to specify one or more rule sets (e.g., `cursor`, `roo`, `windsurf`, `cline`) to apply during initialization. +- If omitted, all available rule sets are installed by default (cursor, windsurf, roo, cline). - You can use multiple comma-separated rules in a single command. **Example:** diff --git a/mcp-server/src/core/direct-functions/initialize-project.js b/mcp-server/src/core/direct-functions/initialize-project.js index 28ba9be1..4132bd86 100644 --- a/mcp-server/src/core/direct-functions/initialize-project.js +++ b/mcp-server/src/core/direct-functions/initialize-project.js @@ -5,6 +5,7 @@ import { // isSilentMode // Not used directly here } from '../../../../scripts/modules/utils.js'; import os from 'os'; // Import os module for home directory check +import { BRAND_NAMES } from '../../../../src/utils/rule-transformer.js'; /** * Direct function wrapper for initializing a project. @@ -74,8 +75,8 @@ export async function initializeProjectDirect(args, log, context = {}) { options.rules = args.rules; log.info(`Including rules: ${args.rules.join(', ')}`); } else { - options.rules = ['cursor']; - log.info(`No rules specified, defaulting to: cursor`); + options.rules = BRAND_NAMES; + log.info(`No rules specified, defaulting to: ${BRAND_NAMES.join(', ')}`); } log.info(`Initializing project with options: ${JSON.stringify(options)}`); diff --git a/scripts/init.js b/scripts/init.js index 1cd0b1ec..c00b6021 100755 --- a/scripts/init.js +++ b/scripts/init.js @@ -320,7 +320,7 @@ async function initializeProject(options = {}) { let selectedBrandRules = options.rules && Array.isArray(options.rules) && options.rules.length > 0 ? options.rules - : ['cursor']; + : BRAND_NAMES; // Default to all rules // if (!isSilentMode()) { // console.log('Skip prompts determined:', skipPrompts); @@ -418,31 +418,6 @@ async function initializeProject(options = {}) { // Create structure using only necessary values createProjectStructure(addAliasesPrompted, dryRun, selectedBrandRules); - // If in MCP mode, call MCP server for rules (without 'yes' param) - if (options.mcpMode && options.mcpServer) { - const mcpArgs = { - action: 'add', - rules: selectedBrandRules, - projectRoot: targetDir - }; - try { - const mcpResult = await options.mcpServer.call('rules', mcpArgs); - if (mcpResult && mcpResult.success) { - log( - 'success', - `Brand rules added via MCP: ${selectedBrandRules.join(', ')}` - ); - } else { - log( - 'error', - `MCP rules add failed: ${mcpResult?.error?.message || 'Unknown error'}` - ); - } - } catch (err) { - log('error', `MCP server error: ${err.message}`); - } - } - for (const rule of selectedBrandRules) { const profile = BRAND_PROFILES[rule]; if (profile) { @@ -479,7 +454,7 @@ function promptQuestion(rl, question) { function createProjectStructure( addAliases, dryRun, - selectedBrandRules = ['cursor'] + selectedBrandRules = BRAND_NAMES // Default to all rules ) { const targetDir = process.cwd(); log('info', `Initializing project in ${targetDir}`); diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index e93be1d2..a7d51cc3 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -2123,17 +2123,23 @@ function registerCommands(programInstance) { .option('--dry-run', 'Show what would be done without making changes') .option('--aliases', 'Add shell aliases (tm, taskmaster)') .action(async (cmdOptions) => { - // Parse rules: accept space or comma separated, default to ['cursor'] - let rules = ['cursor']; + // cmdOptions contains parsed arguments + // Parse rules: accept space or comma separated, default to all available rules + let selectedBrands = BRAND_NAMES; + if (cmdOptions.rules && Array.isArray(cmdOptions.rules)) { - rules = cmdOptions.rules + const userSpecifiedBrands = cmdOptions.rules .flatMap((r) => r.split(',')) .map((r) => r.trim()) .filter(Boolean); - if (rules.length === 0) rules = ['cursor']; + // Only override defaults if user specified valid rules + if (userSpecifiedBrands.length > 0) { + selectedBrands = userSpecifiedBrands; + } } - // cmdOptions contains parsed arguments - cmdOptions.rules = rules; + + cmdOptions.rules = selectedBrands; + try { console.log('DEBUG: Running init command action in commands.js'); console.log(