Skip to content

robbrad/llmstxt-generator-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

llms.txt Generator

CI Release License: MIT

A GitHub Action that automatically generates llms.txt and llms-full.txt files from your markdown documentation, following the official llms.txt specification.

Features

  • πŸ“ Generates both llms.txt (index) and llms-full.txt (full content)
  • πŸ—‚οΈ Organizes documentation into customizable sections
  • πŸ”— Automatically extracts titles, descriptions, and generates URLs
  • 🎯 Supports glob patterns for file filtering
  • πŸ€– Optional auto-commit of generated files
  • ⚑ Fast recursive directory scanning
  • πŸ›‘οΈ Robust error handling and validation

Quick Start

Add this workflow to your repository at .github/workflows/generate-llms-txt.yml:

name: Generate llms.txt

on:
  push:
    branches: [main]
    paths:
      - 'docs/**'
      - '*.md'

jobs:
  generate:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    
    steps:
      - uses: actions/checkout@v4
      
      - name: Generate llms.txt files
        uses: robbrad/llmstxt-generator-github-action@0.0.1
        with:
          base-url: 'https://example.com'
          project-name: 'My Project'
          project-description: 'A brief description of my project'
          commit-changes: 'true'

Documentation

Usage Examples

Basic Usage

- uses: your-org/your-repo/src@v1
  with:
    base-url: 'https://example.com'
    project-name: 'My Project'

Multiple Sections

- uses: your-org/your-repo/src@v1
  with:
    base-url: 'https://example.com'
    project-name: 'My Project'
    sections: |
      {
        "Docs": "docs/**",
        "Guides": "guides/**",
        "Examples": "examples/**"
      }

Custom Directory

- uses: your-org/your-repo/src@v1
  with:
    input-directory: 'documentation'
    output-directory: 'public'
    base-url: 'https://docs.example.com'
    project-name: 'My Project'

Inputs

Input Required Default Description
base-url Yes - Base URL for generating links
project-name Yes - Project name for the H1 header
input-directory No . Directory containing markdown files
output-directory No . Directory for output files
project-description No '' Short project summary
exclude-pattern No '' Glob pattern for exclusions
sections No {"Docs": "**"} JSON mapping of sections
commit-changes No false Auto-commit generated files

Outputs

Output Description
files-processed Number of markdown files processed
llms-txt-path Path to generated llms.txt
llms-full-txt-path Path to generated llms-full.txt

Development

Setup

cd src
npm install

Build

npm run build

Test

# Unit tests
npm test

# Integration tests
npm run test:integration

# All tests
npm run test:all

Bundle

npm run bundle

Project Structure

.
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ actions/
β”‚   β”‚   └── llms-txt-generator/    # Main action code
β”‚   β”‚       β”œβ”€β”€ src               # TypeScript source
β”‚   β”‚       β”œβ”€β”€ tests/             # Integration tests
β”‚   β”‚       β”œβ”€β”€ dist/              # Compiled bundle
β”‚   β”‚       └── action.yml         # Action metadata
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml                 # CI pipeline
β”‚       β”œβ”€β”€ release.yml            # Release automation
β”‚       └── test-scenarios.yml     # Comprehensive tests
β”œβ”€β”€ CONTRIBUTING.md                # Contribution guide
β”œβ”€β”€ PUBLISHING.md                  # Release guide
└── README.md                      # This file

CI/CD Pipeline

The project includes comprehensive CI/CD:

  • CI Workflow: Runs on every push/PR

    • Unit tests
    • Integration tests
    • Build verification
    • Bundle size check
    • TypeScript compilation check
  • Release Workflow: Runs on tag push

    • Full test suite
    • Build and bundle
    • Create GitHub release
    • Generate changelog
    • Update major version tag
  • Test Scenarios: Comprehensive test coverage

    • Basic usage
    • Complex structures
    • Special characters
    • Exclude patterns
    • Empty/malformed files
    • Different file extensions

Testing

The action includes multiple test layers:

  1. Unit Tests: Test individual functions
  2. Integration Tests: Test the complete workflow
  3. Scenario Tests: Test real-world use cases

Run all tests:

cd src
npm run test:all

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Publishing

To publish a new version:

  1. Update version: npm version patch|minor|major
  2. Build: npm run package
  3. Commit: git add dist/ && git commit -m "chore: update bundle"
  4. Push: git push origin main --tags

See PUBLISHING.md for detailed instructions.

License

MIT

Resources

Support

Acknowledgments

Built following the llms.txt specification by Anthropic.

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •