mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-18 21:22:28 +03:00
- canonical executable manifest (bin/cli/cli-manifest.mjs): run/configure/completion derive targets, aliases and --model wiring from one table; drift test cross-checks manifest x cliRuntime x UI catalog (tests/unit/cli/cli-manifest-drift.test.ts) - dashboard Codex generator converged to ~/.codex/config.toml (modern Codex v0.137+, verified against codex-cli 0.147.0): conservative merge, env_key auth (key never written), refuses invalid TOML, reports legacy config.yaml as migration note - omniroute run gemini: launcher over OmniRoute's /v1beta surface via GOOGLE_GEMINI_BASE_URL + isolated GEMINI_CLI_HOME forcing gemini-api-key auth (contract proven against @google/gemini-cli 0.50.0); ACP registration kept distinct - opt-in real smoke harness for upstream CLIs (RUN_CLI_SMOKE=1, credential by env NAME, redacted output): tests/integration/upstream-cli-smoke.int.test.ts - container-guard homologation for POST /api/cli-tools/apply (422 in container, dry-run preview allowed, host write passes) + docs; guard untouched - typecheck: omniglyphAdapter union narrowing, usageTracking typed signatures (UsageLike, no any), models.ts isValidModel params — typecheck:core and typecheck:noimplicit:core now clean - relay core (prior session of this effort): omniroute run for 6 CLIs, configure picker with per-context favorites/recents, contexts with optional keychain + 0600 fallback, provider CRUD with recursive redaction, completion updates, docs
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const {
|
|
listConfigureTargets,
|
|
profileNameFromModel,
|
|
resolveConfigureTargetOptions,
|
|
rankPreferredModels,
|
|
getModelPreferenceState,
|
|
} = await import("../../../bin/cli/commands/configure.mjs");
|
|
|
|
test("configure picker exposes setup-backed CLI targets (manifest declaration order)", () => {
|
|
assert.deepEqual(listConfigureTargets(), [
|
|
"claude",
|
|
"codex",
|
|
"aider",
|
|
"goose",
|
|
"opencode",
|
|
"qwen",
|
|
"cline",
|
|
"continue",
|
|
"kilo",
|
|
]);
|
|
});
|
|
|
|
test("configure picker derives stable profile names from provider/model ids", () => {
|
|
assert.equal(profileNameFromModel("glm/glm-5.2"), "glm52");
|
|
assert.equal(profileNameFromModel("claude-sonnet-4.6"), "claudesonnet46");
|
|
});
|
|
|
|
test("configure picker materializes explicit remote/base-url targets", () => {
|
|
assert.deepEqual(
|
|
resolveConfigureTargetOptions({
|
|
baseUrl: "https://relay.example.test/v1",
|
|
apiKey: "sk_test",
|
|
port: "2999",
|
|
}),
|
|
{
|
|
baseUrl: "https://relay.example.test/v1",
|
|
remote: "https://relay.example.test/v1",
|
|
apiKey: "sk_test",
|
|
port: "2999",
|
|
}
|
|
);
|
|
});
|
|
|
|
test("configure picker ranks favorites and recent model ids without leaking context data", () => {
|
|
const ranked = rankPreferredModels("codex", ["glm/slow", "glm/fast", "qwen/recent"], {
|
|
targets: { codex: { favorites: ["glm/fast"], recent: ["qwen/recent"] } },
|
|
});
|
|
assert.deepEqual(ranked, ["glm/fast", "qwen/recent", "glm/slow"]);
|
|
assert.deepEqual(
|
|
getModelPreferenceState("codex", {
|
|
targets: { codex: { favorites: ["glm/fast"], recent: ["qwen/recent"] } },
|
|
}),
|
|
{ favorites: ["glm/fast"], recent: ["qwen/recent"] }
|
|
);
|
|
});
|
|
|
|
test("configure picker keeps preferences isolated per remote context", () => {
|
|
const preferences = {
|
|
targets: {},
|
|
contexts: {
|
|
local: { codex: { favorites: ["local/model"], recent: [] } },
|
|
remote: { codex: { favorites: ["remote/model"], recent: [] } },
|
|
},
|
|
};
|
|
assert.deepEqual(
|
|
rankPreferredModels("codex", ["local/model", "remote/model"], preferences, "remote"),
|
|
["remote/model", "local/model"]
|
|
);
|
|
assert.deepEqual(getModelPreferenceState("codex", preferences, "local"), {
|
|
favorites: ["local/model"],
|
|
recent: [],
|
|
});
|
|
});
|