feat: booting indicator for async tool sources#22
Merged
StanAngeloff merged 10 commits intodevelopfrom Mar 12, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…iness Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The default statusline format now shows ⏳ while async tool sources are loading. Also removes the redundant DEFAULT_FORMAT local from the lualine component — the single source of truth is config.lua. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rebase onto develop introduced a policy field in sandbox status data that the booting indicator test fixtures were missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d3bbfb6 to
6963630
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Flemma loads async tool sources (e.g. MCP servers, user-provided resolve functions), there's currently no way for users to know that tools are still loading. This PR adds visibility into the boot process through three surfaces:
#{booting}variable — a new resolver that returns truthy while async tool sources are pending, allowing users to show a loading indicator in their statusline format string (e.g.#{?#{booting},⏳ ,}#{model}):Flemma statusbooting line — a⏳ loading async tool sources…line appears in the Tools section while sources are still resolvingFlemmaBootCompleteautocmd — aUserautocmd that fires once all async tool sources have resolved, enabling downstream integrations (the lualine component uses this to auto-refresh)Architecture
No new modules. This extends three existing files plus the syntax file:
lua/flemma/tools/init.luafire_ready_callbacks()now emitsvim.api.nvim_exec_autocmds("User", { pattern = "FlemmaBootComplete" })after draining the callback queue. This is the single event that signals boot completion.lua/lualine/components/flemma.luabootingresolver inmake_resolvers(): returns"1"whiletools.is_ready()is false,""when ready. This integrates with the existing conditional format system (#{?#{booting},true_branch,false_branch}).init()override: creates aUser FlemmaBootCompleteautocmd that callslualine.refresh(), so the statusline updates automatically when boot finishes (no polling needed).lua/flemma/status.luacollect_tools()now includesbooting = not tools_module.is_ready()in its return table.format()conditionally inserts⏳ loading async tool sources…after the Tools header whendata.tools.bootingis true.flemma.status.Datatype annotation is updated to includebooting: booleanon the tools field.syntax/flemma_status.vimFlemmaStatusBootingmatch for^\s\+⏳ .*$, linked toWarningMsghighlight group.Testing
All changes are TDD — tests were written first, verified to fail, then implementation was added:
tests/flemma/tool_async_spec.lua— 1 new test: verifiesFlemmaBootCompleteautocmd fires when the last async source resolvestests/flemma/lualine_spec.lua— 3 new tests:#{booting}truthy while pending, falsy when ready, and lualine refresh onFlemmaBootComplete. The lualine mock was also improved to support properinit()inheritance (addedinitmethod andsetmetatable-basedextend)tests/flemma/status_spec.lua— 4 new tests:data.tools.bootingtrue/false incollect(), and⏳presence/absence informat()Test plan
make qapasses (verified:qa: OK)#{?#{booting},⏳ loading…,}#{model}:Flemma statusshows⏳ loading async tool sources…while a slow async source is pending:Flemma statusomits the booting line once all sources resolve🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com