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

@@ -12,7 +12,7 @@ import {
AuthManager,
AuthenticationError,
type AuthCredentials
} from '@tm/core/auth';
} from '@tm/core';
import * as ui from '../utils/ui.js';
import { ContextCommand } from './context.command.js';
import { displayError } from '../utils/error-handler.js';

View File

@@ -8,12 +8,7 @@ import { Command } from 'commander';
import chalk from 'chalk';
import boxen from 'boxen';
import ora, { type Ora } from 'ora';
import {
createTaskMasterCore,
type TaskMasterCore,
type Task,
type Subtask
} from '@tm/core';
import { createTmCore, type TmCore, type Task, type Subtask } from '@tm/core';
import * as ui from '../utils/ui.js';
/**
@@ -60,7 +55,7 @@ export interface AutopilotCommandResult {
* This is a thin presentation layer over @tm/core's autopilot functionality
*/
export class AutopilotCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: AutopilotCommandResult;
constructor(name?: string) {
@@ -164,11 +159,11 @@ export class AutopilotCommand extends Command {
}
/**
* Initialize TaskMasterCore
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
this.tmCore = await createTaskMasterCore({ projectPath: projectRoot });
this.tmCore = await createTmCore({ projectPath: projectRoot });
}
}
@@ -177,11 +172,11 @@ export class AutopilotCommand extends Command {
*/
private async loadTask(taskId: string): Promise<Task | null> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
try {
const { task } = await this.tmCore.getTaskWithSubtask(taskId);
const { task } = await this.tmCore.tasks.get(taskId);
return task;
} catch (error) {
return null;
@@ -236,11 +231,7 @@ export class AutopilotCommand extends Command {
}
// Validate task structure and get execution order
const validationResult = await this.validateTaskStructure(
taskId,
task,
options
);
const validationResult = await this.validateTaskStructure(taskId, task);
if (!validationResult.success) {
return validationResult;
}
@@ -288,19 +279,23 @@ export class AutopilotCommand extends Command {
*/
private async validateTaskStructure(
taskId: string,
task: Task,
options: AutopilotCommandOptions
task: Task
): Promise<AutopilotCommandResult & { orderedSubtasks?: Subtask[] }> {
const { TaskLoaderService } = await import('@tm/core');
if (!this.tmCore) {
return {
success: false,
taskId,
task,
error: 'TmCore not initialized'
};
}
console.log();
console.log(chalk.cyan.bold('Validating task structure...'));
const taskLoader = new TaskLoaderService(options.project || process.cwd());
const validationResult = await taskLoader.loadAndValidateTask(taskId);
const validationResult = await this.tmCore.tasks.loadAndValidate(taskId);
if (!validationResult.success) {
await taskLoader.cleanup();
return {
success: false,
taskId,
@@ -310,12 +305,10 @@ export class AutopilotCommand extends Command {
};
}
const orderedSubtasks = taskLoader.getExecutionOrder(
const orderedSubtasks = this.tmCore.tasks.getExecutionOrder(
validationResult.task!
);
await taskLoader.cleanup();
return {
success: true,
taskId,
@@ -499,7 +492,6 @@ export class AutopilotCommand extends Command {
*/
async cleanup(): Promise<void> {
if (this.tmCore) {
await this.tmCore.close();
this.tmCore = undefined;
}
}

View File

@@ -3,7 +3,7 @@
*/
import { Command } from 'commander';
import { createTaskMasterCore, type WorkflowContext } from '@tm/core';
import { createTmCore, type WorkflowContext } from '@tm/core';
import {
AutopilotBaseOptions,
hasWorkflowState,
@@ -67,20 +67,19 @@ export class StartCommand extends Command {
}
// Initialize Task Master Core
const tmCore = await createTaskMasterCore({
const tmCore = await createTmCore({
projectPath: mergedOptions.projectRoot!
});
// Get current tag from ConfigManager
const currentTag = tmCore.getActiveTag();
const currentTag = tmCore.config.getActiveTag();
// Load task
formatter.info(`Loading task ${taskId}...`);
const { task } = await tmCore.getTaskWithSubtask(taskId);
const { task } = await tmCore.tasks.get(taskId);
if (!task) {
formatter.error('Task not found', { taskId });
await tmCore.close();
process.exit(1);
}
@@ -90,7 +89,6 @@ export class StartCommand extends Command {
taskId,
suggestion: `Run: task-master expand --id=${taskId}`
});
await tmCore.close();
process.exit(1);
}
@@ -156,7 +154,6 @@ export class StartCommand extends Command {
});
// Clean up
await tmCore.close();
} catch (error) {
formatter.error((error as Error).message);
if (mergedOptions.verbose) {

View File

@@ -8,7 +8,7 @@ import chalk from 'chalk';
import inquirer from 'inquirer';
import search from '@inquirer/search';
import ora, { Ora } from 'ora';
import { AuthManager, type UserContext } from '@tm/core/auth';
import { AuthManager, type UserContext } from '@tm/core';
import * as ui from '../utils/ui.js';
import { displayError } from '../utils/error-handler.js';

View File

@@ -7,8 +7,13 @@ import { Command } from 'commander';
import chalk from 'chalk';
import inquirer from 'inquirer';
import ora, { Ora } from 'ora';
import { AuthManager, type UserContext } from '@tm/core/auth';
import { TaskMasterCore, type ExportResult } from '@tm/core';
import {
AuthManager,
type UserContext,
type ExportResult,
createTmCore,
type TmCore
} from '@tm/core';
import * as ui from '../utils/ui.js';
import { displayError } from '../utils/error-handler.js';
@@ -28,7 +33,7 @@ export interface ExportCommandResult {
*/
export class ExportCommand extends Command {
private authManager: AuthManager;
private taskMasterCore?: TaskMasterCore;
private taskMasterCore?: TmCore;
private lastResult?: ExportCommandResult;
constructor(name?: string) {
@@ -61,7 +66,7 @@ export class ExportCommand extends Command {
}
/**
* Initialize the TaskMasterCore
* Initialize the TmCore
*/
private async initializeServices(): Promise<void> {
if (this.taskMasterCore) {
@@ -69,8 +74,8 @@ export class ExportCommand extends Command {
}
try {
// Initialize TaskMasterCore
this.taskMasterCore = await TaskMasterCore.create({
// Initialize TmCore
this.taskMasterCore = await createTmCore({
projectPath: process.cwd()
});
} catch (error) {
@@ -152,7 +157,8 @@ export class ExportCommand extends Command {
// Perform export
spinner = ora('Exporting tasks...').start();
const exportResult = await this.taskMasterCore!.exportTasks({
// Use integration domain facade
const exportResult = await this.taskMasterCore!.integration.exportTasks({
orgId,
briefId,
tag: options?.tag,

View File

@@ -6,16 +6,16 @@
import { Command } from 'commander';
import chalk from 'chalk';
import {
createTaskMasterCore,
createTmCore,
type Task,
type TaskStatus,
type TaskMasterCore,
type TmCore,
TASK_STATUSES,
OUTPUT_FORMATS,
STATUS_ICONS,
type OutputFormat
} from '@tm/core';
import type { StorageType } from '@tm/core/types';
import type { StorageType } from '@tm/core';
import * as ui from '../utils/ui.js';
import { displayError } from '../utils/error-handler.js';
import { displayCommandHeader } from '../utils/display-helpers.js';
@@ -59,7 +59,7 @@ export interface ListTasksResult {
* This is a thin presentation layer over @tm/core
*/
export class ListTasksCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: ListTasksResult;
constructor(name?: string) {
@@ -144,11 +144,11 @@ export class ListTasksCommand extends Command {
}
/**
* Initialize TaskMasterCore
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
this.tmCore = await createTaskMasterCore({ projectPath: projectRoot });
this.tmCore = await createTmCore({ projectPath: projectRoot });
}
}
@@ -159,7 +159,7 @@ export class ListTasksCommand extends Command {
options: ListCommandOptions
): Promise<ListTasksResult> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
// Build filter
@@ -173,7 +173,7 @@ export class ListTasksCommand extends Command {
: undefined;
// Call tm-core
const result = await this.tmCore.getTaskList({
const result = await this.tmCore.tasks.list({
tag: options.tag,
filter,
includeSubtasks: options.withSubtasks
@@ -459,7 +459,6 @@ export class ListTasksCommand extends Command {
*/
async cleanup(): Promise<void> {
if (this.tmCore) {
await this.tmCore.close();
this.tmCore = undefined;
}
}

View File

@@ -7,8 +7,8 @@ import path from 'node:path';
import { Command } from 'commander';
import chalk from 'chalk';
import boxen from 'boxen';
import { createTaskMasterCore, type Task, type TaskMasterCore } from '@tm/core';
import type { StorageType } from '@tm/core/types';
import { createTmCore, type Task, type TmCore } from '@tm/core';
import type { StorageType } from '@tm/core';
import { displayError } from '../utils/error-handler.js';
import { displayTaskDetails } from '../ui/components/task-detail.component.js';
import { displayCommandHeader } from '../utils/display-helpers.js';
@@ -38,7 +38,7 @@ export interface NextTaskResult {
* This is a thin presentation layer over @tm/core
*/
export class NextCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: NextTaskResult;
constructor(name?: string) {
@@ -104,12 +104,12 @@ export class NextCommand extends Command {
}
/**
* Initialize TaskMasterCore
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
const resolved = path.resolve(projectRoot);
this.tmCore = await createTaskMasterCore({ projectPath: resolved });
this.tmCore = await createTmCore({ projectPath: resolved });
}
}
@@ -120,18 +120,18 @@ export class NextCommand extends Command {
options: NextCommandOptions
): Promise<NextTaskResult> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
// Call tm-core to get next task
const task = await this.tmCore.getNextTask(options.tag);
const task = await this.tmCore.tasks.getNext(options.tag);
// Get storage type and active tag
const storageType = this.tmCore.getStorageType();
const storageType = this.tmCore.config.getStorageConfig().type;
if (storageType === 'auto') {
throw new Error('Storage type must be resolved before use');
}
const activeTag = options.tag || this.tmCore.getActiveTag();
const activeTag = options.tag || this.tmCore.config.getActiveTag();
return {
task,
@@ -232,7 +232,6 @@ export class NextCommand extends Command {
*/
async cleanup(): Promise<void> {
if (this.tmCore) {
await this.tmCore.close();
this.tmCore = undefined;
}
}

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();
}
}

View File

@@ -6,8 +6,8 @@
import { Command } from 'commander';
import chalk from 'chalk';
import boxen from 'boxen';
import { createTaskMasterCore, type Task, type TaskMasterCore } from '@tm/core';
import type { StorageType } from '@tm/core/types';
import { createTmCore, type Task, type TmCore } from '@tm/core';
import type { StorageType } from '@tm/core';
import * as ui from '../utils/ui.js';
import { displayError } from '../utils/error-handler.js';
import { displayTaskDetails } from '../ui/components/task-detail.component.js';
@@ -47,7 +47,7 @@ export interface ShowMultipleTasksResult {
* This is a thin presentation layer over @tm/core
*/
export class ShowCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: ShowTaskResult | ShowMultipleTasksResult;
constructor(name?: string) {
@@ -133,11 +133,11 @@ export class ShowCommand extends Command {
}
/**
* Initialize TaskMasterCore
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
this.tmCore = await createTaskMasterCore({ projectPath: projectRoot });
this.tmCore = await createTmCore({ projectPath: projectRoot });
}
}
@@ -149,18 +149,18 @@ export class ShowCommand extends Command {
_options: ShowCommandOptions
): Promise<ShowTaskResult> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
// Get the task
const task = await this.tmCore.getTask(taskId);
const result = await this.tmCore.tasks.get(taskId);
// Get storage type
const storageType = this.tmCore.getStorageType();
const storageType = this.tmCore.config.getStorageConfig().type;
return {
task,
found: task !== null,
task: result.task,
found: result.task !== null,
storageType: storageType as Exclude<StorageType, 'auto'>
};
}
@@ -173,7 +173,7 @@ export class ShowCommand extends Command {
_options: ShowCommandOptions
): Promise<ShowMultipleTasksResult> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
const tasks: Task[] = [];
@@ -181,16 +181,16 @@ export class ShowCommand extends Command {
// Get each task individually
for (const taskId of taskIds) {
const task = await this.tmCore.getTask(taskId);
if (task) {
tasks.push(task);
const result = await this.tmCore.tasks.get(taskId);
if (result.task) {
tasks.push(result.task);
} else {
notFound.push(taskId);
}
}
// Get storage type
const storageType = this.tmCore.getStorageType();
const storageType = this.tmCore.config.getStorageConfig().type;
return {
tasks,
@@ -253,7 +253,7 @@ export class ShowCommand extends Command {
}
// Display header with storage info
const activeTag = this.tmCore?.getActiveTag() || 'master';
const activeTag = this.tmCore?.config.getActiveTag() || 'master';
displayCommandHeader(this.tmCore, {
tag: activeTag,
storageType: result.storageType
@@ -276,7 +276,7 @@ export class ShowCommand extends Command {
_options: ShowCommandOptions
): void {
// Display header with storage info
const activeTag = this.tmCore?.getActiveTag() || 'master';
const activeTag = this.tmCore?.config.getActiveTag() || 'master';
displayCommandHeader(this.tmCore, {
tag: activeTag,
storageType: result.storageType
@@ -322,7 +322,6 @@ export class ShowCommand extends Command {
*/
async cleanup(): Promise<void> {
if (this.tmCore) {
await this.tmCore.close();
this.tmCore = undefined;
}
}

View File

@@ -10,8 +10,8 @@ import boxen from 'boxen';
import ora, { type Ora } from 'ora';
import { spawn } from 'child_process';
import {
createTaskMasterCore,
type TaskMasterCore,
createTmCore,
type TmCore,
type StartTaskResult as CoreStartTaskResult
} from '@tm/core';
import { displayTaskDetails } from '../ui/components/task-detail.component.js';
@@ -43,7 +43,7 @@ export interface StartCommandResult extends CoreStartTaskResult {
* This is a thin presentation layer over @tm/core's TaskExecutionService
*/
export class StartCommand extends Command {
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
private lastResult?: StartCommandResult;
constructor(name?: string) {
@@ -147,7 +147,7 @@ export class StartCommand extends Command {
// Convert core result to CLI result with storage type
const result: StartCommandResult = {
...coreResult,
storageType: this.tmCore?.getStorageType()
storageType: this.tmCore?.config.getStorageConfig().type
};
// Store result for programmatic access
@@ -180,11 +180,11 @@ export class StartCommand extends Command {
}
/**
* Initialize TaskMasterCore
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
this.tmCore = await createTaskMasterCore({ projectPath: projectRoot });
this.tmCore = await createTmCore({ projectPath: projectRoot });
}
}
@@ -193,9 +193,9 @@ export class StartCommand extends Command {
*/
private async performGetNextTask(): Promise<string | null> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
return this.tmCore.getNextAvailableTask();
return this.tmCore.tasks.getNextAvailable();
}
/**
@@ -204,11 +204,10 @@ export class StartCommand extends Command {
private async showPreLaunchMessage(targetTaskId: string): Promise<void> {
if (!this.tmCore) return;
const { task, subtask, subtaskId } =
await this.tmCore.getTaskWithSubtask(targetTaskId);
const { task, isSubtask } = await this.tmCore.tasks.get(targetTaskId);
if (task) {
const workItemText = subtask
? `Subtask #${task.id}.${subtaskId} - ${subtask.title}`
const workItemText = isSubtask
? `Subtask #${targetTaskId} - ${task.title}`
: `Task #${task.id} - ${task.title}`;
console.log(
@@ -227,7 +226,7 @@ export class StartCommand extends Command {
options: StartCommandOptions
): Promise<CoreStartTaskResult> {
if (!this.tmCore) {
throw new Error('TaskMasterCore not initialized');
throw new Error('TmCore not initialized');
}
// Show spinner for status update if enabled
@@ -237,7 +236,7 @@ export class StartCommand extends Command {
}
// Get execution command from tm-core (instead of executing directly)
const result = await this.tmCore.startTask(targetTaskId, {
const result = await this.tmCore.tasks.start(targetTaskId, {
dryRun: options.dryRun,
force: options.force,
updateStatus: !options.noStatusUpdate
@@ -471,7 +470,6 @@ export class StartCommand extends Command {
*/
async cleanup(): Promise<void> {
if (this.tmCore) {
await this.tmCore.close();
this.tmCore = undefined;
}
}

View File

@@ -41,5 +41,5 @@ export type {
Task,
TaskStatus,
TaskPriority,
TaskMasterCore
TmCore
} from '@tm/core';

View File

@@ -5,7 +5,7 @@
import chalk from 'chalk';
import boxen from 'boxen';
import type { Task, TaskPriority } from '@tm/core/types';
import type { Task, TaskPriority } from '@tm/core';
import { getComplexityWithColor } from '../../utils/ui.js';
/**

View File

@@ -5,7 +5,7 @@
import chalk from 'chalk';
import boxen from 'boxen';
import type { Task } from '@tm/core/types';
import type { Task } from '@tm/core';
import { getComplexityWithColor, getBoxWidth } from '../../utils/ui.js';
/**

View File

@@ -8,7 +8,7 @@ import boxen from 'boxen';
import Table from 'cli-table3';
import { marked, MarkedExtension } from 'marked';
import { markedTerminal } from 'marked-terminal';
import type { Task } from '@tm/core/types';
import type { Task } from '@tm/core';
import {
getStatusWithColor,
getPriorityWithColor,

View File

@@ -3,73 +3,41 @@
* Provides DRY utilities for displaying headers and other command output
*/
import type { TaskMasterCore } from '@tm/core';
import type { StorageType } from '@tm/core/types';
import { displayHeader, type BriefInfo } from '../ui/index.js';
/**
* Get web app base URL from environment
*/
function getWebAppUrl(): string | undefined {
const baseDomain =
process.env.TM_BASE_DOMAIN || process.env.TM_PUBLIC_BASE_DOMAIN;
if (!baseDomain) {
return undefined;
}
// If it already includes protocol, use as-is
if (baseDomain.startsWith('http://') || baseDomain.startsWith('https://')) {
return baseDomain;
}
// Otherwise, add protocol based on domain
if (baseDomain.includes('localhost') || baseDomain.includes('127.0.0.1')) {
return `http://${baseDomain}`;
}
return `https://${baseDomain}`;
}
import type { TmCore } from '@tm/core';
import type { StorageType } from '@tm/core';
import { displayHeader } from '../ui/index.js';
/**
* Display the command header with appropriate storage information
* Handles both API and file storage displays
*/
export function displayCommandHeader(
tmCore: TaskMasterCore | undefined,
tmCore: TmCore | undefined,
options: {
tag?: string;
storageType: Exclude<StorageType, 'auto'>;
}
): void {
const { tag, storageType } = options;
// Get brief info if using API storage
let briefInfo: BriefInfo | undefined;
if (storageType === 'api' && tmCore) {
const storageInfo = tmCore.getStorageDisplayInfo();
if (storageInfo) {
// Construct full brief info with web app URL
briefInfo = {
...storageInfo,
webAppUrl: getWebAppUrl()
};
}
if (!tmCore) {
// Fallback display if tmCore is not available
displayHeader({
tag: options.tag || 'master',
storageType: options.storageType
});
return;
}
// Get file path for display (only for file storage)
// Note: The file structure is fixed for file storage and won't change.
// This is a display-only relative path, not used for actual file operations.
const filePath =
storageType === 'file' && tmCore
? `.taskmaster/tasks/tasks.json`
: undefined;
// Get the resolved storage type from tasks domain
const resolvedStorageType = tmCore.tasks.getStorageType();
// Display header
// Get storage display info from tm-core (single source of truth)
const displayInfo = tmCore.auth.getStorageDisplayInfo(resolvedStorageType);
// Display header with computed display info
displayHeader({
tag: tag || 'master',
filePath: filePath,
storageType: storageType === 'api' ? 'api' : 'file',
briefInfo: briefInfo
tag: options.tag || 'master',
filePath: displayInfo.filePath,
storageType: displayInfo.storageType,
briefInfo: displayInfo.briefInfo
});
}

View File

@@ -6,7 +6,7 @@
import chalk from 'chalk';
import boxen from 'boxen';
import Table from 'cli-table3';
import type { Task, TaskStatus, TaskPriority } from '@tm/core/types';
import type { Task, TaskStatus, TaskPriority } from '@tm/core';
/**
* Get colored status display with ASCII icons (matches scripts/modules/ui.js style)

View File

@@ -181,7 +181,7 @@ Workflows upload artifacts that you can download:
- Check extension code compiles locally: `cd apps/extension && npm run build`
- Verify tests pass locally: `npm run test`
- Check for TypeScript errors: `npm run check-types`
- Check for TypeScript errors: `npm run typecheck`
#### Packaging Failures

View File

@@ -61,7 +61,7 @@ npm run build:css
npm run build
# Type checking
npm run check-types
npm run typecheck
# Linting
npm run lint

View File

@@ -237,7 +237,7 @@
"watch": "npm run watch:js & npm run watch:css",
"watch:js": "node ./esbuild.js --watch",
"watch:css": "npx @tailwindcss/cli -i ./src/webview/index.css -o ./dist/index.css --watch",
"check-types": "tsc --noEmit"
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@dnd-kit/core": "^6.3.1",

View File

@@ -4,7 +4,7 @@
*/
import * as vscode from 'vscode';
import { createTaskMasterCore, type TaskMasterCore } from '@tm/core';
import { createTmCore, type TmCore } from '@tm/core';
import type { ExtensionLogger } from '../utils/logger';
export interface TerminalExecutionOptions {
@@ -21,7 +21,7 @@ export interface TerminalExecutionResult {
export class TerminalManager {
private terminals = new Map<string, vscode.Terminal>();
private tmCore?: TaskMasterCore;
private tmCore?: TmCore;
constructor(
private context: vscode.ExtensionContext,
@@ -49,7 +49,7 @@ export class TerminalManager {
await this.initializeCore();
// Use tm-core to start the task (same as CLI)
const startResult = await this.tmCore!.startTask(taskId, {
const startResult = await this.tmCore!.tasks.start(taskId, {
dryRun: false,
force: false,
updateStatus: true
@@ -110,7 +110,7 @@ export class TerminalManager {
if (!workspaceRoot) {
throw new Error('No workspace folder found');
}
this.tmCore = await createTaskMasterCore({ projectPath: workspaceRoot });
this.tmCore = await createTmCore({ projectPath: workspaceRoot });
}
}
@@ -144,13 +144,9 @@ export class TerminalManager {
});
this.terminals.clear();
// Clear tm-core reference (no explicit cleanup needed)
if (this.tmCore) {
try {
await this.tmCore.close();
this.tmCore = undefined;
} catch (error) {
this.logger.error('Failed to close tm-core:', error);
}
this.tmCore = undefined;
}
}
}

View File

@@ -11,7 +11,7 @@ import {
withNormalizedProjectRoot
} from '../../shared/utils.js';
import type { MCPContext } from '../../shared/types.js';
import { createTaskMasterCore } from '@tm/core';
import { createTmCore } from '@tm/core';
import { WorkflowService } from '@tm/core';
import type { FastMCP } from 'fastmcp';
@@ -83,17 +83,16 @@ export function registerAutopilotStartTool(server: FastMCP) {
}
// Load task data and get current tag
const core = await createTaskMasterCore({
const core = await createTmCore({
projectPath: projectRoot
});
// Get current tag from ConfigManager
const currentTag = core.getActiveTag();
const currentTag = core.config.getActiveTag();
const taskResult = await core.getTaskWithSubtask(taskId);
const taskResult = await core.tasks.get(taskId);
if (!taskResult || !taskResult.task) {
await core.close();
return handleApiResult({
result: {
success: false,
@@ -108,7 +107,6 @@ export function registerAutopilotStartTool(server: FastMCP) {
// Validate task has subtasks
if (!task.subtasks || task.subtasks.length === 0) {
await core.close();
return handleApiResult({
result: {
success: false,