@useorgx/wizard 0.1.58 → 0.1.59
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 +61 -20
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
|
|
5
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
5
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="38a8c165-aa33-5892-9af0-25fee0a694c7")}catch(e){}}();
|
|
6
6
|
import * as clack from "@clack/prompts";
|
|
7
7
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
8
8
|
import { readFileSync as readFileSync10 } from "fs";
|
|
@@ -2441,12 +2441,15 @@ function stringifyTomlDocument(document) {
|
|
|
2441
2441
|
return rendered.endsWith("\n") ? rendered : `${rendered}
|
|
2442
2442
|
`;
|
|
2443
2443
|
}
|
|
2444
|
-
function upsertCodexEntry(servers, key, url) {
|
|
2444
|
+
function upsertCodexEntry(servers, key, url, oauthResource) {
|
|
2445
2445
|
const current = readObject(servers[key]);
|
|
2446
2446
|
const next = {
|
|
2447
2447
|
...current,
|
|
2448
2448
|
url
|
|
2449
2449
|
};
|
|
2450
|
+
if (oauthResource) {
|
|
2451
|
+
next.oauth_resource = oauthResource;
|
|
2452
|
+
}
|
|
2450
2453
|
delete next.command;
|
|
2451
2454
|
delete next.args;
|
|
2452
2455
|
delete next.startup_timeout_sec;
|
|
@@ -2466,7 +2469,12 @@ function removeLegacyCodexEntries(servers) {
|
|
|
2466
2469
|
function patchCodexConfigToml(input, localMcpUrl) {
|
|
2467
2470
|
const current = parseTomlDocument(input);
|
|
2468
2471
|
const servers = readObject(current.mcp_servers);
|
|
2469
|
-
upsertCodexEntry(
|
|
2472
|
+
upsertCodexEntry(
|
|
2473
|
+
servers,
|
|
2474
|
+
ORGX_HOSTED_MCP_KEY,
|
|
2475
|
+
ORGX_CODEX_MCP_URL,
|
|
2476
|
+
ORGX_HOSTED_MCP_URL
|
|
2477
|
+
);
|
|
2470
2478
|
if (localMcpUrl) {
|
|
2471
2479
|
upsertCodexEntry(servers, ORGX_LOCAL_MCP_KEY, localMcpUrl);
|
|
2472
2480
|
}
|
|
@@ -2474,27 +2482,60 @@ function patchCodexConfigToml(input, localMcpUrl) {
|
|
|
2474
2482
|
current.mcp_servers = servers;
|
|
2475
2483
|
return stringifyTomlDocument(current);
|
|
2476
2484
|
}
|
|
2477
|
-
function
|
|
2485
|
+
function migrateCodexHostedMcpConnection(input) {
|
|
2478
2486
|
if (!input) return input;
|
|
2479
2487
|
const current = parseTomlDocument(input);
|
|
2480
2488
|
const servers = readObject(current.mcp_servers);
|
|
2481
2489
|
const hosted = readObject(servers[ORGX_HOSTED_MCP_KEY]);
|
|
2482
|
-
if (hosted.url !== ORGX_HOSTED_MCP_URL)
|
|
2490
|
+
if (hosted.url !== ORGX_HOSTED_MCP_URL && hosted.url !== ORGX_CODEX_MCP_URL) {
|
|
2491
|
+
return input;
|
|
2492
|
+
}
|
|
2483
2493
|
const lines = input.match(/.*(?:\r\n|\n|$)/g)?.filter((line) => line.length > 0) ?? [];
|
|
2484
2494
|
let inOrgxSection = false;
|
|
2485
|
-
let
|
|
2486
|
-
|
|
2495
|
+
let urlIndex = -1;
|
|
2496
|
+
let oauthResourceIndex = -1;
|
|
2497
|
+
for (const [index, line] of lines.entries()) {
|
|
2487
2498
|
if (/^\s*\[/.test(line)) {
|
|
2488
2499
|
inOrgxSection = /^\s*\[mcp_servers\.(?:orgx|"orgx")\]\s*(?:#.*)?(?:\r?\n)?$/.test(line);
|
|
2489
|
-
|
|
2500
|
+
continue;
|
|
2501
|
+
}
|
|
2502
|
+
if (!inOrgxSection) continue;
|
|
2503
|
+
if (/^\s*url\s*=/.test(line)) urlIndex = index;
|
|
2504
|
+
if (/^\s*oauth_resource\s*=/.test(line)) oauthResourceIndex = index;
|
|
2505
|
+
}
|
|
2506
|
+
if (urlIndex < 0) return input;
|
|
2507
|
+
const urlMatch = lines[urlIndex]?.match(
|
|
2508
|
+
/^(\s*url\s*=\s*)(["'])(https:\/\/mcp\.useorgx\.com\/mcp(?:\?profile=commander)?)\2([ \t]*(?:#.*)?)(\r?\n)?$/
|
|
2509
|
+
);
|
|
2510
|
+
if (!urlMatch) return input;
|
|
2511
|
+
let changed = false;
|
|
2512
|
+
if (urlMatch[3] !== ORGX_CODEX_MCP_URL) {
|
|
2513
|
+
lines[urlIndex] = `${urlMatch[1]}${urlMatch[2]}${ORGX_CODEX_MCP_URL}${urlMatch[2]}${urlMatch[4]}${urlMatch[5] ?? ""}`;
|
|
2514
|
+
changed = true;
|
|
2515
|
+
}
|
|
2516
|
+
if (oauthResourceIndex >= 0) {
|
|
2517
|
+
const oauthResourceMatch = lines[oauthResourceIndex]?.match(
|
|
2518
|
+
/^(\s*oauth_resource\s*=\s*)(["'])([^"']*)\2([ \t]*(?:#.*)?)(\r?\n)?$/
|
|
2519
|
+
);
|
|
2520
|
+
if (!oauthResourceMatch) return input;
|
|
2521
|
+
if (oauthResourceMatch[3] !== ORGX_HOSTED_MCP_URL) {
|
|
2522
|
+
lines[oauthResourceIndex] = `${oauthResourceMatch[1]}${oauthResourceMatch[2]}${ORGX_HOSTED_MCP_URL}${oauthResourceMatch[2]}${oauthResourceMatch[4]}${oauthResourceMatch[5] ?? ""}`;
|
|
2523
|
+
changed = true;
|
|
2490
2524
|
}
|
|
2491
|
-
|
|
2492
|
-
const
|
|
2493
|
-
if (!
|
|
2525
|
+
} else {
|
|
2526
|
+
const lineEnding = urlMatch[5] ?? (input.includes("\r\n") ? "\r\n" : "\n");
|
|
2527
|
+
if (!urlMatch[5]) {
|
|
2528
|
+
lines[urlIndex] = `${lines[urlIndex]}${lineEnding}`;
|
|
2529
|
+
}
|
|
2530
|
+
const indent = urlMatch[1]?.match(/^\s*/)?.[0] ?? "";
|
|
2531
|
+
lines.splice(
|
|
2532
|
+
urlIndex + 1,
|
|
2533
|
+
0,
|
|
2534
|
+
`${indent}oauth_resource = "${ORGX_HOSTED_MCP_URL}"${urlMatch[5] ? lineEnding : ""}`
|
|
2535
|
+
);
|
|
2494
2536
|
changed = true;
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
return changed ? nextLines.join("") : input;
|
|
2537
|
+
}
|
|
2538
|
+
return changed ? lines.join("") : input;
|
|
2498
2539
|
}
|
|
2499
2540
|
function removeCodexConfigToml(input) {
|
|
2500
2541
|
const current = parseTomlDocument(input);
|
|
@@ -2515,7 +2556,7 @@ function inspectCodexConfigToml(input) {
|
|
|
2515
2556
|
const servers = readObject(current.mcp_servers);
|
|
2516
2557
|
const hosted = readObject(servers[ORGX_HOSTED_MCP_KEY]);
|
|
2517
2558
|
const local = readObject(servers[ORGX_LOCAL_MCP_KEY]);
|
|
2518
|
-
const hostedConfigured = hosted.url === ORGX_CODEX_MCP_URL;
|
|
2559
|
+
const hostedConfigured = hosted.url === ORGX_CODEX_MCP_URL && hosted.oauth_resource === ORGX_HOSTED_MCP_URL;
|
|
2519
2560
|
const localConfigured = typeof local.url === "string";
|
|
2520
2561
|
return {
|
|
2521
2562
|
configured: hostedConfigured && localConfigured,
|
|
@@ -4252,7 +4293,7 @@ async function installCodexPlugin(paths, fetchImpl, runner) {
|
|
|
4252
4293
|
const syncResult = await syncManagedRepoTree(CODEX_PLUGIN_SYNC_SPEC, paths.codexPluginDir, fetchImpl);
|
|
4253
4294
|
const marketplaceChanged = upsertCodexMarketplaceEntry(paths.codexMarketplacePath);
|
|
4254
4295
|
const previousConfig = readTextIfExists(paths.codexConfigPath);
|
|
4255
|
-
const nextConfig =
|
|
4296
|
+
const nextConfig = migrateCodexHostedMcpConnection(previousConfig);
|
|
4256
4297
|
const configChanged = nextConfig !== previousConfig;
|
|
4257
4298
|
if (configChanged && nextConfig !== null) {
|
|
4258
4299
|
writeTextFile(paths.codexConfigPath, nextConfig);
|
|
@@ -4261,7 +4302,7 @@ async function installCodexPlugin(paths, fetchImpl, runner) {
|
|
|
4261
4302
|
const changes = [
|
|
4262
4303
|
...syncResult.changed ? [`Synced ${syncResult.fileCount} Codex plugin files.`] : [],
|
|
4263
4304
|
...marketplaceChanged ? ["Updated the Codex marketplace entry."] : [],
|
|
4264
|
-
...configChanged ? ["Updated the existing OrgX MCP connection
|
|
4305
|
+
...configChanged ? ["Updated the existing OrgX MCP connection for the commander profile and OAuth."] : []
|
|
4265
4306
|
];
|
|
4266
4307
|
return {
|
|
4267
4308
|
target: "codex",
|
|
@@ -6249,7 +6290,7 @@ function initializeWizardSentry() {
|
|
|
6249
6290
|
Sentry.init({
|
|
6250
6291
|
dsn,
|
|
6251
6292
|
environment: process.env.ORGX_SENTRY_ENVIRONMENT || "production",
|
|
6252
|
-
release: "useorgx-wizard@0.1.
|
|
6293
|
+
release: "useorgx-wizard@0.1.59",
|
|
6253
6294
|
tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
|
|
6254
6295
|
enableLogs: true,
|
|
6255
6296
|
sendDefaultPii: false,
|
|
@@ -18280,7 +18321,7 @@ async function main() {
|
|
|
18280
18321
|
initializeWizardSentry();
|
|
18281
18322
|
const program = new Command();
|
|
18282
18323
|
program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
|
|
18283
|
-
const pkgVersion = true ? "0.1.
|
|
18324
|
+
const pkgVersion = true ? "0.1.59" : void 0;
|
|
18284
18325
|
program.version(pkgVersion ?? "unknown", "-V, --version");
|
|
18285
18326
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
18286
18327
|
if (Boolean(actionCommand.optsWithGlobals().json)) return;
|
|
@@ -19324,4 +19365,4 @@ main().catch(async (error) => {
|
|
|
19324
19365
|
process.exitCode = 1;
|
|
19325
19366
|
});
|
|
19326
19367
|
//# sourceMappingURL=cli.js.map
|
|
19327
|
-
//# debugId=
|
|
19368
|
+
//# debugId=38a8c165-aa33-5892-9af0-25fee0a694c7
|