@wrongstack/tools 0.282.0 → 0.282.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin.d.ts +4 -4
- package/dist/builtin.js +508 -257
- package/dist/builtin.js.map +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +508 -257
- package/dist/index.js.map +1 -1
- package/dist/pack.js +508 -257
- package/dist/pack.js.map +1 -1
- package/package.json +2 -2
package/dist/builtin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn, execFileSync } from 'node:child_process';
|
|
2
2
|
import * as Core from '@wrongstack/core';
|
|
3
|
-
import { buildChildEnv, getDesignKitLoader, isDesignStack, loadActiveKit, applyTokenOverrides, setActiveKit, recordKitChoice, recordOverrides, setDesignOverrides, materializeTokens, runDesignVerify, ToolValidationError, detectNewlineStyle, normalizeToLf, toStyle, atomicWrite, unifiedDiff, ToolError, FetchError, isPrivateIPv4, isPrivateIPv6, assessCommitSafety, compileGlob, expectDefined, recordPackageAction, detectPackageEcosystem, deepMerge, addLinkToTask, addNoteToTask, updateCheckOnTask, addCheckToTask, addDependency, updateTaskAssignment, assignTask, removeTask, moveTask, updateTask, getTask, transferTaskToBoard, copyTaskToBoard, addTask, removeColumn, updateColumn, addColumn, searchKanban, exportBoardAsMarkdown, generateBoardFromDescription, createBoard, parseLinesIntoTasks, getBoard, removeBoard, duplicateBoard, updateBoard, listBoards, mutatePlan, clearPlan, getPlanTemplate, addPlanItem, deriveTodosFromPlanItem, removePlanItem, setPlanItemStatus, mutateTasks, formatTaskList, formatPlan, FsError, toErrorMessage as toErrorMessage$2, computeTaskItemProgress, loadPlan, savePlan, loadTasks, saveTasks, wstackGlobalRoot, resolveWstackPaths, truncate } from '@wrongstack/core';
|
|
3
|
+
import { buildChildEnv, getDesignKitLoader, isDesignStack, loadActiveKit, applyTokenOverrides, setActiveKit, recordKitChoice, recordOverrides, setDesignOverrides, materializeTokens, runDesignVerify, ToolValidationError, detectNewlineStyle, normalizeToLf, toStyle, atomicWrite, unifiedDiff, ToolError, FetchError, isPrivateIPv4, isPrivateIPv6, assessCommitSafety, compileGlob, expectDefined, recordPackageAction, detectPackageEcosystem, deepMerge, addLinkToTask, addNoteToTask, updateCheckOnTask, addCheckToTask, updateGoalMetricOnTask, addGoalMetricToTask, addDependency, updateTaskAssignment, assignTask, releaseTaskClaim, claimReadyTask, getTaskChain, setTaskChain, removeTask, moveTask, updateTask, getTask, transferTaskToBoard, copyTaskToBoard, mergeTasks, splitTask, addTask, removeColumn, updateColumn, addColumn, getKanbanOrchestrationSnapshot, listReadyTasks, searchKanban, deserializeTaskGraph, syncBoardFromTaskGraph, exportBoardToTaskGraph, serializeTaskGraph, exportBoardAsMarkdown, generateBoardFromDescription, createBoard, parseLinesIntoTasks, getBoard, removeBoard, duplicateBoard, updateBoard, listBoards, mutatePlan, clearPlan, getPlanTemplate, addPlanItem, deriveTodosFromPlanItem, removePlanItem, setPlanItemStatus, mutateTasks, formatTaskList, formatPlan, FsError, toErrorMessage as toErrorMessage$2, computeTaskItemProgress, loadPlan, savePlan, loadTasks, saveTasks, wstackGlobalRoot, resolveWstackPaths, truncate } from '@wrongstack/core';
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import { statSync, mkdirSync, createWriteStream } from 'node:fs';
|
|
6
6
|
import * as fs2 from 'node:fs/promises';
|
|
@@ -9286,8 +9286,8 @@ function toYaml(data, indent = 0) {
|
|
|
9286
9286
|
var kanbanTool = {
|
|
9287
9287
|
name: "kanban",
|
|
9288
9288
|
category: "Project",
|
|
9289
|
-
description: "Manage project-scoped multi-kanban boards stored under .wrongstack/kanbans. Supports board/task/column CRUD,
|
|
9290
|
-
usageHint: "Use this for durable project kanban state.
|
|
9289
|
+
description: "Manage project-scoped multi-kanban boards stored under .wrongstack/kanbans. Supports board/task/column CRUD, ready-task queues, dependency chains, split/merge, assignment metadata, provider/model/fallback routing hints, goal metrics, success checks, notes, links, and run status updates.",
|
|
9290
|
+
usageHint: "Use this for durable project kanban state. Agents should call snapshot/ready_tasks, then claim_task before working. Use set_chain for ordered work, split_task/merge_tasks when task scope changes, assign_task with provider/model/fallback hints before spawning, mark_assignment when starting or finishing, and release_task if the claim cannot be worked.",
|
|
9291
9291
|
permission: "confirm",
|
|
9292
9292
|
mutating: true,
|
|
9293
9293
|
capabilities: ["fs.write"],
|
|
@@ -9307,20 +9307,32 @@ var kanbanTool = {
|
|
|
9307
9307
|
"delete_board",
|
|
9308
9308
|
"generate_board",
|
|
9309
9309
|
"export_markdown",
|
|
9310
|
+
"export_task_graph",
|
|
9311
|
+
"sync_task_graph",
|
|
9310
9312
|
"search_tasks",
|
|
9313
|
+
"ready_tasks",
|
|
9314
|
+
"snapshot",
|
|
9311
9315
|
"add_column",
|
|
9312
9316
|
"update_column",
|
|
9313
9317
|
"delete_column",
|
|
9314
9318
|
"add_task",
|
|
9319
|
+
"split_task",
|
|
9320
|
+
"merge_tasks",
|
|
9315
9321
|
"copy_task",
|
|
9316
9322
|
"transfer_task",
|
|
9317
9323
|
"get_task",
|
|
9318
9324
|
"update_task",
|
|
9319
9325
|
"move_task",
|
|
9320
9326
|
"delete_task",
|
|
9327
|
+
"set_chain",
|
|
9328
|
+
"get_chain",
|
|
9329
|
+
"claim_task",
|
|
9330
|
+
"release_task",
|
|
9321
9331
|
"assign_task",
|
|
9322
9332
|
"mark_assignment",
|
|
9323
9333
|
"add_dependency",
|
|
9334
|
+
"add_goal_metric",
|
|
9335
|
+
"update_goal_metric",
|
|
9324
9336
|
"add_check",
|
|
9325
9337
|
"update_check",
|
|
9326
9338
|
"add_note",
|
|
@@ -9329,6 +9341,8 @@ var kanbanTool = {
|
|
|
9329
9341
|
},
|
|
9330
9342
|
boardId: { type: "string" },
|
|
9331
9343
|
taskId: { type: "string" },
|
|
9344
|
+
taskIds: { type: "array", items: { type: "string" } },
|
|
9345
|
+
chainId: { type: "string" },
|
|
9332
9346
|
columnId: { type: "string" },
|
|
9333
9347
|
targetBoardId: { type: "string" },
|
|
9334
9348
|
targetColumnId: { type: "string" },
|
|
@@ -9352,6 +9366,7 @@ var kanbanTool = {
|
|
|
9352
9366
|
},
|
|
9353
9367
|
order: { type: "number" },
|
|
9354
9368
|
query: { type: "string" },
|
|
9369
|
+
limit: { type: "number" },
|
|
9355
9370
|
agentId: { type: "string" },
|
|
9356
9371
|
name: { type: "string" },
|
|
9357
9372
|
role: { type: "string" },
|
|
@@ -9369,7 +9384,36 @@ var kanbanTool = {
|
|
|
9369
9384
|
type: "string",
|
|
9370
9385
|
enum: ["assigned", "queued", "running", "completed", "failed", "cancelled"]
|
|
9371
9386
|
},
|
|
9387
|
+
releaseStatus: { type: "string", enum: ["pending", "ready", "blocked"] },
|
|
9388
|
+
releaseReason: { type: "string" },
|
|
9389
|
+
clearAssignee: { type: "boolean" },
|
|
9390
|
+
taskGraph: { type: "object" },
|
|
9391
|
+
graphId: { type: "string" },
|
|
9392
|
+
specId: { type: "string" },
|
|
9393
|
+
sourceSystem: { type: "string" },
|
|
9394
|
+
phaseId: { type: "string" },
|
|
9395
|
+
preserveOriginTaskIds: { type: "boolean" },
|
|
9396
|
+
includeArchived: { type: "boolean" },
|
|
9397
|
+
archiveMissingTasks: { type: "boolean" },
|
|
9398
|
+
preserveManualDependencies: { type: "boolean" },
|
|
9372
9399
|
dependencyTaskId: { type: "string" },
|
|
9400
|
+
enforceDependencies: { type: "boolean" },
|
|
9401
|
+
childTitles: { type: "array", items: { type: "string" } },
|
|
9402
|
+
inheritAssignment: { type: "boolean" },
|
|
9403
|
+
inheritLabels: { type: "boolean" },
|
|
9404
|
+
inheritSuccessCriteria: { type: "boolean" },
|
|
9405
|
+
inheritGoalMetrics: { type: "boolean" },
|
|
9406
|
+
inheritDependencies: { type: "boolean" },
|
|
9407
|
+
chainChildren: { type: "boolean" },
|
|
9408
|
+
rewireDependents: { type: "boolean" },
|
|
9409
|
+
closeSourceTasks: { type: "boolean" },
|
|
9410
|
+
metricId: { type: "string" },
|
|
9411
|
+
metricName: { type: "string" },
|
|
9412
|
+
metricTarget: { oneOf: [{ type: "string" }, { type: "number" }] },
|
|
9413
|
+
metricCurrent: { oneOf: [{ type: "string" }, { type: "number" }] },
|
|
9414
|
+
metricUnit: { type: "string" },
|
|
9415
|
+
metricStatus: { type: "string", enum: ["pending", "met", "missed", "waived"] },
|
|
9416
|
+
metricNotes: { type: "string" },
|
|
9373
9417
|
checkId: { type: "string" },
|
|
9374
9418
|
checkDescription: { type: "string" },
|
|
9375
9419
|
checkStatus: { type: "string", enum: ["pending", "passed", "failed", "skipped"] },
|
|
@@ -9395,270 +9439,470 @@ var kanbanTool = {
|
|
|
9395
9439
|
async execute(input, ctx) {
|
|
9396
9440
|
const projectRoot = ctx.projectRoot;
|
|
9397
9441
|
if (!projectRoot) return fail("No project root is available.");
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
case "get_board": {
|
|
9404
|
-
const board = await requireBoard(projectRoot, input.boardId);
|
|
9405
|
-
return board ? okBoard(board) : fail("Board not found.");
|
|
9406
|
-
}
|
|
9407
|
-
case "create_board": {
|
|
9408
|
-
if (!input.title) return fail("create_board requires title.");
|
|
9409
|
-
const board = await createBoard(projectRoot, {
|
|
9410
|
-
title: input.title,
|
|
9411
|
-
...input.description !== void 0 ? { description: input.description } : {},
|
|
9412
|
-
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
9413
|
-
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {}
|
|
9414
|
-
});
|
|
9415
|
-
return { ok: true, message: `Board created: ${board.title}`, board };
|
|
9416
|
-
}
|
|
9417
|
-
case "update_board": {
|
|
9418
|
-
if (!input.boardId) return fail("update_board requires boardId.");
|
|
9419
|
-
const board = await updateBoard(projectRoot, input.boardId, {
|
|
9420
|
-
...input.title !== void 0 ? { title: input.title } : {},
|
|
9421
|
-
...input.description !== void 0 ? { description: input.description } : {},
|
|
9422
|
-
...input.tags !== void 0 ? { tags: input.tags } : {}
|
|
9423
|
-
});
|
|
9424
|
-
return board ? okBoard(board, "Board updated.") : fail("Board not found.");
|
|
9425
|
-
}
|
|
9426
|
-
case "duplicate_board": {
|
|
9427
|
-
if (!input.boardId) return fail("duplicate_board requires boardId.");
|
|
9428
|
-
const board = await duplicateBoard(projectRoot, input.boardId, {
|
|
9429
|
-
...input.title !== void 0 ? { title: input.title } : {},
|
|
9430
|
-
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
9431
|
-
...input.includeTasks !== void 0 ? { includeTasks: input.includeTasks } : {},
|
|
9432
|
-
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {},
|
|
9433
|
-
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {}
|
|
9434
|
-
});
|
|
9435
|
-
return board ? okBoard(board, "Board duplicated.") : fail("Board not found.");
|
|
9436
|
-
}
|
|
9437
|
-
case "delete_board": {
|
|
9438
|
-
if (!input.boardId) return fail("delete_board requires boardId.");
|
|
9439
|
-
const removed = await removeBoard(projectRoot, input.boardId);
|
|
9440
|
-
return { ok: removed, message: removed ? "Board deleted." : "Board not found." };
|
|
9441
|
-
}
|
|
9442
|
-
case "generate_board": {
|
|
9443
|
-
if (!input.description) return fail("generate_board requires description.");
|
|
9444
|
-
const boardInput = generateBoardFromDescription({
|
|
9445
|
-
description: input.description,
|
|
9446
|
-
...input.title !== void 0 ? { title: input.title } : {},
|
|
9447
|
-
...input.context !== void 0 ? { context: input.context } : {},
|
|
9448
|
-
...input.columns !== void 0 ? { columns: input.columns } : {}
|
|
9449
|
-
});
|
|
9450
|
-
const board = await createBoard(projectRoot, boardInput);
|
|
9451
|
-
for (const taskInput2 of parseLinesIntoTasks(
|
|
9452
|
-
input.description,
|
|
9453
|
-
board.columns[0]?.id ?? "backlog"
|
|
9454
|
-
)) {
|
|
9455
|
-
await addTask(projectRoot, board.id, taskInput2);
|
|
9442
|
+
try {
|
|
9443
|
+
switch (input.action) {
|
|
9444
|
+
case "list_boards": {
|
|
9445
|
+
const boards = await listBoards(projectRoot);
|
|
9446
|
+
return { ok: true, message: `${boards.length} board(s).`, boards };
|
|
9456
9447
|
}
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
const board = await requireBoard(projectRoot, input.boardId);
|
|
9461
|
-
if (!board) return fail("Board not found.");
|
|
9462
|
-
return {
|
|
9463
|
-
ok: true,
|
|
9464
|
-
message: "Board exported.",
|
|
9465
|
-
board,
|
|
9466
|
-
markdown: exportBoardAsMarkdown(board)
|
|
9467
|
-
};
|
|
9468
|
-
}
|
|
9469
|
-
case "search_tasks": {
|
|
9470
|
-
const tasks = await searchKanban(projectRoot, {
|
|
9471
|
-
query: input.query,
|
|
9472
|
-
boardId: input.boardId,
|
|
9473
|
-
assignedAgent: input.agentId,
|
|
9474
|
-
status: input.status,
|
|
9475
|
-
priority: input.priority,
|
|
9476
|
-
label: input.labels?.[0]
|
|
9477
|
-
});
|
|
9478
|
-
return { ok: true, message: `${tasks.length} task(s) matched.`, tasks };
|
|
9479
|
-
}
|
|
9480
|
-
case "add_column": {
|
|
9481
|
-
if (!input.boardId || !input.title) return fail("add_column requires boardId and title.");
|
|
9482
|
-
const result = await addColumn(projectRoot, input.boardId, {
|
|
9483
|
-
title: input.title,
|
|
9484
|
-
...input.description !== void 0 ? { description: input.description } : {}
|
|
9485
|
-
});
|
|
9486
|
-
return result ? okBoard(result.board, "Column added.") : fail("Board not found.");
|
|
9487
|
-
}
|
|
9488
|
-
case "update_column": {
|
|
9489
|
-
if (!input.boardId || !input.columnId)
|
|
9490
|
-
return fail("update_column requires boardId and columnId.");
|
|
9491
|
-
const board = await updateColumn(projectRoot, input.boardId, input.columnId, {
|
|
9492
|
-
...input.title !== void 0 ? { title: input.title } : {},
|
|
9493
|
-
...input.description !== void 0 ? { description: input.description } : {},
|
|
9494
|
-
...input.order !== void 0 ? { order: input.order } : {}
|
|
9495
|
-
});
|
|
9496
|
-
return board ? okBoard(board, "Column updated.") : fail("Column not found.");
|
|
9497
|
-
}
|
|
9498
|
-
case "delete_column": {
|
|
9499
|
-
if (!input.boardId || !input.columnId)
|
|
9500
|
-
return fail("delete_column requires boardId and columnId.");
|
|
9501
|
-
const board = await removeColumn(projectRoot, input.boardId, input.columnId, {
|
|
9502
|
-
moveTasksToColumnId: input.moveTasksToColumnId
|
|
9503
|
-
});
|
|
9504
|
-
return board ? okBoard(board, "Column deleted.") : fail("Column not found.");
|
|
9505
|
-
}
|
|
9506
|
-
case "add_task": {
|
|
9507
|
-
if (!input.boardId || !input.title) return fail("add_task requires boardId and title.");
|
|
9508
|
-
const result = await addTask(projectRoot, input.boardId, taskInput(input));
|
|
9509
|
-
return result ? okTask(result.board, result.task, "Task added.") : fail("Board not found.");
|
|
9510
|
-
}
|
|
9511
|
-
case "copy_task": {
|
|
9512
|
-
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
9513
|
-
return fail("copy_task requires boardId, taskId, and targetBoardId.");
|
|
9448
|
+
case "get_board": {
|
|
9449
|
+
const board = await requireBoard(projectRoot, input.boardId);
|
|
9450
|
+
return board ? okBoard(board) : fail("Board not found.");
|
|
9514
9451
|
}
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
...input.
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9452
|
+
case "create_board": {
|
|
9453
|
+
if (!input.title) return fail("create_board requires title.");
|
|
9454
|
+
const board = await createBoard(projectRoot, {
|
|
9455
|
+
title: input.title,
|
|
9456
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
9457
|
+
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
9458
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {}
|
|
9459
|
+
});
|
|
9460
|
+
return { ok: true, message: `Board created: ${board.title}`, board };
|
|
9461
|
+
}
|
|
9462
|
+
case "update_board": {
|
|
9463
|
+
if (!input.boardId) return fail("update_board requires boardId.");
|
|
9464
|
+
const board = await updateBoard(projectRoot, input.boardId, {
|
|
9465
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9466
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
9467
|
+
...input.tags !== void 0 ? { tags: input.tags } : {}
|
|
9468
|
+
});
|
|
9469
|
+
return board ? okBoard(board, "Board updated.") : fail("Board not found.");
|
|
9470
|
+
}
|
|
9471
|
+
case "duplicate_board": {
|
|
9472
|
+
if (!input.boardId) return fail("duplicate_board requires boardId.");
|
|
9473
|
+
const board = await duplicateBoard(projectRoot, input.boardId, {
|
|
9474
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9475
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
9476
|
+
...input.includeTasks !== void 0 ? { includeTasks: input.includeTasks } : {},
|
|
9477
|
+
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {},
|
|
9478
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {}
|
|
9479
|
+
});
|
|
9480
|
+
return board ? okBoard(board, "Board duplicated.") : fail("Board not found.");
|
|
9481
|
+
}
|
|
9482
|
+
case "delete_board": {
|
|
9483
|
+
if (!input.boardId) return fail("delete_board requires boardId.");
|
|
9484
|
+
const removed = await removeBoard(projectRoot, input.boardId);
|
|
9485
|
+
return { ok: removed, message: removed ? "Board deleted." : "Board not found." };
|
|
9486
|
+
}
|
|
9487
|
+
case "generate_board": {
|
|
9488
|
+
if (!input.description) return fail("generate_board requires description.");
|
|
9489
|
+
const boardInput = generateBoardFromDescription({
|
|
9490
|
+
description: input.description,
|
|
9491
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9492
|
+
...input.context !== void 0 ? { context: input.context } : {},
|
|
9493
|
+
...input.columns !== void 0 ? { columns: input.columns } : {}
|
|
9494
|
+
});
|
|
9495
|
+
const board = await createBoard(projectRoot, boardInput);
|
|
9496
|
+
for (const taskInput2 of parseLinesIntoTasks(
|
|
9497
|
+
input.description,
|
|
9498
|
+
board.columns[0]?.id ?? "backlog"
|
|
9499
|
+
)) {
|
|
9500
|
+
await addTask(projectRoot, board.id, taskInput2);
|
|
9525
9501
|
}
|
|
9526
|
-
|
|
9527
|
-
return result ? okTask(result.targetBoard, result.task, "Task copied to target board.") : fail("Board or task not found.");
|
|
9528
|
-
}
|
|
9529
|
-
case "transfer_task": {
|
|
9530
|
-
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
9531
|
-
return fail("transfer_task requires boardId, taskId, and targetBoardId.");
|
|
9502
|
+
return okBoard(await getBoard(projectRoot, board.id) ?? board, "Board generated.");
|
|
9532
9503
|
}
|
|
9533
|
-
|
|
9534
|
-
projectRoot,
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9504
|
+
case "export_markdown": {
|
|
9505
|
+
const board = await requireBoard(projectRoot, input.boardId);
|
|
9506
|
+
if (!board) return fail("Board not found.");
|
|
9507
|
+
return {
|
|
9508
|
+
ok: true,
|
|
9509
|
+
message: "Board exported.",
|
|
9510
|
+
board,
|
|
9511
|
+
markdown: exportBoardAsMarkdown(board)
|
|
9512
|
+
};
|
|
9513
|
+
}
|
|
9514
|
+
case "export_task_graph": {
|
|
9515
|
+
if (!input.boardId) return fail("export_task_graph requires boardId.");
|
|
9516
|
+
const exported = await exportBoardToTaskGraph(projectRoot, input.boardId, {
|
|
9517
|
+
...input.graphId !== void 0 ? { graphId: input.graphId } : {},
|
|
9518
|
+
...input.specId !== void 0 ? { specId: input.specId } : {},
|
|
9519
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9520
|
+
...input.preserveOriginTaskIds !== void 0 ? { preserveOriginTaskIds: input.preserveOriginTaskIds } : {},
|
|
9521
|
+
...input.includeArchived !== void 0 ? { includeArchived: input.includeArchived } : {}
|
|
9522
|
+
});
|
|
9523
|
+
if (!exported) return fail("Board not found.");
|
|
9524
|
+
return {
|
|
9525
|
+
ok: true,
|
|
9526
|
+
message: `Task graph exported with ${exported.graph.nodes.size} node(s).`,
|
|
9527
|
+
board: exported.board,
|
|
9528
|
+
taskGraph: serializeTaskGraph(exported.graph)
|
|
9529
|
+
};
|
|
9530
|
+
}
|
|
9531
|
+
case "sync_task_graph": {
|
|
9532
|
+
if (!input.boardId || !input.taskGraph) {
|
|
9533
|
+
return fail("sync_task_graph requires boardId and taskGraph.");
|
|
9534
|
+
}
|
|
9535
|
+
const graph = deserializeTaskGraph(input.taskGraph);
|
|
9536
|
+
const result = await syncBoardFromTaskGraph(projectRoot, input.boardId, graph, {
|
|
9537
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9538
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
9539
|
+
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
9540
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
9541
|
+
...input.sourceSystem !== void 0 ? { sourceSystem: input.sourceSystem } : {},
|
|
9542
|
+
...input.phaseId !== void 0 ? { phaseId: input.phaseId } : {},
|
|
9543
|
+
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {},
|
|
9544
|
+
...input.archiveMissingTasks !== void 0 ? { archiveMissingTasks: input.archiveMissingTasks } : {},
|
|
9545
|
+
...input.preserveManualDependencies !== void 0 ? { preserveManualDependencies: input.preserveManualDependencies } : {}
|
|
9546
|
+
});
|
|
9547
|
+
return result ? {
|
|
9548
|
+
ok: true,
|
|
9549
|
+
message: `Task graph synced: ${result.createdTaskIds.length} created, ${result.updatedTaskIds.length} updated, ${result.archivedTaskIds.length} archived.`,
|
|
9550
|
+
board: result.board
|
|
9551
|
+
} : fail("Board not found.");
|
|
9552
|
+
}
|
|
9553
|
+
case "search_tasks": {
|
|
9554
|
+
const tasks = await searchKanban(projectRoot, {
|
|
9555
|
+
query: input.query,
|
|
9556
|
+
boardId: input.boardId,
|
|
9557
|
+
assignedAgent: input.agentId,
|
|
9558
|
+
status: input.status,
|
|
9559
|
+
priority: input.priority,
|
|
9560
|
+
label: input.labels?.[0],
|
|
9561
|
+
chainId: input.chainId
|
|
9562
|
+
});
|
|
9563
|
+
return { ok: true, message: `${tasks.length} task(s) matched.`, tasks };
|
|
9564
|
+
}
|
|
9565
|
+
case "ready_tasks": {
|
|
9566
|
+
const tasks = await listReadyTasks(projectRoot, {
|
|
9567
|
+
query: input.query,
|
|
9568
|
+
boardId: input.boardId,
|
|
9569
|
+
assignedAgent: input.agentId,
|
|
9570
|
+
priority: input.priority,
|
|
9571
|
+
label: input.labels?.[0],
|
|
9572
|
+
chainId: input.chainId,
|
|
9573
|
+
limit: input.limit
|
|
9574
|
+
});
|
|
9575
|
+
return { ok: true, message: `${tasks.length} ready task(s).`, tasks };
|
|
9576
|
+
}
|
|
9577
|
+
case "snapshot": {
|
|
9578
|
+
const snapshot = await getKanbanOrchestrationSnapshot(projectRoot, {
|
|
9579
|
+
query: input.query,
|
|
9580
|
+
boardId: input.boardId,
|
|
9581
|
+
assignedAgent: input.agentId,
|
|
9582
|
+
status: input.status,
|
|
9583
|
+
priority: input.priority,
|
|
9584
|
+
label: input.labels?.[0],
|
|
9585
|
+
chainId: input.chainId
|
|
9586
|
+
});
|
|
9587
|
+
return {
|
|
9588
|
+
ok: true,
|
|
9589
|
+
message: `${snapshot.ready.length} ready, ${snapshot.running.length} running, ${snapshot.blocked.length} blocked.`,
|
|
9590
|
+
snapshot
|
|
9591
|
+
};
|
|
9592
|
+
}
|
|
9593
|
+
case "add_column": {
|
|
9594
|
+
if (!input.boardId || !input.title) return fail("add_column requires boardId and title.");
|
|
9595
|
+
const result = await addColumn(projectRoot, input.boardId, {
|
|
9596
|
+
title: input.title,
|
|
9597
|
+
...input.description !== void 0 ? { description: input.description } : {}
|
|
9598
|
+
});
|
|
9599
|
+
return result ? okBoard(result.board, "Column added.") : fail("Board not found.");
|
|
9600
|
+
}
|
|
9601
|
+
case "update_column": {
|
|
9602
|
+
if (!input.boardId || !input.columnId)
|
|
9603
|
+
return fail("update_column requires boardId and columnId.");
|
|
9604
|
+
const board = await updateColumn(projectRoot, input.boardId, input.columnId, {
|
|
9605
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
9606
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
9607
|
+
...input.order !== void 0 ? { order: input.order } : {}
|
|
9608
|
+
});
|
|
9609
|
+
return board ? okBoard(board, "Column updated.") : fail("Column not found.");
|
|
9610
|
+
}
|
|
9611
|
+
case "delete_column": {
|
|
9612
|
+
if (!input.boardId || !input.columnId)
|
|
9613
|
+
return fail("delete_column requires boardId and columnId.");
|
|
9614
|
+
const board = await removeColumn(projectRoot, input.boardId, input.columnId, {
|
|
9615
|
+
moveTasksToColumnId: input.moveTasksToColumnId
|
|
9616
|
+
});
|
|
9617
|
+
return board ? okBoard(board, "Column deleted.") : fail("Column not found.");
|
|
9618
|
+
}
|
|
9619
|
+
case "add_task": {
|
|
9620
|
+
if (!input.boardId || !input.title) return fail("add_task requires boardId and title.");
|
|
9621
|
+
const result = await addTask(projectRoot, input.boardId, taskInput(input));
|
|
9622
|
+
return result ? okTask(result.board, result.task, "Task added.") : fail("Board not found.");
|
|
9623
|
+
}
|
|
9624
|
+
case "split_task": {
|
|
9625
|
+
if (!input.boardId || !input.taskId || !input.childTitles?.length) {
|
|
9626
|
+
return fail("split_task requires boardId, taskId, and childTitles.");
|
|
9627
|
+
}
|
|
9628
|
+
const result = await splitTask(projectRoot, input.boardId, input.taskId, {
|
|
9629
|
+
titles: input.childTitles,
|
|
9630
|
+
...input.targetColumnId !== void 0 ? { columnId: input.targetColumnId } : {},
|
|
9631
|
+
...input.inheritAssignment !== void 0 ? { inheritAssignment: input.inheritAssignment } : {},
|
|
9632
|
+
...input.inheritLabels !== void 0 ? { inheritLabels: input.inheritLabels } : {},
|
|
9633
|
+
...input.inheritSuccessCriteria !== void 0 ? { inheritSuccessCriteria: input.inheritSuccessCriteria } : {},
|
|
9634
|
+
...input.inheritGoalMetrics !== void 0 ? { inheritGoalMetrics: input.inheritGoalMetrics } : {},
|
|
9635
|
+
...input.inheritDependencies !== void 0 ? { inheritDependencies: input.inheritDependencies } : {},
|
|
9636
|
+
...input.chainChildren !== void 0 ? { chainChildren: input.chainChildren } : {},
|
|
9637
|
+
...input.rewireDependents !== void 0 ? { rewireDependents: input.rewireDependents } : {}
|
|
9638
|
+
});
|
|
9639
|
+
return result ? {
|
|
9640
|
+
ok: true,
|
|
9641
|
+
message: `${result.children.length} child task(s) created.`,
|
|
9642
|
+
board: result.board,
|
|
9643
|
+
task: result.parent,
|
|
9644
|
+
children: result.children
|
|
9645
|
+
} : fail("Task not found.");
|
|
9646
|
+
}
|
|
9647
|
+
case "merge_tasks": {
|
|
9648
|
+
if (!input.boardId || !input.taskIds?.length || !input.title) {
|
|
9649
|
+
return fail("merge_tasks requires boardId, taskIds, and title.");
|
|
9650
|
+
}
|
|
9651
|
+
const result = await mergeTasks(projectRoot, input.boardId, {
|
|
9652
|
+
taskIds: input.taskIds,
|
|
9653
|
+
title: input.title,
|
|
9654
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
9539
9655
|
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
9540
|
-
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
9541
9656
|
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
9542
|
-
...input.
|
|
9657
|
+
...input.closeSourceTasks !== void 0 ? { closeSourceTasks: input.closeSourceTasks } : {}
|
|
9658
|
+
});
|
|
9659
|
+
return result ? okTask(result.board, result.task, "Tasks merged.") : fail("Board or task not found.");
|
|
9660
|
+
}
|
|
9661
|
+
case "copy_task": {
|
|
9662
|
+
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
9663
|
+
return fail("copy_task requires boardId, taskId, and targetBoardId.");
|
|
9543
9664
|
}
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
}
|
|
9558
|
-
case "move_task": {
|
|
9559
|
-
if (!input.boardId || !input.taskId || !input.targetColumnId) {
|
|
9560
|
-
return fail("move_task requires boardId, taskId, and targetColumnId.");
|
|
9665
|
+
const result = await copyTaskToBoard(
|
|
9666
|
+
projectRoot,
|
|
9667
|
+
input.boardId,
|
|
9668
|
+
input.taskId,
|
|
9669
|
+
input.targetBoardId,
|
|
9670
|
+
{
|
|
9671
|
+
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
9672
|
+
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
9673
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
9674
|
+
...input.preserveDependencies !== void 0 ? { preserveDependencies: input.preserveDependencies } : {}
|
|
9675
|
+
}
|
|
9676
|
+
);
|
|
9677
|
+
return result ? okTask(result.targetBoard, result.task, "Task copied to target board.") : fail("Board or task not found.");
|
|
9561
9678
|
}
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
return fail("assign_task requires boardId and taskId.");
|
|
9580
|
-
const board = await assignTask(
|
|
9581
|
-
projectRoot,
|
|
9582
|
-
input.boardId,
|
|
9583
|
-
input.taskId,
|
|
9584
|
-
assignmentInput(input)
|
|
9585
|
-
);
|
|
9586
|
-
return board ? okBoard(board, "Task assigned.") : fail("Task not found.");
|
|
9587
|
-
}
|
|
9588
|
-
case "mark_assignment": {
|
|
9589
|
-
if (!input.boardId || !input.taskId)
|
|
9590
|
-
return fail("mark_assignment requires boardId and taskId.");
|
|
9591
|
-
const assignmentStatus = input.assignmentStatus ?? (input.status === "completed" ? "completed" : input.error ? "failed" : void 0);
|
|
9592
|
-
const board = await updateTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
9593
|
-
...assignmentStatus !== void 0 ? { status: assignmentStatus } : {},
|
|
9594
|
-
...input.subagentId !== void 0 ? { subagentId: input.subagentId } : {},
|
|
9595
|
-
...input.runTaskId !== void 0 ? { runTaskId: input.runTaskId } : {},
|
|
9596
|
-
...input.lastResult !== void 0 ? { lastResult: input.lastResult } : {},
|
|
9597
|
-
...input.error !== void 0 ? { error: input.error } : {},
|
|
9598
|
-
...input.agentId !== void 0 ? { agentId: input.agentId } : {}
|
|
9599
|
-
});
|
|
9600
|
-
return board ? okBoard(board, "Assignment updated.") : fail("Task not found.");
|
|
9601
|
-
}
|
|
9602
|
-
case "add_dependency": {
|
|
9603
|
-
if (!input.boardId || !input.taskId || !input.dependencyTaskId) {
|
|
9604
|
-
return fail("add_dependency requires boardId, taskId, and dependencyTaskId.");
|
|
9679
|
+
case "transfer_task": {
|
|
9680
|
+
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
9681
|
+
return fail("transfer_task requires boardId, taskId, and targetBoardId.");
|
|
9682
|
+
}
|
|
9683
|
+
const result = await transferTaskToBoard(
|
|
9684
|
+
projectRoot,
|
|
9685
|
+
input.boardId,
|
|
9686
|
+
input.taskId,
|
|
9687
|
+
input.targetBoardId,
|
|
9688
|
+
{
|
|
9689
|
+
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
9690
|
+
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
9691
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
9692
|
+
...input.preserveDependencies !== void 0 ? { preserveDependencies: input.preserveDependencies } : {}
|
|
9693
|
+
}
|
|
9694
|
+
);
|
|
9695
|
+
return result ? okTask(result.targetBoard, result.task, "Task transferred to target board.") : fail("Board or task not found.");
|
|
9605
9696
|
}
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
input.boardId,
|
|
9609
|
-
|
|
9610
|
-
input.dependencyTaskId
|
|
9611
|
-
);
|
|
9612
|
-
return board ? okBoard(board, "Dependency added.") : fail("Task not found.");
|
|
9613
|
-
}
|
|
9614
|
-
case "add_check": {
|
|
9615
|
-
if (!input.boardId || !input.taskId || !input.checkDescription) {
|
|
9616
|
-
return fail("add_check requires boardId, taskId, and checkDescription.");
|
|
9697
|
+
case "get_task": {
|
|
9698
|
+
if (!input.boardId || !input.taskId) return fail("get_task requires boardId and taskId.");
|
|
9699
|
+
const task = await getTask(projectRoot, input.boardId, input.taskId);
|
|
9700
|
+
return task ? { ok: true, message: "Task loaded.", task } : fail("Task not found.");
|
|
9617
9701
|
}
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
return
|
|
9702
|
+
case "update_task": {
|
|
9703
|
+
if (!input.boardId || !input.taskId)
|
|
9704
|
+
return fail("update_task requires boardId and taskId.");
|
|
9705
|
+
const board = await updateTask(
|
|
9706
|
+
projectRoot,
|
|
9707
|
+
input.boardId,
|
|
9708
|
+
input.taskId,
|
|
9709
|
+
taskPatch(input)
|
|
9710
|
+
);
|
|
9711
|
+
return board ? okBoard(board, "Task updated.") : fail("Task not found.");
|
|
9628
9712
|
}
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
input.taskId,
|
|
9633
|
-
input.checkId,
|
|
9634
|
-
{
|
|
9635
|
-
...input.checkDescription !== void 0 ? { description: input.checkDescription } : {},
|
|
9636
|
-
...input.checkStatus !== void 0 ? { status: input.checkStatus } : {}
|
|
9713
|
+
case "move_task": {
|
|
9714
|
+
if (!input.boardId || !input.taskId || !input.targetColumnId) {
|
|
9715
|
+
return fail("move_task requires boardId, taskId, and targetColumnId.");
|
|
9637
9716
|
}
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9717
|
+
const board = await moveTask(
|
|
9718
|
+
projectRoot,
|
|
9719
|
+
input.boardId,
|
|
9720
|
+
input.taskId,
|
|
9721
|
+
input.targetColumnId,
|
|
9722
|
+
input.order
|
|
9723
|
+
);
|
|
9724
|
+
return board ? okBoard(board, "Task moved.") : fail("Move failed.");
|
|
9725
|
+
}
|
|
9726
|
+
case "delete_task": {
|
|
9727
|
+
if (!input.boardId || !input.taskId)
|
|
9728
|
+
return fail("delete_task requires boardId and taskId.");
|
|
9729
|
+
const board = await removeTask(projectRoot, input.boardId, input.taskId);
|
|
9730
|
+
return board ? okBoard(board, "Task deleted.") : fail("Task not found.");
|
|
9731
|
+
}
|
|
9732
|
+
case "set_chain": {
|
|
9733
|
+
if (!input.boardId || !input.taskIds?.length) {
|
|
9734
|
+
return fail("set_chain requires boardId and taskIds.");
|
|
9735
|
+
}
|
|
9736
|
+
const result = await setTaskChain(projectRoot, input.boardId, {
|
|
9737
|
+
taskIds: input.taskIds,
|
|
9738
|
+
...input.chainId !== void 0 ? { chainId: input.chainId } : {},
|
|
9739
|
+
...input.enforceDependencies !== void 0 ? { enforceDependencies: input.enforceDependencies } : {}
|
|
9740
|
+
});
|
|
9741
|
+
return result ? {
|
|
9742
|
+
ok: true,
|
|
9743
|
+
message: `Chain set: ${result.chainId}`,
|
|
9744
|
+
board: result.board,
|
|
9745
|
+
chain: result.tasks
|
|
9746
|
+
} : fail("Board or task not found.");
|
|
9747
|
+
}
|
|
9748
|
+
case "get_chain": {
|
|
9749
|
+
if (!input.boardId || !(input.taskId || input.chainId)) {
|
|
9750
|
+
return fail("get_chain requires boardId and taskId or chainId.");
|
|
9751
|
+
}
|
|
9752
|
+
const result = await getTaskChain(
|
|
9753
|
+
projectRoot,
|
|
9754
|
+
input.boardId,
|
|
9755
|
+
input.taskId ?? input.chainId ?? ""
|
|
9756
|
+
);
|
|
9757
|
+
return result ? {
|
|
9758
|
+
ok: true,
|
|
9759
|
+
message: `Chain loaded: ${result.chainId}`,
|
|
9760
|
+
board: result.board,
|
|
9761
|
+
chain: result.tasks
|
|
9762
|
+
} : fail("Chain not found.");
|
|
9763
|
+
}
|
|
9764
|
+
case "claim_task": {
|
|
9765
|
+
const result = await claimReadyTask(projectRoot, {
|
|
9766
|
+
...input.boardId !== void 0 ? { boardId: input.boardId } : {},
|
|
9767
|
+
...input.taskId !== void 0 ? { taskId: input.taskId } : {},
|
|
9768
|
+
...assignmentInput(input),
|
|
9769
|
+
status: input.assignmentStatus ?? "queued"
|
|
9770
|
+
});
|
|
9771
|
+
return result ? okTask(result.board, result.task, "Task claimed.") : fail("No ready kanban task matched the claim.");
|
|
9772
|
+
}
|
|
9773
|
+
case "release_task": {
|
|
9774
|
+
if (!input.boardId || !input.taskId) {
|
|
9775
|
+
return fail("release_task requires boardId and taskId.");
|
|
9776
|
+
}
|
|
9777
|
+
const board = await releaseTaskClaim(projectRoot, input.boardId, input.taskId, {
|
|
9778
|
+
...input.releaseStatus !== void 0 ? { status: input.releaseStatus } : {},
|
|
9779
|
+
...input.releaseReason !== void 0 ? { reason: input.releaseReason } : {},
|
|
9780
|
+
...input.clearAssignee !== void 0 ? { clearAssignee: input.clearAssignee } : {}
|
|
9781
|
+
});
|
|
9782
|
+
return board ? okBoard(board, "Task claim released.") : fail("Task not found.");
|
|
9783
|
+
}
|
|
9784
|
+
case "assign_task": {
|
|
9785
|
+
if (!input.boardId || !input.taskId)
|
|
9786
|
+
return fail("assign_task requires boardId and taskId.");
|
|
9787
|
+
const board = await assignTask(
|
|
9788
|
+
projectRoot,
|
|
9789
|
+
input.boardId,
|
|
9790
|
+
input.taskId,
|
|
9791
|
+
assignmentInput(input)
|
|
9792
|
+
);
|
|
9793
|
+
return board ? okBoard(board, "Task assigned.") : fail("Task not found.");
|
|
9794
|
+
}
|
|
9795
|
+
case "mark_assignment": {
|
|
9796
|
+
if (!input.boardId || !input.taskId)
|
|
9797
|
+
return fail("mark_assignment requires boardId and taskId.");
|
|
9798
|
+
const assignmentStatus = input.assignmentStatus ?? (input.status === "completed" ? "completed" : input.error ? "failed" : void 0);
|
|
9799
|
+
const board = await updateTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
9800
|
+
...assignmentStatus !== void 0 ? { status: assignmentStatus } : {},
|
|
9801
|
+
...input.subagentId !== void 0 ? { subagentId: input.subagentId } : {},
|
|
9802
|
+
...input.runTaskId !== void 0 ? { runTaskId: input.runTaskId } : {},
|
|
9803
|
+
...input.lastResult !== void 0 ? { lastResult: input.lastResult } : {},
|
|
9804
|
+
...input.error !== void 0 ? { error: input.error } : {},
|
|
9805
|
+
...input.agentId !== void 0 ? { agentId: input.agentId } : {}
|
|
9806
|
+
});
|
|
9807
|
+
return board ? okBoard(board, "Assignment updated.") : fail("Task not found.");
|
|
9808
|
+
}
|
|
9809
|
+
case "add_dependency": {
|
|
9810
|
+
if (!input.boardId || !input.taskId || !input.dependencyTaskId) {
|
|
9811
|
+
return fail("add_dependency requires boardId, taskId, and dependencyTaskId.");
|
|
9812
|
+
}
|
|
9813
|
+
const board = await addDependency(
|
|
9814
|
+
projectRoot,
|
|
9815
|
+
input.boardId,
|
|
9816
|
+
input.taskId,
|
|
9817
|
+
input.dependencyTaskId
|
|
9818
|
+
);
|
|
9819
|
+
return board ? okBoard(board, "Dependency added.") : fail("Task not found.");
|
|
9820
|
+
}
|
|
9821
|
+
case "add_goal_metric": {
|
|
9822
|
+
if (!input.boardId || !input.taskId || !input.metricName) {
|
|
9823
|
+
return fail("add_goal_metric requires boardId, taskId, and metricName.");
|
|
9824
|
+
}
|
|
9825
|
+
const board = await addGoalMetricToTask(projectRoot, input.boardId, input.taskId, {
|
|
9826
|
+
name: input.metricName,
|
|
9827
|
+
...input.metricStatus !== void 0 ? { status: input.metricStatus } : {},
|
|
9828
|
+
...input.metricTarget !== void 0 ? { target: input.metricTarget } : {},
|
|
9829
|
+
...input.metricCurrent !== void 0 ? { current: input.metricCurrent } : {},
|
|
9830
|
+
...input.metricUnit !== void 0 ? { unit: input.metricUnit } : {},
|
|
9831
|
+
...input.metricNotes !== void 0 ? { notes: input.metricNotes } : {}
|
|
9832
|
+
});
|
|
9833
|
+
return board ? okBoard(board, "Goal metric added.") : fail("Task not found.");
|
|
9834
|
+
}
|
|
9835
|
+
case "update_goal_metric": {
|
|
9836
|
+
if (!input.boardId || !input.taskId || !input.metricId) {
|
|
9837
|
+
return fail("update_goal_metric requires boardId, taskId, and metricId.");
|
|
9838
|
+
}
|
|
9839
|
+
const board = await updateGoalMetricOnTask(
|
|
9840
|
+
projectRoot,
|
|
9841
|
+
input.boardId,
|
|
9842
|
+
input.taskId,
|
|
9843
|
+
input.metricId,
|
|
9844
|
+
{
|
|
9845
|
+
...input.metricName !== void 0 ? { name: input.metricName } : {},
|
|
9846
|
+
...input.metricStatus !== void 0 ? { status: input.metricStatus } : {},
|
|
9847
|
+
...input.metricTarget !== void 0 ? { target: input.metricTarget } : {},
|
|
9848
|
+
...input.metricCurrent !== void 0 ? { current: input.metricCurrent } : {},
|
|
9849
|
+
...input.metricUnit !== void 0 ? { unit: input.metricUnit } : {},
|
|
9850
|
+
...input.metricNotes !== void 0 ? { notes: input.metricNotes } : {}
|
|
9851
|
+
}
|
|
9852
|
+
);
|
|
9853
|
+
return board ? okBoard(board, "Goal metric updated.") : fail("Metric not found.");
|
|
9854
|
+
}
|
|
9855
|
+
case "add_check": {
|
|
9856
|
+
if (!input.boardId || !input.taskId || !input.checkDescription) {
|
|
9857
|
+
return fail("add_check requires boardId, taskId, and checkDescription.");
|
|
9858
|
+
}
|
|
9859
|
+
const board = await addCheckToTask(projectRoot, input.boardId, input.taskId, {
|
|
9860
|
+
description: input.checkDescription,
|
|
9861
|
+
type: "manual",
|
|
9862
|
+
status: input.checkStatus
|
|
9863
|
+
});
|
|
9864
|
+
return board ? okBoard(board, "Check added.") : fail("Task not found.");
|
|
9865
|
+
}
|
|
9866
|
+
case "update_check": {
|
|
9867
|
+
if (!input.boardId || !input.taskId || !input.checkId) {
|
|
9868
|
+
return fail("update_check requires boardId, taskId, and checkId.");
|
|
9869
|
+
}
|
|
9870
|
+
const board = await updateCheckOnTask(
|
|
9871
|
+
projectRoot,
|
|
9872
|
+
input.boardId,
|
|
9873
|
+
input.taskId,
|
|
9874
|
+
input.checkId,
|
|
9875
|
+
{
|
|
9876
|
+
...input.checkDescription !== void 0 ? { description: input.checkDescription } : {},
|
|
9877
|
+
...input.checkStatus !== void 0 ? { status: input.checkStatus } : {}
|
|
9878
|
+
}
|
|
9879
|
+
);
|
|
9880
|
+
return board ? okBoard(board, "Check updated.") : fail("Check not found.");
|
|
9881
|
+
}
|
|
9882
|
+
case "add_note": {
|
|
9883
|
+
if (!input.boardId || !input.taskId || !input.note)
|
|
9884
|
+
return fail("add_note requires boardId, taskId, and note.");
|
|
9885
|
+
const board = await addNoteToTask(projectRoot, input.boardId, input.taskId, {
|
|
9886
|
+
author: input.author ?? "agent",
|
|
9887
|
+
content: input.note
|
|
9888
|
+
});
|
|
9889
|
+
return board ? okBoard(board, "Note added.") : fail("Task not found.");
|
|
9890
|
+
}
|
|
9891
|
+
case "add_link": {
|
|
9892
|
+
if (!input.boardId || !input.taskId || !input.url)
|
|
9893
|
+
return fail("add_link requires boardId, taskId, and url.");
|
|
9894
|
+
const board = await addLinkToTask(projectRoot, input.boardId, input.taskId, {
|
|
9895
|
+
url: input.url,
|
|
9896
|
+
type: input.linkType ?? "url",
|
|
9897
|
+
...input.linkTitle !== void 0 ? { title: input.linkTitle } : {}
|
|
9898
|
+
});
|
|
9899
|
+
return board ? okBoard(board, "Link added.") : fail("Task not found.");
|
|
9900
|
+
}
|
|
9901
|
+
default:
|
|
9902
|
+
return fail(`Unknown kanban action: ${input.action}`);
|
|
9659
9903
|
}
|
|
9660
|
-
|
|
9661
|
-
|
|
9904
|
+
} catch (err) {
|
|
9905
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
9662
9906
|
}
|
|
9663
9907
|
}
|
|
9664
9908
|
};
|
|
@@ -9675,6 +9919,7 @@ async function requireBoard(projectRoot, boardId) {
|
|
|
9675
9919
|
return boardId ? getBoard(projectRoot, boardId) : null;
|
|
9676
9920
|
}
|
|
9677
9921
|
function taskInput(input) {
|
|
9922
|
+
const assignment = hasAssignmentInput(input) ? assignmentForTaskCreate(input) : void 0;
|
|
9678
9923
|
return {
|
|
9679
9924
|
title: input.title ?? "",
|
|
9680
9925
|
columnId: input.columnId,
|
|
@@ -9682,8 +9927,10 @@ function taskInput(input) {
|
|
|
9682
9927
|
priority: input.priority,
|
|
9683
9928
|
status: input.status,
|
|
9684
9929
|
labels: input.labels,
|
|
9685
|
-
assignedAgent:
|
|
9686
|
-
...input.
|
|
9930
|
+
...assignment?.agentId ?? assignment?.role ?? assignment?.name ? { assignedAgent: assignment.agentId ?? assignment.role ?? assignment.name } : {},
|
|
9931
|
+
...input.assignee ?? assignment?.name ?? assignment?.agentId ? { assignee: input.assignee ?? assignment?.name ?? assignment?.agentId } : {},
|
|
9932
|
+
...input.dependencyTaskId !== void 0 ? { dependsOn: [input.dependencyTaskId] } : {},
|
|
9933
|
+
...assignment ? { assignment } : {}
|
|
9687
9934
|
};
|
|
9688
9935
|
}
|
|
9689
9936
|
function taskPatch(input) {
|
|
@@ -9695,7 +9942,8 @@ function taskPatch(input) {
|
|
|
9695
9942
|
priority: input.priority,
|
|
9696
9943
|
status: input.status,
|
|
9697
9944
|
labels: input.labels,
|
|
9698
|
-
assignedAgent: input.agentId
|
|
9945
|
+
assignedAgent: input.agentId,
|
|
9946
|
+
...input.dependencyTaskId !== void 0 ? { dependsOn: [input.dependencyTaskId] } : {}
|
|
9699
9947
|
};
|
|
9700
9948
|
}
|
|
9701
9949
|
function assignmentInput(input) {
|
|
@@ -9712,6 +9960,9 @@ function assignmentInput(input) {
|
|
|
9712
9960
|
assignee: input.assignee
|
|
9713
9961
|
};
|
|
9714
9962
|
}
|
|
9963
|
+
function hasAssignmentInput(input) {
|
|
9964
|
+
return input.agentId !== void 0 || input.name !== void 0 || input.role !== void 0 || input.provider !== void 0 || input.model !== void 0 || input.fallbackProfile !== void 0 || input.fallbackModels !== void 0 || input.tools !== void 0 || input.allowedCapabilities !== void 0 || input.assignee !== void 0 || input.assignmentStatus !== void 0;
|
|
9965
|
+
}
|
|
9715
9966
|
function assignmentForTaskCreate(input) {
|
|
9716
9967
|
return {
|
|
9717
9968
|
status: input.assignmentStatus ?? "assigned",
|