@useorgx/wizard 0.1.3 → 0.1.5
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/dist/cli.js +148 -252
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -667,6 +667,7 @@ async function startBrowserPairing(options, fetchImpl) {
|
|
|
667
667
|
method: "POST",
|
|
668
668
|
body: JSON.stringify({
|
|
669
669
|
installationId: options.installationId,
|
|
670
|
+
clientType: "orgx-wizard",
|
|
670
671
|
...options.deviceName ? { deviceName: options.deviceName } : {},
|
|
671
672
|
...options.platform ? { platform: options.platform } : {}
|
|
672
673
|
}),
|
|
@@ -3070,53 +3071,54 @@ function createOrgxSpinner(text2) {
|
|
|
3070
3071
|
}
|
|
3071
3072
|
|
|
3072
3073
|
// src/cli.ts
|
|
3074
|
+
var ICON = {
|
|
3075
|
+
ok: pc3.green("\u2713"),
|
|
3076
|
+
err: pc3.red("\u2717"),
|
|
3077
|
+
warn: pc3.yellow("!"),
|
|
3078
|
+
skip: pc3.dim("\xB7")
|
|
3079
|
+
};
|
|
3080
|
+
function getCmd() {
|
|
3081
|
+
const argv1 = process.argv[1] ?? "";
|
|
3082
|
+
return argv1.includes("_npx") || argv1.includes("/.npm/") || argv1.includes("/npm/_npx") ? "npx @useorgx/wizard" : "orgx-wizard";
|
|
3083
|
+
}
|
|
3073
3084
|
function formatAuthSource(source) {
|
|
3074
3085
|
switch (source) {
|
|
3075
3086
|
case "environment":
|
|
3076
|
-
return "ORGX_API_KEY";
|
|
3087
|
+
return "env ORGX_API_KEY";
|
|
3077
3088
|
case "wizard-store":
|
|
3078
3089
|
return "wizard auth store";
|
|
3079
3090
|
case "openclaw-config-file":
|
|
3080
|
-
return "
|
|
3091
|
+
return "openclaw config";
|
|
3081
3092
|
default:
|
|
3082
3093
|
return "not configured";
|
|
3083
3094
|
}
|
|
3084
3095
|
}
|
|
3085
3096
|
function printSurfaceTable(statuses) {
|
|
3086
3097
|
for (const status of statuses) {
|
|
3087
|
-
const
|
|
3088
|
-
const
|
|
3089
|
-
|
|
3090
|
-
console.log(` ${status.
|
|
3091
|
-
if (status.path) {
|
|
3092
|
-
console.log(` path: ${status.path}`);
|
|
3093
|
-
}
|
|
3094
|
-
for (const detail of status.details) {
|
|
3095
|
-
console.log(` - ${detail}`);
|
|
3096
|
-
}
|
|
3098
|
+
const icon = status.configured ? ICON.ok : status.detected ? ICON.warn : ICON.skip;
|
|
3099
|
+
const state = status.configured ? pc3.green("configured") : status.detected ? pc3.yellow("detected") : pc3.dim("not found");
|
|
3100
|
+
const mode = pc3.dim(status.mode === "automated" ? "auto " : "manual");
|
|
3101
|
+
console.log(` ${icon} ${pc3.bold(status.name.padEnd(10))} ${mode} ${state}`);
|
|
3097
3102
|
}
|
|
3098
3103
|
}
|
|
3099
3104
|
function printMutationResults(results) {
|
|
3100
3105
|
for (const result of summarizeMutationResults(results)) {
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3106
|
+
const icon = result.state === "updated" ? ICON.ok : ICON.skip;
|
|
3107
|
+
const state = result.state === "updated" ? pc3.green("updated ") : pc3.dim("unchanged");
|
|
3108
|
+
console.log(` ${icon} ${pc3.bold(result.name.padEnd(10))} ${state} ${pc3.dim(result.message)}`);
|
|
3103
3109
|
}
|
|
3104
3110
|
}
|
|
3105
3111
|
function printSkillInstallReport(report) {
|
|
3106
3112
|
for (const write of report.writes) {
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3113
|
+
const icon = write.changed ? ICON.ok : ICON.skip;
|
|
3114
|
+
const state = write.changed ? pc3.green("updated ") : pc3.dim("unchanged");
|
|
3115
|
+
console.log(` ${icon} ${pc3.bold(write.label.padEnd(10))} ${state}`);
|
|
3109
3116
|
}
|
|
3110
3117
|
for (const pack of report.packs) {
|
|
3111
|
-
const changedCount = pack.files.filter((
|
|
3112
|
-
const
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
);
|
|
3116
|
-
for (const file of pack.files) {
|
|
3117
|
-
const state = file.changed ? "updated" : "unchanged";
|
|
3118
|
-
console.log(` - ${state} ${file.path}`);
|
|
3119
|
-
}
|
|
3118
|
+
const changedCount = pack.files.filter((f) => f.changed).length;
|
|
3119
|
+
const icon = changedCount > 0 ? ICON.ok : ICON.skip;
|
|
3120
|
+
const state = changedCount > 0 ? pc3.green(`${changedCount} updated `) : pc3.dim("unchanged");
|
|
3121
|
+
console.log(` ${icon} ${pc3.bold(pack.name.padEnd(10))} ${state} ${pc3.dim(`${pack.files.length} files`)}`);
|
|
3120
3122
|
}
|
|
3121
3123
|
}
|
|
3122
3124
|
function printWorkspace(workspace) {
|
|
@@ -3144,15 +3146,11 @@ function printWorkspaceList(workspaces) {
|
|
|
3144
3146
|
}
|
|
3145
3147
|
}
|
|
3146
3148
|
function printWorkspaceSetupResult(result) {
|
|
3147
|
-
console.log(pc3.bold("workspace bootstrap"));
|
|
3148
|
-
const statusLabel = result.status === "updated" ? pc3.green("updated") : result.status === "unchanged" ? pc3.yellow("unchanged") : pc3.dim(result.status);
|
|
3149
|
-
console.log(` ${statusLabel} ${result.message}`);
|
|
3150
3149
|
if (result.workspace) {
|
|
3151
|
-
|
|
3152
|
-
console.log(`
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
}
|
|
3150
|
+
const icon = result.status === "updated" ? ICON.ok : ICON.skip;
|
|
3151
|
+
console.log(` ${icon} ${pc3.green("workspace ")} ${pc3.bold(result.workspace.name)}`);
|
|
3152
|
+
} else {
|
|
3153
|
+
console.log(` ${ICON.skip} ${pc3.dim(result.message)}`);
|
|
3156
3154
|
}
|
|
3157
3155
|
}
|
|
3158
3156
|
function printFounderPresetResult(result) {
|
|
@@ -3221,81 +3219,6 @@ async function syncContinuityAfterAuth(seed = {}) {
|
|
|
3221
3219
|
} catch {
|
|
3222
3220
|
}
|
|
3223
3221
|
}
|
|
3224
|
-
function printOpenClawHealth(check) {
|
|
3225
|
-
console.log(pc3.bold("openclaw runtime"));
|
|
3226
|
-
if (check.skipped) {
|
|
3227
|
-
console.log(` ${pc3.yellow(check.error ?? "Gateway health check skipped.")}`);
|
|
3228
|
-
} else if (check.ok) {
|
|
3229
|
-
const via = check.method === "cli" ? "CLI" : "HTTP";
|
|
3230
|
-
console.log(` ${pc3.green(`healthy via ${via}`)}`);
|
|
3231
|
-
} else {
|
|
3232
|
-
const via = check.method === "none" ? "unavailable" : check.method.toUpperCase();
|
|
3233
|
-
console.log(` ${pc3.red(`unhealthy via ${via}`)} ${check.error ?? "unknown error"}`);
|
|
3234
|
-
}
|
|
3235
|
-
if (check.url) {
|
|
3236
|
-
console.log(` url: ${check.url}`);
|
|
3237
|
-
}
|
|
3238
|
-
for (const detail of check.details) {
|
|
3239
|
-
console.log(` - ${detail}`);
|
|
3240
|
-
}
|
|
3241
|
-
}
|
|
3242
|
-
function printHostedMcpHealth(check) {
|
|
3243
|
-
console.log(pc3.bold("hosted mcp"));
|
|
3244
|
-
if (check.skipped) {
|
|
3245
|
-
console.log(` ${pc3.yellow(check.error ?? "Hosted MCP health check skipped.")}`);
|
|
3246
|
-
} else if (check.ok) {
|
|
3247
|
-
console.log(` ${pc3.green("reachable")}`);
|
|
3248
|
-
} else {
|
|
3249
|
-
console.log(` ${pc3.red("unreachable")} ${check.error ?? "unknown error"}`);
|
|
3250
|
-
}
|
|
3251
|
-
console.log(` url: ${check.url}`);
|
|
3252
|
-
for (const detail of check.details) {
|
|
3253
|
-
console.log(` - ${detail}`);
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
function printHostedMcpToolCheck(check) {
|
|
3257
|
-
console.log(pc3.bold("hosted mcp tool call"));
|
|
3258
|
-
if (check.skipped) {
|
|
3259
|
-
console.log(` ${pc3.yellow(check.error ?? "Hosted MCP tool verification skipped.")}`);
|
|
3260
|
-
} else if (check.ok) {
|
|
3261
|
-
console.log(` ${pc3.green("authenticated tool call ok")}`);
|
|
3262
|
-
} else {
|
|
3263
|
-
console.log(` ${pc3.red("authenticated tool call failed")} ${check.error ?? "unknown error"}`);
|
|
3264
|
-
}
|
|
3265
|
-
console.log(` tool: ${check.toolName}`);
|
|
3266
|
-
console.log(` url: ${check.url}`);
|
|
3267
|
-
if (check.source !== "none") {
|
|
3268
|
-
console.log(` auth source: ${formatAuthSource(check.source)}`);
|
|
3269
|
-
}
|
|
3270
|
-
if (check.baseUrl) {
|
|
3271
|
-
console.log(` base url: ${check.baseUrl}`);
|
|
3272
|
-
}
|
|
3273
|
-
if (check.initializeStatus !== void 0) {
|
|
3274
|
-
console.log(` initialize status: ${check.initializeStatus}`);
|
|
3275
|
-
}
|
|
3276
|
-
if (check.callStatus !== void 0) {
|
|
3277
|
-
console.log(` tool call status: ${check.callStatus}`);
|
|
3278
|
-
}
|
|
3279
|
-
for (const detail of check.details) {
|
|
3280
|
-
console.log(` - ${detail}`);
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
function printNpmRegistryHealth(check) {
|
|
3284
|
-
console.log(pc3.bold("npm registry"));
|
|
3285
|
-
if (!check.reachable) {
|
|
3286
|
-
console.log(` ${pc3.red("unreachable")} ${check.error ?? "unknown error"}`);
|
|
3287
|
-
} else if (check.published) {
|
|
3288
|
-
console.log(
|
|
3289
|
-
` ${pc3.green("reachable")} ${check.packageName}${check.version ? `@${check.version}` : ""}`
|
|
3290
|
-
);
|
|
3291
|
-
} else {
|
|
3292
|
-
console.log(` ${pc3.yellow("reachable")} ${check.error ?? `${check.packageName} is not published yet.`}`);
|
|
3293
|
-
}
|
|
3294
|
-
console.log(` url: ${check.url}`);
|
|
3295
|
-
for (const detail of check.details) {
|
|
3296
|
-
console.log(` - ${detail}`);
|
|
3297
|
-
}
|
|
3298
|
-
}
|
|
3299
3222
|
function parseTimeoutSeconds(value) {
|
|
3300
3223
|
const parsed = Number(value);
|
|
3301
3224
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
@@ -3303,67 +3226,77 @@ function parseTimeoutSeconds(value) {
|
|
|
3303
3226
|
}
|
|
3304
3227
|
return parsed;
|
|
3305
3228
|
}
|
|
3306
|
-
function describeBrowserPairingFailure(error) {
|
|
3307
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3308
|
-
return `${message} Use \`wizard auth login --api-key <oxk_...>\` or \`wizard auth set-key <oxk_...>\` to fall back to a manual key.`;
|
|
3309
|
-
}
|
|
3310
3229
|
function printAuthStatus(status) {
|
|
3311
|
-
console.log(pc3.bold("orgx auth"));
|
|
3312
3230
|
if (!status.configured) {
|
|
3313
|
-
console.log(` ${pc3.yellow(
|
|
3231
|
+
console.log(` ${ICON.warn} ${pc3.yellow("no account")} run ${pc3.cyan(`${getCmd()} auth login`)} to connect`);
|
|
3314
3232
|
return;
|
|
3315
3233
|
}
|
|
3316
|
-
const
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
);
|
|
3320
|
-
if (status.baseUrl) {
|
|
3321
|
-
console.log(` base url: ${status.baseUrl}`);
|
|
3322
|
-
}
|
|
3323
|
-
if (status.path) {
|
|
3324
|
-
console.log(` path: ${status.path}`);
|
|
3325
|
-
}
|
|
3326
|
-
if (status.verifiedAt) {
|
|
3327
|
-
console.log(` verified at: ${status.verifiedAt}`);
|
|
3328
|
-
}
|
|
3234
|
+
const icon = status.ok ? ICON.ok : ICON.err;
|
|
3235
|
+
const state = status.ok ? pc3.green("verified ") : status.skipped ? pc3.yellow("skipped ") : pc3.red("invalid ");
|
|
3236
|
+
const via = pc3.dim(formatAuthSource(status.source));
|
|
3237
|
+
console.log(` ${icon} ${state} ${pc3.bold(status.keyPrefix ?? "unknown")} ${via}`);
|
|
3329
3238
|
if (!status.ok && status.error) {
|
|
3330
|
-
console.log(`
|
|
3239
|
+
console.log(` ${pc3.red(status.error)}`);
|
|
3331
3240
|
}
|
|
3332
3241
|
}
|
|
3333
|
-
function
|
|
3334
|
-
console.log(pc3.
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3242
|
+
function printDoctorReport(report, assessment) {
|
|
3243
|
+
console.log(pc3.dim(" surfaces"));
|
|
3244
|
+
printSurfaceTable(report.surfaces);
|
|
3245
|
+
console.log("");
|
|
3246
|
+
console.log(pc3.dim(" account"));
|
|
3247
|
+
printAuthStatus(report.auth);
|
|
3248
|
+
console.log("");
|
|
3249
|
+
console.log(pc3.dim(" services"));
|
|
3250
|
+
const mcp = report.hostedMcp;
|
|
3251
|
+
{
|
|
3252
|
+
const icon = mcp.skipped ? ICON.skip : mcp.ok ? ICON.ok : ICON.err;
|
|
3253
|
+
const label = pc3.dim("cloud mcp ".padEnd(14));
|
|
3254
|
+
const state = mcp.skipped ? pc3.dim("skipped") : mcp.ok ? pc3.green("reachable") : pc3.red("unreachable");
|
|
3255
|
+
const tail = !mcp.ok && !mcp.skipped && mcp.error ? ` ${pc3.dim(mcp.error)}` : "";
|
|
3256
|
+
console.log(` ${icon} ${label} ${state}${tail}`);
|
|
3257
|
+
}
|
|
3258
|
+
const tool = report.hostedMcpTool;
|
|
3259
|
+
{
|
|
3260
|
+
const icon = tool.skipped ? ICON.skip : tool.ok ? ICON.ok : ICON.err;
|
|
3261
|
+
const label = pc3.dim("tool call ".padEnd(14));
|
|
3262
|
+
const state = tool.skipped ? pc3.dim("skipped") : tool.ok ? pc3.green("authenticated") : pc3.red("failed");
|
|
3263
|
+
const tail = !tool.ok && !tool.skipped && tool.error ? ` ${pc3.dim(tool.error)}` : "";
|
|
3264
|
+
console.log(` ${icon} ${label} ${state}${tail}`);
|
|
3265
|
+
}
|
|
3266
|
+
const ws = report.workspace;
|
|
3267
|
+
{
|
|
3268
|
+
const icon = !ws.configured ? ICON.skip : ws.ok ? ICON.ok : ICON.err;
|
|
3269
|
+
const label = pc3.dim("workspace ".padEnd(14));
|
|
3270
|
+
const state = !ws.configured ? pc3.dim("not configured") : ws.ok && ws.workspace ? pc3.green(ws.workspace.name) : pc3.red(`unreachable${ws.error ? `: ${ws.error}` : ""}`);
|
|
3271
|
+
console.log(` ${icon} ${label} ${state}`);
|
|
3272
|
+
}
|
|
3273
|
+
const openclaw = report.openclaw;
|
|
3274
|
+
{
|
|
3275
|
+
const icon = openclaw.skipped ? ICON.skip : openclaw.ok ? ICON.ok : ICON.err;
|
|
3276
|
+
const label = pc3.dim("openclaw ".padEnd(14));
|
|
3277
|
+
const state = openclaw.skipped ? pc3.dim("not installed") : openclaw.ok ? pc3.green(`healthy${openclaw.method && openclaw.method !== "none" ? ` (${openclaw.method})` : ""}`) : pc3.red(`unhealthy${openclaw.error ? `: ${openclaw.error}` : ""}`);
|
|
3278
|
+
console.log(` ${icon} ${label} ${state}`);
|
|
3338
3279
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
console.log(` ${pc3.green("
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3280
|
+
console.log("");
|
|
3281
|
+
const configuredCount = report.surfaces.filter((s) => s.configured).length;
|
|
3282
|
+
if (assessment.issues.length === 0) {
|
|
3283
|
+
console.log(` ${ICON.ok} ${pc3.green("All systems ready.")}`);
|
|
3284
|
+
if (!report.auth.configured) {
|
|
3285
|
+
console.log(`
|
|
3286
|
+
${pc3.dim("\u2192")} ${pc3.cyan(`${getCmd()} auth login`)} ${pc3.dim("to connect your account")}`);
|
|
3287
|
+
} else {
|
|
3288
|
+
console.log(` ${pc3.dim("\u2192")} ${pc3.dim(`OrgX is active across ${configuredCount} editor${configuredCount !== 1 ? "s" : ""}`)}`);
|
|
3289
|
+
}
|
|
3290
|
+
} else {
|
|
3291
|
+
const hasError = assessment.issues.some((i) => i.level === "error");
|
|
3292
|
+
const headline = hasError ? `${ICON.err} ${pc3.red("Issues detected")}` : `${ICON.warn} ${pc3.yellow("Warnings detected")}`;
|
|
3293
|
+
console.log(` ${headline}`);
|
|
3294
|
+
for (const issue of assessment.issues) {
|
|
3295
|
+
const label = issue.level === "error" ? pc3.red("error") : pc3.yellow("warn ");
|
|
3296
|
+
console.log(`
|
|
3297
|
+
${label} ${issue.title}`);
|
|
3298
|
+
console.log(` ${pc3.dim("\u2192")} ${issue.suggestion}`);
|
|
3346
3299
|
}
|
|
3347
|
-
}
|
|
3348
|
-
if (check.baseUrl) {
|
|
3349
|
-
console.log(` base url: ${check.baseUrl}`);
|
|
3350
|
-
}
|
|
3351
|
-
for (const detail of check.details) {
|
|
3352
|
-
console.log(` - ${detail}`);
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
function printDoctorAssessment(report) {
|
|
3356
|
-
console.log(pc3.bold("doctor summary"));
|
|
3357
|
-
if (report.issues.length === 0) {
|
|
3358
|
-
console.log(` ${pc3.green("ready")} No blocking issues detected.`);
|
|
3359
|
-
return;
|
|
3360
|
-
}
|
|
3361
|
-
const headline = report.ok ? pc3.yellow("warnings only") : pc3.red("blocking issues detected");
|
|
3362
|
-
console.log(` ${headline}`);
|
|
3363
|
-
for (const issue of report.issues) {
|
|
3364
|
-
const label = issue.level === "error" ? pc3.red("error") : pc3.yellow("warning");
|
|
3365
|
-
console.log(` ${label} ${issue.title}`);
|
|
3366
|
-
console.log(` fix: ${issue.suggestion}`);
|
|
3367
3300
|
}
|
|
3368
3301
|
}
|
|
3369
3302
|
async function main() {
|
|
@@ -3402,22 +3335,8 @@ async function main() {
|
|
|
3402
3335
|
printFounderPresetResult(presetResult);
|
|
3403
3336
|
console.log("");
|
|
3404
3337
|
const doctor2 = await runDoctor();
|
|
3405
|
-
printSurfaceTable(doctor2.surfaces);
|
|
3406
|
-
console.log("");
|
|
3407
|
-
printAuthStatus(doctor2.auth);
|
|
3408
|
-
console.log("");
|
|
3409
|
-
printHostedMcpHealth(doctor2.hostedMcp);
|
|
3410
|
-
console.log("");
|
|
3411
|
-
printHostedMcpToolCheck(doctor2.hostedMcpTool);
|
|
3412
|
-
console.log("");
|
|
3413
|
-
printNpmRegistryHealth(doctor2.npmRegistry);
|
|
3414
|
-
console.log("");
|
|
3415
|
-
printWorkspaceConnectivity(doctor2.workspace);
|
|
3416
|
-
console.log("");
|
|
3417
|
-
printOpenClawHealth(doctor2.openclaw);
|
|
3418
|
-
console.log("");
|
|
3419
3338
|
const assessment2 = assessDoctorReport(doctor2);
|
|
3420
|
-
|
|
3339
|
+
printDoctorReport(doctor2, assessment2);
|
|
3421
3340
|
if (!assessment2.ok) {
|
|
3422
3341
|
process.exitCode = 1;
|
|
3423
3342
|
}
|
|
@@ -3437,24 +3356,32 @@ async function main() {
|
|
|
3437
3356
|
message: "Connect your OrgX account to enable workspace and AI tool access",
|
|
3438
3357
|
options: [
|
|
3439
3358
|
{ value: "login", label: "Open browser to connect", hint: "recommended" },
|
|
3440
|
-
{ value: "skip", label: "Skip for now", hint:
|
|
3359
|
+
{ value: "skip", label: "Skip for now", hint: `run \`${getCmd()} auth login\` later` }
|
|
3441
3360
|
]
|
|
3442
3361
|
});
|
|
3443
|
-
if (
|
|
3444
|
-
const loginOk = await runBrowserLogin();
|
|
3445
|
-
if (loginOk) {
|
|
3446
|
-
resolvedAuth = await resolveOrgxAuth();
|
|
3447
|
-
}
|
|
3448
|
-
} else if (clack.isCancel(choice)) {
|
|
3362
|
+
if (clack.isCancel(choice)) {
|
|
3449
3363
|
clack.cancel("Setup cancelled.");
|
|
3450
3364
|
return;
|
|
3365
|
+
}
|
|
3366
|
+
if (choice === "login") {
|
|
3367
|
+
const loginOk = await runBrowserLogin();
|
|
3368
|
+
if (!loginOk) {
|
|
3369
|
+
console.log(`
|
|
3370
|
+
${pc3.dim("\u2192")} ${pc3.cyan(`${getCmd()} auth login`)} ${pc3.dim("to try again")}`);
|
|
3371
|
+
console.log(` ${pc3.dim("\u2192")} ${pc3.cyan(`${getCmd()} auth login --api-key`)} ${pc3.dim("to paste a key directly")}`);
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
resolvedAuth = await resolveOrgxAuth();
|
|
3451
3375
|
} else {
|
|
3452
|
-
console.log(
|
|
3376
|
+
console.log(`
|
|
3377
|
+
${pc3.dim("\u2192")} ${pc3.cyan(`${getCmd()} auth login`)} ${pc3.dim("to connect when ready")}`);
|
|
3378
|
+
return;
|
|
3453
3379
|
}
|
|
3454
3380
|
} else {
|
|
3455
3381
|
console.log(
|
|
3456
|
-
|
|
3382
|
+
` ${ICON.warn} ${pc3.yellow("No account connected.")} Run ${pc3.cyan(`${getCmd()} auth login`)} to connect.`
|
|
3457
3383
|
);
|
|
3384
|
+
return;
|
|
3458
3385
|
}
|
|
3459
3386
|
}
|
|
3460
3387
|
if (resolvedAuth) {
|
|
@@ -3476,32 +3403,24 @@ async function main() {
|
|
|
3476
3403
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
3477
3404
|
}
|
|
3478
3405
|
);
|
|
3479
|
-
if (workspaceSetup.status
|
|
3480
|
-
printWorkspaceSetupResult(workspaceSetup);
|
|
3481
|
-
} else {
|
|
3406
|
+
if (workspaceSetup.status === "cancelled") {
|
|
3482
3407
|
return;
|
|
3483
3408
|
}
|
|
3409
|
+
if (workspaceSetup.workspace) {
|
|
3410
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(workspaceSetup.workspace.name)}`);
|
|
3411
|
+
}
|
|
3484
3412
|
}
|
|
3485
|
-
console.log("");
|
|
3486
3413
|
const doctor = await runDoctor();
|
|
3487
|
-
printSurfaceTable(doctor.surfaces);
|
|
3488
|
-
console.log("");
|
|
3489
|
-
printAuthStatus(doctor.auth);
|
|
3490
|
-
console.log("");
|
|
3491
|
-
printHostedMcpHealth(doctor.hostedMcp);
|
|
3492
|
-
console.log("");
|
|
3493
|
-
printHostedMcpToolCheck(doctor.hostedMcpTool);
|
|
3494
|
-
console.log("");
|
|
3495
|
-
printNpmRegistryHealth(doctor.npmRegistry);
|
|
3496
|
-
console.log("");
|
|
3497
|
-
printWorkspaceConnectivity(doctor.workspace);
|
|
3498
|
-
console.log("");
|
|
3499
|
-
printOpenClawHealth(doctor.openclaw);
|
|
3500
|
-
console.log("");
|
|
3501
3414
|
const assessment = assessDoctorReport(doctor);
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3415
|
+
const configuredCount = doctor.surfaces.filter((s) => s.configured).length;
|
|
3416
|
+
console.log("");
|
|
3417
|
+
if (assessment.issues.length === 0) {
|
|
3418
|
+
console.log(` ${ICON.ok} ${pc3.green("You're all set.")} ${pc3.dim(`OrgX is active across ${configuredCount} editor${configuredCount !== 1 ? "s" : ""}`)}`);
|
|
3419
|
+
} else {
|
|
3420
|
+
printDoctorReport(doctor, assessment);
|
|
3421
|
+
if (!assessment.ok) {
|
|
3422
|
+
process.exitCode = 1;
|
|
3423
|
+
}
|
|
3505
3424
|
}
|
|
3506
3425
|
});
|
|
3507
3426
|
async function runBrowserLogin(opts = {}) {
|
|
@@ -3515,8 +3434,11 @@ async function main() {
|
|
|
3515
3434
|
deviceName: opts.deviceName ?? hostname(),
|
|
3516
3435
|
platform: process.platform
|
|
3517
3436
|
});
|
|
3518
|
-
spinner.succeed("
|
|
3519
|
-
console.log(`
|
|
3437
|
+
spinner.succeed("Browser pairing session opened");
|
|
3438
|
+
console.log(`
|
|
3439
|
+
${pc3.dim("Open this URL to connect:")}`);
|
|
3440
|
+
console.log(` ${pc3.cyan(pairing.connectUrl)}
|
|
3441
|
+
`);
|
|
3520
3442
|
if (opts.open !== false) {
|
|
3521
3443
|
const openResult = openBrowser(pairing.connectUrl);
|
|
3522
3444
|
if (!openResult.ok && openResult.error) {
|
|
@@ -3524,7 +3446,7 @@ async function main() {
|
|
|
3524
3446
|
}
|
|
3525
3447
|
}
|
|
3526
3448
|
spinner.start();
|
|
3527
|
-
spinner.text =
|
|
3449
|
+
spinner.text = "Waiting for browser approval...";
|
|
3528
3450
|
const ready = await waitForBrowserPairing({
|
|
3529
3451
|
baseUrl: opts.baseUrl,
|
|
3530
3452
|
pairingId: pairing.pairingId,
|
|
@@ -3532,13 +3454,14 @@ async function main() {
|
|
|
3532
3454
|
pollToken: pairing.pollToken,
|
|
3533
3455
|
timeoutMs: (opts.timeout ?? 600) * 1e3
|
|
3534
3456
|
});
|
|
3535
|
-
spinner.text =
|
|
3457
|
+
spinner.text = "Verifying API key...";
|
|
3536
3458
|
const result = await verifyAndPersistAuth(ready.key, {
|
|
3537
3459
|
...opts.baseUrl !== void 0 ? { baseUrl: opts.baseUrl } : {}
|
|
3538
3460
|
});
|
|
3539
3461
|
if (!("stored" in result)) {
|
|
3540
|
-
spinner.fail("
|
|
3541
|
-
|
|
3462
|
+
spinner.fail("Pairing completed but key was rejected");
|
|
3463
|
+
console.log(` ${pc3.red(result.verification.error ?? `HTTP ${result.verification.status ?? "error"}`)}`);
|
|
3464
|
+
console.log(` ${pc3.dim("The browser flow finished, but OrgX rejected the key. Try again or check your account at useorgx.com.")}`);
|
|
3542
3465
|
return false;
|
|
3543
3466
|
}
|
|
3544
3467
|
await acknowledgeBrowserPairing({
|
|
@@ -3546,21 +3469,16 @@ async function main() {
|
|
|
3546
3469
|
pairingId: pairing.pairingId,
|
|
3547
3470
|
pollToken: pairing.pollToken
|
|
3548
3471
|
}).catch((error) => {
|
|
3549
|
-
console.log(pc3.
|
|
3472
|
+
console.log(pc3.dim(`Pairing ack failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
3550
3473
|
});
|
|
3551
|
-
spinner.succeed("OrgX
|
|
3474
|
+
spinner.succeed("OrgX account connected");
|
|
3552
3475
|
await syncContinuityAfterAuth({
|
|
3553
3476
|
executionMode: ready.executionMode,
|
|
3554
3477
|
workspaceName: ready.workspaceName
|
|
3555
3478
|
});
|
|
3556
|
-
|
|
3557
|
-
...result.verification,
|
|
3558
|
-
source: "wizard-store",
|
|
3559
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3560
|
-
verifiedAt: result.stored.verifiedAt
|
|
3561
|
-
});
|
|
3479
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3562
3480
|
if (ready.workspaceName) {
|
|
3563
|
-
console.log(`workspace
|
|
3481
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(ready.workspaceName)}`);
|
|
3564
3482
|
}
|
|
3565
3483
|
if (result.openclawResults.length > 0) {
|
|
3566
3484
|
console.log("");
|
|
@@ -3568,8 +3486,9 @@ async function main() {
|
|
|
3568
3486
|
}
|
|
3569
3487
|
return true;
|
|
3570
3488
|
} catch (error) {
|
|
3571
|
-
|
|
3572
|
-
|
|
3489
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3490
|
+
spinner.fail("Browser pairing failed");
|
|
3491
|
+
console.log(` ${pc3.red(message)}`);
|
|
3573
3492
|
return false;
|
|
3574
3493
|
}
|
|
3575
3494
|
}
|
|
@@ -3579,6 +3498,7 @@ async function main() {
|
|
|
3579
3498
|
spinner.start();
|
|
3580
3499
|
const status = await checkOrgxAuth();
|
|
3581
3500
|
spinner.stop();
|
|
3501
|
+
console.log(pc3.dim(" account"));
|
|
3582
3502
|
printAuthStatus(status);
|
|
3583
3503
|
});
|
|
3584
3504
|
auth.command("login").description("Start browser pairing for OrgX auth, with direct API key fallback for CI and blocked browsers.").option("--api-key <key>", "Bypass browser pairing and verify this OrgX API key directly.").option("--base-url <url>", "OrgX base URL").option("--device-name <name>", "Device name shown during browser approval.").option("--no-open", "Do not automatically open the browser connect URL.").option("--timeout <seconds>", "How long to wait for browser pairing before giving up.", parseTimeoutSeconds, 600).action(async (options) => {
|
|
@@ -3591,14 +3511,9 @@ async function main() {
|
|
|
3591
3511
|
printAuthStatus(result.verification);
|
|
3592
3512
|
return;
|
|
3593
3513
|
}
|
|
3594
|
-
spinner.succeed("OrgX
|
|
3514
|
+
spinner.succeed("OrgX account connected");
|
|
3595
3515
|
await syncContinuityAfterAuth();
|
|
3596
|
-
|
|
3597
|
-
...result.verification,
|
|
3598
|
-
source: "wizard-store",
|
|
3599
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3600
|
-
verifiedAt: result.stored.verifiedAt
|
|
3601
|
-
});
|
|
3516
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3602
3517
|
if (result.openclawResults.length > 0) {
|
|
3603
3518
|
console.log("");
|
|
3604
3519
|
printMutationResults(result.openclawResults);
|
|
@@ -3621,14 +3536,9 @@ async function main() {
|
|
|
3621
3536
|
printAuthStatus(result.verification);
|
|
3622
3537
|
return;
|
|
3623
3538
|
}
|
|
3624
|
-
spinner.succeed("OrgX
|
|
3539
|
+
spinner.succeed("OrgX account connected");
|
|
3625
3540
|
await syncContinuityAfterAuth();
|
|
3626
|
-
|
|
3627
|
-
...result.verification,
|
|
3628
|
-
source: "wizard-store",
|
|
3629
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3630
|
-
verifiedAt: result.stored.verifiedAt
|
|
3631
|
-
});
|
|
3541
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3632
3542
|
if (result.openclawResults.length > 0) {
|
|
3633
3543
|
console.log("");
|
|
3634
3544
|
printMutationResults(result.openclawResults);
|
|
@@ -3714,26 +3624,12 @@ async function main() {
|
|
|
3714
3624
|
printWorkspace(result.workspace);
|
|
3715
3625
|
});
|
|
3716
3626
|
program.command("doctor").description("Verify local OrgX surface config and optional remote setup status.").action(async () => {
|
|
3717
|
-
const spinner = createOrgxSpinner("Running OrgX
|
|
3627
|
+
const spinner = createOrgxSpinner("Running OrgX health check");
|
|
3718
3628
|
spinner.start();
|
|
3719
3629
|
const report = await runDoctor();
|
|
3720
3630
|
spinner.stop();
|
|
3721
|
-
printSurfaceTable(report.surfaces);
|
|
3722
|
-
console.log("");
|
|
3723
|
-
printAuthStatus(report.auth);
|
|
3724
|
-
console.log("");
|
|
3725
|
-
printHostedMcpHealth(report.hostedMcp);
|
|
3726
|
-
console.log("");
|
|
3727
|
-
printHostedMcpToolCheck(report.hostedMcpTool);
|
|
3728
|
-
console.log("");
|
|
3729
|
-
printNpmRegistryHealth(report.npmRegistry);
|
|
3730
|
-
console.log("");
|
|
3731
|
-
printWorkspaceConnectivity(report.workspace);
|
|
3732
|
-
console.log("");
|
|
3733
|
-
printOpenClawHealth(report.openclaw);
|
|
3734
|
-
console.log("");
|
|
3735
3631
|
const assessment = assessDoctorReport(report);
|
|
3736
|
-
|
|
3632
|
+
printDoctorReport(report, assessment);
|
|
3737
3633
|
if (!assessment.ok) {
|
|
3738
3634
|
process.exitCode = 1;
|
|
3739
3635
|
}
|