Skip to content

markus41/LangGang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LangGang

AI-Powered Code Templating Framework

LangGang combines the power of LangChain, LangGraph, Cookiecutter, Copier, and Maven Archetypes to create an intelligent code scaffolding system. Transform developer workflows with AI-assisted template generation and multi-framework integration.

Python Version License: MIT

πŸš€ Features

  • Multiple Template Systems: Support for Cookiecutter, Copier, and Maven Archetypes
  • LangChain Integration: AI-powered template selection and generation
  • LangGraph Workflows: Multi-step code generation with state management
  • MCP Protocol: Model Context Protocol servers for AI assistant integration
  • Documentation Access: Built-in MCP servers for LangChain/LangGraph docs
  • LLM CLI Integration: MCP tools for executing Gemini, Codex, OpenAI, and Anthropic CLI commands
  • Harness CI/CD: Automated pipeline configuration
  • Claude Code & Copilot: Enhanced IDE integration with agents and skills

πŸ“‹ Table of Contents

πŸ”§ Installation

Prerequisites

  • Python 3.9 or higher
  • Maven 3.x (for Maven archetypes)
  • Git

Basic Installation

# Clone the repository
git clone https://github.com/markus41/LangGang.git
cd LangGang

# Install dependencies
pip install -r requirements.txt

# Or install as a package
pip install -e .

Development Installation

# Install with development dependencies
pip install -r requirements.txt
pip install -e ".[dev]"

πŸƒ Quick Start

Using MCP Server

from langgang.mcp_server import LangGangMCPServer

# Initialize server
server = LangGangMCPServer()

# List available templates
templates = server.list_templates()
print(templates)

# Generate from Cookiecutter template
result = server.generate_from_cookiecutter(
    template_name="python-langchain-project",
    output_dir="./my-project",
    context={
        "project_name": "My AI App",
        "author": "Your Name",
        "use_langchain": "y"
    }
)

Using LangChain Tools

from langgang.langchain_integration import get_langgang_tools

# Get LangChain tools for template generation
tools = get_langgang_tools()

# Use with LangChain agents
from langchain.agents import AgentExecutor
# ... create agent with tools

Using LangGraph Workflows

from langgang.langgraph_integration import create_template_generation_graph

# Create workflow graph
graph = create_template_generation_graph()

# Run workflow
result = graph.invoke({
    "project_description": "Python Flask API with authentication"
})

πŸ“¦ Template Types

Cookiecutter Templates

Located in templates/cookiecutter/

Features:

  • Python-based templating with Jinja2
  • Rich filter support
  • Best for Python projects and data science

Example:

# Using cookiecutter CLI
cookiecutter templates/cookiecutter/python-langchain-project/

# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_cookiecutter('python-langchain-project', './output', {})"

Copier Templates

Located in templates/copier/

Features:

  • Modern templating with update support
  • YAML configuration
  • Best for projects that evolve with templates

Example:

# Using copier CLI
copier copy templates/copier/langgraph-agent/ ./my-agent

# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_copier('langgraph-agent', './output', {})"

Maven Archetypes

Located in templates/maven/

Features:

  • Java/JVM project templating
  • Standard Maven conventions
  • Best for enterprise Java applications

Example:

# Using Maven CLI
mvn archetype:generate \
  -DarchetypeGroupId=com.langgang \
  -DarchetypeArtifactId=langchain-java-archetype

# Using LangGang
python -c "from langgang.mcp_server import LangGangMCPServer; \
server = LangGangMCPServer(); \
server.generate_from_maven_archetype('langchain-java-archetype', './output', {})"

πŸ”Œ MCP Integration

LangGang provides Model Context Protocol (MCP) servers for AI assistant integration.

Available MCP Servers

  1. Template Generation Server (langgang.mcp_server)

    • Generate code from templates
    • List available templates
    • Support for all template types
  2. Documentation Server (langgang.docs_mcp_server)

    • Search LangChain documentation
    • Search LangGraph documentation
    • Get code examples
    • List available documentation
  3. LLM CLI Server (langgang.llm_cli_mcp_server)

    • Execute Gemini CLI commands
    • Execute Codex CLI commands
    • Execute OpenAI CLI commands
    • Execute Anthropic CLI commands
    • Convenience methods for common operations (chat, generate)
    • Automatic CLI availability detection

Configuration

MCP servers are configured in mcp-config.json:

{
  "mcpServers": {
    "langgang-templates": {
      "command": "python",
      "args": ["-m", "langgang.mcp_server"]
    },
    "langchain-docs": {
      "command": "python",
      "args": ["-m", "langgang.docs_mcp_server"]
    }
  }
}

Running MCP Servers

# Start template generation server
python -m langgang.mcp_server

# Start documentation server
python -m langgang.docs_mcp_server

# Start LLM CLI server
python -m langgang.llm_cli_mcp_server

Using LLM CLI Tools

The LLM CLI MCP server allows agents to execute CLI commands for various LLM providers:

from langgang.llm_cli_mcp_server import LLMCliMCPServer

server = LLMCliMCPServer()

# Check available CLIs
clis = server.list_available_clis()
print(clis)  # {"gemini": True, "codex": False, ...}

# Execute Gemini chat
result = server.gemini_chat(
    prompt="Explain LangChain",
    model="gemini-pro",
    temperature=0.7
)

# Execute Codex generate
result = server.codex_generate(
    prompt="Create a Python function",
    model="gpt-4"
)

# Execute custom CLI command
result = server.execute_gemini_cli(
    command="chat",
    args=["--model", "gemini-1.5-pro", "Your prompt here"]
)

Security: All commands are sanitized to prevent command injection attacks.

πŸ€– LangChain & LangGraph

LangChain Tools

LangGang provides LangChain tools for template generation:

from langgang.langchain_integration import (
    TemplateGenerationTool,
    ListTemplatesTool,
    get_langgang_tools
)

# Use individual tools
list_tool = ListTemplatesTool()
result = list_tool._run()

gen_tool = TemplateGenerationTool()
result = gen_tool._run(
    template_type="cookiecutter",
    template_name="python-langchain-project",
    output_directory="./output",
    context={"project_name": "My App"}
)

# Or get all tools at once
tools = get_langgang_tools()

LangGraph Workflows

Multi-step template generation workflows:

from langgang.langgraph_integration import create_template_generation_graph

# Create workflow
graph = create_template_generation_graph()

# Execute workflow
result = graph.invoke({
    "project_description": "FastAPI application with authentication",
    "context_variables": {
        "project_name": "my_api",
        "author": "Developer"
    }
})

Workflow Steps:

  1. Analyze requirements
  2. Select appropriate template
  3. Gather context variables
  4. Generate code
  5. Validate output

🎯 AI Assistant Integration

Claude Code Integration

LangGang includes extensive Claude Code configurations in .claude/:

  • Agents: Specialized agents for template generation, LangChain development, MCP development, and CI/CD
  • MCPs: MCP server configurations
  • Skills: Reusable skills for common tasks
  • Slash Commands: Quick commands for template operations

Using Claude Code:

# Claude Code automatically loads configurations from .claude/
# See .claude/claude.md for full documentation

GitHub Copilot Integration

Copilot configurations in .copilot/:

  • Agents: Context-aware coding assistants
  • Extensions: Workspace-specific Copilot extensions
  • Code Patterns: Templates and snippets

Using GitHub Copilot:

# Copilot automatically uses configurations from .copilot/
# See .copilot/copilot.md for full documentation

πŸ› οΈ Development

Project Structure

LangGang/
β”œβ”€β”€ .claude/              # Claude Code configurations
β”‚   β”œβ”€β”€ agents/          # Specialized agents
β”‚   β”œβ”€β”€ mcps/            # MCP configurations
β”‚   β”œβ”€β”€ skills/          # Reusable skills
β”‚   β”œβ”€β”€ slash-commands/  # Quick commands
β”‚   └── claude.md        # Claude documentation
β”œβ”€β”€ .copilot/            # GitHub Copilot configurations
β”‚   β”œβ”€β”€ agents/          # Copilot agents
β”‚   β”œβ”€β”€ extensions/      # Copilot extensions
β”‚   └── copilot.md       # Copilot documentation
β”œβ”€β”€ .harness/            # Harness CI/CD pipelines
β”œβ”€β”€ langgang/            # Main Python package
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ mcp_server.py
β”‚   β”œβ”€β”€ docs_mcp_server.py
β”‚   β”œβ”€β”€ langchain_integration.py
β”‚   └── langgraph_integration.py
β”œβ”€β”€ templates/           # Template collections
β”‚   β”œβ”€β”€ cookiecutter/
β”‚   β”œβ”€β”€ copier/
β”‚   └── maven/
└── tests/               # Test suite

Running Tests

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=langgang --cov-report=html

# Run specific test file
pytest tests/test_mcp_server.py -v

Code Quality

# Format code
black langgang/

# Lint code
ruff check langgang/

# Type checking
mypy langgang/

Pre-commit Hooks

LangGang uses pre-commit hooks to ensure code quality and consistency. Hooks automatically run on git commit to:

  • Format code with Black
  • Lint and fix issues with Ruff (including naming conventions)
  • Type check with mypy
  • Run tests to ensure repo works
  • Check for security issues with Bandit
  • Validate file formats (YAML, JSON, TOML)

Installation:

# Install pre-commit (if not already installed)
pip install pre-commit

# Install git hooks
pre-commit install

# Or use the convenience script
./scripts/install-hooks.sh  # Linux/Mac
./scripts/install-hooks.ps1  # Windows PowerShell

Manual execution:

# Run hooks on all files
pre-commit run --all-files

# Run specific hook
pre-commit run ruff --all-files

Naming Conventions: The hooks enforce consistent naming:

  • Functions/Methods: snake_case
  • Classes: PascalCase
  • Constants: UPPER_SNAKE_CASE
  • Private functions/methods: _leading_underscore
  • Variables: snake_case

See pyproject.toml for full configuration.

CI/CD

LangGang uses Harness for CI/CD. Pipeline configuration is in .harness/:

  • pipeline.yaml: Main CI/CD pipeline
  • trigger.yaml: PR and push triggers

πŸ“š Documentation

Official Documentation

LangGang Documentation

  • .claude/claude.md: Claude Code integration guide
  • .copilot/copilot.md: GitHub Copilot integration guide
  • API documentation: Generated from docstrings

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run tests and linting
  6. Submit a pull request

Coding Standards

  • Follow PEP 8 for Python code
  • Use type hints everywhere
  • Add docstrings to all public APIs
  • Write tests for new features
  • Keep commits focused and atomic

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • LangChain team for the amazing framework
  • Cookiecutter and Copier communities
  • Maven project for archetype system
  • Model Context Protocol creators

πŸ“§ Contact


Made with ❀️ by the LangGang community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages