Skip to content

feat: add CLI handler for template-based note creation#1703

Merged
Zachatoo merged 3 commits intoSilentVoid13:masterfrom
brandaogabriel7:feat/cli-handler
Apr 11, 2026
Merged

feat: add CLI handler for template-based note creation#1703
Zachatoo merged 3 commits intoSilentVoid13:masterfrom
brandaogabriel7:feat/cli-handler

Conversation

@brandaogabriel7
Copy link
Copy Markdown
Contributor

@brandaogabriel7 brandaogabriel7 commented Mar 5, 2026

Summary

Fixes #1702

  • Adds templater:create-from-template CLI handler using Obsidian's registerCliHandler API (v1.12.2+)
  • Enables silent, headless creation of templated notes via command line
  • Resolves templates from configured templates folder or full vault path

Usage

obsidian templater:create-from-template template="MyTemplate" file="Path/To/Note.md"
obsidian templater:create-from-template template="MyTemplate" file="Path/To/Note.md" open
Parameter Required Description
template Yes Template path (relative to vault or templates folder, .md optional)
file Yes Output file path (relative to vault root)
open No Opens the created file in the UI

Changes

  • src/handlers/CommandHandler.ts - CLI handler registration and logic
  • src/types.ts - TypeScript declarations for Obsidian CLI API
  • manifest.json - Updated minAppVersion to 1.12.2
  • package.json - Updated obsidian dependency to 1.12.2
  • tests/CommandHandler.test.ts - Test suite

Test plan

  • Build passes (npm run build)
  • Lint passes on new code
  • Test build compiles (npm run test-build)
  • All CLI handler tests pass in Obsidian
  • Manual CLI test with real template

brandaogabriel7 and others added 2 commits March 4, 2026 23:11
Implements a `templater:create-from-template` CLI handler using Obsidian's
registerCliHandler API (v1.12.2+), enabling silent headless creation of
templated notes via command line.
Comment thread src/types.ts Outdated
@Zachatoo Zachatoo merged commit 6740eab into SilentVoid13:master Apr 11, 2026
@Zachatoo
Copy link
Copy Markdown
Collaborator

Thank you!

C-Bjorn pushed a commit to C-Bjorn/Templater that referenced this pull request Apr 21, 2026
…1703)

* feat: add CLI handler for template-based note creation

Implements a `templater:create-from-template` CLI handler using Obsidian's
registerCliHandler API (v1.12.2+), enabling silent headless creation of
templated notes via command line.

fixes: SilentVoid13#1702

* Update pnpm-lock.yaml file

* Update src/types.ts

---------

Co-authored-by: Zachatoo <Zachatoo@users.noreply.github.com>
Co-authored-by: Zach Young <6936914+Zachatoo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add CLI handler for silent template-based note creation (registerCliHandler)

2 participants