Contributing
Development setup
Section titled “Development setup”-
Clone the repository:
Terminal window git clone https://github.com/cybersader/postpartum-tracker.gitcd postpartum-tracker -
Install dependencies:
Terminal window bun install -
Build the plugin:
Terminal window bun run build -
For development with auto-rebuild:
Terminal window bun run dev
Project structure
Section titled “Project structure”The plugin source lives in src/. Build output (main.js) is generated in the project root alongside manifest.json and styles.css.
src/ main.ts Plugin entry point types.ts All interfaces and defaults settings.ts Settings tab StatusBarManager.ts Status bar display data/ CodeBlockStore.ts JSON persistence TrackerRegistry.ts Module registration dateUtils.ts Day boundary helpers nlp/ QuickEntryParser.ts Rules-based NLP parser trackers/ BaseTracker.ts TrackerModule interface library.ts SimpleTrackerDef catalog logicPacks.ts Logic pack milestone definitions milestoneEvaluator.ts Milestone rule engine feeding/FeedingTracker.ts Core: feeding feeding/feedingStats.ts diaper/DiaperTracker.ts Core: diapers diaper/diaperStats.ts medication/MedicationTracker.ts Core: medication medication/medicationStats.ts comment/CommentTracker.ts Core: notes & comments simple/SimpleTrackerModule.ts Library: generic module class simple/simpleTrackerStats.ts widget/ TrackerWidget.ts Main widget (MarkdownRenderChild) CollapsibleSection.ts Reorderable sections QuickActions.ts Button grid QuickEntrySection.ts NLP quick entry UI DailySummary.ts Summary strip AlertsPanel.ts Health alerts EventHistorySection.ts Unified event feed shared/ BigButton.ts Touch-friendly buttons TimerDisplay.ts Live timer component EntryList.ts Scrollable entry list InlineEditPanel.ts Inline edit forms FieldRenderer.ts Dynamic field rendering ui/ TrackerEditModal.ts Modal edit dialog integrations/ TodoistService.ts Todoist API v1 notifications/ NotificationService.ts Periodic scanner + dispatch ToastNotification.ts In-app toast UI utils/ dom.ts DOM helpers formatters.ts Time/date formatting deepMerge.ts Settings merge utilitySee Architecture for a detailed breakdown.
Build commands
Section titled “Build commands”| Command | Description |
|---|---|
bun run build | TypeScript type-check + esbuild bundle |
bun run dev | Watch mode (rebuilds on file changes) |
bun test | Run tests |
npm run lint | ESLint with Obsidian plugin rules |
Testing
Section titled “Testing”The plugin directory is itself an Obsidian vault plugin folder. To test:
- Build with
bun run build. - Open the parent vault in Obsidian (the one containing
.obsidian/plugins/obsidian-postpartum-tracker/). - Enable the plugin in Settings > Community Plugins.
- Open
Baby Tracker.md(or insert a new tracker code block).
The Hot Reload community plugin is recommended for automatic reloading during development.
Adding a new library tracker
Section titled “Adding a new library tracker”The easiest way to contribute a new tracker is through the simple tracker system:
- Add a
SimpleTrackerDeftosrc/trackers/library.ts. - That’s it — rebuild and the tracker appears in the library.
See Simple tracker API for the full field reference.
Releasing
Section titled “Releasing”Releases are created via a shell script that bumps the version, creates a git tag, and pushes. GitHub Actions builds and publishes the release.
bash scripts/release.sh 0.4.0This script:
- Validates the version argument.
- Updates
manifest.jsonandversions.jsonviaversion-bump.mjs. - Runs
bun run build. - Commits, tags, and pushes.
- GitHub Actions creates a release with
main.js,manifest.json, andstyles.css.
Documentation site
Section titled “Documentation site”The docs site (what you’re reading now) uses Astro Starlight and lives in the docs/ directory.
cd docsbun installbun run dev # Local preview at localhost:4321bun run build # Production buildDocumentation is deployed automatically to GitHub Pages when changes to docs/ are pushed to the main branch.
Code style
Section titled “Code style”- Vanilla TypeScript + DOM (no framework)
- CSS class prefix:
pt- - Use
pointerdown/pointerupfor interactive elements in code blocks - Sort entries by timestamp after mutations
- Keep modules self-contained — each module manages its own UI and state
Pull requests
Section titled “Pull requests”- Fork the repository.
- Create a feature branch.
- Make your changes.
- Run
bun run buildto verify the build succeeds. - Run
npm run lintto check code quality. - Submit a pull request with a clear description of what changed and why.