Repository navigation
Conversation
There was a problem hiding this comment.
The feature works as described: from source, explain this and run /re opens the popup with the PR (nothing opens on the base), and Enter completes to explain this and run /review without losing the text before it. The new test file and test/prompt pass, and tsc -b is clean. Public API: unchanged. This is a TUI-only change.
Main concern: what does a mid-prompt completion actually do? Submission only runs or expands a command when the prompt starts with /. Mid-prompt, the inserted /review goes to the model as literal text, which I confirmed by submitting explain this and run /review now. The same goes for /cd, /rename and /btw: they're offered mid-prompt because they take arguments, but inserting them there does nothing. So the popup suggests an action that won't happen. This also partly reverses #54857, which deliberately limited command completion to the start of the prompt. I'd like a maintainer to confirm the direction before this goes further. If it stays, it's probably better to list only entries that make sense as text, or to expand the command server-side.
Smaller point: with prefix matching, Enter can still be taken by the popup in normal sentences. For example, tell me about /c then Enter inserts /cd instead of sending the message.
packages/tui/src/component/prompt/autocomplete.tsx:519: Mid-prompt, this inserts the server command name as plain text. On submit,parseSlashHeadonly recognises a command at the start of the prompt, soexplain this and run /review nowreaches the model as-is and the command template is never used (I checked this in the TUI). Is that the intended result? If the goal is to invoke the command or skill mid-prompt (#40689), that needs to happen at submit time or on the server; completion alone won't do it.
| description: command.description ?? command.title, | ||
| onSelect: slash.arguments ? () => insertSlash(name) : command.run, | ||
| })) | ||
| if (!slash || (inline && !slash.arguments)) return [] |
There was a problem hiding this comment.
Mid-prompt, this keeps the TUI commands that take arguments (/cd, /rename, /btw). But argumentSlash only runs them when the prompt starts with /. Picking one mid-sentence therefore inserts text that does nothing; tell me about /c offers /cd, for example. I'd leave keymap commands out entirely when inline is true.
There was a problem hiding this comment.
The new push only merges dev. Nothing in this PR's files changed, so my earlier points still stand: /cd, /rename and /btw are still offered mid-prompt, and a command picked mid-prompt is still sent to the model as plain text. Public API: unchanged.
|
Thanks for the review. To answer the main question: the goal is #40689. A user should be able to mention skills inside the prompt so the model uses them, for example This PR is the first step only: the
Would you prefer that in this PR, or as a follow-up on top of it? I'm happy to rework this PR either way. |
|
Updated per the review and the goal above. Past the start of the prompt, |
There was a problem hiding this comment.
The new commit addresses my earlier points. Mid-prompt the popup lists only skills, and picking one goes through the existing @skill path, so the skill is actually attached instead of being sent as plain text. No commands are offered mid-prompt. I ran it from source with two project skills: review this with /arc → @arch-review, and /co → @code-gen, both sent as skill parts, and tell me about /c still sends on Enter. On the base, a mid-prompt / opened nothing. The new test file passes and tsc -b is clean. Public API: unchanged.




Issue for this PR
Related to #40689 (mention skills in the middle of a prompt).
Type of change
What does this PR do?
Skills could only be mentioned with
@. This lets a user type/anywhere in the prompt (after whitespace) to pick a skill, so several skills can be used in one prompt, for examplereview this design with /arch-review and check it with /code-gen.Picking a skill replaces the typed
/tokenwith an@skillmention. It goes through the existinginsertPartskill path, the same as an@skillmention or the/skillsdialog, so it is stored inPromptInfo.skillsand resolved on submit like those.Changes, all in
packages/tui/src/component/prompt/autocomplete.tsx:onInputopens the popup for a whitespace-preceded/token past the start of the prompt. A bare/does not open it./.tell me about /c.show("command", slash)now sets the index in one step. Setting it in two steps let the new auto-close effect fire on an intermediate state.Behavior at the start of the prompt is unchanged.
How did you verify your code works?
packages/tui/test/prompt-slash-mid.test.tsx(7 tests): mentioning a skill mid-prompt, several skills in one prompt, no repeat of a mentioned skill, prefix matching, no commands mid-prompt, no popup for a bare or unmatched/, and commands still opening at the start when no skills exist. Four fail ondevwithout the change, and the last test fails on the two-stepshow/setStoreform.bun run testinpackages/tui: 1673 pass. The one failure,go-upsell-art, is in code this PR does not touch.bun run typecheck:tscinpackages/tui: clean.--no-verify: the monorepo-widebun run checkin the pre-push hook fails inservices/site/script/check-worker-start.ts, a file this PR does not touch.Screenshots / recordings
Frames from the TUI test renderer, rendered to an image:
Checklist
Added by the opencode bot (AI-generated).
Fixes #40689
Related: #52051