fix: bedrock set model and other fixes (#641)

This commit is contained in:
Ralph Khreish
2025-06-02 14:44:35 +02:00
committed by GitHub
parent e0438c8fb8
commit ad612763ff
21 changed files with 128 additions and 84 deletions

31
src/utils/logger-utils.js Normal file
View File

@@ -0,0 +1,31 @@
/**
* Logger utility functions for Task Master
* Provides standardized logging patterns for both CLI and utility contexts
*/
import { log as utilLog } from '../../scripts/modules/utils.js';
/**
* Creates a standard logger object that wraps the utility log function
* This provides a consistent logger interface across different parts of the application
* @returns {Object} A logger object with standard logging methods (info, warn, error, debug, success)
*/
export function createStandardLogger() {
return {
info: (msg, ...args) => utilLog('info', msg, ...args),
warn: (msg, ...args) => utilLog('warn', msg, ...args),
error: (msg, ...args) => utilLog('error', msg, ...args),
debug: (msg, ...args) => utilLog('debug', msg, ...args),
success: (msg, ...args) => utilLog('success', msg, ...args)
};
}
/**
* Creates a logger using either the provided logger or a default standard logger
* This is the recommended pattern for functions that accept an optional logger parameter
* @param {Object|null} providedLogger - Optional logger object passed from caller
* @returns {Object} A logger object with standard logging methods
*/
export function getLoggerOrDefault(providedLogger = null) {
return providedLogger || createStandardLogger();
}

View File

@@ -14,6 +14,7 @@ import {
TASKMASTER_CONFIG_FILE,
LEGACY_CONFIG_FILE
} from '../constants/paths.js';
import { getLoggerOrDefault } from './logger-utils.js';
/**
* Find the project root directory by looking for project markers
@@ -59,7 +60,8 @@ export function findProjectRoot(startDir = process.cwd()) {
* @returns {string|null} - Resolved tasks.json path or null if not found
*/
export function findTasksPath(explicitPath = null, args = null, log = null) {
const logger = log || console;
// Use the passed logger if available, otherwise use the default logger
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it (highest priority)
if (explicitPath) {
@@ -130,7 +132,7 @@ export function findTasksPath(explicitPath = null, args = null, log = null) {
* @returns {string|null} - Resolved PRD document path or null if not found
*/
export function findPRDPath(explicitPath = null, args = null, log = null) {
const logger = log || console;
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it (highest priority)
if (explicitPath) {
@@ -199,7 +201,7 @@ export function findComplexityReportPath(
args = null,
log = null
) {
const logger = log || console;
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it (highest priority)
if (explicitPath) {
@@ -268,7 +270,7 @@ export function resolveTasksOutputPath(
args = null,
log = null
) {
const logger = log || console;
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it
if (explicitPath) {
@@ -309,7 +311,7 @@ export function resolveComplexityReportOutputPath(
args = null,
log = null
) {
const logger = log || console;
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it
if (explicitPath) {
@@ -348,7 +350,7 @@ export function resolveComplexityReportOutputPath(
* @returns {string|null} - Resolved config file path or null if not found
*/
export function findConfigPath(explicitPath = null, args = null, log = null) {
const logger = log || console;
const logger = getLoggerOrDefault(log);
// 1. If explicit path is provided, use it (highest priority)
if (explicitPath) {