fix(demo-vault): export invoke() from startup script; add Invocables folder

CodeScript Toolkit runs the startup script via `startupScript.invoke(app)`, so a
top-level script with no `invoke` export threw `this.startupScript.invoke is not
a function` on vault open. Wrap the body in an exported `invoke(app)`. Also add an
empty `Invocables/` folder so every demo vault has the same CodeScript Toolkit
layout regardless of whether it ships invocable scripts.
This commit is contained in:
Michael Naumov 2026-07-20 14:18:25 -06:00
parent 1bd9782bd8
commit 494a720704
2 changed files with 10 additions and 3 deletions

View file

@ -2,9 +2,16 @@
// Toolkit's require) once CodeScript Toolkit is installed and enabled. This is where each
// plugin's demo vault does its own startup setup. Here it just opens the landing note.
import type { App } from 'obsidian';
const START_NOTE_PATH = '00 Start.md';
const startNote = app.vault.getFileByPath(START_NOTE_PATH);
if (startNote) {
void app.workspace.getLeaf(false).openFile(startNote);
// Run by CodeScript Toolkit on load (its `startupScriptPath` setting, which the Demo Vault Helper
// points here). CST calls the exported `invoke` — a top-level script with no `invoke` export throws
// `this.startupScript.invoke is not a function`.
export async function invoke(app: App): Promise<void> {
const startNote = app.vault.getFileByPath(START_NOTE_PATH);
if (startNote) {
await app.workspace.getLeaf(false).openFile(startNote);
}
}