Metadata-Version: 2.5
Name: guidelines-for-all
Version: 1.2.0
Summary: Generate coding guidelines from linter configurations
Project-URL: Homepage, https://github.com/coreyt/guidelines-for-all
Project-URL: Documentation, https://github.com/coreyt/guidelines-for-all#readme
Project-URL: Repository, https://github.com/coreyt/guidelines-for-all
Project-URL: Issues, https://github.com/coreyt/guidelines-for-all/issues
Author: Guidelines for All contributors
License-Expression: Elastic-2.0
License-File: LICENSE
Keywords: coding-guidelines,documentation,eslint,linting,ruff
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyjson5>=1.6.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: ruamel-yaml>=0.18.0
Requires-Dist: toml>=0.10.0
Requires-Dist: tomlkit>=0.13.0
Provides-Extra: dev
Requires-Dist: jsonschema>=4.0.0; extra == 'dev'
Requires-Dist: mypy>=1.8.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.5; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.2.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
Requires-Dist: types-toml>=0.10.0; extra == 'dev'
Provides-Extra: similarity
Requires-Dist: sentence-transformers>=2.2.0; extra == 'similarity'
Provides-Extra: tui
Requires-Dist: textual>=0.47.0; extra == 'tui'
Description-Content-Type: text/markdown

# Guidelines for All (`g4a`)

**Guidelines for All** manages linting configurations and generates living coding standards from them. The command is `g4a`.

## The name

Coding guidelines usually live in a wiki that nobody reads and that drifts out of sync with what the linters actually enforce. Guidelines for All works backward from the tools your team already runs, so the guidelines stay accurate and are available to everyone who touches the code, not just the people who wrote the lint config.

Until 1.2.0 the project was called **bosun** (and before that `bream` and `ling`). See [Migrating from bosun](#migrating-from-bosun).

## Overview

g4a does two things that are better together:

1. **Manage linting configurations** — Scan your codebase, detect conventions, scaffold linter configs, and catch rule conflicts across tools.
2. **Generate coding standards documentation** — Turn those linter configs into human-readable guidelines enriched with upstream rule documentation.

Most teams do these separately: they configure linters by hand, then write coding standards in a wiki that drifts out of sync within weeks. g4a connects both sides. The configs *are* the source of truth, and the documentation stays accurate because it's generated from them.

## Key Features

### Linting Configuration Management

- **Discover conventions from source code** — `g4a discover` scans your codebase with regex-based detectors across 8 dimensions (formatting, naming, imports, string-literals, documentation, modernize, type-safety, complexity) and generates linter configs that formalize what your team already does
- **Rule interference detection** — Finds conflicting rules between tools (e.g., ESLint `semi` vs Prettier `semi`) before they cause confusion
- **Interactive TUI** — Browse rules, manage presets, run the discover wizard, and detect interference from a terminal UI
- **Lint runner generation** — `g4a generate-script` creates a dual-mode bash script (check/fix) that gracefully handles missing tools

### Coding Standards Generation

- **Generate guidelines from linter configs** — Reads ESLint, Prettier, Ruff, Pyright, Roslyn, Checkstyle, PMD, SpotBugs, and 15 more tools, then enriches each rule with upstream documentation
- **15-dimension rule taxonomy** — Every rule is classified into a universal dimension (formatting, naming, imports, etc.) for consistent organization across tools and languages
- **Multiple output formats** — Markdown, DOCX (via Pandoc), composed documents with stub + transition + appendices
- **AI-friendly rule export** — `g4a export-rules` outputs all configured rules as structured JSON/YAML/Markdown for LLM consumption

### Why One Tool?

Both functions share the same infrastructure — config parsers, rule metadata, interference detection, and the cache layer. A team using `discover` to bootstrap their linting setup can immediately run `build` to generate documentation from those same configs. That's a natural workflow: **discover → configure → document**.

## Status

**v1.2.0** (in preparation) - Beta. v1.2.0 is the next release after v1.0.0; the 1.1.0 work was never released separately and is included in 1.2.0. See [CHANGELOG.md](CHANGELOG.md).

**Tests**: 2,164 collected with all extras (as of 2026-10-17)

## Migrating from bosun

Nothing breaks when you upgrade. Everything that used the old name keeps working in 1.2.0 and prints a deprecation notice; the old names will be removed in a future release.

| Before (bosun) | Now (Guidelines for All) | Compatibility in 1.2.0 |
|---|---|---|
| `bosun` command | `g4a` (or the long form `guidelines-for-all`) | `bosun` still works and prints a notice |
| `bosun.yaml` | `g4a.yaml` | `bosun.yaml` is read when `g4a.yaml` does not exist; `g4a.yaml` wins when both exist |
| `.bosun-cache/` | `.g4a-cache/` | An existing `.bosun-cache/` is reused when the cache location is left at the default |
| `import bosun` | `import g4a` | `bosun` and `bosun.<module>` resolve to the same `g4a` modules; `BosunConfig` and `BosunError` remain as aliases of `G4AConfig` and `G4AError` |
| Plugin entry point group `bosun.adapters` | `g4a.adapters` | Plugins in the old group are still loaded, with a notice |
| PyPI package (never published as bosun) | `guidelines-for-all` | Not yet published |

To rename config files across many projects at once, run `scripts/rename-config.sh <directory>`. It renames `bosun.yaml` (and the older `ling.yaml` and `bream.yaml`) to `g4a.yaml` and skips any project that already has a `g4a.yaml`.

One name did not change: the source repository is still `github.com/coreyt/guidelines-for-all`.

## Installation

The package is not on PyPI yet. When it is published, the package name will be `guidelines-for-all`. Until then, install from source.

### From Source

```bash
# Clone the repository
git clone https://github.com/coreyt/guidelines-for-all.git
cd guidelines-for-all

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Or install without dev dependencies
pip install -e .

# Verify installation
g4a --version
```

### Requirements

- **Python 3.10+** (required)
- **Pandoc** (optional, for DOCX output) - [Install Pandoc](https://pandoc.org/installing.html)
- **GitHub Token** (recommended) - Without a token, GitHub API is limited to 60 requests/hour. A typical first sync needs 100+ requests. See [GitHub Authentication](#github-authentication) below.

## Quick Start

### Path A: You already have linter configs (generate documentation)

If your project has ESLint, Ruff, Prettier, or other linter configuration files:

```bash
# 1. Initialize — auto-detects your linter configs and creates g4a.yaml
g4a init

# 2. Fetch upstream rule documentation (from cache or GitHub API)
g4a sync

# 3. Generate coding guidelines
g4a build                    # Full document (stub + transition + appendices), Markdown
g4a build --markdown-only    # One Markdown file per tool instead
g4a build --format docx      # Word document (requires Pandoc)
```

### Path B: Starting from scratch (set up linting + generate documentation)

If your codebase has no linter configs, `g4a discover` scans your source code to detect existing conventions, scaffolds linter configs, and sets up g4a — so you can go from zero to documented coding standards in one workflow:

```bash
# 1. Scan source code and generate linter configs + g4a.yaml in one step
g4a discover --apply

# 2. Review what was detected
g4a discover --format json   # See all findings as structured data
g4a discover --dry-run       # Preview configs without writing

# 3. Check for rule conflicts across tools
g4a check-interference

# 4. Generate coding standards from the configs you just created
g4a sync
g4a build
```

`discover` detects conventions across 8 dimensions (formatting, naming, imports, string-literals, documentation, modernize, type-safety, complexity) for Python, JavaScript, TypeScript, Rust and Go.

### Avoiding GitHub Rate Limits

`g4a sync` and `g4a build` fetch rule documentation from GitHub and cache it in
`.g4a-cache/` (7 days by default), so later builds work offline. Set
`GITHUB_TOKEN` to raise the limit from 60 to 5,000 requests per hour:

```bash
export GITHUB_TOKEN=your_token_here
g4a sync
```

Pre-cached rule downloads (`g4a cache --download`) are not available in 1.2.0;
see [Using Cached Rules](docs/11-using-cached-rules.md).

### Other Commands

```bash
g4a check                    # Validate configuration
g4a list-rules               # List all rules and their status
g4a check-interference       # Find conflicting rules between tools
g4a export-rules             # Export rules as JSON/YAML/Markdown for AI tools
g4a build --appendix-only    # Generate only appendices
g4a build --lint             # Lint generated markdown
```

## Supported Tools

23 adapters. Config file names are the ones each adapter detects automatically; any path can also be set with `config_path` in `g4a.yaml`.

### TypeScript/JavaScript
| Tool | Config files detected |
|------|----------------------|
| ESLint | `eslint.config.{js,mjs,cjs,ts}` (flat config), `.eslintrc.json`, `.eslintrc`, `.eslintrc.yaml`, `.eslintrc.yml` |
| TypeScript-ESLint | `.eslintrc.json`, `.eslintrc`, `.eslintrc.yaml`, `.eslintrc.yml` (`@typescript-eslint/*` rules) |
| TSConfig | `tsconfig.json` |

### Python
| Tool | Config files detected |
|------|----------------------|
| Ruff | `ruff.toml`, `.ruff.toml`, `pyproject.toml` |
| Pyright | `pyrightconfig.json`, `pyproject.toml` |
| mypy | `mypy.ini`, `.mypy.ini`, `setup.cfg`, `pyproject.toml` |

### C#/.NET
| Tool | Config files detected |
|------|----------------------|
| Roslyn analyzers | `.editorconfig`, `.globalconfig` |
| StyleCop Analyzers | `stylecop.json`, `.stylecop.json`, `.editorconfig` (SA* rules) |

> **Note:** `dotnet format` enforces `.editorconfig` settings using Roslyn analyzers. Its rules (IDE*) are covered by the Roslyn adapter, so it needs no separate adapter.

### Java
| Tool | Config files detected |
|------|----------------------|
| Checkstyle | `checkstyle.xml`, `config/checkstyle/checkstyle.xml`, `checkstyle-config.xml`, `.checkstyle.xml` |
| PMD | `pmd.xml`, `ruleset.xml`, `pmd-ruleset.xml`, `.pmd.xml`, `pmd-rules.xml` |
| SpotBugs | `spotbugs-exclude.xml`, `spotbugs-include.xml`, `spotbugs.xml`, and the `findbugs-*.xml` equivalents |

### C/C++
| Tool | Config files detected |
|------|----------------------|
| Clang-Tidy | `.clang-tidy` |
| clang-format | `.clang-format`, `_clang-format` |

### Rust
| Tool | Config files detected |
|------|----------------------|
| Clippy | `Cargo.toml` (`[lints.clippy]`) |
| rustfmt | `rustfmt.toml`, `.rustfmt.toml` |

### Go
| Tool | Config files detected |
|------|----------------------|
| golangci-lint | `.golangci.yml`, `.golangci.yaml`, `.golangci.json`, `.golangci.toml` |

### Lua
| Tool | Config files detected |
|------|----------------------|
| Luacheck | `.luacheckrc`, `.luacheck` |

### Markdown
| Tool | Config files detected |
|------|----------------------|
| Markdownlint | `.markdownlint-cli2.{jsonc,yaml}`, `.markdownlint.{jsonc,json,yaml,yml}` |
| PyMarkdown | `.pymarkdown`, `.pymarkdown.{json,yml,yaml}` |

### Multi-language
| Tool | Config files detected |
|------|----------------------|
| Prettier | `.prettierrc`, `.prettierrc.{json,yaml,yml,toml}` |
| Semgrep | `.semgrep.yaml`, `.semgrep.yml`, `semgrep.yaml`, `semgrep.yml`, `.semgrep` (rules document themselves) |
| SonarQube | Quality Profile XML export: `sonar-quality-profile.xml`, `quality-profile.xml`, `sonar-profile.xml`, `sonar-profile-backup.xml`, `sonarqube-profile.xml`. Known issue in 1.2.0: upstream rule text is not fetched; appendices list rule keys, severities and parameters |
| Lookout (formerly Sine) | `lookout.toml`, `[tool.lookout]` in `pyproject.toml`, `.lookout-rules/`, `.lookout-baseline.json` (architectural rules; project rules plus Lookout's built-in patterns). Old `sine.*` names still detected |

Document framing (the ecosystem-specific introduction in generated guidelines) exists for JavaScript/TypeScript, Python, C#/.NET, Java, C/C++, Rust, Go, Lua and Markdown. A project that enables only multi-language tools (Prettier, Semgrep, SonarQube) gets neutral framing.

## Commands

### Configuration Management

| Command | Description |
|---------|-------------|
| `g4a init` | Create g4a.yaml from detected linter configurations |
| `g4a discover` | Scan source code to detect conventions and generate linter configs |
| `g4a check` | Validate configurations and report status |
| `g4a check-interference` | Check for rule conflicts between tools |
| `g4a generate-script` | Generate a bash lint runner script (check/fix modes) |
| `g4a init-practices` | Initialize best-practices guidelines from a preset |
| `g4a tui` | Launch the interactive terminal UI (needs the `tui` extra) |

### Documentation Generation

| Command | Description |
|---------|-------------|
| `g4a sync` | Fetch/update rule documentation cache |
| `g4a build` | Generate guidelines documentation |
| `g4a list-rules` | List all rules and their applied status |
| `g4a export-rules` | Export configured rules as JSON, YAML, or Markdown |
| `g4a cache` | Manage the rule documentation cache (`--download`, `--status`, `--clear`) |
| `g4a wake-export` | Export lint constraints to wake for Claude Code context |

### Global Options

| Option | Description |
|--------|-------------|
| `--config PATH` | Path to g4a.yaml (default: ./g4a.yaml) |
| `--directory PATH` | Run g4a in the specified directory (useful for testing configs) |
| `--verbose` | Enable verbose output |
| `--quiet` | Suppress non-error output |
| `--version` | Show version |

### Testing Linter Configurations

The `--directory` option allows you to test linter configurations before applying them to your project:

```bash
# Create a test directory with your proposed linter configs
mkdir test-configs
cp .eslintrc.json test-configs/
# Make changes to test-configs/.eslintrc.json

# Initialize g4a in the test directory
g4a --directory test-configs init

# Validate the configuration
g4a --directory test-configs check

# Preview what rules would be documented
g4a --directory test-configs list-rules

# Generate test documentation
g4a --directory test-configs build
```

This workflow enables:
- Testing new linter configurations before deploying them
- Comparing different configuration options side-by-side
- Validating configurations in CI/CD pipelines

## Configuration

g4a uses a `g4a.yaml` file to configure which tools to process and how to generate output.

```yaml
project:
  name: "My Project"
  version: "1.0.0"

tools:
  eslint:
    enabled: true
    config_path: .eslintrc.json
  prettier:
    enabled: true
    config_path: .prettierrc

output:
  markdown:
    enabled: true
    output_dir: ./docs/guidelines
  docx:
    enabled: false
    template: null  # Optional: custom Word template

cache:
  directory: .g4a-cache
  ttl_days: 7  # Recommended: 7 for active dev, 30 for stable projects

github:
  token: null  # Or set GITHUB_TOKEN env var (recommended for large projects)
  api_base_url: https://api.github.com

# Document composition (optional)
document:
  stub: null            # Path to custom stub (uses default if null)
  transition: null      # Path to custom transition section
  appendices:
    style: alpha        # 'alpha' (A, B, C) or 'numeric' (1, 2, 3)
    prefix: Appendix    # e.g., "Appendix A: ESLint Rules"
```

### Document Composition

g4a can generate complete coding standards documents with a professional structure:

```
┌─────────────────────────────────────┐
│  Primary Document Stub              │  ← Purpose, scope, definitions
│  (customizable boilerplate)         │
├─────────────────────────────────────┤
│  Transition Section                 │  ← How to read appendices
│  (appendix index)                   │
├─────────────────────────────────────┤
│  Appendix A: ESLint Rules           │
│  Appendix B: Prettier Rules         │  ← Generated from linter configs
│  Appendix C: Ruff Rules             │
│  ...                                │
└─────────────────────────────────────┘
```

**Usage:**

```bash
# Full document with stub + transition + appendices (the default)
g4a build

# Appendices only (for integration into existing documents)
g4a build --appendix-only

# Combined with DOCX output
g4a build --format docx
```

**Customization:**

Create custom stub and transition documents:

```yaml
document:
  stub: docs/my-coding-standards-intro.md
  transition: docs/my-transition.md
  appendices:
    style: alpha
    prefix: "Annex"  # Results in "Annex A: ESLint Rules"
```

### Rule Interference Detection

g4a can detect conflicting rules between different tools. Common conflicts include:
- ESLint `semi` vs Prettier `semi` (semicolon handling)
- ESLint `quotes` vs Prettier `singleQuote` (quote style)
- ESLint `no-unused-vars` vs TypeScript-ESLint `no-unused-vars` (should use TS version)

**Check for conflicts:**

```bash
# Check for rule interference
g4a check-interference

# Output as JSON
g4a check-interference --format json

# Fail with exit code 5 if conflicts found
g4a check-interference --fail-on-conflict
```

**Configuration:**

```yaml
interference:
  enabled: true              # Enable interference detection
  on_conflict: warn          # 'warn' or 'error' (blocks build)
  confidence_threshold: 0.7  # Threshold for heuristic detection (0.0-1.0)
  ignore:                    # Pairs to ignore (intentional layered enforcement)
    - "eslint/semi:prettier/semi"
    - "eslint/quotes:prettier/singleQuote"
```

Interference detection runs automatically during `g4a build` and can be configured to block builds when conflicts are detected.

### PyMarkdown Output Linting

g4a can lint generated markdown files using pymarkdown with presets optimized for different target environments:

- **pandoc**: Relaxed rules for Pandoc's extended markdown (default)
- **gfm**: Stricter rules for GitHub-flavored markdown

**Configuration:**

```yaml
pymarkdown_lint:
  enabled: true           # Disabled by default
  preset: pandoc          # 'pandoc' or 'gfm'
  fail_on_error: false    # Fail build on lint errors
  config_path: null       # Custom config (overrides preset)
```

**Preset Differences:**

| Feature | Pandoc Preset | GFM Preset |
|---------|---------------|------------|
| Line length | 120 chars | 80 chars |
| Inline HTML | Allowed | Limited tags only |
| Code block language | Optional | Required |
| Blank line limits | 2 consecutive | 1 consecutive |
| Duplicate headings | Siblings only | None allowed |

**Requirements:** `pip install pymarkdownlnt`

### GitHub Authentication

The GitHub API has rate limits:
- **Unauthenticated**: 60 requests/hour
- **Authenticated**: 5,000 requests/hour

For projects with many linter rules, you'll need to authenticate with a GitHub personal access token.

#### Creating a GitHub Token

1. Go to [GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)](https://github.com/settings/tokens)
2. Click **Generate new token** → **Generate new token (classic)**
3. Give it a descriptive name (e.g., "g4a-cli")
4. Select the **public_repo** scope (or no scopes if you only access public repositories)
5. Click **Generate token**
6. Copy the token immediately (you won't see it again)

#### Setting the Token (Temporary)

Export the token in your current terminal session:

```bash
export GITHUB_TOKEN=ghp_your_token_here
g4a sync
```

This token will only be available in the current terminal session.

#### Setting the Token (Persistent)

To make the token available in all future terminal sessions, add it to your shell configuration file:

**For Bash** (`~/.bashrc` or `~/.bash_profile`):
```bash
echo 'export GITHUB_TOKEN=ghp_your_token_here' >> ~/.bashrc
source ~/.bashrc
```

**For Zsh** (`~/.zshrc`):
```bash
echo 'export GITHUB_TOKEN=ghp_your_token_here' >> ~/.zshrc
source ~/.zshrc
```

**For Fish** (`~/.config/fish/config.fish`):
```fish
set -Ux GITHUB_TOKEN ghp_your_token_here
```

#### Verifying the Token

After setting the token, verify it's available:

```bash
echo $GITHUB_TOKEN
# Should print your token (or a portion of it)

# Or check g4a can access it
g4a check --verbose
```

#### Security Notes

- Never commit your token to version control
- Consider using a `.env` file with a tool like [direnv](https://direnv.net/) for project-specific tokens
- Tokens can be revoked at any time from your GitHub settings

## Architecture

g4a's two functions share a common infrastructure layer:

```
                    ┌──────────────────────────────────────────────────────────┐
                    │                  CLI (Click) / TUI (Textual)            │
                    └───────────────────────┬──────────────────────────────────┘
                                            │
              ┌─────────────────────────────┼─────────────────────────────┐
              │                             │                             │
    ┌─────────▼──────────┐     ┌────────────▼───────────┐    ┌───────────▼──────────┐
    │ Config Management  │     │   Shared Infrastructure │    │  Doc Generation      │
    │                    │     │                         │    │                      │
    │ • discover         │     │  ┌───────────────────┐  │    │ • sync               │
    │ • init             │◄───►│  │  Tool Adapters    │  │◄──►│ • build              │
    │ • check-interference│     │  │  (23 adapters)    │  │    │ • list-rules         │
    │ • generate-script  │     │  └───────────────────┘  │    │ • export-rules       │
    └────────────────────┘     │  ┌───────────────────┐  │    └──────────────────────┘
                               │  │  Rule Data +      │  │
                               │  │  Interference DB  │  │
                               │  └───────────────────┘  │
                               │  ┌───────────────────┐  │
                               │  │  Cache + Fetcher  │  │
                               │  └───────────────────┘  │
                               └─────────────────────────┘
```

The **config management** side reads and writes linter configs. The **doc generation** side reads those same configs and enriches them with upstream documentation. Both use the same adapters, rule data, and cache.

## Development

```bash
# Clone and install
git clone https://github.com/coreyt/guidelines-for-all.git
cd guidelines-for-all
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=g4a

# Run linting
ruff check src/g4a/ tests/

# Run type checking
mypy src/g4a/
```

### Project Structure

```
g4a/
├── src/g4a/              # Source code (src layout)
│   ├── adapters/           # Tool-specific config parsers (23 adapters)
│   ├── scanner/            # Codebase convention scanner
│   │   ├── analyzer.py     # CodebaseAnalyzer — core scan logic
│   │   ├── recommender.py  # Findings → linter rule recommendations
│   │   ├── patterns.py     # PatternRegistry — loads scanner-patterns.yaml
│   │   └── file_sampler.py # Smart file sampling
│   ├── tui/                # Terminal UI (Textual)
│   │   ├── app.py          # G4AApp main application
│   │   ├── screens/        # Dashboard, Browser, Writer, Setup, Discover
│   │   └── widgets/        # Rule list, detail, interference panel, etc.
│   ├── data/               # Static data (linters, conflicts, dimensions, scanner patterns)
│   ├── outputs/            # Markdown + DOCX renderers
│   ├── cli.py              # Click CLI commands
│   ├── config.py           # Pydantic configuration models
│   ├── dimensions.py       # 15-dimension rule taxonomy
│   ├── matcher.py          # Rule matching logic
│   ├── interference.py     # Rule interference detection
│   ├── scaffolder.py       # G4AYamlGenerator
│   └── export.py           # AI-friendly rule export
├── tests/                  # 2,164 tests (all extras, 2026-10-17)
├── docs/                   # Design + user documentation
└── pyproject.toml          # Project configuration
```

## Updating Rule Cache (Maintainers)

g4a caches fetched rule documentation in `.g4a-cache/` with a time-to-live
(7 days by default). `g4a cache --status` shows what is cached and
`g4a cache --clear` empties it.

**Not available in 1.2.0:** distributing a pre-built cache. Earlier versions
documented `rule_cache_YYYYMMDD` git branches, `g4a cache --download` and
`scripts/update-rule-cache.sh`. No such branch is published, the script depends
on a fetch-all script that was never committed, and `cache --download` looks in
the current project's git remote rather than g4a's. A working replacement
(a cache published with each release) is planned for 1.2.x. See
[Using Cached Rules](docs/11-using-cached-rules.md).

## Testing DOCX Output

g4a generates formatted Word documents through a sophisticated pipeline with Pandoc and custom Lua filters. To test DOCX output generation:

```bash
# Set up DOCX template (one-time setup)
./scripts/setup-docx-template.sh

# Run comprehensive DOCX tests
./scripts/test-docx-output.sh

# Keep temporary files for inspection
./scripts/test-docx-output.sh --keep-temp
```

This tests:
- Table of Contents generation
- Page breaks and orientation changes
- Multi-level list styling (Bullet List 1/2/3, Ordered List 1/2/3)
- Table styling (TableCompact)
- Custom styled containers (GrayBlock)
- All 6 Lua filter transformations

See [Testing DOCX Output](docs/12-testing-docx-output.md) for detailed guide.

## Documentation

Detailed documentation is available in the `docs/` directory:

- [Usage Guide](docs/usage-guide.md) - Complete usage guide with examples
- [Using Cached Rules](docs/11-using-cached-rules.md) - Pre-cached rule distribution (not available in 1.2.0)
- [Adding Linter Adapters](docs/10-adding-linter-adapters.md) - How to add new linter support
- [Codebase Analyzer](docs/14-codebase-analyzer.md) - Convention detection from source code
- [Testing DOCX Output](docs/12-testing-docx-output.md) - DOCX generation pipeline testing guide
- [Developer Notes](docs/developer-notes.md) - Internal developer notes
- [Changelog](CHANGELOG.md) - Release history
- [Roadmap](ROADMAP.md) - What is planned next

## License

Licensed under the [Elastic License 2.0](LICENSE) (ELv2). ELv2 is a source-available license; it is not an OSI-approved open-source license.

In plain terms (the [LICENSE](LICENSE) text is what governs), you may use, copy, modify and redistribute the software, including inside your company and in your CI pipelines, but you may not:

- provide it to third parties as a hosted or managed service that gives them access to a substantial part of its features;
- move, change, disable or circumvent any license-key functionality;
- alter, remove or obscure licensing, copyright or other notices.

### License history

- Up to and including **v1.0.0** (January 2026, released under the earlier name `ling`): MIT. Anyone who received v1.0.0 keeps the MIT rights to that version.
- From the March 2026 relicense onward, including **v1.2.0**: Elastic License 2.0.
