mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
e65e2c3628
* ✨ feat(desktop): embed CLI in app and PATH install Made-with: Cursor * ✨ feat(desktop): add CLI command execution feature and UI integration - Implemented `runCliCommand` method in `ElectronSystemService` to execute CLI commands. - Added `CliTestSection` component for testing CLI commands within the app. - Updated `SystemCtr` to include CLI command execution functionality. - Enhanced `generateCliWrapper` to create short aliases for CLI commands. - Integrated CLI testing UI in the system tools settings page. Signed-off-by: Innei <tukon479@gmail.com> * ✨ feat: enhance working directory handling for desktop - Updated working directory logic to prioritize topic-level settings over agent-level. - Introduced local storage management for agent working directories. - Modified tests to reflect changes in working directory behavior. - Added checks to ensure working directory retrieval is only performed on desktop environments. Signed-off-by: Innei <tukon479@gmail.com> * ✨ feat(desktop): implement CLI command routing and cleanup - Introduced `CliCtr` for executing CLI commands, enhancing the desktop application with CLI capabilities. - Updated `ShellCommandCtr` to route specific commands to `CliCtr`, improving command handling. - Removed legacy CLI path installation methods from `SystemCtr` and related services. - Cleaned up localization files by removing obsolete entries related to CLI path installation. Signed-off-by: Innei <tukon479@gmail.com> * 🚸 settings(system-tools): show CLI embedded test only in dev mode Made-with: Cursor --------- Signed-off-by: Innei <tukon479@gmail.com>
@lobehub/cli
LobeHub command-line interface.
Local Development
| Task | Command |
|---|---|
| Run in dev mode | bun run dev -- <command> |
| Build the CLI | bun run build |
Link lh/lobe/lobehub into your shell |
bun run cli:link |
| Remove the global link | bun run cli:unlink |
bun run buildonly generatesdist/index.js.- To make
lhavailable in your shell, runbun run cli:link. - After linking, if your shell still cannot find
lh, runrehashinzsh.
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):
| Method | Command | Persistence |
|---|---|---|
| Environment variable | LOBEHUB_SERVER=http://localhost:4000 bun run dev -- <command> |
Current command only |
| Login flag | lh login --server http://localhost:4000 |
Saved to ~/.lobehub/settings.json |
Priority: LOBEHUB_SERVER env var > settings.json > default official URL.
Shell Completion
Install completion for a linked CLI
| Shell | Command |
|---|---|
zsh |
source <(lh completion zsh) |
bash |
source <(lh completion bash) |
Use completion during local development
| Shell | Command |
|---|---|
zsh |
source <(bun src/index.ts completion zsh) |
bash |
source <(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
lhbinary by itself.
Quick Check
which lh
lh --help
lh agent <TAB>