Help us shape the future of Go! Take the 2026 Go Developer Survey

claude

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Overview

Package claude teaches the core reconciler about the Claude Developer Platform: which resources exist, what their files look like, which fields the server owns, and how to talk to the API.

Everything Claude-specific in `ant apply` lives here. The core package holds the reconciler itself and does not import this one, so a hand-written fact about the API has exactly one home — and when the spec moves, this is the only directory to re-read.

Index

Constants

View Source
const (
	KindSkill       core.Kind = "skill"
	KindEnvironment core.Kind = "environment"
	KindMemoryStore core.Kind = "memory_store"
	KindVault       core.Kind = "vault"
	KindAgent       core.Kind = "agent"
	KindDeployment  core.Kind = "deployment"
)

The kinds `ant apply` manages. Each is the `type` of its API resource, by which fromAPI finds its rows.

Variables

This section is empty.

Functions

func CheckOrigin

func CheckOrigin(lock *core.Lockfile, current core.Origin) error

CheckOrigin refuses to run against a lockfile whose resources live somewhere the current credentials do not reach: another API host, organization or workspace. Without this, every read comes back not-found and the plan offers to recreate everything under new ids — the wrong reading of "you are logged in elsewhere".

func ConsoleLinks(consoleURL, workspaceID string) func(core.Kind, string) string

ConsoleLinks returns a function that maps a resource to its page in the Console, for the renderer to hang hyperlinks on, or nil when consoleURL is empty. workspaceID may be empty, in which case the Console's `default` alias is used.

func NewClient

func NewClient(client anthropic.Client, opts ...option.RequestOption) core.Client

NewClient wraps an SDK client for use by the reconciler.

func Registry

func Registry() *core.Registry

Registry describes every kind to the reconciler.

What each kind passes to fromAPI is written by hand, and nothing checks it against the API: a new clearable field not marked Clearable means deleting the line from a file silently does nothing.

Order matters: a kind must come after everything it can reference. TestKindOrderIsTopological holds that.

func WhoAmI

func WhoAmI(ctx context.Context, client anthropic.Client) (organizationID, workspaceID string, err error)

WhoAmI asks the server which organization and workspace these credentials act in. Every response names both in headers, so the cheapest authenticated read will do; local configuration is never consulted, which keeps the answer right for API keys and tokens that no profile describes. An ID whose header the server does not send comes back "", with a nil error.

Types

type OriginMismatchError

type OriginMismatchError struct {
	// Lockfile is the lockfile's path, as Error prints it.
	Lockfile string
	// What names what differs: "API host", "organization" or "workspace".
	What string
	// Want is what the lockfile recorded; Got is what the credentials reach.
	Want, Got string
}

OriginMismatchError is the error CheckOrigin returns, so a caller can add what it knows about how to reach the right target — a profile name, say.

func (*OriginMismatchError) Error

func (e *OriginMismatchError) Error() string

Jump to

Keyboard shortcuts

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