feat(cli): wire Cursor /summarize and /clear slash builtins (#747)

* feat(cursor): wire /summarize and /clear slash builtins for remote sessions

Seed cursor builtins for web autocomplete, parse summarize/clear in
cursorRemoteLauncher (pass-through to agent -p; reject /clear with args).

Fixes tiann/hapi#738

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cursor): isolate slash commands before message queue batching

Parse summarize/clear at enqueue time (runCursor) with pushIsolateAndClear
so waitForMessagesAndGetAsString never merges a slash with the next prompt.
Adds queue policy tests for invalid /clear + following message.

Addresses PR #747 review.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cursor): preserve pending messages when isolating slash commands

pushIsolateAndClear() wipes the entire queue, so a normal prompt queued
before /summarize or /clear would be silently dropped. Add pushIsolated()
- isolation without clearing - and route Cursor slash commands through
it instead. Adds queue tests covering the preserve-then-isolate path.

Addresses PR #747 review.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
HeavyGee
2026-06-01 12:07:57 +08:00
committed by GitHub
co-authored by Cursor
parent 02d4e93178
commit 449cf6af0a
10 changed files with 230 additions and 2 deletions
+4 -1
View File
@@ -39,7 +39,10 @@ export const BUILTIN_SLASH_COMMANDS = {
{ name: 'default', description: 'Return OpenCode permission mode to default', source: 'builtin' },
{ name: 'init', description: 'Generate or refresh AGENTS.md for this project', source: 'builtin' },
],
cursor: [],
cursor: [
{ name: 'summarize', description: 'Summarize conversation context to free window space (pass-through to Cursor agent)', source: 'builtin' },
{ name: 'clear', description: 'Clear conversation context if supported by Cursor agent', source: 'builtin' },
],
} as const satisfies Record<string, readonly SlashCommand[]>
export function getBuiltinSlashCommands(agent: string): SlashCommand[] {