Skip to content

Profiles: Add /analyze and the analyze report to the TUI - #967

Closed
tobocop2 wants to merge 5 commits into
feat/profile-libraryfrom
feat/analyze-tui
Closed

tobocop2 wants to merge 5 commits into
feat/profile-libraryfrom
feat/analyze-tui

Conversation

@tobocop2

@tobocop2 tobocop2 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Problem

lilbee analyze existed on the command line and over HTTP, but the TUI could not run it, and nothing told a new user it existed before they added files.

Solution

/analyze [dir] runs the analysis in the background with progress and shows a notice when it finishes; /analyze report opens the report. It never opens on its own, so keys typed into chat cannot act on it. The report screen shows what it found, any files it could not read, and the recommended profile with each change it makes, marked as needing a reindex or applying to new files only. Apply opens the Apply dialog on the recommended profile, which starts on Cancel; Save only saves it without switching, and Close leaves everything as it is. /analyze off stops the tip.

The /add hint shows a short tip to run /analyze first, before anything is added, while the project is on Default, has never been analyzed, has no documents and nothing queued for indexing, and the tip has not been turned off.

Everything works by keyboard in an 80 by 24 terminal; the changes table scrolls.

Notes

This stacks on #964.

/analyze [dir] runs analyze as a task-bar task with progress and
cancel, then opens a report screen: what analyze found, the files it
could not read, the recommended profile with its changes and their
reindex cost, and the notes. Apply opens the existing Apply dialog on
the recommended profile; Save only writes it without switching.
"Analyze documents" in the command palette runs it on the indexed
documents.

The /add argument hint shows the analyze tip while the command is
typed, before anything is added, and only while the project is on
Default, never analyzed and has not hidden the tip. /analyze off
hides it.
When analyze finished, the report opened over the chat with focus on
its Apply pill, and the Apply dialog also started on Apply. Two Enters
meant for the chat switched the profile and queued a full rebuild; a
typed "s" saved a profile.

The finished run now only shows a notice. /analyze report opens the
last report when the user asks for it. The report opens with focus on
its read-only text, has no single-letter bindings, and the Apply
dialog starts on Cancel, so no key acts until the user moves to a pill.

The analyze tip now also needs a project with no documents: nothing in
the documents folder and no added source. The CLI tip on init and add
and the TUI /add hint follow the same rule.

Analyze gets its own task pill colour.
test_tui_analyze.py copies _press()/_until() from
test_tui_profile_tab.py and hit the same Windows flake: a loaded
runner exhausted _PAUSES=300 waiting for a ConfirmPill to take
focus. Raise the budget to 900 to match the profile-tab fix.
The save-then-discard test pressed enter/space/a/s/enter, then
checked the report screen was still on top after one unconditional
pilot pause. Wait on the screen with _until() instead, the same
flaky shape a loaded Windows runner exposed in _press() (#958).
test_tui_analyze.py's _press() copied the same single-shot
focus-then-wait shape as test_tui_profile_tab.py, so it carried the
same race: Widget.focus() only queues a call_later, and had no way
to recover if the dialog's own on_mount or a worker callback
touched focus in the same window.

Delegate to the shared press_widget() in tests/_async_wait.py,
which calls Screen.set_focus() directly instead (the synchronous
primitive focus() defers to) and retries it while the widget is not
yet focusable, and drop the pause budget back to 300 now that the
wait no longer needs a wider margin to cover a one-shot bet.
@tobocop2

tobocop2 commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

This change is now part of #1003, which collects every Profiles pull request on one branch. Review and merge happen there. The branch stays in place.

@tobocop2 tobocop2 closed this Oct 3, 2026
@tobocop2
tobocop2 deleted the feat/analyze-tui branch November 1, 2026 06:08
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.

1 participant