# cognigy/cognigy-cli architecture

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

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

## Overview

Cognigy CLI is a command-line client for manipulating existing Cognigy.AI agent resources, with local files as the working copy. The principal workflow dispatches a user command, performs resource-specific work, then reads or updates local data and/or Cognigy.AI. Separate capabilities cover Flow localization and CSV content, playbooks and API-client commands, and Knowledge AI resource management and ingestion. The tree, README, and sampled excerpts support the command entry and parts of Flow and Knowledge AI behavior; some subsystem wiring is documented but its implementation was not sampled.

Main entry points: [`src/program/program.ts`](https://github.com/cognigy/cognigy-cli/blob/main/src/program/program.ts) (Command registry), [`src/lib/knowledgeAI`](https://github.com/cognigy/cognigy-cli/tree/main/src/lib/knowledgeAI) (Knowledge operations), [`src/utils/cognigyClient.ts`](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/cognigyClient.ts) (Cognigy API client), [`src/lib/flows.ts`](https://github.com/cognigy/cognigy-cli/blob/main/src/lib/flows.ts) (Flow operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI dispatch"]
  node_entry["Executable entry<br/>[cognigy.ts]"]
  node_program["Command registry<br/>[program.ts]"]
end

subgraph group_resources["Agent resources"]
  node_resourcecmd["Resource commands"]
  node_resourcelib["Resource operations"]
  node_playbooks["Playbook operations<br/>[playbooks.ts]"]
end

subgraph group_flowcontent["Flow content"]
  node_flows["Flow operations<br/>[flows.ts]"]
  node_locales["Locale operations<br/>[locales.ts]"]
  node_flowcommands["Flow content commands"]
  node_translator["Translation adapters<br/>[translators.ts]"]
  node_csv["Flow CSV exchange<br/>[exportcsv.ts]"]
end

subgraph group_knowledge["Knowledge AI"]
  node_knowledgeprogram["Knowledge command registry"]
  node_knowledgecmd["Knowledge commands"]
  node_knowledgeops["Knowledge operations"]
  node_extractors["Extraction providers"]
  node_splitter["Text splitting"]
end

subgraph group_runtime["Runtime services"]
  node_config["Configuration<br/>[config.ts]"]
  node_client["Cognigy API client<br/>[cognigyClient.ts]"]
  node_http["HTTP request adapter<br/>[axiosClient.ts]"]
end

node_user(("CLI user"))
node_localfiles[("Agent files")]
node_cognigy[("Cognigy.AI API")]
node_translationservice(("Translation service"))

node_user -->|"runs"| node_entry
node_entry -->|"parses input"| node_program
node_program -->|"dispatches commands"| node_resourcecmd
node_program -->|"dispatches commands"| node_flowcommands
node_program -->|"registers commands"| node_knowledgeprogram
node_resourcecmd -->|"performs resource work"| node_resourcelib
node_resourcelib -->|"uses API client"| node_client
node_resourcelib -->|"reads and writes"| node_localfiles
node_client -->|"calls API"| node_cognigy
node_flowcommands -->|"runs Flow work"| node_flows
node_flows -->|"retrieves locales"| node_locales
node_flows -->|"requests resources"| node_client
node_flows -->|"reads and writes"| node_localfiles
node_flowcommands -->|"requests translation"| node_translator
node_translator -.->|"translates text"| node_translationservice
node_flowcommands -->|"exports and imports"| node_csv
node_csv -->|"reads and writes CSV"| node_localfiles
node_knowledgeprogram -->|"dispatches commands"| node_knowledgecmd
node_knowledgecmd -->|"runs knowledge work"| node_knowledgeops
node_knowledgeops -->|"extracts content"| node_extractors
node_knowledgeops -->|"splits text"| node_splitter
node_knowledgeops -->|"uploads files"| node_http
node_http -->|"sends requests"| node_cognigy
node_knowledgeops -->|"reads source files"| node_localfiles
node_config -->|"supplies credentials"| node_client
node_playbooks -->|"uses API client"| node_client
node_program -->|"schedules playbooks"| node_playbooks

click node_entry "https://github.com/cognigy/cognigy-cli/blob/main/src/cognigy.ts"
click node_program "https://github.com/cognigy/cognigy-cli/blob/main/src/program/program.ts"
click node_resourcecmd "https://github.com/cognigy/cognigy-cli/tree/main/src/commands"
click node_resourcelib "https://github.com/cognigy/cognigy-cli/tree/main/src/lib"
click node_flows "https://github.com/cognigy/cognigy-cli/blob/main/src/lib/flows.ts"
click node_locales "https://github.com/cognigy/cognigy-cli/blob/main/src/lib/locales.ts"
click node_flowcommands "https://github.com/cognigy/cognigy-cli/tree/main/src/commands"
click node_translator "https://github.com/cognigy/cognigy-cli/blob/main/src/utils/translators.ts"
click node_knowledgeprogram "https://github.com/cognigy/cognigy-cli/blob/main/src/program/knowledgeAIProgram.ts"
click node_knowledgecmd "https://github.com/cognigy/cognigy-cli/tree/main/src/commands/knowledgeAI"
click node_knowledgeops "https://github.com/cognigy/cognigy-cli/tree/main/src/lib/knowledgeAI"
click node_extractors "https://github.com/cognigy/cognigy-cli/tree/main/src/lib/knowledgeAI/extractionProvider"
click node_splitter "https://github.com/cognigy/cognigy-cli/blob/main/src/utils/paragraphSplitter.ts"
click node_config "https://github.com/cognigy/cognigy-cli/blob/main/src/utils/config.ts"
click node_client "https://github.com/cognigy/cognigy-cli/blob/main/src/utils/cognigyClient.ts"
click node_http "https://github.com/cognigy/cognigy-cli/blob/main/src/utils/axiosClient.ts"
click node_playbooks "https://github.com/cognigy/cognigy-cli/blob/main/src/lib/playbooks.ts"
click node_csv "https://github.com/cognigy/cognigy-cli/blob/main/src/commands/exportcsv.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_entry,node_program,node_user toneBlue
class node_resourcecmd,node_resourcelib,node_playbooks,node_localfiles,node_cognigy toneAmber
class node_flows,node_locales,node_flowcommands,node_translator,node_csv toneMint
class node_knowledgeprogram,node_knowledgecmd,node_knowledgeops,node_extractors,node_splitter toneRose
class node_config,node_client,node_http,node_translationservice toneIndigo
```

## Components

### CLI dispatch

- [Executable entry](https://github.com/cognigy/cognigy-cli/blob/main/src/cognigy.ts): `src/cognigy.ts`
- [Command registry](https://github.com/cognigy/cognigy-cli/blob/main/src/program/program.ts): `src/program/program.ts`

### Agent resources

- [Resource commands](https://github.com/cognigy/cognigy-cli/tree/main/src/commands): `src/commands`
- [Resource operations](https://github.com/cognigy/cognigy-cli/tree/main/src/lib): `src/lib`
- [Playbook operations](https://github.com/cognigy/cognigy-cli/blob/main/src/lib/playbooks.ts): `src/lib/playbooks.ts`

### Flow content

- [Flow operations](https://github.com/cognigy/cognigy-cli/blob/main/src/lib/flows.ts): `src/lib/flows.ts`
- [Locale operations](https://github.com/cognigy/cognigy-cli/blob/main/src/lib/locales.ts): `src/lib/locales.ts`
- [Flow content commands](https://github.com/cognigy/cognigy-cli/tree/main/src/commands): `src/commands`
- [Translation adapters](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/translators.ts): `src/utils/translators.ts`
- [Flow CSV exchange](https://github.com/cognigy/cognigy-cli/blob/main/src/commands/exportcsv.ts): `src/commands/exportcsv.ts`

### Knowledge AI

- [Knowledge command registry](https://github.com/cognigy/cognigy-cli/blob/main/src/program/knowledgeAIProgram.ts): `src/program/knowledgeAIProgram.ts`
- [Knowledge commands](https://github.com/cognigy/cognigy-cli/tree/main/src/commands/knowledgeAI): `src/commands/knowledgeAI`
- [Knowledge operations](https://github.com/cognigy/cognigy-cli/tree/main/src/lib/knowledgeAI): `src/lib/knowledgeAI`
- [Extraction providers](https://github.com/cognigy/cognigy-cli/tree/main/src/lib/knowledgeAI/extractionProvider): `src/lib/knowledgeAI/extractionProvider`
- [Text splitting](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/paragraphSplitter.ts): `src/utils/paragraphSplitter.ts`

### Runtime services

- [Configuration](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/config.ts): `src/utils/config.ts`
- [Cognigy API client](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/cognigyClient.ts): `src/utils/cognigyClient.ts`
- [HTTP request adapter](https://github.com/cognigy/cognigy-cli/blob/main/src/utils/axiosClient.ts): `src/utils/axiosClient.ts`

### Other components

- **CLI user**
- **Agent files**
- **Cognigy.AI API**
- **Translation service**

## Connections

- CLI user → Executable entry: runs
- Executable entry → Command registry: parses input
- Command registry → Resource commands: dispatches commands
- Command registry → Flow content commands: dispatches commands
- Command registry → Knowledge command registry: registers commands
- Resource commands → Resource operations: performs resource work
- Resource operations → Cognigy API client: uses API client
- Resource operations → Agent files: reads and writes
- Cognigy API client → Cognigy.AI API: calls API
- Flow content commands → Flow operations: runs Flow work
- Flow operations → Locale operations: retrieves locales
- Flow operations → Cognigy API client: requests resources
- Flow operations → Agent files: reads and writes
- Flow content commands → Translation adapters: requests translation
- Translation adapters → Translation service: translates text
- Flow content commands → Flow CSV exchange: exports and imports
- Flow CSV exchange → Agent files: reads and writes CSV
- Knowledge command registry → Knowledge commands: dispatches commands
- Knowledge commands → Knowledge operations: runs knowledge work
- Knowledge operations → Extraction providers: extracts content
- Knowledge operations → Text splitting: splits text
- Knowledge operations → HTTP request adapter: uploads files
- HTTP request adapter → Cognigy.AI API: sends requests
- Knowledge operations → Agent files: reads source files
- Configuration → Cognigy API client: supplies credentials
- Playbook operations → Cognigy API client: uses API client
- Command registry → Playbook operations: schedules playbooks
