Skip to content

Conversation

@GollyJer
Copy link

@GollyJer GollyJer commented Jan 20, 2026

Fixes missing default commands in TUI.

Greptile Summary

This PR fixes missing default commands in the TUI by correcting how slash commands are collected and resolves TypeScript declaration issues.

Key Changes

  • dialog-command.tsx: Fixed slashes() method to use the new slash field on CommandOption objects instead of filtering by "/" prefix in values. The method now uses flatMap to filter commands with the slash property and returns proper slash command objects with display names, aliases, and onSelect handlers.
  • custom-elements.d.ts files: Replaced broken symlinks in packages/app and packages/enterprise with actual TypeScript declaration files containing export {} to satisfy TypeScript module requirements.

Root Cause

The original slashes() implementation filtered options by checking if value.startsWith("/"), but the actual command values don't have "/" prefixes (e.g., "session.list", "model.list"). The "/" prefix was only meant for display purposes. Commands now properly declare slash command metadata via the slash field, which includes the command name and optional aliases.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The changes are straightforward bug fixes with clear logic improvements. The slashes() method now correctly uses the slash field as intended by the architecture, and the TypeScript declaration files properly replace broken symlinks. All commands with slash fields in app.tsx will now be correctly returned.
  • No files require special attention

Important Files Changed

Filename Overview
packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx Fixed slashes() to return commands with slash field instead of filtering by "/" prefix in value
packages/app/src/custom-elements.d.ts Replaced symlink with actual file containing export {}
packages/enterprise/src/custom-elements.d.ts Replaced symlink with actual file containing export {}

Sequence Diagram

sequenceDiagram
    participant User
    participant Autocomplete
    participant CommandDialog
    participant App
    
    User->>Autocomplete: Type "/" in prompt
    Autocomplete->>CommandDialog: Call slashes()
    CommandDialog->>CommandDialog: flatMap over options()
    CommandDialog->>CommandDialog: Filter options with slash field
    CommandDialog->>CommandDialog: Build slash command objects
    Note over CommandDialog: For each option with slash:<br/>- display: "/" + slash.name<br/>- aliases: slash.aliases<br/>- onSelect: trigger(option.value)
    CommandDialog->>Autocomplete: Return slash commands
    Autocomplete->>User: Display autocomplete options
    User->>Autocomplete: Select a command
    Autocomplete->>CommandDialog: Call onSelect()
    CommandDialog->>CommandDialog: trigger(option.value)
    CommandDialog->>App: Find matching option
    App->>App: Execute option.onSelect()
Loading

@GollyJer
Copy link
Author

I'm not sure about the test failure. Seems unrelated or pre-existing.

@shuv1337 shuv1337 closed this Jan 21, 2026
shuv1337 added a commit that referenced this pull request Jan 21, 2026
shuv1337 added a commit that referenced this pull request Jan 22, 2026
Restores:
- fix(tui): restore resizable sidebar handle
- fix: default commands missing (#318)
- fix(sync): improve session synchronization handling (#317)
- fix: dedupe slash autocomplete and restore fork README
- feat: add toggle session header visibility command
- fix(ci): improve Windows e2e test reliability
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.

2 participants