Keep user-managed Dim and Kimi launchers and write Claude settings through fresh private files
This commit is contained in:
1 parent
23072924c4
commit
da6045be3f
5 files changed
+33
-11
No files matched your search
@@ -15,8 +15,7 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
|
||||
# Remove mise stubs
|
||||
rm -f ~/.local/bin/codex ~/.local/bin/claude ~/.local/bin/agy ~/.local/bin/copilot \
|
||||
~/.local/bin/gh ~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \
|
||||
~/.local/bin/omp ~/.local/bin/ori ~/.local/bin/grok ~/.local/bin/crush ~/.local/bin/ghui ~/.local/bin/hunk \
|
||||
~/.local/bin/dim ~/.local/bin/kimi
|
||||
~/.local/bin/omp ~/.local/bin/ori ~/.local/bin/grok ~/.local/bin/crush ~/.local/bin/ghui ~/.local/bin/hunk
|
||||
|
||||
# Cursor's own installer links ~/.local/bin/cursor-agent as well, so only
|
||||
# the mise wrapper omarchy-mise-install wrote is a preinstall.
|
||||
@@ -25,6 +24,15 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
|
||||
rm -f ~/.local/bin/cursor-agent
|
||||
fi
|
||||
|
||||
# Only Omarchy's mise wrappers for Dim and Kimi are preinstalls.
|
||||
for wrapper in "dim npm:dimcode" "kimi npm:@moonshot-ai/kimi-code"; do
|
||||
read -r command package <<<"$wrapper"
|
||||
if [[ -f ~/.local/bin/$command && ! -L ~/.local/bin/$command ]] &&
|
||||
grep -qF "mise use -g --quiet \"$package\"" ~/.local/bin/$command; then
|
||||
rm -f ~/.local/bin/$command
|
||||
fi
|
||||
done
|
||||
|
||||
# Preserve a user-managed Muse launcher at the same path.
|
||||
if [[ -f ~/.local/bin/muse && ! -L ~/.local/bin/muse ]] &&
|
||||
grep -Eq '^mise use -g .*"http:muse\[' ~/.local/bin/muse; then
|
||||
|
||||
@@ -12,17 +12,15 @@ keys=(ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_MODEL ANTHROPIC_DEFAULT_
|
||||
|
||||
keys_json=$(printf '%s\n' "${keys[@]}" | jq -R . | jq -s .)
|
||||
|
||||
# rewrite <file> <jq filter> [jq args...] keeps the file private.
|
||||
# rewrite <file> <jq filter> [jq args...] replaces the file with a fresh 0600 copy.
|
||||
rewrite() {
|
||||
local file=$1 filter=$2
|
||||
local file=$1 filter=$2 tmp
|
||||
shift 2
|
||||
mkdir -p "${file%/*}"
|
||||
[[ -f $file ]] || echo '{}' >"$file"
|
||||
(
|
||||
umask 077
|
||||
jq --argjson keys "$keys_json" "$@" "$filter" "$file" >"$file.tmp"
|
||||
)
|
||||
mv "$file.tmp" "$file"
|
||||
tmp=$(mktemp "$file.XXXXXX")
|
||||
jq --argjson keys "$keys_json" "$@" "$filter" "$file" >"$tmp" || { rm -f "$tmp"; exit 1; }
|
||||
mv "$tmp" "$file"
|
||||
}
|
||||
|
||||
if [[ ${1:-} == "--remove" ]]; then
|
||||
|
||||
Reference in new issue
Block a user