@nemus-cli/nemus 0.13.0 → 0.14.0
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.
- package/CHANGELOG.md +12 -0
- package/README.md +3 -1
- package/install-shell-integration.sh +21 -9
- package/package.json +1 -1
- package/remove-shell-block.awk +8 -0
- package/uninstall.sh +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.14.0] - 2026-09-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Shell integration now keeps its generated functions out of your shell RC
|
|
15
|
+
files.** Nemus writes them to `~/.nemus/shell-integration.sh` and adds only a
|
|
16
|
+
single guarded `source` line to `.zshrc`/`.bashrc`, so upgrades no longer
|
|
17
|
+
churn hundreds of lines in your personal shell config. Existing inline
|
|
18
|
+
installations migrate automatically without disturbing surrounding user
|
|
19
|
+
content, and reinstalls stay idempotent. Uninstall removes the generated file
|
|
20
|
+
too. Thanks to @uzikilon for the idea and original implementation (#50).
|
|
21
|
+
|
|
10
22
|
## [0.13.0] - 2026-09-02
|
|
11
23
|
|
|
12
24
|
### Added
|
package/README.md
CHANGED
|
@@ -138,7 +138,9 @@ npm install -g @nemus-cli/nemus
|
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
The postinstall step sets up optional shell integration (auto-cd into new
|
|
141
|
-
workspaces + a quick-navigate helper).
|
|
141
|
+
workspaces + a quick-navigate helper). It keeps the generated functions in
|
|
142
|
+
`~/.nemus/shell-integration.sh` and adds only a guarded source line to your
|
|
143
|
+
shell RC file, so upgrades don't churn your `.zshrc`/`.bashrc`.
|
|
142
144
|
|
|
143
145
|
### From source
|
|
144
146
|
|
|
@@ -491,17 +491,30 @@ else
|
|
|
491
491
|
exit 1
|
|
492
492
|
fi
|
|
493
493
|
|
|
494
|
-
#
|
|
495
|
-
|
|
494
|
+
# Keep the generated functions out of the user's shell config. The same file
|
|
495
|
+
# works in both bash and zsh; the RC file only needs this guarded source line.
|
|
496
|
+
SHELL_INTEGRATION_DIR="$HOME/.nemus"
|
|
497
|
+
SHELL_INTEGRATION_FILE="$SHELL_INTEGRATION_DIR/shell-integration.sh"
|
|
498
|
+
SOURCE_LINE='[ -f "$HOME/.nemus/shell-integration.sh" ] && source "$HOME/.nemus/shell-integration.sh"'
|
|
499
|
+
|
|
500
|
+
mkdir -p "$SHELL_INTEGRATION_DIR"
|
|
501
|
+
SHELL_TMPFILE=$(mktemp "$SHELL_INTEGRATION_DIR/.shell-integration.XXXXXX")
|
|
502
|
+
printf '%s\n' "$SHELL_FUNCTION" > "$SHELL_TMPFILE"
|
|
503
|
+
mv "$SHELL_TMPFILE" "$SHELL_INTEGRATION_FILE"
|
|
504
|
+
|
|
505
|
+
append_source_line() {
|
|
506
|
+
printf '\n# Nemus - Shell Integration\n%s\n' "$SOURCE_LINE" >> "$1"
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
# Check if already installed
|
|
510
|
+
if grep -Fq "$SOURCE_LINE" "$RC_FILE" 2>/dev/null; then
|
|
496
511
|
echo "✅ Shell integration already up to date in $RC_FILE"
|
|
497
512
|
elif grep -q "# Nemus - Shell Integration" "$RC_FILE" 2>/dev/null; then
|
|
498
|
-
# Old version installed — remove it and
|
|
513
|
+
# Old inline version installed — remove it and leave only the source line
|
|
499
514
|
echo "🔄 Upgrading shell integration in $RC_FILE..."
|
|
500
515
|
TMPFILE=$(mktemp)
|
|
501
516
|
awk -f "$SCRIPT_DIR/remove-shell-block.awk" "$RC_FILE" > "$TMPFILE"
|
|
502
|
-
|
|
503
|
-
echo "" >> "$TMPFILE"
|
|
504
|
-
echo "$SHELL_FUNCTION" >> "$TMPFILE"
|
|
517
|
+
append_source_line "$TMPFILE"
|
|
505
518
|
cp "$RC_FILE" "${RC_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
|
|
506
519
|
chmod --reference="$RC_FILE" "$TMPFILE" 2>/dev/null || chmod "$(stat -f '%Lp' "$RC_FILE")" "$TMPFILE" 2>/dev/null || true
|
|
507
520
|
mv "$TMPFILE" "$RC_FILE"
|
|
@@ -514,9 +527,8 @@ else
|
|
|
514
527
|
echo "📦 Backup created: ${RC_FILE}.backup.*"
|
|
515
528
|
fi
|
|
516
529
|
|
|
517
|
-
# Append
|
|
518
|
-
|
|
519
|
-
echo "$SHELL_FUNCTION" >> "$RC_FILE"
|
|
530
|
+
# Append the source line (creates the file if it doesn't exist)
|
|
531
|
+
append_source_line "$RC_FILE"
|
|
520
532
|
|
|
521
533
|
echo "✅ Shell integration installed in $RC_FILE"
|
|
522
534
|
echo ""
|
package/package.json
CHANGED
package/remove-shell-block.awk
CHANGED
|
@@ -33,6 +33,14 @@ skip {
|
|
|
33
33
|
saw_func = 1
|
|
34
34
|
next
|
|
35
35
|
}
|
|
36
|
+
if (/\.nemus\/shell-integration\.sh/ && /source/) {
|
|
37
|
+
# Current installs keep the functions in a generated file and leave only
|
|
38
|
+
# this source line in the RC file.
|
|
39
|
+
skip = 0
|
|
40
|
+
saw_func = 0
|
|
41
|
+
buf = ""
|
|
42
|
+
next
|
|
43
|
+
}
|
|
36
44
|
# Non-function line: block is over — emit any buffered lines
|
|
37
45
|
skip = 0
|
|
38
46
|
if (buf != "") printf "%s", buf
|
package/uninstall.sh
CHANGED
|
@@ -38,7 +38,7 @@ echo -e "${YELLOW}This will NOT remove:${NC}"
|
|
|
38
38
|
echo " • Your workspaces ($HOME/workspaces/)"
|
|
39
39
|
echo " • Cache files (~/.workspace-manager-cache/)"
|
|
40
40
|
echo " • Configuration files (~/.workspace-manager-claude-config.json)"
|
|
41
|
-
echo " • Shell integration (from .zshrc or .bashrc)"
|
|
41
|
+
echo " • Shell integration (from .zshrc or .bashrc and ~/.nemus/)"
|
|
42
42
|
echo " • ghq (if installed)"
|
|
43
43
|
echo ""
|
|
44
44
|
|
|
@@ -85,8 +85,11 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
85
85
|
if grep -q "# Nemus - Shell Integration" "$HOME/.zshrc"; then
|
|
86
86
|
# Create backup
|
|
87
87
|
cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d_%H%M%S)"
|
|
88
|
-
# Remove the
|
|
89
|
-
|
|
88
|
+
# Remove the block/source line (awk handles both formats safely)
|
|
89
|
+
TMPFILE=$(mktemp)
|
|
90
|
+
awk -f "$SCRIPT_DIR/remove-shell-block.awk" "$HOME/.zshrc" > "$TMPFILE"
|
|
91
|
+
chmod --reference="$HOME/.zshrc" "$TMPFILE" 2>/dev/null || chmod "$(stat -f '%Lp' "$HOME/.zshrc")" "$TMPFILE" 2>/dev/null || true
|
|
92
|
+
mv "$TMPFILE" "$HOME/.zshrc"
|
|
90
93
|
print_success "Removed from .zshrc (backup created)"
|
|
91
94
|
fi
|
|
92
95
|
fi
|
|
@@ -96,11 +99,19 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
96
99
|
if grep -q "# Nemus - Shell Integration" "$HOME/.bashrc"; then
|
|
97
100
|
# Create backup
|
|
98
101
|
cp "$HOME/.bashrc" "$HOME/.bashrc.backup.$(date +%Y%m%d_%H%M%S)"
|
|
99
|
-
# Remove the
|
|
100
|
-
|
|
102
|
+
# Remove the block/source line (awk handles both formats safely)
|
|
103
|
+
TMPFILE=$(mktemp)
|
|
104
|
+
awk -f "$SCRIPT_DIR/remove-shell-block.awk" "$HOME/.bashrc" > "$TMPFILE"
|
|
105
|
+
chmod --reference="$HOME/.bashrc" "$TMPFILE" 2>/dev/null || chmod "$(stat -f '%Lp' "$HOME/.bashrc")" "$TMPFILE" 2>/dev/null || true
|
|
106
|
+
mv "$TMPFILE" "$HOME/.bashrc"
|
|
101
107
|
print_success "Removed from .bashrc (backup created)"
|
|
102
108
|
fi
|
|
103
109
|
fi
|
|
110
|
+
|
|
111
|
+
if [ -f "$HOME/.nemus/shell-integration.sh" ]; then
|
|
112
|
+
rm -f "$HOME/.nemus/shell-integration.sh"
|
|
113
|
+
print_success "Removed ~/.nemus/shell-integration.sh"
|
|
114
|
+
fi
|
|
104
115
|
fi
|
|
105
116
|
|
|
106
117
|
# Optionally remove cache
|