- Added agent-teams-controller as a dependency and updated the bundling configuration to exclude it. - Refactored task management functions to utilize the new taskStore, improving code organization and maintainability. - Introduced new methods for handling task states, including soft deletion and restoration. - Enhanced kanban functionality with improved reviewer management and task column updates. - Updated tests to reflect changes in task creation and approval processes, ensuring robust coverage. - Improved task ID handling and display logic for better user experience across components.
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
const kanbanStore = require('./kanbanStore.js');
|
|
const tasks = require('./tasks.js');
|
|
|
|
function getKanbanState(context) {
|
|
return kanbanStore.readKanbanState(context.paths, context.teamName);
|
|
}
|
|
|
|
function setKanbanColumn(context, taskId, column) {
|
|
const canonicalTaskId = tasks.resolveTaskId(context, taskId);
|
|
kanbanStore.setKanbanColumn(context.paths, context.teamName, canonicalTaskId, String(column));
|
|
return getKanbanState(context);
|
|
}
|
|
|
|
function clearKanban(context, taskId) {
|
|
const canonicalTaskId = tasks.resolveTaskId(context, taskId);
|
|
kanbanStore.clearKanban(context.paths, context.teamName, canonicalTaskId);
|
|
return getKanbanState(context);
|
|
}
|
|
|
|
function listReviewers(context) {
|
|
return getKanbanState(context).reviewers;
|
|
}
|
|
|
|
function addReviewer(context, reviewer) {
|
|
const state = getKanbanState(context);
|
|
const next = new Set(state.reviewers);
|
|
next.add(String(reviewer));
|
|
kanbanStore.writeKanbanState(context.paths, context.teamName, {
|
|
...state,
|
|
reviewers: [...next],
|
|
});
|
|
return listReviewers(context);
|
|
}
|
|
|
|
function removeReviewer(context, reviewer) {
|
|
const state = getKanbanState(context);
|
|
const next = state.reviewers.filter((entry) => entry !== reviewer);
|
|
kanbanStore.writeKanbanState(context.paths, context.teamName, {
|
|
...state,
|
|
reviewers: next,
|
|
});
|
|
return listReviewers(context);
|
|
}
|
|
|
|
function updateColumnOrder(context, columnId, orderedTaskIds) {
|
|
const canonicalIds = orderedTaskIds.map((taskId) => tasks.resolveTaskId(context, taskId));
|
|
return kanbanStore.updateColumnOrder(context.paths, context.teamName, columnId, canonicalIds);
|
|
}
|
|
|
|
module.exports = {
|
|
getKanbanState,
|
|
setKanbanColumn,
|
|
clearKanban,
|
|
listReviewers,
|
|
addReviewer,
|
|
removeReviewer,
|
|
updateColumnOrder,
|
|
};
|