# philoserf/obsidian-vault-changelog architecture

> Architecture diagram of the GitHub repository philoserf/obsidian-vault-changelog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/philoserf/obsidian-vault-changelog
- Repository: https://github.com/philoserf/obsidian-vault-changelog

## Overview

This project is an Obsidian Vault Changelog Plugin designed to track and update a central changelog of recently edited notes within an Obsidian vault. The plugin supports both manual and automatic triggers for updating the changelog note.

##### Main components
- Plugin Manifest: Represented by the manifest.json file, which defines the metadata for the plugin.
- Core Plugin Logic: The plugin’s main functionality is implemented in the TypeScript source files located in the src folder (main.ts, settings.ts, and suggest.ts). These files handle initialization, settings configuration, and changelog suggestions.
- Plugin Settings: Managed by the settings module, which interacts with user-defined options (e.g., file paths, auto update flag, datetime format, max recent files, and excluded folders).
- Command and Event Handlers: Include the manual command for updating the changelog (“Vault Changelog: Update”) and the automatic event triggers (file modifications).
- Build & Configuration Infrastructure: Files like build.mjs, package.json, bun.lock, bunfig.toml, tsconfig.json, and eslint.config.mjs indicate the use of a bundler (Bun) and TypeScript, ensuring the plugin is compiled and linted appropriately.
- Test Environment: The test-vault directory simulates an Obsidian vault for testing purposes. This includes sample Obsidian configuration and a simulated vault environment to verify the plugin’s behavior.

##### Relationships and interactions
- The Obsidian environment loads the plugin using information from the manifest.json.
- Once loaded, the main module (from src/main.ts) initializes the plugin, setting up event listeners that trigger changelog updates when files are edited.
- Plugin settings, managed by src/settings.ts, allow customization of file paths and update behaviors.
- A command from the Obsidian command palette (or an automatic trigger) invokes functionality defined in the plugin core.
- The test vault is used during development to ensure that the plugin behaves as intended within an actual Obsidian-like environment.

##### Architectural patterns or design principles
- Modularity is emphasized by separating the plugin’s core functions, settings, and suggestion logic into multiple dedicated modules.
- Event-driven design: The system listens for file change events to trigger automatic updates.
- Clear separation between configuration (manifest, settings) and implementation (source code).

##### Relevant technologies and frameworks
- Language/Transpiler: TypeScript (as seen by tsconfig.json).
- Bundler/Runtime: Bun (bun.lock, bunfig.toml, and build.mjs).
- Linting: ESLint (eslint.config.mjs).
- Target Integration: The Obsidian application environment via its plugin API.

##### Elements
- Clear labels for each component (e.g., “Manifest”, “Core Logic”, “Settings”, “Test Environment”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration & Development
    subgraph "Configuration & Development"
        Manifest["Manifest"]:::config
        BuildInfra["Build & Configuration Infrastructure"]:::config
    end

    %% Plugin Core
    subgraph "Plugin Core"
        Core["Core Plugin Logic"]:::core
        Settings["Plugin Settings"]:::core
        Suggest["Changelog Suggestion Logic"]:::core
    end

    %% Runtime Environment
    subgraph "Runtime Environment"
        Obsidian["Obsidian Environment"]:::runtime
        FileEvents["File System Events"]:::runtime
    end

    %% User Interaction
    subgraph "User Interaction"
        Command["Command Palette Trigger"]:::user
    end

    %% Testing
    subgraph "Testing"
        TestEnv["Test Environment"]:::test
    end

    %% Connections
    Obsidian -->|"loads"| Manifest
    Manifest -->|"initializes"| Core
    Core -->|"manages"| Settings
    Core -->|"calls"| Suggest
    FileEvents -->|"triggers"| Core
    Command -->|"invokes"| Core
    TestEnv -->|"simulates"| Obsidian

    %% Click Events
    click Manifest "https://github.com/philoserf/obsidian-vault-changelog/blob/main/manifest.json"
    click Core "https://github.com/philoserf/obsidian-vault-changelog/blob/main/src/main.ts"
    click Settings "https://github.com/philoserf/obsidian-vault-changelog/blob/main/src/settings.ts"
    click Suggest "https://github.com/philoserf/obsidian-vault-changelog/blob/main/src/suggest.ts"
    click BuildInfra "https://github.com/philoserf/obsidian-vault-changelog/blob/main/build.mjs"
    click TestEnv "https://github.com/philoserf/obsidian-vault-changelog/tree/main/test-vault"

    %% Styles
    classDef config fill:#FAD7A0,stroke:#C0392B,stroke-width:2px;
    classDef core fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef runtime fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef user fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef test fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
