@useorgx/wizard 0.1.3 → 0.1.4
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 +141 -250
- 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,50 @@ 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
|
+
};
|
|
3073
3080
|
function formatAuthSource(source) {
|
|
3074
3081
|
switch (source) {
|
|
3075
3082
|
case "environment":
|
|
3076
|
-
return "ORGX_API_KEY";
|
|
3083
|
+
return "env ORGX_API_KEY";
|
|
3077
3084
|
case "wizard-store":
|
|
3078
3085
|
return "wizard auth store";
|
|
3079
3086
|
case "openclaw-config-file":
|
|
3080
|
-
return "
|
|
3087
|
+
return "openclaw config";
|
|
3081
3088
|
default:
|
|
3082
3089
|
return "not configured";
|
|
3083
3090
|
}
|
|
3084
3091
|
}
|
|
3085
3092
|
function printSurfaceTable(statuses) {
|
|
3086
3093
|
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
|
-
}
|
|
3094
|
+
const icon = status.configured ? ICON.ok : status.detected ? ICON.warn : ICON.skip;
|
|
3095
|
+
const state = status.configured ? pc3.green("configured") : status.detected ? pc3.yellow("detected") : pc3.dim("not found");
|
|
3096
|
+
const mode = pc3.dim(status.mode === "automated" ? "auto " : "manual");
|
|
3097
|
+
console.log(` ${icon} ${pc3.bold(status.name.padEnd(10))} ${mode} ${state}`);
|
|
3097
3098
|
}
|
|
3098
3099
|
}
|
|
3099
3100
|
function printMutationResults(results) {
|
|
3100
3101
|
for (const result of summarizeMutationResults(results)) {
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3102
|
+
const icon = result.state === "updated" ? ICON.ok : ICON.skip;
|
|
3103
|
+
const state = result.state === "updated" ? pc3.green("updated ") : pc3.dim("unchanged");
|
|
3104
|
+
console.log(` ${icon} ${pc3.bold(result.name.padEnd(10))} ${state} ${pc3.dim(result.message)}`);
|
|
3103
3105
|
}
|
|
3104
3106
|
}
|
|
3105
3107
|
function printSkillInstallReport(report) {
|
|
3106
3108
|
for (const write of report.writes) {
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3109
|
+
const icon = write.changed ? ICON.ok : ICON.skip;
|
|
3110
|
+
const state = write.changed ? pc3.green("updated ") : pc3.dim("unchanged");
|
|
3111
|
+
console.log(` ${icon} ${pc3.bold(write.label.padEnd(10))} ${state}`);
|
|
3109
3112
|
}
|
|
3110
3113
|
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
|
-
}
|
|
3114
|
+
const changedCount = pack.files.filter((f) => f.changed).length;
|
|
3115
|
+
const icon = changedCount > 0 ? ICON.ok : ICON.skip;
|
|
3116
|
+
const state = changedCount > 0 ? pc3.green(`${changedCount} updated `) : pc3.dim("unchanged");
|
|
3117
|
+
console.log(` ${icon} ${pc3.bold(pack.name.padEnd(10))} ${state} ${pc3.dim(`${pack.files.length} files`)}`);
|
|
3120
3118
|
}
|
|
3121
3119
|
}
|
|
3122
3120
|
function printWorkspace(workspace) {
|
|
@@ -3144,15 +3142,11 @@ function printWorkspaceList(workspaces) {
|
|
|
3144
3142
|
}
|
|
3145
3143
|
}
|
|
3146
3144
|
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
3145
|
if (result.workspace) {
|
|
3151
|
-
|
|
3152
|
-
console.log(`
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
}
|
|
3146
|
+
const icon = result.status === "updated" ? ICON.ok : ICON.skip;
|
|
3147
|
+
console.log(` ${icon} ${pc3.green("workspace ")} ${pc3.bold(result.workspace.name)}`);
|
|
3148
|
+
} else {
|
|
3149
|
+
console.log(` ${ICON.skip} ${pc3.dim(result.message)}`);
|
|
3156
3150
|
}
|
|
3157
3151
|
}
|
|
3158
3152
|
function printFounderPresetResult(result) {
|
|
@@ -3221,81 +3215,6 @@ async function syncContinuityAfterAuth(seed = {}) {
|
|
|
3221
3215
|
} catch {
|
|
3222
3216
|
}
|
|
3223
3217
|
}
|
|
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
3218
|
function parseTimeoutSeconds(value) {
|
|
3300
3219
|
const parsed = Number(value);
|
|
3301
3220
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
@@ -3303,67 +3222,77 @@ function parseTimeoutSeconds(value) {
|
|
|
3303
3222
|
}
|
|
3304
3223
|
return parsed;
|
|
3305
3224
|
}
|
|
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
3225
|
function printAuthStatus(status) {
|
|
3311
|
-
console.log(pc3.bold("orgx auth"));
|
|
3312
3226
|
if (!status.configured) {
|
|
3313
|
-
console.log(` ${pc3.yellow(
|
|
3227
|
+
console.log(` ${ICON.warn} ${pc3.yellow("no account")} run ${pc3.cyan("orgx-wizard auth login")} to connect`);
|
|
3314
3228
|
return;
|
|
3315
3229
|
}
|
|
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
|
-
}
|
|
3230
|
+
const icon = status.ok ? ICON.ok : ICON.err;
|
|
3231
|
+
const state = status.ok ? pc3.green("verified ") : status.skipped ? pc3.yellow("skipped ") : pc3.red("invalid ");
|
|
3232
|
+
const via = pc3.dim(formatAuthSource(status.source));
|
|
3233
|
+
console.log(` ${icon} ${state} ${pc3.bold(status.keyPrefix ?? "unknown")} ${via}`);
|
|
3329
3234
|
if (!status.ok && status.error) {
|
|
3330
|
-
console.log(`
|
|
3235
|
+
console.log(` ${pc3.red(status.error)}`);
|
|
3331
3236
|
}
|
|
3332
3237
|
}
|
|
3333
|
-
function
|
|
3334
|
-
console.log(pc3.
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3238
|
+
function printDoctorReport(report, assessment) {
|
|
3239
|
+
console.log(pc3.dim(" surfaces"));
|
|
3240
|
+
printSurfaceTable(report.surfaces);
|
|
3241
|
+
console.log("");
|
|
3242
|
+
console.log(pc3.dim(" account"));
|
|
3243
|
+
printAuthStatus(report.auth);
|
|
3244
|
+
console.log("");
|
|
3245
|
+
console.log(pc3.dim(" services"));
|
|
3246
|
+
const mcp = report.hostedMcp;
|
|
3247
|
+
{
|
|
3248
|
+
const icon = mcp.skipped ? ICON.skip : mcp.ok ? ICON.ok : ICON.err;
|
|
3249
|
+
const label = pc3.dim("cloud mcp ".padEnd(14));
|
|
3250
|
+
const state = mcp.skipped ? pc3.dim("skipped") : mcp.ok ? pc3.green("reachable") : pc3.red("unreachable");
|
|
3251
|
+
const tail = !mcp.ok && !mcp.skipped && mcp.error ? ` ${pc3.dim(mcp.error)}` : "";
|
|
3252
|
+
console.log(` ${icon} ${label} ${state}${tail}`);
|
|
3253
|
+
}
|
|
3254
|
+
const tool = report.hostedMcpTool;
|
|
3255
|
+
{
|
|
3256
|
+
const icon = tool.skipped ? ICON.skip : tool.ok ? ICON.ok : ICON.err;
|
|
3257
|
+
const label = pc3.dim("tool call ".padEnd(14));
|
|
3258
|
+
const state = tool.skipped ? pc3.dim("skipped") : tool.ok ? pc3.green("authenticated") : pc3.red("failed");
|
|
3259
|
+
const tail = !tool.ok && !tool.skipped && tool.error ? ` ${pc3.dim(tool.error)}` : "";
|
|
3260
|
+
console.log(` ${icon} ${label} ${state}${tail}`);
|
|
3261
|
+
}
|
|
3262
|
+
const ws = report.workspace;
|
|
3263
|
+
{
|
|
3264
|
+
const icon = !ws.configured ? ICON.skip : ws.ok ? ICON.ok : ICON.err;
|
|
3265
|
+
const label = pc3.dim("workspace ".padEnd(14));
|
|
3266
|
+
const state = !ws.configured ? pc3.dim("not configured") : ws.ok && ws.workspace ? pc3.green(ws.workspace.name) : pc3.red(`unreachable${ws.error ? `: ${ws.error}` : ""}`);
|
|
3267
|
+
console.log(` ${icon} ${label} ${state}`);
|
|
3268
|
+
}
|
|
3269
|
+
const openclaw = report.openclaw;
|
|
3270
|
+
{
|
|
3271
|
+
const icon = openclaw.skipped ? ICON.skip : openclaw.ok ? ICON.ok : ICON.err;
|
|
3272
|
+
const label = pc3.dim("openclaw ".padEnd(14));
|
|
3273
|
+
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}` : ""}`);
|
|
3274
|
+
console.log(` ${icon} ${label} ${state}`);
|
|
3338
3275
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
console.log(` ${pc3.green("
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3276
|
+
console.log("");
|
|
3277
|
+
const configuredCount = report.surfaces.filter((s) => s.configured).length;
|
|
3278
|
+
if (assessment.issues.length === 0) {
|
|
3279
|
+
console.log(` ${ICON.ok} ${pc3.green("All systems ready.")}`);
|
|
3280
|
+
if (!report.auth.configured) {
|
|
3281
|
+
console.log(`
|
|
3282
|
+
${pc3.dim("\u2192")} ${pc3.cyan("orgx-wizard auth login")} ${pc3.dim("to connect your account")}`);
|
|
3283
|
+
} else {
|
|
3284
|
+
console.log(` ${pc3.dim("\u2192")} ${pc3.dim(`OrgX is active across ${configuredCount} editor${configuredCount !== 1 ? "s" : ""}`)}`);
|
|
3285
|
+
}
|
|
3286
|
+
} else {
|
|
3287
|
+
const hasError = assessment.issues.some((i) => i.level === "error");
|
|
3288
|
+
const headline = hasError ? `${ICON.err} ${pc3.red("Issues detected")}` : `${ICON.warn} ${pc3.yellow("Warnings detected")}`;
|
|
3289
|
+
console.log(` ${headline}`);
|
|
3290
|
+
for (const issue of assessment.issues) {
|
|
3291
|
+
const label = issue.level === "error" ? pc3.red("error") : pc3.yellow("warn ");
|
|
3292
|
+
console.log(`
|
|
3293
|
+
${label} ${issue.title}`);
|
|
3294
|
+
console.log(` ${pc3.dim("\u2192")} ${issue.suggestion}`);
|
|
3346
3295
|
}
|
|
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
3296
|
}
|
|
3368
3297
|
}
|
|
3369
3298
|
async function main() {
|
|
@@ -3402,22 +3331,8 @@ async function main() {
|
|
|
3402
3331
|
printFounderPresetResult(presetResult);
|
|
3403
3332
|
console.log("");
|
|
3404
3333
|
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
3334
|
const assessment2 = assessDoctorReport(doctor2);
|
|
3420
|
-
|
|
3335
|
+
printDoctorReport(doctor2, assessment2);
|
|
3421
3336
|
if (!assessment2.ok) {
|
|
3422
3337
|
process.exitCode = 1;
|
|
3423
3338
|
}
|
|
@@ -3440,21 +3355,29 @@ async function main() {
|
|
|
3440
3355
|
{ value: "skip", label: "Skip for now", hint: "run `orgx-wizard auth login` later" }
|
|
3441
3356
|
]
|
|
3442
3357
|
});
|
|
3443
|
-
if (
|
|
3444
|
-
const loginOk = await runBrowserLogin();
|
|
3445
|
-
if (loginOk) {
|
|
3446
|
-
resolvedAuth = await resolveOrgxAuth();
|
|
3447
|
-
}
|
|
3448
|
-
} else if (clack.isCancel(choice)) {
|
|
3358
|
+
if (clack.isCancel(choice)) {
|
|
3449
3359
|
clack.cancel("Setup cancelled.");
|
|
3450
3360
|
return;
|
|
3361
|
+
}
|
|
3362
|
+
if (choice === "login") {
|
|
3363
|
+
const loginOk = await runBrowserLogin();
|
|
3364
|
+
if (!loginOk) {
|
|
3365
|
+
console.log(`
|
|
3366
|
+
${pc3.dim("\u2192")} ${pc3.cyan("orgx-wizard auth login")} ${pc3.dim("to try again")}`);
|
|
3367
|
+
console.log(` ${pc3.dim("\u2192")} ${pc3.cyan("orgx-wizard auth login --api-key")} ${pc3.dim("to paste a key directly")}`);
|
|
3368
|
+
return;
|
|
3369
|
+
}
|
|
3370
|
+
resolvedAuth = await resolveOrgxAuth();
|
|
3451
3371
|
} else {
|
|
3452
|
-
console.log(
|
|
3372
|
+
console.log(`
|
|
3373
|
+
${pc3.dim("\u2192")} ${pc3.cyan("orgx-wizard auth login")} ${pc3.dim("to connect when ready")}`);
|
|
3374
|
+
return;
|
|
3453
3375
|
}
|
|
3454
3376
|
} else {
|
|
3455
3377
|
console.log(
|
|
3456
|
-
|
|
3378
|
+
` ${ICON.warn} ${pc3.yellow("No account connected.")} Run ${pc3.cyan("orgx-wizard auth login")} to connect.`
|
|
3457
3379
|
);
|
|
3380
|
+
return;
|
|
3458
3381
|
}
|
|
3459
3382
|
}
|
|
3460
3383
|
if (resolvedAuth) {
|
|
@@ -3476,32 +3399,24 @@ async function main() {
|
|
|
3476
3399
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
3477
3400
|
}
|
|
3478
3401
|
);
|
|
3479
|
-
if (workspaceSetup.status
|
|
3480
|
-
printWorkspaceSetupResult(workspaceSetup);
|
|
3481
|
-
} else {
|
|
3402
|
+
if (workspaceSetup.status === "cancelled") {
|
|
3482
3403
|
return;
|
|
3483
3404
|
}
|
|
3405
|
+
if (workspaceSetup.workspace) {
|
|
3406
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(workspaceSetup.workspace.name)}`);
|
|
3407
|
+
}
|
|
3484
3408
|
}
|
|
3485
|
-
console.log("");
|
|
3486
3409
|
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
3410
|
const assessment = assessDoctorReport(doctor);
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3411
|
+
const configuredCount = doctor.surfaces.filter((s) => s.configured).length;
|
|
3412
|
+
console.log("");
|
|
3413
|
+
if (assessment.issues.length === 0) {
|
|
3414
|
+
console.log(` ${ICON.ok} ${pc3.green("You're all set.")} ${pc3.dim(`OrgX is active across ${configuredCount} editor${configuredCount !== 1 ? "s" : ""}`)}`);
|
|
3415
|
+
} else {
|
|
3416
|
+
printDoctorReport(doctor, assessment);
|
|
3417
|
+
if (!assessment.ok) {
|
|
3418
|
+
process.exitCode = 1;
|
|
3419
|
+
}
|
|
3505
3420
|
}
|
|
3506
3421
|
});
|
|
3507
3422
|
async function runBrowserLogin(opts = {}) {
|
|
@@ -3515,8 +3430,11 @@ async function main() {
|
|
|
3515
3430
|
deviceName: opts.deviceName ?? hostname(),
|
|
3516
3431
|
platform: process.platform
|
|
3517
3432
|
});
|
|
3518
|
-
spinner.succeed("
|
|
3519
|
-
console.log(`
|
|
3433
|
+
spinner.succeed("Browser pairing session opened");
|
|
3434
|
+
console.log(`
|
|
3435
|
+
${pc3.dim("Open this URL to connect:")}`);
|
|
3436
|
+
console.log(` ${pc3.cyan(pairing.connectUrl)}
|
|
3437
|
+
`);
|
|
3520
3438
|
if (opts.open !== false) {
|
|
3521
3439
|
const openResult = openBrowser(pairing.connectUrl);
|
|
3522
3440
|
if (!openResult.ok && openResult.error) {
|
|
@@ -3524,7 +3442,7 @@ async function main() {
|
|
|
3524
3442
|
}
|
|
3525
3443
|
}
|
|
3526
3444
|
spinner.start();
|
|
3527
|
-
spinner.text =
|
|
3445
|
+
spinner.text = "Waiting for browser approval...";
|
|
3528
3446
|
const ready = await waitForBrowserPairing({
|
|
3529
3447
|
baseUrl: opts.baseUrl,
|
|
3530
3448
|
pairingId: pairing.pairingId,
|
|
@@ -3532,12 +3450,12 @@ async function main() {
|
|
|
3532
3450
|
pollToken: pairing.pollToken,
|
|
3533
3451
|
timeoutMs: (opts.timeout ?? 600) * 1e3
|
|
3534
3452
|
});
|
|
3535
|
-
spinner.text =
|
|
3453
|
+
spinner.text = "Verifying API key...";
|
|
3536
3454
|
const result = await verifyAndPersistAuth(ready.key, {
|
|
3537
3455
|
...opts.baseUrl !== void 0 ? { baseUrl: opts.baseUrl } : {}
|
|
3538
3456
|
});
|
|
3539
3457
|
if (!("stored" in result)) {
|
|
3540
|
-
spinner.fail("
|
|
3458
|
+
spinner.fail("API key invalid");
|
|
3541
3459
|
printAuthStatus(result.verification);
|
|
3542
3460
|
return false;
|
|
3543
3461
|
}
|
|
@@ -3546,21 +3464,16 @@ async function main() {
|
|
|
3546
3464
|
pairingId: pairing.pairingId,
|
|
3547
3465
|
pollToken: pairing.pollToken
|
|
3548
3466
|
}).catch((error) => {
|
|
3549
|
-
console.log(pc3.
|
|
3467
|
+
console.log(pc3.dim(`Pairing ack failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
3550
3468
|
});
|
|
3551
|
-
spinner.succeed("OrgX
|
|
3469
|
+
spinner.succeed("OrgX account connected");
|
|
3552
3470
|
await syncContinuityAfterAuth({
|
|
3553
3471
|
executionMode: ready.executionMode,
|
|
3554
3472
|
workspaceName: ready.workspaceName
|
|
3555
3473
|
});
|
|
3556
|
-
|
|
3557
|
-
...result.verification,
|
|
3558
|
-
source: "wizard-store",
|
|
3559
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3560
|
-
verifiedAt: result.stored.verifiedAt
|
|
3561
|
-
});
|
|
3474
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3562
3475
|
if (ready.workspaceName) {
|
|
3563
|
-
console.log(`workspace
|
|
3476
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(ready.workspaceName)}`);
|
|
3564
3477
|
}
|
|
3565
3478
|
if (result.openclawResults.length > 0) {
|
|
3566
3479
|
console.log("");
|
|
@@ -3568,8 +3481,9 @@ async function main() {
|
|
|
3568
3481
|
}
|
|
3569
3482
|
return true;
|
|
3570
3483
|
} catch (error) {
|
|
3571
|
-
|
|
3572
|
-
|
|
3484
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3485
|
+
spinner.fail("Browser pairing failed");
|
|
3486
|
+
console.log(` ${pc3.red(message)}`);
|
|
3573
3487
|
return false;
|
|
3574
3488
|
}
|
|
3575
3489
|
}
|
|
@@ -3579,6 +3493,7 @@ async function main() {
|
|
|
3579
3493
|
spinner.start();
|
|
3580
3494
|
const status = await checkOrgxAuth();
|
|
3581
3495
|
spinner.stop();
|
|
3496
|
+
console.log(pc3.dim(" account"));
|
|
3582
3497
|
printAuthStatus(status);
|
|
3583
3498
|
});
|
|
3584
3499
|
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 +3506,9 @@ async function main() {
|
|
|
3591
3506
|
printAuthStatus(result.verification);
|
|
3592
3507
|
return;
|
|
3593
3508
|
}
|
|
3594
|
-
spinner.succeed("OrgX
|
|
3509
|
+
spinner.succeed("OrgX account connected");
|
|
3595
3510
|
await syncContinuityAfterAuth();
|
|
3596
|
-
|
|
3597
|
-
...result.verification,
|
|
3598
|
-
source: "wizard-store",
|
|
3599
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3600
|
-
verifiedAt: result.stored.verifiedAt
|
|
3601
|
-
});
|
|
3511
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3602
3512
|
if (result.openclawResults.length > 0) {
|
|
3603
3513
|
console.log("");
|
|
3604
3514
|
printMutationResults(result.openclawResults);
|
|
@@ -3621,14 +3531,9 @@ async function main() {
|
|
|
3621
3531
|
printAuthStatus(result.verification);
|
|
3622
3532
|
return;
|
|
3623
3533
|
}
|
|
3624
|
-
spinner.succeed("OrgX
|
|
3534
|
+
spinner.succeed("OrgX account connected");
|
|
3625
3535
|
await syncContinuityAfterAuth();
|
|
3626
|
-
|
|
3627
|
-
...result.verification,
|
|
3628
|
-
source: "wizard-store",
|
|
3629
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3630
|
-
verifiedAt: result.stored.verifiedAt
|
|
3631
|
-
});
|
|
3536
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3632
3537
|
if (result.openclawResults.length > 0) {
|
|
3633
3538
|
console.log("");
|
|
3634
3539
|
printMutationResults(result.openclawResults);
|
|
@@ -3714,26 +3619,12 @@ async function main() {
|
|
|
3714
3619
|
printWorkspace(result.workspace);
|
|
3715
3620
|
});
|
|
3716
3621
|
program.command("doctor").description("Verify local OrgX surface config and optional remote setup status.").action(async () => {
|
|
3717
|
-
const spinner = createOrgxSpinner("Running OrgX
|
|
3622
|
+
const spinner = createOrgxSpinner("Running OrgX health check");
|
|
3718
3623
|
spinner.start();
|
|
3719
3624
|
const report = await runDoctor();
|
|
3720
3625
|
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
3626
|
const assessment = assessDoctorReport(report);
|
|
3736
|
-
|
|
3627
|
+
printDoctorReport(report, assessment);
|
|
3737
3628
|
if (!assessment.ok) {
|
|
3738
3629
|
process.exitCode = 1;
|
|
3739
3630
|
}
|