Skip to content

✨ feat(cli): add shell completion and migrate to tsdown#13164

Merged
Innei merged 4 commits into
lobehub:canaryfrom
Innei:build/cli-migrate-tsdown
Mar 23, 2026
Merged

✨ feat(cli): add shell completion and migrate to tsdown#13164
Innei merged 4 commits into
lobehub:canaryfrom
Innei:build/cli-migrate-tsdown

Conversation

@Innei

@Innei Innei commented Mar 20, 2026

Copy link
Copy Markdown
Member

πŸ’» Change Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ‘· build
  • ⚑️ perf
  • βœ… test
  • πŸ“ docs
  • πŸ”¨ chore

πŸ”— Related Issue

N/A

πŸ”€ Description of Change

This PR expands the CLI packaging update with interactive shell-completion support for @lobehub/cli.

  • migrate the CLI bundler from tsup to tsdown
  • add shell completion support for lh / lobe / lobehub
  • add a public completion [shell] command and an internal __complete resolver backed by the Commander command tree
  • make completion context-aware so nested commands like lh agent <TAB> return agent subcommands instead of top-level commands
  • document local build, bun link, and completion usage in apps/cli/README.md

πŸ§ͺ How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

Commands run:

cd apps/cli
bunx vitest run --config vitest.config.mts --silent='passed-only' 'src/commands/completion.test.ts'
bun run build
source <(bun src/index.ts completion zsh)
LOBEHUB_COMP_CWORD=1 bun src/index.ts __complete agent

πŸ“Έ Screenshots / Videos

N/A (CLI only)

πŸ“ Additional Information

bun run build only generates the binary in dist/. To use lh from the shell locally, run bun run cli:link and refresh shell command lookup if needed (for example rehash in zsh).

@vercel

vercel Bot commented Mar 20, 2026

Copy link
Copy Markdown

@Innei is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@lobehubbot

Copy link
Copy Markdown
Member

@nekomeowww - This is a build tooling change (migrating CLI bundler from tsup to tsdown). Please take a look.

Innei added 2 commits March 20, 2026 21:36
- Moved several dependencies from "dependencies" to "devDependencies" in package.json.
- Updated the bundling configuration in tsdown.config.ts to simplify the bundling process.

Signed-off-by: Innei <tukon479@gmail.com>
- Moved "fast-glob" from "dependencies" to "devDependencies" in package.json for better clarity.
- Removed the "onlyBundle" option from tsdown.config.ts to streamline the configuration.

Signed-off-by: Innei <tukon479@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f25c649f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/package.json
],
"scripts": {
"build": "npx tsup",
"build": "tsdown",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the CLI build self-contained outside the root workspace

Because the repo root package.json does not include apps/cli in workspaces, a normal root bun i/pnpm i does not create apps/cli/node_modules. With this change, bun run build in apps/cli now resolves a bare tsdown binary and fails with command not found unless contributors perform a separate install in that subproject first. The previous npx tsup command did not have that requirement, so this regresses the standard β€œclone + install at repo root” workflow for building or publishing the CLI.

Useful? React with πŸ‘Β / πŸ‘Ž.

@codecov

codecov Bot commented Mar 20, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 74.32%. Comparing base (12280ba) to head (b1ec8a1).
⚠️ Report is 16 commits behind head on canary.

Additional details and impacted files
@@             Coverage Diff             @@
##           canary   #13164       +/-   ##
===========================================
- Coverage   84.47%   74.32%   -10.15%     
===========================================
  Files         311     1531     +1220     
  Lines       19517   125642   +106125     
  Branches     3817    17172    +13355     
===========================================
+ Hits        16487    93384    +76897     
- Misses       2945    32147    +29202     
- Partials       85      111       +26     
Flag Coverage Ξ”
app 67.33% <ΓΈ> (?)
database 97.89% <ΓΈ> (?)
packages/agent-runtime 89.60% <ΓΈ> (?)
packages/context-engine 83.53% <ΓΈ> (?)
packages/conversation-flow 92.36% <ΓΈ> (?)
packages/file-loaders 87.02% <ΓΈ> (ΓΈ)
packages/memory-user-memory 66.68% <ΓΈ> (?)
packages/model-bank 99.84% <ΓΈ> (?)
packages/model-runtime 84.77% <ΓΈ> (ΓΈ)
packages/prompts 74.60% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (?)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (?)
packages/utils 90.09% <ΓΈ> (ΓΈ)
packages/web-crawler 88.81% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 66.21% <ΓΈ> (βˆ…)
Services 49.89% <ΓΈ> (βˆ…)
Server 69.01% <ΓΈ> (βˆ…)
Libs 42.20% <ΓΈ> (βˆ…)
Utils 91.41% <ΓΈ> (-2.07%) ⬇️
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Innei Innei changed the title πŸ‘· build(cli): migrate bundler from tsup to tsdown ✨ feat(cli): add shell completion and migrate to tsdown Mar 20, 2026
@Innei Innei merged commit 4e89a00 into lobehub:canary Mar 23, 2026
19 of 21 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❀️ Great PR @Innei ❀️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

ONLY-yours added a commit that referenced this pull request Mar 27, 2026
# πŸš€ release: 20260326

This release includes **91 commits**. Key updates are below.


- **Agent can now execute background tasks** β€” Agents can perform
long-running operations without blocking your conversation.
[#13289](#13289)
- **Better error messages** β€” Redesigned error UI across chat and image
generation with clearer explanations and recovery options.
[#13302](#13302)
- **Smoother topic switching** β€” No more full page reloads when
switching topics while an agent is responding.
[#13309](#13309)
- **Faster image uploads** β€” Large images are now automatically
compressed to 1920px before upload, reducing wait times.
[#13224](#13224)
- **Improved knowledge base** β€” Documents are now properly parsed before
chunking, improving retrieval accuracy.
[#13221](#13221)

### Bot Platform

- **WeChat Bot support** β€” You can now connect LobeChat to WeChat, in
addition to Discord.
[#13191](#13191)
- **Richer bot responses** β€” Bots now support custom markdown rendering
and context injection.
[#13294](#13294)
- **New bot commands** β€” Added `/new` to start fresh conversations and
`/stop` to halt generation.
[#13194](#13194)
- **Discord stability fixes** β€” Fixed thread creation issues and Redis
connection drops.
[#13228](#13228)
[#13205](#13205)

### Models & Providers

- **GLM-5** is now available in the LobeHub model list.
[#13189](#13189)
- **Coding Plan providers** β€” Added support for code planning assistant
providers. [#13203](#13203)
- **Tencent Hunyuan 3.0 ImageGen** β€” New image generation model from
Tencent. [#13166](#13166)
- **Gemini content handling** β€” Better handling when Gemini blocks
content due to safety filters.
[#13270](#13270)
- **Claude token limits fixed** β€” Corrected max window tokens for
Anthropic Claude models.
[#13206](#13206)

### Skills & Tools

- **Auto credential injection** β€” Skills can now automatically request
and use required credentials.
[#13124](#13124)
- **Smarter tool permissions** β€” Built-in tools skip confirmation for
safe paths like `/tmp`.
[#13232](#13232)
- **Model switcher improvements** β€” Quick access to provider settings
and visual highlight for default model.
[#13220](#13220)

### Memory

- **Bulk delete memories** β€” You can now delete all memory entries at
once. [#13161](#13161)
- **Per-agent memory control** β€” Memory injection now respects
individual agent settings.
[#13265](#13265)

### Desktop App

- **Gateway connection** β€” Desktop app can now connect to LobeHub
Gateway for enhanced features.
[#13234](#13234)
- **Connection status indicator** β€” See gateway connection status in the
titlebar. [#13260](#13260)
- **Settings persistence** β€” Gateway toggle state now persists across
app restarts. [#13300](#13300)

### CLI

- **API key authentication** β€” CLI now supports API key auth for
programmatic access.
[#13190](#13190)
- **Shell completion** β€” Tab completion for bash/zsh/fish shells.
[#13164](#13164)
- **Man pages** β€” Built-in manual pages for CLI commands.
[#13200](#13200)

### Security

- **XSS protection** β€” Sanitized search result image titles to prevent
script injection.
[#13303](#13303)
- **Workflow hardening** β€” Fixed potential shell injection in release
automation. [#13319](#13319)
- **Dependency update** β€” Updated nodemailer to address security
advisory. [#13326](#13326)

### Bug Fixes

- Fixed skill page not redirecting correctly after import.
[#13255](#13255)
[#13261](#13261)
- Fixed token counting in group chats.
[#13247](#13247)
- Fixed editor not resetting when switching to empty pages.
[#13229](#13229)
- Fixed manual tool toggle not working.
[#13218](#13218)
- Fixed Search1API response parsing.
[#13207](#13207)
[#13208](#13208)
- Fixed mobile topic menus rendering issues.
[#12477](#12477)
- Fixed history count calculation for accurate context.
[#13051](#13051)
- Added missing Turkish translations.
[#13196](#13196)

### Credits

Huge thanks to these contributors:

@bakiburakogun @hardy-one @Zhouguanyang @sxjeru @hezhijie0327 @arvinxx
@cy948 @CanisMinor @Innei @lijian @lobehubbot @neko @rdmclin2
@rivertwilight @tjx666
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants