@kesarcloud/omega-plus-cli 2.0.0 → 2.0.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 +3 -3
- package/package.json +1 -1
- package/src/constants.mjs +1 -1
- 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
package/src/constants.mjs
CHANGED
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
|
|