Refactor: Improve MCP logging, update E2E & tests

Refactors MCP server logging and updates testing infrastructure.

- MCP Server:

  - Replaced manual logger wrappers with centralized `createLogWrapper` utility.

  - Updated direct function calls to use `{ session, mcpLog }` context.

  - Removed deprecated `model` parameter from analyze, expand-all, expand-task tools.

  - Adjusted MCP tool import paths and parameter descriptions.

- Documentation:

  - Modified `docs/configuration.md`.

  - Modified `docs/tutorial.md`.

- Testing:

  - E2E Script (`run_e2e.sh`):

    - Removed `set -e`.

    - Added LLM analysis function (`analyze_log_with_llm`) & integration.

    - Adjusted test run directory creation timing.

    - Added debug echo statements.

  - Deleted Unit Tests: Removed `ai-client-factory.test.js`, `ai-client-utils.test.js`, `ai-services.test.js`.

  - Modified Fixtures: Updated `scripts/task-complexity-report.json`.

- Dev Scripts:

  - Modified `scripts/dev.js`.
This commit is contained in:
Eyal Toledano
2025-04-28 14:38:01 -04:00
parent 5f504fafb8
commit 4cf7e8a74a
37 changed files with 687 additions and 1736 deletions

View File

@@ -5,9 +5,9 @@
import { expandAllTasks } from '../../../../scripts/modules/task-manager.js';
import {
enableSilentMode,
disableSilentMode,
isSilentMode
disableSilentMode
} from '../../../../scripts/modules/utils.js';
import { createLogWrapper } from '../../tools/utils.js';
/**
* Expand all pending tasks with subtasks (Direct Function Wrapper)
@@ -26,14 +26,8 @@ export async function expandAllTasksDirect(args, log, context = {}) {
// Destructure expected args
const { tasksJsonPath, num, research, prompt, force } = args;
// Create the standard logger wrapper
const logWrapper = {
info: (message, ...args) => log.info(message, ...args),
warn: (message, ...args) => log.warn(message, ...args),
error: (message, ...args) => log.error(message, ...args),
debug: (message, ...args) => log.debug && log.debug(message, ...args), // Handle optional debug
success: (message, ...args) => log.info(message, ...args) // Map success to info if needed
};
// Create logger wrapper using the utility
const mcpLog = createLogWrapper(log);
if (!tasksJsonPath) {
log.error('expandAllTasksDirect called without tasksJsonPath');
@@ -58,15 +52,14 @@ export async function expandAllTasksDirect(args, log, context = {}) {
const additionalContext = prompt || '';
const forceFlag = force === true;
// Call the core function, passing the logger wrapper and session
// Call the core function, passing options and the context object { session, mcpLog }
const result = await expandAllTasks(
tasksJsonPath, // Use the provided path
tasksJsonPath,
numSubtasks,
useResearch,
additionalContext,
forceFlag,
{ mcpLog: logWrapper, session }, // Pass the wrapper and session
'json' // Explicitly request JSON output format
{ session, mcpLog }
);
// Core function now returns a summary object