@kvell007/embed-labs-cli 0.1.0-alpha.17 → 0.1.0-alpha.18

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/index.js CHANGED
@@ -28,6 +28,8 @@ const DEVICE_PROBE_USAGE = "Usage: embed device probe --host <host> --ports 22,1
28
28
  const QUERY_USAGE = "Usage: embed query <natural language request> [--account <account_id>] [--qr] [--json]";
29
29
  const DEFAULT_PLUGIN_RELEASE_URL = process.env.EMBED_PLUGIN_RELEASE_URL?.trim() || "https://api.embedboard.com/plugin-releases/agent-plugins/latest";
30
30
  const PLUGIN_LIST_USAGE = "Usage: embed plugin list [--release-dir <dir>] [--release-url <url>] [--json]";
31
+ const CODEX_PLUGIN_NAME = "embed-labs";
32
+ const CODEX_MARKETPLACE_NAME = "embed-labs-plugins";
31
33
  const PLUGIN_INSTALL_USAGE = "Usage: embed plugin install <codex|opencode|all> [--release-dir <dir>] [--release-url <url>] [--target <dir>] [--codex-target <dir>] [--opencode-target <dir>] [--force] [--json]";
32
34
  const CLOUD_TASK_ARTIFACTS_USAGE = "Usage: embed cloud task artifacts <task_id> [--json]";
33
35
  const CLOUD_TASK_EVIDENCE_USAGE = "Usage: embed cloud task evidence <task_id> [--json]";
@@ -1636,7 +1638,7 @@ async function installCodexPlugin(parsed, context) {
1636
1638
  return source;
1637
1639
  }
1638
1640
  const targetRoot = codexPluginTargetRoot(parsed, context.installingAll);
1639
- const targetPath = join(targetRoot, "embed-labs");
1641
+ const targetPath = join(targetRoot, CODEX_PLUGIN_NAME);
1640
1642
  const legacyCleanup = await cleanupLegacyCodexPluginRemnants(targetRoot);
1641
1643
  if (await pathExists(targetPath) && !booleanFlag(parsed, "force")) {
1642
1644
  return fail("plugin_already_installed", `Codex plugin already exists at ${targetPath}.`, {
@@ -1647,17 +1649,23 @@ async function installCodexPlugin(parsed, context) {
1647
1649
  await mkdir(targetRoot, { recursive: true });
1648
1650
  await cp(source.data.sourcePath, targetPath, { recursive: true });
1649
1651
  const mcpRegistration = await maybeRegisterCodexMcp(parsed, targetRoot, targetPath);
1652
+ const marketplaceRegistration = await maybeRegisterCodexMarketplace(parsed, targetRoot, targetPath);
1650
1653
  return ok({
1651
1654
  id: "codex",
1652
1655
  target_path: targetPath,
1653
1656
  source: source.data.sourceLabel,
1654
1657
  version: source.data.version,
1655
1658
  command_hint: mcpRegistration.registered
1656
- ? "Codex MCP was registered. Start a new Codex session to reload tools."
1659
+ ? (marketplaceRegistration.registered
1660
+ ? "Codex MCP and plugin marketplace entry were registered. Fully restart Codex to reload @Embed Labs."
1661
+ : "Codex MCP was registered. Start a new Codex session to reload tools.")
1657
1662
  : mcpRegistration.hint,
1658
1663
  warning: legacyCodexCleanupWarning(legacyCleanup),
1659
1664
  mcp_registered: mcpRegistration.registered,
1660
1665
  mcp_warning: mcpRegistration.warning,
1666
+ marketplace_registered: marketplaceRegistration.registered,
1667
+ marketplace_path: marketplaceRegistration.marketplacePath,
1668
+ marketplace_warning: marketplaceRegistration.warning,
1661
1669
  cleanup: legacyCleanup
1662
1670
  });
1663
1671
  }
@@ -2311,6 +2319,101 @@ async function maybeRegisterCodexMcp(parsed, targetRoot, targetPath) {
2311
2319
  const warning = await upsertCodexMcpRuntimeConfig(bridgePath);
2312
2320
  return warning ? { registered: true, warning } : { registered: true };
2313
2321
  }
2322
+ async function maybeRegisterCodexMarketplace(parsed, targetRoot, targetPath) {
2323
+ const explicitTarget = Boolean(stringFlag(parsed, "target") || stringFlag(parsed, "codex-target"));
2324
+ if (explicitTarget && process.env.EMBED_CODEX_MARKETPLACE_REGISTER !== "1") {
2325
+ return {
2326
+ registered: false,
2327
+ warning: "Codex plugin marketplace entry was not registered because a custom target was used. Set EMBED_CODEX_MARKETPLACE_REGISTER=1 to register it anyway."
2328
+ };
2329
+ }
2330
+ if (resolve(targetRoot) !== resolve(defaultCodexPluginRoot()) && process.env.EMBED_CODEX_MARKETPLACE_REGISTER !== "1") {
2331
+ return {
2332
+ registered: false,
2333
+ warning: "Codex plugin marketplace entry was not registered because the install target is not the default Codex plugin root."
2334
+ };
2335
+ }
2336
+ const marketplacePath = defaultCodexLocalMarketplaceRoot();
2337
+ const marketplacePluginPath = join(marketplacePath, "plugins", CODEX_PLUGIN_NAME);
2338
+ try {
2339
+ if (!await pathExists(join(targetPath, ".codex-plugin", "plugin.json"))) {
2340
+ return {
2341
+ registered: false,
2342
+ warning: `Codex plugin manifest was not found at ${join(targetPath, ".codex-plugin", "plugin.json")}.`
2343
+ };
2344
+ }
2345
+ await rm(marketplacePluginPath, { recursive: true, force: true });
2346
+ await mkdir(dirname(marketplacePluginPath), { recursive: true });
2347
+ await cp(targetPath, marketplacePluginPath, { recursive: true });
2348
+ await writeCodexLocalMarketplaceManifest(marketplacePath);
2349
+ const warning = await upsertCodexPluginMarketplaceConfig(marketplacePath);
2350
+ return warning ? { registered: true, marketplacePath, warning } : { registered: true, marketplacePath };
2351
+ }
2352
+ catch (error) {
2353
+ return {
2354
+ registered: false,
2355
+ marketplacePath,
2356
+ warning: `Could not register Codex plugin marketplace entry: ${error instanceof Error ? error.message : String(error)}`
2357
+ };
2358
+ }
2359
+ }
2360
+ function defaultCodexLocalMarketplaceRoot() {
2361
+ return join(defaultCodexHome(), "local-marketplaces", CODEX_PLUGIN_NAME);
2362
+ }
2363
+ async function writeCodexLocalMarketplaceManifest(marketplacePath) {
2364
+ const manifestPath = join(marketplacePath, ".agents", "plugins", "marketplace.json");
2365
+ const manifest = {
2366
+ name: CODEX_MARKETPLACE_NAME,
2367
+ interface: {
2368
+ displayName: "Embed Labs"
2369
+ },
2370
+ plugins: [
2371
+ {
2372
+ name: CODEX_PLUGIN_NAME,
2373
+ source: {
2374
+ source: "local",
2375
+ path: `./plugins/${CODEX_PLUGIN_NAME}`
2376
+ },
2377
+ policy: {
2378
+ installation: "AVAILABLE",
2379
+ authentication: "ON_USE"
2380
+ },
2381
+ category: "Developer Tools"
2382
+ }
2383
+ ]
2384
+ };
2385
+ await mkdir(dirname(manifestPath), { recursive: true });
2386
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
2387
+ }
2388
+ async function upsertCodexPluginMarketplaceConfig(marketplacePath) {
2389
+ const configPath = codexConfigPath();
2390
+ try {
2391
+ await mkdir(dirname(configPath), { recursive: true });
2392
+ let text = "";
2393
+ try {
2394
+ text = await readFile(configPath, "utf8");
2395
+ }
2396
+ catch {
2397
+ text = "";
2398
+ }
2399
+ text = removeLegacyCodexConfigTables(text).text;
2400
+ let updated = upsertTomlTableKeys(text, `marketplaces.${CODEX_MARKETPLACE_NAME}`, {
2401
+ source_type: tomlString("local"),
2402
+ source: tomlString(marketplacePath),
2403
+ last_updated: tomlString(new Date().toISOString().replace(/\.\d{3}Z$/, "Z"))
2404
+ });
2405
+ updated = upsertTomlTableKeys(updated, `plugins."${CODEX_PLUGIN_NAME}@${CODEX_MARKETPLACE_NAME}"`, {
2406
+ enabled: "true"
2407
+ });
2408
+ if (updated !== text) {
2409
+ await writeFile(configPath, updated, "utf8");
2410
+ }
2411
+ return undefined;
2412
+ }
2413
+ catch (error) {
2414
+ return `${configPath} could not be updated with the Embed Labs plugin marketplace entry: ${error instanceof Error ? error.message : String(error)}`;
2415
+ }
2416
+ }
2314
2417
  function codexMcpAlreadyRegistered(stdout, bridgePath, cloudUrl, authFile, embedCliBin) {
2315
2418
  try {
2316
2419
  const parsed = JSON.parse(stdout);
@@ -5223,6 +5326,15 @@ function renderPluginInstall(result) {
5223
5326
  if (item.mcp_warning) {
5224
5327
  lines.push(` warning=${item.mcp_warning}`);
5225
5328
  }
5329
+ if (item.marketplace_registered !== undefined) {
5330
+ lines.push(` codex_marketplace_registered=${item.marketplace_registered}`);
5331
+ }
5332
+ if (item.marketplace_path) {
5333
+ lines.push(` codex_marketplace=${item.marketplace_path}`);
5334
+ }
5335
+ if (item.marketplace_warning) {
5336
+ lines.push(` warning=${item.marketplace_warning}`);
5337
+ }
5226
5338
  }
5227
5339
  return lines.join("\n");
5228
5340
  }