copillm 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
@@ -5,7 +5,7 @@
5
5
  [![npm version](https://img.shields.io/npm/v/copillm.svg)](https://www.npmjs.com/package/copillm)
6
6
  [![Node.js version](https://img.shields.io/node/v/copillm.svg)](https://www.npmjs.com/package/copillm)
7
7
 
8
- A local proxy that exposes OpenAI- and Anthropic-compatible HTTP endpoints backed by a GitHub Copilot CLI subscription. A single login provides a unified gateway that Codex CLI, Claude Code, and other compatible tools can target directly.
8
+ One Copilot subscription. Every coding agent. A unified gateway for Claude Code, Codex CLI, and any OpenAI- or Anthropic-compatible tool, with authentication, MCPs, and environment configs handled automatically.
9
9
 
10
10
  ## Requirements
11
11
 
@@ -3,32 +3,21 @@ import path from "node:path";
3
3
  import { spawnSync } from "node:child_process";
4
4
  import { setTimeout as sleep } from "node:timers/promises";
5
5
  import { getCopillmHome } from "../config/home.js";
6
- const NPM_PACKAGES = {
7
- codex: "@openai/codex",
8
- claude: "@anthropic-ai/claude-code",
9
- pi: "@earendil-works/pi-coding-agent",
10
- copilot: "@github/copilot"
11
- };
12
- const BIN_NAMES = {
13
- codex: "codex",
14
- claude: "claude",
15
- pi: "pi",
16
- copilot: "copilot"
17
- };
6
+ import { AGENT_REGISTRY } from "../integrations/registry.js";
18
7
  export function packageNameFor(agent) {
19
- return NPM_PACKAGES[agent];
8
+ return AGENT_REGISTRY[agent].npmPackage;
20
9
  }
21
10
  export function binNameFor(agent) {
22
- return BIN_NAMES[agent];
11
+ return AGENT_REGISTRY[agent].binName;
23
12
  }
24
13
  export function parsePinSpec(agent, raw) {
25
14
  const trimmed = raw.trim();
26
15
  if (trimmed.length === 0) {
27
- return { packageName: NPM_PACKAGES[agent], version: null };
16
+ return { packageName: AGENT_REGISTRY[agent].npmPackage, version: null };
28
17
  }
29
18
  // Bare version like "1.4.7" or "^1.0.0"
30
19
  if (/^[\d^~><=*]/.test(trimmed)) {
31
- return { packageName: NPM_PACKAGES[agent], version: trimmed };
20
+ return { packageName: AGENT_REGISTRY[agent].npmPackage, version: trimmed };
32
21
  }
33
22
  // <pkg>@<version>; tolerate scoped pkgs starting with @
34
23
  const isScoped = trimmed.startsWith("@");
@@ -46,9 +35,9 @@ export async function resolveAgent(agent, opts = {}) {
46
35
  const cacheRoot = opts.cacheRoot ?? path.join(getCopillmHome(), "bin");
47
36
  const npmExe = opts.npmExecutable ?? defaultNpmExecutable();
48
37
  const log = opts.log ?? ((line) => process.stderr.write(`${line}\n`));
49
- const pin = opts.pinnedSpec ? parsePinSpec(agent, opts.pinnedSpec) : { packageName: NPM_PACKAGES[agent], version: null };
38
+ const pin = opts.pinnedSpec ? parsePinSpec(agent, opts.pinnedSpec) : { packageName: AGENT_REGISTRY[agent].npmPackage, version: null };
50
39
  const pkg = pin.packageName;
51
- const binName = BIN_NAMES[agent];
40
+ const binName = AGENT_REGISTRY[agent].binName;
52
41
  const agentRoot = path.join(cacheRoot, agent);
53
42
  // 1. PATH lookup (skipped when user pinned a specific version)
54
43
  if (!pin.version && opts.preferPath !== false) {
package/dist/cli.js CHANGED
@@ -14,11 +14,11 @@ import { createLogger } from "./config/logging.js";
14
14
  import { listModels, resolveModelSelections } from "./models/discovery.js";
15
15
  import { acquireLock, inspectLock, LockAlreadyRunningError, releaseLock } from "./server/lock.js";
16
16
  import { startProxyServer } from "./server/proxy.js";
17
- import { defaultOutputDir, generateCodexHome } from "./codex/init.js";
18
- import { defaultOutputDir as defaultPiOutputDir, generatePiHome } from "./pi/init.js";
17
+ import { defaultOutputDir, generateCodexHome } from "./integrations/codex/init.js";
18
+ import { defaultOutputDir as defaultPiOutputDir, generatePiHome } from "./integrations/pi/init.js";
19
19
  import { debugLogPath, getCopillmHome } from "./config/home.js";
20
- import { clearClaudeGatewayCache } from "./claude/cache.js";
21
- import { detectClaudeSettingsConflicts, formatSettingsConflictWarning } from "./claude/settingsConflict.js";
20
+ import { clearClaudeGatewayCache } from "./integrations/claude/cache.js";
21
+ import { detectClaudeSettingsConflicts, formatSettingsConflictWarning } from "./integrations/claude/settingsConflict.js";
22
22
  import { buildClaudeExportCommand as buildClaudeExport, computeAnthropicDefaults, readModelIdsFromCache } from "./models/anthropicDefaults.js";
23
23
  import { isShellSyntax, renderEnvBlock } from "./cli/envBlock.js";
24
24
  import { buildClaudeEnvBundle, buildCodexEnvBundle, buildPiEnvBundle } from "./cli/agentEnv.js";
@@ -1,12 +1,12 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import { CopilotTokenManager } from "../auth/copilotToken.js";
4
- import { loadStoredCredential } from "../auth/credentials.js";
5
- import { loadConfig } from "../config/config.js";
6
- import { listModelsUnion } from "../models/discovery.js";
7
- import { ensureSecureDirectory, writeFileSecureAtomic } from "../config/fsSecurity.js";
8
- import { buildCodexCatalog } from "../server/codexSchema.js";
9
- import { inspectLock } from "../server/lock.js";
3
+ import { CopilotTokenManager } from "../../auth/copilotToken.js";
4
+ import { loadStoredCredential } from "../../auth/credentials.js";
5
+ import { loadConfig } from "../../config/config.js";
6
+ import { listModelsUnion } from "../../models/discovery.js";
7
+ import { ensureSecureDirectory, writeFileSecureAtomic } from "../../config/fsSecurity.js";
8
+ import { buildCodexCatalog } from "../../server/codexSchema.js";
9
+ import { inspectLock } from "../../server/lock.js";
10
10
  export async function generateCodexHome(options) {
11
11
  const config = loadConfig();
12
12
  const creds = await loadStoredCredential();
@@ -1,11 +1,11 @@
1
1
  import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
- import { CopilotTokenManager } from "../auth/copilotToken.js";
5
- import { loadStoredCredential } from "../auth/credentials.js";
6
- import { loadConfig } from "../config/config.js";
7
- import { listModelsUnion } from "../models/discovery.js";
8
- import { ensureSecureDirectory, writeFileSecureAtomic } from "../config/fsSecurity.js";
4
+ import { CopilotTokenManager } from "../../auth/copilotToken.js";
5
+ import { loadStoredCredential } from "../../auth/credentials.js";
6
+ import { loadConfig } from "../../config/config.js";
7
+ import { listModelsUnion } from "../../models/discovery.js";
8
+ import { ensureSecureDirectory, writeFileSecureAtomic } from "../../config/fsSecurity.js";
9
9
  export async function generatePiHome(options) {
10
10
  const config = loadConfig();
11
11
  const creds = await loadStoredCredential();
@@ -0,0 +1,6 @@
1
+ export const AGENT_REGISTRY = {
2
+ claude: { npmPackage: "@anthropic-ai/claude-code", binName: "claude" },
3
+ codex: { npmPackage: "@openai/codex", binName: "codex" },
4
+ pi: { npmPackage: "@earendil-works/pi-coding-agent", binName: "pi" },
5
+ copilot: { npmPackage: "@github/copilot", binName: "copilot" },
6
+ };
@@ -624,12 +624,7 @@ async function handleDebug(res, input) {
624
624
  user = {
625
625
  login: summary.login,
626
626
  id: summary.id,
627
- name: summary.name,
628
- email: summary.email,
629
- type: summary.type,
630
- avatar_url: summary.avatar_url,
631
- html_url: summary.html_url,
632
- plan_name: summary.plan_name
627
+ type: summary.type
633
628
  };
634
629
  }
635
630
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copillm",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local Copilot proxy CLI (OpenAI/Anthropic-compatible)",
5
5
  "license": "MIT",
6
6
  "type": "module",
File without changes