@lunaroute/cli 0.14.5 → 0.14.6
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 +2 -2
- package/dist/index.js +53 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Prefer a script? `setup pi --extension` / `--models` pick a flow, `--yes` accept
|
|
|
27
27
|
## What it enables
|
|
28
28
|
|
|
29
29
|
- **One-command setup** — `lunaroute setup` writes the right config for `pi`, `claude-code`, `codex`, `opencode`, `copilot-cli`, or `generic` (any OpenAI-compatible base URL swap).
|
|
30
|
-
- **Session launches** — `lunaroute run claude` or `lunaroute run codex` starts a session wired to LunaRoute; `--model` picks from the catalog, everything after `--` passes through to the harness. `lunaroute run agy` does the same for Antigravity CLI (Gemini CLI's successor) through its gateway env vars — agy reads the model list from LunaRoute's own catalog, so any catalog model is selectable.
|
|
30
|
+
- **Session launches** — `lunaroute run claude` or `lunaroute run codex` starts a session wired to LunaRoute; `--model` picks from the catalog, everything after `--` passes through to the harness. `lunaroute run agy` does the same for Antigravity CLI (Gemini CLI's successor) through its gateway env vars — agy reads the model list from LunaRoute's own catalog, so any catalog model is selectable. `lunaroute run copilot-cli` (alias `copilot`) launches GitHub Copilot CLI through its BYOK env vars: it works without a GitHub login, pins one model, writes no configuration, and still stores session state under `~/.copilot`.
|
|
31
31
|
- **The catalog, in your terminal** — `models`, `pricing`, and `usage` show what's available, what it costs (credits per million tokens), and your wallet balance plus recent ledger entries.
|
|
32
32
|
- **Project memory** — `memory search` and `memory read` query your past agent conversations for the current project. `lunaroute mcp` exposes the same tools as a stdio MCP server, and `skill install` wires the memory skill + MCP into Claude Code.
|
|
33
33
|
|
|
@@ -39,7 +39,7 @@ Prefer a script? `setup pi --extension` / `--models` pick a flow, `--yes` accept
|
|
|
39
39
|
| `lunaroute whoami` | Show the signed-in user and organization |
|
|
40
40
|
| `lunaroute logout` | Remove stored credentials |
|
|
41
41
|
| `lunaroute setup <harness>` | Configure `opencode` \| `pi` \| `openclaw` \| `claude-code` \| `codex` \| `copilot-cli` \| `generic`. pi setup is interactive (asks before writing); `--extension` / `--models` pick a flow, `--yes` accepts prompts, `--print` previews |
|
|
42
|
-
| `lunaroute run <harness>` | Launch `claude` \| `claude-code` \| `codex` \| `zed` \| `agy` on LunaRoute for this session |
|
|
42
|
+
| `lunaroute run <harness>` | Launch `claude` \| `claude-code` \| `codex` \| `zed` \| `agy` \| `copilot-cli` \| `copilot` on LunaRoute for this session |
|
|
43
43
|
| `lunaroute models` | List available LunaRoute models |
|
|
44
44
|
| `lunaroute pricing` | Per-model pricing (credits per million tokens) |
|
|
45
45
|
| `lunaroute usage` | Wallet balance and recent usage |
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.14.
|
|
7
|
+
var version = "0.14.6";
|
|
8
8
|
|
|
9
9
|
// src/login.ts
|
|
10
10
|
import { createServer } from "http";
|
|
@@ -3762,22 +3762,67 @@ function buildRunSpec4(ctx, deps = {}) {
|
|
|
3762
3762
|
};
|
|
3763
3763
|
}
|
|
3764
3764
|
|
|
3765
|
+
// src/run/adapters/copilotCli.ts
|
|
3766
|
+
import { randomUUID } from "crypto";
|
|
3767
|
+
import { tmpdir } from "os";
|
|
3768
|
+
import { join as join8 } from "path";
|
|
3769
|
+
var PROVIDERS_CONFIG = join8(
|
|
3770
|
+
tmpdir(),
|
|
3771
|
+
`lunaroute-run-copilot-providers-${randomUUID()}.json`
|
|
3772
|
+
);
|
|
3773
|
+
function buildRunSpec5(ctx) {
|
|
3774
|
+
const promptTokens = ctx.contextWindow && ctx.contextWindow > 0 ? ctx.contextWindow : void 0;
|
|
3775
|
+
const outputTokens = ctx.maxOutputTokens && ctx.maxOutputTokens > 0 ? ctx.maxOutputTokens : void 0;
|
|
3776
|
+
return {
|
|
3777
|
+
command: "copilot",
|
|
3778
|
+
args: [],
|
|
3779
|
+
// Credential, model and transport overrides from the user's shell would
|
|
3780
|
+
// outrank the injected session config; drop them so this run is ours.
|
|
3781
|
+
unsetEnv: [
|
|
3782
|
+
"COPILOT_PROVIDER_API_KEY_COMMAND",
|
|
3783
|
+
"COPILOT_PROVIDER_BEARER_TOKEN",
|
|
3784
|
+
"COPILOT_PROVIDER_MODEL_ID",
|
|
3785
|
+
"COPILOT_PROVIDER_WIRE_MODEL",
|
|
3786
|
+
"COPILOT_PROVIDER_MAX_PROMPT_TOKENS",
|
|
3787
|
+
"COPILOT_PROVIDER_MAX_OUTPUT_TOKENS",
|
|
3788
|
+
"COPILOT_PROVIDER_HEADERS",
|
|
3789
|
+
"COPILOT_PROVIDER_WIRE_API",
|
|
3790
|
+
"COPILOT_PROVIDER_TRANSPORT",
|
|
3791
|
+
"COPILOT_PROVIDER_AZURE_API_VERSION",
|
|
3792
|
+
"COPILOT_PROVIDER_VISION"
|
|
3793
|
+
],
|
|
3794
|
+
env: {
|
|
3795
|
+
COPILOT_PROVIDER_TYPE: "openai",
|
|
3796
|
+
COPILOT_PROVIDER_BASE_URL: `${ctx.routingUrl}/v1`,
|
|
3797
|
+
COPILOT_PROVIDER_API_KEY: ctx.apiKey,
|
|
3798
|
+
COPILOT_MODEL: ctx.model,
|
|
3799
|
+
COPILOT_PROVIDERS_CONFIG: PROVIDERS_CONFIG,
|
|
3800
|
+
...promptTokens ? { COPILOT_PROVIDER_MAX_PROMPT_TOKENS: String(promptTokens) } : {},
|
|
3801
|
+
...outputTokens ? { COPILOT_PROVIDER_MAX_OUTPUT_TOKENS: String(outputTokens) } : {}
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3765
3806
|
// src/commands/run.ts
|
|
3766
3807
|
var ADAPTERS2 = {
|
|
3767
3808
|
claude: buildRunSpec,
|
|
3768
3809
|
"claude-code": buildRunSpec,
|
|
3769
3810
|
codex: buildRunSpec2,
|
|
3770
3811
|
zed: buildRunSpec3,
|
|
3771
|
-
agy: buildRunSpec4
|
|
3812
|
+
agy: buildRunSpec4,
|
|
3813
|
+
"copilot-cli": buildRunSpec5,
|
|
3814
|
+
copilot: buildRunSpec5
|
|
3772
3815
|
};
|
|
3773
3816
|
var MODEL_LOOKUP_TIMEOUT_MS = 3e3;
|
|
3774
|
-
var WANTS_MODEL_ROW = /* @__PURE__ */ new Set(["codex", "claude", "claude-code"]);
|
|
3817
|
+
var WANTS_MODEL_ROW = /* @__PURE__ */ new Set(["codex", "claude", "claude-code", "copilot-cli", "copilot"]);
|
|
3775
3818
|
var INSTALL_HINT = {
|
|
3776
3819
|
claude: "Install Claude Code: https://docs.anthropic.com/claude-code/install",
|
|
3777
3820
|
"claude-code": "Install Claude Code: https://docs.anthropic.com/claude-code/install",
|
|
3778
3821
|
codex: "Install Codex: https://github.com/openai/codex#install",
|
|
3779
3822
|
zed: "Install Zed: https://zed.dev/download (Windows: winget install -e --id ZedIndustries.Zed)",
|
|
3780
|
-
agy: "Install Antigravity CLI: curl -fsSL https://antigravity.google/cli/install.sh | bash (Windows: https://antigravity.google/cli/install.ps1)"
|
|
3823
|
+
agy: "Install Antigravity CLI: curl -fsSL https://antigravity.google/cli/install.sh | bash (Windows: https://antigravity.google/cli/install.ps1)",
|
|
3824
|
+
"copilot-cli": "Install GitHub Copilot CLI: npm install -g @github/copilot (https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli)",
|
|
3825
|
+
copilot: "Install GitHub Copilot CLI: npm install -g @github/copilot (https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli)"
|
|
3781
3826
|
};
|
|
3782
3827
|
var realDeps = {
|
|
3783
3828
|
spawn: makeRealSpawn(),
|
|
@@ -3833,7 +3878,9 @@ async function runRun(harness, opts, deps = realDeps) {
|
|
|
3833
3878
|
});
|
|
3834
3879
|
if (spec.notice) console.error(spec.notice);
|
|
3835
3880
|
const args = spec.args.concat(opts.passthrough ?? []);
|
|
3836
|
-
const env = { ...process.env
|
|
3881
|
+
const env = { ...process.env };
|
|
3882
|
+
for (const key2 of spec.unsetEnv ?? []) delete env[key2];
|
|
3883
|
+
Object.assign(env, spec.env);
|
|
3837
3884
|
const child = deps.spawn(spec.command, args, env);
|
|
3838
3885
|
return new Promise((resolve) => {
|
|
3839
3886
|
child.on("error", (err) => {
|
|
@@ -3897,7 +3944,7 @@ program.command("setup <harness>").description("Configure a coding harness (open
|
|
|
3897
3944
|
});
|
|
3898
3945
|
if (code !== 0) process.exit(code);
|
|
3899
3946
|
});
|
|
3900
|
-
program.command("run <harness>").description("Launch a coding harness (claude | claude-code | codex | zed | agy) configured to use LunaRoute for this session.").option("--model <id>", "model id to launch on (default: first model in the catalog)").argument("[extra...]").action(async (harness, extra, opts) => {
|
|
3947
|
+
program.command("run <harness>").description("Launch a coding harness (claude | claude-code | codex | zed | agy | copilot-cli | copilot) configured to use LunaRoute for this session.").option("--model <id>", "model id to launch on (default: first model in the catalog)").argument("[extra...]").action(async (harness, extra, opts) => {
|
|
3901
3948
|
const sep = process.argv.indexOf("--");
|
|
3902
3949
|
const post = sep !== -1 ? process.argv.slice(sep + 1) : [];
|
|
3903
3950
|
const before = post.length <= extra.length ? extra.slice(0, extra.length - post.length) : extra;
|