Skip to content

Add pre-release publishing support to the VS Code extension #8156

@kilo-code-bot

Description

@kilo-code-bot

Context

We want the ability to publish pre-release versions of the VS Code extension alongside regular releases, using the VS Code Marketplace's built-in pre-release channel. This gives users an opt-in "Switch to Pre-Release Version" button in the marketplace UI.

How VS Code Marketplace pre-releases work

Documentation: VS Code Pre-release Extensions

  • Publishing: Pass --pre-release to vsce package and vsce publish
  • Version format: Only major.minor.patch — semver pre-release tags like -beta.1 are not supported (vsce PR #666, vsmarketplace#310)
  • User experience: Users opt in via the marketplace UI; a "Switch to Pre-Release Version" button appears on the extension page
  • Open VSX: Also supports --pre-release (openvsx#386, openvsx PR #410)

Auto-update behavior (key docs quotes)

From VS Code docs:

"VS Code will automatically update extensions to the highest version available, so even if a user opted-into a pre-release version and there is an extension release with a higher version, the user will be updated to the released version."

"Note that while pre-release users will be updated to a release version if it is higher, they still remain eligible to automatically update to future pre-releases with higher version numbers than the release version."

This means:

  • Pre-release users always get the highest version — whether it's a pre-release or a release
  • Release users only get non-pre-release versions
  • When a release is published with a higher version than the current pre-release, pre-release users get it too — but they stay opted-in to the pre-release channel and will receive the next pre-release

Proposed scheme: simple checkbox, no special versioning

We don't need the even/odd minor versioning that VS Code recommends. We can just keep incrementing versions monotonically, and use the checkbox to decide whether each publish is a pre-release or a release:

Version Checkbox Release users see Pre-release users see
8.7.0 release 8.7.0 8.7.0
8.8.0 pre-release stay on 8.7.0 8.8.0
8.9.0 release 8.9.0 8.9.0 (higher than 8.8.0)
8.10.0 pre-release stay on 8.9.0 8.10.0

Pre-release users get everything — they see every version we publish. Release users only see the ones we explicitly publish as releases. No special version numbering scheme required.

The only constraint from the docs:

"Versions must be different between pre-release and regular releases. That is, if 1.2.3 is uploaded as a pre-release, the next regular release must be uploaded with a distinct version, such as 1.2.4."

This is naturally satisfied since our versions always increment.

Current state

  • publish.yml has two inputs: bump (patch/minor/major) and version (override). No pre-release option.
  • packages/kilo-vscode/script/build.ts runs vsce package without --pre-release
  • packages/kilo-vscode/script/publish.ts runs vsce publish --packagePath and ovsx publish --packagePath without --pre-release
  • The script/release convenience wrapper dispatches publish.yml with a bump type

Implementation plan

1. Add pre_release checkbox to publish.yml

workflow_dispatch:
  inputs:
    bump:
      description: "Bump major, minor, or patch"
      required: false
      type: choice
      options:
        - patch
        - minor
        - major
    version:
      description: "Override version (optional)"
      required: false
      type: string
    pre_release:
      description: "Publish as pre-release (VS Code marketplace)"
      required: false
      type: boolean
      default: false

Pass it through as KILO_PRE_RELEASE env var to the build-vscode and publish jobs.

2. Update packages/kilo-vscode/script/build.ts

When KILO_PRE_RELEASE=true, add --pre-release to the vsce package command:

const args = ["--no-dependencies", "--skip-license", "--target", config.target, "-o", vsixPath]
if (process.env.KILO_PRE_RELEASE === "true") args.push("--pre-release")
await $`vsce package ${args}`

3. Update packages/kilo-vscode/script/publish.ts

When KILO_PRE_RELEASE=true, add --pre-release to both vsce publish and ovsx publish:

const pre = process.env.KILO_PRE_RELEASE === "true"
const preArgs = pre ? ["--pre-release"] : []

await $`vsce publish ${preArgs} --packagePath ${vsixPath}`
await $`npx ovsx publish ${preArgs} --pat ${process.env.OPENVSX_TOKEN} --packagePath ${vsixPath}`

4. Update script/release

Add a --pre-release flag option:

#!/usr/bin/env bash
BUMP_TYPE=${1:-patch}
PRE_RELEASE=${2:-false}
gh workflow run publish.yml -f bump="$BUMP_TYPE" -f pre_release="$PRE_RELEASE"

Files to modify

File Change
.github/workflows/publish.yml Add pre_release boolean input, pass as env var to build-vscode + publish jobs
packages/kilo-vscode/script/build.ts Conditionally add --pre-release to vsce package
packages/kilo-vscode/script/publish.ts Conditionally add --pre-release to vsce publish and ovsx publish
script/release Accept and forward pre-release flag

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions