# emoo-ai/emoo-cli architecture

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

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

## Overview

EMOO CLI exposes authenticated OpenAPI operations through direct API passthrough, structured domain commands, and Markdown-defined skills. The principal workflow is to configure authentication, invoke a command, have the shared client make EMOO API requests, and receive JSON or formatted output. Skill workflows add knowledge-map generation, intent analysis, plan execution, and optional CSV export. The README documents broad API coverage; sampled source and the SOURCE INDEX support the shared client and selected skill links, while unsampled command internals are represented by their exact paths without inferred call chains.

Main entry points: [`src/cli.py`](https://github.com/emoo-ai/emoo-cli/blob/main/src/cli.py) (Command router), [`src/client.py`](https://github.com/emoo-ai/emoo-cli/blob/main/src/client.py) (HTTP client), [`src/commands/skill.py`](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/skill.py) (Skill commands), [`src/commands/auth.py`](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/auth.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI Entry"]
  node_cli["Command router<br/>[cli.py]"]
end

subgraph group_domains["Domain Commands"]
  node_auth["Authentication<br/>[auth.py]"]
  node_contact["Contacts<br/>[contact.py]"]
  node_data["Data search/get<br/>[data.py]"]
  node_chat["Chat<br/>[chat.py]"]
  node_message["Message push<br/>[message.py]"]
  node_base["Base tables<br/>[base.py]"]
  node_app["App overview<br/>[app.py]"]
  node_agent["Agent management<br/>[agent.py]"]
  node_role["Role management<br/>[role.py]"]
  node_folder["Folders<br/>[folder.py]"]
  node_file["Files<br/>[file.py]"]
  node_api_cmd["API passthrough<br/>[api.py]"]
  node_schema["Schema inspection<br/>[schema_cmd.py]"]
end

subgraph group_skills["Skill Workflows"]
  node_skill_cmd["Skill commands<br/>[skill.py]"]
  node_loader["Skill loader<br/>[loader.py]"]
  node_registry["Skill registry<br/>[registry.py]"]
  node_knowledge["Knowledge map<br/>[knowledge_map.py]"]
  node_intent["Intent analysis<br/>[intent.py]"]
  node_runner["Skill runner<br/>[runner.py]"]
  node_search["Search executor<br/>[search.py]"]
  node_analyze["Search analysis<br/>[analyze.py]"]
end

subgraph group_runtime["Shared Runtime"]
  node_client["HTTP client<br/>[client.py]"]
  node_config[("Credential config<br/>[config.py]")]
  node_formatters["Output formatting<br/>[formatters.py]"]
  node_errors["Structured errors<br/>[errors.py]"]
end

node_user(("CLI user"))
node_emoo_api{{"EMOO OpenAPI"}}

node_user -->|"runs commands"| node_cli
node_cli -->|"routes to"| node_auth
node_cli -->|"routes to"| node_contact
node_cli -->|"routes to"| node_data
node_cli -->|"routes to"| node_chat
node_cli -->|"routes to"| node_message
node_cli -->|"routes to"| node_base
node_cli -->|"routes to"| node_app
node_cli -->|"routes to"| node_agent
node_cli -->|"routes to"| node_role
node_cli -->|"routes to"| node_folder
node_cli -->|"routes to"| node_file
node_cli -->|"routes to"| node_api_cmd
node_cli -->|"routes to"| node_schema
node_cli -->|"routes to"| node_skill_cmd
node_auth -->|"saves credentials"| node_config
node_client -->|"loads credentials"| node_config
node_client -->|"maps API errors"| node_errors
node_auth -->|"creates client"| node_client
node_contact -->|"uses requests"| node_client
node_data -->|"uses requests"| node_client
node_chat -->|"uses requests"| node_client
node_message -->|"uses requests"| node_client
node_base -->|"uses requests"| node_client
node_app -->|"fetches workspace data"| node_client
node_agent -->|"uses requests"| node_client
node_role -->|"uses requests"| node_client
node_folder -->|"uses requests"| node_client
node_file -->|"uses requests"| node_client
node_api_cmd -->|"sends API calls"| node_client
node_client -->|"sends HTTP requests"| node_emoo_api
node_contact -->|"formats results"| node_formatters
node_data -->|"formats results"| node_formatters
node_chat -->|"formats results"| node_formatters
node_skill_cmd -->|"loads definitions"| node_loader
node_skill_cmd -->|"runs skills"| node_runner
node_skill_cmd -->|"executes search"| node_search
node_loader -->|"gets skill directory"| node_registry
node_runner -->|"loads skills"| node_loader
node_search -->|"posts search requests"| node_emoo_api
node_knowledge -->|"fetches records"| node_emoo_api
node_skill_cmd -->|"generates map"| node_knowledge
node_skill_cmd -->|"analyzes query"| node_intent
node_skill_cmd -.->|"analyzes results"| node_analyze
node_runner -.->|"executes search plan"| node_search

click node_cli "https://github.com/emoo-ai/emoo-cli/blob/main/src/cli.py"
click node_auth "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/auth.py"
click node_contact "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/contact.py"
click node_data "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/data.py"
click node_chat "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/chat.py"
click node_message "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/message.py"
click node_base "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/base.py"
click node_app "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/app.py"
click node_agent "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/agent.py"
click node_role "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/role.py"
click node_folder "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/folder.py"
click node_file "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/file.py"
click node_api_cmd "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/api.py"
click node_schema "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/schema_cmd.py"
click node_skill_cmd "https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/skill.py"
click node_loader "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/loader.py"
click node_registry "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/registry.py"
click node_knowledge "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/knowledge_map.py"
click node_intent "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/intent.py"
click node_runner "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/runner.py"
click node_search "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/search.py"
click node_analyze "https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/analyze.py"
click node_client "https://github.com/emoo-ai/emoo-cli/blob/main/src/client.py"
click node_config "https://github.com/emoo-ai/emoo-cli/blob/main/src/config.py"
click node_formatters "https://github.com/emoo-ai/emoo-cli/blob/main/src/formatters.py"
click node_errors "https://github.com/emoo-ai/emoo-cli/blob/main/src/errors.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_cli,node_user toneBlue
class node_auth,node_contact,node_data,node_chat,node_message,node_base,node_app,node_agent,node_role,node_folder,node_file,node_api_cmd,node_schema toneAmber
class node_skill_cmd,node_loader,node_registry,node_knowledge,node_intent,node_runner,node_search,node_analyze,node_emoo_api toneMint
class node_client,node_config,node_formatters,node_errors toneRose
```

## Components

### CLI Entry

- [Command router](https://github.com/emoo-ai/emoo-cli/blob/main/src/cli.py): `src/cli.py`

### Domain Commands

- [Authentication](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/auth.py): `src/commands/auth.py`
- [Contacts](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/contact.py): `src/commands/contact.py`
- [Data search/get](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/data.py): `src/commands/data.py`
- [Chat](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/chat.py): `src/commands/chat.py`
- [Message push](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/message.py): `src/commands/message.py`
- [Base tables](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/base.py): `src/commands/base.py`
- [App overview](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/app.py): `src/commands/app.py`
- [Agent management](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/agent.py): `src/commands/agent.py`
- [Role management](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/role.py): `src/commands/role.py`
- [Folders](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/folder.py): `src/commands/folder.py`
- [Files](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/file.py): `src/commands/file.py`
- [API passthrough](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/api.py): `src/commands/api.py`
- [Schema inspection](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/schema_cmd.py): `src/commands/schema_cmd.py`

### Skill Workflows

- [Skill commands](https://github.com/emoo-ai/emoo-cli/blob/main/src/commands/skill.py): `src/commands/skill.py`
- [Skill loader](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/loader.py): `src/skills/loader.py`
- [Skill registry](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/registry.py): `src/skills/registry.py`
- [Knowledge map](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/knowledge_map.py): `src/skills/knowledge_map.py`
- [Intent analysis](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/intent.py): `src/skills/intent.py`
- [Skill runner](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/runner.py): `src/skills/runner.py`
- [Search executor](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/search.py): `src/skills/search.py`
- [Search analysis](https://github.com/emoo-ai/emoo-cli/blob/main/src/skills/analyze.py): `src/skills/analyze.py`

### Shared Runtime

- [HTTP client](https://github.com/emoo-ai/emoo-cli/blob/main/src/client.py): `src/client.py`
- [Credential config](https://github.com/emoo-ai/emoo-cli/blob/main/src/config.py): `src/config.py`
- [Output formatting](https://github.com/emoo-ai/emoo-cli/blob/main/src/formatters.py): `src/formatters.py`
- [Structured errors](https://github.com/emoo-ai/emoo-cli/blob/main/src/errors.py): `src/errors.py`

### Other components

- **CLI user**
- **EMOO OpenAPI**

## Connections

- CLI user → Command router: runs commands (evidence: `README.md`)
- Command router → Authentication: routes to (evidence: `src/cli.py`)
- Command router → Contacts: routes to (evidence: `src/cli.py`)
- Command router → Data search/get: routes to (evidence: `src/cli.py`)
- Command router → Chat: routes to (evidence: `src/cli.py`)
- Command router → Message push: routes to (evidence: `src/cli.py`)
- Command router → Base tables: routes to (evidence: `src/cli.py`)
- Command router → App overview: routes to (evidence: `src/cli.py`)
- Command router → Agent management: routes to (evidence: `src/cli.py`)
- Command router → Role management: routes to (evidence: `src/cli.py`)
- Command router → Folders: routes to (evidence: `src/cli.py`)
- Command router → Files: routes to (evidence: `src/cli.py`)
- Command router → API passthrough: routes to (evidence: `src/cli.py`)
- Command router → Schema inspection: routes to (evidence: `src/cli.py`)
- Command router → Skill commands: routes to (evidence: `src/cli.py`)
- Authentication → Credential config: saves credentials (evidence: `src/commands/auth.py`)
- HTTP client → Credential config: loads credentials (evidence: `src/client.py`)
- HTTP client → Structured errors: maps API errors (evidence: `src/client.py`)
- Authentication → HTTP client: creates client (evidence: `src/commands/auth.py`)
- Contacts → HTTP client: uses requests (evidence: `src/commands/contact.py`)
- Data search/get → HTTP client: uses requests (evidence: `src/commands/data.py`)
- Chat → HTTP client: uses requests (evidence: `src/commands/chat.py`)
- Message push → HTTP client: uses requests (evidence: `src/commands/message.py`)
- Base tables → HTTP client: uses requests (evidence: `src/commands/base.py`)
- App overview → HTTP client: fetches workspace data (evidence: `src/commands/app.py`)
- Agent management → HTTP client: uses requests (evidence: `src/commands/agent.py`)
- Role management → HTTP client: uses requests (evidence: `src/commands/role.py`)
- Folders → HTTP client: uses requests (evidence: `src/commands/folder.py`)
- Files → HTTP client: uses requests (evidence: `src/commands/file.py`)
- API passthrough → HTTP client: sends API calls (evidence: `src/commands/api.py`)
- HTTP client → EMOO OpenAPI: sends HTTP requests (evidence: `src/client.py`)
- Contacts → Output formatting: formats results (evidence: `src/commands/contact.py`)
- Data search/get → Output formatting: formats results (evidence: `src/commands/data.py`)
- Chat → Output formatting: formats results (evidence: `src/commands/chat.py`)
- Skill commands → Skill loader: loads definitions (evidence: `src/commands/skill.py`)
- Skill commands → Skill runner: runs skills (evidence: `src/commands/skill.py`)
- Skill commands → Search executor: executes search (evidence: `src/commands/skill.py`)
- Skill loader → Skill registry: gets skill directory (evidence: `src/skills/loader.py`)
- Skill runner → Skill loader: loads skills (evidence: `src/skills/runner.py`)
- Search executor → EMOO OpenAPI: posts search requests (evidence: `src/skills/search.py`)
- Knowledge map → EMOO OpenAPI: fetches records (evidence: `src/skills/knowledge_map.py`)
- Skill commands → Knowledge map: generates map (evidence: `src/commands/skill.py`)
- Skill commands → Intent analysis: analyzes query (evidence: `README.md`)
- Skill commands → Search analysis: analyzes results (evidence: `src/commands/skill.py`)
- Skill runner → Search executor: executes search plan
