Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"test:ios-cpu": "node scripts/smoke-ios-cpu.mjs",
"package": "node scripts/package.mjs",
"package:release": "node scripts/package.mjs --release",
"claude:config": "node scripts/claude-config.mjs",
"package:claude": "node scripts/package-claude.mjs",
"test:claude": "node scripts/smoke-claude-package.mjs",
"cursor:config": "node scripts/cursor-config.mjs",
"package:cursor": "node scripts/package-cursor.mjs",
"test:cursor": "node scripts/smoke-cursor-package.mjs",
"claude:config": "node scripts/plugin-config.mjs claude",
"package:claude": "node scripts/package-plugin.mjs claude",
"test:claude": "node scripts/smoke-plugin.mjs claude",
"cursor:config": "node scripts/plugin-config.mjs cursor",
"package:cursor": "node scripts/package-plugin.mjs cursor",
"test:cursor": "node scripts/smoke-plugin.mjs cursor",
"vendor:serve-emu": "node scripts/vendor-serve-emu.mjs",
"dev": "node scripts/dev-ui.mjs",
"dev:off": "node scripts/dev-ui.mjs --off",
Expand Down
18 changes: 0 additions & 18 deletions scripts/claude-config.mjs

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/cursor-config.mjs

This file was deleted.

39 changes: 0 additions & 39 deletions scripts/package-claude.mjs

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/package-cursor.mjs

This file was deleted.

44 changes: 44 additions & 0 deletions scripts/package-plugin.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { execFileSync } from "node:child_process";
import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import { telemetryBuildEnvironment } from "./telemetry-build.mjs";
import { documents, pluginHost } from "./plugin-hosts.mjs";

const name = process.argv[2];
const host = pluginHost(name);
const args = process.argv.slice(3);
// Reuse the existing artifact inventory, native assets and environment checks.
telemetryBuildEnvironment(args);
execFileSync(process.execPath, ["scripts/package.mjs", ...args], { stdio: "inherit" });
const metadata = JSON.parse(await readFile("package.json", "utf8"));
const source = resolve("release/marketplace/plugins/mobile-dev");

if (host.desktopBundle) {
const manifest = JSON.parse(await readFile(host.desktopBundle, "utf8"));
manifest.version = metadata.version;
const directory = resolve(`release/${name}-desktop/mobile-dev`);
await rm(directory, { recursive: true, force: true });
await mkdir(directory, { recursive: true });
for (const path of ["dist", ...documents]) {
await cp(`${source}/${path}`, `${directory}/${path}`, { recursive: true, verbatimSymlinks: true });
}
await writeFile(`${directory}/manifest.json`, JSON.stringify(manifest, null, 2) + "\n");
const archive = resolve(`release/mobile-dev-${manifest.version}-${name}-desktop-darwin-arm64.mcpb`);
await rm(archive, { force: true });
// MCPB is a ZIP with manifest.json at its root. Preserve executable modes.
execFileSync("zip", ["-qr", archive, "manifest.json", "dist", ...documents], { cwd: directory });
execFileSync("unzip", ["-tq", archive], { stdio: "inherit" });
console.log(`${host.label} Desktop bundle: ${archive}`);
}

// The same payload as the Codex package, without its manifest, .mcp.json or launcher.
const plugin = JSON.parse(await readFile(`${host.manifest}/plugin.json`, "utf8"));
plugin.version = metadata.version;
const directory = resolve(`release/${name}-plugin/${plugin.name}`);
await rm(directory, { recursive: true, force: true });
await mkdir(`${directory}/${host.manifest}`, { recursive: true });
for (const path of ["dist", "assets", "skills", ...documents]) {
await cp(`${source}/${path}`, `${directory}/${path}`, { recursive: true, verbatimSymlinks: true });
}
await writeFile(`${directory}/${host.manifest}/plugin.json`, JSON.stringify(plugin, null, 2) + "\n");
console.log(`${host.label} plugin: ${directory}`);
16 changes: 16 additions & 0 deletions scripts/plugin-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { access, mkdir, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import { pluginHost } from "./plugin-hosts.mjs";

// Generate a snippet only; never replace the user's existing host configuration.
const { config: host } = pluginHost(process.argv[2]);
await access("dist/server.mjs");
const config = {
mcpServers: {
"mobile-dev": { ...host.server, command: process.execPath, args: [resolve("dist/server.mjs")] },
},
};
await mkdir(".local-dev", { recursive: true });
const path = resolve(`.local-dev/${host.file}`);
await writeFile(path, JSON.stringify(config, null, 2) + "\n");
console.log(`Merge the mcpServers entry from ${path} into ${host.target}.`);
24 changes: 24 additions & 0 deletions scripts/plugin-hosts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Hosts that load the plugin folder through their own manifest. They start the server from
// PATH Node at the manifest's plugin-root variable; the updater stays off outside Codex.
export const pluginHosts = {
claude: {
label: "Claude", manifest: ".claude-plugin", root: "CLAUDE_PLUGIN_ROOT",
// Claude Desktop also installs a self-contained MCPB bundle.
desktopBundle: "claude-desktop/manifest.json",
config: { file: "claude-desktop-config.json", server: {}, target: "Claude Desktop Settings > Developer > Edit Config, then fully restart Claude" },
},
cursor: {
label: "Cursor", manifest: ".cursor-plugin", root: "CURSOR_PLUGIN_ROOT",
config: { file: "cursor-mcp.json", server: { type: "stdio" }, target: "~/.cursor/mcp.json, then reload Cursor" },
},
};

export const documents = ["README.md", "LICENSE", "THIRD_PARTY_NOTICES.md", "PRIVACY.md", "TERMS.md", "SUPPORT.md"];
// Codex-only files would load the Codex launcher or enable the Codex updater.
export const codexOnlyPaths = [".mcp.json", "mcp.json", ".codex-plugin", "scripts/launch-mcp.sh"];

export function pluginHost(name) {
const host = pluginHosts[name];
if (host === undefined) throw new Error(`Pass a host: ${Object.keys(pluginHosts).join(" or ")}.`);
return host;
}
110 changes: 0 additions & 110 deletions scripts/smoke-claude-package.mjs

This file was deleted.

Loading
Loading