Configurable location for OpenCode: sidebar or main window

This commit is contained in:
Mateusz Tymek
2026-01-10 16:00:13 +01:00
parent b8081e70fa
commit 30953b3176
8 changed files with 157 additions and 18 deletions

View File

@@ -45,13 +45,20 @@ The plugin SHALL maintain a state machine with states: stopped, starting, runnin
- **THEN** the state transitions to `error`
### Requirement: Sidebar View Registration
The plugin SHALL register an ItemView that displays in the Obsidian sidebar.
The plugin SHALL register an ItemView that displays in either the Obsidian sidebar or main editor area based on user settings.
#### Scenario: View activation
#### Scenario: View activation in sidebar
- **WHEN** the user clicks the ribbon icon or runs the toggle command
- **AND** the default view location is set to "sidebar"
- **THEN** the OpenCode view opens in the right sidebar
- **AND** if the view already exists, it is revealed
#### Scenario: View activation in main area
- **WHEN** the user clicks the ribbon icon or runs the toggle command
- **AND** the default view location is set to "main"
- **THEN** the OpenCode view opens as a new tab in the main editor area
- **AND** if the view already exists in any location, it is revealed
### Requirement: View State Rendering
The plugin SHALL render different UI content based on the current process state.
@@ -89,13 +96,18 @@ The plugin SHALL start the server automatically when the view is opened if not a
- **THEN** the plugin initiates server start
### Requirement: Settings Configuration
The plugin SHALL provide configurable settings for server port, hostname, executable path, project directory, and auto-start behavior.
The plugin SHALL provide configurable settings for server port, hostname, executable path, project directory, auto-start behavior, and default view location.
#### Scenario: Settings persistence
- **WHEN** the user modifies settings
- **THEN** changes are persisted to plugin data
- **AND** the process manager is updated with new settings
#### Scenario: Default view location options
- **WHEN** the user configures default view location
- **THEN** the options available are "sidebar" and "main"
- **AND** the default value is "sidebar"
### Requirement: Project Directory Validation
The plugin SHALL validate the project directory setting and support tilde expansion.
@@ -131,8 +143,8 @@ The plugin SHALL register commands for toggling the view and controlling the ser
- **THEN** the server stops
### Requirement: Ribbon Icon
The plugin SHALL add a ribbon icon that activates the OpenCode view.
The plugin SHALL add a ribbon icon that activates the OpenCode view in the configured default location.
#### Scenario: Ribbon icon click
- **WHEN** the user clicks the OpenCode ribbon icon
- **THEN** the OpenCode view is activated in the right sidebar
- **THEN** the OpenCode view is activated in the location specified by the default view location setting