Back to Lobehub

@lobehub/cli

apps/cli/README.md

2.1.562.3 KB
Original Source

@lobehub/cli

LobeHub command-line interface.

Local Development

TaskCommand
Run in dev modebun run dev -- <command>
Build the CLIbun run build
Link lh/lobe/lobehub into your shellbun run cli:link
Remove the global linkbun run cli:unlink
  • bun run build only generates dist/index.js.
  • To make lh available in your shell, run bun run cli:link.
  • After linking, if your shell still cannot find lh, run rehash in zsh.

Custom Server URL

By default the CLI connects to https://app.lobehub.com. To point it at a different server (e.g. a local instance):

MethodCommandPersistence
Environment variableLOBEHUB_SERVER=http://localhost:4000 bun run dev -- <command>Current command only
Login flaglh login --server http://localhost:4000Saved to ~/.lobehub/settings.json

Priority: LOBEHUB_SERVER env var > settings.json > default official URL.

Shell Completion

Install completion for a linked CLI

ShellCommand
zshsource <(lh completion zsh)
bashsource <(lh completion bash)

Use completion during local development

ShellCommand
zshsource <(bun src/index.ts completion zsh)
bashsource <(bun src/index.ts completion bash)
  • Completion is context-aware. For example, lh agent <Tab> shows agent subcommands instead of top-level commands.
  • If you update completion logic locally, re-run the corresponding source <(...) command to reload it in the current shell session.
  • Completion only registers shell functions. It does not install the lh binary by itself.

Quick Check

bash
which lh
lh --help
lh agent <TAB>