From f751f27a6303260455ecb884ee79af60b8d6d6d8 Mon Sep 17 00:00:00 2001 From: rcmerci Date: Fri, 24 Apr 2026 22:35:00 +0800 Subject: [PATCH] refactor(cli): remove --data-dir, add --root-dir --data-dir: ~/logseq/graphs --root-dir: ~/logseq All other configuration files and data directories are derived from the root-dir --- cli-e2e/scripts/compare_graph_queries.py | 18 +- cli-e2e/scripts/db_sync_server.py | 3 +- .../scripts/random_bidirectional_block_ops.py | 14 +- cli-e2e/scripts/wait_sync_status.py | 6 +- cli-e2e/spec/non_sync_cases.edn | 372 +++++++++--------- cli-e2e/spec/non_sync_inventory.edn | 2 +- cli-e2e/spec/sync_cases.edn | 134 +++---- cli-e2e/spec/sync_inventory.edn | 2 +- cli-e2e/src/logseq/cli/e2e/runner.clj | 12 +- cli-e2e/src/logseq/cli/e2e/sync_fixture.clj | 8 +- cli-e2e/test/logseq/cli/e2e/cleanup_test.clj | 6 +- .../cli/e2e/compare_graph_queries_test.py | 14 +- .../test/logseq/cli/e2e/manifests_test.clj | 4 +- .../random_bidirectional_block_ops_test.py | 14 +- .../test/logseq/cli/e2e/sync_fixture_test.clj | 18 +- .../logseq/cli/e2e/wait_sync_status_test.py | 3 +- docs/cli/logseq-cli.md | 22 +- package.json | 3 +- src/main/frontend/worker/db_worker_node.cljs | 118 +++--- .../frontend/worker/db_worker_node_lock.cljs | 33 +- src/main/frontend/worker/platform/node.cljs | 13 +- src/main/logseq/cli/command/core.cljs | 4 +- src/main/logseq/cli/command/doctor.cljs | 26 +- src/main/logseq/cli/command/graph.cljs | 2 +- src/main/logseq/cli/command/upsert.cljs | 2 +- src/main/logseq/cli/completion_generator.cljs | 6 +- src/main/logseq/cli/config.cljs | 41 +- src/main/logseq/cli/data_dir.cljs | 33 -- src/main/logseq/cli/format.cljs | 20 +- src/main/logseq/cli/main.cljs | 19 +- src/main/logseq/cli/root_dir.cljs | 42 ++ src/main/logseq/cli/server.cljs | 75 ++-- src/main/logseq/db_worker/daemon.cljs | 6 +- .../worker/db_worker_node_lock_test.cljs | 58 +-- .../frontend/worker/db_worker_node_test.cljs | 94 ++--- .../frontend/worker/platform_node_test.cljs | 47 +-- src/test/logseq/cli/command/doctor_test.cljs | 48 +-- src/test/logseq/cli/command/graph_test.cljs | 31 +- src/test/logseq/cli/command/server_test.cljs | 4 +- src/test/logseq/cli/command/sync_test.cljs | 96 ++--- src/test/logseq/cli/commands_test.cljs | 10 +- .../logseq/cli/completion_generator_test.cljs | 12 +- src/test/logseq/cli/config_test.cljs | 50 ++- src/test/logseq/cli/data_dir_test.cljs | 49 --- src/test/logseq/cli/format_test.cljs | 38 +- src/test/logseq/cli/integration_test.cljs | 48 +-- src/test/logseq/cli/root_dir_test.cljs | 55 +++ src/test/logseq/cli/server_test.cljs | 163 ++++---- src/test/logseq/db_worker/daemon_test.cljs | 18 +- .../logseq/db_worker/ncc_bundle_test.cljs | 28 +- 50 files changed, 1012 insertions(+), 932 deletions(-) delete mode 100644 src/main/logseq/cli/data_dir.cljs create mode 100644 src/main/logseq/cli/root_dir.cljs delete mode 100644 src/test/logseq/cli/data_dir_test.cljs create mode 100644 src/test/logseq/cli/root_dir_test.cljs diff --git a/cli-e2e/scripts/compare_graph_queries.py b/cli-e2e/scripts/compare_graph_queries.py index 5bc3677d30..b5d95c1e35 100644 --- a/cli-e2e/scripts/compare_graph_queries.py +++ b/cli-e2e/scripts/compare_graph_queries.py @@ -46,12 +46,12 @@ def normalize(value: Any) -> Any: return value -def run_query(cli_path: Path, config_path: Path, data_dir: Path, graph: str, query: str) -> Dict[str, Any]: +def run_query(cli_path: Path, config_path: Path, root_dir: Path, graph: str, query: str) -> Dict[str, Any]: command = [ "node", str(cli_path), - "--data-dir", - str(data_dir), + "--root-dir", + str(root_dir), "--config", str(config_path), "--output", @@ -100,9 +100,9 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--graph", required=True) parser.add_argument("--query", required=True, action="append") parser.add_argument("--config-a", required=True) - parser.add_argument("--data-dir-a", required=True) + parser.add_argument("--root-dir-a", required=True) parser.add_argument("--config-b", required=True) - parser.add_argument("--data-dir-b", required=True) + parser.add_argument("--root-dir-b", required=True) parser.add_argument("--require-result", action="store_true") return parser.parse_args() @@ -117,9 +117,9 @@ def main() -> None: queries = args.query left_config = Path(args.config_a).expanduser().resolve() - left_data_dir = Path(args.data_dir_a).expanduser().resolve() + left_root_dir = Path(args.root_dir_a).expanduser().resolve() right_config = Path(args.config_b).expanduser().resolve() - right_data_dir = Path(args.data_dir_b).expanduser().resolve() + right_root_dir = Path(args.root_dir_b).expanduser().resolve() normalized_results = {} @@ -127,14 +127,14 @@ def main() -> None: left = run_query( cli_path, left_config, - left_data_dir, + left_root_dir, args.graph, query, ) right = run_query( cli_path, right_config, - right_data_dir, + right_root_dir, args.graph, query, ) diff --git a/cli-e2e/scripts/db_sync_server.py b/cli-e2e/scripts/db_sync_server.py index 5c879b3c43..fe041a4f92 100644 --- a/cli-e2e/scripts/db_sync_server.py +++ b/cli-e2e/scripts/db_sync_server.py @@ -128,9 +128,10 @@ def auth_cognito_from_auth_file(auth_path: Path) -> Dict[str, str]: def wait_health(base_url: str, timeout_s: float, interval_s: float) -> bool: deadline = time.time() + timeout_s url = base_url.rstrip("/") + "/health" + opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) while time.time() < deadline: try: - with urllib.request.urlopen(url, timeout=2) as response: + with opener.open(url, timeout=2) as response: if response.status == 200: return True except (urllib.error.URLError, TimeoutError, socket.timeout): diff --git a/cli-e2e/scripts/random_bidirectional_block_ops.py b/cli-e2e/scripts/random_bidirectional_block_ops.py index c0cc772f2a..d68c1ef5cd 100644 --- a/cli-e2e/scripts/random_bidirectional_block_ops.py +++ b/cli-e2e/scripts/random_bidirectional_block_ops.py @@ -25,7 +25,7 @@ class CliCommandError(RuntimeError): class ClientContext: name: str config: Path - data_dir: Path + root_dir: Path def fail(message: str, **context: object) -> None: @@ -46,8 +46,8 @@ def run_cli_json( command = [ "node", str(cli_path), - "--data-dir", - str(client.data_dir), + "--root-dir", + str(client.root_dir), "--config", str(client.config), "--output", @@ -378,9 +378,9 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--cli", required=True, help="Path to static/logseq-cli.js") parser.add_argument("--graph", required=True) parser.add_argument("--config-a", required=True) - parser.add_argument("--data-dir-a", required=True) + parser.add_argument("--root-dir-a", required=True) parser.add_argument("--config-b", required=True) - parser.add_argument("--data-dir-b", required=True) + parser.add_argument("--root-dir-b", required=True) parser.add_argument("--page", required=True) parser.add_argument( "--profile", @@ -406,12 +406,12 @@ def main() -> None: client_a = ClientContext( name="a", config=Path(args.config_a).expanduser().resolve(), - data_dir=Path(args.data_dir_a).expanduser().resolve(), + root_dir=Path(args.root_dir_a).expanduser().resolve(), ) client_b = ClientContext( name="b", config=Path(args.config_b).expanduser().resolve(), - data_dir=Path(args.data_dir_b).expanduser().resolve(), + root_dir=Path(args.root_dir_b).expanduser().resolve(), ) clients = [client_a, client_b] diff --git a/cli-e2e/scripts/wait_sync_status.py b/cli-e2e/scripts/wait_sync_status.py index d7ed1ad4eb..0c2804112d 100644 --- a/cli-e2e/scripts/wait_sync_status.py +++ b/cli-e2e/scripts/wait_sync_status.py @@ -41,8 +41,8 @@ def status_command(args: argparse.Namespace) -> list[str]: command = [ "node", str(Path(args.cli).expanduser().resolve()), - "--data-dir", - str(Path(args.data_dir).expanduser().resolve()), + "--root-dir", + str(Path(args.root_dir).expanduser().resolve()), "--config", str(Path(args.config).expanduser().resolve()), "--output", @@ -184,7 +184,7 @@ def main() -> None: required=True, help="Path to static/logseq-cli.js", ) - parser.add_argument("--data-dir", required=True) + parser.add_argument("--root-dir", required=True) parser.add_argument("--config", required=True) parser.add_argument("--graph", required=True) parser.add_argument("--timeout-s", type=float, default=120.0) diff --git a/cli-e2e/spec/non_sync_cases.edn b/cli-e2e/spec/non_sync_cases.edn index f732c22fcc..7a78f64e7d 100644 --- a/cli-e2e/spec/non_sync_cases.edn +++ b/cli-e2e/spec/non_sync_cases.edn @@ -1,17 +1,17 @@ {:templates {:non-sync/graph-json-env {:setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"], :cleanup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]}, + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"]}, :non-sync/graph-json-secondary-env {:extends :non-sync/graph-json-env, :vars {:secondary-graph "graph-two", :secondary-graph-arg "graph-two"}, :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{secondary-graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{secondary-graph-arg}} >/dev/null"], :cleanup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{secondary-graph-arg}}"]}, + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{secondary-graph-arg}}"]}, :non-sync/source-graph-json-env {:extends :non-sync/graph-json-secondary-env, :vars @@ -55,7 +55,7 @@ :tags [:global :smoke]} {:id "verbose-graph-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json --verbose graph list"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json --verbose graph list"], :expect {:exit 0, :stderr-contains [":cli/parsed-options"], @@ -63,39 +63,39 @@ :covers {:commands ["graph list"], :options - {:global ["--config" "--data-dir" "--output" "--verbose"]}}, + {:global ["--config" "--root-dir" "--output" "--verbose"]}}, :tags [:global :graph]} {:id "graph-create-and-info-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph info --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph info --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :graph] "{{graph}}"}}, :covers {:commands ["graph create" "graph info"], - :options {:global ["--config" "--graph" "--data-dir" "--output"]}}, + :options {:global ["--config" "--graph" "--root-dir" "--output"]}}, :cleanup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"], :tags [:graph :smoke]} {:id "graph-list-human", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human graph list"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human graph list"], :expect {:exit 0, :stdout-contains ["{{graph}}"]}, :covers {:commands ["graph list"], - :options {:global ["--config" "--data-dir" "--output"]}}, + :options {:global ["--config" "--root-dir" "--output"]}}, :tags [:graph], :extends :non-sync/graph-json-env} {:id "graph-list-edn", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output edn graph list"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output edn graph list"], :expect {:exit 0, :stdout-edn-paths {[:status] :ok, [:data :graphs] ["{{graph}}"]}}, :covers {:commands ["graph list"], - :options {:global ["--config" "--data-dir" "--output"]}}, + :options {:global ["--config" "--root-dir" "--output"]}}, :tags [:graph], :extends :non-sync/graph-json-env} {:tags [:graph], @@ -106,29 +106,29 @@ {[:status] "ok", [:data :message] "switched to {{secondary-graph}}"}}, :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph switch --graph {{secondary-graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph switch --graph {{secondary-graph-arg}}"], :id "graph-switch-json", :covers {:commands ["graph switch"], - :options {:global ["--config" "--graph" "--data-dir" "--output"]}}} + :options {:global ["--config" "--graph" "--root-dir" "--output"]}}} {:id "graph-validate-fix-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph validate --graph {{graph-arg}} --fix"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph validate --graph {{graph-arg}} --fix"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :result :errors] nil}}, :covers {:commands ["graph validate"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :graph ["--fix"]}}, :tags [:graph], :extends :non-sync/graph-json-env} {:id "graph-export-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page ExportHome >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page ExportHome >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{graph-arg}} --type edn --file {{export-path-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{graph-arg}} --type edn --file {{export-path-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -136,7 +136,7 @@ :covers {:commands ["graph export"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :graph ["--type" "--file"]}}, :tags [:graph], :extends :non-sync/graph-json-env} @@ -147,26 +147,26 @@ :stdout-json-paths {[:status] "ok"}, :stdout-contains ["Imported edn from" "{{export-path}}"]}, :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{secondary-graph-arg}} --page ImportSeed >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{secondary-graph-arg}} --type edn --file {{export-path-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{secondary-graph-arg}} --page ImportSeed >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph export --graph {{secondary-graph-arg}} --type edn --file {{export-path-arg}} >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph import --graph {{graph-arg}} --type edn --input {{export-path-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph import --graph {{graph-arg}} --type edn --input {{export-path-arg}}"], :id "graph-import-json", :covers {:commands ["graph import"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :graph ["--type" "--input"]}}} {:tags [:graph], :extends :non-sync/graph-json-env, :expect {:exit 0, :stdout-json-paths {[:status] "ok"}}, :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page BackupSeed >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page BackupSeed >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup create --graph {{graph-arg}} --name nightly >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup restore --src \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\" --dst {{restore-graph-arg}} >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup remove --src \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup create --graph {{graph-arg}} --name nightly >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup list" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup restore --src \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\" --dst {{restore-graph-arg}} >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup remove --src \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph backup list | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"backups\"][0][\"name\"])')\""], :id "graph-backup-lifecycle-json", :covers {:commands @@ -175,17 +175,17 @@ "graph backup restore" "graph backup remove"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :graph ["--name" "--src" "--dst"]}}, :vars {:restore-graph "backup-restore", :restore-graph-arg "backup-restore"}, :cleanup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{restore-graph-arg}}"]} + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{restore-graph-arg}}"]} {:id "page-upsert-and-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --fields title,id --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --fields title,id --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -193,15 +193,15 @@ :covers {:commands ["upsert page" "list page"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--page"], :list ["--fields" "--limit" "--sort" "--order"]}}, :tags [:upsert :list :smoke], :extends :non-sync/graph-json-env} {:id "task-upsert-and-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --priority high --scheduled '2026-02-10T08:00:00.000Z' --deadline '2026-02-12T18:00:00.000Z' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list task --graph {{graph-arg}} --status todo --priority high --content task --fields id,title,status,priority,scheduled,deadline --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --priority high --scheduled '2026-02-10T08:00:00.000Z' --deadline '2026-02-12T18:00:00.000Z' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list task --graph {{graph-arg}} --status todo --priority high --content task --fields id,title,status,priority,scheduled,deadline --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -216,7 +216,7 @@ :covers {:commands ["upsert task" "list task"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--page" "--status" "--priority" "--scheduled" "--deadline"], :list @@ -231,10 +231,10 @@ :extends :non-sync/graph-json-env} {:id "task-upsert-clear-properties-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --priority high --scheduled '2026-02-10T08:00:00.000Z' --deadline '2026-02-12T18:00:00.000Z' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --priority high --scheduled '2026-02-10T08:00:00.000Z' --deadline '2026-02-12T18:00:00.000Z' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --no-status --no-priority --no-scheduled --no-deadline >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list task --graph {{graph-arg}} --content taskhome --fields id,title,status,priority,scheduled,deadline --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --no-status --no-priority --no-scheduled --no-deadline >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list task --graph {{graph-arg}} --content taskhome --fields id,title,status,priority,scheduled,deadline --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -246,7 +246,7 @@ :covers {:commands ["upsert task" "list task"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--page" "--no-status" @@ -258,7 +258,7 @@ :extends :non-sync/graph-json-env} {:id "task-upsert-set-clear-conflict-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --no-status"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert task --graph {{graph-arg}} --page TaskHome --status todo --no-status"], :expect {:exit 1, :stdout-contains @@ -267,15 +267,15 @@ :covers {:commands ["upsert task"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--page" "--status" "--no-status"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "page-upsert-invalid-update-properties-atomic-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name AtomicTag >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name AtomicTag >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page AtomicPage --update-tags '[\"AtomicTag\"]' --update-properties '{:missing-prop \"value\"}'"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page AtomicPage --update-tags '[\"AtomicTag\"]' --update-properties '{:missing-prop \"value\"}'"], :expect {:exit 1, :stdout-json-paths @@ -287,16 +287,16 @@ :covers {:commands ["upsert page"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--page" "--update-tags" "--update-properties"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "node-list-by-tags-properties-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name NodeTag >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name node-prop >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page NodeHome --update-tags '[\"NodeTag\"]' --update-properties '{:node-prop \"v\"}' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list node --graph {{graph-arg}} --tags NodeTag --properties node-prop --fields id,title,type --sort updated-at --order desc --limit 20"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name NodeTag >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name node-prop >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page NodeHome --update-tags '[\"NodeTag\"]' --update-properties '{:node-prop \"v\"}' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list node --graph {{graph-arg}} --tags NodeTag --properties node-prop --fields id,title,type --sort updated-at --order desc --limit 20"], :expect {:exit 0, :stdout-json-paths @@ -307,7 +307,7 @@ {:commands ["upsert tag" "upsert property" "upsert page" "list node"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--name" "--page" "--update-tags" "--update-properties"], :list ["--tags" @@ -321,8 +321,8 @@ {:id "asset-upsert-and-list-json", :setup ["printf 'asset-content' > {{export-path-arg}}.png"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --path {{export-path-arg}}.png --content 'Asset One' --target-page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list asset --graph {{graph-arg}} --fields id,title,asset-type,size --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --path {{export-path-arg}}.png --content 'Asset One' --target-page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list asset --graph {{graph-arg}} --fields id,title,asset-type,size --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -333,7 +333,7 @@ :covers {:commands ["upsert asset" "list asset"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--path" "--content" "--target-page"], :list ["--fields" "--limit" "--sort" "--order"]}}, :tags [:upsert :list], @@ -341,10 +341,10 @@ {:id "asset-upsert-update-json", :setup ["printf 'asset-content' > {{export-path-arg}}.png" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --path {{export-path-arg}}.png --content 'Asset Original' --target-page Home >/dev/null"], + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --path {{export-path-arg}}.png --content 'Asset Original' --target-page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Asset Original\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Asset Updated' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list asset --graph {{graph-arg}} --fields id,title --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert asset --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Asset Original\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Asset Updated' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list asset --graph {{graph-arg}} --fields id,title --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -352,17 +352,17 @@ :covers {:commands ["upsert asset" "list asset"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--id" "--content"], :list ["--fields" "--limit" "--sort" "--order"]}}, :tags [:upsert :list], :extends :non-sync/graph-json-env} {:id "block-upsert-and-show-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json show --graph {{graph-arg}} --page Home --level 2 --linked-references false"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json show --graph {{graph-arg}} --page Home --level 2 --linked-references false"], :expect {:exit 0, :stdout-json-paths @@ -371,15 +371,15 @@ :covers {:commands ["upsert block" "show"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--target-page" "--content"], :show ["--page" "--level" "--linked-references"]}}, :tags [:upsert :show :smoke], :extends :non-sync/graph-json-env} {:id "tag-upsert-and-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --with-properties --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --with-properties --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -387,15 +387,15 @@ :covers {:commands ["upsert tag" "list tag"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--name"], :list ["--with-properties" "--sort" "--order" "--limit"]}}, :tags [:upsert :list], :extends :non-sync/graph-json-env} {:id "property-upsert-and-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-type --sort updated-at --order desc --limit 1"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-type --sort updated-at --order desc --limit 1"], :expect {:exit 0, :stdout-json-paths @@ -406,17 +406,17 @@ :covers {:commands ["upsert property" "list property"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--name" "--type" "--cardinality"], :list ["--with-type" "--sort" "--order" "--limit"]}}, :tags [:upsert :list], :extends :non-sync/graph-json-env} {:id "list-tag-expand-offset-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagA >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagB >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagA >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagB >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --expand --with-extends --sort updated-at --order desc --offset 0 --limit 20"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --expand --with-extends --sort updated-at --order desc --offset 0 --limit 20"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -424,7 +424,7 @@ :covers {:commands ["list tag"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :list ["--expand" "--with-extends" @@ -436,10 +436,10 @@ :extends :non-sync/graph-json-env} {:id "list-property-classes-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name alpha --type number --cardinality one >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name beta --type number --cardinality one >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name alpha --type number --cardinality one >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name beta --type number --cardinality one >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-classes --sort updated-at --order desc --offset 0 --limit 20"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --with-classes --sort updated-at --order desc --offset 0 --limit 20"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -447,28 +447,28 @@ :covers {:commands ["list property"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :list ["--with-classes" "--sort" "--order" "--offset" "--limit"]}}, :tags [:list], :extends :non-sync/graph-json-env} {:id "list-page-journal-only-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --journal-only"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list page --graph {{graph-arg}} --journal-only"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :items] []}}, :covers {:commands ["list page"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :list ["--journal-only"]}}, :tags [:list], :extends :non-sync/graph-json-env} {:id "search-block-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchBlockTarget >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchBlockTarget >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} search block --content blocktarget --output json --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} search block --content blocktarget --output json --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -476,15 +476,15 @@ :covers {:commands ["search block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :search ["--content"]}}, :tags [:search :smoke], :extends :non-sync/graph-json-env} {:id "search-page-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchPageTarget >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SearchPageTarget >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search page --content target --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json search page --content target --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -492,15 +492,15 @@ :covers {:commands ["search page"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :search ["--content"]}}, :tags [:search], :extends :non-sync/graph-json-env} {:id "search-property-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name SearchOwner --type default >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name SearchOwner --type default >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search property --content owner --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json search property --content owner --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -508,15 +508,15 @@ :covers {:commands ["search property"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :search ["--content"]}}, :tags [:search], :extends :non-sync/graph-json-env} {:id "search-tag-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name SearchTagTarget >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name SearchTagTarget >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json search tag --content target --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json search tag --content target --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}, @@ -524,111 +524,111 @@ :covers {:commands ["search tag"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :search ["--content"]}}, :tags [:search], :extends :non-sync/graph-json-env} {:id "block-upsert-blocks-file-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null" + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null" "printf '[{:block/title \"Inserted from file\"}]' > {{export-path-arg}}"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Anchor block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --blocks-file {{export-path-arg}} --pos sibling >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Anchor block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --blocks-file {{export-path-arg}} --pos sibling >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], :expect {:exit 0, :stdout-contains ["Inserted from file"]}, :covers {:commands ["upsert block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--blocks-file" "--target-id" "--pos"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "block-upsert-target-uuid-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Anchor block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Anchor block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Inserted by uuid' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --target-uuid \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Anchor block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Inserted by uuid' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], :expect {:exit 0, :stdout-contains ["Inserted by uuid"]}, :covers {:commands ["upsert block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--target-uuid"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "block-upsert-update-id-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by id' --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by id' --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], :expect {:exit 0, :stdout-contains ["Updated by id"]}, :covers {:commands ["upsert block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--id" "--update-tags" "--update-properties"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "block-upsert-update-id-custom-many-property-json", :vars {:prop-name "Reproducible steps"}, :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name '{{prop-name}}' --type default --cardinality many --public true >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name '{{prop-name}}' --type default --cardinality many --public true >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --update-properties '{\"{{prop-name}}\" [\"Step 1\" \"Step 2\" \"Step 3\"]}' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --update-properties '{\"{{prop-name}}\" [\"Step 1\" \"Step 2\" \"Step 3\"]}' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], :expect {:exit 0, :stdout-contains ["{{prop-name}}" "Step 1" "Step 2" "Step 3"]}, :covers {:commands ["upsert block" "show"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--id" "--target-page" "--content" "--update-properties"], :show ["--id"]}}, :tags [:upsert :show]} {:id "block-upsert-update-uuid-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' --update-tags '[:logseq.class/Quote-block]' --update-properties '{:logseq.property/publishing-public? true}' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by uuid' --remove-tags '[:logseq.class/Quote-block]' --remove-properties '[:logseq.property/publishing-public?]' >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human upsert block --graph {{graph-arg}} --uuid \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" --content 'Updated by uuid' --remove-tags '[:logseq.class/Quote-block]' --remove-properties '[:logseq.property/publishing-public?]' >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home"], :expect {:exit 0, :stdout-contains ["Updated by uuid"]}, :covers {:commands ["upsert block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--uuid" "--remove-tags" "--remove-properties"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "property-upsert-update-id-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" --hide true --public false"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" --hide true --public false"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}}, :covers {:commands ["upsert property"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :upsert ["--id" "--hide" "--public"]}}, :tags [:upsert], :extends :non-sync/graph-json-env} {:id "query-custom-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?title . :where [?b :block/title ?title] [(= ?title \"Alpha block\")]]'"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?title . :where [?b :block/title ?title] [(= ?title \"Alpha block\")]]'"], :expect {:exit 0, :stdout-json-paths @@ -636,31 +636,31 @@ :covers {:commands ["query"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :query ["--query"]}}, :tags [:query], :extends :non-sync/graph-json-env} {:id "query-named-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --name recent-updated --inputs '[1]'"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --name recent-updated --inputs '[1]'"], :expect {:exit 0, :stdout-json-paths {[:status] "ok"}}, :covers {:commands ["query"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :query ["--name" "--inputs"]}}, :tags [:query], :extends :non-sync/graph-json-env} {:id "query-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query list --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query list --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :queries 0 :name] "list-priority"}}, :covers {:commands ["query list"], - :options {:global ["--config" "--graph" "--data-dir" "--output"]}}, + :options {:global ["--config" "--graph" "--root-dir" "--output"]}}, :tags [:query], :extends :non-sync/graph-json-env} {:id "example-show-human", @@ -773,51 +773,51 @@ :vars {:example-selector "search block"}} {:id "show-id-human", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find ?e . :where [?e :block/title \"Alpha block\"]]')\""], :expect {:exit 0, :stdout-contains ["Alpha block"]}, :covers {:commands ["show"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :show ["--id"]}}, :tags [:show], :extends :non-sync/graph-json-env} {:id "show-uuid-human", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output json query --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --uuid \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output json query --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], :expect {:exit 0, :stdout-contains ["Alpha block"]}, :covers {:commands ["show"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :show ["--uuid"]}}, :tags [:show], :extends :non-sync/graph-json-env} {:id "show-stdin-id-human", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find [?e ...] :in $ ?q :where [?e :block/title ?title] [(clojure.string/includes? ?title ?q)]]' --inputs '[\"Alpha\"]' | {{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human query --query '[:find [?e ...] :in $ ?q :where [?e :block/title ?title] [(clojure.string/includes? ?title ?q)]]' --inputs '[\"Alpha\"]' | {{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --graph {{graph-arg}} --output human show --id"], :expect {:exit 0, :stdout-contains ["Alpha block"]}, :covers {:commands ["show"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :show ["stdin:--id"]}}, :tags [:show :pipe], :extends :non-sync/graph-json-env} {:id "debug-pull-id-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], :expect {:exit 0, :stdout-json-paths @@ -825,15 +825,15 @@ :covers {:commands ["debug pull"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :debug ["--id"]}}, :tags [:debug], :extends :non-sync/graph-json-env} {:id "debug-pull-uuid-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Home\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --uuid \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Home\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], :expect {:exit 0, :stdout-json-paths @@ -841,13 +841,13 @@ :covers {:commands ["debug pull"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :debug ["--uuid"]}}, :tags [:debug], :extends :non-sync/graph-json-env} {:id "debug-pull-ident-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --ident :logseq.class/Tag"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json debug pull --graph {{graph-arg}} --ident :logseq.class/Tag"], :expect {:exit 0, :stdout-json-paths @@ -855,15 +855,15 @@ :covers {:commands ["debug pull"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :debug ["--ident"]}}, :tags [:debug], :extends :non-sync/graph-json-env} {:id "debug-pull-current-graph-fallback-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json debug pull --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json debug pull --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?e . :where [?e :block/title \"Home\"]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\""], :expect {:exit 0, :stdout-json-paths @@ -871,81 +871,81 @@ :covers {:commands ["debug pull"], :options - {:global ["--config" "--data-dir" "--output"], :debug ["--id"]}}, + {:global ["--config" "--root-dir" "--output"], :debug ["--id"]}}, :tags [:debug], :extends :non-sync/graph-json-env} {:id "remove-page-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove page --graph {{graph-arg}} --page Home"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json remove page --graph {{graph-arg}} --page Home"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :result] true}}, :covers {:commands ["remove page"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :remove ["--page"]}}, :tags [:remove], :extends :non-sync/graph-json-env} {:id "graph-remove-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph remove --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph remove --graph {{graph-arg}}"], :expect {:exit 1, :stdout-contains ["graph-not-removed"]}, :covers {:commands ["graph remove"], - :options {:global ["--config" "--graph" "--data-dir" "--output"]}}, + :options {:global ["--config" "--graph" "--root-dir" "--output"]}}, :tags [:graph :remove]} {:id "remove-block-uuid-human", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page Home >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page Home --content 'Alpha block' >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human remove block --graph {{graph-arg}} --uuid \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home --linked-references false"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human remove block --graph {{graph-arg}} --uuid \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json query --graph {{graph-arg}} --query '[:find ?uuid . :where [?e :block/title \"Alpha block\"] [?e :block/uuid ?uuid]]' | python3 -c 'import sys,json; print(json.load(sys.stdin)[\"data\"][\"result\"])')\" >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output human show --graph {{graph-arg}} --page Home --linked-references false"], :expect {:exit 0, :stdout-not-contains ["Alpha block"]}, :covers {:commands ["remove block"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :remove ["--uuid"]}}, :tags [:remove], :extends :non-sync/graph-json-env} {:id "remove-tag-name-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert tag --graph {{graph-arg}} --name TagOne >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove tag --graph {{graph-arg}} --name TagOne >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --fields title,id"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json remove tag --graph {{graph-arg}} --name TagOne >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list tag --graph {{graph-arg}} --fields title,id"], :expect {:exit 0, :stdout-not-contains ["TagOne"]}, :covers {:commands ["remove tag"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :remove ["--name"]}}, :tags [:remove], :extends :non-sync/graph-json-env} {:id "remove-property-id-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert property --graph {{graph-arg}} --name score --type number --cardinality one >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json remove property --graph {{graph-arg}} --id \"$({{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" >/dev/null" - "{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json remove property --graph {{graph-arg}} --id \"$({{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id --limit 200 --sort updated-at --order desc | python3 -c 'import sys,json; print(next(item[\"db/id\"] for item in json.load(sys.stdin)[\"data\"][\"items\"] if item[\"block/title\"] == \"score\"))')\" >/dev/null" + "{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json list property --graph {{graph-arg}} --fields title,id"], :expect {:exit 0, :stdout-not-contains ["score"]}, :covers {:commands ["remove property"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :remove ["--id"]}}, :tags [:remove], :extends :non-sync/graph-json-env} {:id "server-cleanup-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server cleanup"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server cleanup"], :expect {:exit 0, :stdout-json-paths @@ -956,25 +956,25 @@ :covers {:commands ["server cleanup"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :server []}}, :tags [:server], :extends :non-sync/graph-json-env} {:id "server-list-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server list"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server list"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :servers 0 :repo] "{{graph}}"}}, :covers {:commands ["server list"], - :options {:global ["--config" "--data-dir" "--output"]}}, + :options {:global ["--config" "--root-dir" "--output"]}}, :tags [:server], :extends :non-sync/graph-json-env} {:id "server-restart-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server restart --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server restart --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths @@ -982,29 +982,29 @@ :covers {:commands ["server restart"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :server ["--graph"]}}, :tags [:server], :extends :non-sync/graph-json-env} {:id "server-stop-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths {[:status] "ok", [:data :repo] "{{graph}}"}}, :covers {:commands ["server stop"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :server ["--graph"]}}, :tags [:server]} {:id "server-start-json", :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}} >/dev/null"], :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server start --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server start --graph {{graph-arg}}"], :expect {:exit 0, :stdout-json-paths @@ -1012,7 +1012,7 @@ :covers {:commands ["server start"], :options - {:global ["--config" "--graph" "--data-dir" "--output"], + {:global ["--config" "--graph" "--root-dir" "--output"], :server ["--graph"]}}, :tags [:server], :extends :non-sync/graph-json-env} @@ -1080,7 +1080,7 @@ :vars {:completion-selector "fish"}} {:id "doctor-dev-script-json", :cmds - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json doctor --dev-script"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json doctor --dev-script"], :expect {:exit 0, :stdout-json-paths @@ -1091,6 +1091,6 @@ :covers {:commands ["doctor"], :options - {:global ["--config" "--data-dir" "--output"], + {:global ["--config" "--root-dir" "--output"], :doctor ["--dev-script"]}}, :tags [:doctor :smoke]}]} diff --git a/cli-e2e/spec/non_sync_inventory.edn b/cli-e2e/spec/non_sync_inventory.edn index 44d13c6ce6..01c70a2168 100644 --- a/cli-e2e/spec/non_sync_inventory.edn +++ b/cli-e2e/spec/non_sync_inventory.edn @@ -5,7 +5,7 @@ "--version" "--config" "--graph" - "--data-dir" + "--root-dir" "--output" "--verbose"]} diff --git a/cli-e2e/spec/sync_cases.edn b/cli-e2e/spec/sync_cases.edn index 15352a192a..3b3e369bc1 100644 --- a/cli-e2e/spec/sync_cases.edn +++ b/cli-e2e/spec/sync_cases.edn @@ -1,8 +1,8 @@ {:templates {:sync/base {:cleanup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" - "{{cli}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json server stop --graph {{graph-arg}}"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" + "{{cli}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json server stop --graph {{graph-arg}}"], :tags [:sync], :vars {:sync-port "18080", @@ -13,17 +13,17 @@ :cli-home "HOME='{{tmp-dir}}/home' {{cli}}"}, :setup ["mkdir -p '{{tmp-dir}}/graphs-b'" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}"]}, + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}"]}, :sync/common {:extends :sync/base, :cmds - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}}" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{data-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 120 --interval-s 1" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync download --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 120 --interval-s 1"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}}" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 120 --interval-s 1" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync download --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 120 --interval-s 1"], :expect {:exit 0, :stdout-json-paths @@ -34,29 +34,29 @@ [:data :last-error] nil}}, :covers {:commands ["sync upload" "sync download" "sync status"], - :options {:global ["--config" "--graph" "--data-dir" "--output"]}}}} + :options {:global ["--config" "--graph" "--root-dir" "--output"]}}}} :cases [{:tags [:happy-path :bootstrap :a-to-b], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncBootstrapHome >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncBootstrapHome --content '{{marker-content}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncBootstrapHome >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncBootstrapHome --content '{{marker-content}}' >/dev/null"], :cmds - ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-content}}\")] ]' --require-result" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-content}}\")] ]' --require-result" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-bootstrap-upload-download-a-to-b", :graph "sync-e2e-bootstrap-a-to-b", :vars {:marker-content "sync-happy-bootstrap-a-to-b-marker"}} {:tags [:happy-path :incremental :a-to-b], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncIncrementalHome >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncIncrementalHome --content '{{seed-marker}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncIncrementalHome >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncIncrementalHome --content '{{seed-marker}}' >/dev/null"], :cmds - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncIncrementalHome --content '{{incremental-marker}}' >/dev/null" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 120 --interval-s 1" - "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{incremental-marker}}\")] ]' --require-result" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncIncrementalHome --content '{{incremental-marker}}' >/dev/null" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 120 --interval-s 1" + "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{incremental-marker}}\")] ]' --require-result" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-incremental-update-a-to-b", :graph "sync-e2e-incremental-a-to-b", :vars @@ -65,14 +65,14 @@ {:tags [:happy-path :bidirectional :roundtrip], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncRoundtripAHome >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncRoundtripAHome --content '{{marker-a}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncRoundtripAHome >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncRoundtripAHome --content '{{marker-a}}' >/dev/null"], :cmds - ["{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json upsert page --graph {{graph-arg}} --page SyncRoundtripBHome >/dev/null" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json upsert block --graph {{graph-arg}} --target-page SyncRoundtripBHome --content '{{marker-b}}' >/dev/null" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{data-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 120 --interval-s 1" - "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-b}}\")] ]' --require-result" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync status --graph {{graph-arg}}"], + ["{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json upsert page --graph {{graph-arg}} --page SyncRoundtripBHome >/dev/null" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json upsert block --graph {{graph-arg}} --target-page SyncRoundtripBHome --content '{{marker-b}}' >/dev/null" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 120 --interval-s 1" + "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-b}}\")] ]' --require-result" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync status --graph {{graph-arg}}"], :id "sync-bidirectional-roundtrip", :graph "sync-e2e-bidirectional-roundtrip", :vars @@ -81,20 +81,20 @@ {:tags [:happy-path :multi-batch :a-to-b], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchHome >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchHome --content '{{seed-marker}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchHome >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchHome --content '{{seed-marker}}' >/dev/null"], :cmds - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchOne >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchOne --content '{{batch-marker-1}}' >/dev/null" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchTwo >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchTwo --content '{{batch-marker-2}}' >/dev/null" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchThree >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchThree --content '{{batch-marker-3}}' >/dev/null" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" - "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-1}}\")] ]' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-2}}\")] ]' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-3}}\")] ]' --require-result" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchOne >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchOne --content '{{batch-marker-1}}' >/dev/null" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchTwo >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchTwo --content '{{batch-marker-2}}' >/dev/null" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncMultiBatchThree >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncMultiBatchThree --content '{{batch-marker-3}}' >/dev/null" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" + "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-1}}\")] ]' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-2}}\")] ]' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{batch-marker-3}}\")] ]' --require-result" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-multi-batch-operations", :graph "sync-e2e-multi-batch-operations", :vars @@ -105,10 +105,10 @@ {:tags [:negative :upload :duplicate], :extends :sync/base, :setup - ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}} >/dev/null"], + ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}} >/dev/null"], :cmds - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}}"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync upload --graph {{graph-arg}}"], :expect {:exit 1, :stdout-json-paths @@ -121,25 +121,25 @@ {:tags [:happy-path :steady-state :status], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncSteadyStateHome >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncSteadyStateHome --content '{{marker-content}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page SyncSteadyStateHome >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page SyncSteadyStateHome --content '{{marker-content}}' >/dev/null"], :cmds - ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-content}}\")] ]' --require-result" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{marker-content}}\")] ]' --require-result" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 30 --interval-s 1" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-status-steady-state", :graph "sync-e2e-status-steady-state", :vars {:marker-content "sync-happy-steady-state-marker"}} {:tags [:stress :bidirectional :random :block-ops], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page '{{random-page}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page '{{random-page}}' >/dev/null"], :cmds - ["python3 '{{repo-root}}/cli-e2e/scripts/random_bidirectional_block_ops.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --page '{{random-page}}' --profile default --rounds-per-client {{rounds-per-client}} --seed {{random-seed}}" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{data-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 180 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 180 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" - "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find (pull ?b [:block/uuid :block/title :block/order {:block/parent [:block/uuid]}]) :where [?p :block/title \"{{random-page}}\"] [?b :block/page ?p] [?b :block/uuid]]' --require-result" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["python3 '{{repo-root}}/cli-e2e/scripts/random_bidirectional_block_ops.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --page '{{random-page}}' --profile default --rounds-per-client {{rounds-per-client}} --seed {{random-seed}}" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 180 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 180 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" + "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find (pull ?b [:block/uuid :block/title :block/order {:block/parent [:block/uuid]}]) :where [?p :block/title \"{{random-page}}\"] [?b :block/page ?p] [?b :block/uuid]]' --require-result" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-random-bidirectional-block-ops", :graph "sync-e2e-random-bidirectional-block-ops", :vars @@ -149,19 +149,19 @@ {:tags [:stress :offline :bidirectional :random :block-ops], :extends :sync/common, :setup - ["{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page '{{random-page}}' >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page '{{random-page}}' --content '{{seed-marker}}' >/dev/null"], + ["{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert page --graph {{graph-arg}} --page '{{random-page}}' >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json upsert block --graph {{graph-arg}} --target-page '{{random-page}}' --content '{{seed-marker}}' >/dev/null"], :cmds - ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{seed-marker}}\")] ]' --require-result" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync stop --graph {{graph-arg}}" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync stop --graph {{graph-arg}}" - "python3 '{{repo-root}}/cli-e2e/scripts/random_bidirectional_block_ops.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --page '{{random-page}}' --profile high-stress --rounds-per-client {{rounds-per-client}} --seed {{random-seed}}" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{data-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 240 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" - "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 240 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" - "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --data-dir-a '{{data-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --data-dir-b '{{tmp-dir}}/graphs-b' --query '[:find (pull ?b [:block/uuid :block/title :block/order {:block/parent [:block/uuid]}]) :where [?p :block/title \"{{random-page}}\"] [?b :block/page ?p] [?b :block/uuid]]' --require-result" - "{{cli-home}} --data-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], + ["python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find ?title :where [?b :block/title ?title] [(= ?title \"{{seed-marker}}\")] ]' --require-result" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync stop --graph {{graph-arg}}" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync stop --graph {{graph-arg}}" + "python3 '{{repo-root}}/cli-e2e/scripts/random_bidirectional_block_ops.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --page '{{random-page}}' --profile high-stress --rounds-per-client {{rounds-per-client}} --seed {{random-seed}}" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync start --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{root-dir}}' --config '{{config-path}}' --graph '{{graph}}' --timeout-s 240 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" + "python3 '{{repo-root}}/cli-e2e/scripts/wait_sync_status.py' --cli '{{repo-root}}/static/logseq-cli.js' --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --graph '{{graph}}' --timeout-s 240 --interval-s 1 --min-tx-delta 1 --baseline-tx 0" + "python3 '{{repo-root}}/cli-e2e/scripts/compare_graph_queries.py' --cli '{{repo-root}}/static/logseq-cli.js' --graph '{{graph}}' --config-a '{{config-path}}' --root-dir-a '{{root-dir}}' --config-b '{{tmp-dir}}/cli-b.edn' --root-dir-b '{{tmp-dir}}/graphs-b' --query '[:find (pull ?b [:block/uuid :block/title :block/order {:block/parent [:block/uuid]}]) :where [?p :block/title \"{{random-page}}\"] [?b :block/page ?p] [?b :block/uuid]]' --require-result" + "{{cli-home}} --root-dir '{{tmp-dir}}/graphs-b' --config '{{tmp-dir}}/cli-b.edn' --output json sync status --graph {{graph-arg}}"], :id "sync-offline-random-bidirectional-block-ops", :graph "sync-e2e-offline-random-bidirectional-block-ops", :vars diff --git a/cli-e2e/spec/sync_inventory.edn b/cli-e2e/spec/sync_inventory.edn index 67d35df73f..7a664eb15f 100644 --- a/cli-e2e/spec/sync_inventory.edn +++ b/cli-e2e/spec/sync_inventory.edn @@ -3,7 +3,7 @@ {:global {:options ["--config" "--graph" - "--data-dir" + "--root-dir" "--output"]} :sync diff --git a/cli-e2e/src/logseq/cli/e2e/runner.clj b/cli-e2e/src/logseq/cli/e2e/runner.clj index 77f2f9c484..42c619b959 100644 --- a/cli-e2e/src/logseq/cli/e2e/runner.clj +++ b/cli-e2e/src/logseq/cli/e2e/runner.clj @@ -140,21 +140,21 @@ [case context] (let [tmp-dir (or (:tmp-dir context) (str (fs/create-temp-dir {:prefix (str "logseq-cli-e2e-" (:id case) "-")}))) - data-dir (or (:data-dir context) - (str (fs/path tmp-dir "graphs"))) + root-dir (or (:root-dir context) + tmp-dir) config-path (or (:config-path context) - (str (fs/path tmp-dir "cli.edn"))) + (str (fs/path root-dir "cli.edn"))) export-path (or (:export-path context) (str (fs/path tmp-dir "graph-export.edn"))) graph (or (:graph context) (:graph case) (str "cli-e2e-" (:id case)))] - (fs/create-dirs data-dir) + (fs/create-dirs (fs/path root-dir "graphs")) (spit config-path "{:output-format :json}\n") {:tmp-dir tmp-dir :tmp-dir-arg (shell-escape tmp-dir) - :data-dir data-dir - :data-dir-arg (shell-escape data-dir) + :root-dir root-dir + :root-dir-arg (shell-escape root-dir) :config-path config-path :config-path-arg (shell-escape config-path) :export-path export-path diff --git a/cli-e2e/src/logseq/cli/e2e/sync_fixture.clj b/cli-e2e/src/logseq/cli/e2e/sync_fixture.clj index 228663e280..6d8b1cc6e9 100644 --- a/cli-e2e/src/logseq/cli/e2e/sync_fixture.clj +++ b/cli-e2e/src/logseq/cli/e2e/sync_fixture.clj @@ -53,7 +53,7 @@ "while ! mkdir \"$LOCK_DIR\" 2>/dev/null; do [ -f \"$DONE_FILE\" ] && exit 0; sleep 0.1; done; " "trap 'rmdir \"$LOCK_DIR\" 2>/dev/null || true' EXIT; " "if [ ! -f \"$DONE_FILE\" ]; then " - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}} --upload-keys >/dev/null && touch \"$DONE_FILE\"; " + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}} --upload-keys >/dev/null && touch \"$DONE_FILE\"; " "fi") lock-dir done-file))) @@ -66,7 +66,7 @@ suite-tmp-dir (str (fs/create-temp-dir {:prefix "logseq-cli-e2e-sync-suite-"})) db-sync-pid-file (str (fs/path suite-tmp-dir "db-sync-server.pid")) db-sync-log-file (str (fs/path suite-tmp-dir "db-sync-server.log")) - db-sync-data-dir (str (fs/path suite-tmp-dir "db-sync-server-data")) + db-sync-root-dir (str (fs/path suite-tmp-dir "db-sync-server-data")) sync-http-base (str "http://127.0.0.1:" sync-port) sync-ws-url (str "ws://127.0.0.1:" sync-port "/sync/%s") auth-path (str (fs/path (System/getProperty "user.home") "logseq" "auth.json")) @@ -75,7 +75,7 @@ (shell-quote (paths/repo-root)) (shell-quote db-sync-pid-file) (shell-quote db-sync-log-file) - (shell-quote db-sync-data-dir) + (shell-quote db-sync-root-dir) sync-port (shell-quote auth-path))] (run-command {:cmd start-db-sync-cmd @@ -83,7 +83,7 @@ {:suite-tmp-dir suite-tmp-dir :db-sync-pid-file db-sync-pid-file :db-sync-log-file db-sync-log-file - :db-sync-data-dir db-sync-data-dir + :db-sync-root-dir db-sync-root-dir :sync-port sync-port :sync-http-base sync-http-base :sync-ws-url sync-ws-url})) diff --git a/cli-e2e/test/logseq/cli/e2e/cleanup_test.clj b/cli-e2e/test/logseq/cli/e2e/cleanup_test.clj index 305c08d40a..2f61fa460b 100644 --- a/cli-e2e/test/logseq/cli/e2e/cleanup_test.clj +++ b/cli-e2e/test/logseq/cli/e2e/cleanup_test.clj @@ -6,11 +6,11 @@ (deftest list-cli-e2e-db-worker-pids-filters-processes (let [shell-fn (fn [& _] {:exit 0 - :out (str " 101 node /repo/dist/db-worker-node.js --repo graph-a --data-dir /tmp/logseq-cli-e2e-graph-a-123/graphs --owner-source cli\n" - " 202 node /repo/dist/db-worker-node.js --repo production --data-dir /tmp/production-graphs --owner-source cli\n" + :out (str " 101 node /repo/dist/db-worker-node.js --repo graph-a --root-dir /tmp/logseq-cli-e2e-graph-a-123/graphs --owner-source cli\n" + " 202 node /repo/dist/db-worker-node.js --repo production --root-dir /tmp/production-graphs --owner-source cli\n" " 303 node /repo/static/logseq-cli.js graph list\n" " 404 /usr/bin/python3 background.py\n" - " 505 node /repo/static/db-worker-node.js --repo graph-b --data-dir /private/tmp/logseq-cli-e2e-graph-b-999/graphs --owner-source cli\n") + " 505 node /repo/static/db-worker-node.js --repo graph-b --root-dir /private/tmp/logseq-cli-e2e-graph-b-999/graphs --owner-source cli\n") :err ""})] (is (= [101 505] (cleanup/list-cli-e2e-db-worker-pids {:shell-fn shell-fn})))) diff --git a/cli-e2e/test/logseq/cli/e2e/compare_graph_queries_test.py b/cli-e2e/test/logseq/cli/e2e/compare_graph_queries_test.py index 6093590e5a..cbea01104a 100644 --- a/cli-e2e/test/logseq/cli/e2e/compare_graph_queries_test.py +++ b/cli-e2e/test/logseq/cli/e2e/compare_graph_queries_test.py @@ -25,11 +25,11 @@ def test_parse_args_supports_repeated_queries(monkeypatch) -> None: "demo", "--config-a", "/tmp/a.edn", - "--data-dir-a", + "--root-dir-a", "/tmp/a", "--config-b", "/tmp/b.edn", - "--data-dir-b", + "--root-dir-b", "/tmp/b", "--query", "[:find ?x]", @@ -40,6 +40,8 @@ def test_parse_args_supports_repeated_queries(monkeypatch) -> None: args = compare_graph_queries.parse_args() + assert args.root_dir_a == "/tmp/a" + assert args.root_dir_b == "/tmp/b" assert args.query == ["[:find ?x]", "[:find ?y]"] @@ -50,11 +52,11 @@ def test_main_batches_multiple_queries_in_one_process(tmp_path: Path) -> None: cli_path = tmp_path / "logseq-cli.js" cli_path.write_text("// mock cli\n") - def fake_run_query(cli_path, config_path, data_dir, graph, query): + def fake_run_query(cli_path, config_path, root_dir, graph, query): record = { "cli_path": str(cli_path), "config_path": str(config_path), - "data_dir": str(data_dir), + "root_dir": str(root_dir), "graph": graph, "query": query, } @@ -73,9 +75,9 @@ def test_main_batches_multiple_queries_in_one_process(tmp_path: Path) -> None: graph="demo", query=["[:find ?x]", "[:find ?y]"], config_a="/tmp/a.edn", - data_dir_a="/tmp/a", + root_dir_a="/tmp/a", config_b="/tmp/b.edn", - data_dir_b="/tmp/b", + root_dir_b="/tmp/b", require_result=False, ) compare_graph_queries.print = lambda value, **kwargs: printed.append(json.loads(value)) diff --git a/cli-e2e/test/logseq/cli/e2e/manifests_test.clj b/cli-e2e/test/logseq/cli/e2e/manifests_test.clj index 2f98220263..70f535230b 100644 --- a/cli-e2e/test/logseq/cli/e2e/manifests_test.clj +++ b/cli-e2e/test/logseq/cli/e2e/manifests_test.clj @@ -195,7 +195,7 @@ (is (not-any? #(= "sleep 1" %) commands)) (is (= 1 (count upload-commands))) (is (= 5 (count wait-commands))) - (is (= 3 (count (filter #(re-find #"--data-dir '\{\{tmp-dir\}\}/graphs-b'.+--timeout-s 30 --interval-s 1" %) wait-commands)))))) + (is (= 3 (count (filter #(re-find #"--root-dir '\{\{tmp-dir\}\}/graphs-b'.+--timeout-s 30 --interval-s 1" %) wait-commands)))))) (deftest sync-manifest-includes-duplicate-upload-negative-case (let [cases (manifests/load-cases :sync) @@ -219,7 +219,7 @@ (deftest sync-status-steady-state-does-not-repeat-identical-b-side-steady-state-waits (let [cases (manifests/load-cases :sync) steady-state (some #(when (= "sync-status-steady-state" (:id %)) %) cases) - steady-waits (filter #(re-find #"wait_sync_status\.py.+--data-dir '\{\{tmp-dir\}\}/graphs-b'.+--timeout-s 30 --interval-s 1" %) (:cmds steady-state))] + steady-waits (filter #(re-find #"wait_sync_status\.py.+--root-dir '\{\{tmp-dir\}\}/graphs-b'.+--timeout-s 30 --interval-s 1" %) (:cmds steady-state))] (is (some? steady-state)) (is (= 1 (count steady-waits))) (is (= 1 (count (filter #(re-find #"sync status --graph" %) (:cmds steady-state))))))) diff --git a/cli-e2e/test/logseq/cli/e2e/random_bidirectional_block_ops_test.py b/cli-e2e/test/logseq/cli/e2e/random_bidirectional_block_ops_test.py index 3e03355f5e..ec457c6948 100644 --- a/cli-e2e/test/logseq/cli/e2e/random_bidirectional_block_ops_test.py +++ b/cli-e2e/test/logseq/cli/e2e/random_bidirectional_block_ops_test.py @@ -25,11 +25,11 @@ def test_default_profile_is_faster_than_high_stress(monkeypatch) -> None: "demo", "--config-a", "/tmp/a.edn", - "--data-dir-a", + "--root-dir-a", "/tmp/a", "--config-b", "/tmp/b.edn", - "--data-dir-b", + "--root-dir-b", "/tmp/b", "--page", "Home", @@ -48,11 +48,11 @@ def test_default_profile_is_faster_than_high_stress(monkeypatch) -> None: "demo", "--config-a", "/tmp/a.edn", - "--data-dir-a", + "--root-dir-a", "/tmp/a", "--config-b", "/tmp/b.edn", - "--data-dir-b", + "--root-dir-b", "/tmp/b", "--page", "Home", @@ -62,6 +62,8 @@ def test_default_profile_is_faster_than_high_stress(monkeypatch) -> None: ) high_stress_args = random_bidirectional_block_ops.parse_args() + assert default_args.root_dir_a == "/tmp/a" + assert default_args.root_dir_b == "/tmp/b" assert default_args.profile == "default" assert high_stress_args.profile == "high-stress" assert default_args.rounds_per_client < high_stress_args.rounds_per_client @@ -79,11 +81,11 @@ def test_explicit_rounds_override_profile_default(monkeypatch) -> None: "demo", "--config-a", "/tmp/a.edn", - "--data-dir-a", + "--root-dir-a", "/tmp/a", "--config-b", "/tmp/b.edn", - "--data-dir-b", + "--root-dir-b", "/tmp/b", "--page", "Home", diff --git a/cli-e2e/test/logseq/cli/e2e/sync_fixture_test.clj b/cli-e2e/test/logseq/cli/e2e/sync_fixture_test.clj index 676f0a0bcd..dd7a84ab6e 100644 --- a/cli-e2e/test/logseq/cli/e2e/sync_fixture_test.clj +++ b/cli-e2e/test/logseq/cli/e2e/sync_fixture_test.clj @@ -15,8 +15,8 @@ "python3 '{{repo-root}}/cli-e2e/scripts/prepare_sync_config.py' --output '{{config-path}}' --auth-path '{{tmp-dir}}/home/logseq/auth.json' --http-base '{{sync-http-base}}' --ws-url '{{sync-ws-url}}'" "python3 '{{repo-root}}/cli-e2e/scripts/prepare_sync_config.py' --output '{{tmp-dir}}/cli-b.edn' --auth-path '{{tmp-dir}}/home/logseq/auth.json' --http-base '{{sync-http-base}}' --ws-url '{{sync-ws-url}}'" "python3 '{{repo-root}}/cli-e2e/scripts/db_sync_server.py' start --port 18080" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"] - :cleanup ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"] + :cleanup ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}" "python3 '{{repo-root}}/cli-e2e/scripts/db_sync_server.py' stop --pid-file '{{tmp-dir}}/db-sync-server.pid'"]} prepared (sync-fixture/prepare-case input-case suite-context)] (is (= "sync-case" (:id prepared))) @@ -25,9 +25,9 @@ "cp ~/logseq/auth.json '{{tmp-dir}}/home/logseq/auth.json'" "python3 '{{repo-root}}/cli-e2e/scripts/prepare_sync_config.py' --output '{{config-path}}' --auth-path '{{tmp-dir}}/home/logseq/auth.json' --http-base '{{sync-http-base}}' --ws-url '{{sync-ws-url}}'" "python3 '{{repo-root}}/cli-e2e/scripts/prepare_sync_config.py' --output '{{tmp-dir}}/cli-b.edn' --auth-path '{{tmp-dir}}/home/logseq/auth.json' --http-base '{{sync-http-base}}' --ws-url '{{sync-ws-url}}'" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"] + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null"] (:setup prepared))) - (is (= ["{{cli}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"] + (is (= ["{{cli}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json server stop --graph {{graph-arg}}"] (:cleanup prepared))) (is (= "http://127.0.0.1:18080" (get-in prepared [:vars :sync-http-base]))) (is (= "ws://127.0.0.1:18080/sync/%s" (get-in prepared [:vars :sync-ws-url]))) @@ -49,8 +49,8 @@ prepared (sync-fixture/prepare-case {:id "sync-case" :setup ["mkdir -p '{{tmp-dir}}/graphs-b'" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" - "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}"] + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}"] :cleanup []} suite-context) setup (:setup prepared) @@ -66,9 +66,9 @@ (is (string/includes? bootstrap-cmd "--upload-keys")) (is (string/includes? bootstrap-cmd "/tmp/sync-suite/user-rsa-keys.lock")) (is (string/includes? bootstrap-cmd "/tmp/sync-suite/user-rsa-keys.ready")) - (is (= "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" + (is (= "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json graph create --graph {{graph-arg}} >/dev/null" (nth setup 6))) - (is (= "{{cli-home}} --data-dir {{data-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" + (is (= "{{cli-home}} --root-dir {{root-dir-arg}} --config {{config-path-arg}} --output json sync ensure-keys --graph {{graph-arg}} --e2ee-password {{e2ee-password-arg}}" (nth setup 7))) (is (not-any? #(and (string/includes? % "sync ensure-keys") (not= % bootstrap-cmd) @@ -99,6 +99,8 @@ (is (= 1 (count @calls))) (is (string/includes? (:cmd (first @calls)) "db_sync_server.py")) (is (string/includes? (:cmd (first @calls)) " start ")) + (is (string/includes? (:cmd (first @calls)) "--data-dir")) + (is (not (string/includes? (:cmd (first @calls)) "--root-dir"))) (is (string/includes? (:cmd (first @calls)) "--port 18080")) (is (string/includes? (:cmd (first @calls)) "--startup-timeout-s 60")) (is (not (string/includes? (:cmd (first @calls)) "prepare_sync_config.py"))) diff --git a/cli-e2e/test/logseq/cli/e2e/wait_sync_status_test.py b/cli-e2e/test/logseq/cli/e2e/wait_sync_status_test.py index f58665f872..ba9df4b78d 100644 --- a/cli-e2e/test/logseq/cli/e2e/wait_sync_status_test.py +++ b/cli-e2e/test/logseq/cli/e2e/wait_sync_status_test.py @@ -15,7 +15,7 @@ spec.loader.exec_module(wait_sync_status) def test_resolved_status_command_is_built_once_and_reused() -> None: args = SimpleNamespace( cli="~/repo/static/logseq-cli.js", - data_dir="~/tmp/graph", + root_dir="~/tmp/root", config="~/tmp/cli.edn", graph="demo", ) @@ -23,6 +23,7 @@ def test_resolved_status_command_is_built_once_and_reused() -> None: command = wait_sync_status.status_command(args) assert command[0] == "node" + assert command[2] == "--root-dir" assert command[-2:] == ["--graph", "demo"] assert Path(command[1]).is_absolute() assert Path(command[3]).is_absolute() diff --git a/docs/cli/logseq-cli.md b/docs/cli/logseq-cli.md index 8e42e39c97..0eb9a8d6a6 100644 --- a/docs/cli/logseq-cli.md +++ b/docs/cli/logseq-cli.md @@ -23,7 +23,7 @@ Desktop + CLI shared semantics: - If lock ownership is invalid or stale, startup cleans stale lock state before retrying. - Lock metadata includes an `owner-source` value (`cli`, `electron`, `unknown`) and lifecycle actions enforce owner boundaries. - `server stop` and `server restart` are owner-aware: CLI can only stop/restart servers it owns (or legacy `unknown` ownership). -- If lock is missing but a matching orphan `db-worker-node` process still exists for the same repo/data-dir, startup performs orphan cleanup before retrying. +- If lock is missing but a matching orphan `db-worker-node` process still exists for the same repo/root-dir, startup performs orphan cleanup before retrying. ## Run the CLI @@ -44,11 +44,15 @@ logseq graph list ## Configuration -The CLI config file is located at `~/logseq/cli.edn`. +The CLI config file defaults to `/cli.edn`, where `root-dir` defaults to `~/logseq`. Supported keys include: - `:graph` - The current active graph. Set this with `graph switch`. -- `:data-dir` - Directory where graphs are stored. Default is `~/logseq/graphs`. The graphs in this directory are user-facing graph names e.g. `demo` and do not start with `logseq_db_`. +- `:root-dir` - CLI root directory. Default is `~/logseq`. + - Graph data directory is derived as `/graphs`. + - Config file default is derived as `/cli.edn`. + - Server list file default is derived as `/server-list`. + - Graph directories under `/graphs` are user-facing graph names e.g. `demo` and do not start with `logseq_db_`. - `:output-format` - Format for output. Default is `:human`. Use `:json` or `:edn` for scripting. - `:list-title-max-display-width` - For `:human` output, the max display width for TITLE column, defaulting to `40`. - `:http-base` - Http base domain for sync service. Interact with this via `sync config`. @@ -63,14 +67,14 @@ CLI global flags take precedence over environment variables, which take preceden | Config key | Environment variable | Global flag | | --- | --- | --- | | :graph | $LOGSEQ_CLI_GRAPH | --graph | -| :data-dir | $LOGSEQ_CLI_DATA_DIR | --data-dir | +| :root-dir | $LOGSEQ_CLI_ROOT_DIR | --root-dir | | :output-format | $LOGSEQ_CLI_OUTPUT | --output | | :timeout-ms | $LOGSEQ_CLI_TIMEOUT_MS | --timeout-ms | | :login-timeout-ms | $LOGSEQ_CLI_LOGIN_TIMEOUT_MS | n/a | | :logout-timeout-ms | $LOGSEQ_CLI_LOGOUT_TIMEOUT_MS | n/a | Legacy notes: -* Migration note: If you previously used `~/.logseq/cli-graphs` or `~/.logseq/cli.edn`, pass `--data-dir` or `--config` to continue using those locations. +* Migration note: If you previously used `~/.logseq/cli-graphs` or `~/.logseq/cli.edn`, pass `--root-dir` and/or `--config` to continue using equivalent custom locations. * `:e2ee-password` in `cli.edn` is ignored and removed silently during config read/update. Use `sync start --e2ee-password` or `sync download --e2ee-password` instead. * `cli.edn` no longer persists cloud auth tokens. CLI login state is stored separately in `~/logseq/auth.json`. @@ -113,7 +117,7 @@ Graph commands: - `graph info [--graph ]` - show graph metadata (defaults to current graph) - `graph export --type edn|sqlite --file [--graph ]` - export a graph to EDN or SQLite - `graph import --type edn|sqlite --input --graph ` - import a graph from EDN or SQLite (new graph only) -- `graph backup list` - list backup snapshots under `/backup` +- `graph backup list` - list backup snapshots under `/graphs//backup` - `graph backup create [--graph ] [--name