11# xian-cli
22
3- ` xian-cli ` is the operator control plane for Xian nodes and networks. It keeps
4- lifecycle UX out of ` xian-abci ` and treats ` xian-stack ` as a backend runtime
5- surface instead of a user-facing tool.
3+ ` xian-cli ` is the operator-facing control plane for Xian networks and nodes. It
4+ handles manifests, node profiles, lifecycle commands, health checks, and local
5+ bootstrap flows without turning ` xian-abci ` or ` xian-stack ` into user-facing
6+ tools.
67
7- ## Scope
8+ ## Common Workflows
89
9- This repo owns :
10+ Create a local network from a template :
1011
11- - command-line flows such as ` keys ` , ` network create ` , ` network join ` ,
12- ` node init ` , ` node status ` , ` snapshot restore ` , and ` doctor `
13- - local operator artifacts such as network manifests and node profiles
14- - orchestration across ` xian-abci ` primitives and ` xian-stack ` backend actions
12+ ``` bash
13+ uv run xian network template list
14+ uv run xian network create local-dev --chain-id xian-local-1 \
15+ --template single-node-dev --generate-validator-key --init-node
16+ uv run xian node start local-dev
17+ uv run xian node status local-dev
18+ ```
1519
16- This repo does not own:
20+ Join an existing network with a local profile:
21+
22+ ``` bash
23+ uv run xian network join mainnet-node --network mainnet \
24+ --template embedded-backend --generate-validator-key \
25+ --init-node --restore-snapshot
26+ uv run xian node health mainnet-node
27+ uv run xian node endpoints mainnet-node
28+ ```
29+
30+ Inspect or recover a configured node:
31+
32+ ``` bash
33+ uv run xian doctor mainnet-node
34+ uv run xian doctor mainnet-node --skip-live-checks
35+ uv run xian snapshot restore mainnet-node
36+ ```
1737
18- - deterministic node logic or ABCI internals
19- - Docker or Compose topology
20- - canonical network-specific genesis assets
38+ ## Principles
39+
40+ - ` xian-cli ` owns operator UX. Deterministic node logic stays in ` xian-abci ` ,
41+ and local runtime orchestration stays in ` xian-stack ` .
42+ - Manifests and node profiles are explicit artifacts, not hidden state.
43+ - Templates and solution packs should accelerate common setups, but they should
44+ remain optional. An operator who knows what they are doing should still be
45+ able to work directly with manifests, profiles, and node homes.
46+ - Health, endpoint discovery, and diagnostics are first-class operator
47+ features, not afterthoughts.
2148
2249## Key Directories
2350
24- - ` src/xian_cli/ ` : command implementations, models, and manifest/profile logic
25- - ` docs/ ` : lifecycle contracts and repo-local notes
26- - ` tests/ ` : CLI and manifest/profile validation coverage
51+ - ` src/xian_cli/ ` : commands, models, manifest handling, and backend integration
52+ - ` tests/ ` : CLI behavior and manifest/profile validation coverage
53+ - ` docs/ ` : lifecycle contracts, architecture notes, and backlog items
54+
55+ ## What It Covers
56+
57+ - key generation and validator material
58+ - network creation and network join flows
59+ - node initialization, start, stop, and status
60+ - endpoint and health discovery
61+ - snapshot restore and doctor diagnostics
62+ - solution-pack starter flows built on ` xian-configs `
2763
2864## Validation
2965
@@ -40,110 +76,3 @@ uv run pytest
4076- [ docs/ARCHITECTURE.md] ( docs/ARCHITECTURE.md )
4177- [ docs/BACKLOG.md] ( docs/BACKLOG.md )
4278- [ docs/LIFECYCLE_CONTRACT.md] ( docs/LIFECYCLE_CONTRACT.md )
43-
44- ## Common Workflows
45-
46- ``` bash
47- uv run xian --help
48- uv run xian network template list
49- uv run xian keys validator generate --out-dir ./keys
50- uv run xian network create local-dev --chain-id xian-local-1 \
51- --template single-node-dev --generate-validator-key --init-node
52- uv run xian network join mainnet-node --network mainnet \
53- --template embedded-backend --generate-validator-key \
54- --init-node --restore-snapshot
55- uv run xian node init mainnet-node --restore-snapshot
56- uv run xian node status mainnet-node
57- uv run xian node endpoints mainnet-node
58- uv run xian node health mainnet-node
59- uv run xian snapshot restore mainnet-node
60- uv run xian doctor mainnet-node
61- uv run xian doctor mainnet-node --skip-live-checks
62- uv run xian node start mainnet-node
63- uv run xian node stop mainnet-node
64- ```
65-
66- ` --genesis-source ` accepts either a local file path or an ` http ` /` https ` URL.
67- Local manifests use the same network-first layout as ` xian-configs ` :
68- ` ./networks/<name>/manifest.json ` with a colocated ` genesis.json ` when the CLI
69- generates one.
70- generates one. ` network join ` resolves the named network manifest immediately.
71- It prefers that local path and otherwise falls back to the sibling
72- ` xian-configs/networks/<name>/manifest.json ` manifest. Canonical manifest data
73- such as ` runtime_backend ` is used as the default, while node-local overrides
74- such as ` --seed ` , ` --snapshot-url ` , and ` --genesis-url ` stay in the node
75- profile.
76-
77- Block-time policy is explicit too:
78-
79- - ` on_demand ` : no empty blocks while idle
80- - ` idle_interval ` : emit an empty block after an idle interval such as ` 10s `
81- - ` periodic ` : keep scheduled empty blocks enabled with the chosen interval
82-
83- This only changes when chain time advances during idle periods. Contract ` now `
84- always comes from the finalized block timestamp agreed by consensus.
85-
86- Both network manifests and node profiles must carry ` schema_version: 1 ` . The
87- artifact contract is explicit now; the CLI validates that shape on read and
88- writes the explicit version on new output.
89-
90- ` network create ` can stay lightweight and only write a manifest, but it can now
91- also bootstrap a fresh local network. When validator key material is available,
92- it can generate a colocated ` genesis.json ` ; when ` --bootstrap-node ` is set, it
93- can also create the first node profile and optionally initialize the CometBFT
94- home immediately with ` --init-node ` . Repeating ` --validator <name> ` adds more
95- initial validator profiles and includes them in the generated local genesis.
96- Only the bootstrap node is initialized immediately; additional profiles remain
97- declared intent until they are initialized on their own machines.
98-
99- Canonical or local templates now provide the easiest way to prefill that flow.
100- Use ` xian network template list ` to inspect the available starter shapes, then
101- pass ` --template <name> ` to ` network create ` or ` network join ` . Templates can
102- set defaults for runtime backend, block policy, tracer mode, bootstrap
103- validator names, service-node / indexed mode, dashboard exposure, monitoring,
104- and pruning.
105-
106- If the operator does not already have validator key material, ` network join `
107- can generate it directly with ` --generate-validator-key ` . By default it writes
108- to ` ./keys/<name>/validator_key_info.json ` and stores that relative reference in
109- the node profile.
110-
111- ` network join --init-node ` now runs the same initialization flow as ` node init `
112- immediately after writing the node profile. When combined with
113- ` --restore-snapshot ` , it restores the effective snapshot URL after the CometBFT
114- home is materialized.
115-
116- ` node init ` , ` node start ` , ` node stop ` , and ` snapshot restore ` use the same
117- local-then-canonical manifest resolution. A profile-level ` --genesis-url `
118- override takes precedence over the manifest ` genesis_source ` . Snapshot URL
119- precedence is explicit: command-line override first, then node profile, then
120- network manifest.
121-
122- ` node status ` reports bootstrap artifacts, the ` xian-stack ` backend state when
123- available, and an optional live RPC status probe. ` doctor ` checks workspace
124- resolution and, when given a node name, the profile/manifest/home prerequisites
125- for that node.
126-
127- ` node endpoints ` prints the effective local URLs for CometBFT RPC,
128- ` abci_query ` , Xian and CometBFT metrics, and optional dashboard / Prometheus /
129- Grafana services. This is the quickest way to discover what a template-enabled
130- node is expected to expose.
131-
132- ` node health ` is the concise live-runtime view. It surfaces the ` xian-stack `
133- health state, endpoint health, optional disk-pressure checks, state-sync
134- readiness from the rendered CometBFT config, and the effective snapshot
135- bootstrap URL.
136-
137- ` doctor ` now defaults to live health checks when a node name is provided. That
138- includes backend state, RPC reachability, and optional dashboard / monitoring
139- services when they are enabled in the profile. Use ` --skip-live-checks ` when
140- you only want an offline workspace and node-home preflight.
141-
142- Node profiles now also carry ` monitoring_enabled ` . When that is true,
143- ` xian-cli ` asks ` xian-stack ` to manage the Prometheus and Grafana sidecars
144- alongside the node runtime.
145-
146- ## Workspace Model
147-
148- The preferred layout is a shared parent directory such as ` ~/xian/ ` containing
149- sibling checkouts of ` xian-cli ` , ` xian-abci ` , ` xian-configs ` , and ` xian-stack ` .
0 commit comments