fix MCP - remove yes flag

This commit is contained in:
Joe Danziger
2025-05-09 14:57:43 -04:00
parent d48a3d3edc
commit 143bf8e38e
2 changed files with 20 additions and 3 deletions

View File

@@ -39,9 +39,7 @@ export async function rulesDirect(args, log, context = {}) {
};
}
const rulesList = rules.join(',');
const yesFlag = yes !== false ? '--yes' : '';
const cmd =
`npx task-master rules ${action} ${rulesList} ${yesFlag}`.trim();
const cmd = `npx task-master rules ${action} ${rulesList}`.trim();
log.info(`[rulesDirect] Running: ${cmd} in ${projectRoot}`);
const output = execSync(cmd, { cwd: projectRoot, encoding: 'utf8' });
log.info(`[rulesDirect] Output: ${output}`);

View File

@@ -436,6 +436,25 @@ 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 = ruleProfiles[rule];
if (profile) {