# diplodoc-platform/cli architecture

> Architecture diagram of the GitHub repository diplodoc-platform/cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/diplodoc-platform/cli
- Repository: https://github.com/diplodoc-platform/cli

## Overview

Yfm-docs is a documentation-project CLI: users initialize projects, process Markdown content, and use the broader YFM documentation tooling. The visible runtime centers on command dispatch and shared project services for configuration, file access, Markdown, variables, navigation, and metadata; translation and publishing are additional command branches. The README documents full builds, but the supplied tree has no build-command source, so that implementation is not mapped. Edges use README statements or SOURCE INDEX references; unsampled command internals are not inferred.

Main entry points: [`src/commands/translate/index.ts`](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/index.ts) (Translation commands), [`src/commands/index.ts`](https://github.com/diplodoc-platform/cli/blob/master/src/commands/index.ts) (Command registry), [`src/commands/content/index.ts`](https://github.com/diplodoc-platform/cli/blob/master/src/commands/content/index.ts) (Content command), [`src/index.ts`](https://github.com/diplodoc-platform/cli/blob/master/src/index.ts) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and setup"]
  node_entrypoint["CLI entry<br/>[index.ts]"]
  node_registry["Command registry<br/>[index.ts]"]
  node_program["Program runtime<br/>[index.ts]"]
  node_initializer["Project initializer<br/>[index.ts]"]
  node_publish["Publish command<br/>[index.ts]"]
end

subgraph group_docs["Documentation processing"]
  node_content["Content command<br/>[index.ts]"]
  node_markdown["Markdown processing<br/>[MarkdownService.ts]"]
  node_toc["Navigation TOC<br/>[TocService.ts]"]
  node_metadata["Page metadata<br/>[MetaService.ts]"]
  node_leading["Leading content<br/>[LeadingService.ts]"]
end

subgraph group_services["Project services"]
  node_config["Config resolver<br/>[index.ts]"]
  node_run["Project run<br/>[index.ts]"]
  node_variables["Variable presets<br/>[VarsService.ts]"]
end

subgraph group_extensions["Integrations"]
  node_vcs["VCS service<br/>[VcsService.ts]"]
  node_github["GitHub connector<br/>[connector.ts]"]
  node_arcadia["Arcadia connector<br/>[connector.ts]"]
  node_search["Local search<br/>[provider.ts]"]
end

subgraph group_translation["Translation workflows"]
  node_translate["Translation commands<br/>[index.ts]"]
  node_translate_extract["Extract and compose<br/>[extract.ts]"]
  node_translate_seed["Seed translations<br/>[seed.ts]"]
  node_translate_run["Translation runner<br/>[run.ts]"]
  node_ai["AI provider<br/>[index.ts]"]
  node_yandex["Yandex provider<br/>[index.ts]"]
  node_evaluation["Translation evaluation<br/>[run.ts]"]
end

node_user(("CLI user"))

node_user -->|"runs CLI"| node_entrypoint
node_entrypoint -->|"dispatches through"| node_registry
node_entrypoint -->|"detects raw mode"| node_content
node_registry -->|"creates runtime"| node_program
node_registry -->|"registers command"| node_initializer
node_registry -->|"registers command"| node_translate
node_registry -->|"registers command"| node_publish
node_program -->|"resolves config"| node_config
node_content -->|"creates run"| node_run
node_content -->|"renders content"| node_markdown
node_content -->|"initializes presets"| node_variables
node_markdown -->|"records metadata"| node_metadata
node_toc -->|"adds no-index metadata"| node_metadata
node_run -->|"uses configuration"| node_config
node_translate -->|"registers extract"| node_translate_extract
node_translate -->|"registers seed"| node_translate_seed
node_translate -->|"uses runner"| node_translate_run
node_translate -->|"registers provider"| node_ai
node_translate -->|"registers provider"| node_yandex
node_translate -.->|"offers evaluation"| node_evaluation
node_vcs -->|"uses navigation"| node_toc
node_github -.->|"implements connector"| node_vcs
node_arcadia -.->|"implements connector"| node_vcs
node_leading -->|"uses presets"| node_variables
node_leading -->|"uses metadata"| node_metadata

click node_entrypoint "https://github.com/diplodoc-platform/cli/blob/master/src/index.ts"
click node_registry "https://github.com/diplodoc-platform/cli/blob/master/src/commands/index.ts"
click node_program "https://github.com/diplodoc-platform/cli/blob/master/src/core/program/index.ts"
click node_config "https://github.com/diplodoc-platform/cli/blob/master/src/core/config/index.ts"
click node_initializer "https://github.com/diplodoc-platform/cli/blob/master/src/commands/init/index.ts"
click node_content "https://github.com/diplodoc-platform/cli/blob/master/src/commands/content/index.ts"
click node_run "https://github.com/diplodoc-platform/cli/blob/master/src/core/run/index.ts"
click node_markdown "https://github.com/diplodoc-platform/cli/blob/master/src/core/markdown/MarkdownService.ts"
click node_variables "https://github.com/diplodoc-platform/cli/blob/master/src/core/vars/VarsService.ts"
click node_toc "https://github.com/diplodoc-platform/cli/blob/master/src/core/toc/TocService.ts"
click node_metadata "https://github.com/diplodoc-platform/cli/blob/master/src/core/meta/MetaService.ts"
click node_leading "https://github.com/diplodoc-platform/cli/blob/master/src/core/leading/LeadingService.ts"
click node_vcs "https://github.com/diplodoc-platform/cli/blob/master/src/core/vcs/VcsService.ts"
click node_github "https://github.com/diplodoc-platform/cli/blob/master/src/extensions/github-vcs/connector.ts"
click node_arcadia "https://github.com/diplodoc-platform/cli/blob/master/src/extensions/arcadia-vcs/connector.ts"
click node_search "https://github.com/diplodoc-platform/cli/blob/master/src/extensions/local-search/provider.ts"
click node_translate "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/index.ts"
click node_translate_extract "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/commands/extract.ts"
click node_translate_seed "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/commands/seed.ts"
click node_translate_run "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/run.ts"
click node_ai "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/providers/ai/index.ts"
click node_yandex "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/providers/yandex/index.ts"
click node_evaluation "https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/eval/run.ts"
click node_publish "https://github.com/diplodoc-platform/cli/blob/master/src/commands/publish/index.ts"

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_entrypoint,node_registry,node_program,node_initializer,node_publish,node_user toneBlue
class node_content,node_markdown,node_toc,node_metadata,node_leading toneAmber
class node_config,node_run,node_variables toneMint
class node_vcs,node_github,node_arcadia,node_search toneRose
class node_translate,node_translate_extract,node_translate_seed,node_translate_run,node_ai,node_yandex,node_evaluation toneIndigo
```

## Components

### CLI and setup

- [CLI entry](https://github.com/diplodoc-platform/cli/blob/master/src/index.ts): `src/index.ts`
- [Command registry](https://github.com/diplodoc-platform/cli/blob/master/src/commands/index.ts): `src/commands/index.ts`
- [Program runtime](https://github.com/diplodoc-platform/cli/blob/master/src/core/program/index.ts): `src/core/program/index.ts`
- [Project initializer](https://github.com/diplodoc-platform/cli/blob/master/src/commands/init/index.ts): `src/commands/init/index.ts`
- [Publish command](https://github.com/diplodoc-platform/cli/blob/master/src/commands/publish/index.ts): `src/commands/publish/index.ts`

### Documentation processing

- [Content command](https://github.com/diplodoc-platform/cli/blob/master/src/commands/content/index.ts): `src/commands/content/index.ts`
- [Markdown processing](https://github.com/diplodoc-platform/cli/blob/master/src/core/markdown/MarkdownService.ts): `src/core/markdown/MarkdownService.ts`
- [Navigation TOC](https://github.com/diplodoc-platform/cli/blob/master/src/core/toc/TocService.ts): `src/core/toc/TocService.ts`
- [Page metadata](https://github.com/diplodoc-platform/cli/blob/master/src/core/meta/MetaService.ts): `src/core/meta/MetaService.ts`
- [Leading content](https://github.com/diplodoc-platform/cli/blob/master/src/core/leading/LeadingService.ts): `src/core/leading/LeadingService.ts`

### Project services

- [Config resolver](https://github.com/diplodoc-platform/cli/blob/master/src/core/config/index.ts): `src/core/config/index.ts`
- [Project run](https://github.com/diplodoc-platform/cli/blob/master/src/core/run/index.ts): `src/core/run/index.ts`
- [Variable presets](https://github.com/diplodoc-platform/cli/blob/master/src/core/vars/VarsService.ts): `src/core/vars/VarsService.ts`

### Integrations

- [VCS service](https://github.com/diplodoc-platform/cli/blob/master/src/core/vcs/VcsService.ts): `src/core/vcs/VcsService.ts`
- [GitHub connector](https://github.com/diplodoc-platform/cli/blob/master/src/extensions/github-vcs/connector.ts): `src/extensions/github-vcs/connector.ts`
- [Arcadia connector](https://github.com/diplodoc-platform/cli/blob/master/src/extensions/arcadia-vcs/connector.ts): `src/extensions/arcadia-vcs/connector.ts`
- [Local search](https://github.com/diplodoc-platform/cli/blob/master/src/extensions/local-search/provider.ts): `src/extensions/local-search/provider.ts`

### Translation workflows

- [Translation commands](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/index.ts): `src/commands/translate/index.ts`
- [Extract and compose](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/commands/extract.ts): `src/commands/translate/commands/extract.ts`
- [Seed translations](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/commands/seed.ts): `src/commands/translate/commands/seed.ts`
- [Translation runner](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/run.ts): `src/commands/translate/run.ts`
- [AI provider](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/providers/ai/index.ts): `src/commands/translate/providers/ai/index.ts`
- [Yandex provider](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/providers/yandex/index.ts): `src/commands/translate/providers/yandex/index.ts`
- [Translation evaluation](https://github.com/diplodoc-platform/cli/blob/master/src/commands/translate/eval/run.ts): `src/commands/translate/eval/run.ts`

### Other components

- **CLI user**

## Connections

- CLI user → CLI entry: runs CLI (evidence: `src/index.ts`)
- CLI entry → Command registry: dispatches through (evidence: `src/index.ts`)
- CLI entry → Content command: detects raw mode (evidence: `src/index.ts`)
- Command registry → Program runtime: creates runtime (evidence: `src/commands/index.ts`)
- Command registry → Project initializer: registers command (evidence: `src/commands/index.ts`)
- Command registry → Translation commands: registers command (evidence: `src/commands/index.ts`)
- Command registry → Publish command: registers command (evidence: `src/commands/index.ts`)
- Program runtime → Config resolver: resolves config (evidence: `src/core/program/index.ts`)
- Content command → Project run: creates run (evidence: `src/commands/content/index.ts`)
- Content command → Markdown processing: renders content (evidence: `src/commands/content/index.ts`)
- Content command → Variable presets: initializes presets (evidence: `src/commands/content/index.ts`)
- Markdown processing → Page metadata: records metadata (evidence: `src/core/markdown/MarkdownService.ts`)
- Navigation TOC → Page metadata: adds no-index metadata (evidence: `src/core/toc/TocService.ts`)
- Project run → Config resolver: uses configuration (evidence: `src/core/run/index.ts`)
- Translation commands → Extract and compose: registers extract (evidence: `src/commands/translate/index.ts`)
- Translation commands → Seed translations: registers seed (evidence: `src/commands/translate/index.ts`)
- Translation commands → Translation runner: uses runner (evidence: `src/commands/translate/index.ts`)
- Translation commands → AI provider: registers provider (evidence: `src/commands/translate/index.ts`)
- Translation commands → Yandex provider: registers provider (evidence: `src/commands/translate/index.ts`)
- Translation commands → Translation evaluation: offers evaluation
- VCS service → Navigation TOC: uses navigation (evidence: `src/core/vcs/VcsService.ts`)
- GitHub connector → VCS service: implements connector
- Arcadia connector → VCS service: implements connector
- Leading content → Variable presets: uses presets (evidence: `src/core/leading/LeadingService.ts`)
- Leading content → Page metadata: uses metadata (evidence: `src/core/leading/LeadingService.ts`)
