dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.73k stars 256 forks source link

Bug: The Dendron CLI cannot initialize workspaces #3163

Open benhsm opened 2 years ago

benhsm commented 2 years ago

Please select the area your bug applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

Describe the bug

It doesn't seem to be possible to initialize workspaces using the Dendron CLI. When this is attempted, the CLI program checks for a dendron.yml file and fails because it does not exist (because the workspace directory has yet to be initialized).

To Reproduce

Steps to reproduce the behavior:

  1. In a terminal, make a new empty directory and cd into it
  2. Run the command dendron workspace init --wsRoot ./

Expected behavior

I would expect that as when running "Dendron: Initialize Workspace" from within the plugin, the CLI would give me the option to make either a code workspace or a native workspace, and then populate the directory specified by the argument following --wsRoot with all the necessary files.

Screenshots

Terminal output from doing the above:

$ dendron workspace init --wsRoot ./ 
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]

Error: ENOENT: no such file or directory, open 'dendron.yml'
    at Object.openSync (node:fs:591:3)
    at Object.readFileSync (node:fs:459:35)
    at readYAML (/usr/lib/node_modules/@dendronhq/dendron-cli/node_modules/@dendronhq/common-server/lib/files.js:64:54)
    at DConfig.getRaw (/usr/lib/node_modules/@dendronhq/dendron-cli/node_modules/@dendronhq/engine-server/lib/config.js:33:53)
    at WorkspaceCLICommand.validateConfig (/usr/lib/node_modules/@dendronhq/dendron-cli/lib/src/commands/base.js:123:55)
    at CLICommand.eval [as handler] (/usr/lib/node_modules/@dendronhq/dendron-cli/lib/src/commands/base.js:49:28)
    at Object.runCommand (/usr/lib/node_modules/@dendronhq/dendron-cli/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/usr/lib/node_modules/@dendronhq/dendron-cli/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.get [as argv] (/usr/lib/node_modules/@dendronhq/dendron-cli/node_modules/yargs/build/lib/yargs.js:986:25)
    at Object.<anonymous> (/usr/lib/node_modules/@dendronhq/dendron-cli/lib/bin/dendron-cli.js:40:52) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'dendron.yml'
}

Desktop (please complete the following information)

kevinslin commented 2 years ago

thanks for the issue. we currently don't support creating a workspace via CLI, only activating it (this is confusing because we have a command called initialize workspace that creates a new workspace). going to re-classify this as a feature request. ideally, we would have dendron workspace create create the workspace (and also rename the initialize workspace command we have in the plugin but thats a separate task)

kevinslin commented 2 years ago

@benhsm let me know if you'd be interested in this task, happy to give pointers on where to get started 😇

benhsm commented 2 years ago

@kevinslin Yeah, sure I'd be willing to give it a shot :smiley:

icedwater commented 1 year ago

Hey there @benhsm @kevinslin could I take a look at it too, please? I tried getting something started in https://github.com/icedwater/vimdendron, and I think at the time it was possible to do dendron workspace init, but now I see that since 0.99.0 at least it hasn't been possible.

I'd love to be able to do my notes outside VSCode.