setuptools

package
v0.22.142 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package setuptools — chat-driven Onboard + Init MCP tools.

Today's CLI surface (`clawtool onboard`, `clawtool init`) requires an operator at a terminal. When clawtool runs as a Claude Code plugin (or any MCP host), the calling AI can't drive that flow because there's no MCP tool exposing it.

This package adds three tools so an AI session can drive onboarding + init from chat:

  • OnboardStatus — read-only probe of repo state.
  • InitApply — dispatches into the same setup.Apply machinery `clawtool init` uses.
  • OnboardWizard — non-interactive subset of `clawtool onboard`: persists telemetry preference + agent-family default + the onboarded marker.

Package name `setuptools` (not `setup`) avoids the clash with internal/setup which both files import — the recipe registry lives there and we delegate Apply / Detect / Categories to it.

Package setuptools — `PeerList` MCP tool.

Today's MCP surface lets a calling agent dispatch / send messages (PeerSend, SendMessage, AutonomousRun) but has no way to *discover* what BIAM peers are currently registered. The CLI verb `clawtool peer list` covers the operator path; this tool covers the chat-driven path so an in-context agent can answer "what other Claude Code / Codex / Gemini sessions are reachable right now" without shelling out.

Read-only. Talks to the local daemon via daemon.HTTPRequest — same auth + 5s timeout + XDG state path the rest of the peer surface uses. The handler does no filtering itself; everything is forwarded as a query param so the daemon's a2a.Registry.List is the single source of truth.

Package setuptools — `RuntimeInstall` MCP tool. Lets a calling agent (Claude) install one of clawtool's supported backend CLIs (codex | gemini | opencode | aider) AT RUNTIME from chat. The install.sh script lands tmux + node + claude-code so the user can open Claude on a fresh box; everything else is on-demand.

Why an MCP tool and not just a CLI verb: the call path the operator wants is "open claude → ask for codex → claude installs it". Forcing the operator to drop to a shell to run `clawtool install codex` defeats the chat-first contract.

Test seam: `runtimeInstallExec` is a package-level var the tests rebind to a deterministic stub so the suite never spawns a real `npm` / `pip` / `curl | sh`. Mirrors the spawnLauncher pattern.

Package setuptools — `Spawn` MCP tool. Mirror of the `clawtool spawn` CLI verb: opens a NEW terminal window/pane running the requested agent CLI, then registers the freshly- spawned agent as a peer in the daemon's BIAM registry so the caller can dispatch to it via SendMessage / PeerSend by peer_id within ~1s of the call returning.

Why mirror (and not call into internal/cli): the cli package already imports tools/core (for ToolsList), so a reverse dependency from setuptools → cli would close the cycle. The launch + register surface is small (~100 LOC) so a lightweight re-implementation here keeps the dependency graph clean while the CLI verb keeps owning the user-visible help text + flag parsing.

Test seams: `spawnLauncher` and `spawnRegisterHTTP` are package-level vars tests rebind to deterministic stubs so the suite never spawns a real terminal or hits the daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAutonomousRun added in v0.22.72

func RegisterAutonomousRun(s *server.MCPServer)

RegisterAutonomousRun wires the AutonomousRun MCP tool to s. Mirror of RegisterOnboardStatus / RegisterInitApply.

func RegisterFanout added in v0.22.85

func RegisterFanout(s *server.MCPServer)

RegisterFanout wires the Fanout MCP tool to s. Mirror of RegisterAutonomousRun; same shape so the manifest entry is a minor variant of AutonomousRun's.

func RegisterInitApply

func RegisterInitApply(s *server.MCPServer)

RegisterInitApply wires the InitApply MCP tool to s. Mirror of RegisterOnboardStatus.

func RegisterOnboardStatus

func RegisterOnboardStatus(s *server.MCPServer)

RegisterOnboardStatus wires the OnboardStatus MCP tool to s. Called from internal/tools/core/manifest.go via the registry's Register fn so the surface-drift test sees the new spec automatically.

func RegisterOnboardWizard

func RegisterOnboardWizard(s *server.MCPServer)

RegisterOnboardWizard wires the OnboardWizard MCP tool to s.

func RegisterPeerList added in v0.22.94

func RegisterPeerList(s *server.MCPServer)

RegisterPeerList wires the PeerList MCP tool to s. Mirrors RegisterOnboardStatus's shape so the manifest row is a one-liner.

func RegisterRuntimeInstall added in v0.22.106

func RegisterRuntimeInstall(s *server.MCPServer)

RegisterRuntimeInstall wires the RuntimeInstall MCP tool to s.

func RegisterSpawn added in v0.22.98

func RegisterSpawn(s *server.MCPServer)

RegisterSpawn wires the Spawn MCP tool to s.

Types

type AutonomousDispatcher added in v0.22.72

type AutonomousDispatcher interface {
	Dispatch(ctx context.Context, prompt string) (AutonomousTick, error)
}

AutonomousDispatcher is the seam runAutonomousRun closes over. One method, exactly the shape the parallel CLI branch's Dispatcher uses, so the merge swaps the local definition for the canonical one without touching call sites or tests.

type AutonomousTick added in v0.22.72

type AutonomousTick struct {
	Summary      string   `json:"summary"`
	FilesChanged []string `json:"files_changed,omitempty"`
	NextSteps    []string `json:"next_steps,omitempty"`
	Done         bool     `json:"done"`
}

AutonomousTick is the per-iteration result a dispatcher returns. Field names track the parallel CLI branch's tick struct so the rebase is mechanical (`{ Summary, FilesChanged, NextSteps, Done }`). Don't rename — the wire format is shared.

type RuntimeInstallResult added in v0.22.106

type RuntimeInstallResult struct {
	Runtime    string `json:"runtime"`
	Installed  bool   `json:"installed"`
	Version    string `json:"version,omitempty"`
	BinaryPath string `json:"binary_path,omitempty"`
	Platform   string `json:"platform"`
	Skipped    bool   `json:"skipped,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

RuntimeInstallResult is the deterministic shape returned to the MCP caller. Field names match the operator-facing contract spelled out in the tool's UsageHint so a caller agent can predict them without reading source.

type SpawnLaunchPlan added in v0.22.98

type SpawnLaunchPlan struct {
	Terminal string
	Bin      string
	Argv     []string
	Cwd      string
	Prompt   string
}

SpawnLaunchPlan is the payload spawnLauncher.Launch consumes.

type SpawnPlan added in v0.22.98

type SpawnPlan struct {
	PeerID   string   `json:"peer_id,omitempty"`
	Backend  string   `json:"backend"`
	Family   string   `json:"family"`
	Terminal string   `json:"terminal"`
	PID      int      `json:"pid,omitempty"`
	Bin      string   `json:"bin"`
	Argv     []string `json:"argv"`
	Cwd      string   `json:"cwd"`
	DryRun   bool     `json:"dry_run,omitempty"`
}

SpawnPlan captures the deterministic shape of a planned spawn — returned verbatim by the tool's StructuredContent so a calling agent can introspect what was just launched.

Jump to

Keyboard shortcuts

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