refactor: apiKeyEnv → apiKey, store actual secret in config #530

Merged
xiaonuo merged 2 commits from fix/528-refactor-apikey into main 2026-05-26 05:37:51 +00:00
Owner

What

Rename ProviderConfig.apiKeyEnv to apiKey — store actual API key value in config instead of env var name.

Why

~/.uncaged/workflow/config.yaml is local, never committed. Env var indirection is unnecessary complexity (#528).

Changes

  • workflow-protocol — apiKeyEnv → apiKey in ProviderConfig type
  • workflow-util-agent/extract.ts — use providerEntry.apiKey directly
  • workflow-util-agent/storage.ts — validation updated
  • cli-workflow/setup.ts — removed apiKeyEnvName(), writes key value directly
  • docs/READMEs — updated references
  • Tests — updated setup-validate tests

Breaking Change

Yes — existing config.yaml with apiKeyEnv needs uwf setup to reconfigure.

Ref

Fixes #528

## What Rename ProviderConfig.apiKeyEnv to apiKey — store actual API key value in config instead of env var name. ## Why ~/.uncaged/workflow/config.yaml is local, never committed. Env var indirection is unnecessary complexity (#528). ## Changes - **workflow-protocol** — apiKeyEnv → apiKey in ProviderConfig type - **workflow-util-agent/extract.ts** — use providerEntry.apiKey directly - **workflow-util-agent/storage.ts** — validation updated - **cli-workflow/setup.ts** — removed apiKeyEnvName(), writes key value directly - **docs/READMEs** — updated references - **Tests** — updated setup-validate tests ## Breaking Change Yes — existing config.yaml with apiKeyEnv needs uwf setup to reconfigure. ## Ref Fixes #528
xiaoju added 1 commit 2026-05-26 05:34:21 +00:00
Breaking change: Store API keys directly in config.yaml instead of
environment variable names.

## Changes

### @uncaged/workflow-protocol
- Change ProviderConfig.apiKeyEnv: string → apiKey: string
- Update README to reflect new type

### @uncaged/workflow-util-agent
- extract.ts: Remove dotenv loading, use providerEntry.apiKey directly
- storage.ts: Update normalizeProviders to validate apiKey field
- Update error messages to reference apiKey instead of apiKeyEnv

### @uncaged/cli-workflow
- setup.ts: Write actual API key to config.yaml, not .env
- Remove apiKeyEnvName(), loadEnvFile(), saveEnvFile() functions
- Remove getEnvPath() function
- Update cmdSetup to not return envPath in result
- Update README to reflect config.yaml stores API keys
- Fix setup-validate.test.ts to not expect envPath in result

## Verification
-  bun run build passes
-  All tests pass (260/260 in cli-workflow, 55/55 in util-agent)
-  bun run check passes (only pre-existing warnings)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaoju added 1 commit 2026-05-26 05:37:04 +00:00
Update all documentation files that contained outdated apiKeyEnv
references to use the new apiKey approach.

## Changes

- docs/architecture.md: Update config example to use apiKey field
- docs/wf-stateless-design.md: Update config examples and type
  definitions to use apiKey instead of apiKeyEnv
- docs/builtin-agent-research.md: Update ProviderConfig type
  definition and code examples

All documentation now consistent with the code implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaonuo merged commit bbbe4651c2 into main 2026-05-26 05:37:51 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#530