Contributing

Thank you for your interest in contributing! This guide covers development workflow, coding standards, and our AI-powered development process.

Quick Links

Development Workflow

Branch Strategy

Creating a Feature Branch

Use descriptive branch names with the following prefixes. Features and fixes use an issue number (e.g., feat/025-semantic-diff, fix/026-template-escape), while other types use descriptive names:

Prefix Purpose Example
feat/ New features feat/semantic-diff-firewall-rules
fix/ Bug fixes fix/template-rendering-escape
docs/ Documentation changes docs/update-installation-guide
refactor/ Code refactoring refactor/parser-immutable-models
chore/ Maintenance tasks chore/update-dependencies
workflow/ Agent/workflow changes workflow/add-uat-skill
website/ Website changes website/add-feature-page

Example workflow:

git checkout main
git pull origin main
git checkout -b feat/your-feature-name

Testing Requirements

All changes must include appropriate tests. The project uses a comprehensive testing strategy:

Test Types

Running Tests

# Run all tests
dotnet test

# Run specific test categories
dotnet test --filter "FullyQualifiedName~MarkdownInvariantTests"
dotnet test --filter "FullyQualifiedName~MarkdownLintIntegrationTests"

Markdown Quality Requirements

All generated markdown must:

Commit Messages

This project uses Conventional Commits to automate versioning and changelog generation.

Format

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Commit Types

Type Description Version Bump
feat A new feature Minor (0.x.0)
fix A bug fix Patch (0.0.x)
docs Documentation only None
style Code style changes None
refactor Code refactoring None
test Adding or modifying tests None
chore Other maintenance None

Breaking Changes

For breaking changes, add BREAKING CHANGE: in the commit footer or use ! after the type:

feat(parser)!: change output format to JSON

BREAKING CHANGE: The output format has changed from plain text to JSON.

Commit Cohesion

Each commit should focus on a single topic or change. If you find yourself using "and" repeatedly in a commit message, consider splitting it into multiple commits.

Examples

# Feature
git commit -m "feat(cli): add --output flag for custom output path"

# Bug fix
git commit -m "fix(parser): handle empty resource changes array"

# Documentation
git commit -m "docs: update installation instructions"

# Breaking change
git commit -m "feat(api)!: rename TerraformPlan to PlanResult"

Pull Request Process

  1. Create a feature branch from main
  2. Make your changes following the coding guidelines
  3. Ensure all checks pass:
    dotnet format --verify-no-changes
    dotnet build
    dotnet test
  4. Push your branch and create a Pull Request
  5. Wait for review — PR validation will run automatically
  6. Merge using "Rebase and merge" — This project requires a linear history

PR Requirements

Project Directory Structure

Understanding the project layout:

Merge Strategy

This project uses rebase and merge to maintain a linear Git history:

Coding Standards

Access Modifiers

tfplan2md is a standalone CLI tool, not a class library. Use the most restrictive access modifier that works:

Never use public just for testing. Instead, use InternalsVisibleTo to expose internal members to test projects.

Code Comments

All code must be thoroughly documented with XML doc comments:

Example

/// <summary>
/// Parses Terraform plan JSON and extracts resource changes.
/// </summary>
/// <param name="planFilePath">Absolute path to the plan JSON file.</param>
/// <returns>Collection of resource changes found in the plan.</returns>
/// <remarks>
/// Uses streaming deserialization for memory efficiency on large files.
/// Related feature: docs/features/008-comprehensive-demo/
/// </remarks>
internal async Task<IReadOnlyList<ResourceChange>> ParseAsync(string planFilePath)
{
    // Implementation
}

Local Development Setup

Prerequisites

Getting Started

# Clone the repository
git clone https://github.com/oocx/tfplan2md.git
cd tfplan2md

# Restore tools (including Husky for git hooks)
dotnet tool restore

# Install git hooks
dotnet husky install

# Build and test
dotnet build
dotnet test

Pre-commit Hooks

This project uses Husky.Net for git hooks:

If your commit is rejected:

  1. Format issues: Run dotnet format to fix formatting
  2. Build errors: Fix the build errors before committing
  3. Commit message: Ensure your message follows the format type: description

AI-Powered Development Workflow

This project was built 100% using GitHub Copilot with a multi-agent AI workflow.

Learn About the AI Workflow

Release Process

Releases are automated via GitHub Actions:

  1. When commits are pushed to main, the CI workflow runs Versionize
  2. If there are feat:, fix:, or BREAKING CHANGE commits, Versionize:
    • Bumps the version in .csproj
    • Updates CHANGELOG.md
    • Creates a git tag (e.g., v0.2.0)
  3. The tag push triggers the Release workflow which:
    • Creates a GitHub Release with changelog notes
    • Builds and pushes the Docker image to Docker Hub

Questions?

If you have questions, feel free to open an issue for discussion.