# phyder-create/tool-flow architecture

> Architecture diagram of the GitHub repository phyder-create/tool-flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phyder-create/tool-flow
- Repository: https://github.com/phyder-create/tool-flow

## Overview

tool-flow turns a user's natural-language request into a CLI command through intent matching, parameter extraction, IR normalization, tool selection, and template-based command construction. Its documented product capabilities cover image, PDF, and video operations, backed by JSON intent and tool catalogs. The sampled entry point establishes the runtime call order; parser, resolver, and builder excerpts show their respective catalog/config reads. The settings file mentioned by the resolver is absent from the supplied tree, so it is not represented.

Main entry points: [`main.py`](https://github.com/phyder-create/tool-flow/blob/main/main.py) (CLI entry), [`core/builder.py`](https://github.com/phyder-create/tool-flow/blob/main/core/builder.py) (Command building), [`core/matcher.py`](https://github.com/phyder-create/tool-flow/blob/main/core/matcher.py) (Intent matching), [`core/resolver.py`](https://github.com/phyder-create/tool-flow/blob/main/core/resolver.py) (Tool resolution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Command workflow"]
  node_entry["CLI entry<br/>[main.py]"]
  node_matching["Intent matching<br/>[matcher.py]"]
  node_parsing["Parameter parsing<br/>[parser.py]"]
  node_extensions["Supported extensions"]
  node_ir["IR construction<br/>[ir_builder.py]"]
  node_resolution["Tool resolution<br/>[resolver.py]"]
  node_building["Command building<br/>[builder.py]"]
end

subgraph group_capabilities["Operation catalogs"]
  node_image_intents["Image operations"]
  node_pdf_intents["PDF operations"]
  node_video_intents["Video operations"]
end

subgraph group_tooling["CLI integrations"]
  node_image_tools["Image tool configs"]
  node_pdf_tools["PDF tool configs"]
  node_video_tools["Video tool configs"]
end

node_user(("User"))
node_result["CLI command"]

node_user -->|"enters request"| node_entry
node_entry -->|"matches intent"| node_matching
node_matching -->|"passes intent"| node_parsing
node_parsing -->|"uses extensions"| node_extensions
node_parsing -->|"passes parameters"| node_ir
node_entry -->|"builds IR"| node_ir
node_entry -->|"resolves tool"| node_resolution
node_entry -->|"builds command"| node_building
node_resolution -->|"passes tool"| node_building
node_building -->|"returns command"| node_result
node_entry -->|"prints command"| node_result
node_matching -->|"loads intents"| node_image_intents
node_matching -->|"loads intents"| node_pdf_intents
node_matching -->|"loads intents"| node_video_intents
node_resolution -->|"loads tool configs"| node_image_tools
node_resolution -->|"loads tool configs"| node_pdf_tools
node_resolution -->|"loads tool configs"| node_video_tools
node_building -->|"loads template config"| node_image_tools
node_building -->|"loads template config"| node_pdf_tools
node_building -->|"loads template config"| node_video_tools

click node_entry "https://github.com/phyder-create/tool-flow/blob/main/main.py"
click node_matching "https://github.com/phyder-create/tool-flow/blob/main/core/matcher.py"
click node_parsing "https://github.com/phyder-create/tool-flow/blob/main/core/parser.py"
click node_extensions "https://github.com/phyder-create/tool-flow/blob/main/config/supported_extension.py"
click node_ir "https://github.com/phyder-create/tool-flow/blob/main/core/ir_builder.py"
click node_resolution "https://github.com/phyder-create/tool-flow/blob/main/core/resolver.py"
click node_building "https://github.com/phyder-create/tool-flow/blob/main/core/builder.py"
click node_image_intents "https://github.com/phyder-create/tool-flow/tree/main/intents/image"
click node_pdf_intents "https://github.com/phyder-create/tool-flow/tree/main/intents/pdf"
click node_video_intents "https://github.com/phyder-create/tool-flow/tree/main/intents/video"
click node_image_tools "https://github.com/phyder-create/tool-flow/tree/main/tools/image"
click node_pdf_tools "https://github.com/phyder-create/tool-flow/tree/main/tools/pdf"
click node_video_tools "https://github.com/phyder-create/tool-flow/tree/main/tools/video"

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_matching,node_parsing,node_extensions,node_ir,node_resolution,node_building,node_user toneBlue
class node_image_intents,node_pdf_intents,node_video_intents toneAmber
class node_image_tools,node_pdf_tools,node_video_tools toneMint
class node_result toneIndigo
```

## Components

### Command workflow

- [CLI entry](https://github.com/phyder-create/tool-flow/blob/main/main.py): `main.py`
- [Intent matching](https://github.com/phyder-create/tool-flow/blob/main/core/matcher.py): `core/matcher.py`
- [Parameter parsing](https://github.com/phyder-create/tool-flow/blob/main/core/parser.py): `core/parser.py`
- [Supported extensions](https://github.com/phyder-create/tool-flow/blob/main/config/supported_extension.py): `config/supported_extension.py`
- [IR construction](https://github.com/phyder-create/tool-flow/blob/main/core/ir_builder.py): `core/ir_builder.py`
- [Tool resolution](https://github.com/phyder-create/tool-flow/blob/main/core/resolver.py): `core/resolver.py`
- [Command building](https://github.com/phyder-create/tool-flow/blob/main/core/builder.py): `core/builder.py`

### Operation catalogs

- [Image operations](https://github.com/phyder-create/tool-flow/tree/main/intents/image): `intents/image`
- [PDF operations](https://github.com/phyder-create/tool-flow/tree/main/intents/pdf): `intents/pdf`
- [Video operations](https://github.com/phyder-create/tool-flow/tree/main/intents/video): `intents/video`

### CLI integrations

- [Image tool configs](https://github.com/phyder-create/tool-flow/tree/main/tools/image): `tools/image`
- [PDF tool configs](https://github.com/phyder-create/tool-flow/tree/main/tools/pdf): `tools/pdf`
- [Video tool configs](https://github.com/phyder-create/tool-flow/tree/main/tools/video): `tools/video`

### Other components

- **User**
- **CLI command**

## Connections

- User → CLI entry: enters request (evidence: `README.md`)
- CLI entry → Intent matching: matches intent (evidence: `main.py`)
- Intent matching → Parameter parsing: passes intent (evidence: `main.py`)
- Parameter parsing → Supported extensions: uses extensions (evidence: `core/parser.py`)
- Parameter parsing → IR construction: passes parameters (evidence: `main.py`)
- CLI entry → IR construction: builds IR (evidence: `main.py`)
- CLI entry → Tool resolution: resolves tool (evidence: `main.py`)
- CLI entry → Command building: builds command (evidence: `main.py`)
- Tool resolution → Command building: passes tool (evidence: `main.py`)
- Command building → CLI command: returns command (evidence: `core/builder.py`)
- CLI entry → CLI command: prints command (evidence: `main.py`)
- Intent matching → Image operations: loads intents (evidence: `core/matcher.py`)
- Intent matching → PDF operations: loads intents (evidence: `core/matcher.py`)
- Intent matching → Video operations: loads intents (evidence: `core/matcher.py`)
- Tool resolution → Image tool configs: loads tool configs (evidence: `core/resolver.py`)
- Tool resolution → PDF tool configs: loads tool configs (evidence: `core/resolver.py`)
- Tool resolution → Video tool configs: loads tool configs (evidence: `core/resolver.py`)
- Command building → Image tool configs: loads template config (evidence: `core/builder.py`)
- Command building → PDF tool configs: loads template config (evidence: `core/builder.py`)
- Command building → Video tool configs: loads template config (evidence: `core/builder.py`)
