Skip to content

Commit be4a845

Browse files
committed
refactor: Rename 'todo' to 'task' across CLI commands and related components
1 parent 13b2844 commit be4a845

File tree

11 files changed

+69
-63
lines changed

11 files changed

+69
-63
lines changed

.github/workflows/validate-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ jobs:
4141
- name: Run validator unit tests
4242
run: npm test
4343

44-
- name: List TODO (smoke)
45-
run: node dist/cli.js todo list || true
44+
- name: List Tasks (smoke)
45+
run: node dist/cli.js task list || true

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,44 +123,44 @@ dddctl <command> [options]
123123

124124
The Document Driven Development Kit CLI provides the following commands and sub-commands:
125125

126-
#### `todo list`
126+
#### `task list`
127127

128128
List all tasks in the TODO.md file.
129129

130130
Example:
131131

132132
```bash
133-
npm run cli -- todo list
133+
npm run cli -- task list
134134
```
135135

136-
#### `todo show`
136+
#### `task show`
137137

138138
Show details of a specific task by ID.
139139

140140
Example:
141141

142142
```bash
143-
npm run cli -- todo show <task-id>
143+
npm run cli -- task show <task-id>
144144
```
145145

146-
#### `todo complete`
146+
#### `task complete`
147147

148148
Mark a task as complete.
149149

150150
Example:
151151

152152
```bash
153-
npm run cli -- todo complete <task-id>
153+
npm run cli -- task complete <task-id>
154154
```
155155

156-
#### `todo add`
156+
#### `task add`
157157

158158
Add a new task from a file.
159159

160160
Example:
161161

162162
```bash
163-
npm run cli -- todo add <file-path>
163+
npm run cli -- task add <file-path>
164164
```
165165

166166
#### `validate tasks`
@@ -208,7 +208,7 @@ npm run cli -- ref audit
208208
Example:
209209

210210
```bash
211-
npm run cli -- todo --help
211+
npm run cli -- task --help
212212
```
213213

214214
For a full list of commands and options, run:

scripts/integration-test.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,9 @@ test_cli_help() {
629629
return 1
630630
fi
631631

632-
info "Testing todo help"
633-
if ! run_cli_with_output "todo --help"; then
634-
error "Todo help command failed"
632+
info "Testing task help"
633+
if ! run_cli_with_output "task --help"; then
634+
error "Task help command failed"
635635
return 1
636636
fi
637637

@@ -657,17 +657,17 @@ test_task_management() {
657657

658658
# Add tasks
659659
info "Adding test tasks..."
660-
if ! run_cli_command "todo add $TEST_DIR/task1-auth.md"; then
660+
if ! run_cli_command "task add $TEST_DIR/task1-auth.md"; then
661661
error "Failed to add task1-auth.md"
662662
return 1
663663
fi
664664

665-
if ! run_cli_command "todo add $TEST_DIR/task2-migration.md"; then
665+
if ! run_cli_command "task add $TEST_DIR/task2-migration.md"; then
666666
error "Failed to add task2-migration.md"
667667
return 1
668668
fi
669669

670-
if ! run_cli_command "todo add $TEST_DIR/task3-docs.md"; then
670+
if ! run_cli_command "task add $TEST_DIR/task3-docs.md"; then
671671
error "Failed to add task3-docs.md"
672672
return 1
673673
fi
@@ -676,13 +676,13 @@ test_task_management() {
676676

677677
# List tasks
678678
info "Listing all tasks..."
679-
if ! run_cli_with_output "todo list"; then
679+
if ! run_cli_with_output "task list"; then
680680
warning "Task listing had issues (may be due to existing TODO.md format)"
681681
fi
682682

683683
# Show task details
684684
info "Showing task details..."
685-
if ! run_cli_with_output "todo show integration.test.task.001"; then
685+
if ! run_cli_with_output "task show integration.test.task.001"; then
686686
warning "Task show command had issues (may be due to existing TODO.md format)"
687687
fi
688688

@@ -759,7 +759,7 @@ test_supersede() {
759759
fi
760760

761761
info "Checking task list after supersede..."
762-
if ! run_cli_with_output "todo list"; then
762+
if ! run_cli_with_output "task list"; then
763763
warning "Task list after supersede had issues"
764764
fi
765765

@@ -772,17 +772,17 @@ test_task_completion() {
772772
step "Testing task completion..."
773773

774774
info "Completing task 002..."
775-
if ! run_cli_command "todo complete integration.test.task.002 --message 'Integration test completion'" false; then
775+
if ! run_cli_command "task complete integration.test.task.002 --message 'Integration test completion'" false; then
776776
warning "Task completion had issues (may be due to existing TODO.md format)"
777777
fi
778778

779779
info "Completing remaining tasks..."
780-
if ! run_cli_command "todo complete integration.test.task.003 --message 'Test cleanup'" false; then
780+
if ! run_cli_command "task complete integration.test.task.003 --message 'Test cleanup'" false; then
781781
warning "Task completion had issues (may be due to existing TODO.md format)"
782782
fi
783783

784784
info "Checking final task list..."
785-
if ! run_cli_with_output "todo list"; then
785+
if ! run_cli_with_output "task list"; then
786786
warning "Final task list had issues"
787787
fi
788788

@@ -832,13 +832,13 @@ This integration test comprehensively validated the DDD-Kit CLI functionality wi
832832
833833
1. **CLI Help System**
834834
- Main help command (\`--help\`)
835-
- Subcommand help (\`todo --help\`, \`validate --help\`, \`ref --help\`)
835+
- Subcommand help (\`task --help\`, \`validate --help\`, \`ref --help\`)
836836
837837
2. **Task Management**
838-
- Adding tasks from files (\`todo add <file>\`)
839-
- Listing all tasks (\`todo list\`)
840-
- Showing task details (\`todo show <id>\`)
841-
- Task completion with messages (\`todo complete <id> --message "..."\`)
838+
- Adding tasks from files (\`task add <file>\`)
839+
- Listing all tasks (\`task list\`)
840+
- Showing task details (\`task show <id>\`)
841+
- Task completion with messages (\`task complete <id> --message "..."\`)
842842
843843
3. **Validation System**
844844
- Task schema validation (\`validate tasks\`)

scripts/validate-local.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import { TodoManager } from '../dist/core/storage/task.js';
3+
import { TaskManager } from '../dist/core/storage/task.manager.js';
44
import { getLogger } from '../dist/core/system/logger.js';
55
import { validateTasks } from '../dist/validators/validator.js';
66

@@ -20,11 +20,11 @@ import { validateTasks } from '../dist/validators/validator.js';
2020
*/
2121
async function main() {
2222
try {
23-
const todoManager = new TodoManager(getLogger());
24-
const tasks = todoManager.listTasks();
23+
const taskManager = new TaskManager(getLogger());
24+
const tasks = taskManager.listTasks();
2525
const res = validateTasks(tasks);
2626

27-
if (res.valid) {
27+
if (res.isValid) {
2828
console.log(`✅ All ${tasks.length} tasks validate successfully.`);
2929
process.exitCode = 0;
3030
} else {

src/commands/rendering/next.command.telemetry.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { CommandName } from '../../types';
12
import { IObservabilityLogger } from '../../types/observability';
2-
import { IHydrationOptions } from '../../types/tasks';
3+
import { IHydrationOptions, TaskProviderType } from '../../types/tasks';
34

45
export interface OperationContext {
56
operationLogger: IObservabilityLogger;
@@ -24,10 +25,10 @@ export class NextCommandTelemetry {
2425
operationId: 'next_command_execution',
2526
});
2627

27-
operationLogger.counter('commands.next.executions', { provider: options.provider ?? 'todo' });
28+
operationLogger.counter('commands.next.executions', { provider: options.provider ?? 'task' });
2829
operationLogger.event('command_execution_started', {
29-
command: 'next',
30-
provider: options.provider ?? 'todo',
30+
command: CommandName.NEXT,
31+
provider: options.provider ?? TaskProviderType.TASK,
3132
hasFilters: Boolean(options.filters?.length),
3233
filterCount: options.filters?.length ?? 0,
3334
});
@@ -37,14 +38,14 @@ export class NextCommandTelemetry {
3738

3839
noTaskFound(op: OperationContext, options: IHydrationOptions): void {
3940
op.operationLogger.warn('No eligible tasks found for next command', {
40-
provider: options.provider ?? 'todo',
41+
provider: options.provider ?? TaskProviderType.TASK,
4142
filters: options.filters,
4243
});
4344
op.operationLogger.counter('commands.next.no_tasks_found', {
44-
provider: options.provider ?? 'todo',
45+
provider: options.provider ?? TaskProviderType.TASK,
4546
});
4647
op.operationLogger.event('command_execution_completed', {
47-
command: 'next',
48+
command: CommandName.NEXT,
4849
success: false,
4950
reason: 'no_eligible_tasks',
5051
});
@@ -57,7 +58,7 @@ export class NextCommandTelemetry {
5758

5859
op.operationLogger.span('next_command_execution', op.startTime, endTime, {
5960
taskId,
60-
provider: provider ?? 'todo',
61+
provider: provider ?? TaskProviderType.TASK,
6162
success: true,
6263
});
6364

@@ -66,9 +67,11 @@ export class NextCommandTelemetry {
6667
duration,
6768
});
6869

69-
op.operationLogger.counter('commands.next.success', { provider: provider ?? 'todo' });
70+
op.operationLogger.counter('commands.next.success', {
71+
provider: provider ?? TaskProviderType.TASK,
72+
});
7073
op.operationLogger.event('command_execution_completed', {
71-
command: 'next',
74+
command: CommandName.NEXT,
7275
success: true,
7376
taskId,
7477
duration,
@@ -91,18 +94,18 @@ export class NextCommandTelemetry {
9194
});
9295

9396
op.operationLogger.counter('commands.next.errors', {
94-
provider: provider ?? 'todo',
97+
provider: provider ?? TaskProviderType.TASK,
9598
error_type: errorType,
9699
});
97100

98101
op.operationLogger.span('next_command_execution', op.startTime, endTime, {
99-
provider: provider ?? 'todo',
102+
provider: provider ?? TaskProviderType.TASK,
100103
success: false,
101104
error: message,
102105
});
103106

104107
op.operationLogger.event('command_execution_completed', {
105-
command: 'next',
108+
command: CommandName.NEXT,
106109
success: false,
107110
error: message,
108111
duration,

src/commands/rendering/next.command.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class NextCommand extends BaseCommand {
5050
const op: OperationContext = this.telemetry.recordStart(this.observabilityLogger, options);
5151

5252
try {
53-
const provider = this.createProvider(options.provider ?? 'todo');
53+
const provider = this.createProvider(options.provider ?? TaskProviderType.TASK);
5454
const task = await this.findNextTask(provider, options);
5555

5656
if (!task) {
@@ -81,7 +81,7 @@ export class NextCommand extends BaseCommand {
8181
taskProviderType = providerType;
8282
break;
8383
default:
84-
taskProviderType = TaskProviderType.TODO;
84+
taskProviderType = TaskProviderType.TASK;
8585
}
8686
return TaskProviderFactory.create(taskProviderType, this.logger);
8787
}
@@ -134,7 +134,11 @@ export class NextCommand extends BaseCommand {
134134
program
135135
.command(CommandName.NEXT)
136136
.description('Hydrate the next eligible task')
137-
.option('--provider <provider>', 'Task provider: todo, issues, projects', 'todo')
137+
.option(
138+
'--provider <provider>',
139+
'Task provider: task, issues, projects',
140+
TaskProviderType.TASK,
141+
)
138142
.option('--filters <filters...>', 'Filters for task selection')
139143
.option('--branch-prefix <prefix>', 'Branch prefix', 'feature/')
140144
.option('--pin <sha>', 'Pin to specific ddd-kit commit/tag')

src/commands/shared/command.factory.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ export class CommandFactory {
3131
const ref = program.command('ref').description('Reference management');
3232
RefAuditCommand.configure(ref, logger);
3333

34-
// Todo commands
35-
const todo = program.command('todo').description('Task management commands');
36-
AddTaskCommand.configure(todo, logger);
37-
CompleteTaskCommand.configure(todo, logger);
38-
ListTasksCommand.configure(todo, logger);
39-
ShowTaskCommand.configure(todo, logger);
34+
// Task commands
35+
const task = program.command('task').description('Task management commands');
36+
AddTaskCommand.configure(task, logger);
37+
CompleteTaskCommand.configure(task, logger);
38+
ListTasksCommand.configure(task, logger);
39+
ShowTaskCommand.configure(task, logger);
4040

4141
// Validate commands
4242
const validate = program.command('validate').description('Validation commands');

src/core/processing/hydrate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class TaskHydrationService implements ITaskHydrationUseCase {
9191

9292
/**
9393
* Creates a task provider based on the specified type.
94-
* @param providerType - optional provider type to create, defaults to TODO
94+
* @param providerType - optional provider type to create, defaults to TASK
9595
* @returns the created provider instance
9696
*/
9797
private createProvider(providerType?: string) {
@@ -101,7 +101,7 @@ export class TaskHydrationService implements ITaskHydrationUseCase {
101101
return TaskProviderFactory.create(providerType, this.logger);
102102

103103
default:
104-
return TaskProviderFactory.create(TaskProviderType.TODO, this.logger);
104+
return TaskProviderFactory.create(TaskProviderType.TASK, this.logger);
105105
}
106106
}
107107

src/core/storage/task-provider.factory.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { ITaskRepository, TaskProviderType } from '../../types';
2-
import { ILogger } from '../../types/observability';
1+
import { TaskProviderType, ILogger, ITaskRepository } from '../../types';
32

4-
import { TaskProvider } from './task.provider';
53
import { IssuesProvider } from './issues.provider';
64
import { ProjectsProvider } from './projects.provider';
5+
import { TaskProvider } from './task.provider';
76

87
/**
98
* Factory for creating task providers following Factory pattern and OCP.
@@ -12,7 +11,7 @@ import { ProjectsProvider } from './projects.provider';
1211
export class TaskProviderFactory {
1312
static create(providerType: TaskProviderType, logger: ILogger): ITaskRepository {
1413
switch (providerType) {
15-
case TaskProviderType.TODO:
14+
case TaskProviderType.TASK:
1615
return new TaskProvider(logger);
1716

1817
case TaskProviderType.ISSUES:
@@ -27,6 +26,6 @@ export class TaskProviderFactory {
2726
}
2827

2928
static getAvailableProviders(): TaskProviderType[] {
30-
return [TaskProviderType.TODO, TaskProviderType.ISSUES, TaskProviderType.PROJECTS];
29+
return [TaskProviderType.TASK, TaskProviderType.ISSUES, TaskProviderType.PROJECTS];
3130
}
3231
}

src/services/task-render.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class TaskRenderService implements ITaskRenderUseCase {
1616
}
1717

1818
async execute(taskId: string, options: IRenderOptions): Promise<void> {
19-
const provider = TaskProviderFactory.create(TaskProviderType.TODO, this.logger);
19+
const provider = TaskProviderFactory.create(TaskProviderType.TASK, this.logger);
2020
const task = await provider.findById(taskId);
2121
if (!task) throw new Error(`Task ${taskId} not found`);
2222

0 commit comments

Comments
 (0)