mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
chore(cli): Prep for cli release
Also tweak readme and list command desc
This commit is contained in:
11
deps/cli/CHANGELOG.md
vendored
11
deps/cli/CHANGELOG.md
vendored
@@ -1,3 +1,14 @@
|
||||
## 0.4.0
|
||||
* BREAKING CHANGE: Commands that call local graphs are invoked with `-g` instead of as an argument e.g. `logseq search foo -g db-name` instead of `logseq search db-name foo`
|
||||
* Add `import-edn` command for local and in-app graphs
|
||||
* Add `validate` command for local graphs
|
||||
* Add `export-edn` command for API mode
|
||||
* Fix most commands with API mode not respecting `$LOGSEQ_API_SERVER_TOKEN`
|
||||
* Fix API `mcp-server` command failing lazily
|
||||
* Fix commands failing confusingly when given a file graph
|
||||
* Fix `query` command with multiple local graphs not switching graphs
|
||||
* Fix API `search` command
|
||||
|
||||
## 0.3.0
|
||||
* Add mcp-server command to run a MCP server
|
||||
* All commands that have graph args and options now support local paths e.g. `logseq search $HOME/Downloads/logseq_db_yep_1751032977.sqlite foo`
|
||||
|
||||
19
deps/cli/README.md
vendored
19
deps/cli/README.md
vendored
@@ -1,6 +1,6 @@
|
||||
## Description
|
||||
|
||||
This library provides a `logseq` CLI for DB graphs. The CLI currently only applies to desktop DB graphs and requires the [database-version](/README.md#-database-version) desktop app to be installed. The CLI works offline by default which means it can also be used on CI/CD platforms like Github Actions. Most CLI commands can also interact with the current DB graph if the [HTTP Server](https://docs.logseq.com/#/page/local%20http%20server) is turned on in the Desktop app.
|
||||
This library provides a `logseq` CLI for DB graphs created using the [database-version](/README.md#-database-version). By default, the CLI works offline with local graphs. This allows for running commands automatically on CI/CD platforms like Github Actions. Most CLI commands also connect to the current DB graph in a desktop app (a.k.a. in-app graph) if the [HTTP API Server](https://docs.logseq.com/#/page/local%20http%20server) is turned on.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -24,7 +24,7 @@ Options:
|
||||
-v, --version Print version
|
||||
|
||||
Commands:
|
||||
list List graphs
|
||||
list List local graphs
|
||||
show Show DB graph(s) info
|
||||
search [options] Search DB graph
|
||||
query [options] Query DB graph(s)
|
||||
@@ -57,7 +57,11 @@ $ logseq show db-test
|
||||
| Graph initial schema version | {:major 65, :minor 7} |
|
||||
| Graph created by commit | https://github.com/logseq/logseq/commit/3c93fd2637 |
|
||||
| Graph imported by | :cli/create-graph |
|
||||
```
|
||||
|
||||
To run a command against the current desktop graph, set `$LOGSEQ_API_SERVER_TOKEN` once or set `-a` each time with a valid token for the desktop's HTTP API server:
|
||||
|
||||
```
|
||||
# Search your current graph and print highlighted results one per line like grep
|
||||
$ logseq search woot -a my-token
|
||||
Search found 100 results:
|
||||
@@ -65,9 +69,13 @@ dev:db-export woot woot.edn && dev:db-create woot2 woot.edn
|
||||
dev:db-diff woot woot2
|
||||
...
|
||||
# Can also authenticate api with $LOGSEQ_API_SERVER_TOKEN
|
||||
$ LOGSEQ_API_SERVER_TOKEN=my-token logseq search woot
|
||||
$ export LOGSEQ_API_SERVER_TOKEN=my-token
|
||||
$ logseq search woot
|
||||
...
|
||||
```
|
||||
|
||||
Here are more examples of all the available commands:
|
||||
```
|
||||
# Search a local graph
|
||||
$ logseq search page -g woot
|
||||
Search found 23 results:
|
||||
@@ -132,6 +140,11 @@ Exported 16 properties, 1 classes and 36 pages to woot.edn
|
||||
$ logseq import-edn -f woot-ontology.edn
|
||||
Imported 16 properties, 1 classes and 0 pages!
|
||||
|
||||
# Validate a local graph. Useful to run in CI
|
||||
$ logseq validate -g woot
|
||||
Read graph woot with counts: {:entities 317, :pages 159, :blocks 147, :classes 17, :properties 112, :objects 64, :property-pairs 669, :datoms 3964}
|
||||
Valid!
|
||||
|
||||
# Append text to current page
|
||||
$ logseq append add this text -a my-token
|
||||
Success!
|
||||
|
||||
2
deps/cli/src/logseq/cli.cljs
vendored
2
deps/cli/src/logseq/cli.cljs
vendored
@@ -68,7 +68,7 @@
|
||||
(js/process.exit 1))))))
|
||||
|
||||
(def ^:private table
|
||||
[{:cmds ["list"] :desc "List graphs"
|
||||
[{:cmds ["list"] :desc "List local graphs"
|
||||
:fn (lazy-load-fn 'logseq.cli.commands.graph/list-graphs)}
|
||||
{:cmds ["show"] :desc "Show DB graph(s) info"
|
||||
:description "For each graph, prints information related to a graph's creation and anything that is helpful for debugging."
|
||||
|
||||
Reference in New Issue
Block a user