Skip to content
lejunyangPublic

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

osdk — one SDK manager

English · 简体中文 · Documentation · Releases

osdk gives Windows, macOS, and Linux projects one CLI for language runtimes, package managers, developer tools, and model snapshots. Use it to:

  • install and switch complete project toolchains with one command style;
  • keep platform-aware project locks that teammates and CI can reuse;
  • choose responsive SDK mirrors and dependency registries automatically;
  • work from downloaded metadata and artifacts when the network is unavailable;
  • manage Hugging Face, ModelScope, and exact Civitai LoRA-version snapshots alongside development tools;
  • inspect Docker, containerd, Buildx, OCI registries, mirror benchmarks/plans, and native caches, then deliberately apply mirror config, pull images, or approve narrowly scoped native cleanup;
  • bind read-only or third-party directories as managed projects, keeping osdk's configuration and locks outside the project itself;
  • inspect storage, caches, active versions, and environment health in English or Chinese.

Start with the quick start, or browse the user guide, grouped by feature.

Install

Linux and macOS:

curl --proto '=https' --tlsv1.2 -sSf \
  https://raw.githubusercontent.com/lejunyang/one-sdk/main/install.sh | sh

Windows PowerShell:

irm https://raw.githubusercontent.com/lejunyang/one-sdk/main/install.ps1 | iex

The installers download the latest release and verify it against SHA256SUMS. On Linux, the installer selects the GNU archive when it detects glibc 2.31 or newer and otherwise selects a fully static musl archive; an explicit --target overrides this choice. It then detects the shells on your system, asks which to configure, and lets you confirm or change where osdk keeps its config, data, and cache. Each selected shell gets the environment variables plus osdk activate, so a new shell is ready to use. On Windows the current session is activated too; on Unix, add --print-activation and eval the output to activate the shell you are in:

eval "$(sh install.sh --print-activation)"

To choose a version or destination, download the script first:

curl -sSfLO https://raw.githubusercontent.com/lejunyang/one-sdk/main/install.sh
sh install.sh --version 0.0.1 --install-dir "$HOME/bin"
Invoke-WebRequest `
  https://raw.githubusercontent.com/lejunyang/one-sdk/main/install.ps1 `
  -OutFile install.ps1
.\install.ps1 -Version 0.0.1 -InstallDir "$HOME\bin"

Every prompt has a flag, so unattended installs never block:

sh install.sh --shells bash,zsh --config-dir ~/.config/osdk --accept-defaults
sh install.sh --no-modify-shell   # install the binaries only
.\install.ps1 -Shells pwsh -AcceptDefaults
.\install.ps1 -NoModifyShell

If Rust is already installed, cargo install osdk-cli --locked installs the main osdk command. Use the Release installer for the complete two-program installation, including osdk-shim.

If GitHub downloads are slow, route both the installer and release downloads through a trusted proxy:

curl --proto '=https' --tlsv1.2 -sSf \
  https://gh-proxy.com/https://raw.githubusercontent.com/lejunyang/one-sdk/main/install.sh |
  OSDK_DOWNLOAD_BASE_URL=https://gh-proxy.com/https://github.com sh

Once installed, osdk updates itself — no need to rerun the installer:

osdk self upgrade --dry-run   # what is available
osdk self upgrade             # download it and replace this installation

Self-upgrade downloads run in the currently installed version. When upgrading from a version with a progress display bug, its fix takes effect on the next run.

Both programs are replaced together and the download is checksum-verified. Linux self-updates preserve the installed GNU or musl ABI. Update sources are speed-probed just like tool downloads, so a GitHub mirror is used automatically when it is faster; osdk source test self shows the measurement and osdk source pin self <id> fixes the choice.

See Installation for PATH setup, installer options, source builds, and verification.

GitHub Actions

The repository also ships a composite setup action. It installs a verified osdk release, restores the shared tool/package caches, materializes locked tools and application dependencies, and exports the selected environment to later steps:

- uses: actions/checkout@v4
- uses: lejunyang/one-sdk@main

Pin the action to a release tag or full commit SHA in production. See GitHub Actions for CI-safe defaults, inputs, cache keys, monorepo setup, and strict offline/checksum modes.

Quick start

# Install several runtimes; downloads can run concurrently.
osdk --jobs 4 install node@20 python@3.12 go@1.22

# Choose a user-wide default.
osdk use -g node@20

# Pin a version for the current project.
osdk use python@3.12

# See what this directory will use.
osdk current

# Enable automatic per-directory switching.
eval "$(osdk activate bash)"

node --version
python --version

Each osdk download updates one labelled progress line; concurrent downloads have separate lines. Unknown sizes show downloaded bytes. Use --quiet to hide progress.

Activation also supports zsh, fish, and PowerShell. Fish activation and deactivation return success when optional saved variables are already absent. If a configured tool is not installed, activation names it once and activates the other tools; it never silently falls back to a system executable. Run osdk --help or osdk <command> --help whenever you need the full command reference.

IDEs, CI steps, containers and scheduled jobs run without the shell hook. Shims on the persistent PATH already pick the right version there; for the environment variables as well (JAVA_HOME, ANDROID_HOME, cache directories), export what an activated shell would have, or run a command under it:

osdk env > .env                    # dotenv for an IDE or `docker --env-file`
osdk env --format json             # also bash, zsh, fish, powershell
osdk exec -- ./gradlew build       # without --tool: this directory's own selection

On Unix, a CI runner can send SIGTERM or SIGINT to the osdk exec PID to cancel the build command after it starts.

To update a globally selected tool to the latest release, request @latest explicitly:

osdk use -g github:lejunyang/ai-auto-desktop@latest

Upgrade existing global selections within their configured constraints:

osdk upgrade -g github:lejunyang/ai-auto-desktop
osdk upgrade -g aad                 # its unique managed command
osdk upgrade -g                     # all global selections

Global upgrades update the user lock and preserve the global constraints and options. They ignore the current project. A unique command exported by an installed global tool also works, such as aad; multiple owners produce an error listing the tools. Tool names and configured aliases take priority. This also works for Cargo, Go, PyPI, Conda, HTTPS artifacts, and declarative tools. Use use -g TOOL@VERSION to change a constraint.

An explicit floating selector resolves the current matching release before reusing an installation. If that exact target is already installed, osdk keeps it. A bare use can reuse a local version; install --force is for reinstalling or repairing a version.

Scenario: make a project toolchain reproducible

Pin tools in the repository. A normal project use installs the tool and updates both osdk.toml and the current-platform osdk.lock; a teammate or CI can then replay it with install. When the current platform has no lock section yet, no-argument install/lock inherit one compatible version shared by the other platform sections, then resolve platform-specific artifacts and checksums locally. If an existing structured tool is excluded on the current platform by when, use tool@VERSION updates only its version while preserving when, lazy, and backend options; it neither installs the tool nor writes a lock entry for the wrong platform:

osdk use node@20
osdk use python@3.12
osdk use go@1.22
osdk install

Tools needed only by occasional workflows can be declared with lazy = true. A bare osdk install skips them; use osdk install --include-lazy when you want the complete configured toolset. Explicit operands such as osdk install cargo:release-tool are always installed.

Check for newer matching versions or run a command without changing project pins:

osdk outdated
osdk upgrade
osdk exec --tool node@20 -- node --version

Use osdk lock after editing [tools] by hand, or to resolve without installing. It writes only the tools the project itself declares into osdk.lock; pins that live in your user-global configuration stay out, so the lock is safe to commit and reproduces on someone else's machine. To lock a global tool too, declare it in the project configuration or name it with osdk lock <tool>.

For immutable Rust reproduction, pin an explicit or dated toolchain. Floating rustup channels such as stable, beta, and nightly remain floating when written to the lock.

osdk can also follow existing .tool-versions, .nvmrc, .node-version, .python-version, .java-version, go.mod, rust-toolchain.toml, and Node version declarations in package.json. Data-only declarative backends use the same locked artifact URL, checksum, download cache, and offline reinstall path as built-in archive backends. They can also declare the environment a toolchain needs — a C/C++ cross compiler is found by build systems through CC, SYSROOT, and similar variables rather than through PATH alone — and osdk exports those variables whenever the version is active. For osdk-owned dynamic npm:<package>, cargo:<crate-or-https-url>, go:<module-or-command-path>, conda:<package>, pypi:<project>, and github:owner/repo installs, options and managed-runtime dependencies that change the selected or built output are part of the installation identity. osdk records that identity in .osdk-install.json schema 1 and places each b3-v2: identity under its own fingerprinted install root, so multiple identities of the same backend and version can coexist. Reuse, activation, shims, where, uninstall, and reshim all select the exact configured identity. Older .osdk-tool.json manifests are detected only as legacy state and are never reused or executed.

Guides: Project toolchains · Lockfiles and repeatable environments

Scenario: bind a project without writing into it

Some directories cannot be modified — read-only checkouts of third-party repositories, or workspaces where you want osdk's configuration centralized. Bind the directory instead: osdk keeps its osdk.toml and osdk.lock under $OSDK_CONFIG_DIR/projects/, and every command resolves it by walking up from the current directory.

osdk project add ~/repos/third-party-app   # binds exactly this directory; no Git-root guessing
osdk project show .                        # which configuration this directory actually uses
osdk use node@20                          # writes into the external config and its lock
osdk project list                          # all bindings with status (active / missing / shadowed)
osdk project remove ~/tmp/checkout --dry-run

The bound directory remains the logical project root: tasks and deps still resolve and write there, while the tool configuration stays out of the project. A local osdk.toml on the same root always wins over the external copy. Moving or removing a binding preserves or deletes only the external directory itself — project files and shared tool installations are never touched.

project show . also finds the selected project from a child directory. project add and the destination of project relocate require a directory. Existing bundle contents are never overwritten; a failed preparation leaves the original binding intact. Git checkouts support external configuration too. With extends, inherited tasks keep their declaring directories and inherited files stay inside the repository.

Each external bundle supports one dependency manifest per provider; use separate bindings for independent projects using the same provider. Conflicting lock records are rejected before running tools.

Guide: External project configuration

Scenario: replace a Makefile with project tasks

Declare commands in osdk.toml and run them with osdk run. Tasks are phony by default, prerequisites run in topological order, and osdk injects the tool versions the project declared -- no shell activation required first.

[tools]
"cargo:cargo-nextest" = { version = "0.9", lazy = true }

[tasks]
build = "cargo build --release"

[tasks.ci]
run = [
  "cargo fmt --check",
  { cmd = "cargo clippy -- -D warnings", ignore_error = true },
  "cargo nextest run",
  { tasks = ["doc"] },
]
depends = ["build"]
tools = ["cargo:cargo-nextest"]
osdk run ci
osdk task list
osdk run ci --dry-run

Declare sources and outputs for incremental builds. Editing a task's run command or changing the arguments passed to it triggers a rebuild even when the source files are unchanged. With freshness = "hash", each positive output pattern must match a file that passes the exclusions for the task to be skipped. A symlink to an existing regular file counts.

Array entries run in order and stop at the first failure; ignore_error tolerates one and continues (printing a warning); { tasks = [...] } runs them together and waits for all. Do not reach for the shell's & -- it means something different in cmd, PowerShell 7, and PowerShell 5.1. See Project tasks.

Declare sub-projects with [task].roots and invoke their tasks as osdk run //path:task; each runs relative to its own project directory.

tools names keys declared in [tools]. Before any task command starts, osdk checks the complete task graph and installs missing requirements, including entries marked lazy = true. It deliberately does not infer tools by parsing shell commands: aliases, scripts, and conditional command lines make that guess unreliable.

Embedded Lua handles branches, loops, and captured subprocess output without long prefixes: run("cargo", "test") streams a command while exec("git", "status", "--short") captures it. Helpers such as join, mkdir, copy, and glob avoid platform-specific filesystem commands; json.decode and toml.decode handle data files. The explicit osdk.* forms remain available. For editor and linter support, put longer Lua in a .lua file and reference it with file = "scripts/task.lua"; osdk uses the same embedded runtime, so no system Lua installation or shebang is needed.

Scenario: install a tool from a direct HTTPS artifact

For a tool without a dedicated backend, bind one exact semantic version to an HTTPS {version} URL template and the publisher's SHA-256. A bare executable can be installed directly:

# Replace the example digest with the SHA-256 of the exact 1.2.3 artifact.
osdk install \
  'http:https://downloads.example.com/acme-{version}[sha256=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef,kind=file,rename=acme]@1.2.3'

The same backend supports tar.gz, tar.xz, and ZIP archives with explicit bin/bins, subdir, strip-components, and single-binary rename layout options. Plain HTTP, credentials, query strings, cross-origin redirects, floating versions, and missing checksums fail closed. Downloads bypass proxies, pin DNS results only after every address passes a conservative public-address check, and have a 512 MiB transfer cap and 10-minute HTTP request timeout. Archives are limited to 16,384 entries and 2 GiB of cumulative declared expanded size; publication also requires at least one executable, and Windows publishes only .exe-named outputs. After an online install and osdk lock, osdk --offline install can replay the locked URL, filename, and checksum from the exact identity-scoped cache; the lock does not embed the artifact bytes.

Guide: Direct HTTPS artifacts

Scenario: use package managers with an available registry

Install npm, pnpm, or Yarn independently, using a major/minor prefix when you want the newest compatible release, or let an exact package.json#packageManager selection join the project toolchain. An explicitly selected manager takes precedence over Node's bundled Corepack launcher:

osdk install npm@11
osdk install pnpm@9
osdk install yarn@4

Before a package-manager process starts, osdk can select a healthy configured registry for npm, pnpm, Yarn, Bun, and Deno. Inspect the current choice with:

osdk registry test
osdk registry test pnpm

Explicit registry flags, environment variables, private registries, and native package-manager configuration remain under your control.

Guide: Package managers and registry selection

Scenario: add an npm-published developer tool

Global npm: tools install anonymously in isolation even when you are logged in to npm. Your login configuration stays intact and credentials are not imported. The registry in your npmrc, a company mirror included, is used as is rather than swapped for a public one; if it requires a login, the install fails and says so. Scoped registry routing remains unsupported for this isolated path. To pick the registry for global installs yourself, set [registries.npm] default with [settings.precedence] npm = "osdk" in your user configuration.

Prefix a package with npm: to distinguish it from the npm package manager. In a Node project, use adds the package to the nearest package.json, keeps an existing dependency section (or defaults to devDependencies), and makes its local command available after shell activation. Activation exposes only an osdk-curated generation of the configured packages' validated commands, never the project's entire node_modules/.bin:

osdk use npm:prettier@3
eval "$(osdk activate bash)"
prettier --check .

# Force a particular installer when the automatic choice is not wanted.
osdk use npm:eslint@9 -o installer=pnpm

# Install a user-wide tool without changing the current project.
osdk use --global 'npm:@antfu/ni@0.21.12' -o installer=npm
osdk where --global 'npm:@antfu/ni'
osdk uninstall --global 'npm:@antfu/ni@0.21.12'

Project use respects the nearest package.json and exactly one compatible existing native lock. Automatic selection follows the project's declared packageManager, then the installer that owns an existing native lock, and otherwise the configured default; installer=npm and installer=pnpm select one explicitly. Set the fallback with settings.npm.default-installer in config.toml or OSDK_NPM_DEFAULT_INSTALLER; it applies only when a project states no preference of its own. Shell activation exposes only validated commands from packages selected by the trusted project configuration, never the project's entire node_modules/.bin. Without a package.json, local use retains the isolated osdk-managed installation and shim behavior. The generated .osdk/npm-bin/ directory is local derived state and should normally be ignored by version control. Commit the package manager's native lock alongside osdk.lock; the latter does not replace the transitive dependency graph.

Managed npm also defaults to the shared directory when called directly without shell activation. Run osdk reshim once after upgrading to update existing Node/npm installations; explicit npm prefix overrides remain supported.

Node-directory globals need migration before they can receive managed shims; commands in the shared npm prefix remain available.

When commands conflict, osdk reshim rebuilds unaffected shims and reports all remaining conflicts with source paths, returning a nonzero exit code.

If older globals remain inside a Node version, osdk doctor shows their versions and locations. Preview osdk node migrate-packages --from VERSION --to-global; select differing source versions with --package NAME and add --apply to move them. Unselected local package links remain in place. Native or install-script packages are skipped by default; opt in with --package NAME --allow-scripts, then add --apply after reviewing the plan. Preview lists replacements; apply reports progress and completion without repeating selection prompts.

Managed npm i -g and similar commands use shared global directories, so changing Node does not remove the installed packages. Through osdk shims, supported JS managers reconcile their global command shims after exit, including rapid uninstall/reinstall cycles. These commands use the selected runtime without requiring an independent npm installation; outside a project, deliberately set a default with osdk use --global node@22. Missing runtimes produce a hint instead of choosing an arbitrary installed version. osdk reshim also exposes native Cargo/Go applications without requiring a selected compiler. Native addons, pinned wrappers and Python environments retain their runtime compatibility requirements. System managers and native output overrides retain native locations; see global installation boundaries and environment variables.

where --global and uninstall --global explicitly target the user-wide npm installation whose exact configured identity matches. Without that flag, the existing project/isolated behavior is preserved; uninstall removes only the selected identity root, while sibling identities of the same package version remain installed. A global uninstall also removes its user config, lock entry, and now-unowned shims. Project-managed npm dependencies and their curated .osdk/npm-bin generation remain separate from these osdk-owned roots.

Guide: npm developer tools

Scenario: install a project's own application dependencies

install brings tools; deps brings the project's own dependency manifest. [tools] provides the package manager, then deps drives it over package.json so the whole closure lands inside the project. Adding or removing a single dependency stays with osdk install npm:<package>.

Declare a provider in osdk.toml, then run it:

[deps.pnpm]          # Node: npm / pnpm / yarn / bun
# [deps.go]          # Go / Rust / Deno: go, cargo, deno
# roots = ["apps/*"]  # monorepo: declare sub-projects; never scanned for
# [deps.uv]          # Python: pyproject.toml + uv.lock
# [deps.pip-requirements]   # Python: requirements.txt (resolves transitive deps; not frozen)
osdk deps --list            # detected providers and their freshness
osdk deps --dry-run         # print what would run, without running it
osdk deps                   # materialize the manifest
osdk deps --verify          # check the installed tree against its own receipts
osdk deps npm               # nearest npm project to the working directory
osdk deps //:npm            # config root only
osdk deps //apps/api:npm    # one declared sub-project

Independent sub-projects need no osdk.toml; declare them once at the root:

[deps.projects."apps/web".pnpm]
timeout = "5m"
[deps.projects."apps/api".pip-requirements]
auto = false

Run osdk deps --list --all --explain to inspect the selected projects and commands, then osdk deps to initialize them. auto = false keeps explicit installation available; disable removes a provider. Native pnpm/uv workspaces install once at the shared root, and selecting a member explains the expanded coverage. Child configurations can explicitly inherit with extends = "../../osdk.toml".

Command overrides accept argv arrays, such as run = ["pnpm", "install", "--offline"], and require trust. Overrides cannot guarantee frozen installation or disabled scripts. An override that runs a package manager still gets the registry osdk selects, unless the command or its env names one explicitly. Package sources now use registries; [settings.precedence] supports ordered tool declaration sources, optional conflict errors, and osdk/native package priority per ecosystem. Use osdk current TOOL --sources --project DIR to inspect applicable sources, missing declarations and effective order; add --json for automation. See tool environments for selectors versus cache overrides. Set tool_order=["system","osdk"] to opt into existing PATH/home tools; defaults stay managed. See supported system tools and examples. Old deps source fields are removed. Explicit input/output paths belong to their declaring file (for example sources = ["apps/api/package.json"]). See the dependency guide for workspace, inheritance and migration details.

You don't have to call it every time. A bare osdk install, osdk run <task> or osdk exec compares manifest hashes first and materializes only when stale. On a hit it skips the install. Use osdk deps --verify for a deep scan. Naming a tool (osdk install node@22) never triggers a deps install. Skip once with --no-deps, or turn it off per provider with auto = false:

osdk run dev                # materialize if stale, then run the task
osdk run dev --no-deps      # not this time

For pip-requirements, osdk resolves the full transitive closure with uv pip install -r; a top-level requirements.txt is not treated as an exact lock or synchronized set. Use --frozen in CI to require an existing native lockfile that the provider can use without changing it.

osdk deps --frozen

In a Cargo workspace, osdk deps //crates/demo:cargo --frozen --no-install-tools uses the workspace lock selected by Cargo, usually the root Cargo.lock, even if the member directory still has its own lockfile. Install or link Rust first when using --no-install-tools. For a standalone crate with a committed Cargo.lock, osdk deps --frozen can prepare Rust on the first run.

Build and lifecycle scripts are off by default. Turn them on per provider, which requires approving the config:

[deps.pnpm]
allow_build_from_source = true

When the package manager is not installed, deps installs it through the same tool install path osdk install uses, into osdk's isolated directories rather than your project. In CI, where tools should come only from an explicit osdk install, turn the acquisition off:

osdk deps --no-install-tools

With no [deps] section, osdk deps only reports what it found and which providers could manage it. It installs nothing.

Guide: application dependencies

Scenario: install a Rust CLI from Cargo

Choose one exact managed Rust version, then install a crate by exact version, latest stable release, or numeric prefix:

osdk use rust@1.91.1
osdk use cargo:ripgrep@14.1 -o features=pcre2 -o locked=true
eval "$(osdk activate bash)"
rg --version

Cargo tools reject floating or linked Rust toolchains. Registry requests use cargo:<crate>; HTTPS Git requests use latest, tag:<ref>, branch:<ref>, or an immutable rev:<40 lowercase hex> selector:

osdk use \
  'cargo:https://github.com/BurntSushi/ripgrep.git@rev:0123456789abcdef0123456789abcdef01234567'

Supported build options are features, default-features, bin, locked (default false), and Git-only crate. A complete exact installation can be reused offline, but Cargo locks do not contain the complete source graph needed for a cold offline build. Registry versions are recorded as version-only, full Git revisions as immutable-revision, and Git HEAD/tags/branches as floating-ref.

Guide: Cargo developer tools

Scenario: install a Go command package

Keep the Go runtime and Go command namespaces separate, then install a command with an exact managed Go toolchain:

osdk use go@1.24
osdk use go:golang.org/x/tools/gopls@0.20.0
eval "$(osdk activate bash)"
gopls version

go: accepts module or nested command paths, latest, numeric prefixes, exact semantic versions, and canonical pseudo-versions. tags and a restricted env option are identity-bearing; CGO_ENABLED=0 is supported, while enabling cgo is rejected until a C toolchain can be bound to the install identity. osdk chooses and records one Go proxy, invokes the exact managed go once with a staged GOBIN, and keeps module/build caches under its cache root. The compact schema-4 lock records the proxy, module root, and exact Go runtime—not the transitive module graph—so an exact completed install can be reused offline, but a cold offline build cannot.

Online osdk install checks that the current Go proxy and privacy settings match the lock even when the tool is already installed.

Go tool installs honor HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (including lowercase forms).

Guide: Go developer tools

Scenario: work in each language ecosystem

The same command style applies across ecosystems, while backend-specific capability notes live in their guides. Runtime-specific commands cover the workflows that need them.

Node.js

osdk install node@20 -o corepack=true
osdk lock node@20 -o arch=arm64
osdk node migrate-packages --from 20.19.0 --to 22.17.0
osdk node migrate-packages --from 20.19.0 --to 22.17.0 --apply

If installation fails and rollback succeeds, the target keeps its original global npm packages, including local links and packages installed from local tarballs. If rollback also fails, check the backup path in the error message.

Python

osdk install python@3.14
osdk install python@cpython-3.14+freethreaded
osdk install python@pypy-3.11
osdk python find
osdk python find pypy-3.11

Java and JVM tools

osdk install java@21
osdk install java@21 -o package-type=jre
osdk install java@21 -o distribution=zulu -o package-type=jdk
osdk install maven@3.9.16 "gradle@=9.3.1" kotlin@2.4.10

Go

osdk install go@1.22
osdk use go@1.22
osdk exec --tool go@1.22 -- go version

Rust

osdk install rust@stable -o profile=minimal -o components=clippy,rustfmt
osdk rust component add rustfmt --toolchain stable
osdk rust target add x86_64-pc-windows-gnu --toolchain stable
osdk rust check --repair

Use osdk rust override import PATH to import an isolated rustup directory override into the nearest osdk project config at or above PATH. Omit PATH to use the current directory. The command requires an existing project config.

The Rust source probe only ranks candidates. Toolchain, component, and target installs run rustup against each candidate in order, so a preferred mirror that lacks the exact target falls back automatically.

Zig

osdk install zig@latest
osdk exec --tool zig -- zig version

Zig bundles its own libc (musl, several glibc versions, mingw-w64, wasi-libc), so a single install cross-compiles C and C++ to many targets without a sysroot per target:

osdk exec --tool zig -- zig cc -target aarch64-linux-musl -o hello hello.c
osdk exec --tool zig -- zig cc -target x86_64-windows-gnu -o hello.exe hello.c

Guide: Runtime and ecosystem workflows

Scenario: manage the Android SDK

Install Android SDK packages — the NDK, adb/fastboot, build-tools — straight from Google's repository, accepting the required agreements by flag so it works unattended in CI:

# Review the agreement before agreeing to anything
osdk android licenses show android-ndk@29.0.14206865

# Install with explicit consent
osdk install android-ndk@29.0.14206865 -o accept-licenses=true
osdk install android-platform-tools@37.0.1 -o accept-license=android-sdk-license

# Use the tools
osdk exec -t android-platform-tools@37.0.1 -- adb devices

# Hand the recorded acceptance to Gradle
osdk android licenses export --sdk-root /path/to/sdk

Exporting preserves the destination SDK's existing license digests and adds only missing ones. If the destination is the managed SDK, osdk reports that no export is needed.

osdk never accepts a license on your behalf: without one of the accept options the install stops before downloading anything. Available families are android-ndk, android-platform-tools, android-build-tools, android-cmdline-tools, android-cmake, android-platforms, android-emulator, android-sources and android-system-images. When package families overlap, the shared R8 launchers resolve to android-build-tools and lld resolves to android-ndk; other duplicate executable names remain errors.

android-platforms and android-sources spell their revisions android-37.2, and latest picks the newest stable API level. Previews have to be asked for by name: Google publishes builds such as android-37.2-beta3 and android-CANARY on the stable channel (channelRef is channel-0), so osdk identifies them from the manifest's <codename> and <beta-api-level> instead, and the default prerelease = if-explicit policy still keeps them out of latest.

Within one family android-36 and android-36.1 are two different API levels, which the names do not reveal, so osdk list-remote annotates each candidate with the API level it actually declares:

osdk list-remote android-platforms
# android-36-ext19 (API 36x)   <- side-by-side extension, ExtensionLevel 19
# android-36 (API 36)
# android-36.1 (API 36.1)

When you mean "this one, with no fallback", pin it verbatim with =:

# exactly API 36; cannot drift to 36.1
osdk install "android-platforms@=android-36"

Emulator system images work the same way, and whatever a package declares as a dependency is installed with it — asking for an image brings the matching android-emulator along:

# Browse the images (every vendor and form factor in one list)
osdk list-remote android-system-images

# Installing this also installs the emulator the image requires
osdk install "android-system-images@android-35;google_apis;x86_64" \
  -o accept-licenses=true

The emulator only accepts an SDK directory that contains platform-tools, so install that as well before creating an AVD. osdk arranges every Android package into the single directory layout Google's tools expect, without storing any package twice.

Create and run a virtual device with the image:

osdk android avd create pixel-35 --image "android-35;google_apis;x86_64"
osdk android avd list
emulator -avd pixel-35

Devices live under osdk''s data directory, and the emulator and avdmanager are pointed at it automatically, so emulator -avd pixel-35 works from an activated shell without exporting anything by hand.

osdk writes the device definition itself rather than calling avdmanager, which cannot work against this layout: it locates the SDK by inspecting its own path, so it looks one directory too high, and create avd accepts no flag to correct that. Devices it did manage to create also record a relative image path that resolves against the wrong directory here.

To see what Google's own tools can see, and to rebuild the index they read:

osdk android sdk-root show
osdk android sdk-root repair

repair is worth running once after upgrading osdk: packages installed by an earlier version have no index file, so sdkmanager lists them while avdmanager reports Package path is not valid.

osdk links every Android package into the directory layout Google's tools expect (a junction on Windows), storing the payload once. Uninstalling removes the link before the payload: the other order leaves a dangling link, which still answers yes to the existence checks the emulator and Gradle make. sdk-root show reports dangling links and repair removes them.

The Android packages contain no JDK, so sdkmanager, avdmanager, d8 and the other jar-backed tools run against an osdk-managed java when the environment has no JAVA_HOME of your own (a stale value osdk's activation exported is recomputed for the current directory, so one project's JDK cannot drive another's build). Install one with osdk install java.

Guide: Android SDK tools

Scenario: pin a model snapshot

Declare and materialize selected files from Hugging Face, ModelScope, or an exact Civitai LoRA version, verify the snapshot, and obtain its stable path:

osdk model use qwen25 hf:Qwen/Qwen2.5-7B-Instruct@main \
  --include '*.json' --include '*.safetensors' --sync
osdk model use character-lora civitai:456@123 --view comfyui \
  --kind lora --family sdxl --derived-from hf:stabilityai/stable-diffusion-xl-base-1.0@main --sync
osdk model import local-style C:\models\style.safetensors --kind lora --view comfyui --json
osdk model verify qwen25
osdk model path qwen25 --stable
osdk model sync qwen25       # one model
osdk model sync              # whole project
osdk model sync --prune      # reclaim this project’s retired snapshots
osdk model show qwen25 --json
osdk model sync --dry-run --jsonl

model use edits the project declaration and does not download by default; --sync immediately materializes that model. It can declare a consumer view in the same operation:

osdk model use flux hf:black-forest-labs/FLUX.1-dev@main \
  --include '*.safetensors' --view comfyui \
  --map unet/=diffusion_models --map vae/=vae --sync
osdk model view path comfyui

Civitai's civitai.com and civitai.red front doors are both built-in official sources. Auto mode probes both for the exact requested version, keeps the existing official source id for .com, and exposes official-red for an explicit pin or --source override.

model sync re-resolves changes to source, variant, semantic metadata, include, or exclude, then replays immutable lock entries. model sync --prune preserves snapshots still used by other projects, snapshots from before project tracking, and local imports. model import NAME PATH snapshots a local file or directory into CAS without creating a project declaration or lock entry; local imports are machine-specific and must be re-imported from their original bytes. model unuse NAME removes this project's model requirement and cleans up its unused snapshots. Use --keep-snapshot to retain those snapshots through future project cleanups. model remove NAME reports projects still using the model and deletes all local snapshots and views for the name.

Guide: Model snapshots

Scenario: install a skill for an AI coding agent

A skill is a SKILL.md instruction package that AI coding agents such as Claude Code, Codex, and Cursor read. osdk installs skills from GitHub or a local path into the selected agents' skills directories. Teams and CI can use osdk skills sync to reproduce applicable locked skills and install declarations that still need lock entries. osdk copies or links the files and never runs a skill's scripts.

osdk skills agents                       # which agents osdk knows, and their skills dirs
osdk skills find agent skills             # search GitHub for installable skills (anonymous, no skills.sh)
osdk skills add github:vercel-labs/agent-skills --list        # list a repo's skills only
osdk skills add github:vercel-labs/agent-skills/skills/web-design-guidelines # choose agents and link/copy interactively
osdk skills add ./my-skills -s my-skill -a codex              # a local source, one skill
osdk skills list                         # locked skills, plus unlocked paths in project scope
osdk skills sync                         # replay locked skills and install missing declarations
osdk skills remove web-design-guidelines

Without -a or [skills].default_agents, add detects installed agents: one is selected automatically together with agents that share .agents/skills; multiple or zero detections open the agent picker. --yes accepts the detected set (or all agents when none are detected); other non-interactive calls must pass -a or configure defaults. Link/copy is asked only when the selected agents have multiple physical destinations; one destination is copied directly. Before writing, add prints every destination, marks existing paths as overwrites, and asks for confirmation unless --yes was supplied.

Declare team skills under [skills.<name>] in osdk.toml. Run osdk skills sync to install applicable declarations and record their resolutions alongside existing entries in osdk.lock. Use skills update to refresh a locked GitHub ref or apply changes to the Agent list. sync and bulk update skip skills excluded by when. Updating an excluded skill by name reports the platform requirement and exits with status 1. If Agent selection is needed in CI or without a terminal, set agents or [skills].default_agents, or pass --yes to accept the recommended targets. sync asks before replacing an existing unlocked skill directory. In CI or without a terminal, pass --yes to replace it or move it aside first. Pin a GitHub skill with ref = "rev:<commit>" to keep it at that commit across updates. To change the pin, edit ref and run skills update with network access. Set [skills].scope = "global" to use user-level Agent directories by default, or pass -g on an individual command.

If skills list or skills remove reports a candidate entry in an ancestor lock, follow the subproject recovery guide.

Guide: Agent skills

Scenario: control sources, offline use, and trust

Let osdk rank available sources, pin a preferred mirror, add a trusted internal source, or override the source for one command:

osdk source list node
osdk source test node
osdk source pin node tuna
osdk source add node --id mycorp \
  --download-url https://mirror.corp/node/ \
  --index-url https://mirror.corp/node/index.json
osdk --source official install go@1.22

Model repositories use a separate probe budget because metadata requests and CDN cold starts are heavier than SDK indexes. The default sources.model_probe_timeout_ms = 8000 applies independently to metadata resolution, response headers, and a 64 KiB sample. osdk probes the smallest non-empty repository file; a successful response marks the source reachable even when the sample body exceeds its budget, in which case throughput is unknown rather than unreachable. An all-failed probe set is not cached for the normal six-hour TTL.

Downloads performed directly by osdk are not single-shot. Regular archives keep the existing three attempts (400 ms, then 800 ms). Model files default to six attempts with visible retry warnings and 1/2/4/8/8-second exponential backoff; tune them with sources.model_download_attempts and sources.model_download_retry_base_ms through osdk config set; sources.model_read_timeout_ms (default 60000) fails a request that stalls mid-stream so it retries instead of hanging. Both paths retain a .partial file plus ETag/Last-Modified metadata and resume with Range + If-Range; an ignored or invalid range, changed object, or changed source URL causes a safe restart. A successful probe or HTTP 200 is not enough to select a tool source: archives, standalone binaries, and self-update assets fall through to the next ranked source when checksum/attestation verification fails, an archive cannot be unpacked, or its required payload is missing. The receipt records the source whose artifact actually passed. Model sync likewise falls through after one source exhausts its attempts; exhaustion of every source remains terminal.

If pip or uv is configured with a single index, pypi: uses it for version lookup and installation. Global tools ignore project uv configuration; additional native uv indexes retain default PyPI and require uv so first-index selection is preserved. Without a native index, set [registries.python].urls to choose the mirrors osdk can use. Set [settings.precedence] python = "osdk" to use that selected index for both lookup and installation, ignoring native additional indexes. go: uses your native Go module proxy and privacy settings, including values saved by go env -w. Version lookup for a private command stays within its Go no-proxy scope when checking parent module paths. Managed go commands also keep these settings, including command-level GOPROXY overrides after activation. Go locks keep the module and exact version, so teammates and CI can replay them with different local proxy settings.

A mirror already set in your environment (RUSTUP_DIST_SERVER, GOPROXY, npm_config_registry, and the like) is validated and then raced against osdk's built-in mirrors, so a stale or unreachable value cannot win by default; an unusable one is reported instead of being ignored. To obey it as-is, or to fail when it is missing, ask for it explicitly:

osdk --source-mode env install rust@1.98.0

The Go module proxy is a separate channel: [sources.go] only decides where the Go toolchain archive is downloaded from, while go build / go test fetch dependencies through GOPROXY. When running a managed go, osdk injects a ranked GOPROXY joined with | (upstream first, then mirrors, direct last), so an unreachable proxy.golang.org falls through to a mirror instead of failing the build. The | separator is required: a comma only advances on 404/410 and treats a connection timeout as terminal.

This mirror set lives under its own go-modules name, independent of the toolchain archive sources in [sources.go], and the usual osdk source subcommands apply to it:

osdk source list go-modules
osdk source test go-modules
osdk source add go-modules --id corp --download-url https://goproxy.corp/
osdk source pin go-modules goproxy.cn
osdk source unpin go-modules

A pin means "try this first", not "use only this": the pinned source moves to the front and the rest stay on as fallbacks, so one unreachable host does not fail the build. Use [sources.go-modules].disable when you want exactly one endpoint.

A GOPROXY you set yourself is never overridden -- including the policy values off and direct.

After a successful online download, require cache-only operation with --offline. Tighten artifact policy when your environment requires it:

osdk --offline install node@20
osdk --require-checksums install github:sharkdp/fd
osdk --attestations required install github:cli/cli@latest

Each command asks for review only on what it can do: install/use/upgrade cover verification settings and download sources, osdk run covers [task], and pkg apply covers the [sys.pkg] entries that apply on this machine -- model configuration is never gated. Declaring which tools or packages to install is not in that category, and when a config is refused osdk lists exactly which keys need review and why:

osdk --yes trust ./osdk.toml     # approves this config for osdk and its tool shims
osdk trust list
osdk untrust ./osdk.toml
osdk trust prune                 # drop records whose config file is gone

Configuration collections such as [tasks], [models], and [skills] stay plural. Singleton settings and namespaces use [task], [container], [alias.tools], and [sys.pkg]. Older [task_config], [containers], [aliases], [syspkg], and the temporary [sys.pkg.packages] form remain readable; use osdk config migrate --dry-run and then osdk config migrate to rewrite them.

Guides: Download sources and mirrors · Offline mode · Integrity and attestation · Project configuration trust

Scenario: inspect and operate native container runtimes

Docker Hub works out of the box with two operator-documented public pull-through caches, mirror.gcr.io and docker.m.daocloud.io. osdk benchmarks them anonymously against library/alpine:latest, verifies manifest equivalence and a bounded layer sample, and recommends the passing mirrors by measured latency. An explicit policy in trusted user or project configuration fully replaces those built-ins:

[container.registries."docker.io"]
mirrors = ["https://mirror.example/"]
anonymous_only = true
resolve = "mirror"
osdk container doctor
osdk container doctor --runtime docker --builder my-builder
osdk container doctor --json --check
osdk container registry test docker.io
osdk container registry test docker.io \
  --image ubuntu:24.04 --platform linux/amd64 --json --check
osdk container mirrors plan docker.io --runtime docker
osdk container mirrors plan docker.io --runtime docker \
  --native-config /etc/docker/daemon.json --json
osdk container mirrors apply docker.io --runtime docker \
  --native-config /etc/docker/daemon.json
# Automation is two-step and binds the exact fresh plan:
plan_id=$(osdk container mirrors apply docker.io --runtime docker \
  --native-config /etc/docker/daemon.json --dry-run --json | jq -r .plan_id)
osdk --yes container mirrors apply docker.io --runtime docker \
  --native-config /etc/docker/daemon.json --accept-plan "$plan_id" --json
osdk container cache status --json --check
osdk container cache status --runtime buildkit --builder my-builder
osdk container pull ubuntu:24.04
osdk container pull ghcr.io/example/tool:1.0 \
  --runtime containerd --platform linux/amd64 \
  --address unix:///run/containerd/containerd.sock --namespace default
osdk container prune --runtime docker --scope images
osdk container prune --runtime buildkit --scope build-cache --builder my-builder
osdk container prune --runtime docker --scope images --json

container doctor reports the selected runtime first, then the typed facts already obtained by that probe: Docker versions/platform/rootless/Desktop and mirror origins; containerd versions and registry-config state; and Buildx driver, node state, BuildKit versions, endpoints, and platforms. Its schema-version-2 JSON omits context, builder and node names, namespaces, native config paths, and secret-bearing endpoint paths or queries.

When Docker denies the current user, human-readable output recommends Linux rootless Docker first, then explains the rootful docker-group option and warns that the group is root-equivalent. Users with an existing rootless daemon usually only need to select its context and keep running osdk unprivileged:

docker context use rootless
osdk container doctor --runtime docker

Do not work around the diagnostic by loosening socket permissions or routinely running sudo osdk; the container guide covers installation, the user-level daemon.json, and restart steps.

Registry tests use anonymous HTTPS only, validate image digests, platform selection, bounded Range support, and rank verified mirrors. A digest-pinned image can still validate mirrors when the upstream is unavailable; mutable tags remain upstream-authoritative. A mirror plan always targets one configured or Docker Hub built-in registry policy and one explicit Docker, containerd, or BuildKit control plane. It reports a deterministic plan_id; without an explicit native config path a locally actionable plan is manual-only. Planning never writes native configuration, starts builders, or restarts daemons. Plan JSON can expose operational absolute paths, builder names, and mirror origins plus whether a path prefix exists; exact mirror prefixes, existing configuration contents, and generated candidate bytes remain hidden. mirrors apply performs that benchmark and plan in one invocation, prompts interactively without asking you to copy the ID, then rechecks the input under a lock, validates the generated daemon JSON with dockerd --validate, and atomically replaces the file. It never elevates privileges or restarts/recreates the native service. Unattended --yes requires the exact fresh --accept-plan; use --dry-run --json to obtain it. A failed JSON preview still emits the full Registry diagnostic before exiting nonzero.

container pull uses the effective runtime and platform unless you override them. In auto mode it performs one bounded read-only Docker/containerd resolution, then starts exactly one native foreground pull. Explicit containerd selection requires paired --address and --namespace values; auto requires them only if containerd wins, so Docker can proceed without them. On Unix, osdk accepts a canonical unix:///path/to/containerd.sock selector and renders the native /path/to/containerd.sock argument expected by ctr. The child inherits stdio and osdk waits for it, returning its direct exit code or, on Unix, normalized 128 + signal; it does not fall back to another runtime or copy the image into an osdk store.

container prune is preview-only by default. It can preview one discovered Docker context or Buildx builder and binds a secret-safe fingerprint of the Docker endpoint or Buildx driver/node endpoint topology. Execution is available only for Docker contexts backed by a directly addressable local Unix socket or Windows named pipe without context-held TLS material; it uses docker --host and removes only dangling images. To execute, repeat the command with both --execute and the exact reported --accept-preview sha256:..., then confirm the execution prompt (or use global --yes). BuildKit remains preview-only because its mutable builder name cannot be pinned atomically. Although --scope remains required, containerd has no accepted scope pairing: a selector-free, non-executing request reports typed unsupported, while selectors and execution flags are rejected. The command never expands into system-wide cleanup of containers, volumes, networks, or implementation-private stores.

Guide: Container runtimes, registries, and native operations

Scenario: see what package managers the host has

osdk pkg doctor
osdk pkg doctor --json
osdk pkg mirrors test
osdk pkg mirrors apply --dry-run

Reports which system package managers the host has (winget today), their version, and the sources they have configured along with each source's trust level. mirrors test measures each mirror and ranks them, with the official source measured alongside. Read-only: nothing is installed, no configuration changes, no elevation. The --json output carries a schema version and does not vary with the display language.

Note that a winget mirror speeds up search and list, not installer downloads: the URLs inside a manifest point at each vendor's own servers. osdk says so in its output.

mirrors apply is the only one of these that changes machine state: it needs administrator rights and an explicit --accept-plan fingerprint. A mirror that cannot be installed (older than what is present) is refused up front, and a failure part-way through rolls itself back.

Guide: System Package Managers

Scenario: inspect caches and reclaim storage

osdk cache dir
osdk cache env
osdk --yes cache clean
osdk cache prune
osdk prune --dry-run
osdk --yes prune

cache clean clears downloaded archives and the managed uv and pip caches. Managed uv 0.13.1 or later waits for installs using the same cache. Run osdk cache prune to reclaim unused uv cache entries, or osdk prune to reclaim unreferenced shared content. Wait for pip installs to finish before running cache clean.

Download copies default to a 2 GiB retention budget. Larger models still install; oversized copies are removed after success. Set osdk config set --global download_cache.max_size_bytes 0 to retain none. Inspect with osdk cache status --json, preview with osdk cache trim --dry-run, and trim with osdk cache trim. Models with intact local content and snapshot records can be rebuilt offline after download copies are removed.

Guide: Caches and cleanup

Scenario: a tool updated itself and no longer matches

osdk doctor --verify --tool node
osdk install --force node@20.11.1

doctor --verify re-hashes every installed file and names the ones that changed after installation, which is what a tool's own self-update, a manual edit or a half-restored backup leaves behind. A plain install treats an existing install as done and will not repair it; --force reinstalls the pinned version over it. Verification reads every file, so it is opt-in — plain doctor stays fast and nothing on the execution path hashes anything.

Dynamic installs are checked at each identity-specific root. Newly installed PyPI tools record an integrity baseline; reinstall older PyPI installs with --force to create one. Python bytecode caches are excluded.

Guide: Diagnostics and install verification

Scenario: diagnose an environment or switch language

osdk doctor
osdk doctor --verify
osdk current
osdk where node
osdk config path
osdk config list
osdk config get jobs
osdk config set shims.exclude "apkanalyzer"
osdk --lang zh doctor
OSDK_LANG=en osdk --help
osdk completions bash > osdk.bash

osdk localizes commands, help, prompts, errors, and diagnostics in English and Chinese. --lang overrides the locale for one command; OSDK_LANG sets the session preference.

osdk doctor also reports proxy state. osdk reads a proxy only from HTTPS_PROXY/HTTP_PROXY/ALL_PROXY, never from the Windows system-proxy toggle; when those disagree it says so and names the variable to set, instead of letting a browser-working, osdk-timing-out setup go unexplained.

Guides: Diagnostics · Environment variables · Shell activation and completions

Support matrix

Area Supported
Platforms Windows, macOS, Linux
Runtimes Node.js, Python, Java JDK/JRE, Go, Rust, Deno, Bun, Zig
Package and JVM tools npm, pnpm, Yarn, Maven, Gradle, Kotlin
Other developer tools npm packages through npm:<package>, registry crates or HTTPS Git repositories through cargo:..., Go command packages through go:<module-or-command-path>, conda packages and toolchains such as CUDA through conda:<package>, Python CLIs through pypi:<project> (one virtual environment per tool, with dependencies shared between them), public GitHub Releases through github:owner/repo, and exact checksum-pinned HTTPS artifacts through http:https://...{version}...
Android SDK NDK, platform-tools, build-tools, cmdline-tools, platforms, emulator, and system images
Model providers Hugging Face, ModelScope, Civitai LoRA versions
Agent skills Install SKILL.md packages from GitHub (github:owner/repo with an optional subdir) or a local path, linked into Claude Code / Codex / Cursor / OpenCode / Gemini CLI / GitHub Copilot and more
Native container operations Docker Engine, containerd, Docker Buildx, anonymous OCI registry tests, built-in Docker Hub mirror benchmarking, safe native mirror apply, direct native image pulls, native cache status, Docker local-endpoint pruning, and BuildKit prune previews
Project inputs osdk.toml, .tool-versions, common ecosystem version files
Shells Bash, zsh, fish, PowerShell
CLI languages English, Chinese

Documentation

Getting started and configuration:

Using osdk:

How it works: Internals

Contributions are welcome through issues and pull requests.

License

MIT

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages