A shared client for programs that sign in at yaiam (or any OIDC provider): device flow (RFC 8628), refresh with rotation, revocation (RFC 7009), UserInfo and a 0600 file store. Standard library only; https only (http on loopback), exact issuer match, no redirects, answers capped at 1 MiB, tokens never in errors or fmt output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.7 KiB
AGENTS.md
Guidance for anyone (human or coding agent) working on yetano-clients.
The meta-repository's AGENTS.md (../AGENTS.md) applies as well; this
file only adds what is specific here. User-facing docs are in
README.md, open work in TODO.md.
What this is
A library module, yetano.dev/yetano/yetano-clients, imported like
core: no main, no Makefile publish, no internal/version, no
Yetanofile. A release is a git tag (vX.Y.Z); consumers reach a change
only through a new tag. Never force-move a tag.
Checks
make # gofmt check, go vet, go test -race, govulncheck
Tests use httptest servers only -- never a live Atlassian site.
Rules
- Standard library only. A new dependency needs a real reason.
atlassian/internal/transportowns everything HTTP: auth, TLS, proxy, redirects, retries, the 429 throttle, pagination, downloads.jiraandconfluencebuild requests and decode answers, nothing more. Public configuration and error types live inatlassian.- Credentials are never logged and never put into an error. Redirects to another host drop them.
- No program-specific behaviour: no localized messages, no config-file
knowledge, no output shapes for a particular tool. Those stay in the
consuming program (yareco's
internal/jirautil, yamcp's error mapping). - Every call takes a
context.Context, and every wait (backoff, Retry-After, throttle,APIDelay) ends when it is cancelled. - Cloud and Server/Data Center differ in API prefix and body encoding;
keep that switch inside the client (
APIPrefix,TextBody), never in the caller. - An unexpected answer is an error, never an empty result (
ErrNotJSON,OptionValues/SprintValueson an unknown shape). - Comments explain why, not what. Every exported identifier has a doc comment.
yaiam
yaiam signs a CLI in at yaiam over standards only (device flow,
refresh, revocation, UserInfo). It holds no secret and verifies no
token signature -- no crypto here; servers check tokens with yaiam's
pkg/httpauth. Never log a token or put one into an error, never follow
a redirect with one, never accept an endpoint that is not https (http
only on loopback), and never send a stored token to another issuer or
client than the one it came from. Tests use a fake provider
(httptest); the end-to-end test against a real yaiam-authd is in
yaiam (internal/oidcprovider/devicelogin_test.go).
Consumers
yareco, yabaratla, yamcp (Atlassian); yaiam (its example and
end-to-end test), next yasta (yaiam). All in the yetano
meta-repository. A
breaking API change needs a new minor version and the consumers bumped
in the same wave.