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 fact about the API has exactly one home — and when the spec moves, this is the only directory to re-read.
Index ¶
- Constants
- func CheckOrigin(lock *core.Lockfile, current core.Origin) error
- func ConsoleLinks(consoleURL, workspaceID string) func(core.Kind, string) string
- func NewClient(client anthropic.Client, opts ...option.RequestOption) core.Client
- func Registry() *core.Registry
- func WhoAmI(ctx context.Context, client anthropic.Client) (organizationID, workspaceID string, err error)
- type OriginMismatchError
Constants ¶
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.
Variables ¶
This section is empty.
Functions ¶
func CheckOrigin ¶
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 ¶
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 Registry ¶
Registry describes every kind to the reconciler.
The Fields below are hand-transcribed from the API specification, and nothing enforces that they stay in step with it. When the SDK is bumped, re-check each one against the endpoint's params and response structs:
- a new server-computed response field not marked Computed causes permanent phantom drift, blocking every plan;
- a new secret not marked WriteOnly gets printed in the plan;
- a new clearable field not marked Clearable means deleting the line from a file silently does nothing.
None of these show up at build time.
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