feat: --mode flag passed to tui

This commit is contained in:
adamdottv
2025-07-10 10:19:25 -05:00
parent 5dc1920a4c
commit 6603d9a9f0
4 changed files with 18 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ type App struct {
Commands commands.CommandRegistry
InitialModel *string
InitialPrompt *string
IntitialMode *string
compactCancel context.CancelFunc
}
@@ -70,8 +71,9 @@ func New(
appInfo opencode.App,
modes []opencode.Mode,
httpClient *opencode.Client,
model *string,
prompt *string,
initialModel *string,
initialPrompt *string,
initialMode *string,
) (*App, error) {
util.RootPath = appInfo.Path.Root
util.CwdPath = appInfo.Path.Cwd
@@ -106,6 +108,9 @@ func New(
if appState.Mode != "" {
modeName = appState.Mode
}
if initialMode != nil && *initialMode != "" {
modeName = *initialMode
}
for i, m := range modes {
if m.Name == modeName {
modeIndex = i
@@ -154,8 +159,9 @@ func New(
Session: &opencode.Session{},
Messages: []opencode.MessageUnion{},
Commands: commands.LoadFromConfig(configInfo),
InitialModel: model,
InitialPrompt: prompt,
InitialModel: initialModel,
InitialPrompt: initialPrompt,
IntitialMode: initialMode,
}
return app, nil