diff options
| author | Adam Malczewski <[email protected]> | 2026-03-28 19:26:58 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-03-28 19:26:58 +0900 |
| commit | ab6d09df695c5cdfa21aa8005f00ebf2bd37df2b (patch) | |
| tree | ae4f994a85b2ba52a9c8e8626c6d8ae9dd2e4cf4 /.rules/plan/calendar-phase-1.md | |
| parent | 80b35f3a606753ba804445e120eb9a7f05afef85 (diff) | |
| download | ai-pulse-obsidian-plugin-ab6d09df695c5cdfa21aa8005f00ebf2bd37df2b.tar.gz ai-pulse-obsidian-plugin-ab6d09df695c5cdfa21aa8005f00ebf2bd37df2b.zip | |
split of big plan
Diffstat (limited to '.rules/plan/calendar-phase-1.md')
| -rw-r--r-- | .rules/plan/calendar-phase-1.md | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/.rules/plan/calendar-phase-1.md b/.rules/plan/calendar-phase-1.md new file mode 100644 index 0000000..a1f9b2e --- /dev/null +++ b/.rules/plan/calendar-phase-1.md @@ -0,0 +1,64 @@ +# Phase 1: Daily Note Manager (`src/calendar/daily-notes.ts`) + +**Status:** Not started +**Depends on:** Nothing (standalone) +**Output file:** `src/calendar/daily-notes.ts` + +--- + +## Overview + +Core module — no UI, just logic. All daily note path computation, CRUD, indexing, and date detection lives here. + +--- + +## Storage Structure + +``` +{rootFolder}/{YYYY}/{MM}/{DD}/{YYYY-MM-DD}.md +``` + +- **`rootFolder`** — configurable, defaults to `"Calendar"` +- **Year** — 4-digit (`2026`) +- **Month** — 2-digit zero-padded (`01`–`12`) +- **Day** — 2-digit zero-padded (`01`–`31`) +- **Filename** — `YYYY-MM-DD.md` (ISO date) + +--- + +## Functions + +``` +- getDailyNotePath(date: Moment, rootFolder: string): string + Computes: `{rootFolder}/{YYYY}/{MM}/{DD}/{YYYY-MM-DD}.md` + +- getDailyNote(app: App, date: Moment, rootFolder: string): TFile | null + Looks up vault file at the computed path. + +- createDailyNote(app: App, date: Moment, rootFolder: string, template?: string): Promise<TFile> + Creates parent folders if needed, creates the file. + Uses template content if configured, else empty with frontmatter: + --- + date: YYYY-MM-DD + --- + +- openDailyNote(app: App, date: Moment, rootFolder: string, opts: { newLeaf: boolean }): Promise<void> + Opens existing note or creates then opens. + +- indexDailyNotes(app: App, rootFolder: string): Map<string, TFile> + Scans `{rootFolder}/` recursively, parses YYYY/MM/DD structure, + returns Map<"YYYY-MM-DD", TFile>. + +- getDateFromDailyNote(file: TFile, rootFolder: string): Moment | null + Reverse lookup: given a TFile, extract the date if it lives + in the daily note folder structure. +``` + +--- + +## Notes + +- `moment.js` is available globally in Obsidian as `window.moment()`. No import needed. +- `indexDailyNotes()` scans only the calendar root folder, not the entire vault. +- Template support: if `calendarDailyNoteTemplate` is set, new daily notes copy that file's content (with `{{date}}` placeholder replacement). +- The `day/` folder can hold multiple notes per day for future expansion, but the calendar UI currently shows one note per day. |
