@anyforge/control 0.2.1 → 0.2.2

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.
@@ -1,4 +1,5 @@
1
1
  import { promises as fs } from 'fs';
2
+ import { homedir } from 'os';
2
3
  import { join } from 'path';
3
4
  import open from 'open';
4
5
  import prompts from 'prompts';
@@ -65,13 +66,32 @@ export async function runInit(opts) {
65
66
  // eslint-disable-next-line no-console
66
67
  console.log(dim(' Set ANTHROPIC_BASE_URL=' + endpoint + '/v1/anthropic and'));
67
68
  // eslint-disable-next-line no-console
68
- console.log(dim(' ANTHROPIC_API_KEY=<your AnyForge key> manually if needed.'));
69
+ console.log(dim(' ANTHROPIC_AUTH_TOKEN=<your AnyForge key> manually if needed.'));
69
70
  }
70
71
  else {
71
72
  summarisePatches(patches);
72
73
  }
73
74
  // eslint-disable-next-line no-console
74
75
  console.log();
76
+ if (await hasClaudeCodeLogin()) {
77
+ // Claude Code shows an "Auth conflict" warning when both a /login
78
+ // credential and an env-token are set — even though the token wins
79
+ // by precedence (#2 vs #6), the warning is cosmetic-but-loud. The
80
+ // only way to silence it is to stay logged out: /logout once, then
81
+ // skip the login prompt on the next launch.
82
+ // eslint-disable-next-line no-console
83
+ console.log(yellow(' ⚠ Existing Claude Code login detected (~/.claude/.credentials.json).'));
84
+ // eslint-disable-next-line no-console
85
+ console.log(dim(' Claude Code will work, but it will warn that both a token and a'));
86
+ // eslint-disable-next-line no-console
87
+ console.log(dim(' /login key are set. To silence the warning:'));
88
+ // eslint-disable-next-line no-console
89
+ console.log(dim(' 1) run `claude /logout`,'));
90
+ // eslint-disable-next-line no-console
91
+ console.log(dim(' 2) on the next launch, skip the login prompt (Esc / Ctrl+C).'));
92
+ // eslint-disable-next-line no-console
93
+ console.log(dim(' The AnyForge token in settings.local.json is enough on its own.'));
94
+ }
75
95
  if (scope === 'repo') {
76
96
  // eslint-disable-next-line no-console
77
97
  console.log(dim(' Re-run this command in another repo to patch it too,'));
@@ -112,6 +132,20 @@ async function pollForToken(args) {
112
132
  }
113
133
  throw new Error('Authorisation timed out (15 min). Re-run `anyforge init`.');
114
134
  }
135
+ async function hasClaudeCodeLogin() {
136
+ // Claude Code's docs document the credentials file at
137
+ // ~/.claude/.credentials.json (Linux/Windows) or the macOS Keychain.
138
+ // We can only see the file on Linux/Windows. On macOS the keychain
139
+ // is invisible to us, so this check is best-effort — false negatives
140
+ // are fine since the warning is just a hint.
141
+ try {
142
+ await fs.access(join(homedir(), '.claude', '.credentials.json'));
143
+ return true;
144
+ }
145
+ catch {
146
+ return false;
147
+ }
148
+ }
115
149
  async function isGitRepoRoot(cwd) {
116
150
  // git worktrees use a `.git` file pointing at the real gitdir, so
117
151
  // accept either a directory or a regular file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyforge/control",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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",