mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
1.8 KiB
1.8 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
- Build:
npm run build(runs type check and esbuild in production mode) - Dev:
npm run dev(builds in watch mode using esbuild) - Lint:
npm run lint(runs eslint check) - Test:
npm run test(runs vitest suite) - Version bump:
npm run version(updates manifest.json and versions.json via script)
Code Architecture
- Type: Obsidian Plugin (TypeScript) that syncs vault files with a GitLab or GitHub repository.
- Entry Point:
src/main.tscontains the mainGitLabFilesPushclass extendingPlugin. - Settings:
src/settings.tsdefinesGitLabFilesPushSettingsinterface,DEFAULT_SETTINGSobject, andGitLabSyncSettingTabfor the Obsidian UI. - Services:
src/services/abstracts the git provider behindGitServiceInterface, withGitHubServiceandGitLabServiceimplementations sharing common logic viaBaseGitService. - Sync logic:
src/logic/sync-manager.tshandles push/pull, conflict detection, and rename detection;src/logic/gitignore-manager.tsmerges local and remote.gitignorerules. - UI:
src/ui/SyncStatusView.tsrenders the sync status side panel;src/ui/components/holds its sub-views. - Bundling: Uses
esbuild.config.mjsfor compilation from TypeScript to a singlemain.jsfile. - Deployment: Relies on
manifest.jsonfor plugin metadata andversions.jsonfor version mapping/compatibility.
Conventions
- Use
this.loadData()andthis.saveData()for persistent settings. - Use
this.addCommand()for registration in the Command Palette. - Use
this.addRibbonIcon()for left-sidebar buttons. - Use
this.registerDomEvent()andthis.registerInterval()to ensure automatic cleanup when the plugin is disabled.