From 8c891082da41df407b35767cef58294f87215360 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 07:42:22 +0200 Subject: [PATCH 01/17] feat: initial config --- .gitignore | 1 + CHANGELOG.md | 11 +++ LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++ tsconfig.json | 11 +++ 4 files changed, 224 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..30bc162 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/node_modules \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..eb45d9c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to the **Apify for Open Code** plugin are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] — Initial Open Code release + +### Added +- `apify` setup with agent, skills, rules and MCP server configuration. +- Apache-2.0 license. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ce2a292 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Apify Technologies s.r.o. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..42bb9f2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "noEmit": true, + "skipLibCheck": true + }, + "include": ["index.ts"] +} \ No newline at end of file From d7c7b6d7827676450610ce3447053b33492fcbd3 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 07:43:04 +0200 Subject: [PATCH 02/17] feat: main logic --- index.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 index.ts create mode 100644 package.json diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..700673f --- /dev/null +++ b/index.ts @@ -0,0 +1,58 @@ +import type { Plugin } from "@opencode-ai/plugin"; +import type { Config as ConfigV2 } from "@opencode-ai/sdk/v2" +import { existsSync, readFileSync } from "node:fs"; +import path, { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; + +const current_dir = dirname(fileURLToPath(import.meta.url)); + +export const ApifyPlugin: Plugin = async () => { + const agentPath = path.join(current_dir, "agents/apify.md") + if (!existsSync(agentPath)) { + throw new Error('Apify agent.md not found') + } + const agent = readFileSync(agentPath, "utf8") + + const skillsPath = path.join(current_dir, "skills") + if (!existsSync(skillsPath)) { + throw new Error('Apify skills not found') + } + + const instructionsPath = path.join(current_dir, "instructions/apify-routing.md") + if (!existsSync(instructionsPath)) { + throw new Error('Apify instructions not found') + } + + return { + config: async (config) => { + // ConfigV2 includes `skills` which isn't in the plugin's Config type yet + const cfg = config as typeof config & Pick + + cfg.mcp = { ...cfg.mcp, apify: { type: "remote", enabled: true, url: "https://mcp.apify.com" } } + cfg.agent = { + ...cfg.agent, + apify: { + prompt: agent, + mode: "all", + description: "Anything related to Apify, use the apify_* tools to interact with the Apify platform.", + }, + } + cfg.skills = { + ...cfg.skills, + paths: [...(cfg.skills?.paths ?? []), skillsPath], + } + cfg.tools = { + ...cfg.tools, + "apify_*": true, + } + cfg.instructions = [...(cfg.instructions ?? []), instructionsPath] + }, + "shell.env": async (_input, output) => { + if (process.env.APIFY_TOKEN) { + output.env.APIFY_TOKEN = process.env.APIFY_TOKEN; + } + }, + } +} + +export default ApifyPlugin; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..b8d97fa --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "opencode-apify", + "version": "1.0.0", + "description": "Apify plugin for OpenCode - web scraping, automation, and data extraction via the Apify platform", + "type": "module", + "main": "index.ts", + "files": [ + "index.ts", + "agents", + "instructions", + "skills" + ], + "keywords": [ + "opencode", + "opencode-plugin", + "apify", + "web-scraping", + "automation", + "data-extraction", + "actors", + "llm", + "ai" + ], + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/apify/apify-opencode-plugin" + }, + "homepage": "https://apify.com", + "author": { + "name": "Apify Technologies s.r.o." + }, + "scripts": { + "check": "tsc --noEmit" + }, + "devDependencies": { + "@opencode-ai/plugin": "^1.0.0", + "@opencode-ai/sdk": "^1.17.4", + "@types/node": "^25.2.2", + "typescript": "^5.0.0" + } +} \ No newline at end of file From 74af3d92f9bd5d37937ed676a415bcb7784f085f Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 07:43:23 +0200 Subject: [PATCH 03/17] feat: ci cid npm publish --- .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5a221d6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish to NPM + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org + + - name: Set version from release tag + run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version + + - run: npm install + + - run: npm run check + + - run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 7bb0e9d9262ea42c08d3c9cf05d25e21d11656e7 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 07:43:41 +0200 Subject: [PATCH 04/17] chore: readme --- README.md | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c142a1..4f02a50 100644 --- a/README.md +++ b/README.md @@ -1 +1,169 @@ -# apify-opencode-plugin +# Apify for Open Code + +Official Apify plugin for [Open Code](https://opencode.ai) — adds the Apify MCP server, one `apify` routing agent, and five bundled skills for the main Apify workflows: using existing Actors, building and deploying your own Actors, actorizing existing projects, generating Actor output schemas, and integrating Apify into existing applications. + +> **Apify** is a platform of thousands of serverless cloud programs called **Actors** for web scraping, browser automation, and data extraction. Learn more at [apify.com](https://apify.com). + +## What you get + +| Component | Name | Purpose | +|---|---|---| +| Agent (entry point) | `apify` | Routes every Apify request to the right skill or transport path. **This is the one you should invoke.** | +| MCP server | `apify` (`https://mcp.apify.com/`) | Lets the agent search the Apify Store, fetch Actor details, run Actors, and read the Apify docs. | +| Skill | `apify-actor-development` | Create, debug, and deploy a brand new Apify Actor from scratch. | +| Skill | `apify-actorization` | Convert an existing JS/TS, Python, or CLI project into an Apify Actor. | +| Skill | `apify-generate-output-schema` | Generate `dataset_schema.json` / `output_schema.json` / `key_value_store_schema.json` for an existing Actor. | +| Skill | `apify-sdk-integration` | Add Apify Actor execution to an existing application using the `apify-client` package. | +| Skill | `apify-ultimate-scraper` | CLI-driven data extraction workflow for selecting, configuring, and running pre-built Actors across 15+ platforms. | + + +## Prerequisites + +- **Open Code** CLI installed ([opencode.ai](https://opencode.ai)). + +## First-run setup + +The plugin uses **three setup paths** depending on what you're doing. The `apify` agent will guide you through the right one, but here is the high-level map. + +### Path 1 — Using existing Actors through MCP + +Uses **OAuth**. The first time the agent calls a tool that needs auth (for example `run-actor` or `get-dataset-items`), Open Code opens `console.apify.com` in your browser and asks you to sign in. Read-only tools such as `search-actors`, `fetch-actor-details`, `search-apify-docs`, and `fetch-apify-docs` work without auth. + +### Path 2 — CLI workflows for Actor development, actorization, or scraper runs + +These skills expect the local `apify` CLI to be available. Install it first: + +```bash +npm install -g apify-cli +``` + +For interactive use, authenticate with: + +```bash +apify login +``` + +In headless or CI environments, export an **`APIFY_TOKEN`** instead; the CLI can read it automatically: + +```bash +export APIFY_TOKEN="apify_api_xxxxxxxxxxxx" +``` + +Generate a token at [console.apify.com/settings/integrations](https://console.apify.com/settings/integrations). Don't have an account? [Sign up free](https://console.apify.com/sign-up) — no credit card required. + +### Path 3 — SDK integration into an existing application + +Uses an **`APIFY_TOKEN`** environment variable with the `apify-client` package or the REST API: + +```bash +export APIFY_TOKEN="apify_api_xxxxxxxxxxxx" +``` + +## Installation + +### 1. Add the plugin to your project + +Add the plugin entry to your project's `opencode.json`: + +```json +{ + "$schema": "https://opencode.ai/config.json", + "plugin": ["apify-open-code-plugin"] +} +``` + +Or run: + +```bash +opencode plugin opencode-apify +``` + +This will add the entry to `opencode.json` automatically. + +> **Local development:** you can also pass a file path instead of the package name for local testing, e.g. `"plugin": ["./path/to/apify-open-code-plugin"]`. + +### 2. Check available MCPs + +```bash +opencode mcp list +``` + +### 3. Authenticate + +```bash +opencode mcp auth apify +``` + +### 4. Verify the setup + +```bash +opencode run "List the names of all skills and instructions available to you, and list of MCPs you can use + allowed tools" +``` + +If everything is working, you should see the `apify` agent, the five skills, and the Apify MCP tools listed in the output. + +### Working in headless / SSH environments (no browser) + +The MCP OAuth flow needs a browser. If you're running Open Code over SSH or in any environment without a browser, you have these options: + +1. **Authenticate locally first.** Run Open Code once on your laptop so the OAuth refresh token is stored, then reconnect remotely. +2. **Use the CLI-based skills.** `apify-actor-development`, `apify-actorization`, and `apify-ultimate-scraper` can work in headless environments when the `apify` CLI is installed and `APIFY_TOKEN` is exported. +3. **Use the SDK integration skill.** `apify-sdk-integration` uses `apify-client` and only needs `APIFY_TOKEN`. + +## How to use it + +Start an Open Code session and describe what you need. The `apify` agent reads the request, chooses between MCP, CLI, or SDK-based workflows, and dispatches to the right skill or tool. + +``` +find me 5 well-rated coffee shops in Seattle and export to CSV +build me an Actor that scrapes a sitemap and stores titles +add Apify to this Next.js app so I can run a scraper from /api/scrape +generate output schemas for the Actor in this folder +``` + +## Components reference + +### MCP server + +The `apify` MCP server is configured automatically by the plugin and the agent uses it for Route 1 tasks. It exposes: + +- `search-actors` — search the Apify Store by keyword (no auth) +- `fetch-actor-details` — Actor specs, input schema, pricing (no auth) +- `run-actor` — execute an Actor and return results (OAuth) +- `get-dataset-items` — retrieve dataset rows from a previous run (OAuth) +- `search-apify-docs` / `fetch-apify-docs` — Apify documentation lookup + +### Bundled skills + +The bundled skills ship with markdown references that the agent uses while working: + +- `skills/apify-actor-development/references/` — Actor config, schemas, logging, standby mode, and README guidance +- `skills/apify-actorization/references/` — JS/TS, Python, and CLI actorization guides plus schema/output notes +- `skills/apify-ultimate-scraper/references/` — Actor index, gotchas, and workflow playbooks for common scraping use cases + +Route 1 uses the MCP server, Route 2 relies on the local `apify` CLI, and Route 3 uses the `apify-client` SDK. + +## Troubleshooting + +**OAuth browser never opens / hangs.** See the "Working in headless / SSH environments" section above and switch to a CLI- or SDK-based path if needed. + +**`apify` CLI not found.** Install it with `npm install -g apify-cli` before using `apify-actor-development`, `apify-actorization`, or `apify-ultimate-scraper`. + +**`APIFY_TOKEN` not found.** Export `APIFY_TOKEN` in your shell before starting Open Code when using headless CLI auth or the `apify-sdk-integration` skill. + +**The wrong skill keeps getting picked.** The five bundled skills are routed through the `apify` agent. If routing looks wrong, describe the goal more explicitly: use existing Actors, build an Actor, actorize a project, generate output schemas, or integrate Apify into an app. + +**`apify` vs `apify-client`** — these are two different npm packages. The `apify` package is the SDK for **building** Actors (used inside an Actor's code, on the Apify platform). The `apify-client` package is the API client for **calling** Actors from your own application. The agent picks the right one for you; if you're installing manually, double-check. + +## Resources + +- Apify Console — [console.apify.com](https://console.apify.com) +- Apify Store — [apify.com/store](https://apify.com/store) +- Docs (LLM-friendly) — [docs.apify.com/llms.txt](https://docs.apify.com/llms.txt) +- Docs (full) — [docs.apify.com/llms-full.txt](https://docs.apify.com/llms-full.txt) +- Source repo — [github.com/apify/apify-open-code-plugin](https://github.com/apify/apify-open-code-plugin) +- Issues / feedback — open an issue on the source repo, or email [support@apify.com](mailto:support@apify.com) + +## License + +Apache-2.0. See [LICENSE](./LICENSE). From bae6a770dd361f27af74eb807ff03237719fb60e Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:14:09 +0200 Subject: [PATCH 05/17] fix: entrypoint Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b8d97fa..b2d6d18 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,10 @@ "version": "1.0.0", "description": "Apify plugin for OpenCode - web scraping, automation, and data extraction via the Apify platform", "type": "module", - "main": "index.ts", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", "files": [ - "index.ts", + "dist", "agents", "instructions", "skills" From a585b55912314542dd7ebe88dd1d8615be4cd856 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:17:20 +0200 Subject: [PATCH 06/17] fix: build Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b2d6d18..405b399 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "name": "Apify Technologies s.r.o." }, "scripts": { - "check": "tsc --noEmit" + "build": "tsc -p tsconfig.json", + "check": "tsc -p tsconfig.json --noEmit" }, "devDependencies": { "@opencode-ai/plugin": "^1.0.0", From a3f90ded179a2a057d32cf3c2ce9789de64005bc Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:17:48 +0200 Subject: [PATCH 07/17] fix: build in CI Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5a221d6..8b301ec 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,6 +24,7 @@ jobs: - run: npm install - run: npm run check + - run: npm run build - run: npm publish --provenance --access public env: From 67e6436a3ed7e170129f143c5724157bf13cb55a Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:19:01 +0200 Subject: [PATCH 08/17] chore: example Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f02a50..352d190 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Add the plugin entry to your project's `opencode.json`: ```json { "$schema": "https://opencode.ai/config.json", - "plugin": ["apify-open-code-plugin"] + "plugin": ["opencode-apify"] } ``` From f58160fba76ab6226667e838624d4718d52953a7 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:19:29 +0200 Subject: [PATCH 09/17] fix: repo path Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 352d190..af29df1 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ Route 1 uses the MCP server, Route 2 relies on the local `apify` CLI, and Route - Apify Store — [apify.com/store](https://apify.com/store) - Docs (LLM-friendly) — [docs.apify.com/llms.txt](https://docs.apify.com/llms.txt) - Docs (full) — [docs.apify.com/llms-full.txt](https://docs.apify.com/llms-full.txt) -- Source repo — [github.com/apify/apify-open-code-plugin](https://github.com/apify/apify-open-code-plugin) +- Source repo — [github.com/apify/apify-opencode-plugin](https://github.com/apify/apify-opencode-plugin) - Issues / feedback — open an issue on the source repo, or email [support@apify.com](mailto:support@apify.com) ## License From 6c2f8e454895ff2d9ccf6573ff5116d3f7e9f326 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:19:57 +0200 Subject: [PATCH 10/17] fix: path hint Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af29df1..f82a6c3 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ opencode plugin opencode-apify This will add the entry to `opencode.json` automatically. -> **Local development:** you can also pass a file path instead of the package name for local testing, e.g. `"plugin": ["./path/to/apify-open-code-plugin"]`. +> **Local development:** you can also pass a file path instead of the package name for local testing, e.g. `"plugin": ["./path/to/opencode-apify"]`. ### 2. Check available MCPs From 9f84073c97bc5cb3b4cd79e26279cdeec7c1b3c5 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:32:18 +0200 Subject: [PATCH 11/17] fix: build setting --- .gitignore | 3 ++- package.json | 1 - tsconfig.json | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 30bc162..b2d59d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/node_modules \ No newline at end of file +/node_modules +/dist \ No newline at end of file diff --git a/package.json b/package.json index 405b399..4de7b1e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "Apify plugin for OpenCode - web scraping, automation, and data extraction via the Apify platform", "type": "module", "main": "./dist/index.js", - "types": "./dist/index.d.ts", "files": [ "dist", "agents", diff --git a/tsconfig.json b/tsconfig.json index 42bb9f2..034b4fc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,9 @@ "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, - "noEmit": true, - "skipLibCheck": true + "outDir": "./dist", + "skipLibCheck": true, + "declaration": false }, "include": ["index.ts"] } \ No newline at end of file From 1e7b9614c58b2b759fbe5d2a46b021dfa53a2460 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 08:50:02 +0200 Subject: [PATCH 12/17] feat: content check Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8b301ec..d379ef4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,12 @@ jobs: - run: npm install + - name: Verify plugin assets exist + run: | + test -f agents/apify.md + test -f instructions/apify-routing.md + test -d skills + - run: npm run check - run: npm run build From 4e8f0a50bd41f2986a69358145b5343e7e95a073 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 09:13:46 +0200 Subject: [PATCH 13/17] fix: paths --- index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 700673f..a91e1ed 100644 --- a/index.ts +++ b/index.ts @@ -5,20 +5,21 @@ import path, { dirname } from "node:path"; import { fileURLToPath } from "node:url"; const current_dir = dirname(fileURLToPath(import.meta.url)); +const root_dir = path.join(current_dir, ".."); export const ApifyPlugin: Plugin = async () => { - const agentPath = path.join(current_dir, "agents/apify.md") + const agentPath = path.join(root_dir, "agents/apify.md") if (!existsSync(agentPath)) { throw new Error('Apify agent.md not found') } const agent = readFileSync(agentPath, "utf8") - const skillsPath = path.join(current_dir, "skills") + const skillsPath = path.join(root_dir, "skills") if (!existsSync(skillsPath)) { throw new Error('Apify skills not found') } - const instructionsPath = path.join(current_dir, "instructions/apify-routing.md") + const instructionsPath = path.join(root_dir, "instructions/apify-routing.md") if (!existsSync(instructionsPath)) { throw new Error('Apify instructions not found') } From be491d688bffc707f4255d1ae0252a660c3824a1 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Thu, 18 Jun 2026 10:47:34 +0200 Subject: [PATCH 14/17] feat: allow tools in subagent --- index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.ts b/index.ts index a91e1ed..f37f5b8 100644 --- a/index.ts +++ b/index.ts @@ -35,6 +35,9 @@ export const ApifyPlugin: Plugin = async () => { apify: { prompt: agent, mode: "all", + tools: { + "apify_*": true, + }, description: "Anything related to Apify, use the apify_* tools to interact with the Apify platform.", }, } From b1afd6f43bcfe03f2f470ee34e1a12eec18dae1a Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Fri, 19 Jun 2026 07:37:57 +0200 Subject: [PATCH 15/17] chore: add package lock --- package-lock.json | 324 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3bacba0 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,324 @@ +{ + "name": "opencode-apify", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "opencode-apify", + "version": "1.0.0", + "license": "Apache-2.0", + "devDependencies": { + "@opencode-ai/plugin": "^1.0.0", + "@opencode-ai/sdk": "^1.17.4", + "@types/node": "^25.2.2", + "typescript": "^5.0.0" + } + }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { + "version": "3.0.4", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@opencode-ai/plugin": { + "version": "1.17.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@opencode-ai/sdk": "1.17.4", + "effect": "4.0.0-beta.74", + "zod": "4.1.8" + }, + "peerDependencies": { + "@opentui/core": ">=0.3.4", + "@opentui/keymap": ">=0.3.4", + "@opentui/solid": ">=0.3.4" + }, + "peerDependenciesMeta": { + "@opentui/core": { + "optional": true + }, + "@opentui/keymap": { + "optional": true + }, + "@opentui/solid": { + "optional": true + } + } + }, + "node_modules/@opencode-ai/sdk": { + "version": "1.17.4", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "7.0.6" + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "25.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/effect": { + "version": "4.0.0-beta.74", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "fast-check": "^4.8.0", + "find-my-way-ts": "^0.1.6", + "ini": "^7.0.0", + "kubernetes-types": "^1.30.0", + "msgpackr": "^2.0.1", + "multipasta": "^0.2.7", + "toml": "^4.1.1", + "uuid": "^14.0.0", + "yaml": "^2.9.0" + } + }, + "node_modules/fast-check": { + "version": "4.8.0", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^8.0.0" + }, + "engines": { + "node": ">=12.17.0" + } + }, + "node_modules/find-my-way-ts": { + "version": "0.1.6", + "dev": true, + "license": "MIT" + }, + "node_modules/ini": { + "version": "7.0.0", + "dev": true, + "license": "ISC", + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/kubernetes-types": { + "version": "1.30.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/msgpackr": { + "version": "2.0.4", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "msgpackr-extract": "^3.0.4" + } + }, + "node_modules/msgpackr-extract": { + "version": "3.0.4", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build-optional-packages": "5.2.2" + }, + "bin": { + "download-msgpackr-prebuilds": "bin/download-prebuilds.js" + }, + "optionalDependencies": { + "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.4", + "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.4", + "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.4", + "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.4", + "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.4", + "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.4" + } + }, + "node_modules/multipasta": { + "version": "0.2.7", + "dev": true, + "license": "MIT" + }, + "node_modules/node-gyp-build-optional-packages": { + "version": "5.2.2", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.1" + }, + "bin": { + "node-gyp-build-optional-packages": "bin.js", + "node-gyp-build-optional-packages-optional": "optional.js", + "node-gyp-build-optional-packages-test": "build-test.js" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pure-rand": { + "version": "8.4.0", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/toml": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "dev": true, + "license": "MIT" + }, + "node_modules/uuid": { + "version": "14.0.0", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, + "node_modules/which": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/yaml": { + "version": "2.9.0", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/zod": { + "version": "4.1.8", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} From de02da8b19d0a783c62a76e5d3493879b0b057f2 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Fri, 19 Jun 2026 07:38:33 +0200 Subject: [PATCH 16/17] chore: ci cd based on n8n --- .github/workflows/publish.yml | 68 ++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d379ef4..d265e68 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,27 +1,39 @@ -name: Publish to NPM +name: Release & Publish Apify OpenCode Plugin on: release: types: [published] +permissions: + id-token: write + contents: write + jobs: - publish: + build_and_release: runs-on: ubuntu-latest - permissions: - contents: read - id-token: write + steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + fetch-depth: 0 - - uses: actions/setup-node@v4 + - name: Set up Node.js & cache npm + uses: actions/setup-node@v6 with: - node-version: 22 - registry-url: https://registry.npmjs.org + node-version: '24.x' + registry-url: 'https://registry.npmjs.org' + cache: npm - - name: Set version from release tag - run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version + - name: Install dependencies + run: npm ci - - run: npm install + - name: Type check + run: npm run check + + - name: Build project + run: npm run build - name: Verify plugin assets exist run: | @@ -29,9 +41,31 @@ jobs: test -f instructions/apify-routing.md test -d skills - - run: npm run check - - run: npm run build + - name: Extract release version + id: get_version + run: | + FULL_TAG_NAME="${{ github.event.release.tag_name }}" + VERSION_NUMBER="${FULL_TAG_NAME#v}" + echo "VERSION=${VERSION_NUMBER}" >> $GITHUB_ENV + + - name: Update package.json version + run: | + echo "Updating package.json to version ${{ env.VERSION }}" + npm version ${{ env.VERSION }} --no-git-tag-version - - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Commit version update + uses: apify/actions/signed-commit@v1.1.2 + with: + message: "chore(release): set version to ${{ env.VERSION }} [skip ci]" + add: 'package.json' + github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + branch: ${{ github.event.release.target_commitish }} + + - name: Publish to npm + run: | + if npm view opencode-apify@${{ env.VERSION }} version > /dev/null 2>&1; then + echo "Version ${{ env.VERSION }} of opencode-apify is already published to npm. Skipping publish step." + else + echo "Publishing opencode-apify@${{ env.VERSION }} to npm..." + npm publish --provenance --access public + fi From 2c3cc6b73742f7bfee7b7f82df13da454cee91e4 Mon Sep 17 00:00:00 2001 From: Jakub Vacek Date: Wed, 24 Jun 2026 10:03:42 +0200 Subject: [PATCH 17/17] fix: incorrect action name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jiří Spilka --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f82a6c3..64aac1a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The plugin uses **three setup paths** depending on what you're doing. The `apify ### Path 1 — Using existing Actors through MCP -Uses **OAuth**. The first time the agent calls a tool that needs auth (for example `run-actor` or `get-dataset-items`), Open Code opens `console.apify.com` in your browser and asks you to sign in. Read-only tools such as `search-actors`, `fetch-actor-details`, `search-apify-docs`, and `fetch-apify-docs` work without auth. +Uses **OAuth**. The first time the agent calls a tool that needs auth (for example `call-actor` or `get-dataset-items`), Open Code opens `console.apify.com` in your browser and asks you to sign in. Read-only tools such as `search-actors`, `fetch-actor-details`, `search-apify-docs`, and `fetch-apify-docs` work without auth. ### Path 2 — CLI workflows for Actor development, actorization, or scraper runs