feat(git-workflow): Add automatic git branch-tag integration

- Implement automatic tag creation when switching to new git branches

- Add branch-tag mapping system for seamless context switching

- Enable auto-switch of task contexts based on current git branch

- Provide isolated task contexts per branch to prevent merge conflicts

- Add configuration support for enabling/disabling git workflow features

- Fix ES module compatibility issues in git-utils module

- Maintain zero migration impact with automatic 'master' tag creation

- Support parallel development with branch-specific task contexts

The git workflow system automatically detects branch changes and creates corresponding empty task tags, enabling developers to maintain separate task contexts for different features/branches while preventing task-related merge conflicts during collaborative development.

Resolves git workflow integration requirements for multi-context development.
This commit is contained in:
Eyal Toledano
2025-06-13 18:27:51 -04:00
parent a047886910
commit 32236a0bc5
16 changed files with 127 additions and 41 deletions

View File

@@ -6052,7 +6052,7 @@
"id": 98,
"title": "Implement Standalone 'research' CLI Command for AI-Powered Queries",
"description": "Develop a new 'task-master research' (alias 'tm research') CLI command for fast, context-aware AI research queries using the ai-services-unified.js infrastructure.",
"status": "in-progress",
"status": "done",
"dependencies": [
2,
4,
@@ -6128,8 +6128,8 @@
"id": 7,
"title": "Add research save-to-file functionality",
"description": "Implement functionality to save research results to /research/ folder with optional interactive prompts",
"details": "Add capability to save research results to files in a /research/ directory at project root. For CLI mode, use inquirer to prompt user if they want to save the research. For MCP mode, accept a saveToFile parameter.\n\nKey implementation details:\n- Create /research/ directory if it doesn't exist (similar to how tasks/ is handled)\n- Generate meaningful filenames based on query and timestamp\n- Support both CLI interactive mode (inquirer prompts) and MCP parameter mode\n- Follow project root detection pattern from add-task.js stack\n- Handle file writing with proper error handling\n- Return saved file path in response for confirmation\n\nFile structure:\n- /research/YYYY-MM-DD_query-summary.md (markdown format)\n- Include query, timestamp, context used, and full AI response\n- Add metadata header with query details and context sources\n<info added on 2025-06-13T17:20:09.162Z>\nImplementation approach confirmed with detailed plan:\n\n**Modified handleFollowUpQuestions:**\n- Added \"Save to file\" option to inquirer prompt choices\n- Option triggers new handleSaveToFile function when selected\n\n**New handleSaveToFile function:**\n- Manages complete file-saving workflow\n- Creates .taskmaster/docs/research/ directory structure (following project patterns)\n- Generates slugified filenames: YYYY-MM-DD_query-summary.md format\n- Formats full conversation history into comprehensive Markdown with metadata header\n- Handles file writing with proper error handling\n- Returns confirmation message with saved file path\n\n**Enhanced performResearch for MCP integration:**\n- Added saveToFile boolean parameter to options object\n- Non-interactive mode (MCP) bypasses user prompts when saveToFile=true\n- Direct invocation of handleSaveToFile logic for programmatic saves\n- Updated main action in commands.js to support new saveToFile option parameter\n\nThis maintains consistency with existing project patterns while supporting both interactive CLI and programmatic MCP usage modes.\n</info added on 2025-06-13T17:20:09.162Z>",
"status": "pending",
"details": "Add capability to save research results to files in a /research/ directory at project root. For CLI mode, use inquirer to prompt user if they want to save the research. For MCP mode, accept a saveToFile parameter.\n\nKey implementation details:\n- Create /research/ directory if it doesn't exist (similar to how tasks/ is handled)\n- Generate meaningful filenames based on query and timestamp\n- Support both CLI interactive mode (inquirer prompts) and MCP parameter mode\n- Follow project root detection pattern from add-task.js stack\n- Handle file writing with proper error handling\n- Return saved file path in response for confirmation\n\nFile structure:\n- /research/YYYY-MM-DD_query-summary.md (markdown format)\n- Include query, timestamp, context used, and full AI response\n- Add metadata header with query details and context sources\n<info added on 2025-06-13T17:20:09.162Z>\nImplementation approach confirmed with detailed plan:\n\n**Modified handleFollowUpQuestions:**\n- Added \"Save to file\" option to inquirer prompt choices\n- Option triggers new handleSaveToFile function when selected\n\n**New handleSaveToFile function:**\n- Manages complete file-saving workflow\n- Creates .taskmaster/docs/research/ directory structure (following project patterns)\n- Generates slugified filenames: YYYY-MM-DD_query-summary.md format\n- Formats full conversation history into comprehensive Markdown with metadata header\n- Handles file writing with proper error handling\n- Returns confirmation message with saved file path\n\n**Enhanced performResearch for MCP integration:**\n- Added saveToFile boolean parameter to options object\n- Non-interactive mode (MCP) bypasses user prompts when saveToFile=true\n- Direct invocation of handleSaveToFile logic for programmatic saves\n- Updated main action in commands.js to support new saveToFile option parameter\n\nThis maintains consistency with existing project patterns while supporting both interactive CLI and programmatic MCP usage modes.\n</info added on 2025-06-13T17:20:09.162Z>\n<info added on 2025-06-13T19:52:28.153Z>\n**IMPLEMENTATION COMPLETED SUCCESSFULLY**\n\n✅ **Save-to-file functionality implemented and working:**\n\n1. **Core Function Enhanced**: Modified `handleFollowUpQuestions` in `research.js` to add \"Save to file\" option\n2. **New Handler Created**: Added `handleSaveToFile` function that:\n - Creates `.taskmaster/docs/research/` directory if needed\n - Generates timestamped, slugified filenames (e.g., `2025-01-13_what-is-typescript.md`)\n - Formats research as comprehensive Markdown with metadata header\n - Saves conversation history with proper formatting\n3. **CLI Integration**: Added `--save-file` flag to research command (consistent with existing `--save` and `--save-to` flags)\n4. **MCP Integration**: Added `saveToFile` parameter to MCP research tool\n5. **Output Cleanup**: Fixed duplicate information in saved files by removing redundant header section\n\n**Testing Results:**\n- CLI command `task-master research \"What is TypeScript?\" --save-file --detail=low` works perfectly\n- File saved to `.taskmaster/docs/research/2025-01-13_what-is-typescript.md` with clean formatting\n- MCP tool has correct `saveToFile` parameter\n\n**🔧 CRITICAL BUG FIXED: Tag Corruption in MCP Tools**\n\n**Root Cause Identified**: Several MCP direct functions were calling `readJSON()` without the `projectRoot` parameter, causing tag resolution to fail and corrupting the tagged task structure.\n\n**Key Fixes Applied**:\n1. **Fixed `readJSON()` calls**: Added missing `projectRoot` parameter to all `readJSON()` calls in direct functions\n2. **Updated MCP tool parameter passing**: Ensured `projectRoot` is passed from MCP tools to direct functions\n3. **Context parameter clarification**: Only functions that perform AI operations actually need the `context = {}` parameter for session access (API keys)\n\n**Functions Fixed**:\n- `list-tasks.js` - Now passes `projectRoot` in context to core function\n- `next-task.js` - Now calls `readJSON(tasksJsonPath, projectRoot)`\n- `set-task-status.js` - Now passes `projectRoot` to `nextTaskDirect`\n- `show-task.js` - Now calls `readJSON(tasksJsonPath, projectRoot)`\n- `remove-task.js` - Now calls `readJSON(tasksJsonPath, projectRoot)`\n- `expand-task.js` - Now calls `readJSON(tasksPath, projectRoot)` in both locations\n\n**Verification**: Tag preservation now works correctly - tested with `set_task_status` MCP tool and tag remained as \"master\" instead of being corrupted.\n\n**Architecture Insight**: The `context = {}` parameter is only needed for AI operations that require `session` for API keys. Simple CRUD operations only need `projectRoot` passed correctly to maintain tag context.\n</info added on 2025-06-13T19:52:28.153Z>",
"status": "done",
"dependencies": [],
"parentTaskId": 98
},
@@ -6748,8 +6748,16 @@
],
"metadata": {
"created": "2025-06-13T02:49:12.129Z",
"updated": "2025-06-13T17:26:21.856Z",
"updated": "2025-06-13T20:18:22.896Z",
"description": "Tasks for master context"
}
},
"v017-adds": {
"tasks": [],
"metadata": {
"created": "2025-06-13T22:24:34.115Z",
"updated": "2025-06-13T22:24:34.115Z",
"description": "Automatically created from git branch \"v017-adds\""
}
}
}