# redhat-community-ai-tools/code-to-docs architecture

> Architecture diagram of the GitHub repository redhat-community-ai-tools/code-to-docs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redhat-community-ai-tools/code-to-docs
- Repository: https://github.com/redhat-community-ai-tools/code-to-docs

## Overview

Code-to-Docs is a GitHub Action that turns PR-comment commands into documentation review suggestions or documentation updates, with an optional Jira/spec-versus-code review mode. The main runtime entry point is `src/suggest_docs.py`; it coordinates discovery, generation, interactive review, and GitHub operations. The README documents these product capabilities, while the source excerpts and SOURCE INDEX support the internal module links shown here. Some subsystem internals and exact runtime call sequences were not sampled, so those connections are omitted rather than inferred.

Main entry points: [`src/suggest_docs.py`](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/suggest_docs.py) (Command workflow), [`src/discovery.py`](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/discovery.py) (Doc discovery), [`src/jira_integration.py`](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/jira_integration.py) (Spec-code analysis), [`src/security_utils.py`](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/security_utils.py) (Path and secret safety)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Action workflow"]
  node_orchestrator["Command workflow<br/>[suggest_docs.py]"]
  node_review_comments["Review comments<br/>[comments.py]"]
end

subgraph group_docs["Documentation intelligence"]
  node_discovery["Doc discovery<br/>[discovery.py]"]
  node_doc_index[("Semantic doc index<br/>[doc_index.py]")]
  node_generation["Content generation<br/>[generation.py]"]
end

subgraph group_integrations["External integrations"]
  node_github_ops["GitHub operations<br/>[github_ops.py]"]
  node_jira_analysis["Spec-code analysis"]
end

subgraph group_shared["Configuration and safety"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_security["Path and secret safety<br/>[security_utils.py]"]
  node_utilities["Retry utilities<br/>[utils.py]"]
end

node_reviewer(("PR reviewer"))
node_github["GitHub"]
node_model["LLM service"]
node_jira["Jira"]
node_spec_docs["Linked spec documents"]

node_reviewer -->|"comments command"| node_orchestrator
node_orchestrator -->|"selects docs"| node_discovery
node_discovery -->|"uses indexes"| node_doc_index
node_orchestrator -->|"requests updates"| node_generation
node_orchestrator -->|"posts review"| node_review_comments
node_reviewer -->|"curates files"| node_review_comments
node_orchestrator -->|"publishes docs PR"| node_github_ops
node_github_ops -->|"creates PR"| node_github
node_orchestrator -->|"enables feature review"| node_jira_analysis
node_jira_analysis -->|"fetches ticket"| node_jira
node_jira_analysis -->|"fetches linked specs"| node_spec_docs
node_orchestrator -->|"loads settings"| node_config
node_discovery -->|"uses settings"| node_config
node_generation -->|"uses settings"| node_config
node_orchestrator -->|"uses safeguards"| node_security
node_discovery -->|"validates paths"| node_security
node_generation -->|"validates files"| node_security
node_github_ops -->|"runs safe commands"| node_security
node_doc_index -->|"uses settings"| node_config
node_doc_index -->|"uses safeguards"| node_security
node_jira_analysis -->|"uses settings"| node_config
node_jira_analysis -->|"uses safeguards"| node_security
node_review_comments -->|"uses settings"| node_config
node_review_comments -->|"uses safeguards"| node_security
node_discovery -->|"uses retry helpers"| node_utilities
node_generation -->|"generates content"| node_model
node_discovery -->|"selects relevant docs"| node_model
node_jira_analysis -->|"analyzes coverage"| node_model

click node_orchestrator "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/suggest_docs.py"
click node_review_comments "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/comments.py"
click node_github_ops "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/github_ops.py"
click node_discovery "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/discovery.py"
click node_doc_index "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/doc_index.py"
click node_generation "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/generation.py"
click node_jira_analysis "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/jira_integration.py"
click node_config "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/config.py"
click node_security "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/security_utils.py"
click node_utilities "https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_orchestrator,node_review_comments,node_reviewer toneBlue
class node_discovery,node_doc_index,node_generation toneAmber
class node_github_ops,node_jira_analysis toneMint
class node_config,node_security,node_utilities toneRose
class node_github,node_model,node_jira,node_spec_docs toneIndigo
```

## Components

### Action workflow

- [Command workflow](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/suggest_docs.py): `src/suggest_docs.py`
- [Review comments](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/comments.py): `src/comments.py`

### Documentation intelligence

- [Doc discovery](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/discovery.py): `src/discovery.py`
- [Semantic doc index](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/doc_index.py): `src/doc_index.py`
- [Content generation](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/generation.py): `src/generation.py`

### External integrations

- [GitHub operations](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/github_ops.py): `src/github_ops.py`
- [Spec-code analysis](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/jira_integration.py): `src/jira_integration.py`

### Configuration and safety

- [Runtime configuration](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/config.py): `src/config.py`
- [Path and secret safety](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/security_utils.py): `src/security_utils.py`
- [Retry utilities](https://github.com/redhat-community-ai-tools/code-to-docs/blob/main/src/utils.py): `src/utils.py`

### Other components

- **PR reviewer**
- **GitHub**
- **LLM service**
- **Jira**
- **Linked spec documents**

## Connections

- PR reviewer → Command workflow: comments command (evidence: `README.md`)
- Command workflow → Doc discovery: selects docs (evidence: `src/suggest_docs.py`)
- Doc discovery → Semantic doc index: uses indexes (evidence: `src/discovery.py`)
- Command workflow → Content generation: requests updates (evidence: `src/suggest_docs.py`)
- Command workflow → Review comments: posts review (evidence: `src/suggest_docs.py`)
- PR reviewer → Review comments: curates files (evidence: `README.md`)
- Command workflow → GitHub operations: publishes docs PR (evidence: `src/suggest_docs.py`)
- GitHub operations → GitHub: creates PR (evidence: `src/github_ops.py`)
- Command workflow → Spec-code analysis: enables feature review (evidence: `src/suggest_docs.py`)
- Spec-code analysis → Jira: fetches ticket (evidence: `src/jira_integration.py`)
- Spec-code analysis → Linked spec documents: fetches linked specs (evidence: `README.md`)
- Command workflow → Runtime configuration: loads settings (evidence: `src/suggest_docs.py`)
- Doc discovery → Runtime configuration: uses settings (evidence: `src/discovery.py`)
- Content generation → Runtime configuration: uses settings (evidence: `src/generation.py`)
- Command workflow → Path and secret safety: uses safeguards (evidence: `src/suggest_docs.py`)
- Doc discovery → Path and secret safety: validates paths (evidence: `src/discovery.py`)
- Content generation → Path and secret safety: validates files (evidence: `src/generation.py`)
- GitHub operations → Path and secret safety: runs safe commands (evidence: `src/github_ops.py`)
- Semantic doc index → Runtime configuration: uses settings (evidence: `src/doc_index.py`)
- Semantic doc index → Path and secret safety: uses safeguards (evidence: `src/doc_index.py`)
- Spec-code analysis → Runtime configuration: uses settings (evidence: `src/jira_integration.py`)
- Spec-code analysis → Path and secret safety: uses safeguards (evidence: `src/jira_integration.py`)
- Review comments → Runtime configuration: uses settings (evidence: `src/comments.py`)
- Review comments → Path and secret safety: uses safeguards (evidence: `src/comments.py`)
- Doc discovery → Retry utilities: uses retry helpers (evidence: `src/discovery.py`)
- Content generation → LLM service: generates content (evidence: `README.md`)
- Doc discovery → LLM service: selects relevant docs (evidence: `README.md`)
- Spec-code analysis → LLM service: analyzes coverage (evidence: `src/jira_integration.py`)
