@askalf/dario 6.12.12 → 6.12.13

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.
@@ -64,6 +64,12 @@ export interface DetectedOAuthConfig {
64
64
  */
65
65
  export declare function normalizeAuthorizeUrl(url: string): string;
66
66
  export declare const FALLBACK_FOR_DRIFT_CHECK: Readonly<DetectedOAuthConfig>;
67
+ /**
68
+ * The first `claude` regular file on `pathValue`, symlinks resolved, or null. The fixed candidates
69
+ * cover the standard install prefixes; this covers any other prefix the user's shell resolves.
70
+ * Exported for tests.
71
+ */
72
+ export declare function findClaudeOnPath(pathValue: string | undefined, names?: readonly string[]): string | null;
67
73
  /**
68
74
  * Scan binary bytes for the PROD OAuth config block.
69
75
  *
@@ -38,9 +38,9 @@
38
38
  * or ~/.dario/oauth-config.override.json.
39
39
  */
40
40
  import { readFile, writeFile, mkdir, stat, open as openFile } from 'node:fs/promises';
41
- import { existsSync } from 'node:fs';
41
+ import { existsSync, realpathSync, statSync } from 'node:fs';
42
42
  import { homedir, platform } from 'node:os';
43
- import { join, dirname } from 'node:path';
43
+ import { join, dirname, delimiter } from 'node:path';
44
44
  import { createHash } from 'node:crypto';
45
45
  /**
46
46
  * Normalize the authorize URL to match what CC uses at runtime.
@@ -131,11 +131,15 @@ function candidatePaths() {
131
131
  }
132
132
  return [
133
133
  // v2.x bin/claude precompiled exe — checked before legacy cli.js/.mjs.
134
+ // The npm package names it bin/claude.exe on every platform.
134
135
  '/usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude',
136
+ '/usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe',
137
+ '/usr/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe',
135
138
  '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/bin/claude',
136
139
  join(home, '.claude', 'local', 'node_modules', '@anthropic-ai', 'claude-code', 'bin', 'claude'),
137
140
  join(home, '.local', 'bin', 'claude'),
138
141
  '/usr/local/bin/claude',
142
+ '/usr/bin/claude',
139
143
  '/opt/homebrew/bin/claude',
140
144
  '/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js',
141
145
  '/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.mjs',
@@ -144,6 +148,28 @@ function candidatePaths() {
144
148
  join(home, '.claude', 'local', 'node_modules', '@anthropic-ai', 'claude-code', 'cli.mjs'),
145
149
  ];
146
150
  }
151
+ /**
152
+ * The first `claude` regular file on `pathValue`, symlinks resolved, or null. The fixed candidates
153
+ * cover the standard install prefixes; this covers any other prefix the user's shell resolves.
154
+ * Exported for tests.
155
+ */
156
+ export function findClaudeOnPath(pathValue, names = platform() === 'win32' ? ['claude.exe'] : ['claude']) {
157
+ for (const dir of (pathValue ?? '').split(delimiter)) {
158
+ if (!dir)
159
+ continue;
160
+ for (const name of names) {
161
+ try {
162
+ const real = realpathSync(join(dir, name));
163
+ if (statSync(real).isFile())
164
+ return real;
165
+ }
166
+ catch {
167
+ // not in this directory
168
+ }
169
+ }
170
+ }
171
+ return null;
172
+ }
147
173
  function findCCBinary() {
148
174
  const override = process.env['DARIO_CC_PATH'];
149
175
  if (override && existsSync(override))
@@ -152,7 +178,7 @@ function findCCBinary() {
152
178
  if (existsSync(p))
153
179
  return p;
154
180
  }
155
- return null;
181
+ return findClaudeOnPath(process.env['PATH'] ?? process.env['Path']);
156
182
  }
157
183
  function isOverrideDisabled() {
158
184
  return process.env['DARIO_OAUTH_DISABLE_OVERRIDE'] === '1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "6.12.12",
3
+ "version": "6.12.13",
4
4
  "description": "Use your Claude and ChatGPT subscriptions in Cursor, Cline, Aider, Claude Code and the Agent SDK — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint: either plan answers either wire shape, with automatic failover when one hits its limit.",
5
5
  "type": "module",
6
6
  "bin": {