diff --git a/.github/actions/setup-git-committer/action.yml b/.github/actions/setup-git-committer/action.yml new file mode 100644 index 00000000000..e5a57206521 --- /dev/null +++ b/.github/actions/setup-git-committer/action.yml @@ -0,0 +1,42 @@ +name: "Setup Git Committer" +description: "Create app token and configure git user" +inputs: + opencode-app-id: + description: "OpenCode GitHub App ID" + required: true + opencode-app-secret: + description: "OpenCode GitHub App private key" + required: true +outputs: + token: + description: "GitHub App token" + value: ${{ steps.apptoken.outputs.token }} + app-slug: + description: "GitHub App slug" + value: ${{ steps.apptoken.outputs.app-slug }} +runs: + using: "composite" + steps: + - name: Create app token + id: apptoken + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ inputs.opencode-app-id }} + private-key: ${{ inputs.opencode-app-secret }} + + - name: Configure git user + run: | + slug="${{ steps.apptoken.outputs.app-slug }}" + git config --global user.name "${slug}[bot]" + git config --global user.email "${slug}[bot]@users.noreply.github.com" + shell: bash + + - name: Clear checkout auth + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + shell: bash + + - name: Configure git remote + run: | + git remote set-url origin https://x-access-token:${{ steps.apptoken.outputs.token }}@github.com/${{ github.repository }} + shell: bash diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml new file mode 100644 index 00000000000..7d21bba01e7 --- /dev/null +++ b/.github/workflows/containers.yml @@ -0,0 +1,48 @@ +name: containers + +on: + push: + branches: + - dev + paths: + - packages/containers/** + - .github/workflows/containers.yml + - package.json + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build: + # kilocode_change start - disabled for kilo-cli fork (OpenCode infrastructure deployment) + if: false + # kilocode_change end + runs-on: blacksmith-4vcpu-ubuntu-2404 + env: + REGISTRY: ghcr.io/${{ github.repository_owner }} + TAG: "24.04" + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-bun + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push containers + run: bun ./packages/containers/script/build.ts --push + env: + REGISTRY: ${{ env.REGISTRY }} + TAG: ${{ env.TAG }} diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 79497a0ed35..31b3962d9db 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -19,14 +19,17 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.pull_request.head.ref || github.ref_name }} - name: Setup Bun uses: ./.github/actions/setup-bun + - name: Setup git committer + id: committer + uses: ./.github/actions/setup-git-committer + with: + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} + - name: Generate run: ./script/generate.ts @@ -36,10 +39,8 @@ jobs: echo "No changes to commit" exit 0 fi - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" git add -A - git commit -m "chore: generate" + git commit -m "chore: generate" --allow-empty git push origin HEAD:${{ github.ref_name }} --no-verify # if ! git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref_name }} --no-verify; then # echo "" diff --git a/.github/workflows/nix-hashes.yml b/.github/workflows/nix-hashes.yml index 76357006352..21f374f10fa 100644 --- a/.github/workflows/nix-hashes.yml +++ b/.github/workflows/nix-hashes.yml @@ -22,7 +22,10 @@ on: jobs: nix-hashes: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + # kilocode_change start - disabled for kilo-cli fork (OpenCode infrastructure deployment) + if: false + # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + # kilocode_change end runs-on: depot-ubuntu-24.04-4 env: TITLE: node_modules hashes @@ -36,14 +39,16 @@ jobs: ref: ${{ github.head_ref || github.ref_name }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + - name: Setup git committer + id: committer + uses: ./.github/actions/setup-git-committer + with: + opencode-app-id: ${{ vars.OPENCODE_APP_ID }} + opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }} + - name: Setup Nix uses: nixbuild/nix-quick-install-action@v34 - - name: Configure git - run: | - git config --global user.email "action@github.com" - git config --global user.name "Github Action" - - name: Pull latest changes env: TARGET_BRANCH: ${{ github.head_ref || github.ref_name }} diff --git a/AGENTS.md b/AGENTS.md index 483d99f11d2..481e262b203 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,6 +5,7 @@ Kilo CLI is an open source AI coding agent that generates code from natural lang - To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`. - ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE. - The default branch in this repo is `dev`. +- Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility. ## Style Guide diff --git a/bun.lock b/bun.lock index 1d13af50beb..350efd9ce7d 100644 --- a/bun.lock +++ b/bun.lock @@ -25,6 +25,7 @@ "name": "@opencode-ai/app", "version": "1.0.14", "dependencies": { + "@kilocode/kilo-i18n": "workspace:*", "@kilocode/sdk": "workspace:*", "@kobalte/core": "catalog:", "@opencode-ai/ui": "workspace:*", diff --git a/packages/app/src/components/dialog-select-model-unpaid.tsx b/packages/app/src/components/dialog-select-model-unpaid.tsx index 5914fe28bff..78c169777e0 100644 --- a/packages/app/src/components/dialog-select-model-unpaid.tsx +++ b/packages/app/src/components/dialog-select-model-unpaid.tsx @@ -34,8 +34,11 @@ export const DialogSelectModelUnpaid: Component = () => { }) return ( - -
+ +
{language.t("dialog.model.unpaid.freeModels.title")}
{ )}
-
+
{language.t("dialog.model.unpaid.addMore.title")}
diff --git a/packages/app/src/i18n/ar.ts b/packages/app/src/i18n/ar.ts index e478af1764a..970b5851a91 100644 --- a/packages/app/src/i18n/ar.ts +++ b/packages/app/src/i18n/ar.ts @@ -135,7 +135,8 @@ export const dict = { "provider.connect.oauth.code.invalid": "رمز التفويض غير صالح", "provider.connect.oauth.auto.visit.prefix": "قم بزيارة ", "provider.connect.oauth.auto.visit.link": "هذا الرابط", - "provider.connect.oauth.auto.visit.suffix": " وأدخل الرمز أدناه لتوصيل حسابك واستخدام نماذج {{provider}} في Kilo.", + "provider.connect.oauth.auto.visit.suffix": + " وأدخل الرمز أدناه لتوصيل حسابك واستخدام نماذج {{provider}} في Kilo.", "provider.connect.oauth.auto.confirmationCode": "رمز التأكيد", "provider.connect.toast.connected.title": "تم توصيل {{provider}}", "provider.connect.toast.connected.description": "نماذج {{provider}} متاحة الآن للاستخدام.", diff --git a/packages/app/src/i18n/fr.ts b/packages/app/src/i18n/fr.ts index 5c488fe7d61..d615ff2c8a5 100644 --- a/packages/app/src/i18n/fr.ts +++ b/packages/app/src/i18n/fr.ts @@ -370,7 +370,8 @@ export const dict = { "toast.session.listFailed.title": "Échec du chargement des sessions pour {{project}}", "toast.update.title": "Mise à jour disponible", - "toast.update.description": "Une nouvelle version d'Kilo ({{version}}) est maintenant disponible pour installation.", + "toast.update.description": + "Une nouvelle version d'Kilo ({{version}}) est maintenant disponible pour installation.", "toast.update.action.installRestart": "Installer et redémarrer", "toast.update.action.notYet": "Pas encore", @@ -511,7 +512,8 @@ export const dict = { "sidebar.workspaces.enable": "Activer les espaces de travail", "sidebar.workspaces.disable": "Désactiver les espaces de travail", "sidebar.gettingStarted.title": "Commencer", - "sidebar.gettingStarted.line1": "Kilo inclut des modèles gratuits pour que vous puissiez commencer immédiatement.", + "sidebar.gettingStarted.line1": + "Kilo inclut des modèles gratuits pour que vous puissiez commencer immédiatement.", "sidebar.gettingStarted.line2": "Connectez n'importe quel fournisseur pour utiliser des modèles, y compris Claude, GPT, Gemini etc.", "sidebar.project.recentSessions": "Sessions récentes", diff --git a/packages/app/src/i18n/th.ts b/packages/app/src/i18n/th.ts index bd4d2f4f7ff..c8c86f9edb8 100644 --- a/packages/app/src/i18n/th.ts +++ b/packages/app/src/i18n/th.ts @@ -139,7 +139,8 @@ export const dict = { "provider.connect.oauth.code.invalid": "รหัสการอนุญาตไม่ถูกต้อง", "provider.connect.oauth.auto.visit.prefix": "เยี่ยมชม ", "provider.connect.oauth.auto.visit.link": "ลิงก์นี้", - "provider.connect.oauth.auto.visit.suffix": " และป้อนรหัสด้านล่างเพื่อเชื่อมต่อบัญชีและใช้โมเดล {{provider}} ใน Kilo", + "provider.connect.oauth.auto.visit.suffix": + " และป้อนรหัสด้านล่างเพื่อเชื่อมต่อบัญชีและใช้โมเดล {{provider}} ใน Kilo", "provider.connect.oauth.auto.confirmationCode": "รหัสยืนยัน", "provider.connect.toast.connected.title": "{{provider}} ที่เชื่อมต่อแล้ว", "provider.connect.toast.connected.description": "โมเดล {{provider}} พร้อมใช้งานแล้ว", diff --git a/packages/app/src/i18n/zht.ts b/packages/app/src/i18n/zht.ts index 6f0c0ce7bd7..b4cb07d0be0 100644 --- a/packages/app/src/i18n/zht.ts +++ b/packages/app/src/i18n/zht.ts @@ -136,7 +136,8 @@ export const dict = { "provider.connect.oauth.code.invalid": "授權碼無效", "provider.connect.oauth.auto.visit.prefix": "造訪 ", "provider.connect.oauth.auto.visit.link": "此連結", - "provider.connect.oauth.auto.visit.suffix": " 並輸入以下程式碼,以連線你的帳戶並在 Kilo 中使用 {{provider}} 模型。", + "provider.connect.oauth.auto.visit.suffix": + " 並輸入以下程式碼,以連線你的帳戶並在 Kilo 中使用 {{provider}} 模型。", "provider.connect.oauth.auto.confirmationCode": "確認碼", "provider.connect.toast.connected.title": "{{provider}} 已連線", "provider.connect.toast.connected.description": "現在可以使用 {{provider}} 模型了。", diff --git a/packages/containers/README.md b/packages/containers/README.md new file mode 100644 index 00000000000..a1cfe60db3e --- /dev/null +++ b/packages/containers/README.md @@ -0,0 +1,38 @@ +# CI containers + +Prebuilt images intended to speed up GitHub Actions jobs by baking in +large, slow-to-install dependencies. These are designed for Linux jobs +that can use `job.container` in workflows. + +Images + +- `base`: Ubuntu 24.04 with common build tools and utilities +- `bun-node`: `base` plus Bun and Node.js 24 +- `rust`: `bun-node` plus Rust (stable, minimal profile) +- `tauri-linux`: `rust` plus Tauri Linux build dependencies +- `publish`: `bun-node` plus Docker CLI and AUR tooling + +Build + +``` +REGISTRY=ghcr.io/anomalyco TAG=24.04 bun ./packages/containers/script/build.ts +REGISTRY=ghcr.io/anomalyco TAG=24.04 bun ./packages/containers/script/build.ts --push +``` + +Workflow usage + +``` +jobs: + build-cli: + runs-on: ubuntu-latest + container: + image: ghcr.io/anomalyco/build/bun-node:24.04 +``` + +Notes + +- These images only help Linux jobs. macOS and Windows jobs cannot run + inside Linux containers. +- `--push` publishes multi-arch (amd64 + arm64) images using Buildx. +- If a job uses Docker Buildx, the container needs access to the host + Docker daemon (or `docker-in-docker` with privileged mode). diff --git a/packages/containers/base/Dockerfile b/packages/containers/base/Dockerfile new file mode 100644 index 00000000000..a81f4baa22a --- /dev/null +++ b/packages/containers/base/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:24.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + git \ + jq \ + openssh-client \ + pkg-config \ + python3 \ + unzip \ + xz-utils \ + zip \ + && rm -rf /var/lib/apt/lists/* diff --git a/packages/containers/bun-node/Dockerfile b/packages/containers/bun-node/Dockerfile new file mode 100644 index 00000000000..e6cad9c2725 --- /dev/null +++ b/packages/containers/bun-node/Dockerfile @@ -0,0 +1,24 @@ +ARG REGISTRY=ghcr.io/anomalyco +FROM ${REGISTRY}/build/base:24.04 + +SHELL ["/bin/bash", "-lc"] + +ARG NODE_VERSION=24.4.0 +ARG BUN_VERSION=1.3.5 + +ENV BUN_INSTALL=/opt/bun +ENV PATH=/opt/bun/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN set -euo pipefail; \ + arch=$(uname -m); \ + node_arch=x64; \ + if [ "$arch" = "aarch64" ]; then node_arch=arm64; fi; \ + curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${node_arch}.tar.xz" \ + | tar -xJf - -C /usr/local --strip-components=1; \ + corepack enable + +RUN set -euo pipefail; \ + curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"; \ + bun --version; \ + node --version; \ + npm --version diff --git a/packages/containers/publish/Dockerfile b/packages/containers/publish/Dockerfile new file mode 100644 index 00000000000..4780d22740f --- /dev/null +++ b/packages/containers/publish/Dockerfile @@ -0,0 +1,10 @@ +ARG REGISTRY=ghcr.io/anomalyco +FROM ${REGISTRY}/build/bun-node:24.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + docker.io \ + pacman-package-manager \ + && rm -rf /var/lib/apt/lists/* diff --git a/packages/containers/rust/Dockerfile b/packages/containers/rust/Dockerfile new file mode 100644 index 00000000000..533f348be76 --- /dev/null +++ b/packages/containers/rust/Dockerfile @@ -0,0 +1,13 @@ +ARG REGISTRY=ghcr.io/anomalyco +FROM ${REGISTRY}/build/bun-node:24.04 + +ARG RUST_TOOLCHAIN=stable + +ENV CARGO_HOME=/opt/cargo +ENV RUSTUP_HOME=/opt/rustup +ENV PATH=/opt/cargo/bin:/opt/bun/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN set -euo pipefail; \ + curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "${RUST_TOOLCHAIN}"; \ + rustc --version; \ + cargo --version diff --git a/packages/containers/script/build.ts b/packages/containers/script/build.ts new file mode 100644 index 00000000000..6b880e7a5b9 --- /dev/null +++ b/packages/containers/script/build.ts @@ -0,0 +1,77 @@ +#!/usr/bin/env bun + +import { $ } from "bun" +import path from "path" +import { fileURLToPath } from "url" + +const rootDir = fileURLToPath(new URL("../../..", import.meta.url)) +process.chdir(rootDir) + +const reg = process.env.REGISTRY ?? "ghcr.io/anomalyco" +const tag = process.env.TAG ?? "24.04" +const push = process.argv.includes("--push") || process.env.PUSH === "1" + +const root = path.join(rootDir, "package.json") +const pkg = await Bun.file(root).json() +const manager = pkg.packageManager ?? "" +const bun = manager.startsWith("bun@") ? manager.slice(4) : "" +if (!bun) throw new Error("packageManager must be bun@") + +const images = ["base", "bun-node", "rust", "tauri-linux", "publish"] + +const setup = async () => { + if (!push) return + const list = await $`docker buildx ls`.text() + if (list.includes("opencode")) { + await $`docker buildx use opencode` + return + } + await $`docker buildx create --name opencode --use` +} + +await setup() + +const platform = "linux/amd64,linux/arm64" + +for (const name of images) { + const image = `${reg}/build/${name}:${tag}` + const file = `packages/containers/${name}/Dockerfile` + if (name === "base") { + if (push) { + console.log(`docker buildx build --platform ${platform} -f ${file} -t ${image} --push .`) + await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --push .` + } + if (!push) { + console.log(`docker build -f ${file} -t ${image} .`) + await $`docker build -f ${file} -t ${image} .` + } + } + if (name === "bun-node") { + if (push) { + console.log( + `docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} --push .`, + ) + await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} --push .` + } + if (!push) { + console.log(`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} .`) + await $`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} --build-arg BUN_VERSION=${bun} .` + } + } + if (name !== "base" && name !== "bun-node") { + if (push) { + console.log( + `docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --push .`, + ) + await $`docker buildx build --platform ${platform} -f ${file} -t ${image} --build-arg REGISTRY=${reg} --push .` + } + if (!push) { + console.log(`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} .`) + await $`docker build -f ${file} -t ${image} --build-arg REGISTRY=${reg} .` + } + } + + if (push) { + console.log(`pushed ${image}`) + } +} diff --git a/packages/containers/tauri-linux/Dockerfile b/packages/containers/tauri-linux/Dockerfile new file mode 100644 index 00000000000..9f67a280498 --- /dev/null +++ b/packages/containers/tauri-linux/Dockerfile @@ -0,0 +1,12 @@ +ARG REGISTRY=ghcr.io/anomalyco +FROM ${REGISTRY}/build/rust:24.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libappindicator3-dev \ + libwebkit2gtk-4.1-dev \ + librsvg2-dev \ + patchelf \ + && rm -rf /var/lib/apt/lists/* diff --git a/packages/containers/tsconfig.json b/packages/containers/tsconfig.json new file mode 100644 index 00000000000..00ef1254685 --- /dev/null +++ b/packages/containers/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@tsconfig/bun/tsconfig.json", + "compilerOptions": { + "lib": ["ESNext", "DOM", "DOM.Iterable"], + "noUncheckedIndexedAccess": false + } +} diff --git a/packages/extensions/zed/extension.toml b/packages/extensions/zed/extension.toml index 8c45fc13705..00c2e776aba 100644 --- a/packages/extensions/zed/extension.toml +++ b/packages/extensions/zed/extension.toml @@ -1,7 +1,7 @@ id = "kilo" name = "Kilo" description = "The open source coding agent." -version = "1.1.44" +version = "1.1.45" schema_version = 1 authors = ["Anomaly"] repository = "https://github.com/Kilo-Org/kilo" @@ -11,26 +11,26 @@ name = "Kilo" icon = "./icons/opencode.svg" [agent_servers.opencode.targets.darwin-aarch64] -archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.44/opencode-darwin-arm64.zip" +archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.45/opencode-darwin-arm64.zip" cmd = "./opencode" args = ["acp"] [agent_servers.opencode.targets.darwin-x86_64] -archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.44/opencode-darwin-x64.zip" +archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.45/opencode-darwin-x64.zip" cmd = "./opencode" args = ["acp"] [agent_servers.opencode.targets.linux-aarch64] -archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.44/opencode-linux-arm64.tar.gz" +archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.45/opencode-linux-arm64.tar.gz" cmd = "./opencode" args = ["acp"] [agent_servers.opencode.targets.linux-x86_64] -archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.44/opencode-linux-x64.tar.gz" +archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.45/opencode-linux-x64.tar.gz" cmd = "./opencode" args = ["acp"] [agent_servers.opencode.targets.windows-x86_64] -archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.44/opencode-windows-x64.zip" +archive = "https://github.com/Kilo-Org/kilo/releases/download/v1.1.45/opencode-windows-x64.zip" cmd = "./opencode.exe" args = ["acp"] diff --git a/packages/web/src/content/docs/zen.mdx b/packages/web/src/content/docs/zen.mdx index c303b02d8f2..9c8a962217c 100644 --- a/packages/web/src/content/docs/zen.mdx +++ b/packages/web/src/content/docs/zen.mdx @@ -13,7 +13,7 @@ OpenCode Zen is a list of tested and verified models provided by the Kilo team. OpenCode Zen is currently in beta. ::: -OpenCode Zen works like any other provider in Kilo. You login to OpenCode Zen and get +Zen works like any other provider in Kilo. You login to OpenCode Zen and get your API key. It's **completely optional** and you don't need to use it to use Kilo. @@ -248,4 +248,4 @@ We created OpenCode Zen to: 1. **Benchmark** the best models/providers for coding agents. 2. Have access to the **highest quality** options and not downgrade performance or route to cheaper providers. 3. Pass along any **price drops** by selling at cost; so the only markup is to cover our processing fees. -4. Have **no lock-in** by allowing you to use it with any other coding agent. And always let you use any other provider with OpenCode as well. +4. Have **no lock-in** by allowing you to use it with any other coding agent. And always let you use any other provider with Kilo as well. diff --git a/script/changelog.ts b/script/changelog.ts index 0f3567d0f6e..adf0d6197d2 100755 --- a/script/changelog.ts +++ b/script/changelog.ts @@ -1,7 +1,7 @@ #!/usr/bin/env bun import { $ } from "bun" -import { createOpencode } from "@kilocode/sdk" +import { createOpencode } from "@kilocode/sdk/v2" import { parseArgs } from "util" export const team = [ @@ -18,13 +18,29 @@ export const team = [ "R44VC0RP", ] -export async function getLatestRelease() { - return fetch("https://api.github.com/repos/Kilo-Org/kilo/releases/latest") - .then((res) => { - if (!res.ok) throw new Error(res.statusText) - return res.json() - }) - .then((data: any) => data.tag_name.replace(/^v/, "")) +type Release = { + tag_name: string + draft: boolean + prerelease: boolean +} + +export async function getLatestRelease(skip?: string) { + const data = await fetch("https://api.github.com/repos/Kilo-Org/kilo/releases?per_page=100").then((res) => { + if (!res.ok) throw new Error(res.statusText) + return res.json() + }) + + const releases = data as Release[] + const target = skip?.replace(/^v/, "") + + for (const release of releases) { + if (release.draft) continue + const tag = release.tag_name.replace(/^v/, "") + if (target && tag === target) continue + return tag + } + + throw new Error("No releases found") } type Commit = { @@ -137,9 +153,9 @@ async function summarizeCommit(opencode: Awaited x.data?.parts?.find((y) => y.type === "text")?.text ?? message) return result.trim() } @@ -222,7 +240,7 @@ export async function buildNotes(from: string, to: string) { console.log("generating changelog since " + from) - const opencode = await createOpencode({ port: 5044 }) + const opencode = await createOpencode({ port: 0 }) const notes: string[] = [] try { @@ -242,8 +260,9 @@ export async function buildNotes(from: string, to: string) { throw error } } finally { - opencode.server.close() + await opencode.server.close() } + console.log("changelog generation complete") const contributors = await getContributors(from, to) diff --git a/script/publish.ts b/script/publish.ts index 23a6e5c9dfc..84abe6a66a3 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -2,7 +2,6 @@ import { $ } from "bun" import { Script } from "@opencode-ai/script" -import { buildNotes, getLatestRelease } from "./changelog" const highlightsTemplate = `