chore: refactor tm-core to host more of our "core" commands (#1331)

This commit is contained in:
Ralph Khreish
2025-10-21 21:16:15 +02:00
committed by GitHub
parent c1e2811d2b
commit 03b7ef9a0e
146 changed files with 3137 additions and 1009 deletions

View File

@@ -6,12 +6,8 @@
import { Command } from 'commander';
import chalk from 'chalk';
import boxen from 'boxen';
import {
createTaskMasterCore,
type TaskMasterCore,
type TaskStatus
} from '@tm/core';
import type { StorageType } from '@tm/core/types';
import { createTmCore, type TmCore, type TaskStatus } from '@tm/core';
import type { StorageType } from '@tm/core';
import { displayError } from '../utils/error-handler.js';
/**
@@ -56,7 +52,7 @@ export interface SetStatusResult {
* This is a thin presentation layer over @tm/core
*/
export class SetStatusCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: SetStatusResult;
constructor(name?: string) {
@@ -112,7 +108,7 @@ export class SetStatusCommand extends Command {
}
// Initialize TaskMaster core
this.tmCore = await createTaskMasterCore({
this.tmCore = await createTmCore({
projectPath: options.project || process.cwd()
});
@@ -128,7 +124,7 @@ export class SetStatusCommand extends Command {
for (const taskId of taskIds) {
try {
const result = await this.tmCore.updateTaskStatus(
const result = await this.tmCore.tasks.updateStatus(
taskId,
options.status
);
@@ -168,7 +164,7 @@ export class SetStatusCommand extends Command {
this.lastResult = {
success: true,
updatedTasks,
storageType: this.tmCore.getStorageType() as Exclude<
storageType: this.tmCore.config.getStorageConfig().type as Exclude<
StorageType,
'auto'
>
@@ -188,7 +184,6 @@ export class SetStatusCommand extends Command {
} finally {
// Clean up resources
if (this.tmCore) {
await this.tmCore.close();
}
}