Skip to content

Repository files navigation

BDD Implementation Plan Generator Action

A GitHub Action that scans your codebase for .md requirements files and .feature Gherkin files to generate a comprehensive BDD (Behavior-Driven Development) implementation plan with checkboxes.

Features

  • Automatic Requirements Discovery: Scans all .md files for requirements, user stories, and acceptance criteria
  • Gherkin Feature Analysis: Parses .feature files to understand existing BDD scenarios
  • Infrastructure Detection: Identifies infrastructure needs from documentation (Docker, databases, message queues, etc.)
  • Framework Detection: Automatically detects test frameworks and programming languages in use
  • Comprehensive Planning: Generates a detailed, phase-based implementation plan following BDD best practices
  • Checkbox Tracking: Creates actionable tasks with checkboxes for progress tracking
  • GitHub Issue Integration: Optionally creates a GitHub issue with the generated plan

BDD Workflow

The action generates a plan following this BDD workflow:

  1. Gherkin Creation: Create .feature files from requirements if they don't exist
  2. Test Implementation: Write tests based on Gherkin scenarios (assuming implementation exists)
  3. Implementation: Build the actual implementation to make tests pass
  4. Infrastructure: Set up Docker and required services
  5. CI/CD: Configure continuous integration and deployment
  6. Documentation: Create comprehensive documentation
  7. Quality Assurance: Perform final validation

Usage

As a GitHub Action

Add to your workflow file (.github/workflows/bdd-plan.yml):

name: Generate BDD Plan
on:
  workflow_dispatch:
  push:
    paths:
      - '**/*.md'
      - '**/*.feature'

jobs:
  generate-plan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Generate BDD Implementation Plan
        uses: your-username/bdd-plan-generator@v1
        with:
          create-issue: 'true'
          issue-labels: 'bdd,implementation,plan'
          scan-paths: '.'
          output-file: 'bdd_implementation_plan.md'

Standalone Script

You can also run the generator directly:

# Install dependencies
pip install pyyaml markdown

# Run the generator
python generate_bdd_plan.py --scan-paths . --output bdd_plan.md

Inputs

Input Description Required Default
create-issue Create a GitHub issue with the plan No true
issue-labels Comma-separated labels for the issue No bdd,implementation,plan
scan-paths Paths to scan for requirements No .
output-file Name of the output plan file No bdd_implementation_plan.md

Outputs

Output Description
plan-file Path to the generated plan file
total-tasks Total number of tasks in the plan
requirements-count Number of requirements found
features-count Number of feature files found
issue-number Issue number if created

Requirements Format

The action recognizes various requirement formats in markdown files:

User Stories

As a user, I want to login with OAuth, so that I can access my account securely.

Acceptance Criteria

## Acceptance Criteria
- User can login with Google OAuth
- User can login with GitHub OAuth
- Session persists across browser refreshes

Infrastructure Requirements

## Infrastructure
- PostgreSQL database for user data
- Redis for session storage
- Docker containers for all services

Gherkin Features

The action parses standard Gherkin .feature files:

Feature: User Authentication
  As a user
  I want to authenticate
  So that I can access protected resources

  Scenario: Successful login
    Given I am on the login page
    When I enter valid credentials
    Then I should be redirected to the dashboard

Generated Plan Structure

The generated plan includes:

  1. Phase 1: Gherkin Feature Creation

    • Review existing requirements
    • Create missing Gherkin features
  2. Phase 2: Test Implementation

    • Step definitions
    • Test infrastructure
    • Integration tests
    • E2E tests
  3. Phase 3: Implementation

    • Domain models
    • Business logic
    • API endpoints
    • UI components
    • Data access layer
  4. Phase 4: Infrastructure Setup

    • Docker configuration
    • Required services
    • Database setup
    • Message queues
    • Monitoring
  5. Phase 5: CI/CD Pipeline

    • Continuous integration
    • Continuous deployment
  6. Phase 6: Documentation

    • README
    • API documentation
    • Architecture diagrams
  7. Phase 7: Quality Assurance

    • Code review
    • Performance tests
    • Security audit

Example Output

The action generates a markdown file with checkboxes:

# BDD Implementation Plan

## Phase 1: Gherkin Feature Creation

### 1.1 Review Existing Requirements
- [ ] Review requirement from `docs/requirements.md`
  - Content: User authentication with OAuth

### 1.2 Create Missing Gherkin Features
- [ ] Create Gherkin feature for OAuth authentication
  - [ ] Define Feature description
  - [ ] Write Background (if applicable)
  - [ ] Create Scenarios with Given/When/Then
  - [ ] Add Examples for Scenario Outlines

## Phase 2: Test Implementation

### 2.1 Step Definitions
- [ ] Create step definition file
  - [ ] Implement step: `I am on the login page`
  - [ ] Implement step: `I click the OAuth login button`
  ...

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages