Skip to content

Install Grok through mise's first-party registry - #7247

Closed
haydenmckay wants to merge 2 commits into
omacom:quattrofrom
haydenmckay:install-grok-via-mise-registry
Closed

haydenmckay wants to merge 2 commits into
omacom:quattrofrom
haydenmckay:install-grok-via-mise-registry

Conversation

@haydenmckay

@haydenmckay haydenmckay commented Aug 17, 2026 •

Copy link
Copy Markdown

Why

Omarchy already treats Grok like Claude and Codex: a lazy mise stub in ~/.local/bin/grok, plus Setup → Defaults → Agent → Grok. First run of grok is supposed to download the CLI. That is the install path. There is no Install → AI row for coding-agent CLIs on purpose (Crush was removed from that menu).

This PR is not “add Grok because it was missing.” Typing grok is the intended fix for “I want the Grok CLI.”

What is wrong:

  1. Wrong mise package name. The stub and omarchy-default-agent grok called mise use -g npm:@xai-official/grok. mise now has a first-party grok backend (http:grok). mise use -g grok therefore does not install the same tool Omarchy wired up. Anyone following mise/xAI docs pastes a custom HTTP tool definition, or runs the website installer.

  2. The x.ai curl | bash installer fights Omarchy. It writes ~/.grok/bin, prepends that on PATH, and overwrites ~/.local/bin/grok (plus an agent symlink). After that, mise is no longer what grok runs. Easy to hit if you look at x.ai instead of typing grok.

  3. Grok Bot is easy to mistake for the CLI. Install → AI only offers Grok Bot (desktop chat). Someone looking for “install Grok” will pick that, decide it is the wrong thing, and leave the menu for the website. The CLI was never in that list.

Observed sequence on a 4.0 machine (for context, not the bug report): Install → AI → Grok Bot → uninstall → curl -fsSL https://x.ai/cli/install.sh | bash → then grok. grok was never tried first. A failed first grok is not what we are fixing.

What

  • Fresh installs: omarchy-mise-install grok (first-party mise package, same shape as claude / codex)
  • omarchy default agent grok installs grok, not npm:@xai-official/grok
  • Migration rewrites npm wrappers and removes the curl installer's leftover ~/.local/bin/agent symlink
  • Manual: run grok or pick the default agent; skip the website installer
  • Grok Bot menu row: “desktop chat app, not the Grok CLI”

Coding agents stay out of Install → AI. Deploy path is still grok or Setup → Defaults → Agent → Grok.

Tests

  • test/shell.d/default-agent-test.sh
  • test/shell.d/menu-test.sh
  • ./test/cli

mise now ships a grok backend, so the lazy stub and default-agent
installer can use `mise use -g grok` like claude and codex. The npm
package name made that fail unless you pasted a custom tool definition,
which is how people ended up on the x.ai curl installer instead.
Copilot AI balanced review requested due to automatic review settings August 17, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR migrates Grok CLI installation to mise’s first-party grok backend, adds a migration to clean up legacy Grok installs, and updates docs/tests/UI text to match.

Changes:

  • Switch Grok installation from npm:@xai-official/grok to mise registry grok
  • Add a migration to install Grok via mise and remove legacy wrappers / installer artifacts
  • Update manual, menu copy, and shell tests to reflect the new Grok install path

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/shell.d/default-agent-test.sh Updates assertions and adds coverage for the new Grok registry migration behavior
migrations/1786956325.sh New migration to install Grok via mise registry and remove legacy Grok wrapper / agent symlink
manual/17-ai.md Updates Grok CLI documentation to recommend mise registry path and warn against the curl installer
install/user/mise.sh Switches default Grok install to omarchy-mise-install grok
default/omarchy/omarchy-menu.jsonc Clarifies “Grok Bot” is a desktop chat app, not the CLI
bin/omarchy-default-agent Removes explicit npm package mapping for Grok

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread migrations/1786956325.sh Outdated
Comment on lines +15 to +16
agent_target=$(readlink -f "$HOME/.local/bin/agent" || true)
if [[ $agent_target == "$HOME/.grok/"* ]]; then

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken. readlink -f misses the leftover once ~/.grok/bin is gone; the migration now uses the raw readlink target (and the test covers a dangling link).

Comment thread migrations/1786956325.sh
@@ -0,0 +1,19 @@
echo "Install Grok through mise's first-party registry"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this. Omarchy migrations are required to start with an echo describing the change — that line is the progress output in omarchy update, same as migrations/1785846769.sh.

Comment thread migrations/1786956325.sh
Comment on lines +7 to +17
if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then
omarchy-mise-install grok
elif [[ -f $HOME/.local/bin/grok ]] && grep -Fq 'npm:@xai-official/grok' "$HOME/.local/bin/grok"; then
rm -f "$HOME/.local/bin/grok"
fi

# The website installer also drops an `agent` symlink into ~/.local/bin.
if [[ -L $HOME/.local/bin/agent ]]; then
agent_target=$(readlink -f "$HOME/.local/bin/agent" || true)
if [[ $agent_target == "$HOME/.grok/"* ]]; then
rm -f "$HOME/.local/bin/agent"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this. Nearby migrations inline $HOME/.local/... paths; extracting locals in a 20-line one-shot does not match that style.

readlink -f fails once ~/.grok/bin is gone, so the migration would
leave the leftover ~/.local/bin/agent link in place.
Copilot AI review requested due to automatic review settings August 17, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (2)

migrations/1786956325.sh:19

  • This migration is sourced, so agent_target becomes a global variable in the caller’s shell environment and can accidentally clobber an existing variable. Consider using a more uniquely-scoped name (e.g. prefixing with omarchy_), and/or unset it after use to avoid leaking state from the migration.
if [[ -L $HOME/.local/bin/agent ]]; then
  agent_target=$(readlink "$HOME/.local/bin/agent" || true)
  if [[ $agent_target == "$HOME/.grok/"* || $agent_target == *'/.grok/'* ]]; then
    rm -f "$HOME/.local/bin/agent"

migrations/1786956325.sh:18

  • The migration repeats long, specific filesystem paths inline. Defining variables like preinstalls_removed_file=\"$HOME/.local/state/omarchy/preinstalls-removed\" and grok_wrapper=\"$HOME/.local/bin/grok\" would reduce duplication and make future edits less error-prone (e.g., if the state/bin locations change).
if [[ ! -f $HOME/.local/state/omarchy/preinstalls-removed ]]; then
  omarchy-mise-install grok
elif [[ -f $HOME/.local/bin/grok ]] && grep -Fq 'npm:@xai-official/grok' "$HOME/.local/bin/grok"; then
  rm -f "$HOME/.local/bin/grok"
fi

Copilot AI review requested due to automatic review settings August 17, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

migrations/1786956325.sh:17

  • The agent symlink cleanup can miss relative symlink targets like .grok/bin/agent because the match only covers $HOME/.grok/... or paths containing /.grok/. Consider normalizing the target to an absolute path (e.g., via a non-resolving normalization like realpath -m), or broadening the pattern to also match targets containing .grok/ without requiring a leading slash.
if [[ -L $HOME/.local/bin/agent ]]; then
  agent_target=$(readlink "$HOME/.local/bin/agent" || true)
  if [[ $agent_target == "$HOME/.grok/"* || $agent_target == *'/.grok/'* ]]; then
    rm -f "$HOME/.local/bin/agent"
  fi

@shawnyeager

Copy link
Copy Markdown
Contributor

Hit another path of the same fight on Omarchy 4.0.1-1, still on the shipped npm:@xai-official/grok stub.

The stub is mise x "npm:@xai-official/grok" -- grok. That npm trampoline sets GROK_MANAGED_BY_NPM=1, so Grok's auto-updater runs npm i -g @xai-official/grok against prefix=~/.local. npm then tries to write ~/.local/bin/grok and fails with EEXIST because the Omarchy stub is already there (a bash wrapper, not an npm bin-link):

npm error code EEXIST
npm error path /home/shawn/.local/bin/grok
npm error EEXIST: file already exists
Error: Auto-update failed: npm install failed.

After that, mise can hold the 1.0.13 package while ~/.grok/bin/grok still points at grok-1.0.5. The trampoline prefers the existing canonical binary, and the failed npm install never ran postinstall.

Switching to first-party grok (http:grok / aqua:x.ai/cli/grok) drops that trampoline, so Grok should not pick the npm i -g update path. Same class of conflict as the curl installer overwrite already described here.

#7101 is the inverse (Omarchy rm -fs the stub on update) and does not cover this.

@madhermit

Copy link
Copy Markdown

Another data point for this, on Omarchy 4.0.3-1 / mise 2026.9.1. The stale canonical binary @shawnyeager described happens even when nothing fails:

  • mise upgrade moved npm:@xai-official/grok 1.0.13 → 1.0.30 cleanly, but grok --version still reported 1.0.25.
  • mise's npm backend (aube) doesn't run lifecycle scripts, so postinstall.js never updates ~/.grok/bin/grok. The 1.0.30 package's grok-bootstrap.js finds the existing ~/.grok/bin/grok -> grok-1.0.25 and runs that instead of unpacking its own binary. As long as that symlink exists, every mise upgrade is a no-op in practice.
  • I also had a global @xai-official/grok@1.0.25 under mise's node prefix (~/.local/share/mise/installs/node/26.8.1/bin/grok) that shadowed both the mise shim and the Omarchy stub on PATH. It has the same timestamp as grok-1.0.25, so it was most likely Grok's own npm i -g auto-update path that succeeded this time.

Switching locally to the first-party tool (npm -g uninstall @xai-official/grok, mise unuse -g npm:@xai-official/grok, omarchy-mise-install grok, rm -rf ~/.grok/bin) fixed it immediately: grok 1.0.30, one binary, no trampoline.

@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for spotting the npm launcher problem early. The first-party mise package is now coming in through #14004 (from #13889), so closing this in favor of that.

@dhh dhh closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants