Files
claude-task-master/packages/tm-core
Ralph Khreish 8857417870 feat: implement Phase 0 TDD autopilot dry-run foundation
Implements the complete Phase 0 spike for autonomous TDD workflow with orchestration architecture.

## What's New

### Core Services (tm-core)
- **PreflightChecker**: Validates environment prerequisites
  - Test command detection from package.json
  - Git working tree status validation
  - Required tools availability (git, gh, node, npm)
  - Default branch detection

- **TaskLoaderService**: Comprehensive task validation
  - Task existence and structure validation
  - Subtask dependency analysis with circular detection
  - Execution order calculation via topological sort
  - Helpful expansion suggestions for unready tasks

### CLI Command
- **autopilot command**: `tm autopilot <taskId> --dry-run`
  - Displays complete execution plan without executing
  - Shows preflight check results
  - Lists subtasks in dependency order
  - Preview RED/GREEN/COMMIT phases per subtask
  - Registered in command registry

### Architecture Documentation
- **Phase 0 completion**: Marked tdd-workflow-phase-0-spike.md as complete
- **Orchestration model**: Added execution model section to main workflow doc
  - Clarifies orchestrator guides AI sessions vs direct execution
  - WorkflowOrchestrator API design (getNextWorkUnit, completeWorkUnit)
  - State machine approach for phase transitions

- **Phase 1 roadmap**: New tdd-workflow-phase-1-orchestrator.md
  - Detailed state machine specifications
  - MCP integration plan with new tool definitions
  - Implementation checklist with 6 clear steps
  - Example usage flows

## Technical Details

**Preflight Checks**:
-  Test command detection
-  Git working tree status
-  Required tools validation
-  Default branch detection

**Task Validation**:
-  Task existence check
-  Status validation (no completed/cancelled tasks)
-  Subtask presence validation
-  Dependency resolution with circular detection
-  Execution order calculation

**Architecture Decision**:
Adopted orchestration model where WorkflowOrchestrator maintains state and generates work units, while Claude Code (via MCP) executes the actual work. This provides:
- Clean separation of concerns
- Human-in-the-loop capability
- Simpler implementation (no AI integration in orchestrator)
- Flexible executor support

## Out of Scope (Phase 0)
- Actual test generation
- Actual code implementation
- Git operations (commits, branches, PR)
- Test execution
→ All deferred to Phase 1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 16:46:34 +02:00
..
2025-09-20 00:08:20 +02:00
2025-09-24 19:21:21 +02:00
2025-09-12 03:34:32 +02:00

@task-master/tm-core

Core library for Task Master AI - providing task management and orchestration capabilities with TypeScript support.

Overview

tm-core is the foundational library that powers Task Master AI's task management system. It provides a comprehensive set of tools for creating, managing, and orchestrating tasks with AI integration.

Features

  • TypeScript-first: Built with full TypeScript support and strict type checking
  • Dual Format: Supports both ESM and CommonJS with automatic format detection
  • Modular Architecture: Clean separation of concerns with dedicated modules for different functionality
  • AI Provider Integration: Pluggable AI provider system for task generation and management
  • Flexible Storage: Abstracted storage layer supporting different persistence strategies
  • Task Parsing: Advanced parsing capabilities for various task definition formats
  • Error Handling: Comprehensive error system with specific error types
  • Testing: Complete test coverage with Jest and TypeScript support

Installation

npm install @task-master/tm-core

Usage

Basic Usage

import { generateTaskId, PlaceholderTask } from '@task-master/tm-core';

// Generate a unique task ID
const taskId = generateTaskId();

// Create a task (coming soon - full implementation)
const task: PlaceholderTask = {
  id: taskId,
  title: 'My Task',
  status: 'pending',
  priority: 'medium'
};

Modular Imports

You can import specific modules to reduce bundle size:

// Import types only
import type { TaskId, TaskStatus } from '@task-master/tm-core/types';

// Import utilities
import { generateTaskId, formatDate } from '@task-master/tm-core/utils';

// Import providers (AI providers coming soon)
// import { AIProvider } from '@task-master/tm-core/providers';

// Import storage
import { PlaceholderStorage } from '@task-master/tm-core/storage';

// Import parsers
import { PlaceholderParser } from '@task-master/tm-core/parser';

// Import errors
import { TmCoreError, TaskNotFoundError } from '@task-master/tm-core/errors';

Architecture

The library is organized into several key modules:

  • types/: TypeScript type definitions and interfaces
  • providers/: AI provider implementations for task generation
  • storage/: Storage adapters for different persistence strategies
  • parser/: Task parsing utilities for various formats
  • utils/: Common utility functions and helpers
  • errors/: Custom error classes and error handling

Development

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn

Setup

# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint code
npm run lint

# Format code
npm run format

Scripts

  • build: Build the library for both ESM and CJS formats
  • build:watch: Build in watch mode for development
  • test: Run the test suite
  • test:watch: Run tests in watch mode
  • test:coverage: Run tests with coverage reporting
  • lint: Lint TypeScript files
  • lint:fix: Lint and auto-fix issues
  • format: Format code with Prettier
  • format:check: Check code formatting
  • typecheck: Type-check without emitting files
  • clean: Clean build artifacts
  • dev: Development mode with watch

ESM and CommonJS Support

This package supports both ESM and CommonJS formats automatically:

// ESM
import { generateTaskId } from '@task-master/tm-core';

// CommonJS
const { generateTaskId } = require('@task-master/tm-core');

Roadmap

This is the initial package structure. The following features are planned for implementation:

Task 116: TypeScript Types

  • Complete type definitions for tasks, projects, and configurations
  • Zod schema validation
  • Generic type utilities

Task 117: AI Provider System

  • Base provider interface
  • Anthropic Claude integration
  • OpenAI integration
  • Perplexity integration
  • Provider factory and registry

Task 118: Storage Layer

  • File system storage adapter
  • Memory storage adapter
  • Storage interface and factory

Task 119: Task Parser

  • PRD parser implementation
  • Markdown parser
  • JSON task format parser
  • Validation utilities

Task 120: Utility Functions

  • Task ID generation
  • Date formatting
  • Validation helpers
  • File system utilities

Task 121: Error Handling

  • Task-specific errors
  • Storage errors
  • Provider errors
  • Validation errors

Task 122: Configuration System

  • Configuration schema
  • Default configurations
  • Environment variable support

Task 123: Testing Infrastructure

  • Unit test coverage
  • Integration tests
  • Mock utilities

Task 124: Documentation

  • API documentation
  • Usage examples
  • Migration guides

Task 125: Package Finalization

  • Final testing and validation
  • Release preparation
  • CI/CD integration

Implementation Checklist

Task 115: Initialize tm-core Package Structure (COMPLETED)

  • Create tm-core directory structure and base configuration files
  • Configure build and test infrastructure
  • Create barrel export files for all directories
  • Add development tooling and documentation
  • Validate package structure and prepare for development

🚧 Remaining Implementation Tasks

  • Task 116: TypeScript Types - Complete type definitions for tasks, projects, and configurations
  • Task 117: AI Provider System - Base provider interface and integrations
  • Task 118: Storage Layer - File system and memory storage adapters
  • Task 119: Task Parser - PRD, Markdown, and JSON parsers
  • Task 120: Utility Functions - Task ID generation, validation helpers
  • Task 121: Error Handling - Task-specific and validation errors
  • Task 122: Configuration System - Schema and environment support
  • Task 123: Testing Infrastructure - Complete unit and integration tests
  • Task 124: Documentation - API docs and usage examples
  • Task 125: Package Finalization - Release preparation and CI/CD

Contributing

This package is part of the Task Master AI project. Please refer to the main project's contributing guidelines.

License

MIT - See the main project's LICENSE file for details.

Support

For questions and support, please refer to the main Task Master AI documentation.