@anyforge/control 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,6 +32,10 @@ Pick whichever suits the moment — the choices aren't mutually exclusive over t
32
32
 
33
33
  > The `.env` written in per-repo mode contains a live `ANYFORGE_API_KEY`. The CLI warns if your repo's `.gitignore` doesn't already exclude `.env`. **Add it before committing.**
34
34
 
35
+ ### Why `ANTHROPIC_AUTH_TOKEN`, not `ANTHROPIC_API_KEY`?
36
+
37
+ Claude Code recognises both, but they behave differently. `ANTHROPIC_API_KEY` is sent as `X-Api-Key` and — when an OAuth Console login is also present — surfaces an "Auth conflict: Using ANTHROPIC_API_KEY instead of Anthropic Console key" warning, and can cascade into a "selected model may not exist" error. `ANTHROPIC_AUTH_TOKEN` is sent as `Authorization: Bearer …`, is documented for "routing through an LLM gateway or proxy", out-ranks the OAuth login cleanly, and matches the bearer-token shape AnyForge expects. We patch the token form, and on every install we explicitly delete any stale `ANTHROPIC_API_KEY` left behind by older versions.
38
+
35
39
  ## Commands
36
40
 
37
41
  | | |
@@ -65,7 +65,12 @@ async function patchClaudeCode(opts) {
65
65
  }
66
66
  const env = (json.env ?? {});
67
67
  env.ANTHROPIC_BASE_URL = `${opts.endpoint}/v1/anthropic`;
68
- env.ANTHROPIC_API_KEY = opts.apiKey;
68
+ env.ANTHROPIC_AUTH_TOKEN = opts.apiKey;
69
+ // Strip stale ANTHROPIC_API_KEY from prior installs — keeping
70
+ // both set re-triggers the auth-conflict warning even though
71
+ // ANTHROPIC_AUTH_TOKEN is what we actually want Claude Code
72
+ // to use.
73
+ delete env.ANTHROPIC_API_KEY;
69
74
  json.env = env;
70
75
  await fs.writeFile(path, JSON.stringify(json, null, 2) + '\n');
71
76
  // eslint-disable-next-line no-console
@@ -93,7 +98,7 @@ async function patchRepoEnv(opts) {
93
98
  SENTINEL_BEGIN,
94
99
  `ANYFORGE_API_KEY=${opts.apiKey}`,
95
100
  `ANTHROPIC_BASE_URL=${opts.endpoint}/v1/anthropic`,
96
- `ANTHROPIC_API_KEY=${opts.apiKey}`,
101
+ `ANTHROPIC_AUTH_TOKEN=${opts.apiKey}`,
97
102
  `OPENAI_BASE_URL=${opts.endpoint}/v1/openai`,
98
103
  `OPENAI_API_KEY=${opts.apiKey}`,
99
104
  SENTINEL_END,
@@ -177,9 +182,10 @@ async function ensureShellRcExports(opts) {
177
182
  SENTINEL_BEGIN,
178
183
  `export ANYFORGE_API_KEY="${opts.apiKey}"`,
179
184
  `export ANTHROPIC_BASE_URL="${opts.endpoint}/v1/anthropic"`,
180
- `export ANTHROPIC_API_KEY="${opts.apiKey}"`,
185
+ `export ANTHROPIC_AUTH_TOKEN="${opts.apiKey}"`,
181
186
  `export OPENAI_BASE_URL="${opts.endpoint}/v1/openai"`,
182
187
  `export OPENAI_API_KEY="${opts.apiKey}"`,
188
+ `unset ANTHROPIC_API_KEY 2>/dev/null || true`,
183
189
  SENTINEL_END,
184
190
  '',
185
191
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyforge/control",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AnyForge Control CLI — governed LLM proxy for Claude Code, Cursor, Cline, and any agent that talks to OpenAI- or Anthropic-shape APIs.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://anyforge.ai",