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`);
|
spinner.succeed(`Task ${taskId} loaded`);
|
||||||
|
|
||||||
// Display task information
|
// Display task information
|
||||||
this.displayTaskInfo(task, options.dryRun);
|
this.displayTaskInfo(task, options.dryRun || false);
|
||||||
|
|
||||||
// Execute autopilot logic (placeholder for now)
|
// Execute autopilot logic (placeholder for now)
|
||||||
const result = await this.performAutopilot(taskId, task, options);
|
const result = await this.performAutopilot(taskId, task, options);
|
||||||
@@ -260,7 +260,7 @@ export class AutopilotCommand extends Command {
|
|||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
// Display subtasks
|
// Display subtasks
|
||||||
orderedSubtasks.forEach((subtask, index) => {
|
orderedSubtasks.forEach((subtask: any, index: number) => {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.yellow(
|
chalk.yellow(
|
||||||
`${index + 1}. ${validationResult.task!.id}.${subtask.id}: ${subtask.title}`
|
`${index + 1}. ${validationResult.task!.id}.${subtask.id}: ${subtask.title}`
|
||||||
@@ -337,7 +337,7 @@ export class AutopilotCommand extends Command {
|
|||||||
|
|
||||||
case 'text':
|
case 'text':
|
||||||
default:
|
default:
|
||||||
this.displayTextResult(result, options);
|
this.displayTextResult(result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,10 +352,7 @@ export class AutopilotCommand extends Command {
|
|||||||
/**
|
/**
|
||||||
* Display result in text format
|
* Display result in text format
|
||||||
*/
|
*/
|
||||||
private displayTextResult(
|
private displayTextResult(result: AutopilotCommandResult): void {
|
||||||
result: AutopilotCommandResult,
|
|
||||||
options: AutopilotCommandOptions
|
|
||||||
): void {
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
|
|||||||
@@ -72,3 +72,14 @@ export {
|
|||||||
type ComplexityAnalysis,
|
type ComplexityAnalysis,
|
||||||
type TaskComplexityData
|
type TaskComplexityData
|
||||||
} from './reports/index.js';
|
} 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 { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import {
|
|
||||||
isGitRepository,
|
|
||||||
isGhCliAvailable,
|
|
||||||
getDefaultBranch
|
|
||||||
} from '../../../../scripts/modules/utils/git-utils.js';
|
|
||||||
import { getLogger } from '../logger/factory.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');
|
const logger = getLogger('PreflightChecker');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export interface DependencyIssue {
|
|||||||
* TaskLoaderService loads and validates tasks for autopilot execution
|
* TaskLoaderService loads and validates tasks for autopilot execution
|
||||||
*/
|
*/
|
||||||
export class TaskLoaderService {
|
export class TaskLoaderService {
|
||||||
private taskService: TaskService;
|
private taskService: TaskService | null = null;
|
||||||
private projectRoot: string;
|
private projectRoot: string;
|
||||||
|
|
||||||
constructor(projectRoot: string) {
|
constructor(projectRoot: string) {
|
||||||
@@ -65,10 +65,17 @@ export class TaskLoaderService {
|
|||||||
throw new Error('projectRoot is required for TaskLoaderService');
|
throw new Error('projectRoot is required for TaskLoaderService');
|
||||||
}
|
}
|
||||||
this.projectRoot = projectRoot;
|
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);
|
this.taskService = new TaskService(configManager);
|
||||||
|
await this.taskService.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,8 +133,11 @@ export class TaskLoaderService {
|
|||||||
*/
|
*/
|
||||||
private async loadTask(taskId: string): Promise<Task | null> {
|
private async loadTask(taskId: string): Promise<Task | null> {
|
||||||
try {
|
try {
|
||||||
const result = await this.taskService.getTask(taskId);
|
await this.ensureInitialized();
|
||||||
return result.task || null;
|
if (!this.taskService) {
|
||||||
|
throw new Error('TaskService initialization failed');
|
||||||
|
}
|
||||||
|
return await this.taskService.getTask(taskId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Failed to load task ${taskId}:`, error);
|
logger.error(`Failed to load task ${taskId}:`, error);
|
||||||
return null;
|
return null;
|
||||||
@@ -384,6 +394,7 @@ export class TaskLoaderService {
|
|||||||
* Clean up resources
|
* Clean up resources
|
||||||
*/
|
*/
|
||||||
async cleanup(): Promise<void> {
|
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