Skip to content

Commit 7d29e8f

Browse files
committed
feat(deps): improve dependency management workflow
1 parent e5f78db commit 7d29e8f

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

src/core/TaskMaster.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ export class TaskMaster {
14681468
// Dependencies Methods
14691469
// ==============================================
14701470

1471-
// TODO: in-progress
1471+
// TODO: done
14721472
/**
14731473
* @description Adds a dependency to a task
14741474
* @param taskId ID of the task to modify
@@ -1478,15 +1478,15 @@ export class TaskMaster {
14781478
taskId: string,
14791479
dependencyIds: string[],
14801480
): Promise<void> {
1481-
const formatedDepsIds =
1482-
dependencyIds.length > 1 ? dependencyIds.join(",") : dependencyIds[0];
1483-
await this._executeCommandAsync(
1484-
`Adding dependency ${formatedDepsIds} to task ${taskId}...`,
1485-
`Dependency ${formatedDepsIds} added successfully to task ${taskId}!`,
1486-
`Failed to add dependency ${formatedDepsIds} to task ${taskId}`,
1487-
this._mainCommand,
1488-
["add-dependency", `--id=${taskId}`, `--depends-on=${formatedDepsIds}`],
1489-
);
1481+
for (const dependencyId of dependencyIds) {
1482+
await this._executeCommandAsync(
1483+
`Adding dependency ${dependencyId} to task ${taskId}...`,
1484+
`Dependency ${dependencyId} added successfully to task ${taskId}!`,
1485+
`Failed to add dependency ${dependencyId} to task ${taskId}`,
1486+
this._mainCommand,
1487+
["add-dependency", `--id=${taskId}`, `--depends-on=${dependencyId}`],
1488+
);
1489+
}
14901490
}
14911491

14921492
// TODO: done

src/core/exec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ const tmai = new TaskMaster({
6363
isTestMode: false,
6464
});
6565

66-
// TODO: done
6766
export async function tmaiInitAsync() {
6867
const choice = await inquirer.prompt(tmaiInitMenu_prompt);
6968

@@ -106,7 +105,6 @@ export async function tmaiInitAsync() {
106105
await restartAsync();
107106
}
108107

109-
// TODO: done
110108
export async function tmaiGenAsync() {
111109
const choice = await inquirer.prompt(tmaiGenDecMenu_prompt);
112110

@@ -147,7 +145,6 @@ export async function tmaiGenAsync() {
147145
await restartAsync();
148146
}
149147

150-
// TODO: in-progress
151148
export async function tmaiManageAsync() {
152149
let tasks = await tmai.getTasksContentAsync();
153150
const { mainIDs, subtasksIDs } = await tmai.getAllTaskIdsAsync(tasks);
@@ -373,21 +370,26 @@ export async function tmaiManageAsync() {
373370
await restartAsync();
374371
}
375372

376-
// TODO: in-progress
377373
export async function tmaiDependenciesAsync() {
374+
let tasks = await tmai.getTasksContentAsync();
378375
const { tmaiDepsMenu } = await inquirer.prompt(tmaiDepsMenu_prompt);
379-
const tasks = await tmai.getTasksContentAsync();
380376
const { mainIDs, subtasksIDs } = await tmai.getAllTaskIdsAsync(tasks);
381377

382378
switch (tmaiDepsMenu) {
383379
case "tmai-adddeps": {
384380
await tmai.listAsync(tasks, TASKS_STATUSES.join(","), true, true);
385-
const taskId = await askHybridTaskIdAsync(mainIDs, subtasksIDs);
381+
const taskId = await askHybridTaskIdAsync(
382+
mainIDs,
383+
subtasksIDs,
384+
"Select the task ID to which you want to add dependencies (integer or hierarchical):",
385+
);
386386
const multipleTaskIds = await askMultipleTaskIdAsync(
387387
mainIDs,
388388
subtasksIDs,
389+
"Select the dependencies IDs to add (comma-separated):",
389390
);
390391
await tmai.addDependencyAsync(taskId, multipleTaskIds);
392+
tasks = await tmai.getTasksContentAsync();
391393
await tmai.listAsync(tasks, TASKS_STATUSES.join(","), true, true);
392394
break;
393395
}
@@ -406,7 +408,6 @@ export async function tmaiDependenciesAsync() {
406408
await restartAsync();
407409
}
408410

409-
// TODO: done
410411
export async function tmaiBackupRestoreClearAsync() {
411412
const { tmaiBackupRestoreClearMenu } = await inquirer.prompt(
412413
tmaiBackupRestoreClearClear_prompt,

0 commit comments

Comments
 (0)