Skip to content

Commit 316fdf3

Browse files
diegorvclaude
andcommitted
fix(templates): point periodic/one-on-one defaults at periodic-note/ subfolder
Context: The vault's _system/templates layout was reorganized so periodic and one-on-one templates live under a periodic-note/ subfolder, mirroring the existing quick-capture/ subfolder. DEFAULT_SETTINGS and ensureTemplatesFolder still referenced the old flat paths. Problem: - DEFAULT_SETTINGS periodic + oneOnOne templatePaths pointed at the flat _system/templates/<Name>-Note.md, which no longer exist on disk. - ensureTemplatesFolder destructured only { daily, weekly, monthly, quarterly } from periodicNotes, so the yearly template was never scaffolded for new vaults. Solution: - Repoint daily/weekly/monthly/quarterly/yearly/oneOnOne defaults at _system/templates/periodic-note/<Name>-Note.md. - Include yearly in the ensureTemplatesFolder destructure + path list. - Update the templates.service test expectations to the new paths and add the Yearly-Note.md write assertion. Behavior: New vaults scaffold all six periodic/one-on-one templates under periodic-note/ (yearly included); existing vaults resolve templates from the relocated files. Files: - src/lib/core/settings/settings.store.svelte.ts:13-50 (six templatePaths) - src/lib/plugins/templates/templates.service.ts:78-79 (add yearly) - src/tests/lib/plugins/templates/templates.service.test.ts:192-201 (paths + yearly) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c864e36 commit 316fdf3

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/lib/core/settings/settings.store.svelte.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ export const DEFAULT_SETTINGS: AppSettings = {
1010
daily: {
1111
format: 'YYYY/MM-MMM/_[journal]-[day]-DD-MM-YYYY',
1212
template: '',
13-
templatePath: '_system/templates/Daily-Note.md',
13+
templatePath: '_system/templates/periodic-note/Daily-Note.md',
1414
autoOpen: true,
1515
autoPin: true,
1616
},
1717
weekly: {
1818
format: 'YYYY/MM-MMM/[__journal-week-]WW[-]YYYY',
19-
templatePath: '_system/templates/Weekly-Note.md',
19+
templatePath: '_system/templates/periodic-note/Weekly-Note.md',
2020
},
2121
monthly: {
2222
format: 'YYYY/MM-MMM/MM-MMM',
23-
templatePath: '_system/templates/Monthly-Note.md',
23+
templatePath: '_system/templates/periodic-note/Monthly-Note.md',
2424
},
2525
quarterly: {
2626
format: 'YYYY/[_journal-quarter-]YYYY[-Q]Q',
27-
templatePath: '_system/templates/Quarterly-Note.md',
27+
templatePath: '_system/templates/periodic-note/Quarterly-Note.md',
2828
},
2929
yearly: {
3030
format: 'YYYY/YYYY',
31-
templatePath: '_system/templates/Yearly-Note.md',
31+
templatePath: '_system/templates/periodic-note/Yearly-Note.md',
3232
},
3333
},
3434
quickCapture: {
@@ -47,7 +47,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
4747
workPeopleFolder: 'Work/_people',
4848
folderFormat: 'YYYY/MM-MMM',
4949
filenameFormat: '[-1on1-]{person}[-]DD-MM-YYYY',
50-
templatePath: '_system/templates/One-On-One.md',
50+
templatePath: '_system/templates/periodic-note/One-On-One.md',
5151
},
5252
layout: {
5353
sidebarMode: 'types',

src/lib/plugins/templates/templates.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export async function ensureTemplatesFolder(): Promise<void> {
7575
if (!vaultPath) return;
7676

7777
const folderPath = buildTemplatesFolderPath(vaultPath, settingsStore.templates.folder);
78-
const { daily, weekly, monthly, quarterly } = settingsStore.periodicNotes;
79-
const templatePaths = [daily, weekly, monthly, quarterly]
78+
const { daily, weekly, monthly, quarterly, yearly } = settingsStore.periodicNotes;
79+
const templatePaths = [daily, weekly, monthly, quarterly, yearly]
8080
.map((s) => s.templatePath)
8181
.filter((p): p is string => !!p);
8282

src/tests/lib/plugins/templates/templates.service.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,17 @@ describe('ensureTemplatesFolder', () => {
189189
// Phase 8.8: folder creation routes through Rust `create_folder`.
190190
const { invoke } = await import('@tauri-apps/api/core');
191191
expect(invoke).toHaveBeenCalledWith('create_folder', { path: '/vault/_system/templates' });
192-
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/Daily-Note.md', '');
193-
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/Weekly-Note.md', '');
194-
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/Monthly-Note.md', '');
195-
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/Quarterly-Note.md', '');
192+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/Daily-Note.md', '');
193+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/Weekly-Note.md', '');
194+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/Monthly-Note.md', '');
195+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/Quarterly-Note.md', '');
196+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/Yearly-Note.md', '');
196197
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/quick-capture/Composer-Note.md', '');
197198
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/quick-capture/Clip-Note.md', '');
198199
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/quick-capture/Link-Note.md', '');
199200
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/quick-capture/Shot-Note.md', '');
200201
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/quick-capture/File-Note.md', '');
201-
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/One-On-One.md', '');
202+
expect(writeTextFile).toHaveBeenCalledWith('/vault/_system/templates/periodic-note/One-On-One.md', '');
202203
expect(refreshTree).toHaveBeenCalled();
203204
});
204205

0 commit comments

Comments
 (0)