Mod slash commands that open UI require Enter twice from the slash menu
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- api, cli, testing-qa
Rechercherichtung
Beginne mit dem Registrierungsvertrag für mod-Befehle und dem Enter-Handler des slash-menu, und verfolge dann, wie Befehl und Beschreibung zu den Menüeinträgen gelangen. Füge den Opt-in-Ausführungsstatus hinzu, wobei die Einfügung bei Tab und Right Arrow erhalten bleibt. Überprüfe die aufgeführten Regressionstestfälle, einschließlich der Ausführung beim ersten Enter, der normalen Vervollständigung von Befehlen und des unveränderten Verhaltens von /model.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Mod slash commands that open UI require Enter twice from the slash menu
Summary
Selecting a mod-provided slash command from the TUI slash menu requires two Enter presses before its handler runs. The first Enter only inserts the completed command into the input; the second Enter dispatches it. Built-in picker commands such as /model run on the first Enter.
This makes UI-only mod commands feel less integrated and contradicts the slash-command documentation, which says Enter runs the selected command while Tab or Right Arrow inserts it.
Expected behavior
A mod command explicitly marked as action-only / execute-on-select should run its handler on the first Enter, allowing a cmd.ui.select() dialog to open immediately like /model.
Tab and Right Arrow should continue to insert the command for editing without executing it.
Actual behavior
The first Enter completes and inserts the mod command with a trailing space. The handler is only called after a second Enter. There is no public addCommand option that lets a mod opt into the built-in picker behavior.
Minimal reproduction
import type {ModApi} from '@commandcode/harness';
export default function (cmd: ModApi): void {
cmd.addCommand({
name: 'picker-test',
description: 'Open a test picker',
handler: async () => {
await cmd.ui.select({
title: 'Test picker',
options: [{label: 'One'}, {label: 'Two'}],
});
},
});
}
- Start
cmd --mod ./picker-test.ts. - Type
/picker-testor select it from the slash menu. - Press Enter once.
- Observe that the picker does not open and the command is merely inserted.
- Press Enter again; the picker opens.
- Compare with
/model, which opens its picker on the first Enter.
Environment
- Command Code 1.32.2 (latest npm release at time of report)
- Linux
- Bash
Technical analysis
The runtime keeps built-in picker commands such as /model in a private BARE_OPENS_PICKER_BUILTIN_SLASH_COMMANDS set. The input dispatcher bypasses completion for members of that set and invokes them immediately.
Mod command menu items only carry command and description, and the public command registration contract is currently {name, description?, argumentHint?, handler}. Consequently, a mod cannot request the same execution mode. transformInput is not a workaround because slash commands and individual keypresses do not route through it.
Suggested API and implementation
Add an explicit opt-in field, for example:
cmd.addCommand({
name: 'picker-test',
description: 'Open a test picker',
executeOnSelect: true,
handler: async () => { /* open UI */ },
});
Then:
- Preserve
executeOnSelectin the mod host's command menu items. - In the slash-menu Enter handler, dispatch such an item immediately.
- Keep Tab and Right Arrow as insertion-only actions.
- Keep the existing completion behavior as the default for backward compatibility.
Suggested regression coverage:
- a mod command with
executeOnSelect: trueruns exactly once on the first Enter; - a normal mod command retains its existing completion behavior;
- Tab and Right Arrow never execute either kind;
- built-in
/modelbehavior remains unchanged.
Real-world case
command-code-external-providers registers /external-providers, whose handler immediately opens a provider/model picker. It currently needs the extra Enter even though it has no arguments and behaves like a built-in picker command.
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 4k
- Forks
- 350
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CommandCodeAI/command-code
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#855 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CommandCodeAI/command-code#841 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#655 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#608 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
CommandCodeAI/command-code#893 ·
Alle Issues in CommandCodeAI/command-code
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
connectrpc/connect-py#342 ·
-
01 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
plone/cookieplone-templates#471 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
notch8/utk_knapsack#148 ·
-
helsemelding-json-schema json-schema-core
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100