GeezerVison is showing github.com — OpenCode Desktop app (#5044) · nocksock/opencode@cd6bfb3
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/publish.yml +74Lines changed: 74 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,7 @@ permissions: | 26 | 26 | jobs: | 27 | 27 | publish: | 28 | 28 | runs-on: blacksmith-4vcpu-ubuntu-2404 | | 29 | + if: github.repository == 'sst/opencode' | 29 | 30 | steps: | 30 | 31 | - uses: actions/checkout@v3 | 31 | 32 | with: | | 79 | 80 | GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} | 80 | 81 | AUR_KEY: ${{ secrets.AUR_KEY }} | 81 | 82 | OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | | 83 | + | | 84 | + publish-tauri: | | 85 | + strategy: | | 86 | + matrix: | | 87 | + settings: | | 88 | + - host: macos-latest | | 89 | + target: x86_64-apple-darwin | | 90 | + - host: macos-latest | | 91 | + target: aarch64-apple-darwin | | 92 | + - host: windows-latest | | 93 | + target: x86_64-pc-windows-msvc | | 94 | + - host: ubuntu-24.04 | | 95 | + target: x86_64-unknown-linux-gnu | | 96 | + runs-on: ${{ matrix.settings.host }} | | 97 | + steps: | | 98 | + - uses: actions/checkout@v3 | | 99 | + with: | | 100 | + fetch-depth: 0 | | 101 | + | | 102 | + - run: git fetch --force --tags | | 103 | + | | 104 | + - uses: ./.github/actions/setup-bun | | 105 | + | | 106 | + - name: install dependencies (ubuntu only) | | 107 | + if: startsWith(matrix.settings.host, 'ubuntu') | | 108 | + run: | | | 109 | + sudo apt-get update | | 110 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | | 111 | +
| | 112 | + - name: install Rust stable | | 113 | + uses: dtolnay/rust-toolchain@stable | | 114 | + with: | | 115 | + targets: ${{ matrix.settings.target }} | | 116 | + | | 117 | + - uses: Swatinem/rust-cache@v2 | | 118 | + with: | | 119 | + workspaces: packages/tauri/src-tauri | | 120 | + shared-key: ${{ matrix.settings.target }} | | 121 | + | | 122 | + - name: Prepare | | 123 | + run: | | | 124 | + cd packages/tauri | | 125 | + bun ./scripts/prepare.ts | | 126 | + env: | | 127 | + OPENCODE_BUMP: ${{ inputs.bump }} | | 128 | + OPENCODE_VERSION: ${{ inputs.version }} | | 129 | + OPENCODE_CHANNEL: latest | | 130 | + NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | | 131 | + GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} | | 132 | + AUR_KEY: ${{ secrets.AUR_KEY }} | | 133 | + OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | | 134 | + RUST_TARGET: ${{ matrix.settings.target }} | | 135 | + GH_TOKEN: ${{ github.token }} | | 136 | + | | 137 | + # Fixes AppImage build issues, can be removed when https://github.com/tauri-apps/tauri/pull/12491 is released | | 138 | + - run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/truly-portable-appimage | | 139 | + if: startsWith(matrix.settings.host, 'ubuntu') | | 140 | + | | 141 | + - name: Build and upload artifacts | | 142 | + uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a | | 143 | + env: | | 144 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | | 145 | + TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true | | 146 | + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | | 147 | + with: | | 148 | + projectPath: packages/tauri | | 149 | + uploadWorkflowArtifacts: true | | 150 | + tauriScript: ${{ (startsWith(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }} | | 151 | + args: --target ${{ matrix.settings.target }} | | 152 | + updaterJsonPreferNsis: true | | 153 | + releaseDraft: true | | 154 | + tagName: ${{ inputs.version }} | | 155 | + releaseName: ${{ inputs.version }} |
Collapse file Copy file name to clipboardExpand all lines: .gitignore +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 | Session.vim | 19 | 19 | opencode.json | 20 | 20 | a.out | | 21 | +target |
Collapse file Copy file name to clipboardExpand all lines: bun.lock +215-10Lines changed: 215 additions & 10 deletions Collapse file Copy file name to clipboardExpand all lines: packages/desktop/package.json +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | "version": "1.0.133", | 4 | 4 | "description": "", | 5 | 5 | "type": "module", | | 6 | + "exports": { | | 7 | + ".": "./src/index.tsx", | | 8 | + "./vite": "./vite.js" | | 9 | + }, | 6 | 10 | "scripts": { | 7 | 11 | "typecheck": "tsgo --noEmit", | 8 | 12 | "start": "vite", | |
Collapse file Copy file name to clipboardExpand all lines: packages/desktop/src/pages/layout.tsx +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ export default function Layout(props: ParentProps) { | 35 | 35 |
| 36 | 36 | return ( | 37 | 37 | <div class="relative h-screen flex flex-col"> | 38 | | - <header class="h-12 shrink-0 bg-background-base border-b border-border-weak-base flex"> | | 38 | + <header class="h-12 shrink-0 bg-background-base border-b border-border-weak-base flex" data-tauri-drag-region> | 39 | 39 | <A | 40 | 40 | href="/" | 41 | 41 | classList={{ | @@ -44,6 +44,7 @@ export default function Layout(props: ParentProps) { | 44 | 44 | "border-r border-border-weak-base": true, | 45 | 45 | }} | 46 | 46 | style={{ width: layout.sidebar.opened() ? `${layout.sidebar.width()}px` : undefined }} | | 47 | + data-tauri-drag-region | 47 | 48 | > | 48 | 49 | <Mark class="shrink-0" /> | 49 | 50 | </A> | @@ -215,7 +216,7 @@ export default function Layout(props: ParentProps) { | 215 | 216 | > | 216 | 217 | <Tooltip placement="right" value={session.title}> | 217 | 218 | <div | 218 | | - class="w-full px-2 py-1 rounded-md | | 219 | + class="w-full px-2 py-1 rounded-md | 219 | 220 | group-data-[active=true]/session:bg-surface-raised-base-hover | 220 | 221 | group-hover/session:bg-surface-raised-base-hover | 221 | 222 | group-focus/session:bg-surface-raised-base-hover" | |
Collapse file Copy file name to clipboard +2-12Lines changed: 2 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { defineConfig } from "vite" | 2 | | -import solidPlugin from "vite-plugin-solid" | 3 | | -import tailwindcss from "@tailwindcss/vite" | 4 | | -import path from "path" | | 2 | +import desktopPlugin from "./vite" | 5 | 3 |
| 6 | 4 | export default defineConfig({ | 7 | | - resolve: { | 8 | | - alias: { | 9 | | - "@": path.resolve(__dirname, "./src"), | 10 | | - }, | 11 | | - }, | 12 | | - plugins: [tailwindcss(), solidPlugin()] as any, | | 5 | + plugins: [desktopPlugin] as any, | 13 | 6 | server: { | 14 | 7 | host: "0.0.0.0", | 15 | 8 | allowedHosts: true, | @@ -18,7 +11,4 @@ export default defineConfig({ | 18 | 11 | build: { | 19 | 12 | target: "esnext", | 20 | 13 | }, | 21 | | - worker: { | 22 | | - format: "es", | 23 | | - }, | 24 | 14 | }) |
Collapse file Copy file name to clipboard +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import solidPlugin from "vite-plugin-solid" | | 2 | +import tailwindcss from "@tailwindcss/vite" | | 3 | +import { fileURLToPath } from "url" | | 4 | + | | 5 | +/** | | 6 | + * @type {import("vite").PluginOption} | | 7 | + */ | | 8 | +export default [ | | 9 | + { | | 10 | + name: "opencode-desktop:config", | | 11 | + config() { | | 12 | + return { | | 13 | + resolve: { | | 14 | + alias: { | | 15 | + "@": fileURLToPath(new URL("./src", import.meta.url)), | | 16 | + }, | | 17 | + }, | | 18 | + worker: { | | 19 | + format: "es", | | 20 | + }, | | 21 | + } | | 22 | + }, | | 23 | + }, | | 24 | + tailwindcss(), | | 25 | + solidPlugin(), | | 26 | +] |
Collapse file Copy file name to clipboard +22-29Lines changed: 22 additions & 29 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | <!doctype html> | 2 | 2 | <html lang="en"> | 3 | 3 | <head> | 4 | | - <meta charset="UTF-8" /> | 5 | | - <link rel="stylesheet" href="/src/styles.css" /> | 6 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | 7 | | - <title>Tauri App</title> | 8 | | - <script type="module" src="/src/main.ts" defer></script> | | 4 | + <meta charset="utf-8" /> | | 5 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> | | 6 | + <title>OpenCode</title> | | 7 | + <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" /> | | 8 | + <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | | 9 | + <link rel="shortcut icon" href="/favicon.ico" /> | | 10 | + <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> | | 11 | + <link rel="manifest" href="/site.webmanifest" /> | | 12 | + <meta name="theme-color" content="#F8F7F7" /> | | 13 | + <meta name="theme-color" content="#131010" media="(prefers-color-scheme: dark)" /> | | 14 | + <meta property="og:image" content="/social-share.png" /> | | 15 | + <meta property="twitter:image" content="/social-share.png" /> | 9 | 16 | </head> | 10 | | - | 11 | | - <body> | 12 | | - <main class="container"> | 13 | | - <h1>Welcome to Tauri</h1> | 14 | | - | 15 | | - <div class="row"> | 16 | | - <a href="https://vite.dev" target="_blank"> | 17 | | - <img src="/src/assets/vite.svg" class="logo vite" alt="Vite logo" /> | 18 | | - </a> | 19 | | - <a href="https://tauri.app" target="_blank"> | 20 | | - <img src="/src/assets/tauri.svg" class="logo tauri" alt="Tauri logo" /> | 21 | | - </a> | 22 | | - <a href="https://www.typescriptlang.org/docs" target="_blank"> | 23 | | - <img src="/src/assets/typescript.svg" class="logo typescript" alt="typescript logo" /> | 24 | | - </a> | 25 | | - </div> | 26 | | - <p>Click on the Tauri logo to learn more about the framework</p> | 27 | | - | 28 | | - <form class="row" id="greet-form"> | 29 | | - <input id="greet-input" placeholder="Enter a name..." /> | 30 | | - <button type="submit">Greet</button> | 31 | | - </form> | 32 | | - <p id="greet-msg"></p> | 33 | | - </main> | | 17 | + <body class="antialiased overscroll-none select-none text-12-regular"> | | 18 | + <script> | | 19 | + ;(function () { | | 20 | + const savedTheme = localStorage.getItem("theme") || "oc-1" | | 21 | + document.documentElement.setAttribute("data-theme", savedTheme) | | 22 | + })() | | 23 | + </script> | | 24 | + <noscript>You need to enable JavaScript to run this app.</noscript> | | 25 | + <div id="root"></div> | | 26 | + <script src="/src/index.ts" type="module"></script> | 34 | 27 | </body> | 35 | 28 | </html> |
Collapse file Copy file name to clipboardExpand all lines: packages/tauri/package.json +11-3Lines changed: 11 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | "version": "1.0.133", | 5 | 5 | "type": "module", | 6 | 6 | "scripts": { | | 7 | + "predev": "bun ./scripts/predev.ts", | 7 | 8 | "dev": "vite", | 8 | 9 | "build": "tsc && vite build", | 9 | 10 | "preview": "vite preview", | 10 | 11 | "tauri": "tauri" | 11 | 12 | }, | 12 | 13 | "dependencies": { | | 14 | + "@opencode-ai/desktop": "workspace:*", | 13 | 15 | "@tauri-apps/api": "^2", | 14 | | - "@tauri-apps/plugin-opener": "^2" | | 16 | + "@tauri-apps/plugin-dialog": "~2", | | 17 | + "@tauri-apps/plugin-opener": "^2", | | 18 | + "@tauri-apps/plugin-shell": "~2", | | 19 | + "@tauri-apps/plugin-updater": "~2", | | 20 | + "solid-js": "catalog:" | 15 | 21 | }, | 16 | 22 | "devDependencies": { | | 23 | + "@actions/artifact": "4.0.0", | 17 | 24 | "@tauri-apps/cli": "^2", | 18 | | - "vite": "^6.0.3", | 19 | | - "typescript": "~5.6.2" | | 25 | + "@types/bun": "catalog:", | | 26 | + "typescript": "~5.6.2", | | 27 | + "vite": "catalog:" | 20 | 28 | } | 21 | 29 | } |
Collapse file Copy file name to clipboard +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { $ } from "bun" | | 2 | +import * as path from "node:path" | | 3 | + | | 4 | +import { RUST_TARGET } from "./utils" | | 5 | + | | 6 | +if (!RUST_TARGET) throw new Error("RUST_TARGET not defined") | | 7 | + | | 8 | +const BUNDLE_DIR = `src-tauri/target/${RUST_TARGET}/release/bundle` | | 9 | +const BUNDLES_OUT_DIR = path.join(process.cwd(), `src-tauri/target/bundles`) | | 10 | + | | 11 | +await $`mkdir -p ${BUNDLES_OUT_DIR}` | | 12 | +await $`cp -r ${BUNDLE_DIR}/*/OpenCode* ${BUNDLES_OUT_DIR}` |
|