@dylanpiercey/work 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.sh +44 -8
  2. package/package.json +1 -1
package/install.sh CHANGED
@@ -94,14 +94,50 @@ log "installing $PKG"
94
94
  npm install -g --loglevel=error "$PKG"
95
95
 
96
96
  # npm's global bin lives inside the mise-managed node install; make sure
97
- # future shells can find `work`.
98
- # Decide from the rc files alone: this script has already put mise's shims on
99
- # its own PATH and installed the package, so `have work` is always true here
100
- # and would skip the append every time.
101
- if ! grep -qs 'mise activate' "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile"; then
102
- log 'adding mise activation to ~/.bashrc'
103
- printf '\neval "$(%s activate bash)"\n' "$(command -v mise)" >> "$HOME/.bashrc"
104
- fi
97
+ # future shells can find `work`. Decide from the rc files alone: this
98
+ # script has already put mise's shims on its own PATH and installed the
99
+ # package, so `have work` is always true here and would skip the append
100
+ # every time. Prefer $SHELL's rc (macOS is zsh); never die if we can't
101
+ # write mise.run may already have hooked zsh, and a root-owned or
102
+ # missing-unwritable ~/.bashrc used to abort the whole install.
103
+ ensure_mise_rc() {
104
+ local shell_name rc hook mise_bin
105
+ mise_bin="$(command -v mise)"
106
+ shell_name="$(basename "${SHELL:-bash}")"
107
+ case "$shell_name" in
108
+ zsh) rc="$HOME/.zshrc"; hook="eval \"\$(\"$mise_bin\" activate zsh)\"" ;;
109
+ fish)
110
+ rc="$HOME/.config/fish/config.fish"
111
+ mkdir -p "$(dirname "$rc")" 2>/dev/null || true
112
+ hook="\"$mise_bin\" activate fish | source"
113
+ ;;
114
+ *) rc="$HOME/.bashrc"; hook="eval \"\$(\"$mise_bin\" activate bash)\"" ;;
115
+ esac
116
+ if grep -qs 'mise activate' \
117
+ "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile" \
118
+ "$HOME/.zshrc" "$HOME/.zprofile" \
119
+ "$HOME/.config/fish/config.fish" 2>/dev/null; then
120
+ return 0
121
+ fi
122
+ if [[ -e "$rc" && ! -w "$rc" ]] || [[ ! -e "$rc" && ! -w "$(dirname "$rc")" ]]; then
123
+ log "could not write $rc — add this to your shell startup: $hook"
124
+ return 0
125
+ fi
126
+ log "adding mise activation to $rc"
127
+ printf '\n%s\n' "$hook" >> "$rc" || {
128
+ log "could not write $rc — add this to your shell startup: $hook"
129
+ return 0
130
+ }
131
+ # macOS Terminal runs bash as a login shell, which reads .bash_profile only.
132
+ if [[ "$rc" == "$HOME/.bashrc" && "$(uname -s)" == "Darwin" ]]; then
133
+ local bp="$HOME/.bash_profile"
134
+ if { [[ -e "$bp" && -w "$bp" ]] || [[ ! -e "$bp" && -w "$HOME" ]]; } \
135
+ && ! grep -Fqs '.bashrc' "$bp" 2>/dev/null; then
136
+ printf '\n[[ -f ~/.bashrc ]] && source ~/.bashrc\n' >> "$bp" || true
137
+ fi
138
+ fi
139
+ }
140
+ ensure_mise_rc
105
141
 
106
142
  # ── hand off ─────────────────────────────────────────────────────────────
107
143
  log "running work setup"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dylanpiercey/work",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "description": "Web GUI for agentic dev workspaces",
6
6
  "license": "MIT",