@gitgov/core 1.1.0 → 1.2.0
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/src/index.d.ts +6 -0
- package/dist/src/index.js +36 -0
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -1766,6 +1766,7 @@ interface IBacklogAdapter {
|
|
|
1766
1766
|
pauseTask(taskId: string, actorId: string, reason?: string): Promise<TaskRecord>;
|
|
1767
1767
|
resumeTask(taskId: string, actorId: string, force?: boolean): Promise<TaskRecord>;
|
|
1768
1768
|
discardTask(taskId: string, actorId: string, reason?: string): Promise<TaskRecord>;
|
|
1769
|
+
deleteTask(taskId: string, actorId: string): Promise<void>;
|
|
1769
1770
|
createCycle(payload: Partial<CycleRecord>, actorId: string): Promise<CycleRecord>;
|
|
1770
1771
|
getCycle(cycleId: string): Promise<CycleRecord | null>;
|
|
1771
1772
|
getAllCycles(): Promise<CycleRecord[]>;
|
|
@@ -1865,6 +1866,11 @@ declare class BacklogAdapter implements IBacklogAdapter {
|
|
|
1865
1866
|
* Supports both cancellation (ready/active) and rejection (review) operations
|
|
1866
1867
|
*/
|
|
1867
1868
|
discardTask(taskId: string, actorId: string, reason?: string): Promise<TaskRecord>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Deletes a draft task completely (no discarded state)
|
|
1871
|
+
* Only works for tasks in 'draft' status that never entered formal workflow
|
|
1872
|
+
*/
|
|
1873
|
+
deleteTask(taskId: string, actorId: string): Promise<void>;
|
|
1868
1874
|
/**
|
|
1869
1875
|
* Updates a task with new payload
|
|
1870
1876
|
*/
|
package/dist/src/index.js
CHANGED
|
@@ -4383,6 +4383,9 @@ var BacklogAdapter = class {
|
|
|
4383
4383
|
const task = taskRecord.payload;
|
|
4384
4384
|
const actor = await this.getActor(actorId);
|
|
4385
4385
|
if (!["ready", "active", "review"].includes(task.status)) {
|
|
4386
|
+
if (task.status === "draft") {
|
|
4387
|
+
throw new Error(`ProtocolViolationError: Cannot cancel task in 'draft' state. Use 'gitgov task delete ${taskId}' to remove draft tasks.`);
|
|
4388
|
+
}
|
|
4386
4389
|
throw new Error(`ProtocolViolationError: Task is in '${task.status}' state. Cannot cancel from this state. Only 'ready', 'active', and 'review' tasks can be cancelled.`);
|
|
4387
4390
|
}
|
|
4388
4391
|
const context = {
|
|
@@ -4421,6 +4424,39 @@ ${task.status === "review" ? "[REJECTED]" : "[CANCELLED]"} ${reason} (${(/* @__P
|
|
|
4421
4424
|
});
|
|
4422
4425
|
return updatedPayload;
|
|
4423
4426
|
}
|
|
4427
|
+
/**
|
|
4428
|
+
* Deletes a draft task completely (no discarded state)
|
|
4429
|
+
* Only works for tasks in 'draft' status that never entered formal workflow
|
|
4430
|
+
*/
|
|
4431
|
+
async deleteTask(taskId, actorId) {
|
|
4432
|
+
const taskRecord = await this.taskStore.read(taskId);
|
|
4433
|
+
if (!taskRecord) {
|
|
4434
|
+
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
4435
|
+
}
|
|
4436
|
+
const task = taskRecord.payload;
|
|
4437
|
+
if (task.status !== "draft") {
|
|
4438
|
+
if (task.status === "review") {
|
|
4439
|
+
throw new Error(`ProtocolViolationError: Cannot delete task in 'review' state. Use 'gitgov task reject ${taskId}' to discard tasks under review.`);
|
|
4440
|
+
} else if (task.status === "ready" || task.status === "active") {
|
|
4441
|
+
throw new Error(`ProtocolViolationError: Cannot delete task in '${task.status}' state. Use 'gitgov task cancel ${taskId}' to discard tasks from ready/active states.`);
|
|
4442
|
+
}
|
|
4443
|
+
throw new Error(`ProtocolViolationError: Cannot delete task in '${task.status}' state. Only draft tasks can be deleted.`);
|
|
4444
|
+
}
|
|
4445
|
+
await this.getActor(actorId);
|
|
4446
|
+
await this.taskStore.delete(taskId);
|
|
4447
|
+
this.eventBus.publish({
|
|
4448
|
+
type: "task.status.changed",
|
|
4449
|
+
timestamp: Date.now(),
|
|
4450
|
+
source: "backlog_adapter",
|
|
4451
|
+
payload: {
|
|
4452
|
+
taskId,
|
|
4453
|
+
oldStatus: "draft",
|
|
4454
|
+
newStatus: "deleted",
|
|
4455
|
+
actorId,
|
|
4456
|
+
reason: "Draft task deleted"
|
|
4457
|
+
}
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4424
4460
|
/**
|
|
4425
4461
|
* Updates a task with new payload
|
|
4426
4462
|
*/
|