refactor: bashrc is always sourced after tool install automatically

- Added source_bashrc funciton in shell_confi.sh
- Removed bashrc source commands from installer scripts
- Updated skill instructions
This commit is contained in:
2026-06-25 09:53:03 +05:30
parent 53e98c7542
commit 7fe9ac913b
9 changed files with 40 additions and 11 deletions

View File

@@ -246,3 +246,4 @@ track_file "/usr/local/bin/binary"
6. **Error handling**: Use `set -euo pipefail` after the guard block.
7. **CLI Enforcement Guard**: Always copy the standalone execution guard block verbatim to the top of your installer script to prevent direct execution.
8. **Clean Official Scripts**: When implementing official curl/install scripts provided in the prompt, strip them of bloat, macOS/Windows support, and redundant shell setups before writing the script.
9. **No manual shell re-sourcing**: Do NOT manually run `source ~/.bashrc` or print instructions asking the user to run it. Sourcing of the shell configuration is handled automatically by the central router and CLI at the end of the installation.

View File

@@ -25,12 +25,22 @@ When the user asks to "cut a release", "bump the version", or "tag a new version
- If any core-CLI commit has `feat:` → **minor**
- Otherwise (only `fix:`, `refactor:`, etc. in core-CLI) → **patch**
- If *all* commits are installer-only or docs-only → inform the user no release is needed.
3. **Run the release script** non-interactively (if an actual bump is needed):
```bash
./scripts/release.sh --<level> -y
3. **Formulate a verbose, structured description of the changes** based on the analyzed commits. Group the changes into logical sections (such as "Breaking Changes & Major Features:" and "Other Updates:") and list the corresponding commit messages or summaries. Example format:
```text
Breaking Changes & Major Features:
feat: Resumable Download Helper and Manifest Preservation
Other Updates:
docs: Update readme
feat(skills): Add Installer to use rollback and savepoint hooks
```
(e.g., `./scripts/release.sh --minor -y`)
4. **Push** the tag and commit (ask for user confirmation before pushing):
4. **Run the release script** non-interactively, passing the compiled description:
```bash
./scripts/release.sh --<level> -y -m "<verbose description>"
```
5. **Push** the tag and commit (ask for user confirmation before pushing):
```bash
git push origin master <tag>
```

9
b.sh
View File

@@ -66,6 +66,15 @@ b() {
# Execute the routes file
bash "$routes_file" "$@"
local ret=$?
# Sourced again in the parent shell after successfully running the command
if [ $ret -eq 0 ]; then
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
return $ret
}
# Autocompletion for the b command in Bash

View File

@@ -94,7 +94,6 @@ main() {
echo
log_success "Bat installation and configuration complete."
log_info "Please close and reopen your terminal or run: source ~/.bashrc to apply changes."
}
main "$@"

View File

@@ -109,7 +109,6 @@ main() {
log_info "Installed NVM version: $(nvm --version 2>/dev/null || cat "$HOME/.nvm/package.json" | grep '"version":' | head -n1 | sed -E 's/.*"version": "([^"]+)".*/\1/' || echo "unknown")"
else
log_success "Installation complete."
log_info "Please close and reopen your terminal or run: source ~/.bashrc to verify."
fi
}

View File

@@ -218,7 +218,6 @@ main() {
log_info "Installed pnpm version: $(pnpm --version 2>/dev/null || echo 'unknown')"
else
log_success "Installation complete."
log_info "Please close and reopen your terminal or run: source ~/.bashrc to verify."
fi
}

View File

@@ -127,6 +127,7 @@ run_ware() {
if [ "$run_status" -eq 0 ] && [ "$interrupted" = "false" ]; then
mark_install_success "$tool"
source_bashrc
else
echo
if [ "$interrupted" = "true" ]; then

View File

@@ -166,8 +166,18 @@ create_fd_symlink() {
fi
}
# Source the bashrc file to reload configurations
source_bashrc() {
if [ -f "$HOME/.bashrc" ]; then
log_info "Re-sourcing ~/.bashrc..."
. "$HOME/.bashrc"
fi
}
# Export functions and variables for subshells
export _LIB_SHELL_CONFIG_SOURCED=1
export -f get_shell_configs remove_block inject_block add_alias_if_missing add_env_if_missing create_fd_symlink write_env_snippet write_alias_snippet remove_env_snippet remove_alias_snippet
export -f get_shell_configs remove_block inject_block add_alias_if_missing add_env_if_missing create_fd_symlink write_env_snippet write_alias_snippet remove_env_snippet remove_alias_snippet source_bashrc

View File

@@ -10,7 +10,7 @@ IFS='.' read -r cur_major cur_minor cur_patch <<< "${current#v}"
bump=""
auto_confirm=false
message=""
# Parse flags for non-interactive (agent) usage
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -18,6 +18,7 @@ while [[ $# -gt 0 ]]; do
--minor) bump="minor"; shift ;;
--major) bump="major"; shift ;;
-y|--yes) auto_confirm=true; shift ;;
-m|--message) message="$2"; shift 2 ;;
*) echo "Unknown option: $1" >&2; exit 1 ;;
esac
done
@@ -58,7 +59,7 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then
echo "${new_ver#v}" > VERSION
git add VERSION
git commit -m "release: $new_ver"
git tag -a "$new_ver" -m "Release $new_ver"
git tag -a "$new_ver" -m "${message:-Release $new_ver}"
echo "Tagged $new_ver. Push with: git push origin master $new_ver"
else
echo "Aborted."