Skip to main content
Version: Next

TasksPlugin

TasksPlugin

CommandKit plugin that provides task management capabilities.

This plugin automatically loads task definitions from the src/app/tasks directory and manages their execution through configured drivers. It supports hot module replacement (HMR) for development workflows.

Example

import { tasks } from '@commandkit/tasks';

export default {
plugins: [
tasks(),
],
};
Signature
class TasksPlugin extends RuntimePlugin<TasksPluginOptions> {
public readonly name = 'tasks';
public readonly tasks = new Collection<string, Task>();
activate(ctx: CommandKitPluginRuntime) => Promise<void>;
deactivate(ctx: CommandKitPluginRuntime) => Promise<void>;
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>;
}

name

property

The plugin name identifier

tasks

property

Collection of loaded task instances indexed by task name

activate

method
(ctx: CommandKitPluginRuntime) => Promise<void>

Activates the tasks plugin.

This method:

  1. Sets up the task execution runner
  2. Loads all task definitions from the tasks directory
  3. Schedules tasks that have defined schedules

deactivate

method
(ctx: CommandKitPluginRuntime) => Promise<void>

Deactivates the tasks plugin.

Clears all loaded tasks from memory.

performHMR

method
(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>

Handles hot module replacement (HMR) for task files.

When a task file is modified during development, this method reloads the task definition and updates the scheduler accordingly.