fix: resolve TypeScript typecheck errors in Phase 0 implementation
- Fix git-utils import in PreflightChecker using require() with type casting - Fix ConfigManager initialization in TaskLoaderService (use async factory) - Fix TaskService.getTask return type (returns Task | null directly) - Export PreflightChecker and TaskLoaderService from @tm/core - Fix unused parameter and type annotations in autopilot command - Add boolean fallback for optional dryRun parameter All turbo:typecheck errors resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,7 @@ export class AutopilotCommand extends Command {
|
||||
spinner.succeed(`Task ${taskId} loaded`);
|
||||
|
||||
// Display task information
|
||||
this.displayTaskInfo(task, options.dryRun);
|
||||
this.displayTaskInfo(task, options.dryRun || false);
|
||||
|
||||
// Execute autopilot logic (placeholder for now)
|
||||
const result = await this.performAutopilot(taskId, task, options);
|
||||
@@ -260,7 +260,7 @@ export class AutopilotCommand extends Command {
|
||||
console.log();
|
||||
|
||||
// Display subtasks
|
||||
orderedSubtasks.forEach((subtask, index) => {
|
||||
orderedSubtasks.forEach((subtask: any, index: number) => {
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
`${index + 1}. ${validationResult.task!.id}.${subtask.id}: ${subtask.title}`
|
||||
@@ -337,7 +337,7 @@ export class AutopilotCommand extends Command {
|
||||
|
||||
case 'text':
|
||||
default:
|
||||
this.displayTextResult(result, options);
|
||||
this.displayTextResult(result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -352,10 +352,7 @@ export class AutopilotCommand extends Command {
|
||||
/**
|
||||
* Display result in text format
|
||||
*/
|
||||
private displayTextResult(
|
||||
result: AutopilotCommandResult,
|
||||
options: AutopilotCommandOptions
|
||||
): void {
|
||||
private displayTextResult(result: AutopilotCommandResult): void {
|
||||
if (result.success) {
|
||||
console.log(
|
||||
boxen(
|
||||
|
||||
@@ -72,3 +72,14 @@ export {
|
||||
type ComplexityAnalysis,
|
||||
type TaskComplexityData
|
||||
} from './reports/index.js';
|
||||
|
||||
// Re-export services
|
||||
export {
|
||||
PreflightChecker,
|
||||
TaskLoaderService,
|
||||
type CheckResult,
|
||||
type PreflightResult,
|
||||
type TaskValidationResult,
|
||||
type ValidationErrorType,
|
||||
type DependencyIssue
|
||||
} from './services/index.js';
|
||||
|
||||
@@ -6,13 +6,21 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import {
|
||||
isGitRepository,
|
||||
isGhCliAvailable,
|
||||
getDefaultBranch
|
||||
} from '../../../../scripts/modules/utils/git-utils.js';
|
||||
import { getLogger } from '../logger/factory.js';
|
||||
|
||||
// Import git utilities (JS module without type definitions)
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const gitUtils = require('../../../../scripts/modules/utils/git-utils.js');
|
||||
const isGitRepository = gitUtils.isGitRepository as (
|
||||
projectRoot: string
|
||||
) => Promise<boolean>;
|
||||
const isGhCliAvailable = gitUtils.isGhCliAvailable as (
|
||||
projectRoot: string
|
||||
) => Promise<boolean>;
|
||||
const getDefaultBranch = gitUtils.getDefaultBranch as (
|
||||
projectRoot: string
|
||||
) => Promise<string | null>;
|
||||
|
||||
const logger = getLogger('PreflightChecker');
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@ export interface DependencyIssue {
|
||||
* TaskLoaderService loads and validates tasks for autopilot execution
|
||||
*/
|
||||
export class TaskLoaderService {
|
||||
private taskService: TaskService;
|
||||
private taskService: TaskService | null = null;
|
||||
private projectRoot: string;
|
||||
|
||||
constructor(projectRoot: string) {
|
||||
@@ -65,10 +65,17 @@ export class TaskLoaderService {
|
||||
throw new Error('projectRoot is required for TaskLoaderService');
|
||||
}
|
||||
this.projectRoot = projectRoot;
|
||||
}
|
||||
|
||||
// Initialize TaskService with ConfigManager
|
||||
const configManager = new ConfigManager(projectRoot);
|
||||
/**
|
||||
* Ensure TaskService is initialized
|
||||
*/
|
||||
private async ensureInitialized(): Promise<void> {
|
||||
if (this.taskService) return;
|
||||
|
||||
const configManager = await ConfigManager.create(this.projectRoot);
|
||||
this.taskService = new TaskService(configManager);
|
||||
await this.taskService.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,8 +133,11 @@ export class TaskLoaderService {
|
||||
*/
|
||||
private async loadTask(taskId: string): Promise<Task | null> {
|
||||
try {
|
||||
const result = await this.taskService.getTask(taskId);
|
||||
return result.task || null;
|
||||
await this.ensureInitialized();
|
||||
if (!this.taskService) {
|
||||
throw new Error('TaskService initialization failed');
|
||||
}
|
||||
return await this.taskService.getTask(taskId);
|
||||
} catch (error) {
|
||||
logger.error(`Failed to load task ${taskId}:`, error);
|
||||
return null;
|
||||
@@ -384,6 +394,7 @@ export class TaskLoaderService {
|
||||
* Clean up resources
|
||||
*/
|
||||
async cleanup(): Promise<void> {
|
||||
await this.taskService.close();
|
||||
// TaskService doesn't require explicit cleanup
|
||||
// Resources are automatically released when instance is garbage collected
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user