How apingali/fabric works
Main Components
• CLI Interface: Represent the “cli” directory and associated Go files (cli.go, flags.go, output.go, etc.). This is the command‑line entry point that accepts user inputs, parameters, and flags.
• Patterns Repository: Show the “patterns” directory (with over a hundred subdirectories) that holds the markdown files describing AI prompts and workflows. This is a key resource that the CLI and other parts read to dispatch the “Patterns” regarding summarization, analysis, etc.
• Plugins System: Highlight the “plugins” directory and its subdirectories for AI integration (various vendor implementations, e.g., OpenAI, Anthropic, Azure, etc.), database connectors (in plugins/db), templating (in plugins/template), and additional tools. This modular design enables fabric’s extensibility.
• REST API: Include the “restapi” folder which provides API endpoints (chat, sessions, storage, contexts, etc.) that allow external applications – including the web UI – to interact with fabric’s core logic.
• Web Interface: Illustrate the “web” directory that contains the Svelte‑based frontend. Its structure (with directories for components, routes, interfaces, store, etc.) demonstrates that the web UI is a separate layer that talks to the REST API.
• Auxiliary Components: Represent the “nix” configurations, Dockerfile/docker‑compose, and container configurations. Although not part of the runtime architecture per se, these files are crucial for deployment, containerization, and environment reproducibility.
Relationships and Data Flow
• API Layer: The web UI communicates with the REST API to perform operations (chat, pattern retrieval, session management, etc.). Indicate clear REST endpoints that bridge user inputs with core functionalities.
• Pattern Processing Flow: Indicate that the CLI and REST API layer both reference the Patterns Repository. The engine reads markdown templates (from the “patterns” directory) and sends them to one or more AI providers via the Plugins system.
• Deployment: Optionally include Docker and Nix components to show that fabric is containerizable and has reproducible environments.
Architectural Patterns and Design Principles
• Modular, Extensible Design: Emphasize the loose coupling between the core engine and plugins (each plugin is organized by feature and vendor). This modular approach is a central design theme.
• Separation of Concerns: Illustrate that the CLI, API, and Web UI are separate concerns that interface with a common core. The Pattern Repository is also distinct and can be independently updated (as shown by update workflows in the .github folder).
• Configuration Driven: Include notes on environment configuration (Docker, devcontainer, flake.nix) which allow the project to run in a consistent environment.
• Workflow and Streaming: Highlight features such as “--stream” in CLI usage, which indicates real‑time processing or streaming data flows.
Relevant Technologies, Frameworks, and Libraries
• Go – the main programming language used across CLI, core, REST API, and plugins.
• Svelte, TypeScript, and related web tooling – used in the “web” directory for the front‑end.
• Docker and Nix – used for containerization and reproducible builds/configurations.
• GitHub Actions and Dockerfiles – for CI/CD and environment management.
• Markdown – used extensively for defining Patterns, which are the primary interfaces and prompts used by AI models.
Essential Elements
• Clear labels for every component and sub‑module (e.g., within plugins, group AI vendor implementations separately from database connectors).
• Annotations noting configuration files that support deployment (Docker, Nix, .devcontainer) and workflows (GitHub CI/CD files).