SDK v1.14.0
Highlights
Two new environment-variable conventions for resolving the Affinity API key from
external secret stores — AFFINITY_API_KEY_FILE (path to a file containing the key,
used by Docker secrets, k8s mounted Secrets, and Hashicorp Vault agent) and
AFFINITY_API_KEY_COMMAND (a shell command whose stdout is the key, used by
1Password CLI, pass, gpg, macOS Keychain, and git-credential-style helpers).
Both conventions are industry-standard 12-factor patterns and work with from_env(),
AsyncAffinity.from_env(), and the xaffinity CLI.
This release also bundles a previously-unreleased audit cleanup of the
xaffinity marketplace and plugin metadata (no behavior change for users on
existing install commands; brings on-disk state in line with Claude Code
v2.1.120 plugin/marketplace conventions).
What's New
AFFINITY_API_KEY_FILE— set this env var to a file path; the SDK and CLI
read the API key from that file at startup. Supports~expansion. File
permissions are checked on Posix systems; aUserWarningis emitted if the file
is group- or world-readable. Useful with Docker secrets (/run/secrets/…), k8s
mounted Secrets, and Hashicorp Vault agent sidecar patterns.AFFINITY_API_KEY_COMMAND— set this env var to a shell command; the SDK and
CLI run it at startup and use its stdout as the API key. Shell is used so that
credential helper conventions (op read …,security find-generic-password -w,
pass show …,vault kv get -field=…) work without quoting gymnastics. Default
timeout is 30 s, overridable viaAFFINITY_API_KEY_COMMAND_TIMEOUT. Non-zero exit
or empty stdout raises aConfigurationError/CLIError.- Both new env vars are tried between
AFFINITY_API_KEY(step 2) and the
existing--api-key-file/--api-key-stdinCLI flags (steps 5–6) in the
resolver chain. Empty string is treated as unset at every step. - New internal module
affinity/_internal/keyfile.pywithread_key_fileand
read_key_commandhelpers shared between the SDK and CLI resolver call sites. xaffinity config check-keynow recognizesAFFINITY_API_KEY_FILEand
AFFINITY_API_KEY_COMMANDas configured sources (reportssource: "file"/
"command"in JSON output). Previously the check-key helper only knew about
AFFINITY_API_KEYenv,.envfiles, and the profile config, so users who
configured the key only via_FILEor_COMMANDgot a misleading
configured: false.- Marketplace (
xaffinity) metadata:owner.email,owner.url, and per-plugin
homepage,repository,license, andtagsfields (no new install commands;
metadata only).
Changes
- CLI "missing API key" error message now enumerates all resolution paths
(env vars, file/stdin flags, profile config) rather than naming a subset. - Plugin manifest names aligned to marketplace entry names:
affinity-sdk→affinity-crm-sdk-unofficial,
xaffinity-cli→affinity-crm-cli-xaffinity-unofficial. Existing install
commands are unchanged for users on the published marketplace. - All
/plugin install|update|uninstall <short>@xaffinityreferences in
README.md,docs/public/**,mcp/.claude-plugin/xaffinity-mcp.sh,
mcp/README.md, and the GitHub release install footer updated to the
correct long-form identifiers
(affinity-crm-{sdk,cli-xaffinity,mcp}-unofficial@xaffinity). The previous
short forms had never resolved against the published marketplace. - CLI plugin's
xaffinity-cli-usageskill: full resolution chain documented
in theconfigured: falsebranch; Cowork-specific edge case now points
users at project.env+--dotenvandAFFINITY_API_KEY_FILEas
portable options. - MCP plugin's
affinity-mcp-workflowsskill: API-key-error troubleshooting
row lists all five resolution paths. - Plugin skill frontmatter split into
description+when_to_use(SDK and
CLI plugins).
Removed
- Dead
mcp/.claude-plugin/.mcp.json(inlinemcpServersinplugin.json
is the source of truth).
Plugins
- SDK plugin (
affinity-crm-sdk-unofficial): 1.6.0 → 1.6.1 —plugin.json#namealignment + skill frontmatter split. - CLI plugin (
affinity-crm-cli-xaffinity-unofficial): 1.8.0 → 1.8.2 —plugin.json#namealignment + skill frontmatter split + newAFFINITY_API_KEY_FILE/_COMMANDdocumentation in the resolution-chain skill content. - MCP plugin (
affinity-crm-mcp-unofficial): 1.22.1 → 1.22.2 — troubleshooting skill row updated to list all key-resolution paths.
Quick Install
SDK only:
pip install affinity-sdkSDK + CLI:
pipx install "affinity-sdk[cli]"MCP Server for Claude Desktop (easiest - MCPB bundle):
- Install CLI:
pipx install "affinity-sdk[cli]" - (Optional) Pre-configure API key:
xaffinity config setup-key- If skipped, Claude Desktop will prompt for your API key during install
- Install xaffinity MCP in Claude Desktop (download and double-click)
Other MCP clients (Cursor, Windsurf, VS Code, etc.) require manual configuration - see MCP docs.