Skip to content

Conversation

@shuv1337
Copy link
Collaborator

@shuv1337 shuv1337 commented Dec 31, 2025

Summary

This PR merges several improvements from the shuvcode-dev branch including plugin command fixes, UI customization features, and code cleanup.

Changes

Features

  • Add theme and font pickers to header and mobile sidebar
  • Show review pane toggle when session exists
  • Prioritize changelog over thank yous in Discord notification posts

Fixes

  • Fix plugin commands with type field and arguments
  • Only emit Command.Event.Executed when plugin creates new message
  • Restore variant_cycle keybind in TUI prompt
  • Use Meslo as default font

Tests

  • Add test coverage for plugin commands and session-only guard

Chores

  • Remove resolved context files (PLAN-215 and dev-lan-access-issue)
  • Keep command types aligned in SDK

Breaking Changes

None

Testing

  • New tests added in packages/opencode/test/command/plugin-commands.test.ts
  • Existing tests cover remaining changes

Greptile Summary

Merged improvements from shuvcode-dev branch including plugin command fixes, theme/font pickers, and code cleanup.

Major Changes:

  • Fixed plugin commands to properly handle type field and arguments parameter
  • Added comprehensive test coverage for plugin commands (aliases, execution, errors, session-only guard)
  • Added ThemePicker and FontPicker to header and mobile sidebar for UI customization
  • Changed review pane to show when session exists (not just when diffs exist)
  • Changed default font to Meslo
  • Refactored Discord notification script to prioritize changelog over thank yous

Issues Found:

  • Critical regression in packages/opencode/src/session/prompt.ts: reverted previous fix (commit 0953f75) that used session.directory instead of Instance.directory for shell command cwd. This will break shell commands on first message in new projects.

Confidence Score: 3/5

  • This PR has a critical regression that breaks shell commands in new projects
  • Score reflects excellent test coverage and well-implemented features, but a critical regression in cwd handling (reverting commit 0953f75) will cause shell commands to fail on first message in new projects. All other changes are solid.
  • Pay close attention to packages/opencode/src/session/prompt.ts - the cwd changes on lines 1086 and 1177 revert a previous fix and will cause shell command failures

Important Files Changed

Filename Overview
packages/opencode/src/session/prompt.ts Major refactor of plugin command execution, removed variant parameter, reverted cwd to Instance.directory. Has potential regression with cwd change.
packages/opencode/src/command/index.ts Added type field to distinguish template vs plugin commands, improved alias resolution with clearer comments.
packages/opencode/test/command/plugin-commands.test.ts Added comprehensive test coverage for plugin commands including aliases, execution, error handling, and session-only guard.
packages/app/src/components/header.tsx Added ThemePicker and FontPicker components to header, changed review pane toggle condition from files to session existence.
packages/app/src/pages/session.tsx Changed review pane visibility from diffs-only to always show when review opened, updated mobile label from 'Files' to 'Browse Files'.

Sequence Diagram

sequenceDiagram
    participant User
    participant TUI
    participant SessionPrompt
    participant Command
    participant Plugin
    participant PluginCommand

    User->>TUI: /hello world
    TUI->>SessionPrompt: command({command: "hello", arguments: "world"})
    SessionPrompt->>Command: get("hello")
    Command->>Plugin: list()
    Plugin-->>Command: [plugin hooks]
    Command-->>SessionPrompt: {name: "hello", type: "plugin"}
    
    alt sessionOnly check
        SessionPrompt->>Session: get(sessionID)
        alt session not found
            Session-->>SessionPrompt: error
            SessionPrompt->>Bus: publish(Session.Event.Error)
            SessionPrompt-->>TUI: throw Error
        end
    end
    
    SessionPrompt->>Session: messages({limit: 1})
    Session-->>SessionPrompt: lastMessageIDBefore
    
    SessionPrompt->>Plugin: client()
    Plugin-->>SessionPrompt: client
    SessionPrompt->>PluginCommand: execute({sessionID, arguments, client})
    
    alt execution fails
        PluginCommand-->>SessionPrompt: throw error
        SessionPrompt->>Bus: publish(Session.Event.Error)
        SessionPrompt-->>TUI: throw error
    else execution succeeds
        PluginCommand->>Session: create new message
        PluginCommand-->>SessionPrompt: void
        SessionPrompt->>Session: messages({limit: 1})
        Session-->>SessionPrompt: messagesAfter
        
        alt new message created
            SessionPrompt->>Bus: publish(Command.Event.Executed)
            SessionPrompt-->>TUI: return message
        else no new message
            SessionPrompt-->>TUI: return void
        end
    end
Loading

- Toggle button now visible whenever a session is active, not just when
  file changes exist
- Review pane defaults to closed instead of open
- Mobile review button registers when session exists
- Allows users to access file browser before making changes
Handle variant_cycle at element level in prompt's onKeyDown handler.
Global useKeyboard doesn't receive events properly when textarea is
focused, so this keybind must be handled locally.

Fixes #222
Discord release notifications now show the changelog (bullet list of
changes) first, with contributor thank yous truncated first when
hitting the 2000 character limit.

Fixes #221
Set meslo as the default font for both sans and mono font families
instead of Inter/IBM Plex Mono from upstream.
Cherry-picked from dev-pr branch (ba8144c) with conflict resolution:
- Added 'type' field to Command.Info schema (template|plugin)
- Added session-only guard for plugin commands
- Pass 'arguments' to plugin command execute function
- Preserved fork-specific bundleLocalPlugin and serverUrl features
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 1086 to 1089
agent: input.agent,
cost: 0,
path: {
cwd,
cwd: Instance.directory,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: reverts fix from commit 0953f75 that used session.directory for shell command cwd. the previous fix ensured correct working directory on first message in new projects.

Suggested change
agent: input.agent,
cost: 0,
path: {
cwd,
cwd: Instance.directory,
path: {
cwd: session.directory,
root: Instance.worktree,
},
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/opencode/src/session/prompt.ts
Line: 1086:1089

Comment:
**logic:** reverts fix from commit 0953f75b that used `session.directory` for shell command cwd. the previous fix ensured correct working directory on first message in new projects.

```suggestion
      path: {
        cwd: session.directory,
        root: Instance.worktree,
      },
```

How can I resolve this? If you propose a fix, please make it concise.

}

const matchingInvocation = invocations[shellName] ?? invocations[""]
const args = matchingInvocation?.args
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: reverts fix from commit 0953f75 - should use session.directory instead

Suggested change
const args = matchingInvocation?.args
cwd: session.directory,
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/opencode/src/session/prompt.ts
Line: 1177:1177

Comment:
**logic:** reverts fix from commit 0953f75b - should use `session.directory` instead

```suggestion
      cwd: session.directory,
```

How can I resolve this? If you propose a fix, please make it concise.

Applied Greptile review suggestion - restores fix from commit 0953f75
that ensures shell commands use session.directory for correct working
directory, especially on first message in new projects.
@shuv1337 shuv1337 merged commit fce3c8a into integration Dec 31, 2025
2 checks passed
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