Skip to content

Decide: should template-sync be owned by the markdown plugin? #62

@mindsocket

Description

@mindsocket

Background

template-sync syncs Obsidian template files with schema examples. It reads templateDir, templatePrefix, and fieldMap from the markdown plugin config, making it inherently markdown-specific.

The plugin architecture currently supports a parse hook. If plugins could also register CLI commands, template-sync would naturally live inside the markdown plugin, alongside the config that drives it.

Options

Option A: Plugin command registration hook
Add a commands(program: Command): void hook to OstToolsPlugin. The markdown plugin registers template-sync directly and owns all its config. The core CLI only calls plugin.commands(program) during setup.

Option B: template-sync stays global, markdown is a template provider
Treat template syncing as a generic capability — define a templateSync hook on OstToolsPlugin so any plugin can provide templates. The core template-sync command invokes whichever plugin supports it. Less opinionated but adds abstraction for a single use case.

Option C: Keep as-is, accept the coupling
template-sync is explicitly a markdown workflow tool. The coupling to the markdown plugin is intentional and documented. No architecture change needed.

Current state

The config lookup (getMarkdownConfig) is encapsulated in the markdown plugin module, so index.ts doesn't reach into markdown internals by key. The residual coupling is that template-sync as a top-level command implies all spaces use markdown templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions