fix: improve error handling, test options, and model configuration

- Enhance error validation in parse-prd.js and update-tasks.js
- Fix bug where mcpLog was incorrectly passed as logWrapper
- Improve error messages and response formatting
- Add --skip-verification flag to E2E tests
- Update MCP server config that ships with init to match new API key structure
- Fix task force/append handling in parse-prd command
- Increase column width in update-tasks display
This commit is contained in:
Eyal Toledano
2025-05-02 23:11:39 -04:00
parent 2e17437da3
commit 25ca1a45a0
8 changed files with 248 additions and 195 deletions

View File

@@ -34,18 +34,17 @@ export async function parsePRDDirect(args, log, context = {}) {
projectRoot
} = args;
// Create the standard logger wrapper
const logWrapper = createLogWrapper(log);
// --- Input Validation and Path Resolution ---
if (!projectRoot || !path.isAbsolute(projectRoot)) {
logWrapper.error(
'parsePRDDirect requires an absolute projectRoot argument.'
);
if (!projectRoot) {
logWrapper.error('parsePRDDirect requires a projectRoot argument.');
return {
success: false,
error: {
code: 'MISSING_ARGUMENT',
message: 'projectRoot is required and must be absolute.'
message: 'projectRoot is required.'
}
};
}
@@ -57,7 +56,7 @@ export async function parsePRDDirect(args, log, context = {}) {
};
}
// Resolve input and output paths relative to projectRoot if they aren't absolute
// Resolve input and output paths relative to projectRoot
const inputPath = path.resolve(projectRoot, inputArg);
const outputPath = outputArg
? path.resolve(projectRoot, outputArg)
@@ -101,7 +100,7 @@ export async function parsePRDDirect(args, log, context = {}) {
// Ensure positive number
numTasks = getDefaultNumTasks(projectRoot); // Fallback to default if parsing fails or invalid
logWrapper.warn(
`Invalid numTasks value: ${numTasksArg}. Using default: 10`
`Invalid numTasks value: ${numTasksArg}. Using default: ${numTasks}`
);
}
}
@@ -132,7 +131,7 @@ export async function parsePRDDirect(args, log, context = {}) {
inputPath,
outputPath,
numTasks,
{ session, mcpLog: logWrapper, projectRoot, useForce, useAppend },
{ session, mcpLog, projectRoot, useForce, useAppend },
'json'
);
@@ -147,7 +146,6 @@ export async function parsePRDDirect(args, log, context = {}) {
message: `Successfully parsed PRD and generated ${result.tasks.length} tasks.`,
outputPath: outputPath,
taskCount: result.tasks.length
// Optionally include tasks if needed by client: tasks: result.tasks
}
};
} else {