@useorgx/wizard 0.1.1 → 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 +205 -357
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -578,15 +578,12 @@ async function checkOrgxAuth(options = {}) {
|
|
|
578
578
|
ok: false,
|
|
579
579
|
skipped: true,
|
|
580
580
|
source: "none",
|
|
581
|
-
error: "No OrgX
|
|
581
|
+
error: "No OrgX account connected. Run `orgx-wizard auth login` to connect.",
|
|
582
582
|
url: buildOrgxApiUrl("/client/sync", DEFAULT_ORGX_BASE_URL)
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
585
|
return verifyOrgxAuth(auth);
|
|
586
586
|
}
|
|
587
|
-
function describeSetupStatusScope() {
|
|
588
|
-
return "The setup-status endpoint is still service-key-only and uses ORGX_SERVICE_KEY.";
|
|
589
|
-
}
|
|
590
587
|
|
|
591
588
|
// src/lib/browser-auth.ts
|
|
592
589
|
function asString(value) {
|
|
@@ -670,6 +667,7 @@ async function startBrowserPairing(options, fetchImpl) {
|
|
|
670
667
|
method: "POST",
|
|
671
668
|
body: JSON.stringify({
|
|
672
669
|
installationId: options.installationId,
|
|
670
|
+
clientType: "orgx-wizard",
|
|
673
671
|
...options.deviceName ? { deviceName: options.deviceName } : {},
|
|
674
672
|
...options.platform ? { platform: options.platform } : {}
|
|
675
673
|
}),
|
|
@@ -745,48 +743,6 @@ function openBrowser(url) {
|
|
|
745
743
|
return { ok: true };
|
|
746
744
|
}
|
|
747
745
|
|
|
748
|
-
// src/lib/setup-status.ts
|
|
749
|
-
async function fetchSetupStatus(apiKey = process.env.ORGX_SERVICE_KEY?.trim()) {
|
|
750
|
-
if (!apiKey) {
|
|
751
|
-
return {
|
|
752
|
-
ok: false,
|
|
753
|
-
skipped: true,
|
|
754
|
-
error: "ORGX_SERVICE_KEY is not set; /api/setup/status is a service-level check and was skipped.",
|
|
755
|
-
url: ORGX_SETUP_STATUS_URL
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
try {
|
|
759
|
-
const response = await fetch(ORGX_SETUP_STATUS_URL, {
|
|
760
|
-
headers: {
|
|
761
|
-
Authorization: `Bearer ${apiKey}`
|
|
762
|
-
},
|
|
763
|
-
signal: AbortSignal.timeout(7e3)
|
|
764
|
-
});
|
|
765
|
-
const text2 = await response.text();
|
|
766
|
-
let data = text2;
|
|
767
|
-
try {
|
|
768
|
-
data = text2.length > 0 ? JSON.parse(text2) : null;
|
|
769
|
-
} catch {
|
|
770
|
-
data = text2;
|
|
771
|
-
}
|
|
772
|
-
return {
|
|
773
|
-
ok: response.ok,
|
|
774
|
-
skipped: false,
|
|
775
|
-
status: response.status,
|
|
776
|
-
data,
|
|
777
|
-
url: ORGX_SETUP_STATUS_URL,
|
|
778
|
-
...response.ok ? {} : { error: `HTTP ${response.status}` }
|
|
779
|
-
};
|
|
780
|
-
} catch (error) {
|
|
781
|
-
return {
|
|
782
|
-
ok: false,
|
|
783
|
-
skipped: false,
|
|
784
|
-
error: error instanceof Error ? error.message : String(error),
|
|
785
|
-
url: ORGX_SETUP_STATUS_URL
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
|
|
790
746
|
// src/lib/openclaw-health.ts
|
|
791
747
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
792
748
|
function trimOutput(value) {
|
|
@@ -2288,9 +2244,8 @@ async function runDoctor() {
|
|
|
2288
2244
|
const hostedMcpTool = await checkHostedMcpToolAccess();
|
|
2289
2245
|
const npmRegistry = await checkNpmRegistryHealth();
|
|
2290
2246
|
const workspace = await checkWorkspaceConnectivity();
|
|
2291
|
-
const remote = await fetchSetupStatus();
|
|
2292
2247
|
const openclaw = openclawSurface?.detected ? await checkOpenClawHealth(openclawSurface.path) : skippedOpenClawHealth();
|
|
2293
|
-
return { surfaces, auth, hostedMcp, hostedMcpTool, npmRegistry, workspace,
|
|
2248
|
+
return { surfaces, auth, hostedMcp, hostedMcpTool, npmRegistry, workspace, openclaw };
|
|
2294
2249
|
}
|
|
2295
2250
|
function assessDoctorReport(report) {
|
|
2296
2251
|
const issues = [];
|
|
@@ -2342,13 +2297,6 @@ function assessDoctorReport(report) {
|
|
|
2342
2297
|
suggestion: "Run `openclaw doctor` or `openclaw doctor --repair` before relying on local bridge clients like Cursor."
|
|
2343
2298
|
});
|
|
2344
2299
|
}
|
|
2345
|
-
if (!report.remote.skipped && !report.remote.ok) {
|
|
2346
|
-
issues.push({
|
|
2347
|
-
level: "warning",
|
|
2348
|
-
title: "Remote setup status check failed.",
|
|
2349
|
-
suggestion: "If you expected the service-key check to pass, verify ORGX_SERVICE_KEY before trusting setup-status output."
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
2300
|
return {
|
|
2353
2301
|
ok: !issues.some((issue) => issue.level === "error"),
|
|
2354
2302
|
issues
|
|
@@ -3123,53 +3071,50 @@ function createOrgxSpinner(text2) {
|
|
|
3123
3071
|
}
|
|
3124
3072
|
|
|
3125
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
|
+
};
|
|
3126
3080
|
function formatAuthSource(source) {
|
|
3127
3081
|
switch (source) {
|
|
3128
3082
|
case "environment":
|
|
3129
|
-
return "ORGX_API_KEY";
|
|
3083
|
+
return "env ORGX_API_KEY";
|
|
3130
3084
|
case "wizard-store":
|
|
3131
3085
|
return "wizard auth store";
|
|
3132
3086
|
case "openclaw-config-file":
|
|
3133
|
-
return "
|
|
3087
|
+
return "openclaw config";
|
|
3134
3088
|
default:
|
|
3135
3089
|
return "not configured";
|
|
3136
3090
|
}
|
|
3137
3091
|
}
|
|
3138
3092
|
function printSurfaceTable(statuses) {
|
|
3139
3093
|
for (const status of statuses) {
|
|
3140
|
-
const
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3143
|
-
console.log(` ${status.
|
|
3144
|
-
if (status.path) {
|
|
3145
|
-
console.log(` path: ${status.path}`);
|
|
3146
|
-
}
|
|
3147
|
-
for (const detail of status.details) {
|
|
3148
|
-
console.log(` - ${detail}`);
|
|
3149
|
-
}
|
|
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}`);
|
|
3150
3098
|
}
|
|
3151
3099
|
}
|
|
3152
3100
|
function printMutationResults(results) {
|
|
3153
3101
|
for (const result of summarizeMutationResults(results)) {
|
|
3154
|
-
const
|
|
3155
|
-
|
|
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)}`);
|
|
3156
3105
|
}
|
|
3157
3106
|
}
|
|
3158
3107
|
function printSkillInstallReport(report) {
|
|
3159
3108
|
for (const write of report.writes) {
|
|
3160
|
-
const
|
|
3161
|
-
|
|
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}`);
|
|
3162
3112
|
}
|
|
3163
3113
|
for (const pack of report.packs) {
|
|
3164
|
-
const changedCount = pack.files.filter((
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
);
|
|
3169
|
-
for (const file of pack.files) {
|
|
3170
|
-
const state = file.changed ? "updated" : "unchanged";
|
|
3171
|
-
console.log(` - ${state} ${file.path}`);
|
|
3172
|
-
}
|
|
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`)}`);
|
|
3173
3118
|
}
|
|
3174
3119
|
}
|
|
3175
3120
|
function printWorkspace(workspace) {
|
|
@@ -3197,15 +3142,11 @@ function printWorkspaceList(workspaces) {
|
|
|
3197
3142
|
}
|
|
3198
3143
|
}
|
|
3199
3144
|
function printWorkspaceSetupResult(result) {
|
|
3200
|
-
console.log(pc3.bold("workspace bootstrap"));
|
|
3201
|
-
const statusLabel = result.status === "updated" ? pc3.green("updated") : result.status === "unchanged" ? pc3.yellow("unchanged") : pc3.dim(result.status);
|
|
3202
|
-
console.log(` ${statusLabel} ${result.message}`);
|
|
3203
3145
|
if (result.workspace) {
|
|
3204
|
-
|
|
3205
|
-
console.log(`
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
}
|
|
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)}`);
|
|
3209
3150
|
}
|
|
3210
3151
|
}
|
|
3211
3152
|
function printFounderPresetResult(result) {
|
|
@@ -3274,81 +3215,6 @@ async function syncContinuityAfterAuth(seed = {}) {
|
|
|
3274
3215
|
} catch {
|
|
3275
3216
|
}
|
|
3276
3217
|
}
|
|
3277
|
-
function printOpenClawHealth(check) {
|
|
3278
|
-
console.log(pc3.bold("openclaw runtime"));
|
|
3279
|
-
if (check.skipped) {
|
|
3280
|
-
console.log(` ${pc3.yellow(check.error ?? "Gateway health check skipped.")}`);
|
|
3281
|
-
} else if (check.ok) {
|
|
3282
|
-
const via = check.method === "cli" ? "CLI" : "HTTP";
|
|
3283
|
-
console.log(` ${pc3.green(`healthy via ${via}`)}`);
|
|
3284
|
-
} else {
|
|
3285
|
-
const via = check.method === "none" ? "unavailable" : check.method.toUpperCase();
|
|
3286
|
-
console.log(` ${pc3.red(`unhealthy via ${via}`)} ${check.error ?? "unknown error"}`);
|
|
3287
|
-
}
|
|
3288
|
-
if (check.url) {
|
|
3289
|
-
console.log(` url: ${check.url}`);
|
|
3290
|
-
}
|
|
3291
|
-
for (const detail of check.details) {
|
|
3292
|
-
console.log(` - ${detail}`);
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
function printHostedMcpHealth(check) {
|
|
3296
|
-
console.log(pc3.bold("hosted mcp"));
|
|
3297
|
-
if (check.skipped) {
|
|
3298
|
-
console.log(` ${pc3.yellow(check.error ?? "Hosted MCP health check skipped.")}`);
|
|
3299
|
-
} else if (check.ok) {
|
|
3300
|
-
console.log(` ${pc3.green("reachable")}`);
|
|
3301
|
-
} else {
|
|
3302
|
-
console.log(` ${pc3.red("unreachable")} ${check.error ?? "unknown error"}`);
|
|
3303
|
-
}
|
|
3304
|
-
console.log(` url: ${check.url}`);
|
|
3305
|
-
for (const detail of check.details) {
|
|
3306
|
-
console.log(` - ${detail}`);
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
function printHostedMcpToolCheck(check) {
|
|
3310
|
-
console.log(pc3.bold("hosted mcp tool call"));
|
|
3311
|
-
if (check.skipped) {
|
|
3312
|
-
console.log(` ${pc3.yellow(check.error ?? "Hosted MCP tool verification skipped.")}`);
|
|
3313
|
-
} else if (check.ok) {
|
|
3314
|
-
console.log(` ${pc3.green("authenticated tool call ok")}`);
|
|
3315
|
-
} else {
|
|
3316
|
-
console.log(` ${pc3.red("authenticated tool call failed")} ${check.error ?? "unknown error"}`);
|
|
3317
|
-
}
|
|
3318
|
-
console.log(` tool: ${check.toolName}`);
|
|
3319
|
-
console.log(` url: ${check.url}`);
|
|
3320
|
-
if (check.source !== "none") {
|
|
3321
|
-
console.log(` auth source: ${formatAuthSource(check.source)}`);
|
|
3322
|
-
}
|
|
3323
|
-
if (check.baseUrl) {
|
|
3324
|
-
console.log(` base url: ${check.baseUrl}`);
|
|
3325
|
-
}
|
|
3326
|
-
if (check.initializeStatus !== void 0) {
|
|
3327
|
-
console.log(` initialize status: ${check.initializeStatus}`);
|
|
3328
|
-
}
|
|
3329
|
-
if (check.callStatus !== void 0) {
|
|
3330
|
-
console.log(` tool call status: ${check.callStatus}`);
|
|
3331
|
-
}
|
|
3332
|
-
for (const detail of check.details) {
|
|
3333
|
-
console.log(` - ${detail}`);
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
function printNpmRegistryHealth(check) {
|
|
3337
|
-
console.log(pc3.bold("npm registry"));
|
|
3338
|
-
if (!check.reachable) {
|
|
3339
|
-
console.log(` ${pc3.red("unreachable")} ${check.error ?? "unknown error"}`);
|
|
3340
|
-
} else if (check.published) {
|
|
3341
|
-
console.log(
|
|
3342
|
-
` ${pc3.green("reachable")} ${check.packageName}${check.version ? `@${check.version}` : ""}`
|
|
3343
|
-
);
|
|
3344
|
-
} else {
|
|
3345
|
-
console.log(` ${pc3.yellow("reachable")} ${check.error ?? `${check.packageName} is not published yet.`}`);
|
|
3346
|
-
}
|
|
3347
|
-
console.log(` url: ${check.url}`);
|
|
3348
|
-
for (const detail of check.details) {
|
|
3349
|
-
console.log(` - ${detail}`);
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
3218
|
function parseTimeoutSeconds(value) {
|
|
3353
3219
|
const parsed = Number(value);
|
|
3354
3220
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
@@ -3356,86 +3222,78 @@ function parseTimeoutSeconds(value) {
|
|
|
3356
3222
|
}
|
|
3357
3223
|
return parsed;
|
|
3358
3224
|
}
|
|
3359
|
-
function describeBrowserPairingFailure(error) {
|
|
3360
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3361
|
-
return `${message} Use \`wizard auth login --api-key <oxk_...>\` or \`wizard auth set-key <oxk_...>\` to fall back to a manual key.`;
|
|
3362
|
-
}
|
|
3363
3225
|
function printAuthStatus(status) {
|
|
3364
|
-
console.log(pc3.bold("orgx auth"));
|
|
3365
3226
|
if (!status.configured) {
|
|
3366
|
-
console.log(` ${pc3.yellow(
|
|
3227
|
+
console.log(` ${ICON.warn} ${pc3.yellow("no account")} run ${pc3.cyan("orgx-wizard auth login")} to connect`);
|
|
3367
3228
|
return;
|
|
3368
3229
|
}
|
|
3369
|
-
const
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
);
|
|
3373
|
-
if (status.baseUrl) {
|
|
3374
|
-
console.log(` base url: ${status.baseUrl}`);
|
|
3375
|
-
}
|
|
3376
|
-
if (status.path) {
|
|
3377
|
-
console.log(` path: ${status.path}`);
|
|
3378
|
-
}
|
|
3379
|
-
if (status.verifiedAt) {
|
|
3380
|
-
console.log(` verified at: ${status.verifiedAt}`);
|
|
3381
|
-
}
|
|
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}`);
|
|
3382
3234
|
if (!status.ok && status.error) {
|
|
3383
|
-
console.log(`
|
|
3235
|
+
console.log(` ${pc3.red(status.error)}`);
|
|
3384
3236
|
}
|
|
3385
3237
|
}
|
|
3386
|
-
function
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
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}`);
|
|
3391
3275
|
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
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" : ""}`)}`);
|
|
3396
3285
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
if (!check.configured) {
|
|
3407
|
-
console.log(` ${pc3.yellow(check.error ?? "Workspace connectivity check skipped.")}`);
|
|
3408
|
-
return;
|
|
3409
|
-
}
|
|
3410
|
-
if (!check.ok) {
|
|
3411
|
-
console.log(` ${pc3.red("unreachable")} ${check.error ?? "unknown error"}`);
|
|
3412
|
-
} else if (check.workspace) {
|
|
3413
|
-
console.log(` ${pc3.green("reachable")} ${check.workspace.name}`);
|
|
3414
|
-
console.log(` workspace id: ${check.workspace.id}`);
|
|
3415
|
-
if (check.workspace.isDefault) {
|
|
3416
|
-
console.log(" default: yes");
|
|
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}`);
|
|
3417
3295
|
}
|
|
3418
3296
|
}
|
|
3419
|
-
if (check.baseUrl) {
|
|
3420
|
-
console.log(` base url: ${check.baseUrl}`);
|
|
3421
|
-
}
|
|
3422
|
-
for (const detail of check.details) {
|
|
3423
|
-
console.log(` - ${detail}`);
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
function printDoctorAssessment(report) {
|
|
3427
|
-
console.log(pc3.bold("doctor summary"));
|
|
3428
|
-
if (report.issues.length === 0) {
|
|
3429
|
-
console.log(` ${pc3.green("ready")} No blocking issues detected.`);
|
|
3430
|
-
return;
|
|
3431
|
-
}
|
|
3432
|
-
const headline = report.ok ? pc3.yellow("warnings only") : pc3.red("blocking issues detected");
|
|
3433
|
-
console.log(` ${headline}`);
|
|
3434
|
-
for (const issue of report.issues) {
|
|
3435
|
-
const label = issue.level === "error" ? pc3.red("error") : pc3.yellow("warning");
|
|
3436
|
-
console.log(` ${label} ${issue.title}`);
|
|
3437
|
-
console.log(` fix: ${issue.suggestion}`);
|
|
3438
|
-
}
|
|
3439
3297
|
}
|
|
3440
3298
|
async function main() {
|
|
3441
3299
|
const program = new Command();
|
|
@@ -3473,24 +3331,8 @@ async function main() {
|
|
|
3473
3331
|
printFounderPresetResult(presetResult);
|
|
3474
3332
|
console.log("");
|
|
3475
3333
|
const doctor2 = await runDoctor();
|
|
3476
|
-
printSurfaceTable(doctor2.surfaces);
|
|
3477
|
-
console.log("");
|
|
3478
|
-
printAuthStatus(doctor2.auth);
|
|
3479
|
-
console.log("");
|
|
3480
|
-
printHostedMcpHealth(doctor2.hostedMcp);
|
|
3481
|
-
console.log("");
|
|
3482
|
-
printHostedMcpToolCheck(doctor2.hostedMcpTool);
|
|
3483
|
-
console.log("");
|
|
3484
|
-
printNpmRegistryHealth(doctor2.npmRegistry);
|
|
3485
|
-
console.log("");
|
|
3486
|
-
printWorkspaceConnectivity(doctor2.workspace);
|
|
3487
|
-
console.log("");
|
|
3488
|
-
printOpenClawHealth(doctor2.openclaw);
|
|
3489
|
-
console.log("");
|
|
3490
|
-
printRemoteSetupStatus(doctor2.remote);
|
|
3491
|
-
console.log("");
|
|
3492
3334
|
const assessment2 = assessDoctorReport(doctor2);
|
|
3493
|
-
|
|
3335
|
+
printDoctorReport(doctor2, assessment2);
|
|
3494
3336
|
if (!assessment2.ok) {
|
|
3495
3337
|
process.exitCode = 1;
|
|
3496
3338
|
}
|
|
@@ -3501,12 +3343,42 @@ async function main() {
|
|
|
3501
3343
|
const results = await setupDetectedSurfaces();
|
|
3502
3344
|
spinner.succeed("Detected surfaces configured");
|
|
3503
3345
|
printMutationResults(results);
|
|
3504
|
-
|
|
3346
|
+
let resolvedAuth = await resolveOrgxAuth();
|
|
3505
3347
|
if (!resolvedAuth) {
|
|
3506
3348
|
console.log("");
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3349
|
+
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
3350
|
+
if (interactive) {
|
|
3351
|
+
const choice = await selectPrompt({
|
|
3352
|
+
message: "Connect your OrgX account to enable workspace and AI tool access",
|
|
3353
|
+
options: [
|
|
3354
|
+
{ value: "login", label: "Open browser to connect", hint: "recommended" },
|
|
3355
|
+
{ value: "skip", label: "Skip for now", hint: "run `orgx-wizard auth login` later" }
|
|
3356
|
+
]
|
|
3357
|
+
});
|
|
3358
|
+
if (clack.isCancel(choice)) {
|
|
3359
|
+
clack.cancel("Setup cancelled.");
|
|
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();
|
|
3371
|
+
} else {
|
|
3372
|
+
console.log(`
|
|
3373
|
+
${pc3.dim("\u2192")} ${pc3.cyan("orgx-wizard auth login")} ${pc3.dim("to connect when ready")}`);
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
} else {
|
|
3377
|
+
console.log(
|
|
3378
|
+
` ${ICON.warn} ${pc3.yellow("No account connected.")} Run ${pc3.cyan("orgx-wizard auth login")} to connect.`
|
|
3379
|
+
);
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3510
3382
|
}
|
|
3511
3383
|
if (resolvedAuth) {
|
|
3512
3384
|
console.log("");
|
|
@@ -3527,131 +3399,128 @@ async function main() {
|
|
|
3527
3399
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
3528
3400
|
}
|
|
3529
3401
|
);
|
|
3530
|
-
if (workspaceSetup.status
|
|
3531
|
-
printWorkspaceSetupResult(workspaceSetup);
|
|
3532
|
-
} else {
|
|
3402
|
+
if (workspaceSetup.status === "cancelled") {
|
|
3533
3403
|
return;
|
|
3534
3404
|
}
|
|
3405
|
+
if (workspaceSetup.workspace) {
|
|
3406
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(workspaceSetup.workspace.name)}`);
|
|
3407
|
+
}
|
|
3535
3408
|
}
|
|
3536
|
-
console.log("");
|
|
3537
3409
|
const doctor = await runDoctor();
|
|
3538
|
-
printSurfaceTable(doctor.surfaces);
|
|
3539
|
-
console.log("");
|
|
3540
|
-
printAuthStatus(doctor.auth);
|
|
3541
|
-
console.log("");
|
|
3542
|
-
printHostedMcpHealth(doctor.hostedMcp);
|
|
3543
|
-
console.log("");
|
|
3544
|
-
printHostedMcpToolCheck(doctor.hostedMcpTool);
|
|
3545
|
-
console.log("");
|
|
3546
|
-
printNpmRegistryHealth(doctor.npmRegistry);
|
|
3547
|
-
console.log("");
|
|
3548
|
-
printWorkspaceConnectivity(doctor.workspace);
|
|
3549
|
-
console.log("");
|
|
3550
|
-
printOpenClawHealth(doctor.openclaw);
|
|
3551
|
-
console.log("");
|
|
3552
|
-
printRemoteSetupStatus(doctor.remote);
|
|
3553
|
-
console.log("");
|
|
3554
3410
|
const assessment = assessDoctorReport(doctor);
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
spinner.start();
|
|
3564
|
-
const status = await checkOrgxAuth();
|
|
3565
|
-
spinner.stop();
|
|
3566
|
-
printAuthStatus(status);
|
|
3567
|
-
});
|
|
3568
|
-
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) => {
|
|
3569
|
-
if (options.apiKey) {
|
|
3570
|
-
const spinner2 = createOrgxSpinner("Verifying OrgX API key");
|
|
3571
|
-
spinner2.start();
|
|
3572
|
-
const result = await verifyAndPersistAuth(options.apiKey, options);
|
|
3573
|
-
if (!("stored" in result)) {
|
|
3574
|
-
spinner2.fail("OrgX API key verification failed");
|
|
3575
|
-
printAuthStatus(result.verification);
|
|
3576
|
-
return;
|
|
3577
|
-
}
|
|
3578
|
-
spinner2.succeed("OrgX API key verified and saved");
|
|
3579
|
-
await syncContinuityAfterAuth();
|
|
3580
|
-
printAuthStatus({
|
|
3581
|
-
...result.verification,
|
|
3582
|
-
source: "wizard-store",
|
|
3583
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3584
|
-
verifiedAt: result.stored.verifiedAt
|
|
3585
|
-
});
|
|
3586
|
-
if (result.openclawResults.length > 0) {
|
|
3587
|
-
console.log("");
|
|
3588
|
-
printMutationResults(result.openclawResults);
|
|
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;
|
|
3589
3419
|
}
|
|
3590
|
-
return;
|
|
3591
3420
|
}
|
|
3421
|
+
});
|
|
3422
|
+
async function runBrowserLogin(opts = {}) {
|
|
3592
3423
|
const installationId = getOrCreateWizardInstallationId();
|
|
3593
3424
|
const spinner = createOrgxSpinner("Starting OrgX browser pairing");
|
|
3594
3425
|
spinner.start();
|
|
3595
3426
|
try {
|
|
3596
3427
|
const pairing = await startBrowserPairing({
|
|
3597
3428
|
installationId,
|
|
3598
|
-
baseUrl:
|
|
3599
|
-
deviceName:
|
|
3429
|
+
baseUrl: opts.baseUrl,
|
|
3430
|
+
deviceName: opts.deviceName ?? hostname(),
|
|
3600
3431
|
platform: process.platform
|
|
3601
3432
|
});
|
|
3602
|
-
spinner.succeed("
|
|
3603
|
-
console.log(`
|
|
3604
|
-
|
|
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
|
+
`);
|
|
3438
|
+
if (opts.open !== false) {
|
|
3605
3439
|
const openResult = openBrowser(pairing.connectUrl);
|
|
3606
3440
|
if (!openResult.ok && openResult.error) {
|
|
3607
3441
|
console.log(pc3.yellow(`Browser open failed: ${openResult.error}`));
|
|
3608
3442
|
}
|
|
3609
3443
|
}
|
|
3610
3444
|
spinner.start();
|
|
3611
|
-
spinner.text =
|
|
3445
|
+
spinner.text = "Waiting for browser approval...";
|
|
3612
3446
|
const ready = await waitForBrowserPairing({
|
|
3613
|
-
baseUrl:
|
|
3447
|
+
baseUrl: opts.baseUrl,
|
|
3614
3448
|
pairingId: pairing.pairingId,
|
|
3615
3449
|
pollIntervalMs: pairing.pollIntervalMs,
|
|
3616
3450
|
pollToken: pairing.pollToken,
|
|
3617
|
-
timeoutMs:
|
|
3451
|
+
timeoutMs: (opts.timeout ?? 600) * 1e3
|
|
3452
|
+
});
|
|
3453
|
+
spinner.text = "Verifying API key...";
|
|
3454
|
+
const result = await verifyAndPersistAuth(ready.key, {
|
|
3455
|
+
...opts.baseUrl !== void 0 ? { baseUrl: opts.baseUrl } : {}
|
|
3618
3456
|
});
|
|
3619
|
-
spinner.text = pc3.cyan("Verifying OrgX API key");
|
|
3620
|
-
const result = await verifyAndPersistAuth(ready.key, options);
|
|
3621
3457
|
if (!("stored" in result)) {
|
|
3622
|
-
spinner.fail("
|
|
3458
|
+
spinner.fail("API key invalid");
|
|
3623
3459
|
printAuthStatus(result.verification);
|
|
3624
|
-
return;
|
|
3460
|
+
return false;
|
|
3625
3461
|
}
|
|
3626
3462
|
await acknowledgeBrowserPairing({
|
|
3627
|
-
baseUrl:
|
|
3463
|
+
baseUrl: opts.baseUrl,
|
|
3628
3464
|
pairingId: pairing.pairingId,
|
|
3629
3465
|
pollToken: pairing.pollToken
|
|
3630
3466
|
}).catch((error) => {
|
|
3631
|
-
console.log(pc3.
|
|
3467
|
+
console.log(pc3.dim(`Pairing ack failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
3632
3468
|
});
|
|
3633
|
-
spinner.succeed("OrgX
|
|
3469
|
+
spinner.succeed("OrgX account connected");
|
|
3634
3470
|
await syncContinuityAfterAuth({
|
|
3635
3471
|
executionMode: ready.executionMode,
|
|
3636
3472
|
workspaceName: ready.workspaceName
|
|
3637
3473
|
});
|
|
3638
|
-
|
|
3639
|
-
...result.verification,
|
|
3640
|
-
source: "wizard-store",
|
|
3641
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3642
|
-
verifiedAt: result.stored.verifiedAt
|
|
3643
|
-
});
|
|
3474
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3644
3475
|
if (ready.workspaceName) {
|
|
3645
|
-
console.log(`workspace
|
|
3476
|
+
console.log(` ${ICON.ok} ${pc3.green("workspace ")} ${pc3.bold(ready.workspaceName)}`);
|
|
3646
3477
|
}
|
|
3647
3478
|
if (result.openclawResults.length > 0) {
|
|
3648
3479
|
console.log("");
|
|
3649
3480
|
printMutationResults(result.openclawResults);
|
|
3650
3481
|
}
|
|
3482
|
+
return true;
|
|
3651
3483
|
} catch (error) {
|
|
3652
|
-
|
|
3653
|
-
|
|
3484
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3485
|
+
spinner.fail("Browser pairing failed");
|
|
3486
|
+
console.log(` ${pc3.red(message)}`);
|
|
3487
|
+
return false;
|
|
3654
3488
|
}
|
|
3489
|
+
}
|
|
3490
|
+
const auth = program.command("auth").description("Manage OrgX API key auth for the wizard.");
|
|
3491
|
+
auth.command("status").description("Show the resolved OrgX API key source and verify it against OrgX.").action(async () => {
|
|
3492
|
+
const spinner = createOrgxSpinner("Checking OrgX auth");
|
|
3493
|
+
spinner.start();
|
|
3494
|
+
const status = await checkOrgxAuth();
|
|
3495
|
+
spinner.stop();
|
|
3496
|
+
console.log(pc3.dim(" account"));
|
|
3497
|
+
printAuthStatus(status);
|
|
3498
|
+
});
|
|
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) => {
|
|
3500
|
+
if (options.apiKey) {
|
|
3501
|
+
const spinner = createOrgxSpinner("Verifying OrgX API key");
|
|
3502
|
+
spinner.start();
|
|
3503
|
+
const result = await verifyAndPersistAuth(options.apiKey, options);
|
|
3504
|
+
if (!("stored" in result)) {
|
|
3505
|
+
spinner.fail("OrgX API key verification failed");
|
|
3506
|
+
printAuthStatus(result.verification);
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3509
|
+
spinner.succeed("OrgX account connected");
|
|
3510
|
+
await syncContinuityAfterAuth();
|
|
3511
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3512
|
+
if (result.openclawResults.length > 0) {
|
|
3513
|
+
console.log("");
|
|
3514
|
+
printMutationResults(result.openclawResults);
|
|
3515
|
+
}
|
|
3516
|
+
return;
|
|
3517
|
+
}
|
|
3518
|
+
await runBrowserLogin({
|
|
3519
|
+
...options.baseUrl !== void 0 ? { baseUrl: options.baseUrl } : {},
|
|
3520
|
+
...options.deviceName !== void 0 ? { deviceName: options.deviceName } : {},
|
|
3521
|
+
...options.open !== void 0 ? { open: options.open } : {},
|
|
3522
|
+
timeout: options.timeout
|
|
3523
|
+
});
|
|
3655
3524
|
});
|
|
3656
3525
|
auth.command("set-key").description("Verify and persist a per-user OrgX API key for the wizard.").argument("<apiKey>", "per-user OrgX API key (oxk_...)").option("--base-url <url>", "OrgX base URL").action(async (apiKey, options) => {
|
|
3657
3526
|
const spinner = createOrgxSpinner("Verifying OrgX API key");
|
|
@@ -3662,14 +3531,9 @@ async function main() {
|
|
|
3662
3531
|
printAuthStatus(result.verification);
|
|
3663
3532
|
return;
|
|
3664
3533
|
}
|
|
3665
|
-
spinner.succeed("OrgX
|
|
3534
|
+
spinner.succeed("OrgX account connected");
|
|
3666
3535
|
await syncContinuityAfterAuth();
|
|
3667
|
-
|
|
3668
|
-
...result.verification,
|
|
3669
|
-
source: "wizard-store",
|
|
3670
|
-
path: ORGX_WIZARD_AUTH_PATH,
|
|
3671
|
-
verifiedAt: result.stored.verifiedAt
|
|
3672
|
-
});
|
|
3536
|
+
console.log(` ${ICON.ok} ${pc3.green("verified ")} ${pc3.bold(result.stored.keyPrefix ?? result.verification.keyPrefix ?? "unknown")} ${pc3.dim("wizard auth store")}`);
|
|
3673
3537
|
if (result.openclawResults.length > 0) {
|
|
3674
3538
|
console.log("");
|
|
3675
3539
|
printMutationResults(result.openclawResults);
|
|
@@ -3755,28 +3619,12 @@ async function main() {
|
|
|
3755
3619
|
printWorkspace(result.workspace);
|
|
3756
3620
|
});
|
|
3757
3621
|
program.command("doctor").description("Verify local OrgX surface config and optional remote setup status.").action(async () => {
|
|
3758
|
-
const spinner = createOrgxSpinner("Running OrgX
|
|
3622
|
+
const spinner = createOrgxSpinner("Running OrgX health check");
|
|
3759
3623
|
spinner.start();
|
|
3760
3624
|
const report = await runDoctor();
|
|
3761
3625
|
spinner.stop();
|
|
3762
|
-
printSurfaceTable(report.surfaces);
|
|
3763
|
-
console.log("");
|
|
3764
|
-
printAuthStatus(report.auth);
|
|
3765
|
-
console.log("");
|
|
3766
|
-
printHostedMcpHealth(report.hostedMcp);
|
|
3767
|
-
console.log("");
|
|
3768
|
-
printHostedMcpToolCheck(report.hostedMcpTool);
|
|
3769
|
-
console.log("");
|
|
3770
|
-
printNpmRegistryHealth(report.npmRegistry);
|
|
3771
|
-
console.log("");
|
|
3772
|
-
printWorkspaceConnectivity(report.workspace);
|
|
3773
|
-
console.log("");
|
|
3774
|
-
printOpenClawHealth(report.openclaw);
|
|
3775
|
-
console.log("");
|
|
3776
|
-
printRemoteSetupStatus(report.remote);
|
|
3777
|
-
console.log("");
|
|
3778
3626
|
const assessment = assessDoctorReport(report);
|
|
3779
|
-
|
|
3627
|
+
printDoctorReport(report, assessment);
|
|
3780
3628
|
if (!assessment.ok) {
|
|
3781
3629
|
process.exitCode = 1;
|
|
3782
3630
|
}
|