diff --git a/.github/workflows/sync-zed-extension.yml b/.github/workflows/sync-zed-extension.yml deleted file mode 100644 index 6e4b44083..000000000 --- a/.github/workflows/sync-zed-extension.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: "sync-zed-extension" - -on: - workflow_dispatch: - release: - types: [published] - -jobs: - zed: - name: Release Zed Extension - runs-on: blacksmith-4vcpu-ubuntu-2404 - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - fetch-depth: 0 - - - uses: ./.github/actions/setup-bun - - - name: Get version tag - id: get_tag - run: | - if [ "${{ github.event_name }}" = "release" ]; then - TAG="${{ github.event.release.tag_name }}" - else - TAG=$(git tag --list 'v[0-9]*.*' --sort=-version:refname | head -n 1) - fi - echo "tag=${TAG}" >> $GITHUB_OUTPUT - echo "Using tag: ${TAG}" - - - name: Sync Zed extension - run: | - ./script/sync-zed.ts ${{ steps.get_tag.outputs.tag }} - env: - ZED_EXTENSIONS_PAT: ${{ secrets.ZED_EXTENSIONS_PAT }} - ZED_PR_PAT: ${{ secrets.ZED_PR_PAT }} diff --git a/packages/extensions/zed/LICENSE b/packages/extensions/zed/LICENSE deleted file mode 120000 index 5853aaea5..000000000 --- a/packages/extensions/zed/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../LICENSE \ No newline at end of file diff --git a/packages/extensions/zed/extension.toml b/packages/extensions/zed/extension.toml deleted file mode 100644 index a669a3a5d..000000000 --- a/packages/extensions/zed/extension.toml +++ /dev/null @@ -1,36 +0,0 @@ -id = "opencode" -name = "OpenCode" -description = "The open source coding agent." -version = "1.15.13" -schema_version = 1 -authors = ["Anomaly"] -repository = "https://github.com/anomalyco/opencode" - -[agent_servers.opencode] -name = "OpenCode" -icon = "./icons/opencode.svg" - -[agent_servers.opencode.targets.darwin-aarch64] -archive = "https://github.com/anomalyco/opencode/releases/download/v1.15.13/opencode-darwin-arm64.zip" -cmd = "./opencode" -args = ["acp"] - -[agent_servers.opencode.targets.darwin-x86_64] -archive = "https://github.com/anomalyco/opencode/releases/download/v1.15.13/opencode-darwin-x64.zip" -cmd = "./opencode" -args = ["acp"] - -[agent_servers.opencode.targets.linux-aarch64] -archive = "https://github.com/anomalyco/opencode/releases/download/v1.15.13/opencode-linux-arm64.tar.gz" -cmd = "./opencode" -args = ["acp"] - -[agent_servers.opencode.targets.linux-x86_64] -archive = "https://github.com/anomalyco/opencode/releases/download/v1.15.13/opencode-linux-x64.tar.gz" -cmd = "./opencode" -args = ["acp"] - -[agent_servers.opencode.targets.windows-x86_64] -archive = "https://github.com/anomalyco/opencode/releases/download/v1.15.13/opencode-windows-x64.zip" -cmd = "./opencode.exe" -args = ["acp"] diff --git a/packages/extensions/zed/icons/opencode.svg b/packages/extensions/zed/icons/opencode.svg deleted file mode 100644 index fc001e49b..000000000 --- a/packages/extensions/zed/icons/opencode.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/script/publish.ts b/script/publish.ts index 7e91eef76..46a265d5e 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -24,13 +24,6 @@ async function prepareReleaseFiles() { await Bun.file(file).write(pkg) } - const extensionToml = fileURLToPath(new URL("../packages/extensions/zed/extension.toml", import.meta.url)) - let toml = await Bun.file(extensionToml).text() - toml = toml.replace(/^version = "[^"]+"/m, `version = "${Script.version}"`) - toml = toml.replaceAll(/releases\/download\/v[^/]+\//g, `releases/download/v${Script.version}/`) - console.log("updated:", extensionToml) - await Bun.file(extensionToml).write(toml) - await $`bun install` await $`./packages/sdk/js/script/build.ts` } diff --git a/script/raw-changelog.ts b/script/raw-changelog.ts index c571de322..2ea76247d 100644 --- a/script/raw-changelog.ts +++ b/script/raw-changelog.ts @@ -39,7 +39,6 @@ const sections = { tauri: "Desktop", sdk: "SDK", plugin: "SDK", - "extensions/zed": "Extensions", "extensions/vscode": "Extensions", github: "Extensions", } as const @@ -75,7 +74,7 @@ async function diff(base: string, head: string) { } function section(areas: Set) { - const priority = ["core", "tui", "app", "tauri", "sdk", "plugin", "extensions/zed", "extensions/vscode", "github"] + const priority = ["core", "tui", "app", "tauri", "sdk", "plugin", "extensions/vscode", "github"] for (const area of priority) { if (areas.has(area)) return sections[area as keyof typeof sections] } @@ -138,7 +137,6 @@ async function commits(from: string, to: string) { else if (file.startsWith("packages/desktop/src-tauri/")) areas.add("tauri") else if (file.startsWith("packages/desktop/") || file.startsWith("packages/app/")) areas.add("app") else if (file.startsWith("packages/sdk/") || file.startsWith("packages/plugin/")) areas.add("sdk") - else if (file.startsWith("packages/extensions/")) areas.add("extensions/zed") else if (file.startsWith("sdks/vscode/") || file.startsWith("github/")) areas.add("extensions/vscode") } diff --git a/script/sync-zed.ts b/script/sync-zed.ts deleted file mode 100755 index 68deb6356..000000000 --- a/script/sync-zed.ts +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env bun - -import { $ } from "bun" -import { tmpdir } from "os" -import { join } from "path" - -const FORK_REPO = "anomalyco/zed-extensions" -const UPSTREAM_REPO = "zed-industries/extensions" -const EXTENSION_NAME = "opencode" - -async function main() { - const version = process.argv[2] - if (!version) throw new Error("Version argument required, ex: bun script/sync-zed.ts v1.0.52") - - const token = process.env.ZED_EXTENSIONS_PAT - if (!token) throw new Error("ZED_EXTENSIONS_PAT environment variable required") - - const prToken = process.env.ZED_PR_PAT - if (!prToken) throw new Error("ZED_PR_PAT environment variable required") - - const cleanVersion = version.replace(/^v/, "") - console.log(`📦 Syncing Zed extension for version ${cleanVersion}`) - - const commitSha = await $`git rev-parse ${version}`.text() - const sha = commitSha.trim() - console.log(`🔍 Found commit SHA: ${sha}`) - - const extensionToml = await $`git show ${version}:packages/extensions/zed/extension.toml`.text() - const parsed = Bun.TOML.parse(extensionToml) as { version: string } - const extensionVersion = parsed.version - - if (extensionVersion !== cleanVersion) { - throw new Error(`Version mismatch: extension.toml has ${extensionVersion} but tag is ${cleanVersion}`) - } - console.log(`✅ Version ${extensionVersion} matches tag`) - - // Clone the fork to a temp directory - const workDir = join(tmpdir(), `zed-extensions-${Date.now()}`) - console.log(`📁 Working in ${workDir}`) - - await $`git clone https://x-access-token:${token}@github.com/${FORK_REPO}.git ${workDir}` - process.chdir(workDir) - - // Configure git identity - await $`git config user.name "Aiden Cline"` - await $`git config user.email "63023139+rekram1-node@users.noreply.github.com "` - - // Sync fork with upstream (force reset to match exactly) - console.log(`🔄 Syncing fork with upstream...`) - await $`git remote add upstream https://github.com/${UPSTREAM_REPO}.git` - await $`git fetch upstream` - await $`git checkout main` - await $`git reset --hard upstream/main` - await $`git push origin main --force` - console.log(`✅ Fork synced (force reset to upstream)`) - - // Create a new branch - const branchName = `update-${EXTENSION_NAME}-${cleanVersion}` - console.log(`🌿 Creating branch ${branchName}`) - await $`git checkout -b ${branchName}` - - const submodulePath = `extensions/${EXTENSION_NAME}` - console.log(`📌 Updating submodule to commit ${sha}`) - await $`git submodule update --init ${submodulePath}` - process.chdir(submodulePath) - await $`git fetch` - await $`git checkout ${sha}` - process.chdir(workDir) - await $`git add ${submodulePath}` - - console.log(`📝 Updating extensions.toml`) - const extensionsTomlPath = "extensions.toml" - const extensionsToml = await Bun.file(extensionsTomlPath).text() - - const versionRegex = new RegExp(`(\\[${EXTENSION_NAME}\\][\\s\\S]*?)version = "[^"]+"`) - const updatedToml = extensionsToml.replace(versionRegex, `$1version = "${cleanVersion}"`) - - if (updatedToml === extensionsToml) { - throw new Error(`Failed to update version in extensions.toml - pattern not found`) - } - - await Bun.write(extensionsTomlPath, updatedToml) - await $`git add extensions.toml` - - const commitMessage = `Update ${EXTENSION_NAME} to v${cleanVersion}` - - await $`git commit -m ${commitMessage}` - console.log(`✅ Changes committed`) - - // Delete any existing branches for opencode updates - console.log(`🔍 Checking for existing branches...`) - const branches = await $`git ls-remote --heads https://x-access-token:${token}@github.com/${FORK_REPO}.git`.text() - const branchPattern = `refs/heads/update-${EXTENSION_NAME}-` - const oldBranches = branches - .split("\n") - .filter((line) => line.includes(branchPattern)) - .map((line) => line.split("refs/heads/")[1]) - .filter(Boolean) - - if (oldBranches.length > 0) { - console.log(`🗑️ Found ${oldBranches.length} old branch(es), deleting...`) - for (const branch of oldBranches) { - await $`git push https://x-access-token:${token}@github.com/${FORK_REPO}.git --delete ${branch}` - console.log(`✅ Deleted branch ${branch}`) - } - } - - console.log(`🚀 Pushing to fork...`) - await $`git push https://x-access-token:${token}@github.com/${FORK_REPO}.git ${branchName}` - - console.log(`📬 Creating pull request...`) - const prResult = - await $`gh pr create --repo ${UPSTREAM_REPO} --base main --head ${FORK_REPO.split("/")[0]}:${branchName} --title "Update ${EXTENSION_NAME} to v${cleanVersion}" --body "Updating OpenCode extension to v${cleanVersion}"` - .env({ ...process.env, GH_TOKEN: prToken }) - .nothrow() - - if (prResult.exitCode !== 0) { - console.error("stderr:", prResult.stderr.toString()) - throw new Error(`Failed with exit code ${prResult.exitCode}`) - } - - const prUrl = prResult.stdout.toString().trim() - console.log(`✅ Pull request created: ${prUrl}`) - console.log(`🎉 Done!`) -} - -main().catch((err) => { - console.error("❌ Error:", err.message) - process.exit(1) -})