context

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package context implements the `bitbottle context` command — a single one-call orientation primitive that returns the current host, project, slug, branch, default branch, ahead/behind counts vs the default branch, authenticated user, and backend type. This collapses what previously required three independent calls (auth status / repo view / git status) into a single structured response, principally for AI-agent integrations that pay a per-round-trip latency cost.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(f *factory.Factory, hostname string) (backend.Context, error)

Build assembles a backend.Context from config, git state, and the backend (current user + branch list when inside a repo). Exposed so the MCP `get_context` handler returns the exact same shape as the CLI.

Outside a git repository, BaseRepo() returns a non-nil error. That branch yields an empty Project / Slug / Branch / DefaultBranch / Ahead / Behind while still resolving Host, User, and Backend.

func NewCmdContext

func NewCmdContext(f *factory.Factory) *cobra.Command

NewCmdContext builds the cobra command. The command has no subcommands and takes no positional arguments — the entire shape is resolved from config, git state, and one backend round-trip (current user + branch list when inside a repo).

Types

This section is empty.

Jump to

Keyboard shortcuts

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