Task 104: Implement 'scope-up' and 'scope-down' CLI Commands for Dynamic Task Complexity Adjustment (#1069)

* feat(task-104): Complete task 104 - Implement scope-up and scope-down CLI Commands

- Added new CLI commands 'scope-up' and 'scope-down' with comma-separated ID support
- Implemented strength levels (light/regular/heavy) and custom prompt functionality
- Created core complexity adjustment logic with AI integration
- Added MCP tool equivalents for integrated environments
- Comprehensive error handling and task validation
- Full test coverage with TDD approach
- Updated task manager core and UI components

Task 104: Implement 'scope-up' and 'scope-down' CLI Commands for Dynamic Task Complexity Adjustment - Complete implementation with CLI, MCP integration, and testing

* chore: Add changeset for scope-up and scope-down features

- Comprehensive user-facing description with usage examples
- Key features and benefits explanation
- CLI and MCP integration details
- Real-world use cases for agile workflows

* feat(extension): Add scope-up and scope-down to VS Code extension task details

- Added useScopeUpTask and useScopeDownTask hooks in useTaskQueries.ts
- Enhanced AIActionsSection with Task Complexity Adjustment section
- Added strength selection (light/regular/heavy) and custom prompt support
- Integrated scope buttons with proper loading states and error handling
- Uses existing mcpRequest handler for scope_up_task and scope_down_task tools
- Maintains consistent UI patterns with existing AI actions

Extension now supports dynamic task complexity adjustment directly from task details view.
This commit is contained in:
Eyal Toledano
2025-08-02 19:43:04 +03:00
committed by GitHub
parent 64302dc191
commit 72ca68edeb
21 changed files with 3402 additions and 553 deletions

View File

@@ -227,3 +227,119 @@ export function useUpdateSubtask() {
}
});
}
// Hook to scope up task complexity
export function useScopeUpTask() {
const { sendMessage } = useVSCodeContext();
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({
taskId,
strength = 'regular',
prompt,
options = {}
}: {
taskId: string;
strength?: 'light' | 'regular' | 'heavy';
prompt?: string;
options?: { research?: boolean };
}) => {
console.log('🔄 Scoping up task:', taskId, strength, prompt, options);
const response = await sendMessage({
type: 'mcpRequest',
tool: 'scope_up_task',
params: {
id: taskId,
strength,
prompt,
research: options.research || false
}
});
console.log('📥 Scope up task response:', response);
// Check for error in response
if (response && typeof response === 'object' && 'error' in response) {
throw new Error(response.error || 'Failed to scope up task');
}
return response;
},
onSuccess: async (data, variables) => {
console.log(
'✅ Task scope up successful, invalidating all task queries'
);
console.log('Task ID:', variables.taskId);
// Invalidate ALL task-related queries
await queryClient.invalidateQueries({
queryKey: taskKeys.all
});
console.log(
'🔄 All task queries invalidated for scoped up task:',
variables.taskId
);
}
});
}
// Hook to scope down task complexity
export function useScopeDownTask() {
const { sendMessage } = useVSCodeContext();
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({
taskId,
strength = 'regular',
prompt,
options = {}
}: {
taskId: string;
strength?: 'light' | 'regular' | 'heavy';
prompt?: string;
options?: { research?: boolean };
}) => {
console.log('🔄 Scoping down task:', taskId, strength, prompt, options);
const response = await sendMessage({
type: 'mcpRequest',
tool: 'scope_down_task',
params: {
id: taskId,
strength,
prompt,
research: options.research || false
}
});
console.log('📥 Scope down task response:', response);
// Check for error in response
if (response && typeof response === 'object' && 'error' in response) {
throw new Error(response.error || 'Failed to scope down task');
}
return response;
},
onSuccess: async (data, variables) => {
console.log(
'✅ Task scope down successful, invalidating all task queries'
);
console.log('Task ID:', variables.taskId);
// Invalidate ALL task-related queries
await queryClient.invalidateQueries({
queryKey: taskKeys.all
});
console.log(
'🔄 All task queries invalidated for scoped down task:',
variables.taskId
);
}
});
}