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:
@@ -12,6 +12,7 @@ import {
|
||||
enableSilentMode,
|
||||
disableSilentMode
|
||||
} from '../../../../scripts/modules/utils.js';
|
||||
import { createLogWrapper } from '../../tools/utils.js';
|
||||
|
||||
/**
|
||||
* Get or update model configuration
|
||||
@@ -25,14 +26,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
const { projectRoot } = args; // Extract projectRoot from args
|
||||
|
||||
// Create a logger wrapper that the core functions can use
|
||||
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) : null,
|
||||
success: (message, ...args) => log.info(message, ...args)
|
||||
};
|
||||
const mcpLog = createLogWrapper(log);
|
||||
|
||||
log.info(`Executing models_direct with args: ${JSON.stringify(args)}`);
|
||||
log.info(`Using project root: ${projectRoot}`);
|
||||
@@ -59,7 +53,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
if (args.listAvailableModels === true) {
|
||||
return await getAvailableModelsList({
|
||||
session,
|
||||
mcpLog: logWrapper,
|
||||
mcpLog,
|
||||
projectRoot // Pass projectRoot to function
|
||||
});
|
||||
}
|
||||
@@ -68,7 +62,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
if (args.setMain) {
|
||||
return await setModel('main', args.setMain, {
|
||||
session,
|
||||
mcpLog: logWrapper,
|
||||
mcpLog,
|
||||
projectRoot, // Pass projectRoot to function
|
||||
providerHint: args.openrouter
|
||||
? 'openrouter'
|
||||
@@ -81,7 +75,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
if (args.setResearch) {
|
||||
return await setModel('research', args.setResearch, {
|
||||
session,
|
||||
mcpLog: logWrapper,
|
||||
mcpLog,
|
||||
projectRoot, // Pass projectRoot to function
|
||||
providerHint: args.openrouter
|
||||
? 'openrouter'
|
||||
@@ -94,7 +88,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
if (args.setFallback) {
|
||||
return await setModel('fallback', args.setFallback, {
|
||||
session,
|
||||
mcpLog: logWrapper,
|
||||
mcpLog,
|
||||
projectRoot, // Pass projectRoot to function
|
||||
providerHint: args.openrouter
|
||||
? 'openrouter'
|
||||
@@ -107,7 +101,7 @@ export async function modelsDirect(args, log, context = {}) {
|
||||
// Default action: get current configuration
|
||||
return await getModelConfiguration({
|
||||
session,
|
||||
mcpLog: logWrapper,
|
||||
mcpLog,
|
||||
projectRoot // Pass projectRoot to function
|
||||
});
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user