TUI plugin API: allow a location on the home route (router.navigate)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- developer-experience
Línea de trabajo
Empieza con el tipo Route del plugin en packages/plugin/src/tui/context.ts y compáralo con HomeRoute en packages/tui/src/context/route.tsx. Añade la ubicación opcional a la variante home y documéntala; comprueba que router.current() exponga la ubicación de la ruta home y que la navegación acepte el directorio mostrado en la reproducción. El issue no indica ningún test, así que primero busca tests existentes de tipos de la API del plugin.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
A TUI plugin cannot open the new-session screen for a specific directory with the typed plugin API. OpenCode's own code can.
Internally, HomeRoute carries an optional location (packages/tui/src/context/route.tsx):
export type HomeRoute = {
type: "home"
prompt?: PromptInfo
// Location carried over from the previous session or project picker so a new session lands there.
location?: LocationRef
}
The project picker (component/dialog-open.tsx) and the workspace move (component/prompt/move.tsx) both call route.navigate({ type: "home", location: { directory } }). Home then applies route.location (routes/home.tsx), so the next session is created in that directory.
The plugin API's Route type (packages/plugin/src/tui/context.ts) has only { readonly type: "home" }. ui.router.navigate passes a home destination straight through to the host (packages/tui/src/plugin/api.tsx), so navigate({ type: "home", location }) works at runtime. However, a plugin has to cast to reach it, and nothing guarantees it keeps working.
Proposal: add readonly location?: LocationRef to the home variant of the plugin Route type, and document it. router.current() would then also type the location of the current home route, which the host already returns.
Use case: opencode-switchboard, a side panel that lists sessions grouped by project, wants a "New session" action on a project. It should open that project's new-session screen, as picking the project in Ctrl+O does, without creating an empty session up front with session.create.
Happy to send a PR.
Plugins
opencode-switchboard
OpenCode version
2.2.5
Steps to reproduce
- In a TUI plugin, call
ctx.ui.router.navigate({ type: "home", location: { directory: "/some/other/project" } }). - TypeScript rejects
location. With a cast, it works: the new-session screen opens in that directory.
Operating System
Ubuntu 24.04
Terminal
Ghostty
- Lenguaje dominante
- TypeScript
- Estrellas
- 224k
- Forks
- 30k
- Merge medio
- 5 h 25 min
- PR fusionados (30 d)
- 494
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de anomalyco/opencode
-
pending close
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
anomalyco/opencode#62305 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
docs: AgentEditor.update creates missing agents, but the plugin docs don't say soPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
anomalyco/opencode#62210 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
tui: /models drops provider grouping when the session location differs from the default locationQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
anomalyco/opencode#62105 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
anomalyco/opencode#62046 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
anomalyco/opencode#61897 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de anomalyco/opencode
Issues similares
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
lingdojo/kana-dojo#33701 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
rookslog/zlibrary-mcp#408 ·
Los mantenedores suelen responder en 1 día
-
mp4box.js — 20-byte `sgpd` box with large `entry_count` causes unbounded loop and heap OOM abortAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
mastra-ai/mastra#29641 · 1 comentario ·
Los mantenedores suelen responder en 1 día