How phibr0/obsidian-commander works
Project Type and Purpose
• Project type: A full‑stack (front‑end + runtime) Obsidian plugin written in TypeScript/React that extends the Obsidian UI.
• Purpose: Allow users to add, remove, reorder, and hide custom commands in various Obsidian UI areas (left ribbon, status bar, title bar, menu, page header).
File Structure
• Top‑level:
• manifest.json, package.json, scripts/, src/, locale/, styles/, build configs, GitHub/workflows.
• src/:
• src/main.ts – plugin entry point (initializes plugin, registers commands).
• src/manager/commands – logic to register, update, and remove command placements.
• src/assets, src/constants.ts, src/types.ts, src/l10n.ts – shared assets, types, localization loader.
• locale/: language JSON files for i18n.
• styles/: SASS/Tailwind config for UI theming.
• GitHub/workflows/release.yml – CI/CD pipeline for packaging and publishing the plugin.
README for Insights
• Confirms that the core functionality is to extend UI sections with custom commands.
a. Main Components
1. Obsidian Host (external service)
2. Plugin Loader (Obsidian runtime reads manifest.json)
3. Plugin Core (src/main.ts)
4. Command Manager (src/manager/commands/*)
5. UI Layer (React components in src/ui)
6. Localization Module (src/l10n.ts + locale JSON)
7. Storage (Obsidian’s Setting API for persisting command configurations)
8. Build Pipeline (scripts/ + esbuild + tailwind.config.js)
b. Relationships & Interactions
• On startup, Obsidian loads the Plugin Loader which invokes Plugin Core.
• Plugin Core hands off to the Command Manager to scan existing UI areas via Obsidian API.
• Command Manager registers hooks/commands in UI areas.
• When user opens settings, Plugin Core renders the UI Layer in a modal.
• UI Layer components call back into Command Manager to add/edit/delete/reorder commands.
• Command Manager updates persistent settings via Obsidian Storage API.
• Localization Module provides translated strings to UI Layer at render time.
• Build Pipeline compiles all src/TSX into a single JS bundle, injects manifest, and packages for release.
c. Architectural Patterns & Principles
• Modular separation of concerns: “manager” for logic, “ui” for presentation, “locale” for i18n.
• Plugin API boundary: the only external dependency is the Obsidian Plugin API.
• Reactive UI: user actions in React components immediately trigger manager updates.
d. Key Technologies & Frameworks
• TypeScript for type safety
• React/TSX for UI components
• SASS/Tailwind for styling
• esbuild for bundling
• Obsidian Plugin API for integration
• GitHub Actions for CI/CD
Final Advice
• Every directory as its own component or sub‑component to reflect the true modular structure.
• Be explicit about data persistence (settings JSON via Obsidian API).
• Don’t omit the build/deployment step—this is crucial for plugin packaging.