-
Notifications
You must be signed in to change notification settings - Fork 3.7k
OpenCode Desktop app #5044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
OpenCode Desktop app #5044
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4b1343b
OpenCode Desktop
Brendonovich 3504e66
add updater endpoint
Brendonovich 0968529
updater dialog
Brendonovich b5864e2
remove needs
Brendonovich 6ce8181
point at my fork for a bit
Brendonovich b812ff2
remove concurrency temporarily
Brendonovich 780b891
fix build
Brendonovich f955b78
fix build
Brendonovich 46e2e80
update pubkey
Brendonovich 9bd55e2
proper verison numbers
Brendonovich 80e3a0b
correct update version comparator
Brendonovich 9bd77b3
complete rebase
Brendonovich 53bdd09
add back concurrency
Brendonovich 2a0b01a
restore custom runner
Brendonovich d6fae13
reorder keys
Brendonovich 3ea50fb
add tauri cli patch comment
Brendonovich 0e94b4e
use desktop vite plugin
Brendonovich 085910f
update public key
Brendonovich e3a2e5f
remove TAURI_SIGNING_PRIVATE_KEY_PASSWORD usage
Brendonovich 7d73315
Merge branch 'dev' into tauri-prod
adamdotdevin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ refs | |
| Session.vim | ||
| opencode.json | ||
| a.out | ||
| target | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import solidPlugin from "vite-plugin-solid" | ||
| import tailwindcss from "@tailwindcss/vite" | ||
| import { fileURLToPath } from "url" | ||
|
|
||
| /** | ||
| * @type {import("vite").PluginOption} | ||
| */ | ||
| export default [ | ||
| { | ||
| name: "opencode-desktop:config", | ||
| config() { | ||
| return { | ||
| resolve: { | ||
| alias: { | ||
| "@": fileURLToPath(new URL("./src", import.meta.url)), | ||
| }, | ||
| }, | ||
| worker: { | ||
| format: "es", | ||
| }, | ||
| } | ||
| }, | ||
| }, | ||
| tailwindcss(), | ||
| solidPlugin(), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,28 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="stylesheet" href="/src/styles.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Tauri App</title> | ||
| <script type="module" src="/src/main.ts" defer></script> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <title>OpenCode</title> | ||
| <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" /> | ||
| <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
| <link rel="shortcut icon" href="/favicon.ico" /> | ||
| <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> | ||
| <link rel="manifest" href="/site.webmanifest" /> | ||
| <meta name="theme-color" content="#F8F7F7" /> | ||
| <meta name="theme-color" content="#131010" media="(prefers-color-scheme: dark)" /> | ||
| <meta property="og:image" content="/social-share.png" /> | ||
| <meta property="twitter:image" content="/social-share.png" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <main class="container"> | ||
| <h1>Welcome to Tauri</h1> | ||
|
|
||
| <div class="row"> | ||
| <a href="https://vite.dev" target="_blank"> | ||
| <img src="/src/assets/vite.svg" class="logo vite" alt="Vite logo" /> | ||
| </a> | ||
| <a href="https://tauri.app" target="_blank"> | ||
| <img src="/src/assets/tauri.svg" class="logo tauri" alt="Tauri logo" /> | ||
| </a> | ||
| <a href="https://www.typescriptlang.org/docs" target="_blank"> | ||
| <img src="/src/assets/typescript.svg" class="logo typescript" alt="typescript logo" /> | ||
| </a> | ||
| </div> | ||
| <p>Click on the Tauri logo to learn more about the framework</p> | ||
|
|
||
| <form class="row" id="greet-form"> | ||
| <input id="greet-input" placeholder="Enter a name..." /> | ||
| <button type="submit">Greet</button> | ||
| </form> | ||
| <p id="greet-msg"></p> | ||
| </main> | ||
| <body class="antialiased overscroll-none select-none text-12-regular"> | ||
| <script> | ||
| ;(function () { | ||
| const savedTheme = localStorage.getItem("theme") || "oc-1" | ||
| document.documentElement.setAttribute("data-theme", savedTheme) | ||
| })() | ||
| </script> | ||
| <noscript>You need to enable JavaScript to run this app.</noscript> | ||
| <div id="root"></div> | ||
| <script src="/src/index.ts" type="module"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { $ } from "bun" | ||
| import * as path from "node:path" | ||
|
|
||
| import { RUST_TARGET } from "./utils" | ||
|
|
||
| if (!RUST_TARGET) throw new Error("RUST_TARGET not defined") | ||
|
|
||
| const BUNDLE_DIR = `src-tauri/target/${RUST_TARGET}/release/bundle` | ||
| const BUNDLES_OUT_DIR = path.join(process.cwd(), `src-tauri/target/bundles`) | ||
|
|
||
| await $`mkdir -p ${BUNDLES_OUT_DIR}` | ||
| await $`cp -r ${BUNDLE_DIR}/*/OpenCode* ${BUNDLES_OUT_DIR}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import * as fs from "node:fs/promises" | ||
| import { $ } from "bun" | ||
|
|
||
| import { copyBinaryToSidecarFolder, getCurrentSidecar } from "./utils" | ||
|
|
||
| const RUST_TARGET = Bun.env.TAURI_ENV_TARGET_TRIPLE | ||
|
|
||
| const sidecarConfig = getCurrentSidecar(RUST_TARGET) | ||
|
|
||
| const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode` | ||
|
|
||
| if (!(await fs.exists(binaryPath))) { | ||
| console.log("opencode binary not found, building...") | ||
| await $`cd ../opencode && bun run build --single` | ||
| } | ||
|
|
||
| await copyBinaryToSidecarFolder(binaryPath, RUST_TARGET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env bun | ||
|
|
||
| import { $ } from "bun" | ||
|
|
||
| import { copyBinaryToSidecarFolder, getCurrentSidecar } from "./utils" | ||
|
|
||
| const sidecarConfig = getCurrentSidecar() | ||
|
|
||
| const dir = "src-tauri/target/opencode-binaries" | ||
|
|
||
| await $`mkdir -p ${dir}` | ||
| await $`gh release download --pattern ${sidecarConfig.ocBinary}.${sidecarConfig.assetExt} --repo sst/opencode --skip-existing --dir ${dir}` | ||
|
|
||
| if (sidecarConfig.assetExt === "tar.gz") { | ||
| await $`tar -xvzf ${dir}/${sidecarConfig.ocBinary}.${sidecarConfig.assetExt} -C ${dir}` | ||
| } else { | ||
| await $`unzip -o ${dir}/${sidecarConfig.ocBinary}.${sidecarConfig.assetExt} -d ${dir}` | ||
| } | ||
|
|
||
| await copyBinaryToSidecarFolder(`${dir}/opencode${process.platform === "win32" ? ".exe" : ""}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { $ } from "bun" | ||
|
|
||
| export const SIDECAR_BINARIES: Array<{ rustTarget: string; ocBinary: string; assetExt: string }> = [ | ||
| { | ||
| rustTarget: "aarch64-apple-darwin", | ||
| ocBinary: "opencode-darwin-arm64", | ||
| assetExt: "zip", | ||
| }, | ||
| { | ||
| rustTarget: "x86_64-apple-darwin", | ||
| ocBinary: "opencode-darwin-x64", | ||
| assetExt: "zip", | ||
| }, | ||
| { | ||
| rustTarget: "x86_64-pc-windows-msvc", | ||
| ocBinary: "opencode-windows-x64", | ||
| assetExt: "zip", | ||
| }, | ||
| { | ||
| rustTarget: "x86_64-unknown-linux-gnu", | ||
| ocBinary: "opencode-linux-x64", | ||
| assetExt: "tar.gz", | ||
| }, | ||
| ] | ||
|
|
||
| export const RUST_TARGET = Bun.env.RUST_TARGET | ||
|
|
||
| export function getCurrentSidecar(target = RUST_TARGET) { | ||
| if (!target && !RUST_TARGET) throw new Error("RUST_TARGET not set") | ||
|
|
||
| const binaryConfig = SIDECAR_BINARIES.find((b) => b.rustTarget === target) | ||
| if (!binaryConfig) throw new Error(`Sidecar configuration not available for Rust target '${RUST_TARGET}'`) | ||
|
|
||
| return binaryConfig | ||
| } | ||
|
|
||
| export async function copyBinaryToSidecarFolder(source: string, target = RUST_TARGET) { | ||
| await $`mkdir -p src-tauri/sidecars` | ||
| const dest = `src-tauri/sidecars/opencode-${target}${process.platform === "win32" ? ".exe" : ""}` | ||
| await $`cp ${source} ${dest}` | ||
|
|
||
| console.log(`Copied ${source} to ${dest}`) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ | |
| # Generated by Tauri | ||
| # will have schema files for capabilities auto-completion | ||
| /gen/schemas | ||
|
|
||
| sidecars | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all be replaced by just providing
releaseId, which will likely need to be derived from thepublishjob