feat(repl): C.0.2 Tab completion for boxen REPL#769
Merged
Conversation
Adds Tab-key completion to the boxen --debug-tui REPL: slash commands
(/h<TAB> -> /help) and ODB paths (system.<TAB> -> popup of candidates).
Single candidate replaces input inline; multiple candidates open a
transient floating popup above the input bar.
- New repl_completion.h header extracts the completion-callback adapter
pattern from repl.c. Linenoise REPL keeps its current behavior;
boxen REPL uses the same underlying logic via the new callback.
- New boxen_completion_popup.{c,h} module wraps the popup window
lifecycle (raise for z-order above input bar, navigation).
Uses boxen_window_raise instead of set_modal: modal would redirect
key dispatch away from the input window (D3 nuance resolved).
- completion_hook seam on boxen_repl_state_t mirrors the existing
slash_dispatch_hook / repl_eval_hook pattern so the test binary
does not need to link the full repl.c surface.
Keys while popup open: Tab/Down navigate +1, Up navigate -1,
Enter accepts, Esc dismisses, any other key closes and falls through.
Refs: planning/phase_c/REPL_SCHISM_EXECUTION_PLAN.md Section 2
Issue: #691
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
Local /gate Round 1 (pre-merge HEAD 50d44d2)Verdict: PASS WITH NOTES — 0 P0, 0 P1, 6 P2 (all cosmetic doc/comment/contract cleanup). Reviewer summary
P2 items (all <10 min fixes, addressing in-worktree before merge)
Fixing all six before merge. |
Address six P2 findings from local /gate round 1, all cosmetic: - P2-1: popup height doc in header now matches impl (min(count, 10)) - P2-2: file-header design notes updated to reflect set_modal -> raise pivot - P2-3: test mock signatures use BOXEN_COMPLETION_CANDIDATE_MAX (was BOXEN_REPL_INPUT_MAX -- both 1024 but semantically wrong) - P2-4: drop redundant set_user_data call (boxen_window_open already wires user_data via its third argument) - P2-5: document scope-reduction in boxen_repl_real_completion: C.0.2 does slash + ODB path; richer non-slash deferred per execution plan - P2-6: document non-NULL contract for completion in repl_completion.h (bc_add internal callers are trusted; no defensive guard needed) No behavior change; tests unchanged at 784/784, integration baseline character-for-character. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
Local /gate Round 2 (post-fix HEAD 0b56b0e)Verdict: PASS — all six round-1 P2s addressed; spot-check only (delta is 23/-11 LOC, all docs/contract). Round-1 P2 verification
Tests at new HEAD
Reviewer assessmentRound-1 bar-raiser explicitly stated "Ready to merge with two cosmetic doc/comment cleanups" (paraphrasing — actually 5 P2s). All P2s now addressed. Round-1 security ("Clear to land") and concurrency ("PASS") concerns also resolved. No new code paths introduced; no new behavior to re-review. Going straight to merge once CI is green. |
Owner
Author
/auto SummaryWhat went well:
What could improve:
Recommendations:
Issues filed: #770 (non-slash completion parity follow-up, P2 for C.0.x late or C.0.6). 🤖 Generated with Claude Code /auto |
7 tasks
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
Adds Tab-key completion to the boxen
--debug-tuiREPL: slash commands (/h<TAB>→/help) and ODB paths. Single candidate replaces input inline; multiple candidates open a transient floating popup above the input bar. Linenoise REPL behavior unchanged.This is milestone C.0.2 from planning/phase_c/REPL_SCHISM_EXECUTION_PLAN.md Section 2 — second of seven boxen-parity steps before the C.6 default flip.
Changes
Adapter refactor (
repl_completion.h,repl.c)repl_completion.hexposesrepl_complete_slash_command_pathwith a generic(add_fn, ctx)callback signaturerepl.c's existing logic refactored to use the callback; a thinlinenoise_add_adapterkeeps the linenoise REPL byte-identicalrepl_slash_commands_list[]exposed asextern const char *constNew completion popup module (
boxen_completion_popup.{c,h})BOXEN_ATTR_REVERSE; truncates long candidatesboxen_window_raisefor z-order (NOTset_modal— see "Design notes" below)State + key handling (
boxen_repl.c,boxen_repl_internal.h)completion_hookfunction pointer on state (test seam — same pattern asslash_dispatch_hook/repl_eval_hook); production wires it toboxen_repl_real_completionon_input: Tab/Down → navigate +1, Up → navigate -1, Enter → accept, Escape → dismiss, any other → close + fall throughTests (
tests/boxen_repl_tests.c)test_tab_completes_single_slash_command— inline replace for single candidatetest_tab_opens_popup_with_multiple_candidates— popup opens, input_buf unchangedtest_tab_completes_odb_path_prefix— ODB-path completion behaves same as slash commandtest_escape_dismisses_popup_without_accept— Escape closes popup, input_buf unchangedDesign notes
boxen_window_raisenotset_modal: the initial plan called forset_modal, butboxen_dispatch_eventroutes all keys to the modal window — and since the popup has no input_fn, Escape was silently dropped.raisegives us z-order without hijacking key routing; the REPL input window keeps focus, andon_inputroutes keys based ons->completion_popup != NULL.repl.c. Following the established hook pattern forslash_dispatch_hook/repl_eval_hook, the completion hook is injected at runtime — tests use synthetic candidates, production wires toboxen_repl_real_completionunder#ifndef BOXEN_REPL_OMIT_MAIN.Test plan
make -C frontier-cliclean/gate(running)dist/frontier-cli,/h<TAB>→/help,/jump sys<TAB>→ candidate listdist/frontier-cli --debug-tui,/h<TAB>→ inline/help;/<TAB>→ popup above input; Tab/Up/Down navigate; Enter accepts; Escape dismisses; typing closes popup and inserts the charOut of scope (deferred per execution plan)
Refs: #691
🤖 Generated with Claude Code