Skip to content

Latest commit

 

History

History
193 lines (142 loc) · 4.93 KB

README.md

File metadata and controls

193 lines (142 loc) · 4.93 KB

Chef

Personal package manager

Why it exists

This is useful for those binaries that are not packaged by a distro.

With chef you can:

  • Install a random binary
  • Keep it up-to-date
  • Run it
  • Automatically create desktop entries for GUI applications when specified in recipes

Quick Start (Zero Config)

Install Chef globally to manage your binaries from anywhere:

deno install -gA jsr:@sigmasd/chef

# Now you can use the chef command directly
chef gui
chef list

GUI Application

Chef comes with a GTK4 graphical user interface. You can install it as a permanent desktop application:

chef gui --install

Chef GUI

Customizing Recipes

By default, Chef uses a recipes file located in your cache directory. To customize your recipes, you can create a local script (e.g., chef.ts):

import { $, Chef } from "jsr:@sigmasd/chef";
import { getLatestGithubRelease } from "jsr:@sigmasd/chef/utils";

const chef = new Chef();

chef.add({
  name: "irust",
  download: async ({ latestVersion }) => {
    await $.request(
      `https://github.com/sigmaSd/IRust/releases/download/${latestVersion}/irust-x86_64-unknown-linux-gnu`,
    ).showProgress().pipeToPath();
    await Deno.chmod("./irust-x86_64-unknown-linux-gnu", 0o555);
    return {
      exe: "./irust-x86_64-unknown-linux-gnu",
    };
  },
  version: () => getLatestGithubRelease("sigmaSd/IRust"),
  desktopFile: {
    comment: "Rust REPL",
    categories: "Development;",
    terminal: true,
  },
});

await chef.start(import.meta.url);

Detecting the installed version

By default, Chef tracks what version it installed in its database. If you update the binary externally (e.g., the app's own updater), Chef won't know about it.

Use versionCommand to detect the currently installed version by running a shell command on the binary. This is checked every time recipes are refreshed (e.g., on chef list, chef update):

import { $, Chef } from "jsr:@sigmasd/chef";

const chef = new Chef();

chef.add({
  name: "zap",
  download: async ({ latestVersion }) => {
    // download the binary
    return { exe: "./zap" };
  },
  version: () => getLatestGithubRelease("zap-zsh/zap"),
  // Run `zap --version` and parse the output to extract the version
  versionCommand: () =>
    $`chef run zap --version`.text().then((out) => out.split("Oz")[1]),
});

await chef.start(import.meta.url);

Running your custom script

# Run your script directly
deno run -A chef.ts list

# You can also install your custom script as the global 'chef' command
deno install -gA -n chef chef.ts
chef gui

Multiple Recipe Scripts

You can have multiple chef scripts for different purposes (e.g., lsp.ts, work.ts). Each script manages its own set of binaries and settings independently because of the import.meta.url passed to chef.start().

deno run -A lsp.ts update
deno run -A work.ts list

Agent Skill: Adding Recipes

An Agent Skills skill that teaches coding agents (opencode, Claude Code, etc.) how to add recipes to Chef — download and inspect the real release asset, then write the recipe based on what was observed.

Install it globally (symlinked into ~/.config/opencode/skills/):

dx skills add sigmaSd/Chef -g -a opencode

dx is the Deno alternative to npx (deno x). Update later with dx skills update. Restart opencode after installing so it picks up the skill.

External Providers

Chef supports external providers, which allow you to integrate other package managers or custom binary sources. Providers are external commands that communicate with Chef using a JSON-based protocol.

Example provider: rustman (A provider for Rust binaries).

Provider SDK

You can use the Chef provider SDK to create your own providers easily:

import { runChefProvider } from "jsr:@sigmasd/chef/sdk";

await runChefProvider({
  list: async () => [{ name: "my-app", version: "1.0.0" }],
  update: async ({ name, version }) => {
    console.error(`Installing ${name}@${version}`);
    return true;
  },
  remove: async (name) => {
    console.error(`Removing ${name}`);
    return true;
  },
});

Managing Providers

# Add a provider
chef provider add rustman "deno run -A jsr:@sigmasd/rustman"

# List providers
chef provider list

# Remove a provider
chef provider remove rustman

Once a provider is added, its binaries will appear in chef list and can be managed just like native recipes.

CLI Commands

  • chef update to update all binaries
  • chef list to list currently installed binaries
  • chef run ${binary} $args to run an installed binary
  • chef link ${binary} to create a symlink in ~/.cache/chef/exports (add this to your PATH!)
  • chef gui [--install | --uninstall] manage the Chef GUI application
  • chef desktop-file [create | remove] <binary> manually manage desktop entries
  • chef --version show chef version