@bluefly/tddai

0.2.0 • Public • Published

TDDAI - Test-Driven Development Framework

Version License Node.js

A framework for Test-Driven Development with automated setup, test coverage monitoring, and project analysis.

Features

TDD Framework

  • Automated setup for Node.js, TypeScript, React, Drupal, and PHP projects
  • Test framework integration for Jest, PHPUnit, Vitest, and Mocha
  • Test coverage tracking with configurable thresholds
  • RED-GREEN-REFACTOR workflow guidance

Project Presets

  • 7 built-in presets: Enterprise, Startup, React, CLI, API, Library, and Drupal
  • Quick setup with single command
  • Automatic project type detection
  • Custom preset creation

Project Migration

  • Analysis of existing projects for TDD adoption
  • Migration planning with step-by-step instructions
  • Backup and rollback capabilities
  • Batch project processing

IDE Integration

  • Cursor IDE integration with .cursorrules generation
  • Claude Code integration with CLAUDE.md files
  • Code quality recommendations
  • TDD compliance analysis

Drupal Development

  • Integration with Drupal AI ecosystem (drupal:ai, drupal:eca)
  • Service pattern validation for dependency injection
  • ECA workflow generation for automation
  • AI service testing patterns

Multi-Platform Support

  • Node.js/TypeScript with Jest integration
  • React applications with testing utilities
  • PHP/Drupal with PHPUnit integration
  • CLI tools with testing frameworks

Installation

npm install -g @bluefly/tddai

Quick Start

# Initialize TDD in existing project
tddai init

# Use a preset for quick setup
tddai preset apply enterprise

# Analyze project for TDD compliance
tddai analyze

# Run TDD workflow
tddai tdd start

Usage

Project Initialization

# Initialize with automatic detection
tddai init

# Initialize with specific preset
tddai init --preset=react

# Initialize with custom configuration
tddai init --config=custom-config.yml

Preset Management

# List available presets
tddai preset list

# Apply preset to current project
tddai preset apply startup

# Create custom preset
tddai preset create my-preset

TDD Workflow

# Start TDD workflow
tddai tdd start

# Run specific phase
tddai tdd red    # Write failing test
tddai tdd green  # Write minimal code
tddai tdd refactor # Improve code

# Monitor compliance
tddai monitor

Project Analysis

# Analyze current project
tddai analyze

# Generate migration plan
tddai migrate plan

# Execute migration
tddai migrate execute

# Validate TDD compliance
tddai validate

Configuration

Basic Configuration (tddai.config.yml)

project:
  type: "typescript"
  framework: "jest"
  
testing:
  coverage_threshold: 95
  test_pattern: "**/*.test.ts"
  
tdd:
  enforce_workflow: true
  auto_watch: true
  
ai:
  cursor_integration: true
  claude_integration: true

Preset Configuration

name: "enterprise"
description: "Enterprise TypeScript project"
files:
  - template: "jest.config.ts"
  - template: "tsconfig.json"
  - template: ".cursorrules"
  - template: "CLAUDE.md"
dependencies:
  - "jest"
  - "typescript"
  - "@types/jest"
scripts:
  test: "jest"
  test:watch: "jest --watch"
  test:coverage: "jest --coverage"

Commands

Core Commands

  • tddai init - Initialize TDD framework
  • tddai analyze - Analyze project compliance
  • tddai validate - Validate TDD compliance
  • tddai monitor - Real-time compliance monitoring

Preset Commands

  • tddai preset list - List available presets
  • tddai preset apply <name> - Apply preset
  • tddai preset create <name> - Create custom preset

TDD Workflow Commands

  • tddai tdd start - Start TDD workflow
  • tddai tdd red - RED phase (failing test)
  • tddai tdd green - GREEN phase (minimal code)
  • tddai tdd refactor - REFACTOR phase

Migration Commands

  • tddai migrate plan - Generate migration plan
  • tddai migrate execute - Execute migration
  • tddai migrate rollback - Rollback changes

Drupal Integration

Setup

# Initialize Drupal project
tddai init --preset=drupal

# Enable AI integration
tddai drupal:ai enable

# Generate ECA workflows
tddai drupal:eca generate

Service Testing

// Generated test pattern
class MyServiceTest extends KernelTestBase {
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['my_module']);
  }
  
  public function testServiceIntegration(): void {
    $service = $this->container->get('my_module.my_service');
    $this->assertInstanceOf(MyService::class, $service);
  }
}

API

Programmatic Usage

import { TDDAIFramework } from '@bluefly/tddai';

const tddai = new TDDAIFramework();

// Initialize project
await tddai.init({
  preset: 'typescript',
  coverage: 95
});

// Analyze compliance
const analysis = await tddai.analyze();
console.log(`Compliance: ${analysis.compliance}%`);

// Apply preset
await tddai.preset.apply('enterprise');

Plugin Development

import { TDDAIPlugin } from '@bluefly/tddai';

export class CustomPlugin extends TDDAIPlugin {
  name = 'custom-plugin';
  
  async init(config: Config): Promise<void> {
    // Plugin initialization
  }
  
  async analyze(project: Project): Promise<Analysis> {
    // Custom analysis logic
  }
}

Testing

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run specific test suite
npm run test:unit
npm run test:integration

Development

Repository

Setup

git clone https://gitlab.bluefly.io/llm/tddai.git
cd tddai
npm install
npm run build

Contributing

  1. Fork the repository on GitLab
  2. Create feature branch
  3. Write tests for new features
  4. Ensure all tests pass
  5. Submit merge request

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @bluefly/tddai

Weekly Downloads

305

Version

0.2.0

License

MIT

Unpacked Size

11.7 MB

Total Files

947

Last publish

Collaborators

  • bluefly