# snuc1925/tinyshell architecture

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

- Interactive diagram: https://gitdiagram.com/snuc1925/tinyshell
- Repository: https://github.com/snuc1925/tinyshell

## Overview

##### Project type and purpose
- From the file tree and README, this is a small command-line shell (“TinyShell”) written in C++.
- It implements a simple CLI interpreter that reads user input, dispatches built-in commands (file and process operations), and delegates to the OS.

##### File structure
- Top-level:
- main.cpp – entry point, CLI loop
- command_manager.{cpp,h} – core dispatcher for commands
- utils.h – shared helper functions (e.g., string parsing)
- commands/ directory:
- file_commands.h – file-system related commands (e.g., ls, cd, rm)
- process_commands.h – process management commands (e.g., fork, exec, kill)
- Build artifacts: main.exe, .gitignore

##### README
- No external services or databases—everything runs in process and uses OS syscalls.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Components
    CLI["CLI Interface\n(main.cpp)"]:::interface
    Manager["Command Manager\n(command_manager.cpp/.h)"]:::core
    Utils["Utility Library\n(utils.h)"]:::core

    subgraph "Command Modules"
        File["FileCommands\n(commands/file_commands.h)"]:::module
        Process["ProcessCommands\n(commands/process_commands.h)"]:::module
    end

    OS["OS Kernel / Std Lib\n(syscalls)"]:::external

    %% Data Flow
    CLI -->|"command string"| Manager
    Manager -->|"tokenize/validate"| Utils
    Utils -->|"parsed args"| Manager
    Manager -->|"dispatch parsed args"| File
    Manager -->|"dispatch parsed args"| Process
    File -->|"syscall calls"| OS
    Process -->|"syscall calls"| OS
    OS -->|"output / status"| CLI

    %% Click Events
    click CLI "https://github.com/snuc1925/tinyshell/blob/main/main.cpp"
    click Manager "https://github.com/snuc1925/tinyshell/blob/main/command_manager.cpp"
    click Manager "https://github.com/snuc1925/tinyshell/blob/main/command_manager.h"
    click File "https://github.com/snuc1925/tinyshell/blob/main/commands/file_commands.h"
    click Process "https://github.com/snuc1925/tinyshell/blob/main/commands/process_commands.h"
    click Utils "https://github.com/snuc1925/tinyshell/blob/main/utils.h"

    %% Styles
    classDef interface fill:#e3f2fd,stroke:#90caf9,stroke-width:2px
    classDef core fill:#bbdefb,stroke:#64b5f6,stroke-width:2px
    classDef module fill:#c8e6c9,stroke:#81c784,stroke-width:2px
    classDef external fill:#ffe0b2,stroke:#ffb74d,stroke-width:2px
```
