The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.
JavaScript agent-skillsai-agentautomationbrowserbrowser-automationclaude-codecodexhermes-agentskillsskills-sh
feat(plugins): package ego-browser for nine agent hosts
JackWang03d729d4e25e
diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.jsonnew file mode 100644index 0000000..9cbd71e--- /dev/null+++ b/.agents/plugins/marketplace.json@@ -0,0 +1,20 @@+{+ "name": "ego-agent-skills",+ "interface": {+ "displayName": "Ego Agent Skills"+ },+ "plugins": [+ {+ "name": "ego",+ "source": {+ "source": "local",+ "path": "./plugins/ego"+ },+ "policy": {+ "installation": "AVAILABLE",+ "authentication": "ON_INSTALL"+ },+ "category": "Productivity"+ }+ ]+}diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex fff2cb5..ae4a6f7 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -7,16 +7,15 @@"email": "[email protected]"},"metadata": {- "description": "ego example skills",- "version": "1.0.0"+ "description": "ego-browser Skill plugins for AI agents",+ "version": "2.0.0"},"plugins": [{- "name": "browser-skills",+ "name": "ego",+ "version": "2.0.0","description": "Automates browser interactions for web testing, form filling, screenshots, and data extraction",- "source": "./",- "strict": false,- "skills": ["./skills/ego-browser"],+ "source": "./plugins/ego","category": "development"}]diff --git a/plugins/ego/.claude-plugin/plugin.json b/plugins/ego/.claude-plugin/plugin.jsonnew file mode 100644index 0000000..1864910--- /dev/null+++ b/plugins/ego/.claude-plugin/plugin.json@@ -0,0 +1,10 @@+{+ "name": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite"+}diff --git a/plugins/ego/.codebuddy-plugin/plugin.json b/plugins/ego/.codebuddy-plugin/plugin.jsonnew file mode 100644index 0000000..5a2b941--- /dev/null+++ b/plugins/ego/.codebuddy-plugin/plugin.json@@ -0,0 +1,15 @@+{+ "name": "ego",+ "displayName": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT",+ "keywords": ["browser", "automation", "skill", "playwright"],+ "skills": ["./skills/ego-browser"]+}diff --git a/plugins/ego/.codex-plugin/plugin.json b/plugins/ego/.codex-plugin/plugin.jsonnew file mode 100644index 0000000..e208ae7--- /dev/null+++ b/plugins/ego/.codex-plugin/plugin.json@@ -0,0 +1,26 @@+{+ "name": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]",+ "url": "https://github.com/citrolabs"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT",+ "keywords": ["browser", "automation", "skill", "playwright"],+ "skills": "./skills/",+ "interface": {+ "displayName": "ego",+ "shortDescription": "Automate the user's ego browser",+ "longDescription": "Control ego lite through the packaged ego-browser Skill while keeping agent browsing isolated from the user's own tabs.",+ "developerName": "citrolabs",+ "category": "Engineering",+ "capabilities": ["Interactive", "Read", "Write"],+ "defaultPrompt": [+ "Use ego-browser to inspect https://example.com and report its title."+ ]+ }+}diff --git a/plugins/ego/.cursor-plugin/plugin.json b/plugins/ego/.cursor-plugin/plugin.jsonnew file mode 100644index 0000000..15cc01f--- /dev/null+++ b/plugins/ego/.cursor-plugin/plugin.json@@ -0,0 +1,15 @@+{+ "name": "ego",+ "displayName": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT",+ "keywords": ["browser", "automation", "skill", "playwright"],+ "skills": "./skills/"+}diff --git a/plugins/ego/.qoder-plugin/plugin.json b/plugins/ego/.qoder-plugin/plugin.jsonnew file mode 100644index 0000000..5a2b941--- /dev/null+++ b/plugins/ego/.qoder-plugin/plugin.json@@ -0,0 +1,15 @@+{+ "name": "ego",+ "displayName": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT",+ "keywords": ["browser", "automation", "skill", "playwright"],+ "skills": ["./skills/ego-browser"]+}diff --git a/plugins/ego/.workbuddy-plugin/plugin.json b/plugins/ego/.workbuddy-plugin/plugin.jsonnew file mode 100644index 0000000..5a2b941--- /dev/null+++ b/plugins/ego/.workbuddy-plugin/plugin.json@@ -0,0 +1,15 @@+{+ "name": "ego",+ "displayName": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT",+ "keywords": ["browser", "automation", "skill", "playwright"],+ "skills": ["./skills/ego-browser"]+}diff --git a/plugins/ego/LICENSE b/plugins/ego/LICENSEnew file mode 100644index 0000000..ba089d2--- /dev/null+++ b/plugins/ego/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 CitroLabs++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/plugins/ego/README.md b/plugins/ego/README.mdnew file mode 100644index 0000000..db664a1--- /dev/null+++ b/plugins/ego/README.md@@ -0,0 +1,239 @@+# ego agent plugin++Package the same `ego-browser` Skill for nine agent hosts. Each distribution+contains only its host entry points, a complete copy of the canonical Skill,+and installation instructions for that host.++## Requirements++- macOS with ego lite installed and open+- `ego-browser` available on the agent's `PATH`+- An agent host that can read Skills and execute local shell commands++## Packaging++From the repository root, build all nine artifacts with one command:++```bash+npm --prefix plugins/ego run package+```++The output directory is `dist/plugins/ego-v2.0.0/`:++| Host | Artifact | Contents |+| ---------------- | --------------------------------- | --------------------------------------------------- |+| Claude Code | `ego-claude-code-v2.0.0.zip` | Claude plugin |+| Codex | `ego-codex-v2.0.0.zip` | Local marketplace and Codex plugin |+| Cursor | `ego-cursor-v2.0.0.zip` | Cursor plugin |+| GitHub Copilot | `ego-github-copilot-v2.0.0.zip` | Claude-compatible plugin |+| Grok Build | `ego-grok-build-v2.0.0.zip` | Agent Plugins manifest and Skill |+| WorkBuddy | `ego-workbuddy-v2.0.0.zip` | Local marketplace and WorkBuddy/CodeBuddy manifests |+| QwenWork Desktop | `ego-qwenwork-v2.0.0.zip` | Claude-compatible expert kit |+| OpenCode | `ego-opencode-v2.0.0.tgz` | `@citrolabs/ego-opencode` npm package |+| DeepSeek Harness | `ego-deepseek-harness-v2.0.0.tgz` | `@citrolabs/ego-deepseek-harness` npm bundle |++Every ZIP includes a host-specific `README.md` at its root; npm archives include+it under `package/`. Codex and WorkBuddy ZIPs contain a marketplace root with the+plugin under `plugins/ego/`. Other ZIPs start directly at the plugin root.++The two npm packages have separate names and exports so their adapters cannot+be confused by package caches. All nine packages contain real Skill files;+none depends on the source checkout or its symlink.++Override the output parent directory, or package all plugin directories:++```bash+npm --prefix plugins/ego run package -- --output /absolute/path/to/artifacts+node plugins/scripts/package-plugins.mjs --all+```++Each plugin gets its own `<name>-v<version>/` directory. Rebuilding replaces the+nine named artifacts only after all nine have been built. A build failure leaves+previous artifacts intact. Older universal ZIP/npm outputs outside the version+directory are left untouched and are no longer generated.++Packaging requires Node.js, npm, `zip`, and `unzip`. Run this command instead of+`npm pack` in the source directory: npm omits the linked Skill when packing the+source directly.++## Installation++Choose the artifact for the host. Extract ZIPs into a persistent local directory+unless the host accepts ZIP upload. The paths below are placeholders for that+directory or the downloaded npm archive. Each packaged README repeats only the+matching section and the requirements above.++### Claude Code++Extract the Claude Code ZIP, then load its plugin directory for a session:++```bash+claude --plugin-dir /absolute/path/to/ego-claude-code+```++Use `/ego:ego-browser`. This flag loads the plugin for that session. Persistent+installation uses a plugin marketplace; the repository marketplace exposes+`ego@ego-agent-skills` when that source version is available.++See the [Claude Code plugin reference](https://code.claude.com/docs/en/plugins-reference).++### Codex++Extract the Codex ZIP, keeping `.agents/plugins/marketplace.json` and+`plugins/ego/` together. Add the extracted marketplace root:++```bash+codex plugin marketplace add /absolute/path/to/ego-codex+codex plugin add ego@ego-codex-local+```++Restart Codex if the plugin does not appear, then ask it to use `$ego-browser`.+The contained plugin uses `.codex-plugin/plugin.json`. Remove the installed+plugin with `codex plugin remove ego@ego-codex-local`.++See the [OpenAI plugin guide](https://developers.openai.com/plugins/build/plugins).++### Cursor++Extract the Cursor ZIP and load it with Cursor CLI:++```bash+cursor-agent --plugin-dir /absolute/path/to/ego-cursor+```++The package declares its Skill through `.cursor-plugin/plugin.json`. Use+`/ego-browser` in the session. This command does not install a Cursor Desktop+marketplace entry.++### GitHub Copilot++Extract the GitHub Copilot ZIP and load it with Copilot CLI:++```bash+copilot --plugin-dir /absolute/path/to/ego-github-copilot+```++Use `/ego-browser`. This local session uses the packaged Claude-compatible+manifest. VS Code marketplace installation is a separate host workflow.++Check the Skill's source when a personal `ego-browser` Skill is already+installed. In the tested Copilot CLI, the personal copy takes precedence over+the plugin copy, and a disabled personal copy prevents the plugin Skill from+being invoked. Resolve that duplicate and enable the plugin Skill before use.++See the [GitHub Copilot plugin guide](https://docs.github.com/en/copilot/concepts/agents/about-plugins).++### Grok Build++Extract the Grok Build ZIP, then install the local directory:++```bash+grok plugin install /absolute/path/to/ego-grok-build+```++Use `/ego-browser`. The package contains the Agent Plugins `plugin.json` and+Skill directory. Remove it with `grok plugin uninstall ego`.++### WorkBuddy++Extract the WorkBuddy ZIP as a marketplace root. It contains+`.claude-plugin/marketplace.json` and `plugins/ego/`, including+`.codebuddy-plugin/plugin.json`, `.workbuddy-plugin/plugin.json`, and the+Claude-compatible manifest.++For WorkBuddy versions that expose **添加市场** with local sources, add the+absolute path of the extracted root, select **ego-workbuddy-local**, and install+**ego**. Start a new task and ask it to use the ego-browser Skill.++Local marketplace import still needs verification in WorkBuddy Desktop. The+[official WorkBuddy plugin guide](https://www.codebuddy.cn/docs/workbuddy/From-Beginner-to-Expert-Guide/Function-Description/Plug-In)+documents marketplace installation but does not establish a direct ZIP import+workflow. If the installed version only accepts a published marketplace, this+local archive must be distributed through that supported marketplace first.++### QwenWork Desktop++Upload the QwenWork ZIP directly through **扩展 → 专家套件 → + 添加 → 上传套件**,+then click **安装**. Start a new task and ask it to use ego-browser.++This package uses `.claude-plugin/plugin.json`, an explicitly supported expert+kit format. The older `.qoder-plugin/plugin.json` source manifest is not used+for this artifact. See the [QwenWork expert-kit guide](https://qwenwork.cn/docs/desktop/expert-kits).++### OpenCode++Extract the local npm archive into a persistent directory, then register its+JavaScript entry point:++```bash+mkdir -p /absolute/path/to/ego-opencode+tar -xzf /absolute/path/to/ego-opencode-v2.0.0.tgz -C /absolute/path/to/ego-opencode+opencode plugin "file:///absolute/path/to/ego-opencode/package/index.js" -g+```++Keep the extracted directory in place. OpenCode 1.14.30 accepts a local `.tgz`+in its installer but fails to resolve that archive's server entry at startup;+the extracted file URL loads successfully. Remove any earlier `.tgz` entry+from the config's `plugin` array when switching to the file URL.++The package is named `@citrolabs/ego-opencode`. Its `.` and `./server` exports+load `index.js`, which adds the packaged Skill instructions and `/ego-browser`+command. To remove it, delete its entry from the applicable `opencode.json`+`plugin` array.++See the [OpenCode plugin guide](https://opencode.ai/docs/plugins/).++### DeepSeek Harness++Extract the npm archive into a persistent directory, then add its `package/`+directory to the desired profile:++```bash+mkdir -p /absolute/path/to/ego-deepseek-harness+tar -xzf /absolute/path/to/ego-deepseek-harness-v2.0.0.tgz -C /absolute/path/to/ego-deepseek-harness+dsh plugin --profile web add /absolute/path/to/ego-deepseek-harness/package+dsh --profile web --dump-config+dsh --profile web+```++The package is named `@citrolabs/ego-deepseek-harness`. Its bundle patch loads+`@citrolabs/ego-deepseek-harness/dsh` and registers the packaged Skill. Use+`/ego-browser`. Remove it with+`dsh plugin --profile web remove @citrolabs/ego-deepseek-harness`.++An existing personal `ego-browser` Skill takes precedence over this bundled+provider. Check the base directory returned by the Skill tool: it must point+inside this extracted package when validating the plugin. Resolve the duplicate+personal Skill if you want named invocation to use the plugin copy.++See the [DeepSeek Harness local package guide](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/user/develop/basic/publish.md).++## Verification++Packaging tests check all nine payloads, marketplace paths, canonical Skill+contents, source symlink preservation, repeat builds, and failed-batch handling.+They load both npm adapters after extraction outside the repository. These+checks do not establish end-to-end compatibility in all nine host applications.++After installation, confirm that the host discovers ego-browser and can run:++```bash+ego-browser nodejs <<'EOF'+console.log('ego-browser ready')+EOF+```++## Development++`skills/ego-browser` is a relative symlink to `../../../skills/ego-browser`.+Edit the canonical Skill; the packager materializes it in temporary directories+and leaves the source link untouched. Unexpected or broken links fail packaging.++Plugin tests belong in `plugins/ego/tests/` and run independently of browser+runtime tests:++```bash+npm --prefix plugins/ego test+```++CI and the commit hook run this suite for plugin changes.diff --git a/plugins/ego/cordis.patch.yml b/plugins/ego/cordis.patch.ymlnew file mode 100644index 0000000..a2557ac--- /dev/null+++ b/plugins/ego/cordis.patch.yml@@ -0,0 +1,3 @@+- insert:+ - id: ego+ name: '@citrolabs/ego/dsh'diff --git a/plugins/ego/dsh/src/index.js b/plugins/ego/dsh/src/index.jsnew file mode 100644index 0000000..d224ee3--- /dev/null+++ b/plugins/ego/dsh/src/index.js@@ -0,0 +1,89 @@+import { readFileSync } from "node:fs";+import { dirname } from "node:path";+import { fileURLToPath } from "node:url";++const SKILL_URL = new URL("../../skills/ego-browser/SKILL.md", import.meta.url);+const SKILL_PATH = fileURLToPath(SKILL_URL);+const SKILL_DIRECTORY = dirname(SKILL_PATH);+const INVOCATION = Object.freeze({+ modelInvocable: true,+ userInvocable: true,+});++function scalar(value) {+ const trimmed = value.trim();+ if (+ (trimmed.startsWith('"') && trimmed.endsWith('"')) ||+ (trimmed.startsWith("'") && trimmed.endsWith("'"))+ ) {+ return trimmed.slice(1, -1);+ }+ return trimmed;+}++function readPackagedSkill() {+ const source = readFileSync(SKILL_URL, "utf8");+ const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(source);+ if (!match) throw new Error(`Invalid Skill frontmatter: ${SKILL_PATH}`);++ const frontmatter = match[1];+ const field = (name) => {+ const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(frontmatter)?.[1];+ if (!value) throw new Error(`Skill frontmatter requires ${name}`);+ return scalar(value);+ };++ return Object.freeze({+ name: field("name"),+ description: field("description"),+ content: match[2].trimStart(),+ });+}++const PACKAGED_SKILL = readPackagedSkill();+const RESOURCE_BASE = Object.freeze({+ kind: "directory",+ path: SKILL_DIRECTORY,+});+const SKILL_CANDIDATE = Object.freeze({+ name: PACKAGED_SKILL.name,+ description: PACKAGED_SKILL.description,+ invocation: INVOCATION,+ provider: "ego",+ source: "bundled",+ resourceBase: RESOURCE_BASE,+ rank: 600,+ locator: SKILL_PATH,+ path: SKILL_PATH,+});+const SKILL_PROVIDER = Object.freeze({+ name: "ego",+ async list() {+ return [SKILL_CANDIDATE];+ },+ async get(candidate) {+ if (+ candidate?.name !== SKILL_CANDIDATE.name ||+ candidate?.locator !== SKILL_CANDIDATE.locator+ ) {+ return undefined;+ }+ return {+ name: PACKAGED_SKILL.name,+ description: PACKAGED_SKILL.description,+ invocation: INVOCATION,+ provider: "ego",+ source: "bundled",+ resourceBase: RESOURCE_BASE,+ path: SKILL_PATH,+ content: PACKAGED_SKILL.content,+ };+ },+});++export const name = "ego";+export const inject = ["skills"];++export function apply(ctx) {+ ctx.skills.registerProvider(() => SKILL_PROVIDER);+}diff --git a/plugins/ego/index.js b/plugins/ego/index.jsnew file mode 100644index 0000000..bd7ea7d--- /dev/null+++ b/plugins/ego/index.js@@ -0,0 +1,21 @@+import { fileURLToPath } from "node:url";++const skillPath = fileURLToPath(+ new URL("./skills/ego-browser/SKILL.md", import.meta.url),+);++export const EgoBrowserPlugin = async () => ({+ config: async (config) => {+ config.instructions ??= [];+ if (!config.instructions.includes(skillPath)) {+ config.instructions.push(skillPath);+ }++ config.command ??= {};+ config.command["ego-browser"] ??= {+ description: "Automate the browser with ego-browser",+ template:+ "Follow the installed ego-browser Skill for this request: $ARGUMENTS",+ };+ },+});diff --git a/plugins/ego/package.json b/plugins/ego/package.jsonnew file mode 100644index 0000000..c8e11a0--- /dev/null+++ b/plugins/ego/package.json@@ -0,0 +1,49 @@+{+ "name": "@citrolabs/ego",+ "version": "2.0.0",+ "description": "Portable ego-browser Skill for AI agent hosts",+ "type": "module",+ "scripts": {+ "test": "node --test \"tests/**/*.test.mjs\"",+ "package": "node ../scripts/package-plugins.mjs ego"+ },+ "exports": {+ ".": "./index.js",+ "./server": "./index.js",+ "./dsh": "./dsh/src/index.js"+ },+ "files": [+ "LICENSE",+ "plugin.json",+ ".claude-plugin",+ ".codex-plugin",+ ".cursor-plugin",+ ".codebuddy-plugin",+ ".workbuddy-plugin",+ ".qoder-plugin",+ "index.js",+ "cordis.patch.yml",+ "dsh",+ "skills",+ "README.md"+ ],+ "dsh": {+ "bundle": {+ "patch": "./cordis.patch.yml"+ }+ },+ "keywords": [+ "agent-plugin",+ "deepseek-harness",+ "opencode",+ "browser",+ "automation",+ "skill"+ ],+ "author": "citrolabs",+ "license": "MIT",+ "homepage": "https://github.com/citrolabs/ego-lite",+ "publishConfig": {+ "access": "public"+ }+}diff --git a/plugins/ego/plugin.json b/plugins/ego/plugin.jsonnew file mode 100644index 0000000..871bd98--- /dev/null+++ b/plugins/ego/plugin.json@@ -0,0 +1,13 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ "name": "ego",+ "version": "2.0.0",+ "description": "Browser automation with the ego-browser Skill",+ "author": {+ "name": "citrolabs",+ "email": "[email protected]"+ },+ "homepage": "https://github.com/citrolabs/ego-lite",+ "repository": "https://github.com/citrolabs/ego-lite",+ "license": "MIT"+}diff --git a/plugins/ego/skills/ego-browser b/plugins/ego/skills/ego-browsernew file mode 120000index 0000000..a363356--- /dev/null+++ b/plugins/ego/skills/ego-browser@@ -0,0 +1 @@+../../../skills/ego-browser\ No newline at end of filediff --git a/plugins/ego/tests/claude-plugin-mode-isolation.test.mjs b/plugins/ego/tests/claude-plugin-mode-isolation.test.mjsnew file mode 100644index 0000000..796b9fb--- /dev/null+++ b/plugins/ego/tests/claude-plugin-mode-isolation.test.mjs@@ -0,0 +1,179 @@+import assert from "node:assert/strict";+import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";+import test from "node:test";++const repoFile = (path) => new URL(`../../../${path}`, import.meta.url);++const standaloneSkillPath = "skills/ego-browser/SKILL.md";+const claudePluginRoot = "plugins/ego";+const claudeManifestPath = `${claudePluginRoot}/.claude-plugin/plugin.json`;+const claudeSkillPath = `${claudePluginRoot}/skills/ego-browser/SKILL.md`;+const claudeSkillSupportPaths = [+ `${claudePluginRoot}/skills/ego-browser/references/install.md`,+ `${claudePluginRoot}/skills/ego-browser/references/api.md`,+ `${claudePluginRoot}/skills/ego-browser/references/clearing-state.md`,+ `${claudePluginRoot}/skills/ego-browser/scripts/install.sh`,+];+const runtimeTerms =+ /\b(?:REPL|MCP|Bun)\b|\brepl_(?:start|eval|read|status|interrupt|stop)\b/i;++function readRequiredFile(path) {+ const url = repoFile(path);+ assert.equal(existsSync(url), true, `${path} must exist`);+ return readFileSync(url, "utf8");+}++function assertMissing(path) {+ assert.equal(existsSync(repoFile(path)), false, `${path} must not exist`);+}++function assertPureSkillText(value, label) {+ assert.doesNotMatch(value, runtimeTerms, `${label} must use the browser CLI`);+}++function assertTaskSpaceSafety(skill, label) {+ assert.match(+ skill,+ /exactly one TaskSpace for the entire user goal/i,+ `${label} must keep one TaskSpace per user goal`,+ );+ assert.match(+ skill,+ /resume that same space in later rounds/i,+ `${label} must resume the existing TaskSpace across rounds`,+ );+ assert.match(+ skill,+ /Claim a user-owned or inactive space only when the\s+user explicitly asks/i,+ `${label} must not implicitly claim a user-owned TaskSpace`,+ );+ assert.match(+ skill,+ /Stop when the user takes control[\s\S]*Do not\s+retry or route around the stop/i,+ `${label} must stop when the user takes control`,+ );+ assert.match(+ skill,+ /After the user confirms, resume the\s+same space:[\s\S]*takeOverTaskSpace\(7\)/i,+ `${label} must wait for user confirmation before resuming a handoff`,+ );+ assert.match(+ skill,+ /task\.finish\(\{ keep: \[\] \}\)/,+ `${label} must document cleanup`,+ );+ assert.match(+ skill,+ /Call `finish\(\)` exactly once and wait for it\s+to resolve before reporting completion/i,+ `${label} must wait for cleanup before reporting completion`,+ );+ assert.match(+ skill,+ /does not verify the resulting application state/i,+ `${label} must distinguish action receipts from verified outcomes`,+ );+}++test("Claude marketplace routes the plugin to its portable subtree", () => {+ const marketplace = JSON.parse(+ readRequiredFile(".claude-plugin/marketplace.json"),+ );++ assert.equal(marketplace.plugins?.length, 1);+ assert.equal(marketplace.plugins[0].source, `./${claudePluginRoot}`);+});++test("Claude plugin subtree contains its manifest and complete Skill only", () => {+ for (const path of [+ claudeManifestPath,+ claudeSkillPath,+ ...claudeSkillSupportPaths,+ ]) {+ readRequiredFile(path);+ }++ assertMissing(`${claudePluginRoot}/.mcp.json`);+ assertMissing(`${claudePluginRoot}/mcp.json`);+ assertMissing(`${claudePluginRoot}/mcp`);+ assertMissing(`${claudePluginRoot}/commands`);+});++test("Claude plugin versions align without an executable runtime", () => {+ const marketplace = JSON.parse(+ readRequiredFile(".claude-plugin/marketplace.json"),+ );+ const source = readRequiredFile(claudeManifestPath);+ const manifest = JSON.parse(source);+ const skill = readRequiredFile(claudeSkillPath);++ assert.equal(manifest.name, marketplace.plugins[0].name);+ assert.equal(manifest.version, marketplace.plugins[0].version);+ assert.match(skill, new RegExp(`version: ["']${manifest.version}["']`));+ assertPureSkillText(source, "Claude plugin manifest");+});++test("Claude plugin publishes under the ego install and slash namespace", () => {+ const marketplace = JSON.parse(+ readRequiredFile(".claude-plugin/marketplace.json"),+ );+ const manifest = JSON.parse(readRequiredFile(claudeManifestPath));+ const pluginReadme = readRequiredFile(`${claudePluginRoot}/README.md`);++ assert.equal(marketplace.plugins[0].name, "ego");+ assert.equal(manifest.name, "ego");+ assert.match(pluginReadme, /claude --plugin-dir/);+ assert.match(pluginReadme, /ego@ego-agent-skills/);+ assert.match(pluginReadme, /\/ego:ego-browser/);+ assert.doesNotMatch(pluginReadme, /ego-skills|browser-skills/);+});++test("standalone Skill keeps the heredoc execution contract", () => {+ const skill = readRequiredFile(standaloneSkillPath);++ assert.match(skill, /ego-browser nodejs <<'EOF'/);+ assertPureSkillText(skill, "standalone Skill");+});++test("portable Skill and support files use the same heredoc contract", () => {+ const standalone = readRequiredFile(standaloneSkillPath);+ const portable = readRequiredFile(claudeSkillPath);+ const support = claudeSkillSupportPaths.map(readRequiredFile).join("\n");++ assert.equal(portable, standalone);+ assert.match(portable, /ego-browser nodejs <<'EOF'/);+ assertPureSkillText(`${portable}\n${support}`, "portable Skill package");+});++test("portable Skill restores v2 Pages across script rounds", () => {+ const skill = readRequiredFile(claudeSkillPath);++ assert.match(+ skill,+ /Every invocation starts a new Node\.js process[\s\S]*Page labels\s+persist; JavaScript variables do not/i,+ );+ assert.match(skill, /await taskSpace\(7\);[\s\S]*resumed\.page\("p1"\)/);+ assert.match(skill, /After the page changes, take a new snapshot/);+ assert.doesNotMatch(+ skill,+ /switchTaskSpace|completeTaskSpace|closeTaskSpace/,+ );+});++test("source plugin links directly to the canonical Skill", () => {+ const canonicalRoot = "skills/ego-browser";+ const packagedRoot = `${claudePluginRoot}/skills/ego-browser`;+ assert.equal(lstatSync(repoFile(packagedRoot)).isSymbolicLink(), true);+ assert.equal(+ realpathSync(repoFile(packagedRoot)),+ realpathSync(repoFile(canonicalRoot)),+ );+});++test("both Skill copies preserve TaskSpace safety policy", () => {+ for (const [label, path] of [+ ["standalone Skill", standaloneSkillPath],+ ["portable Skill", claudeSkillPath],+ ]) {+ assertTaskSpaceSafety(readRequiredFile(path), label);+ }+});diff --git a/plugins/ego/tests/cross-host-plugin.test.mjs b/plugins/ego/tests/cross-host-plugin.test.mjsnew file mode 100644index 0000000..dd84795--- /dev/null+++ b/plugins/ego/tests/cross-host-plugin.test.mjs@@ -0,0 +1,268 @@+import assert from "node:assert/strict";+import { existsSync, readFileSync } from "node:fs";+import test from "node:test";++const repoFile = (path) => new URL(`../../../${path}`, import.meta.url);+const pluginRoot = "plugins/ego";+const runtimeTerms =+ /\b(?:MCP|REPL|Bun)\b|\brepl_(?:start|eval|read|status|interrupt|stop)\b/i;+const skillVersion = read("skills/ego-browser/SKILL.md").match(+ /^\s+version: "([^"]+)"/m,+)[1];++function read(path) {+ const url = repoFile(path);+ assert.equal(existsSync(url), true, `${path} must exist`);+ return readFileSync(url, "utf8");+}++function json(path) {+ return JSON.parse(read(path));+}++function assertMissing(path) {+ assert.equal(existsSync(repoFile(path)), false, `${path} must not exist`);+}++function assertPureSkillText(value, label) {+ assert.doesNotMatch(+ value,+ runtimeTerms,+ `${label} must not require a runtime`,+ );+}++test("one pure-Skill portable root serves Agent Plugins hosts", () => {+ const source = read(`${pluginRoot}/plugin.json`);+ const manifest = JSON.parse(source);++ assert.equal(+ manifest.$schema,+ "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ );+ assert.equal(manifest.name, "ego");+ assert.equal(manifest.version, skillVersion);+ assertPureSkillText(source, "Agent Plugins manifest");+ read(`${pluginRoot}/skills/ego-browser/SKILL.md`);+ assertMissing(`${pluginRoot}/mcp.json`);+});++test("branded hosts expose explicit pure-Skill manifests", () => {+ const shared = json(`${pluginRoot}/plugin.json`);+ const pkg = json(`${pluginRoot}/package.json`);++ for (const [host, path, skills] of [+ ["Cursor", ".cursor-plugin/plugin.json", "./skills/"],+ ["CodeBuddy", ".codebuddy-plugin/plugin.json", ["./skills/ego-browser"]],+ ["WorkBuddy", ".workbuddy-plugin/plugin.json", ["./skills/ego-browser"]],+ ["QoderWork", ".qoder-plugin/plugin.json", ["./skills/ego-browser"]],+ ]) {+ const source = read(`${pluginRoot}/${path}`);+ const manifest = JSON.parse(source);++ assert.equal(manifest.name, shared.name, `${host} name must stay aligned`);+ assert.equal(+ manifest.version,+ shared.version,+ `${host} version must stay aligned`,+ );+ assert.equal(+ manifest.description,+ shared.description,+ `${host} description must stay aligned`,+ );+ assert.deepEqual(+ manifest.author,+ shared.author,+ `${host} author must stay aligned`,+ );+ assert.deepEqual(manifest.skills, skills, `${host} must declare its Skill`);+ assert.equal(Object.hasOwn(manifest, "mcpServers"), false);+ assert.equal(Object.hasOwn(manifest, "commands"), false);+ assertPureSkillText(source, `${host} manifest`);+ }++ assert.deepEqual(+ json(`${pluginRoot}/.codebuddy-plugin/plugin.json`),+ json(`${pluginRoot}/.workbuddy-plugin/plugin.json`),+ "WorkBuddy's authoritative and branded manifests must not drift",+ );++ for (const path of [+ "plugin.json",+ ".claude-plugin",+ ".codex-plugin",+ ".cursor-plugin",+ ".codebuddy-plugin",+ ".workbuddy-plugin",+ ".qoder-plugin",+ ]) {+ assert.ok(pkg.files.includes(path), `${path} must ship in the npm package`);+ }+});++test("Claude compatibility files expose only the portable Skill", () => {+ const marketplace = json(".claude-plugin/marketplace.json");+ const source = read(`${pluginRoot}/.claude-plugin/plugin.json`);+ const manifest = JSON.parse(source);++ assert.equal(marketplace.plugins[0].name, "ego");+ assert.equal(marketplace.plugins[0].source, `./${pluginRoot}`);+ assert.equal(manifest.name, "ego");+ assert.equal(manifest.version, skillVersion);+ assert.equal(marketplace.metadata.version, manifest.version);+ assertPureSkillText(source, "Claude manifest");+ assertMissing(`${pluginRoot}/.mcp.json`);+});++test("Codex marketplace and manifest expose the same pure-Skill plugin", () => {+ const marketplace = json(".agents/plugins/marketplace.json");+ const source = read(`${pluginRoot}/.codex-plugin/plugin.json`);+ const manifest = JSON.parse(source);+ const entry = marketplace.plugins.find((item) => item.name === "ego");++ assert.equal(marketplace.name, "ego-agent-skills");+ assert.deepEqual(entry.source, {+ source: "local",+ path: "./plugins/ego",+ });+ assert.equal(entry.policy.installation, "AVAILABLE");+ assert.equal(entry.policy.authentication, "ON_INSTALL");+ assert.equal(manifest.name, "ego");+ assert.equal(manifest.version, skillVersion);+ assert.equal(manifest.skills, "./skills/");+ assert.equal(Object.hasOwn(manifest, "mcpServers"), false);+ assertPureSkillText(source, "Codex manifest");+});++test("OpenCode adapter injects only instructions and the Skill slash command", async () => {+ const pkgSource = read(`${pluginRoot}/package.json`);+ const pkg = JSON.parse(pkgSource);+ assert.equal(pkg.name, "@citrolabs/ego");+ assert.equal(pkg.version, skillVersion);+ assert.equal(pkg.exports["."], "./index.js");+ assert.equal(pkg.exports["./server"], "./index.js");+ assert.equal(pkg.exports["./dsh"], "./dsh/src/index.js");+ assert.ok(pkg.files.includes("skills"));+ assert.ok(pkg.files.every((path) => !/^mcp(?:\/|$)/i.test(path)));+ assertPureSkillText(pkgSource, "npm package metadata");++ const adapterSource = read(`${pluginRoot}/index.js`);+ const { EgoBrowserPlugin } = await import(+ new URL(`../../../${pluginRoot}/index.js`, import.meta.url)+ );+ const hooks = await EgoBrowserPlugin({});+ const config = {};+ await hooks.config(config);++ assert.equal(config.mcp, undefined);+ assert.equal(config.instructions.length, 1);+ assert.match(+ config.instructions[0],+ /plugins\/ego\/skills\/ego-browser\/SKILL\.md$/,+ );+ assert.match(config.command["ego-browser"].template, /\$ARGUMENTS/);+ assertPureSkillText(adapterSource, "OpenCode adapter");+ assertPureSkillText(+ config.command["ego-browser"].template,+ "OpenCode slash command",+ );+});++test("portable Skill is the standalone heredoc Skill without runtime tools", () => {+ const standalone = read("skills/ego-browser/SKILL.md");+ const portable = read(`${pluginRoot}/skills/ego-browser/SKILL.md`);++ assert.equal(portable, standalone);+ assert.match(portable, /ego-browser nodejs <<'EOF'/);+ assertPureSkillText(portable, "portable Skill");+});++test("DeepSeek Harness adapter registers only the packaged Skill", () => {+ const pkg = json(`${pluginRoot}/package.json`);+ const patch = read(`${pluginRoot}/cordis.patch.yml`);+ const adapter = read(`${pluginRoot}/dsh/src/index.js`);++ assert.deepEqual(pkg.dsh, {+ bundle: { patch: "./cordis.patch.yml" },+ });+ assert.ok(pkg.files.includes("cordis.patch.yml"));+ assert.ok(pkg.files.includes("dsh"));+ assert.ok(pkg.files.every((path) => !/^mcp(?:\/|$)/i.test(path)));+ assert.match(patch, /name:\s*['"]?@citrolabs\/ego\/dsh['"]?/);+ assert.match(adapter, /ctx\.skills\.registerProvider/);+ assert.doesNotMatch(+ adapter,+ /ctx\.tools\.register|\bsubprocess\b|ReplSession|createAgentSessionPool|spawnDshTerminal|repl_/i,+ );+ assertMissing(`${pluginRoot}/dsh/src/agent-session-pool.js`);+ assertMissing(`${pluginRoot}/dsh/src/terminal-adapter.js`);+});++test("portable plugin contains no MCP or persistent-REPL runtime artifacts", () => {+ for (const path of [+ `${pluginRoot}/mcp.json`,+ `${pluginRoot}/.mcp.json`,+ `${pluginRoot}/mcp`,+ `${pluginRoot}/dsh/src/agent-session-pool.js`,+ `${pluginRoot}/dsh/src/terminal-adapter.js`,+ ]) {+ assertMissing(path);+ }+});++test("portable plugin ships the repository license", () => {+ assert.equal(read(`${pluginRoot}/LICENSE`), read("LICENSE"));+});++test("portable Skill includes Codex UI metadata", () => {+ const metadata = read(`${pluginRoot}/skills/ego-browser/agents/openai.yaml`);++ assert.match(metadata, /display_name: ["']ego-browser["']/);+ assert.match(metadata, /short_description:/);+ assert.match(metadata, /default_prompt: ["'][^"']*\$ego-browser/);+});++test("standalone Skill remains the heredoc source of truth", () => {+ const skill = read("skills/ego-browser/SKILL.md");+ assert.match(skill, /ego-browser nodejs <<'EOF'/);+ assertPureSkillText(skill, "standalone Skill");+});++test("plugin README documents every host as a pure-Skill install", () => {+ const readme = read(`${pluginRoot}/README.md`);++ for (const host of [+ "Claude Code",+ "Codex",+ "Cursor",+ "GitHub Copilot",+ "Grok Build",+ "WorkBuddy",+ "QwenWork Desktop",+ "OpenCode",+ "DeepSeek Harness",+ ]) {+ assert.match(readme, new RegExp(`### ${host}\\b`));+ }++ assert.match(readme, /claude --plugin-dir/);+ assert.match(readme, /codex plugin add ego@ego-codex-local/);+ assert.match(readme, /cursor-agent[\s\\]*--plugin-dir/);+ assert.match(readme, /\.cursor-plugin\/plugin\.json/);+ assert.match(readme, /copilot --plugin-dir/);+ assert.match(readme, /grok plugin install \/absolute\/path/);+ assert.match(readme, /\.codebuddy-plugin\/plugin\.json/);+ assert.match(readme, /\.workbuddy-plugin\/plugin\.json/);+ assert.match(readme, /\.qoder-plugin\/plugin\.json/);+ assert.match(readme, /opencode plugin "file:/);+ assert.match(readme, /dsh plugin --profile web add \/absolute\/path/);+ assert.match(+ readme,+ new RegExp(+ `dist/plugins/ego-v${json(`${pluginRoot}/plugin.json`).version}/`,+ ),+ );+ assert.match(readme, /ego-browser nodejs <<'EOF'/);+ assertPureSkillText(readme, "plugin README");+});diff --git a/plugins/ego/tests/dsh-plugin.test.mjs b/plugins/ego/tests/dsh-plugin.test.mjsnew file mode 100644index 0000000..7ca5911--- /dev/null+++ b/plugins/ego/tests/dsh-plugin.test.mjs@@ -0,0 +1,136 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { dirname } from "node:path";+import { fileURLToPath } from "node:url";+import test from "node:test";++const dshPluginUrl = new URL(+ "../../../plugins/ego/dsh/src/index.js",+ import.meta.url,+);+const packagedSkillUrl = new URL(+ "../../../plugins/ego/skills/ego-browser/SKILL.md",+ import.meta.url,+);++function forbiddenService(name) {+ throw new Error(`Skill-only DSH plugin must not access ctx.${name}`);+}++function skillOnlyContext() {+ const providers = [];+ const ctx = {+ skills: {+ register() {+ throw new Error("Packaged Skill must use bundled provider precedence");+ },+ registerProvider(create) {+ providers.push(+ create({+ signal: new AbortController().signal,+ invalidate() {},+ }),+ );+ return () => {};+ },+ },+ get tools() {+ return forbiddenService("tools");+ },+ get subprocess() {+ return forbiddenService("subprocess");+ },+ get commands() {+ return forbiddenService("commands");+ },+ get agents() {+ return forbiddenService("agents");+ },+ on() {+ return forbiddenService("on");+ },+ effect() {+ return forbiddenService("effect");+ },+ };+ return { ctx, providers };+}++test("DSH plugin exposes only the Skill service contract", async () => {+ const plugin = await import(dshPluginUrl);++ assert.equal(plugin.name, "ego");+ assert.deepEqual(plugin.inject, ["skills"]);+ assert.equal(+ Object.hasOwn(plugin, "createDshToolDefinitions"),+ false,+ "Skill-only DSH plugin must not expose native REPL tool builders",+ );+});++test("packaged plugin Skill uses heredoc and contains no repl tools", () => {+ const skill = readFileSync(packagedSkillUrl, "utf8");++ assert.match(skill, /ego-browser nodejs <<'EOF'/);+ assert.doesNotMatch(+ skill,+ /\brepl_(?:start|eval|read|status|interrupt|stop)\b/,+ );+});++test("DSH registers only the packaged Skill as a bundled provider", async () => {+ const { apply } = await import(dshPluginUrl);+ const harness = skillOnlyContext();++ apply(harness.ctx);++ assert.equal(harness.providers.length, 1);+ const provider = harness.providers[0];+ assert.equal(provider.name, "ego");++ const expectedPath = fileURLToPath(packagedSkillUrl);+ const resourceBase = {+ kind: "directory",+ path: dirname(expectedPath),+ };+ const invocation = {+ modelInvocable: true,+ userInvocable: true,+ };+ const candidates = await provider.list({ cwd: "/tmp/project" });+ assert.equal(candidates.length, 1);+ const candidate = candidates[0];+ assert.equal(candidate.name, "ego-browser");+ const canonical = readFileSync(+ new URL("../../../skills/ego-browser/SKILL.md", import.meta.url),+ "utf8",+ );+ assert.equal(+ candidate.description,+ canonical.match(/^description: (.+)$/m)[1],+ );+ assert.equal(candidate.provider, "ego");+ assert.equal(candidate.source, "bundled");+ assert.equal(candidate.rank, 600);+ assert.deepEqual(candidate.invocation, invocation);+ assert.deepEqual(candidate.resourceBase, resourceBase);++ const skill = await provider.get(candidate, { cwd: "/tmp/project" });+ assert.equal(skill.name, "ego-browser");+ assert.equal(skill.description, candidate.description);+ assert.equal(skill.provider, "ego");+ assert.equal(skill.source, "bundled");+ assert.match(skill.content, /^# ego-browser\b/);+ assert.equal(+ skill.content,+ canonical.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trimStart(),+ );+ assert.match(skill.content, /ego-browser nodejs <<'EOF'/);+ assert.doesNotMatch(+ skill.content,+ /\brepl_(?:start|eval|read|status|interrupt|stop)\b/,+ );+ assert.equal(skill.path, expectedPath);+ assert.deepEqual(skill.resourceBase, resourceBase);+ assert.deepEqual(skill.invocation, invocation);+});diff --git a/plugins/ego/tests/plugin-packaging.test.mjs b/plugins/ego/tests/plugin-packaging.test.mjsnew file mode 100644index 0000000..e888dcb--- /dev/null+++ b/plugins/ego/tests/plugin-packaging.test.mjs@@ -0,0 +1,510 @@+import assert from "node:assert/strict";+import {+ copyFileSync,+ existsSync,+ lstatSync,+ mkdirSync,+ mkdtempSync,+ readFileSync,+ readlinkSync,+ readdirSync,+ rmSync,+ symlinkSync,+ writeFileSync,+} from "node:fs";+import { tmpdir } from "node:os";+import { dirname, join, relative } from "node:path";+import { spawnSync } from "node:child_process";+import { fileURLToPath } from "node:url";+import test from "node:test";++const repositoryRoot = fileURLToPath(new URL("../../..", import.meta.url));+const targets = [+ ["claude-code", "Claude Code", [".claude-plugin"]],+ ["codex", "Codex", [".codex-plugin"], ".agents/plugins/marketplace.json"],+ ["cursor", "Cursor", [".cursor-plugin"]],+ ["github-copilot", "GitHub Copilot", [".claude-plugin"]],+ ["grok-build", "Grok Build", []],+ [+ "workbuddy",+ "WorkBuddy",+ [".claude-plugin", ".codebuddy-plugin", ".workbuddy-plugin"],+ ".claude-plugin/marketplace.json",+ ],+ ["qwenwork", "QwenWork Desktop", [".claude-plugin"]],+ ["opencode", "OpenCode"],+ ["deepseek-harness", "DeepSeek Harness"],+];++function write(path, value) {+ mkdirSync(dirname(path), { recursive: true });+ writeFileSync(path, value);+}+function writeJson(path, value) {+ write(path, `${JSON.stringify(value, null, 2)}\n`);+}++function addPlugin(root, name, version, skillName) {+ const pluginRoot = join(root, "plugins", name);+ const manifest = {+ name,+ version,+ description: `${name} fixture`,+ author: { name: "example" },+ };+ writeJson(join(pluginRoot, "plugin.json"), manifest);+ for (const directory of new Set(+ targets.flatMap((target) => target[2] ?? []),+ )) {+ writeJson(join(pluginRoot, directory, "plugin.json"), manifest);+ }+ mkdirSync(join(pluginRoot, "skills"), { recursive: true });+ symlinkSync(+ relative(join(pluginRoot, "skills"), join(root, "skills", skillName)),+ join(pluginRoot, "skills", skillName),+ );+ write(+ join(pluginRoot, "README.md"),+ `# ${name}\n\n## Requirements\n\nFixture requirements.\n\n## Installation\n\n${targets.map(([, title]) => `### ${title}\n\nInstall in ${title}.\n`).join("\n")}\n## Development\n\nDo not ship these instructions.\n`,+ );+ write(join(pluginRoot, "LICENSE"), "fixture license\n");+ writeJson(join(pluginRoot, "package.json"), {+ name: `@example/${name}`,+ version,+ type: "module",+ scripts: { prepare: "must-not-run" },+ exports: {+ ".": "./index.js",+ "./server": "./index.js",+ "./dsh": "./dsh/src/index.js",+ },+ dsh: { bundle: { patch: "./cordis.patch.yml" } },+ });+ write(join(pluginRoot, "index.js"), "export default async () => ({});\n");+ write(+ join(pluginRoot, "cordis.patch.yml"),+ `- insert:\n - id: ${name}\n name: '@example/${name}/dsh'\n`,+ );+ write(+ join(pluginRoot, "dsh", "src", "index.js"),+ "export const name = 'fixture';\n",+ );+ write(+ join(root, "skills", skillName, "SKILL.md"),+ `---\nname: ${skillName}\ndescription: canonical ${skillName}\n---\n\n# ${skillName}\n`,+ );+ write(+ join(root, "skills", skillName, "references", "install.md"),+ `canonical ${skillName} reference\n`,+ );+ for (const path of [+ "mcp/server.js",+ "node_modules/fixture/index.js",+ ".DS_Store",+ "dist/old.zip",+ "tests/plugin.test.mjs",+ "unrelated.txt",+ ])+ write(join(pluginRoot, path), "must not ship\n");+}++function createFixture() {+ const root = mkdtempSync(join(tmpdir(), "ego-plugin-packaging-"));+ mkdirSync(join(root, "plugins", "scripts"), { recursive: true });+ copyFileSync(+ join(repositoryRoot, "plugins", "scripts", "package-plugins.mjs"),+ join(root, "plugins", "scripts", "package-plugins.mjs"),+ );+ addPlugin(root, "ego", "1.3.1", "ego-browser");+ addPlugin(root, "sample", "2.4.0", "sample-skill");+ return root;+}+function runPackager(root, args) {+ return spawnSync(+ process.execPath,+ [join(root, "plugins", "scripts", "package-plugins.mjs"), ...args],+ { cwd: root, encoding: "utf8" },+ );+}+function assertSuccess(result) {+ assert.equal(+ result.status,+ 0,+ `command failed\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`,+ );+}+function artifactName(name, version, target) {+ return `${name}-${target[0]}-v${version}.${target[2] ? "zip" : "tgz"}`;+}+function unpack(archive, destination) {+ mkdirSync(destination, { recursive: true });+ const npm = archive.endsWith(".tgz");+ assertSuccess(+ spawnSync(+ npm ? "tar" : "unzip",+ npm+ ? ["-xzf", archive, "-C", destination]+ : ["-q", archive, "-d", destination],+ { encoding: "utf8" },+ ),+ );+ return npm ? join(destination, "package") : destination;+}+function files(root, prefix = "") {+ return readdirSync(join(root, prefix))+ .flatMap((name) => {+ const path = join(prefix, name);+ const info = lstatSync(join(root, path));+ assert.equal(+ info.isSymbolicLink(),+ false,+ `${path} must be materialized`,+ );+ return info.isDirectory() ? files(root, path) : [path];+ })+ .sort();+}++function assertArtifacts(root, output, name, version, skillName) {+ const release = join(output, `${name}-v${version}`);+ assert.equal(+ existsSync(release),+ true,+ "packaging must create a version directory with nine host artifacts",+ );+ assert.deepEqual(+ readdirSync(release).sort(),+ targets.map((target) => artifactName(name, version, target)).sort(),+ );+ const extracted = mkdtempSync(join(tmpdir(), "ego-plugin-extracted-"));+ const packages = new Map();+ const sourcePackage = JSON.parse(+ readFileSync(join(root, "plugins", name, "package.json"), "utf8"),+ );+ try {+ for (const target of targets) {+ const [id, title, manifests, marketplacePath] = target;+ const contents = unpack(+ join(release, artifactName(name, version, target)),+ join(extracted, id),+ );+ const plugin = marketplacePath+ ? join(contents, "plugins", name)+ : contents;+ const expected = [+ "LICENSE",+ "README.md",+ ...files(join(root, "skills", skillName)).map(+ (path) => `skills/${skillName}/${path}`,+ ),+ ];+ const readme = readFileSync(join(contents, "README.md"), "utf8");+ assert.ok(readme.includes(title));+ assert.doesNotMatch(readme, /## Development/);+ for (const [, other] of targets)+ if (other !== title)+ assert.ok(+ !readme.includes(`### ${other}\n`),+ "only this host's installation instructions should ship",+ );+ if (manifests) {+ expected.push(+ "plugin.json",+ ...manifests.map((path) => `${path}/plugin.json`),+ );+ for (const path of [+ "plugin.json",+ ...manifests.map((path) => `${path}/plugin.json`),+ ]) {+ const metadata = JSON.parse(readFileSync(join(plugin, path), "utf8"));+ assert.equal(metadata.name, name);+ assert.equal(metadata.version, version);+ }+ } else {+ expected.push(+ "package.json",+ ...(id === "opencode"+ ? ["index.js"]+ : ["cordis.patch.yml", "dsh/src/index.js"]),+ );+ const pkg = JSON.parse(+ readFileSync(join(plugin, "package.json"), "utf8"),+ );+ assert.equal(pkg.name, `${sourcePackage.name}-${id}`);+ assert.equal(pkg.version, version);+ assert.equal(+ pkg.scripts,+ undefined,+ "source lifecycle and development scripts must not ship",+ );+ if (id === "opencode") {+ assert.deepEqual(pkg.exports, {+ ".": "./index.js",+ "./server": "./index.js",+ });+ assert.equal(pkg.dsh, undefined);+ } else {+ assert.deepEqual(pkg.exports, { "./dsh": "./dsh/src/index.js" });+ assert.deepEqual(pkg.dsh, {+ bundle: { patch: "./cordis.patch.yml" },+ });+ assert.ok(+ readFileSync(join(plugin, "cordis.patch.yml"), "utf8").includes(+ `'${pkg.name}/dsh'`,+ ),+ );+ }+ packages.set(id, plugin);+ }+ assert.deepEqual(+ files(plugin),+ expected.sort(),+ `${id} must include only its host entry points and the complete Skill`,+ );+ for (const path of files(join(root, "skills", skillName))) {+ assert.deepEqual(+ readFileSync(join(plugin, "skills", skillName, path)),+ readFileSync(join(root, "skills", skillName, path)),+ `${id}: ${path} must match the canonical Skill`,+ );+ }+ if (marketplacePath) {+ const marketplace = JSON.parse(+ readFileSync(join(contents, marketplacePath), "utf8"),+ );+ assert.equal(marketplace.name, `${name}-${id}-local`);+ assert.equal(marketplace.plugins.length, 1);+ assert.equal(marketplace.plugins[0].name, name);+ if (id === "workbuddy") {+ assert.equal(+ marketplace.description,+ JSON.parse(readFileSync(join(plugin, "plugin.json"), "utf8"))+ .description,+ );+ }+ assert.deepEqual(+ marketplace.plugins[0].source,+ id === "codex"+ ? { source: "local", path: `./plugins/${name}` }+ : `./plugins/${name}`,+ );+ assert.deepEqual(+ files(contents),+ [+ "README.md",+ marketplacePath,+ ...expected.map((path) => `plugins/${name}/${path}`),+ ].sort(),+ );+ }+ }+ if (root === repositoryRoot) {+ assertSuccess(+ spawnSync(+ process.execPath,+ [+ "--input-type=module",+ "-e",+ `+ import assert from 'node:assert/strict';+ import { existsSync } from 'node:fs';+ import { EgoBrowserPlugin } from '@citrolabs/ego-opencode/server';+ const config = {};+ await (await EgoBrowserPlugin()).config(config);+ assert.ok(existsSync(config.instructions[0]));+ assert.ok(config.command['ego-browser']);+ `,+ ],+ { cwd: packages.get("opencode"), encoding: "utf8" },+ ),+ );+ assertSuccess(+ spawnSync(+ process.execPath,+ [+ "--input-type=module",+ "-e",+ `+ import assert from 'node:assert/strict';+ import { existsSync, readFileSync } from 'node:fs';+ const patch = readFileSync('cordis.patch.yml', 'utf8');+ const { apply } = await import(patch.match(/name: '([^']+)'/)[1]);+ let provider;+ apply({ skills: { registerProvider: create => { provider = create(); } } });+ const [candidate] = await provider.list();+ const skill = await provider.get(candidate);+ assert.match(skill.content, /await taskSpace/);+ assert.ok(existsSync(skill.path));+ `,+ ],+ { cwd: packages.get("deepseek-harness"), encoding: "utf8" },+ ),+ );+ }+ } finally {+ rmSync(extracted, { recursive: true, force: true });+ }+}++test("one command builds nine independent host packages without changing source links", () => {+ const root = createFixture();+ const output = join(root, "plugins", "ego", "release-output");+ const link = join(root, "plugins", "ego", "skills", "ego-browser");+ const target = readlinkSync(link);+ try {+ write(join(output, "old-artifact.zip"), "keep this existing artifact\n");+ assertSuccess(runPackager(root, ["ego", "--output", output]));+ assertArtifacts(root, output, "ego", "1.3.1", "ego-browser");+ assert.equal(readlinkSync(link), target);+ write(+ join(root, "skills", "ego-browser", "references", "install.md"),+ "updated canonical reference\n",+ );+ assertSuccess(runPackager(root, ["ego", "--output", output]));+ assertArtifacts(root, output, "ego", "1.3.1", "ego-browser");+ assert.equal(readlinkSync(link), target);+ assert.equal(+ readFileSync(join(output, "old-artifact.zip"), "utf8"),+ "keep this existing artifact\n",+ );+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+});++test("--all creates nine artifacts per plugin in separate version directories", () => {+ const root = createFixture();+ const output = join(root, "release");+ try {+ assertSuccess(runPackager(root, ["--all", "--output", output]));+ assert.deepEqual(readdirSync(output).sort(), [+ "ego-v1.3.1",+ "sample-v2.4.0",+ ]);+ assertArtifacts(root, output, "ego", "1.3.1", "ego-browser");+ assertArtifacts(root, output, "sample", "2.4.0", "sample-skill");+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+});++test("an output directory above plugins does not exclude the plugin itself", () => {+ const root = createFixture();+ try {+ assertSuccess(runPackager(root, ["ego", "--output", root]));+ assertArtifacts(root, root, "ego", "1.3.1", "ego-browser");+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+});++test("a missing host adapter fails the batch without replacing previous artifacts", () => {+ const root = createFixture();+ const output = join(root, "release");+ try {+ assertSuccess(runPackager(root, ["ego", "--output", output]));+ const release = join(output, "ego-v1.3.1");+ assert.equal(existsSync(release), true);+ const previous = new Map(+ readdirSync(release).map((name) => [+ name,+ readFileSync(join(release, name)),+ ]),+ );+ rmSync(join(root, "plugins", "ego", "dsh", "src", "index.js"));+ write(+ join(root, "skills", "ego-browser", "SKILL.md"),+ "changed after last successful package\n",+ );+ const result = runPackager(root, ["ego", "--output", output]);+ assert.notEqual(result.status, 0);+ assert.match(result.stderr, /dsh/);+ for (const [name, bytes] of previous)+ assert.deepEqual(readFileSync(join(release, name)), bytes);+ assert.deepEqual(readdirSync(output), ["ego-v1.3.1"]);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+});++for (const kind of [+ "external-file",+ "missing-skill",+ "different-skill",+ "canonical-child",+ "output-link",+]) {+ test(`${kind} symlinks fail packaging without changing the source`, () => {+ const root = createFixture();+ const output = join(root, "plugins", "ego", "release-output");+ const skillLink = join(root, "plugins", "ego", "skills", "ego-browser");+ try {+ write(join(root, "outside", "secret.txt"), "PRIVATE-DATA\n");+ if (kind === "external-file")+ symlinkSync(+ join(root, "outside", "secret.txt"),+ join(root, "plugins", "ego", "leak.txt"),+ );+ if (kind === "canonical-child")+ symlinkSync(+ join(root, "outside", "secret.txt"),+ join(root, "skills", "ego-browser", "secret.txt"),+ );+ if (kind === "output-link") symlinkSync(join(root, "outside"), output);+ if (kind === "missing-skill" || kind === "different-skill") {+ rmSync(skillLink);+ symlinkSync(+ join(root, kind === "missing-skill" ? "missing" : "outside"),+ skillLink,+ );+ }+ const before = readlinkSync(skillLink);+ const result = runPackager(root, ["ego", "--output", output]);+ assert.notEqual(result.status, 0);+ assert.match(result.stderr, /symbolic link|canonical Skill/i);+ assert.equal(readlinkSync(skillLink), before);+ assert.equal(existsSync(join(output, "ego-v1.3.1")), false);+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+ });+}++test("invalid selectors fail with clear errors", () => {+ const root = createFixture();+ try {+ for (const [args, message] of [+ [["missing"], /unknown plugin.*missing/i],+ [["ego", "--all"], /choose either/i],+ [["ego", "--output"], /requires a directory/i],+ ]) {+ const result = runPackager(root, args);+ assert.notEqual(result.status, 0);+ assert.match(result.stderr, message);+ }+ } finally {+ rmSync(root, { recursive: true, force: true });+ }+});++test("the documented npm command builds all nine artifacts with working isolated adapters", () => {+ const output = mkdtempSync(join(tmpdir(), "ego-plugin-npm-"));+ try {+ assertSuccess(+ spawnSync(+ "npm",+ ["--prefix", "plugins/ego", "run", "package", "--", "--output", output],+ { cwd: repositoryRoot, encoding: "utf8" },+ ),+ );+ const { version } = JSON.parse(+ readFileSync(+ join(repositoryRoot, "plugins", "ego", "plugin.json"),+ "utf8",+ ),+ );+ assertArtifacts(repositoryRoot, output, "ego", version, "ego-browser");+ } finally {+ rmSync(output, { recursive: true, force: true });+ }+});diff --git a/plugins/scripts/package-plugins.mjs b/plugins/scripts/package-plugins.mjsnew file mode 100755index 0000000..154f905--- /dev/null+++ b/plugins/scripts/package-plugins.mjs@@ -0,0 +1,433 @@+#!/usr/bin/env node++import { spawnSync } from "node:child_process";+import {+ cp,+ lstat,+ mkdir,+ mkdtemp,+ readFile,+ readdir,+ realpath,+ rename,+ rm,+ stat,+ writeFile,+} from "node:fs/promises";+import { basename, dirname, join, resolve } from "node:path";++const TARGETS = [+ {+ id: "claude-code",+ title: "Claude Code",+ files: [".claude-plugin/plugin.json"],+ },+ {+ id: "codex",+ title: "Codex",+ files: [".codex-plugin/plugin.json"],+ marketplace: ".agents/plugins/marketplace.json",+ },+ { id: "cursor", title: "Cursor", files: [".cursor-plugin/plugin.json"] },+ {+ id: "github-copilot",+ title: "GitHub Copilot",+ files: [".claude-plugin/plugin.json"],+ },+ { id: "grok-build", title: "Grok Build", files: [] },+ {+ id: "workbuddy",+ title: "WorkBuddy",+ files: [+ ".claude-plugin/plugin.json",+ ".codebuddy-plugin/plugin.json",+ ".workbuddy-plugin/plugin.json",+ ],+ marketplace: ".claude-plugin/marketplace.json",+ },+ {+ id: "qwenwork",+ title: "QwenWork Desktop",+ files: [".claude-plugin/plugin.json"],+ },+ { id: "opencode", title: "OpenCode", files: ["index.js"], npm: true },+ {+ id: "deepseek-harness",+ title: "DeepSeek Harness",+ files: ["cordis.patch.yml", "dsh/src/index.js"],+ npm: true,+ },+];++function usage() {+ return `Usage:+ node plugins/scripts/package-plugins.mjs <plugin> [--output <directory>]+ node plugins/scripts/package-plugins.mjs --all [--output <directory>]++Builds nine host artifacts per plugin (seven ZIPs and two npm archives).`;+}++function parseArguments(args) {+ let all = false;+ let output;+ let plugin;++ for (let index = 0; index < args.length; index += 1) {+ const argument = args[index];+ if (argument === "--all") {+ all = true;+ } else if (argument === "--output") {+ output = args[index + 1];+ if (!output) throw new Error("--output requires a directory");+ index += 1;+ } else if (argument === "--help" || argument === "-h") {+ return { help: true };+ } else if (argument.startsWith("-")) {+ throw new Error(`Unknown option: ${argument}`);+ } else if (plugin) {+ throw new Error("Choose one plugin or --all");+ } else {+ plugin = argument;+ }+ }++ if (all && plugin) throw new Error("Choose either one plugin or --all");+ if (!all && !plugin) throw new Error(usage());+ return { all, output, plugin };+}++async function isDirectory(path) {+ try {+ return (await stat(path)).isDirectory();+ } catch (error) {+ if (error?.code === "ENOENT") return false;+ throw error;+ }+}++async function findRepositoryRoot(start) {+ let directory = resolve(start);+ while (true) {+ if (+ (await isDirectory(join(directory, "plugins"))) &&+ (await isDirectory(join(directory, "skills")))+ ) {+ return directory;+ }+ const parent = dirname(directory);+ if (parent === directory) {+ throw new Error("Could not find a repository with plugins/ and skills/");+ }+ directory = parent;+ }+}++async function canonicalPath(path) {+ try {+ return await realpath(path);+ } catch (error) {+ if (error?.code !== "ENOENT") throw error;+ const parent = dirname(path);+ if (parent === path) return path;+ return join(await canonicalPath(parent), basename(path));+ }+}++async function validateLinks(root, label, allowedLinks = new Map()) {+ const information = await lstat(root);+ if (information.isSymbolicLink()) {+ const canonical = allowedLinks.get(root);+ if (canonical && (await canonicalPath(root)) === canonical) return;+ throw new Error(`${label} contains a symbolic link: ${root}`);+ }+ if (!information.isDirectory()) return;++ const entries = await readdir(root, { withFileTypes: true });+ for (const entry of entries) {+ await validateLinks(join(root, entry.name), label, allowedLinks);+ }+}++async function pluginNames(repositoryRoot) {+ const entries = await readdir(join(repositoryRoot, "plugins"), {+ withFileTypes: true,+ });+ const names = [];+ for (const entry of entries) {+ if (+ entry.isDirectory() &&+ (await isDirectory(join(repositoryRoot, "plugins", entry.name)))+ ) {+ try {+ await readFile(+ join(repositoryRoot, "plugins", entry.name, "plugin.json"),+ "utf8",+ );+ names.push(entry.name);+ } catch (error) {+ if (error?.code !== "ENOENT") throw error;+ }+ }+ }+ return names.sort();+}++async function collectSkills(repositoryRoot, pluginRoot) {+ const packagedSkillsRoot = join(pluginRoot, "skills");+ if (!(await isDirectory(packagedSkillsRoot))) {+ throw new Error(`Plugin has no skills directory: ${pluginRoot}`);+ }++ const entries = await readdir(packagedSkillsRoot, { withFileTypes: true });+ const skills = entries+ .filter((entry) => entry.isDirectory() || entry.isSymbolicLink())+ .map((entry) => entry.name)+ .filter((name) => !name.startsWith("."))+ .sort();+ if (skills.length === 0) {+ throw new Error(`Plugin has no packaged Skills: ${pluginRoot}`);+ }++ const allowedLinks = new Map();+ for (const skill of skills) {+ const canonical = join(repositoryRoot, "skills", skill);+ if (!(await isDirectory(canonical))) {+ throw new Error(`Canonical Skill not found: skills/${skill}`);+ }+ if ((await realpath(canonical)) !== canonical) {+ throw new Error(`Canonical Skill ${skill} contains a symbolic link`);+ }+ await validateLinks(canonical, `Canonical Skill ${skill}`);+ allowedLinks.set(join(packagedSkillsRoot, skill), canonical);+ }+ await validateLinks(+ pluginRoot,+ `Plugin ${basename(pluginRoot)}`,+ allowedLinks,+ );+ return skills;+}++function run(command, args, options = {}) {+ const result = spawnSync(command, args, {+ encoding: "utf8",+ ...options,+ });+ if (result.error) {+ throw new Error(`${command} could not be started: ${result.error.message}`);+ }+ if (result.status !== 0) {+ const details = result.stderr.trim() || result.stdout.trim();+ throw new Error(`${command} failed${details ? `: ${details}` : ""}`);+ }+ return result.stdout;+}++function readmeSection(readme, heading) {+ const section = readme+ .split(`${heading}\n`)[1]+ ?.split(/\n#{1,3} /)[0]+ ?.trim();+ if (!section) throw new Error(`Plugin README.md requires ${heading}`);+ return section;+}++async function writeJson(path, value) {+ await mkdir(dirname(path), { recursive: true });+ await writeFile(path, `${JSON.stringify(value, null, 2)}\n`);+}++async function packagePlugin(repositoryRoot, name, outputRoot) {+ if (!/^[a-z0-9][a-z0-9._-]*$/i.test(name)) {+ throw new Error(`Invalid plugin name: ${name}`);+ }+ const pluginRoot = join(repositoryRoot, "plugins", name);+ if (!(await isDirectory(pluginRoot))) {+ throw new Error(`Unknown plugin: ${name}`);+ }++ let manifest;+ try {+ manifest = JSON.parse(+ await readFile(join(pluginRoot, "plugin.json"), "utf8"),+ );+ } catch (error) {+ throw new Error(`Invalid plugin.json for ${name}: ${error.message}`);+ }+ if (manifest.name !== name) {+ throw new Error(+ `Plugin directory ${name} does not match manifest name ${manifest.name}`,+ );+ }+ if (!/^[a-z0-9][a-z0-9._-]*$/i.test(manifest.version ?? "")) {+ throw new Error(`Plugin ${name} has an invalid version`);+ }++ const skills = await collectSkills(repositoryRoot, pluginRoot);+ const readme = await readFile(join(pluginRoot, "README.md"), "utf8");+ const requirements = readmeSection(readme, "## Requirements");+ const sourcePackage = JSON.parse(+ await readFile(join(pluginRoot, "package.json"), "utf8"),+ );+ if (sourcePackage.version !== manifest.version) {+ throw new Error(+ `Plugin ${name} package.json version does not match plugin.json`,+ );+ }+ await mkdir(outputRoot, { recursive: true });+ const temporaryRoot = await mkdtemp(join(outputRoot, `.${name}-package-`));+ const releaseRoot = join(outputRoot, `${name}-v${manifest.version}`);+ const archives = [];+ try {+ for (const target of TARGETS) {+ const stagingRoot = join(temporaryRoot, target.id);+ const payloadRoot = target.marketplace+ ? join(stagingRoot, "plugins", name)+ : stagingRoot;+ const entries = [+ "LICENSE",+ ...target.files,+ ...(target.npm ? [] : ["plugin.json"]),+ ];+ for (const entry of entries) {+ const destination = join(payloadRoot, entry);+ await mkdir(dirname(destination), { recursive: true });+ await cp(join(pluginRoot, entry), destination, {+ preserveTimestamps: true,+ });+ }+ for (const skill of skills) {+ const destination = join(payloadRoot, "skills", skill);+ await cp(join(repositoryRoot, "skills", skill), destination, {+ recursive: true,+ preserveTimestamps: true,+ });+ await readFile(join(destination, "SKILL.md"), "utf8");+ }+ const installation = readmeSection(readme, `### ${target.title}`);+ const hostReadme = `# ${name} for ${target.title}\n\n## Requirements\n\n${requirements}\n\n## Installation\n\n${installation}\n`;+ await writeFile(join(payloadRoot, "README.md"), hostReadme);+ if (target.marketplace) {+ const source = `./plugins/${name}`;+ const catalog =+ target.id === "codex"+ ? {+ interface: { displayName: `${name} for ${target.title}` },+ plugins: [+ {+ name,+ source: { source: "local", path: source },+ policy: {+ installation: "AVAILABLE",+ authentication: "ON_INSTALL",+ },+ category: "Productivity",+ },+ ],+ }+ : {+ description: manifest.description,+ owner: manifest.author,+ metadata: { version: manifest.version },+ plugins: [+ {+ name,+ version: manifest.version,+ description: manifest.description,+ source,+ },+ ],+ };+ await writeJson(join(stagingRoot, target.marketplace), {+ name: `${name}-${target.id}-local`,+ ...catalog,+ });+ await writeFile(join(stagingRoot, "README.md"), hostReadme);+ }+ const archiveName = `${name}-${target.id}-v${manifest.version}.${target.npm ? "tgz" : "zip"}`;+ const archive = join(temporaryRoot, archiveName);+ if (target.npm) {+ const pkg = {+ ...sourcePackage,+ name: `${sourcePackage.name}-${target.id}`,+ files: ["LICENSE", "README.md", "skills", ...target.files],+ exports:+ target.id === "opencode"+ ? { ".": "./index.js", "./server": "./index.js" }+ : { "./dsh": "./dsh/src/index.js" },+ };+ delete pkg.scripts;+ if (target.id === "opencode") {+ delete pkg.dsh;+ } else {+ const patchPath = join(payloadRoot, "cordis.patch.yml");+ const patch = await readFile(patchPath, "utf8");+ await writeFile(+ patchPath,+ patch.replaceAll(`${sourcePackage.name}/dsh`, `${pkg.name}/dsh`),+ );+ }+ await writeJson(join(payloadRoot, "package.json"), pkg);+ }+ await validateLinks(stagingRoot, `Staged ${target.title} plugin`);+ if (target.npm) {+ const [packed] = JSON.parse(+ run(+ "npm",+ [+ "pack",+ "--json",+ "--ignore-scripts",+ "--pack-destination",+ temporaryRoot,+ ],+ { cwd: payloadRoot },+ ),+ );+ await rename(join(temporaryRoot, packed.filename), archive);+ } else {+ run("zip", ["-q", "-r", "-X", archive, "."], { cwd: stagingRoot });+ run("unzip", ["-tqq", archive]);+ }+ archives.push(archiveName);+ }+ // Publish only after every host has packaged successfully.+ await mkdir(releaseRoot, { recursive: true });+ for (const archiveName of archives) {+ await rename(+ join(temporaryRoot, archiveName),+ join(releaseRoot, archiveName),+ );+ }+ } finally {+ await rm(temporaryRoot, { recursive: true, force: true });+ }+ for (const archiveName of archives)+ console.log(`Packaged: ${join(releaseRoot, archiveName)}`);+}++async function main() {+ const options = parseArguments(process.argv.slice(2));+ if (options.help) {+ console.log(usage());+ return;+ }++ const repositoryRoot = await findRepositoryRoot(process.cwd());+ const outputRoot = await canonicalPath(+ resolve(options.output ?? join(repositoryRoot, "dist", "plugins")),+ );+ const names = options.all+ ? await pluginNames(repositoryRoot)+ : [options.plugin];+ if (names.length === 0) throw new Error("No plugins found");++ for (const name of names) {+ await packagePlugin(repositoryRoot, name, outputRoot);+ }+}++main().catch((error) => {+ console.error(`package-plugins: ${error.message}`);+ process.exitCode = 1;+});diff --git a/skills/ego-browser/agents/openai.yaml b/skills/ego-browser/agents/openai.yamlnew file mode 100644index 0000000..025d8eb--- /dev/null+++ b/skills/ego-browser/agents/openai.yaml@@ -0,0 +1,7 @@+interface:+ display_name: "ego-browser"+ short_description: "Automate logged-in web tasks"+ icon_small: "./assets/composer-icon.png"+ icon_large: "./assets/logo.png"+ brand_color: "#1E90FF"+ default_prompt: "Use $ego-browser to complete a browser automation task."diff --git a/skills/ego-browser/assets/composer-icon.png b/skills/ego-browser/assets/composer-icon.pngnew file mode 100644index 0000000..78dd4f5Binary files /dev/null and b/skills/ego-browser/assets/composer-icon.png differdiff --git a/skills/ego-browser/assets/logo.png b/skills/ego-browser/assets/logo.pngnew file mode 100644index 0000000..87f0a2aBinary files /dev/null and b/skills/ego-browser/assets/logo.png differ