diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 115e10e59f..3b5298f99b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,7 +35,9 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || inpu permissions: id-token: write contents: write + issues: write # kilocode_change - label automated JetBrains CLI pin bump PRs packages: write + pull-requests: write # kilocode_change - create automated JetBrains CLI pin bump PRs jobs: version: diff --git a/.kilo/skills/release-jetbrains/script/set-pin.ts b/.kilo/skills/release-jetbrains/script/set-pin.ts index 371cf3ddf4..479c8703e2 100644 --- a/.kilo/skills/release-jetbrains/script/set-pin.ts +++ b/.kilo/skills/release-jetbrains/script/set-pin.ts @@ -6,6 +6,7 @@ import { parseArgs } from "util" const repo = process.env.GH_REPO ?? process.env.GITHUB_REPOSITORY ?? "Kilo-Org/kilocode" const file = "packages/kilo-jetbrains/package.json" +const label = "jetbrains-cli-pin-bump" const asset = [ "kilo-darwin-arm64.zip", "kilo-darwin-x64.zip", @@ -101,10 +102,12 @@ async function pr(version: string) { const view = await $`gh pr view ${branch} --repo ${repo} --json url --jq .url`.quiet().nothrow() if (view.exitCode === 0 && view.stdout.toString().trim()) { await $`gh pr edit ${branch} --repo ${repo} --title ${title} --body ${desc}` + await tag(branch) console.log(view.stdout.toString().trim()) return } const url = await $`gh pr create --repo ${repo} --base main --head ${branch} --title ${title} --body ${desc}`.text() + await tag(branch) console.log(url.trim()) } @@ -138,3 +141,11 @@ async function ensure(branch: string, sha: string) { } await $`gh api --method POST ${`repos/${repo}/git/refs`} -f ref=${`refs/heads/${branch}`} -f sha=${sha}`.quiet() } + +async function tag(branch: string) { + await $`gh label create ${label} --repo ${repo} --color 1D76DB --description ${"JetBrains pinned CLI version bump"}`.quiet().nothrow() + const result = await $`gh pr edit ${branch} --repo ${repo} --add-label ${label}`.quiet().nothrow() + if (result.exitCode !== 0) { + console.warn(`Warning: failed to add ${label} label to ${branch}`) + } +} diff --git a/packages/kilo-jetbrains/AGENTS.md b/packages/kilo-jetbrains/AGENTS.md index e7e83f3f4d..714f92feb0 100644 --- a/packages/kilo-jetbrains/AGENTS.md +++ b/packages/kilo-jetbrains/AGENTS.md @@ -188,6 +188,8 @@ The JetBrains plugin has two independent CLI controls. Use the commands below di `set-pin.ts` refuses versions whose CLI release or runtime assets do not exist, so it cannot create a pin that would 404 during runtime download. +Stable CLI releases also attempt this PR automatically after publishing and label it `jetbrains-cli-pin-bump`. The CLI release workflow logs the PR URL when creation succeeds and logs a warning without failing the release if PR creation fails. + For the full release process (resolve version, pin verification, prepare, changelog, publish), load the `release-jetbrains` skill: `.kilo/skills/release-jetbrains/SKILL.md`. ### Server Protocol diff --git a/packages/kilo-jetbrains/RELEASING.md b/packages/kilo-jetbrains/RELEASING.md index a485813629..606065a27d 100644 --- a/packages/kilo-jetbrains/RELEASING.md +++ b/packages/kilo-jetbrains/RELEASING.md @@ -48,6 +48,8 @@ bun .kilo/skills/release-jetbrains/script/set-pin.ts --latest --pr Merge the generated pin PR first, then re-run `check-pin.ts` and dispatch prepare. Do not dispatch prepare from a local-only pin edit. +Stable CLI releases also try to open this pin bump PR automatically after publishing. The PR is labeled `jetbrains-cli-pin-bump`. Release publishing does not fail if creating the PR fails; inspect the publish log for either the PR URL or the warning with manual follow-up instructions. + ## Create Release Tag And PR 1. Open the GitHub Actions workflow: diff --git a/script/publish.ts b/script/publish.ts index 8bfa2ff85e..54558c43d2 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -6,6 +6,11 @@ import { fileURLToPath } from "url" console.log("=== publishing ===\n") +// kilocode_change start - keep JetBrains CLI pin reviewable outside CLI release commits +const jetbrainsPkg = fileURLToPath(new URL("../packages/kilo-jetbrains/package.json", import.meta.url)) +const jetbrainsPin = await Bun.file(jetbrainsPkg).text() +// kilocode_change end + // kilocode_change start - consume changesets on the publish runner so changelog // changes are included in the release commit. Previously this ran in the // version job on a separate runner whose workspace was discarded. @@ -42,6 +47,13 @@ const pkgjsons = await Array.fromAsync( ).then((arr) => arr.filter((x) => !x.includes("node_modules") && !x.includes("dist"))) for (const file of pkgjsons) { + // kilocode_change start - create a follow-up PR for JetBrains CLI pin bumps + if (file === jetbrainsPkg) { + console.log("preserved JetBrains CLI pin:", file) + await Bun.file(file).write(jetbrainsPin) + continue + } + // kilocode_change end let pkg = await Bun.file(file).text() pkg = pkg.replaceAll(/"version": "[^"]+"/g, `"version": "${Script.version}"`) console.log("updated:", file) @@ -122,3 +134,34 @@ await import(`../packages/kilo-vscode/script/publish.ts`) const dir = fileURLToPath(new URL("..", import.meta.url)) process.chdir(dir) + +// kilocode_change start - non-blocking JetBrains CLI pin bump PR after stable CLI release +await createJetbrainsPinPr() +// kilocode_change end + +// kilocode_change start +async function createJetbrainsPinPr() { + console.log("\n=== jetbrains cli pin bump pr ===\n") + if (!Script.release) { + console.log("Skipping JetBrains CLI pin bump PR: not a release build") + return + } + if (Script.preview) { + console.log(`Skipping JetBrains CLI pin bump PR for pre-release v${Script.version}`) + return + } + const result = await $`bun .kilo/skills/release-jetbrains/script/set-pin.ts --version ${Script.version} --pr`.nothrow() + const out = result.stdout.toString().trim() + const err = result.stderr.toString().trim() + if (result.exitCode === 0) { + if (out) console.log(out) + const url = out.match(/https:\/\/github\.com\/\S+\/pull\/\d+/)?.[0] + if (url) console.log(`::notice title=JetBrains CLI pin bump PR::${url}`) + return + } + console.warn("JetBrains CLI pin bump PR creation failed; release will continue.") + if (out) console.warn(out) + if (err) console.warn(err) + console.warn("::warning title=JetBrains CLI pin bump PR failed::Release completed, but the JetBrains CLI pin bump PR was not created. Check the logs above and create it manually if needed.") +} +// kilocode_change end