Repository navigation
Separate using a Skill from toggling it in the TUI - #2126
Conversation
eric8810
left a comment
There was a problem hiding this comment.
[P2] Preserve the newline keys when a Skill suggestion is selected. The new Skill branch submits on any Enter, and palette handling runs before the composer handles newline chords. Shift+Enter and Alt+Enter therefore clear the draft and send a bare Skill invocation instead of remaining non-send gestures. Check newline_key in both this path and submits(), and add a regression that distinguishes plain Enter (sends), Tab (completes), and newline Enter (does not send).
[P2] Translate the new key hints in every supported locale. The exact Windows CI job fails every_simplified_chinese_key_resolves_in_every_locale: ja lacks "Tab complete · Enter send". The PR adds the new hints only to the two Chinese locale tables; please add matching entries across the other supported locales and run the parity check to catch any subsequent missing key.
Source review plus the exact GitHub Actions log; I did not run local TUI tests.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head 5d1a863.
The change separates two actions that shared one key, and it does so in the panel's own terms rather than in the caller's. Entry::can_use() folds the four-part filter — enabled, not shadowed, user-invocable, and a name the /skill:<name> token can carry — into one predicate on the entry, so the panel decides what may be used instead of the caller reconstructing that rule at its call site. ActionKind::UseSkill then yields Effect::UseSkill(name), which closes the panel and prepends /skill:<name> to the composer; ActionKind::Toggle stays on Tab.
That Enter prefills rather than submits is the part worth getting right, and it is right: no request, no event, the operator writes the task and sends. The footer now says Enter use · Tab toggle, so the two keys are distinguishable on screen instead of only in the documentation, and the palette keeps its own Tab-completes/Enter-sends behaviour because the remap is scoped to the skills area.
The scope statement holds up against the diff: client-side selection and presentation only, enablement through the existing skills owner, no wire face, event, persistence or lifecycle change, and the contract in cli-commands.md updated in both languages alongside Skills.md.
Blocking: none.
Checks are green at this head. I read the management_panel.rs and tui.rs deltas, the file list and the PR body; I did not read the i18n rows, composer/mod.rs and palette.rs in full, the flow-test changes, or the design deltas, and ran nothing.
Non-blocking: none.
zerob13
left a comment
There was a problem hiding this comment.
The newline-key and locale fixes landed, but two paths still violate the intended draft-then-send interaction.
[P2] Keep the slash palette's existing Skill completion behavior. The accepted CLI contract makes both Enter and Tab fill a selected Skill without sending. This composer change changes a plain Enter on that row to submit the bare Skill instead. Selecting a Skill can now start or steer work before the user has written the task. Keep the /skills action remap, but preserve the existing palette completion keys unless this wider behavioral change is separately agreed.
[P2] Keep the task draft in focus when Use Skill returns from the panel. UseSkill closes the panel and prepends the Skill. If the panel covered a pending non-typing question, the same dispatch restores that question, and it owns subsequent keys. Keep the question pending while handing focus to the populated draft until an explicit send or cancel. Cover that handoff alongside palette completion so inserting a Skill cannot answer or send anything implicitly.
These findings are from exact-head source review. The hosted Linux and Windows checks exercised the fixed key chords and locale parity, and the selected gate is green.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Reviewed at head 5d1a863 (main 6e86d48). Scope: the /skills panel and the / palette Skill rows, plus the English and Chinese contracts. The change is client-side: the panel drafts on Enter and toggles on Tab, and the palette Enter sends. I read the full diff and the changed design sections, ran cargo test -p dim-cli --lib (818 passed) and the locale parity test. I confirmed by source at this head that the two blockers already raised still apply; this review adds the contract contradiction they do not cover.
Verdict: REQUEST_CHANGES, for the contract-document P2 below.
P2 The /skills flow diagram still teaches Enter to toggle
Problem. The new contract paragraph says Tab toggles and Enter uses an invocable selection (docs/design/cli-commands.md:1102-1106), and the panel does that (crates/dim-cli/src/ui/management_panel.rs:471-482). The same document's session-port flow for /skills still draws Enter -> Command { area, Toggle ... } -> skills.set_enabled (docs/design/cli-commands.md:1274), and the Chinese mirror repeats it (docs/zh/design/cli-commands.md:733).
Failure scenario. A reader or the next implementer follows the diagram. On a disabled row Enter now does nothing, and on an invocable row it closes the panel and drafts /skill:<name> . Code written to the diagram would put toggle back on Enter and undo the issue's central separation.
Evidence. docs/design/cli-commands.md:1274 and docs/zh/design/cli-commands.md:733 against docs/design/cli-commands.md:1102-1106 and crates/dim-cli/src/ui/management_panel.rs:471-482. The same section also says the hint is "in the table's order" (docs/design/cli-commands.md:1124-1125), while the Skills hint puts Enter use before Tab toggle (crates/dim-cli/src/ui/management_panel.rs:817-833).
Fix. Update both diagrams: Tab -> Toggle -> skills.set_enabled, and Enter -> UseSkill -> the composer draft. Adjust the "table's order" sentence for the Skills exception. Two lines in each language.
P3 Source comments still describe the old keys
Problem. The module doc still draws the Skills example with Enter toggle · Ctrl+R reload · Esc close and says "Enter, Space, ... keep one meaning in every area" (crates/dim-cli/src/ui/management_panel.rs:15,19). The flow test still says "Enter toggles the selected entry" (crates/dimcode/tests/cli_flow/skills.rs:468).
Failure scenario. The module doc is the source of the example the PR updated in the design page. A later reader takes Enter and Space as the panel's keys and regresses the split.
Evidence. crates/dim-cli/src/ui/management_panel.rs:15 and :19; crates/dimcode/tests/cli_flow/skills.rs:468.
Fix. Update both to Tab toggle and Enter use, and narrow the "one meaning in every area" sentence.
P3 No test covers the panel's Enter use end to end
Problem. The panel test asserts Effect::UseSkill (crates/dim-cli/src/ui/management_panel.rs:1067-1071) and the composer test asserts the prepend, but no TUI test opens a Skills panel, presses Enter on an invocable row, and checks that the panel is gone, the draft is /skill:<name> , and the next key reaches the composer. The new flow tests cover only the palette Tab and the panel Tab.
Failure scenario. A later change to prompt closing or key routing can restore another prompt over the draft and silently steal the keys; the suite stays green.
Evidence. crates/dim-cli/src/ui/tui.rs has no test for Effect::UseSkill; crates/dimcode/tests/cli_flow/skills.rs:531-535 covers Tab only; crates/dimcode/tests/cli_tui_flow.rs:2825-2830 covers the palette Tab only.
Fix. Add one test: seed the Skills view with an invocable entry, press Enter, assert composer.text() == "/skill:<name> ", then send a plain character and assert it lands in the composer.
|
|
||
| In both TUI modes, `/skills` lists names and states by source. Selecting a Skill does not | ||
| display its description, file path or file contents. In this panel Tab toggles the selected | ||
| Skill and leaves the list open. Enter uses an invocable selection: it closes the list and |
There was a problem hiding this comment.
This paragraph now says Tab toggles and Enter uses in /skills, but the same document's /skills flow at line 1274 still routes Enter to Toggle -> skills.set_enabled, and the Chinese mirror repeats it at docs/zh/design/cli-commands.md:733. Update both diagrams with the new split so the contract does not teach the behavior this change removes.
There was a problem hiding this comment.
Partially fixed in 87db9da: docs/design/cli-commands.md:1123 now excepts the Skills keys from the table. The /skills flow at docs/design/cli-commands.md:1273 still draws Enter -> Toggle -> skills.set_enabled; it should draw Tab -> Toggle and Enter -> UseSkill -> /skill:<name> in the composer.
There was a problem hiding this comment.
Fixed in ed40da7. Updated the English flow diagram to separate Enter → task draft from Tab → skills.set_enabled; Hooks editing is now a separate path.
| 条目按所有者报告的分组归类——user、project、`plugin:<id>`、内置——顺序与所有者的报告顺序一致;一个 Hook 来源本身就是一个条目,归在 `sources` 分组下。每个条目有标签、详情、它的状态(已启用、已禁用、无效、不可用、被覆盖、只读)以及它提供的动作。所有者不允许客户端写入的条目(插件所有、已锁定)不提供写入动作,详情说明原因。所有者无法使用的东西作为 issue 列在条目之后。当 run 种类接受输入文档时,条目可以携带该操作的输入文档:Ctrl+T 先用外部编辑器打开它,run 随编辑器留下的文本发出。 | ||
|
|
||
| 两种 TUI 模式下,`/skills` 都按来源列出名称和状态。选中 Skill 不显示其描述、文件路径或正文。 | ||
| 在此面板中,Tab 切换所选 Skill 的启停状态并留在列表。Enter 使用可调用的选中项:关闭列表, |
There was a problem hiding this comment.
The /skills flow at line 733 still routes Enter to Toggle -> skills.set_enabled. Update it with this paragraph's Tab toggle and Enter use split so the Chinese contract matches the panel.
There was a problem hiding this comment.
Partially fixed in 87db9da: the table-order sentence now excepts the Skills keys. The /skills flow at docs/zh/design/cli-commands.md:734 still draws Enter -> Toggle -> skills.set_enabled; update it to Tab -> Toggle and Enter -> UseSkill -> composer draft so it matches docs/zh/design/cli-commands.md:646-649.
There was a problem hiding this comment.
Fixed in ed40da7. Updated the Chinese diagram and hint ordering to match the Skills panel.
| .filter(|e| e.actions.contains(&ActionKind::UseSkill)) | ||
| .map_or(Effect::None, |e| Effect::UseSkill(e.label.clone())); | ||
| } | ||
| KeyCode::Tab => KeyEvent::new(KeyCode::Enter, key.mods), |
There was a problem hiding this comment.
The module doc above (lines 15 and 19) still draws this panel with Enter toggle and says Enter, Space, ... keep one meaning in every area. With this remap Enter is use, Tab is toggle, and Space is not a Skills action. Update the example and that sentence.
There was a problem hiding this comment.
Fixed in ed40da7. Corrected the module example, CLI README and test description. Enter uses the Skill; Tab toggles it; Space is not a toggle.
zerob13
left a comment
There was a problem hiding this comment.
The slash palette now prefills on Enter or Tab without sending, the newline shortcuts are preserved, and /skills correctly returns focus to the task draft initially.
[P2] Keep the task draft focused when the user edits before its Skill token. This is the remaining case of the prior focus finding. With a non-typing question pending, select a Skill from /skills, move the caret to the beginning, and type a task before the token. The event handler clears the draft's focus after the first character because the text no longer starts with /. The question then handles the next keys, so Space or Enter can change or confirm an answer rather than edit or send the task. Keep focus until explicit submit or cancel instead of tying it to the prefix, including when the Skill reference moves within the draft.
Source review; the exact current run was not yet complete.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head 87db9da.
Approving, citing my review at 5d1a8639. The two commits since then extend the same separation to the place it was missing: /skills now loads its catalog at Home as well as in a Session, because the read was previously wired into one opening branch. read_skills as a method is the right shape for that — it checks whether the client offers skills.catalog, reads with the current cwd, and reports a failed read as a notice instead of failing the panel — and the calls sit at the points where a Home or resumed view becomes current.
The test rename states the behaviour plainly: a_skill_row_completes_without_sending_and_preserves_newline_keys. That is the property that matters — choosing a Skill completes the row, it does not submit, and the newline keys a draft can carry survive the completion. It also keeps the two callers honest: the palette still sends on Enter where that is the contract, and the Skills row completes.
The TUI behaviour is pinned the way this repository asks for it: two tmux scenarios in scripts/tui-tmux/scenarios.mjs with screenshots, rather than a cli_flow case asserting on private render state, and the interaction document updated to match.
Blocking: none.
Checks are green at this head. I read the session_host.rs, composer/mod.rs and tui.rs deltas and the file list; I did not read the 56 lines of tmux scenarios, the screenshots, the README and design deltas, and ran nothing.
Non-blocking: none.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Reviewed at head 87db9da (origin/main bf3a4e6). Scope: the /skills panel and the / palette Skill rows in both TUI modes, the Home catalog read, the pending-question draft focus, and the English and Chinese contracts. The change is client-side: Tab toggles in /skills, Enter drafts /skill:<name> for an invocable row, the slash palette completes on Enter or Tab without sending, and Home loads the launch workspace catalog. I read the full diff and the new tmux scenarios, ran the target tests below, and confirmed CI is green at this head.
Verdict: REQUEST_CHANGES for the two P2s below.
P2 The docs still teach Enter to toggle in /skills
Problem. The new paragraph says Tab toggles and Enter uses an invocable selection (docs/design/cli-commands.md:1100-1105), and the panel does that (crates/dim-cli/src/ui/management_panel.rs:471-481). The same document's session-port flow still draws Enter -> Command { area, Toggle ... } -> skills.set_enabled -> skills.catalog (docs/design/cli-commands.md:1273). The Chinese mirror repeats it (docs/zh/design/cli-commands.md:734). The shipped README's management-surfaces paragraph also still says the keys are one per kind in every area with Enter or Space toggles and Tab inspects (crates/dim-cli/README.md:1619-1622), while its own /skills row now says Tab toggles and Enter uses (crates/dim-cli/README.md:1500). The reworded exception at docs/design/cli-commands.md:1123 covers the key names but still says hints follow "the table's order", while the Skills hint puts Enter use ahead of Tab toggle and UseSkill has no table row.
Failure scenario. A reader follows the diagram or the README summary. On an invocable row Enter now closes the panel and drafts the reference, while both say it toggles. Code written to them would restore toggle on Enter and undo the separation this PR makes.
Evidence. docs/design/cli-commands.md:1273, docs/zh/design/cli-commands.md:734, and crates/dim-cli/README.md:1619-1622 against docs/design/cli-commands.md:1100-1105 and crates/dim-cli/src/ui/management_panel.rs:471-481.
Fix. In both diagrams, draw Tab -> Toggle -> skills.set_enabled and Enter -> UseSkill -> /skill:<name> in the composer. Update the README paragraph to name the Skills exception. Say separately that the Skills hint lists Enter use before Tab toggle.
P2 The pending-question focus ends when the draft no longer starts with /
Problem. Effect::UseSkill sets command_entry = true (crates/dim-cli/src/ui/tui.rs:4296-4300), so the composer keeps the keys while a question waits. But every input recomputes that flag from the first byte of the draft (crates/dim-cli/src/ui/tui.rs:3390). Once the draft stops starting with /, the question prompt takes the keys again (crates/dim-cli/src/ui/tui.rs:3501-3512). The contract says the composer keeps keyboard focus until the draft is sent or cancelled (docs/design/cli-commands.md:1104, docs/zh/design/cli-commands.md:649).
Failure scenario. A question with options is pending. Open /skills, use a Skill with Enter, then press Home (or Ctrl+A) and type the task before the /skill:<name> token. The first character lands in the draft; the next Space changes the question's selection and the next Enter answers or advances it, while the task stays unsent. Opening the palette over the draft and pressing Esc has the same result: the draft is restored after command_entry is already false, so the next key reaches the question. Recalling an older draft with Home then Up does too.
Evidence. crates/dim-cli/src/ui/tui.rs:3390 and 3501-3512; the new scenario types only after the token (scripts/tui-tmux/scenarios.mjs:1040-1092), so it does not cover this path. The prefix rule predates this change, but the UseSkill draft is the first message draft it governs, and the sentence added here is unconditional.
Fix. Keep the focus state set by UseSkill independent of the prefix until the draft is submitted or Esc cancels it, or narrow the contract sentence to the drafts that start with the reference. Add a test that moves the caret before the token and types.
P3 Stale key comments (optional)
The module doc still draws Enter toggle and says Enter, Space, ... keep one meaning in every area (crates/dim-cli/src/ui/management_panel.rs:15,19). The flow test still says Enter toggles (crates/dimcode/tests/cli_flow/skills.rs:468). Both are false at this head.
Prior round
- The docs P2 is still open. The table-order sentence was partially adjusted at docs/design/cli-commands.md:1123, but the flow diagrams and the README summary at crates/dim-cli/README.md:1619 still teach the old keys.
- The module doc and flow-test comments are still open.
- The missing panel Enter-use test is covered now: crates/dim-cli/src/ui/management_panel.rs:1067-1075 asserts
Effect::UseSkill, and scripts/tui-tmux/scenarios.mjs:1040-1092 drives Home selection,/skillsEnter use over a pending question, and both Esc and Enter. Withdrawn.
Verification
- CI at 87db9da: all required checks passed (changes, windows-cli, scripts, verify (linux), macos-native, ci-ok).
- Ran
cargo test -p dim-cli --lib --locked: 818 passed, 0 failed, including the Skill row completion, panel key, and locale parity tests. - Ran
cargo test -p dimcode --test cli_tui_flow tui_skill_rows_come_from_the_catalog_and_complete_without_sending --exact: 1 passed. - Ran
cargo test -p dimcode --test cli_daemon_flow skills::tui_skills_panel_lists_toggles_and_reloads --exact: 1 passed. - Did not run the tmux suite; I read the two new scenarios.
- Merging origin/main bf3a4e6 into the head has no conflicts.
| Effect::UseSkill(name) => { | ||
| self.prompt = None; | ||
| self.composer.prepend_skill(&format!("/skill:{name}")); | ||
| self.command_entry = true; |
There was a problem hiding this comment.
P2: the pending-question focus is tied to the draft prefix. Setting command_entry = true here makes the composer own the keys after UseSkill, but handle recomputes the flag after every key from self.composer.text().starts_with('/') (crates/dim-cli/src/ui/tui.rs:3390). With a question pending, press Home (or Ctrl+A) and type the task before the /skill:<name> token: the first character lands in the draft, then the question owns the next Space or Enter (crates/dim-cli/src/ui/tui.rs:3501-3512) and advances or answers it instead of editing or sending the task. Opening the palette over the draft and pressing Esc does the same, because the draft comes back after command_entry is already false. This contradicts docs/design/cli-commands.md:1104 and docs/zh/design/cli-commands.md:649. Keep the focus state set here independent of the prefix until the draft is submitted or Esc cancels it, and cover a caret before the token in the scenario.
There was a problem hiding this comment.
Fixed in ed40da7. The Skill task draft now keeps focus independently of its prefix. Both real tmux modes reproduced the old failure and passed the updated scenario: insert before the token, Ctrl+O then Esc, continue editing, cancel or submit, and finish the original question. The submitted task was checked at the model boundary.
There was a problem hiding this comment.
Fixed in ed40da7: QuestionFocus::TaskDraft keeps the composer focused after the draft stops starting with /, and the new tmux scenario covers editing before the token, palette close, cancel and submit. A separate ordering case remains in the body: a question that arrives while a palette is already open does not claim Command focus, so completing /goal or a Skill row after the question arrives leaves the next key with the question.
zerob13
left a comment
There was a problem hiding this comment.
The Skill draft now keeps focus through prefix editing, submit, and cancellation. The remaining issue is in the shared routing for ordinary slash commands, not the Skill text.
[P2] Keep a command in control if a question arrives during completion. In the non-typing question handler, a slash palette that opened before the question still receives Tab, but this path does not claim command focus. Completing /goal closes the palette, so subsequent argument keys go to the question instead. Explicitly preserve the active command’s focus through completion until it is submitted or cancelled. Cover the arrival ordering, not just completion when the question was already pending.
Static review. The hosted gate passed on the earlier integrated base; the later main change is limited to Web projection.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head ed40da7.
Approving, citing my review at 87db9da1. The commit replaces command_entry: bool with QuestionFocus { Question, Command, TaskDraft }, and that is the right correction rather than an extra flag: "who owns the keys while a question is pending" was being inferred from a boolean plus palette_open(), and the inferred answer could not express the case this commit is about — a Skill task draft holding the composer while a question waits. With the state explicit, each transition is named: Command when a command draft begins, back to Question on a submit, draft-submit or shell outcome, and TaskDraft when the Skill draft takes the keys. The old command_entry_open() gate stays a single predicate over that state, so the call sites did not each grow their own derivation.
That is the shape a third case asks for: two booleans would have left the combinations meaningful only by convention.
Blocking: none.
Checks are green at this head. I read the tui.rs delta's state and transitions, the file list and the commit messages; I did not read the management_panel.rs changes, the flow test, the 10 lines added to the tmux scenarios, or the design deltas, and ran nothing.
Non-blocking: none.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: PR #2126, round 3, head ed40da7
Scope: the /skills panel and / palette Skill rows in both TUI modes, the Home catalog read, the pending-question focus state, and the English and Chinese contracts. I reviewed the full main...head at ed40da7 (merge base 6e86d48, origin/main 7a0e3d4), not only the delta.
Verdict: REQUEST_CHANGES.
Prior round
- The docs P2 is fixed: both
/skillsflows now draw Tab -> Toggle and Enter -> UseSkill, the README summary names the Skills exception, and the hint-order sentence coversEnter usebeforeTab toggle(docs/design/cli-commands.md:1100-1125, docs/zh/design/cli-commands.md:646-667, crates/dim-cli/README.md:1619-1622). Withdrawn. - The 87db9da focus P2 is fixed for its stated case:
QuestionFocus::TaskDraftsurvives a draft that no longer starts with/, and the new scenario edits before the token, opens and closes the palette, cancels and submits (scripts/tui-tmux/scenarios.mjs:1066-1083). Withdrawn. - The module doc, flow-test comment and missing panel test P3s are fixed. Withdrawn.
P2
1. A question that arrives while the command palette is open still loses command focus
Problem: QuestionFocus starts at Question (crates/dim-cli/src/ui/tui.rs:1734), and sync_prompt installs a pending Prompt::Ask at :2295-2298 without claiming focus. The state is set to Command by the explicit /, Ctrl+O or Ctrl+P path (:3518), and otherwise by the post-key branch at :3393-3394 only while command_entry_open() is still true. A key that completes the row closes the palette before that branch runs, so the ordering below leaves focus at Question. While the palette is still open, command_entry_open (:1826) is true, so Tab or Enter reaches the composer. Completing a command with an argument, or a Skill row, closes the palette. The next handle at :3388 sees !command_entry_open() because focus is still Question, resets it to Question, and the ask branch at :3503 sends the next key to the question.
Failure scenario: In a Session with a running turn, start typing /goal or /rev so the palette is open. The turn asks a question before the palette closes. Press Enter to complete the row, then type the argument or task. The first key after completion goes to the question, not the composer; Space can change the question selection and Enter can answer or advance it while the command or Skill draft stays unsent. A question that arrives after a Skill draft was created without a question pending has the same result, because TaskDraft is reset as soon as command_entry_open() is false.
Evidence: crates/dim-cli/src/ui/tui.rs:1734, :1826, :2295-2298, :3388, :3502-3518; scripts/tui-tmux/scenarios.mjs:1066-1074 opens the question first and then /skills, so it does not cover this ordering.
Fix: When sync_prompt installs a question while the palette is open or the composer text starts with /, set question_focus = Command (or keep TaskDraft for a Skill draft) instead of leaving it Question. Add a scenario where the turn asks the question while the palette is open, the user completes the row with Enter, and the next character lands in the composer.
P3 (optional)
- The action contract calls the client's kinds a closed set but the table does not name
UseSkill(docs/design/cli-commands.md:1123-1140), and the README says a kind is offered only where the area's method table and the owner's view have one (crates/dim-cli/README.md:1623-1624).UseSkillis client-local and offered fromEntry::can_use(crates/dim-cli/src/management/skills.rs:42-49), so that sentence is false for it. Add a row, or say that client-local actions are outside the method-table rule.
Verification
cargo test -p dim-cli --lib --locked: 818 passed, 0 failed.cargo test -p dimcode --test cli_tui_flow tui_skill_rows_come_from_the_catalog_and_complete_without_sending --locked: passed.cargo test -p dimcode --test cli_daemon_flow skills::tui_skills_panel_lists_toggles_and_reloads --locked: passed.node scripts/adr-check.mjs --base 6e86d48: passed, 41 changed files.git diff --check: passed.- CI at ed40da7: ci-ok, scripts, macos-native, verify (linux), windows-cli and changes pass; the other jobs are skipped.
- I read the new tmux scenarios but did not run the tmux suite. The PR is MERGEABLE against 7a0e3d4. I found no P0 or P1.
| { | ||
| self.open_palette(); | ||
| self.command_entry = true; | ||
| self.question_focus = QuestionFocus::Command; |
There was a problem hiding this comment.
P2: the state is set to Command by this branch, or by the post-key branch at :3393-3394 while command_entry_open() is still true. If the question arrives while a palette is already open, question_focus is still Question; command_entry_open() stays true only until the palette closes, and a key that completes the row closes it before the post-key branch runs. Then handle (:3388) resets focus and the next key goes to the question. Start typing /goal or /rev, let the running turn ask a question, press Enter to complete the row, then type: the argument or task does not reach the composer, and Space or Enter can change or confirm the answer. Initialize Command when sync_prompt installs a question over an open palette or a slash draft (:2295-2298), or keep the focus state until the command is submitted or cancelled. Add the arrival-order case to scripts/tui-tmux/scenarios.mjs.
There was a problem hiding this comment.
Fixed in ceec650. A later question now leaves command arguments and Skill drafts with the composer, including when the Skill reference no longer starts the draft. I reproduced the old /goal failure with tmux in scrollback and fullscreen. Both modes now pass with the question gated until (1) the /goal row is open, (2) a Skill row is open, or (3) text has been inserted before a completed Skill. Each test edits, cancels, then answers the original question through to the model. The English and Chinese contracts and CLI README also distinguish local Skill use from adapter actions.
There was a problem hiding this comment.
Fixed for the reported paths in ceec650. command_entry_open now derives from Composer.skill_draft or a slash prefix (crates/dim-cli/src/ui/tui.rs:1816-1820), so completing /goal or a Skill row after the question arrives leaves the next key in the composer. The new scenario covers a question arriving with the palette open and after editing before the token, in both TUI modes (scripts/tui-tmux/scenarios.mjs:1102-1146). Withdrawn. The review leaves one optional P3: the new skill_draft flag can outlive the token when the draft is deleted or replaced from history; the inline comment notes the fix.
zerob13
left a comment
There was a problem hiding this comment.
Re-reviewed ceec650d. Both TUI layouts now keep focus in the composer when an ordinary slash command is completed while a question is pending, through argument entry and submission or cancellation. Esc returns control to the question. This resolves my prior blocker. The exact arrival-before-Tab tmux cases were reported passing by the author; I reviewed those cases statically. Exact integrated PR check passed on f4c29f7b against current main 7a0e3d46, including Linux PTY coverage, Windows CLI checks, selected macOS native tests, and ci-ok.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: PR #2126, round 4, head ceec650
Scope: the /skills panel and / palette Skill rows in both TUI modes, the Home catalog read, the pending-question focus rule, and the English and Chinese contracts. I reviewed the full main...head at ceec650 (merge base 6e86d48, origin/main 7a0e3d4), not only the delta.
Verdict: APPROVE.
Prior round
- The round-3 P2 is fixed.
command_entry_opennow derives fromComposer.skill_draftor a slash prefix (crates/dim-cli/src/ui/tui.rs:1816-1820), so a question that arrives while the palette is open no longer resets command focus when the row completes. The new scenario covers a question arriving with/goalopen, with a Skill row open, and after editing before a Skill token, in both modes (scripts/tui-tmux/scenarios.mjs:1102-1146). Withdrawn. - The round-3 P3 is fixed. The action section says Using a Skill is a local composer action (docs/design/cli-commands.md:1123-1129), and the README says the same (crates/dim-cli/README.md:1619-1624). Withdrawn.
- The removed
QuestionFocusstate has no remaining references in the tree.
P3 (optional)
1. skill_draft can outlive the Skill token
Problem: Composer.skill_draft is set in prepend_skill (crates/dim-cli/src/ui/composer/mod.rs:629-635) and cleared only by clear (:410-421). Deleting the inserted element only prunes tokens (:1042-1049), and browsing history replaces the draft through load_history (:1097-1108), but neither resets the flag. With a question pending, command_entry_open (crates/dim-cli/src/ui/tui.rs:1816-1820) then keeps the keys in the composer.
Failure scenario: Use a Skill from /skills or the / palette, then press Backspace until the token is gone. The composer is empty, but skill_draft is still true. If the running turn asks a question, the panel shows its options while 1 and 2 are typed into the composer and Enter sends that text as a message instead of answering, until the user presses Esc. The same happens after recalling a history entry over a Skill draft: the recalled text is not a slash command or a Skill draft, but it still holds the keys.
Evidence: crates/dim-cli/src/ui/composer/mod.rs:118, :410-421, :629-635, :1042-1049, :1097-1108; crates/dim-cli/src/ui/tui.rs:1816-1820, :3487-3496.
Fix: Reset the flag when the last Skill token is pruned or when history replaces the draft, or derive it from the live tokens. The stuck-key outcome already existed when a question was pending at the time of use; this flag also keeps it when the Skill was selected before the question arrived.
Cross-PR and main
- The PR is based on
6e86d48; current main is7a0e3d46; it is open, not draft, MERGEABLE, and the worktree is clean atceec650d. - #2101 changes the target-contract section of
docs/design/plugins/Skills.mdand does not edit the display bullets at :475-536 that this PR changes. #2095 and #2097 each change distant lines ofdocs/design/cli-commands.md(:1901 and :690, :1309, :1861) and the Chinese mirror; none overlaps this PR's :1100-1129. #1881 changescrates/dim-cli/src/ui/tui.rsat :2295-2328 and its tests; this PR's hunks are at :1813-1830, :3377-3385, :3484-3502 and :4277-4287, so there is no hunk overlap. No other open PR touches the code files in this diff.
Verification
cargo test -p dim-cli --lib --locked: 818 passed, 0 failed at ceec650.cargo test -p dimcode --test cli_tui_flow tui_skill_rows_come_from_the_catalog_and_complete_without_sending --locked: 1 passed.cargo test -p dimcode --test cli_daemon_flow skills::tui_skills_panel_lists_toggles_and_reloads --locked: 1 passed.node scripts/adr-check.mjs --base 6e86d48: passed, 41 changed files.git diff --checkpassed.- CI at ceec650:
changes,scripts,macos-nativeandwindows-clisucceed;verify (linux)is still running; the other jobs are skipped. I did not wait for CI. - I read the new tmux scenarios but did not run the tmux suite.
Unverified
- The new scenario's behavior on the real terminal was not executed here; the focus rule was checked by reading
command_entry_open, the Ask branch and the scenario assertions. - The
verify (linux)result at ceec650 was not available at review time.
| self.area | ||
| .insert_element(&token, TOKEN_KIND, Some(token_line(&skill_label(name)))); | ||
| pub fn prepend_skill(&mut self, reference: &str) { | ||
| self.skill_draft = true; |
There was a problem hiding this comment.
P3 optional: this flag can outlive the Skill it marks. It is cleared only by clear (crates/dim-cli/src/ui/composer/mod.rs:410-421); prune_tokens (:1042-1049) removes a deleted token and load_history (:1097-1108) replaces a draft during history browsing, but neither resets it. command_entry_open (crates/dim-cli/src/ui/tui.rs:1816-1820) then keeps the keys while a question is pending, so the question can ignore 1 and 2, and Enter can send that text as a message, for an empty or unrelated draft until Esc. Reset it when the Skill token leaves the draft, or derive it from the live tokens. The stuck-key outcome already existed when a question was pending at the time of use; this flag also keeps it when the Skill was selected before the question arrived.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head ceec650.
This reverses the shape I approved at ed40da74, and it is the better arrangement: QuestionFocus was a second copy of an answer the composer already holds. With skill_draft a property of the composer and the command case visible as shell().is_none() && text().starts_with('/'), the focus is derived from one owner instead of two fields kept in step by every transition. Two commits ago I praised the enum for making the state explicit; explicit is only better than derived when the derivation is ambiguous, and here it is not — the composer is where a draft lives, so it is where "a draft owns the keys" belongs. Removing the duplicate state is what the ablation review asks for, and taking it back out once the flag had a home is the right call.
The behaviour the commit adds is the part that matters: an active command and a Skill draft both keep the keys when a question arrives, and palette_stash now carries whether the stashed draft was a Skill draft so restoring it restores the right kind. The two tmux scenarios pin the user-visible result rather than private state, which is how this repository wants TUI behaviour covered.
Blocking: none.
Checks are green at this head. I read the tui.rs delta, the file list and the commit message; I did not read the 45 lines of new tmux scenarios, the composer/mod.rs change, or the design and README deltas, and ran nothing.
Non-blocking:
crates/dim-cli/src/ui/tui.rs—palette_stash: Option<(String, bool)>stores the draft's text and its Skill-draft flag as an anonymous pair; a reader at the use site has to remember which half is which. A two-field struct would name them once and remove that lookup, which is the same reason the enum was worth having before the flag found its owner.
Fixes #2128
Behavior
In
/skills, Tab toggles the selected row in place. Enter on an invocable row returns to the composer with/skill:<name>and no model request. The user writes a task and presses Enter to send. Neither the panel nor the transcript previews the loaded instructions. In slash suggestions both Enter and Tab complete the Skill without sending. Home loads the launch workspace catalog before the first message and after returning from a Session. A pending question retains its answers while the user types the task in the composer.tmux screenshots
Cropped terminal captures: Home suggestions → first task draft → task draft with a question pending → explicit answer.
Scrollback
Fullscreen
Design and scope
The CLI command contract covers both layouts. This is a client-side selection and presentation change. Enablement uses the existing skills owner; submission and model context use the existing input path. No new plugin, wire face, event, persistence, handover, callback, assembly or lifecycle change. No accepted ADR or delivery status change.
Verification
Exercised scrollback and fullscreen with real tmux on the installed-version source: toggled off and back on, returned to the composer, typed the task, observed zero model requests until send, then checked that the fixture received both instructions and task.
On that source: 750 CLI unit tests and 17 Skill-related flow tests passed.
Ported the palette flow assertion to its new test target on main. Formatting, diff whitespace and ADR checks passed on the PR branch.
On the updated PR branch: 818 CLI unit tests passed. Both new tmux scenarios in
node scripts/tui-tmux/run.mjs --area skillspassed: Skill suggestions at Home, no model request on completion, draft focus over a pending question until cancel or send, independent question answer, and completion after/new.