1jehuang / 1jehuang/jcode

Adding jcode to official Homebrew Core: support build feature to disable self-updates

Open
#1,111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: no enhancement priority: medium triage: needs-decision
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Hi @1jehuang,

I'm currently preparing a Pull Request to submit jcode to official [Homebrew Core](https://github.com/Homebrew/homebrew-core).

Homebrew's acceptance policy requires that CLI tools packaged in Core do not attempt to self-update (neither via background auto-updates nor manual update commands), as package managers handle binary integrity, sandboxing, and version upgrades directly via brew upgrade.

Current Workaround in the Formula

In our formula, we currently apply two small inreplace patches during the build step:

  1. Disable default background auto-update (src/cli/args.rs):
// Changes default_value from "true" to "false"
#[arg(long, global = true, default_value = "false")]
pub(crate) auto_update: bool,

  1. Redirect manual jcode update to Homebrew (src/cli/dispatch.rs):
// Prints a notice instead of downloading binaries
eprintln!("Please update jcode using: brew upgrade jcode");

Proposed Upstream Solutions

To make packaging cleaner and avoid source patches across downstream package managers (Homebrew, Arch AUR, Nixpkgs, Alpine, etc.), would you be open to introducing an upstream compile-time switch?

A few common approaches:

  • Option 1: A Cargo feature (Recommended)
    Make self-update a default feature in Cargo.toml:
[features]
default = ["pdf", "embeddings", "bedrock", "self-update"]
self-update = []

When self-update is disabled:

  • --auto-update defaults to false.

  • jcode update informs the user that updates are managed by their package manager.

  • Option 2: A compile-time environment variable
    Check option_env!("JCODE_DISABLE_SELF_UPDATE") during compilation.

This is a standard pattern used by tools in Homebrew Core (such as mise, pixi, and rustup).

Thanks for building jcode! Let me know what you think.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Cargo.toml, src/cli/args.rs, and src/cli/dispatch.rs to understand the existing feature configuration, auto-update default, and update command. Resolve which compile-time switch the project will support, then verify that disabling it prevents self-updates and directs users to their package manager.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.