# subucodes/vscode-ext-project-structure-extractor architecture

> Architecture diagram of the GitHub repository subucodes/vscode-ext-project-structure-extractor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subucodes/vscode-ext-project-structure-extractor
- Repository: https://github.com/subucodes/vscode-ext-project-structure-extractor

## Overview

##### Project type and purpose
- This is a Visual Studio Code extension (Node.js) whose job is to scan a user’s workspace folder, build a representation of its folder/file hierarchy (tree or markdown list), and copy it to the clipboard.

##### File structure
- Top-level files:
- package.json / package-lock.json: extension metadata, dependencies, activation events, commands
- extension.js: main entry point implementing VS Code extension API handlers
- eslint.config.mjs, jsconfig.json: build / lint configuration
- CHANGELOG.md, LICENSE: documentation/artifacts
- .vscode, .vscodeignore: editor and packaging config
- Directory “test” with extension.test.js: unit tests for activation & core logic
- No “frontend”/“backend”—this is a single‐process plugin that runs inside VS Code’s Extension Host.

##### Relationships & data flows
1. User triggers command (“Extract Project Structure”)
VS Code UI → Extension Host → `extension.js` (activate & register command)
2. Extension reads configuration settings
3. Scanner Service iterates workspace folder
4. Scanner emits raw tree data → Formatter Service
5. Formatter outputs text → Clipboard Service
6. Progress Service updates status bar during scan
7. Final success notification to user

##### Architectural patterns & design principles
- Single‐process plugin using VS Code’s Extension Host model
- Modular separation: scanning / formatting / clipboard / UI
- Configuration‐driven behavior (.gitignore, depth, format, file size)
- Test coverage of core logic

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% VS Code UI
    uiCmd["Command Palette UI"]:::blue
    uiStatus["Status Bar UI"]:::blue

    %% External systems
    FS["File System"]:::orange
    ClipboardExt["Clipboard"]:::orange

    %% Extension Host boundary
    subgraph "VS Code Extension Host"
        direction TB
        pkg["Activation Events<br/>(package.json)"]:::blue
        cfg["Configuration Settings<br/>(projectStructureExporter.*)"]:::grey
        ext["Main Extension Module<br/>(extension.js)"]:::blue
        scan["Workspace Scanner Service"]:::green
        fmt["Formatter Module"]:::green
        clipSrv["Clipboard Service"]:::orange
        prog["Progress Indicator Service"]:::green
    end

    %% Unit Tests
    tests["Unit Tests<br/>(extension.test.js)"]:::grey

    %% Relationships
    uiCmd -->|"User triggers command"| ext
    ext -->|"Read settings"| cfg
    ext -->|"Activate (& register command)"| pkg
    ext -->|"Invoke scan"| scan
    scan -->|"Scan FS"| FS
    scan -->|"Emit raw data"| fmt
    fmt -->|"Formatted output"| clipSrv
    clipSrv -->|"Copy to clipboard"| ClipboardExt
    scan -->|"Report progress"| prog
    prog -->|"Update status"| uiStatus
    tests -->|"Test activation"| ext
    tests -->|"Test scanning"| scan
    tests -->|"Test formatting"| fmt

    %% Click Events
    click pkg "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/package.json"
    click cfg "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/package.json"
    click ext "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/extension.js"
    click scan "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/extension.js"
    click fmt "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/extension.js"
    click clipSrv "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/extension.js"
    click prog "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/extension.js"
    click tests "https://github.com/subucodes/vscode-ext-project-structure-extractor/blob/main/test/extension.test.js"

    %% Styles
    classDef blue fill:#D0E8FF,stroke:#0366d6,color:#000;
    classDef green fill:#DFF2BF,stroke:#4F8A10,color:#000;
    classDef orange fill:#FFE8B5,stroke:#D48806,color:#000;
    classDef grey fill:#F0F0F0,stroke:#999,color:#000;
```
