Skip to content

feat(card): archive-style ───── dividers between numbered options in kb-mode#134

Merged
Time4Mind merged 1 commit into
mainfrom
feat/kb-mode-archive-style-dividers
Jun 16, 2026
Merged

feat(card): archive-style ───── dividers between numbered options in kb-mode#134
Time4Mind merged 1 commit into
mainfrom
feat/kb-mode-archive-style-dividers

Conversation

@Time4Mind

Copy link
Copy Markdown
Owner

Summary

  • Follow-up to fix(card): hard line breaks in kb-mode prompt so numbered options don't collapse #133. Numbered options in kb-mode prompts (`1. …`, `❯ 2. …`, etc.) no longer collapsed but still sat with the same row gap as plain prose — visually they blurred into a wall of text. Made the boundary explicit by lifting the /archive list pattern (`handlers/archive.py:426`): split the prompt at every numbered-option line into its own block, join blocks with the same `─────` rule the session list uses.
  • Plain prompts with no numbered options (ExitPlanMode, plain confirmations) keep the cheap hard-break + paragraph join — no dividers chopping prose.
  • Source-level horizontal rules (literal `─────` lines in a captured pane) are absorbed so generated dividers don't double up.
  • Box-frame (fenced code block) branch untouched.

Test plan

  • `uv run pytest tests/test_kb_prompt_sanitize.py` — 19 passing (4 new `TestNumberedOptionsSplit` cases + 3 new `TestPromptWithoutOptions` cases for the no-option fallback)
  • `uv run pytest` — 736 passing
  • `uv run ruff check src/ tests/` / `ruff format --check` / `pyright src/ccbot/handlers/card_model.py`
  • Field check: trigger `/model` picker (or any AskUserQuestion with numbered options) → confirm each option sits in its own block separated by `─────`, matching /archive's session list

🤖 Generated with Claude Code

…kb-mode

After PR #133 fixed line collapse, numbered options stayed on their own
rows but with the same gap as any other line — visually still a wall
of text. Mirror the /archive list affordance: split the prompt at every
numbered-option line ("1.", "❯ 2.", "  3.") into its own block and join
the blocks with the same ───── rule the session list uses. The
trailing hint paragraph (Enter / Esc legend) becomes its own block too,
so the option run ends cleanly.

Plain prompts without numbered options (ExitPlanMode, plain
confirmations) keep the cheap hard-break + paragraph join — no
spurious dividers in prose.

Source rule lines in the pane are dropped to avoid double dividers.
The box-frame (fenced code block) path is untouched; the new helper
only runs on the non-box branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Time4Mind Time4Mind merged commit aeaef7f into main Jun 16, 2026
4 checks passed
@Time4Mind Time4Mind deleted the feat/kb-mode-archive-style-dividers branch June 16, 2026 13:03
Time4Mind added a commit that referenced this pull request Jun 17, 2026
…ath (#136)

The #134 archive-style option dividers only ran in _render_card's frameless
branch. But real AskUserQuestion panes frame each option's preview in
box-drawing glyphs (│ ┌ ├), so _BOX_FRAME_RE always matched and rendering
took the code-fence branch — which emitted the sanitized body as one
monospace block with NO dividers. The feature never fired for the panes
users actually see (the frameless tests passed because they call
_format_kb_prompt directly or feed frameless prompts).

Splice literal ───── rule lines between numbered options inside the fenced
path too (new _rule_between_options). Inside the fence they render as plain
monospace dividers — same visible separation without dropping the fence,
which still prevents telegramify's blockquote-collapse ("✂ N lines hidden")
and MarkdownV2 escaping on the long boxed region. Each option keeps its
trailing preview lines; existing source rules are absorbed so separators
never double up.

Updates test_box_frame_path_unaffected -> test_box_frame_path_no_hard_breaks
(hard-break trick still excluded; dividers now expected) and adds
test_options_separated_by_divider.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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