@kesarcloud/omega-plus-cli 2.0.0 → 2.0.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.
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/config-writers.mjs +7 -5
- package/src/constants.mjs +1 -1
- package/src/detector.mjs +2 -2
- package/src/key-validator.mjs +34 -4
- package/src/wizard.mjs +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Interactive setup wizard for connecting local coding tools to Omega Plus.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx @kesarcloud/omega-plus-cli
|
|
6
|
+
npx -y @kesarcloud/omega-plus-cli
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
The wizard shows the Omega Plus banner, validates your Omega API key, lets you choose a supported coding tool, backs up existing config files, and writes Omega Plus settings.
|
|
@@ -20,8 +20,8 @@ The wizard shows the Omega Plus banner, validates your Omega API key, lets you c
|
|
|
20
20
|
## Non-Interactive Usage
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx @kesarcloud/omega-plus-cli configure --tool claude --api-key YOUR_KEY
|
|
24
|
-
npx @kesarcloud/omega-plus-cli configure --tool codex --api-key YOUR_KEY --dry-run
|
|
23
|
+
npx -y @kesarcloud/omega-plus-cli configure --tool claude --api-key YOUR_KEY
|
|
24
|
+
npx -y @kesarcloud/omega-plus-cli configure --tool codex --api-key YOUR_KEY --dry-run
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Defaults:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kesarcloud/omega-plus-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Interactive Omega Plus setup wizard for coding CLI tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"author": "KesarCloud Technologies",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/karanbavari/OmegaCluster",
|
|
34
|
+
"url": "git+https://github.com/karanbavari/OmegaCluster.git",
|
|
35
35
|
"directory": "packages/omega-cli-helper"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
package/src/config-writers.mjs
CHANGED
|
@@ -79,14 +79,15 @@ async function configureCodex(input) {
|
|
|
79
79
|
const parsed = parseToml(await readText(paths.config, ""));
|
|
80
80
|
|
|
81
81
|
parsed._root.model = options.model;
|
|
82
|
-
parsed._root.model_provider = "
|
|
82
|
+
parsed._root.model_provider = "kesarcloud";
|
|
83
83
|
delete parsed._root.openai_base_url;
|
|
84
|
-
parsed._sections["model_providers.
|
|
85
|
-
name: "
|
|
84
|
+
parsed._sections["model_providers.kesarcloud"] = {
|
|
85
|
+
name: "Kesarcloud",
|
|
86
86
|
base_url: normalizeCodexBaseUrl(options.openaiBaseUrl),
|
|
87
87
|
wire_api: "chat",
|
|
88
88
|
env_key: "OPENAI_API_KEY",
|
|
89
89
|
};
|
|
90
|
+
delete parsed._sections["model_providers.omega"];
|
|
90
91
|
delete parsed._sections["model_providers.omniroute"];
|
|
91
92
|
|
|
92
93
|
const configWrite = await writeTextFile(paths.config, stringifyToml(parsed), options);
|
|
@@ -110,7 +111,7 @@ function buildOpenCodeProvider(options) {
|
|
|
110
111
|
|
|
111
112
|
return {
|
|
112
113
|
npm: "@ai-sdk/anthropic",
|
|
113
|
-
name: "
|
|
114
|
+
name: "Kesarcloud",
|
|
114
115
|
options: {
|
|
115
116
|
baseURL: options.anthropicBaseUrl,
|
|
116
117
|
apiKey: options.apiKey,
|
|
@@ -134,9 +135,10 @@ async function configureOpenCode(input) {
|
|
|
134
135
|
$schema: current.$schema || "https://opencode.ai/config.json",
|
|
135
136
|
provider: {
|
|
136
137
|
...provider,
|
|
137
|
-
|
|
138
|
+
kesarcloud: buildOpenCodeProvider(options),
|
|
138
139
|
},
|
|
139
140
|
};
|
|
141
|
+
if (nextConfig.provider.omega) delete nextConfig.provider.omega;
|
|
140
142
|
if (nextConfig.provider.omniroute) delete nextConfig.provider.omniroute;
|
|
141
143
|
|
|
142
144
|
const write = await writeJsonFile(paths.config, nextConfig, options);
|
package/src/constants.mjs
CHANGED
package/src/detector.mjs
CHANGED
|
@@ -55,13 +55,13 @@ async function configStatus(toolId, options = {}) {
|
|
|
55
55
|
if (toolId === "codex") {
|
|
56
56
|
const config = await readText(paths.config, "");
|
|
57
57
|
const auth = await readJson(paths.auth, {});
|
|
58
|
-
return config.includes("[model_providers.
|
|
58
|
+
return config.includes("[model_providers.kesarcloud]") && auth.OPENAI_API_KEY
|
|
59
59
|
? "configured"
|
|
60
60
|
: "not_configured";
|
|
61
61
|
}
|
|
62
62
|
if (toolId === "opencode") {
|
|
63
63
|
const config = await readJson(paths.config, null);
|
|
64
|
-
return config?.provider?.
|
|
64
|
+
return config?.provider?.kesarcloud?.options?.apiKey ? "configured" : "not_configured";
|
|
65
65
|
}
|
|
66
66
|
if (toolId === "cline") {
|
|
67
67
|
const state = await readJson(paths.globalState, null);
|
package/src/key-validator.mjs
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { DEFAULT_VALIDATION_URL } from "./constants.mjs";
|
|
2
2
|
|
|
3
3
|
export class ApiKeyValidationError extends Error {
|
|
4
|
-
constructor(message, status = "invalid") {
|
|
4
|
+
constructor(message, status = "invalid", details = {}) {
|
|
5
5
|
super(message);
|
|
6
6
|
this.name = "ApiKeyValidationError";
|
|
7
7
|
this.status = status;
|
|
8
|
+
this.details = details;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
function getKeyPrefix(apiKey) {
|
|
13
|
+
return String(apiKey || "").slice(0, 10);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function buildValidationErrorMessage({ message, status, httpStatus, url, apiKey }) {
|
|
17
|
+
const parts = [message];
|
|
18
|
+
const prefix = getKeyPrefix(apiKey);
|
|
19
|
+
if (prefix) parts.push(`key prefix: ${prefix}`);
|
|
20
|
+
if (status) parts.push(`server status: ${status}`);
|
|
21
|
+
if (httpStatus) parts.push(`HTTP ${httpStatus}`);
|
|
22
|
+
if (url) parts.push(`validation URL: ${url}`);
|
|
23
|
+
return parts.join(" | ");
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
export function resolveValidationUrl(options = {}) {
|
|
12
27
|
if (options.validationUrl) return String(options.validationUrl).trim();
|
|
13
28
|
const base = String(options.baseUrl || "")
|
|
@@ -45,8 +60,9 @@ export async function validateApiKey(apiKey, options = {}) {
|
|
|
45
60
|
} catch (error) {
|
|
46
61
|
const message = error instanceof Error ? error.message : String(error);
|
|
47
62
|
throw new ApiKeyValidationError(
|
|
48
|
-
`Could not reach Omega validation server: ${message}`,
|
|
49
|
-
"unreachable"
|
|
63
|
+
`Could not reach Omega validation server at ${url}: ${message}`,
|
|
64
|
+
"unreachable",
|
|
65
|
+
{ validationUrl: url }
|
|
50
66
|
);
|
|
51
67
|
}
|
|
52
68
|
|
|
@@ -68,5 +84,19 @@ export async function validateApiKey(apiKey, options = {}) {
|
|
|
68
84
|
: status === "expired"
|
|
69
85
|
? "API key expired"
|
|
70
86
|
: "Invalid API key";
|
|
71
|
-
throw new ApiKeyValidationError(
|
|
87
|
+
throw new ApiKeyValidationError(
|
|
88
|
+
buildValidationErrorMessage({
|
|
89
|
+
message,
|
|
90
|
+
status,
|
|
91
|
+
httpStatus: response.status,
|
|
92
|
+
url,
|
|
93
|
+
apiKey: trimmed,
|
|
94
|
+
}),
|
|
95
|
+
status,
|
|
96
|
+
{
|
|
97
|
+
validationUrl: url,
|
|
98
|
+
httpStatus: response.status,
|
|
99
|
+
keyPrefix: getKeyPrefix(trimmed),
|
|
100
|
+
}
|
|
101
|
+
);
|
|
72
102
|
}
|
package/src/wizard.mjs
CHANGED
|
@@ -80,7 +80,7 @@ export async function runWizard(options = {}) {
|
|
|
80
80
|
|
|
81
81
|
const installedTool = await maybeInstallTool(toolId, options, rl);
|
|
82
82
|
if (!installedTool?.installed && !options.dryRun) {
|
|
83
|
-
console.log(`\nInstall ${installedTool.name} first, then rerun: npx @kesarcloud/omega-plus-cli`);
|
|
83
|
+
console.log(`\nInstall ${installedTool.name} first, then rerun: npx -y @kesarcloud/omega-plus-cli`);
|
|
84
84
|
return { toolId, skipped: true, reason: "not_installed" };
|
|
85
85
|
}
|
|
86
86
|
|