CLI

Summary

The Dendron CLI exposes Dendron's functionality via the command line.

Common Options

Common Options

wsRoot

This only needs to be set if you are not executing the CLI from within the root of your workspace or in a subdirectory of an existing workspace

vault

Path to a vaults. If not given and not a multi vault workspace, Dendron will use the only existing vault. Otherwise, will ask for you to specify a vault

useLocalEngine

Runs the command called using the in memory engine instead of connecting to a server.

Engine Commands

doctor

Summary

Fix your notes using doctor

Usage

NOTE: the fixFrontmatter option is only available via the plugin at this time

doctor helps you fix your notes

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --action          what action the doctor should take
      [string] [choices: "fixFrontmatter", "h1ToTitle", "h1ToH2", "removeStubs",
              "createMissingLinkedNotes", "regenerateNoteId", "findBrokenLinks",
           "fixRemoteVaults", "fixAirtableMetadata", "addMissingDefaultConfigs",
                    "removeDeprecatedConfigs", "fixSelfContainedVaultsInConfig"]
  --query           run doctor over a query                             [string]
  --limit           limit num changes                                   [number]
  --dryRun          dry run                                            [boolean]
  --podId           podId used to export note(s) to Airtable            [string]

Options

--action

What action should the doctor take to mend the notes.

Values:

  • h1ToTitle:

    • Remove initial h1 header and use it to replace contents of title field in frontmatter

  • h1ToH2:

    • Convert all initial h1 header to h2 header

  • removeStubs:

    • Remove all stub docs

  • createMissingLinkedNotes:

    • Create notes that do not exist yet but has a wikilink to it.
    • A preview pane will appear with the notes that will be created before proceeding.
    • In a multi-vault workspace, wikilinks that do not specify a vault prefix will be omitted from the candidates.
      • In a workspace that has 2 vaults named foo and bar, the wikilink [[missing-note]] will not be a candidate for missing note creation with this command.
      • However, [[dendron://foo/missing-note]] and / or [[dendron://bar/missing-note]] will be recognized as a missing note and will be listed as candidates.

  • regenerateNoteId:

    Regenerates the IDs of your notes.

    • Command: Dendron: Doctor
    • Option: regenerateNoteId

    If you publish your notes, this will break the published links to your notes.

    To change the scope of using this command (single note vs. workspace), remember to follow the notice in Dendron Doctor Details.

  • findBrokenLinks:

    Similar to createMissingLinkedNotes: find all broken links (that have a vault prefix). This does note create new notes.

    • Command: Dendron: Doctor
    • Option: findBrokenLinks

    This simply lists all broken links in the scope.

  • fixRemoteVaults:

    If you have a remote vault that is not correctly marked as such in the configuration, this action will fix your config file for you.

    • Command: Dendron: Doctor
    • Option: fixRemoteVaults

  • fixAirtableMetadata:

    Update airtable export pod metadata to latest version. Before running this command, Navigate to the domain of the hiearchy (eg. tasks) that is currently exported When run, the doctor will ask for the following:

    • hierarchy to export (same hierarchy you are currently on)
    • pod id that this hierarchy is exported to (select the relevant pod config)

    After doctor has run, it will convert all scalar airtable destinations to the new value

  • addMissingDefaultConfigs:

    • Detects if there are any missing configurations that are required or has a default value in dendron.yml.

    • When a missing configuration exists, a backup of dendron.yml is created and the missing keys are added with their corresponding default values.

    • Command: Dendron: Doctor

    • Option: addMissingDefaultConfigs

  • removeDeprecatedConfigs:

    • Detects if there are any deprecated configurations that are still in dendron.yml.

    • When a deprecated configuration key exists, a backup of dendron.yml is created and the deprecated keys are removed.

    • Command: Dendron: Doctor

    • Option: removeDeprecatedConfigs

  • fixSelfContainedVaultsInConfig: Fixes issues in the dendron.yml when using/moving to a self-contained vault

Examples

  • convert all h1 tags to frontmatter title values for the readings hierarchy
dendron doctor --wsRoot . --action h1ToTitle --limit 10 --query "readings.*" 
  • see log
LOG_LEVEL=info LOG_DST=stdout dendron doctor --wsRoot . --action h1ToTitle --limit 10 

launchEngineServer

Summary

Launch an instance of dendron engine

Usage

Launch the (In Progress)Dendron server. Useful for development purposes or to launch the server in a specified port

The CLI will also write out .dendron.* metadata files in the workspace root just the same as the Dendron plugin.

launch instance of dendron engine

Options:
  --version      Show version number                                   [boolean]
  --help         Show help                                             [boolean]
  --wsRoot       location of workspace
  --vault        name of vault
  --quiet        don't print output to stdout
  --port         port to launch server                                  [number]
  --init         initialize server                                     [boolean]
  --noWritePort  don't write the port to a file                        [boolean]
  --fast         launch engine without indexing                        [boolean]

Examples

dendron launchEngineServer --wsRoot ~/Dendron/ --port 3005

Publishing Commands

Summary

Commands for publishing your notes

Usage

dendron publish <cmd>

commands for publishing notes

Positionals:
  cmd  a command to run
                 [string] [required] [choices: "init", "build", "dev", "export"]

Options:
  --version    Show version number                                     [boolean]
  --help       Show help                                               [boolean]
  --wsRoot     location of workspace
  --vault      name of vault
  --quiet      don't print output to stdout
  --dest       override where nextjs-template is located                [string]
  --attach     use existing dendron engine instead of spawning a new one
                                                                       [boolean]
  --noBuild    skip building notes                    [boolean] [default: false]
  --overrides  override existing siteConfig properties                  [string]
  --target     export to specific destination                           [string]
  --sitemap    generates a sitemap
  --yes        automatically say yes to all prompts

See Publish for more information about publishing your notes.

Commands

init

Initialize Next.js template and all dependencies

build

Prepare notes for publication. Runs Next.js pod in the background.

dev

Builds notes and starts a local dev server. Behind the scenes, runs dendron publish build && npx next dev

export

Export notes as static HTML

Examples

  • build and preview the site locally
dendron publish dev
  • build your site to prepare for publication

    • Run this command inside the root of your workspace
    npx dendron publish build
    

  • override a default option while building

dendron publish build --overrides="siteUrl=foo.com"

Pod Commands

Summary

CLI commands for interacting with pods

NOTE: you can find pod ids in the pods page

Usage

Commands

Export Pod

Summary

Use pods to export your notes to another pod type

Usage

Actions

The below provide an overview of the purpose of action the doctor command can run.

use a pod to export notes

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --podId           id of pod to use
  --showConfig      show pod configuration
  --genConfig       show pod configuration
  --podPkg          if specifying a custom pod, name of pkg
  --config          pass in config instead of reading from file. format is comma
                    delimited {key}={value} pairs
  --podSource       podSource[choices: "custom", "builtin"] [default: "builtin"]

Examples

  • export note to a JSONpod
dendron exportPod --podId dendron.json --wsRoot . 

Import Pod

Summary

Use pods to import your notes from another pod type

Usage

use a pod to import notes

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --podId           id of pod to use
  --showConfig      show pod configuration
  --genConfig       show pod configuration
  --podPkg          if specifying a custom pod, name of pkg
  --config          pass in config instead of reading from file. format is comma
                    delimited {key}={value} pairs
  --podSource       podSource[choices: "custom", "builtin"] [default: "builtin"]

Examples

  • Import notes from FilePod
dendron importPod --podId dendron.markdown --wsRoot . 

Publish Pod

Summary

Publish a note to a pod

Usage

publish a note

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --podId           id of pod to use
  --showConfig      show pod configuration
  --genConfig       show pod configuration
  --podPkg          if specifying a custom pod, name of pkg
  --config          pass in config instead of reading from file. format is comma
                    delimited {key}={value} pairs
  --podSource       podSource[choices: "custom", "builtin"] [default: "builtin"]

Options

--query

Name of note to publish

Examples

  • Publish dendron.md note as Markdown
dendron publishPod --wsRoot . --podId dendron.markdown --query dendron

Common Options

--configPath

Path to a custom yml configuration for the pod

Vault Commands

Summary

Manage your vaults via the CLI

Usage

vault related commands

Positionals:
  cmd  a command to run       [string] [required] [choices: "create", "convert"]

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --vaultPath       path to vault                            [string] [required]
  --noAddToConfig   if set, don't add vault to dendron.yml             [boolean]
  --remoteUrl       If converting to a remote vault, URL of the remote to use.
                    Like https://github.com/dendronhq/dendron-site.git or
                    git@github.com:dendronhq/dendron-site.git           [string]
  --type            If converting a vault, what type of vault to convert it to.
                                           [string] [choices: "remote", "local"]

Commands

create

Create a new vault within the workspace

convert

Convert a vault from remote to local, or local to remote

Examples

  • Create a new vault
dendron vault create --vaultPath kevin-test --wsRoot .
  • Convert a vault to remote from local
dendron vault convert --vaultPath kevin-test --wsRoot . --type remote --remoteURL https://github.com/dendronhq/dendron-site.git

Workspace Commands

Summary

Manage your workspace via the CLI

Usage

dendron workspace <cmd>

workspace related commands

Positionals:
  cmd  a command to run
           [string] [required] [choices: "pull", "push", "addAndCommit", "sync",
                                                  "removeCache", "init", "info"]

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]

Commands

init

Initialize a Workspace.

pull

Run git pull --rebase on all vaults inside workspace

push

Run git push on all vaults inside workspace

addAndCommit

Run git add . && git commit on all vaults inside the workspace

sync

Run addAndCommit, pull, and push on all vaults inside the workspace. This follows the same configuration as the Workspace: Sync command in the extension, see Workspace Sync for details.

Note Commands

Summary

Usage

note related commands

Positionals:
  cmd  a command to run[string] [required] [choices: "lookup", "delete", "move"]

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --query           the query to run                                    [string]
  --output          format to output in
            [string] [choices: "json", "md_gfm", "md_dendron"] [default: "json"]
  --destFname       name to change to (for move)                        [string]
  --destVaultName   vault to move to (for move)                         [string]

Commands

lookup

Find or create a note if one does not exist, outputting in a specified format.

delete

Delete a note from a vault.

move

Move a note to another vault, or rename a note within a workspace.

Options

--query

Note to query for. Same syntax as Lookup

--output

Controls how note is formatted

Values:

  • json: JSON output
  • md_dendron: dendron markdown
  • md_gfm: github flavored markdown

Examples

  • Creating a note
# creates hello if it does not exist
dendron note lookup --query "hello" 
  • Querying a note
# retrieves hello.md if it does exist
dendron note lookup --query "hello" 
  • Querying a note with GitHub Flavored Markdown output
# retrieves hello.md if it does exist
dendron note lookup --query "hello" --output md_gfm
  • Deleting a note
dendron note delete --query "foo" 
  • Deleting a note within a multi-vault workspace
dendron note delete --vault vault2 --query "foo" 
  • Moving a note
# renames the note "foo" to "bar" within a single-vault workspace
#   if there is no note in the vault already named "bar"
dendron note move --query "foo" --destFname "bar"
  • Moving a note in a multi-vault workspace
# moves the note "foo" to vault2 and changes its name to "bar"
#    if there is no note in vault2 already named "bar"
dendron note move --vault vault --query "foo" --destFname "bar" --destVaultName vault2

Dev Commands

dendron dev <cmd>

commands related to development of Dendron

Positionals:
  cmd  a command to run
      [string] [required] [choices: "generate_json_schema_from_config", "build",
       "bump_version", "publish", "sync_assets", "sync_tutorial", "prep_plugin",
    "package_plugin", "install_plugin", "enable_telemetry", "disable_telemetry",
                           "show_telemetry", "show_migrations", "run_migration"]

Options:
  --version           Show version number                              [boolean]
  --help              Show help                                        [boolean]
  --wsRoot            root directory of the Dendron workspace
  --vault             name of vault
  --quiet             don't print output to stdout
  --upgradeType       how to do upgrade
                              [choices: "major", "minor", "patch", "prerelease"]
  --publishEndpoint   where to publish              [choices: "local", "remote"]
  --extensionTarget   extension name to publish in the marketplace
                                                 [choices: "dendron", "nightly"]
  --fast              skip some checks
  --skipSentry        skip upload source map to sentry
  --migrationVersion  migration version to run
                     [choices: "0.83.0", "0.55.2", "0.51.4", "0.47.1", "0.46.0"]


Backlinks