context

package
v0.12.0-beta Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Emit a condensed summary of the active raid workspace.

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "context",
	Short: "Print a condensed summary of the active workspace, or run as an MCP server",
	Long:  "Print a condensed, token-efficient snapshot of the active workspace: profile, environment, and per-repository git state. Use --json for machine-readable output.",
	Args:  cobra.NoArgs,
	RunE: func(cmd *cobra.Command, _ []string) error {
		ws := context.Get()
		ws.Tools = collectTools(cmd.Root())
		if jsonOutput {
			return writeJSON(cmd.OutOrStdout(), ws)
		}
		return writePretty(cmd.OutOrStdout(), ws)
	},
}

Command is the `raid context` subcommand. It prints a condensed snapshot of the active workspace — profile, environment, and per-repo branch / dirty state — for human or agent consumption, and hosts the `serve` subcommand that runs the same data live as an MCP server over stdio.

View Source
var ServeCmd = &cobra.Command{
	Use:   "serve",
	Short: "Run an MCP server exposing the active workspace over stdio",
	Args:  cobra.NoArgs,
	RunE: func(cmd *cobra.Command, _ []string) error {
		parent := cmd.Context()
		if parent == nil {
			parent = stdctx.Background()
		}
		ctx, cancel := stdctx.WithCancel(parent)
		defer cancel()
		startVarsWatcherFn(ctx)
		return serveStdioFn(BuildServer())
	},
}

ServeCmd runs an MCP server over stdio, exposing the active raid workspace as resources and the canonical raid agent toolkit as tools. It's the long-running counterpart to `raid context --json` — same shape, served live, with mutating tools that drive raid's actual install / env-switch / run-task paths under the cross-process mutation lock. Long is populated at init() via buildServeLong so the help text can embed the running binary's absolute path in copy-paste host configs.

Functions

func BuildServer

func BuildServer() *server.MCPServer

BuildServer wires up the MCP server with the workspace resources and the raid agent tool catalog. Exported so tests can introspect the assembled server without driving it through stdio.

Types

This section is empty.

Jump to

Keyboard shortcuts

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