workbench

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

README

Shared Workbench composition

NewWorkbench(ctx, db, WithBridge(...), WithRepository(...), WithLauncher(...), ...) composes the existing adapter, SQLC store, cron store, worktree manager and terminal manager. The caller owns its database, Copilot bridge, listener and process context: it grants the pool as a csfpg.IDB after applying store.Migrations to it, and grants the ipc/proc launcher that Git and terminal shells start through. MountUI(router, directory) serves the existing built browser bundle at /ui/.

Call Register(router) to mount the generated API and Restore(ctx) to reconnect persisted sessions. Until restoration succeeds, Workbench API requests return 503 with Retry-After; sibling routes such as MCP remain available. Run Adapter.RunSchedules(ctx) under the caller's lifecycle and call Close(ctx) before closing the bridge and database. Workbench closes its live board and adapter; the caller retains the bridge and database. The public CSF host uses this composition.

The UI build accepts VITE_CSF_DASHBOARD_URL=/ for navigation to a cohosted board. An omitted value leaves the standalone Workbench navigation unchanged.

Documentation

Overview

Package workbench composes the existing Copilot service for caller-owned hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalRepositoryRoot

func CanonicalRepositoryRoot(ctx context.Context, launcher proc.ILauncher, path string) (string, error)

CanonicalRepositoryRoot resolves path to its Git work tree's top level, running Git through launcher.

func MountUI

func MountUI(engine gin.IRouter, directory string)

Types

type Option

type Option func(config *settings)

func WithBridge

func WithBridge(bridge copilotadapter.ICopilotBridge) Option

func WithKanbanOrigins

func WithKanbanOrigins(origins ...string) Option

WithKanbanOrigins mounts the live board on the same router as the adapter. The host supplies its actual allowed browser origins; no listener is created.

func WithLauncher added in v0.2.0

func WithLauncher(launcher proc.ILauncher) Option

WithLauncher grants the process capability that Git and terminal shells start through. It is required: the Workbench never starts a process itself.

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithRepository

func WithRepository(path string) Option

func WithScheduleStore added in v0.2.0

func WithScheduleStore(schedules cron.IStore) Option

WithScheduleStore grants the cron store chat schedules fire through: the binary builds it with cron.NewStore over a pool it applied CSF's schema to. It is required: the Workbench opens no database of its own.

func WithShell

func WithShell(path string) Option

func WithTaskContinuity

func WithTaskContinuity(tasks *workcontinuity.Continuity) Option

func WithWorktrees

func WithWorktrees(path string) Option

type Workbench

type Workbench struct {
	Adapter *copilotadapter.CopilotAdapter
	Store   *store.PostgresStore
	// contains filtered or unexported fields
}

Workbench shares one adapter and its SQLC store between HTTP and inspection. The caller owns the database and CLI bridge and mounts Adapter.Register.

func NewWorkbench

func NewWorkbench(ctx context.Context, db csfpg.IDB, options ...Option) (*Workbench, error)

NewWorkbench composes existing service libraries over the database capability the binary granted, which already carries the adapter's schema (store.Migrations). It never opens a pool, starts a listener or a provider process, or restores sessions implicitly.

func (*Workbench) Close

func (workbench *Workbench) Close(ctx context.Context) error

Close drains browser subscriptions before closing their adapter. The caller continues to own the database and provider bridge.

func (*Workbench) Register

func (workbench *Workbench) Register(router gin.IRouter) error

Register mounts the generated adapter API, returning 503 until Restore succeeds.

func (*Workbench) Restore

func (workbench *Workbench) Restore(ctx context.Context) error

Restore reconnects persisted sessions before enabling the Workbench HTTP API. The host may already serve sibling routes (including MCP) during restoration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL