Eyal Toledano afb47584bd feat(refactor): Finalize AI service migration and cleanup obsolete files
This commit completes the major refactoring initiative (Task 61) to migrate all AI-interacting task management functions to the unified service layer (`ai-services-unified.js`) and standardized configuration (`config-manager.js`).

Key Changes:

1.  **Refactor `update-task-by-id` & `update-subtask-by-id`:**

    *   Replaced direct AI client logic and config fetching with calls to `generateTextService`.

    *   Preserved original prompt logic while ensuring JSON output format is requested.

    *   Implemented robust manual JSON parsing and Zod validation for text-based AI responses.

    *   Corrected logger implementation (`logFn`/`isMCP`/`report` pattern) for both CLI and MCP contexts.

    *   Ensured correct passing of `session` context to the unified service.

    *   Refactored associated direct function wrappers (`updateTaskByIdDirect`, `updateSubtaskByIdDirect`) to remove AI client initialization and call core logic appropriately.

2.  **CLI Environment Loading:**

    *   Added `dotenv.config()` to `scripts/dev.js` to ensure consistent loading of the `.env` file for CLI operations.

3.  **Obsolete Code Removal:**

    *   Deleted unused helper files:

        *   `scripts/modules/task-manager/get-subtasks-from-ai.js`

        *   `scripts/modules/task-manager/generate-subtask-prompt.js`

        *   `scripts/modules/ai-services.js`

        *   `scripts/modules/ai-client-factory.js`

        *   `mcp-server/src/core/utils/ai-client-utils.js`

    *   Removed corresponding imports/exports from `scripts/modules/task-manager.js` and `mcp-server/src/core/task-master-core.js`.

4.  **Verification:**

    *   Successfully tested `update-task` and `update-subtask` via both CLI and MCP after refactoring.

5.  **Task Management:**

    *   Marked subtasks 61.38, 61.39, 61.40, 61.41, and 61.33 as 'done'.

    *   Includes other task content/status updates as reflected in the diff.

This completes the migration of core AI features to the new architecture, enhancing maintainability and flexibility.
2025-04-25 13:24:15 -04:00

11 lines
215 B
JavaScript

/**
* index.js
* Main export point for all Task Master CLI modules
*/
// Export all modules
export * from './utils.js';
export * from './ui.js';
export * from './task-manager.js';
export * from './commands.js';