OKF Workbench

ADR 0008 — Bundle the native CLI in platform VSIX packages and distribute it separately

ADR 0008 — Bundle the native CLI in platform VSIX packages and distribute it separately

Status

Accepted — 2026-07-24; Homebrew and Scoop publication added 2026-07-27

Context

ADR 0007 established a native Rust okf CLI beside the capability-free Wasm core used by the extension. A separately downloaded CLI is useful for CI, scripts, and shells outside the editor, but it does not provide an immediate command-line path after installing the extension.

VS Code and Open VSX support target-platform VSIX packages. The extension is a workspace extension, so the applicable target is the operating system and architecture of the Extension Host. For a local window that is the local machine; for a remote workspace it is normally the remote host.

Decision

Release each version through two complementary distribution paths:

  1. Target-platform VSIX packages bundle one native okf executable so a new integrated terminal can use the CLI immediately.
  2. Standalone native CLI archives remain available for CI, external terminals, servers, and users who do not install the extension. Tagged releases also update Formula/okf.rb and bucket/okf.json in koizumikento/stray-tools; those manifests reference the retained GitHub Release archives and checksums rather than rebuilding the CLI.

The initial target set is:

A universal VSIX without a native executable remains a supported fallback for other Extension Host targets. Extension commands continue to use the packaged capability-free Wasm core on every target; they never spawn the native CLI.

Each platform release job builds one Rust executable and feeds those exact bytes to both the standalone archive and the target-platform VSIX. Packaging records the byte length, SHA-256, extension/CLI version, core version, and ABI version in dist/bundled-cli.json. Release gates reject a VSIX whose target, executable name, mode, bytes, or manifest metadata differ, and require the raw standalone and bundled executable hashes to match.

On activation, the extension validates the manifest and executable before exposing it. When okfWorkbench.cli.exposeInIntegratedTerminal is enabled, it appends the bundled binary directory to PATH for newly created integrated terminals and sets OKF_WORKBENCH_CLI to the exact validated binary. Appending preserves an already installed okf earlier in PATH; scripts that require the bundled version can invoke OKF_WORKBENCH_CLI. The extension does not modify shell profiles, machine-level environment variables, or external terminals.

OKF: Show CLI Status reports whether the current Extension Host has a validated bundled CLI. OKF: Open CLI Terminal opens an integrated terminal and pre-fills okf version without executing it. Startup activation is used only to establish terminal environment mutations; Wasm loading stays lazy until a core operation is requested.

Consequences

Rejected alternatives