chore: linting and prettier

This commit is contained in:
Eyal Toledano
2025-05-22 04:17:06 -04:00
parent 5a91941913
commit 0c55ce0165
20 changed files with 2303 additions and 1785 deletions

View File

@@ -29,11 +29,11 @@ import { createLogWrapper } from '../../tools/utils.js'; // Import the new utili
*/
export async function analyzeTaskComplexityDirect(args, log, context = {}) {
const { session } = context;
const {
tasksJsonPath,
outputPath,
threshold,
research,
const {
tasksJsonPath,
outputPath,
threshold,
research,
projectRoot,
ids,
from,

View File

@@ -22,7 +22,7 @@ import {
*/
export async function moveTaskDirect(args, log, context = {}) {
const { session } = context;
// Validate required parameters
if (!args.sourceId) {
return {
@@ -52,7 +52,8 @@ export async function moveTaskDirect(args, log, context = {}) {
return {
success: false,
error: {
message: 'Project root is required if tasksJsonPath is not provided',
message:
'Project root is required if tasksJsonPath is not provided',
code: 'MISSING_PROJECT_ROOT'
}
};
@@ -64,7 +65,12 @@ export async function moveTaskDirect(args, log, context = {}) {
enableSilentMode();
// Call the core moveTask function, always generate files
const result = await moveTask(tasksPath, args.sourceId, args.destinationId, true);
const result = await moveTask(
tasksPath,
args.sourceId,
args.destinationId,
true
);
// Restore console output
disableSilentMode();
@@ -81,7 +87,7 @@ export async function moveTaskDirect(args, log, context = {}) {
disableSilentMode();
log.error(`Failed to move task: ${error.message}`);
return {
success: false,
error: {
@@ -90,4 +96,4 @@ export async function moveTaskDirect(args, log, context = {}) {
}
};
}
}
}

View File

@@ -116,7 +116,9 @@ export async function parsePRDDirect(args, log, context = {}) {
}
if (research) {
logWrapper.info('Research mode enabled. Using Perplexity AI for enhanced PRD analysis.');
logWrapper.info(
'Research mode enabled. Using Perplexity AI for enhanced PRD analysis.'
);
}
logWrapper.info(

View File

@@ -52,16 +52,16 @@ export function registerAnalyzeProjectComplexityTool(server) {
ids: z
.string()
.optional()
.describe('Comma-separated list of task IDs to analyze specifically (e.g., "1,3,5").'),
from: z
.coerce
.describe(
'Comma-separated list of task IDs to analyze specifically (e.g., "1,3,5").'
),
from: z.coerce
.number()
.int()
.positive()
.optional()
.describe('Starting task ID in a range to analyze.'),
to: z
.coerce
to: z.coerce
.number()
.int()
.positive()

View File

@@ -21,33 +21,36 @@ export function registerMoveTaskTool(server) {
name: 'move_task',
description: 'Move a task or subtask to a new position',
parameters: z.object({
from: z.string().describe(
'ID of the task/subtask to move (e.g., "5" or "5.2"). Can be comma-separated to move multiple tasks (e.g., "5,6,7")'
),
to: z.string().describe(
'ID of the destination (e.g., "7" or "7.3"). Must match the number of source IDs if comma-separated'
),
file: z
from: z
.string()
.optional()
.describe('Custom path to tasks.json file'),
.describe(
'ID of the task/subtask to move (e.g., "5" or "5.2"). Can be comma-separated to move multiple tasks (e.g., "5,6,7")'
),
to: z
.string()
.describe(
'ID of the destination (e.g., "7" or "7.3"). Must match the number of source IDs if comma-separated'
),
file: z.string().optional().describe('Custom path to tasks.json file'),
projectRoot: z
.string()
.optional()
.describe('Root directory of the project (typically derived from session)')
.describe(
'Root directory of the project (typically derived from session)'
)
}),
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
try {
// Find tasks.json path if not provided
let tasksJsonPath = args.file;
if (!tasksJsonPath) {
tasksJsonPath = findTasksJsonPath(args, log);
}
// Parse comma-separated IDs
const fromIds = args.from.split(',').map(id => id.trim());
const toIds = args.to.split(',').map(id => id.trim());
const fromIds = args.from.split(',').map((id) => id.trim());
const toIds = args.to.split(',').map((id) => id.trim());
// Validate matching IDs count
if (fromIds.length !== toIds.length) {
@@ -64,13 +67,13 @@ export function registerMoveTaskTool(server) {
for (let i = 0; i < fromIds.length; i++) {
const fromId = fromIds[i];
const toId = toIds[i];
// Skip if source and destination are the same
if (fromId === toId) {
log.info(`Skipping ${fromId} -> ${toId} (same ID)`);
continue;
}
const shouldGenerateFiles = i === fromIds.length - 1;
const result = await moveTaskDirect(
{
@@ -82,14 +85,16 @@ export function registerMoveTaskTool(server) {
log,
{ session }
);
if (!result.success) {
log.error(`Failed to move ${fromId} to ${toId}: ${result.error.message}`);
log.error(
`Failed to move ${fromId} to ${toId}: ${result.error.message}`
);
} else {
results.push(result.data);
}
}
return {
success: true,
data: {
@@ -121,4 +126,4 @@ export function registerMoveTaskTool(server) {
}
})
});
}
}

View File

@@ -53,7 +53,9 @@ export function registerParsePRDTool(server) {
.boolean()
.optional()
.default(false)
.describe('Use the research model for research-backed task generation, providing more comprehensive, accurate and up-to-date task details.'),
.describe(
'Use the research model for research-backed task generation, providing more comprehensive, accurate and up-to-date task details.'
),
projectRoot: z
.string()
.describe('The directory of the project. Must be an absolute path.')