Skip to content

Instantly share code, notes, and snippets.

@tilusnet
Created April 22, 2026 12:22
Show Gist options
  • Select an option

  • Save tilusnet/2a6113adb4302b6cdbe7501c82bb3229 to your computer and use it in GitHub Desktop.

Select an option

Save tilusnet/2a6113adb4302b6cdbe7501c82bb3229 to your computer and use it in GitHub Desktop.
Alternative (patched) claude-obsidian installer
#!/usr/bin/env bash
# init-claude-obsidian-vault.sh — Set up a fresh claude-obsidian wiki vault.
#
# How it works:
# 1. You point it at a blank directory: this is your new Claude managed wiki, Obsidian vault compatible.
# 2. cd to your new vault and type `claude`
# 3. use claude-obsidian commands /wiki, etc.
#
# See https://github.com/AgriciDaniel/claude-obsidian
set -euo pipefail
# ── Colours ────────────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
CYAN='\033[0;36m'; BOLD='\033[1m'; RESET='\033[0m'
info() { echo -e "${CYAN}${RESET} $*"; }
success() { echo -e "${GREEN}${RESET} $*"; }
warn() { echo -e "${YELLOW} !${RESET} $*"; }
die() { echo -e "${RED}$*${RESET}" >&2; exit 1; }
header() { echo -e "\n${BOLD}$*${RESET}"; }
# ── Usage ──────────────────────────────────────────────────────────────────────
usage() {
echo -e "${BOLD}Usage:${RESET} $(basename "$0") <destination>"
echo
echo " Clones the claude-obsidian repo into <destination>, wires up"
echo " the .claude symlinks, and runs the vault setup script."
echo
echo -e "${BOLD}Example:${RESET}"
echo " $(basename "$0") ~/vaults/my-wiki"
exit 0
}
[[ "${1:-}" =~ ^(-h|--help)$ ]] && usage
[[ $# -eq 0 ]] && die "No destination provided. Run '$(basename "$0") --help' for usage."
DESTDIR="$1"
REPO="https://github.com/AgriciDaniel/claude-obsidian"
# ── Pre-flight checks ──────────────────────────────────────────────────────────
header "Preflight checks"
command -v git &>/dev/null || die "git is not installed."
success "git found"
[[ -e "$DESTDIR" ]] && die "Destination already exists: $DESTDIR"
success "Destination is free: $DESTDIR"
# ── Clone ──────────────────────────────────────────────────────────────────────
header "Cloning repository"
info "From: $REPO"
info "Into: $DESTDIR"
git clone "$REPO" "$DESTDIR"
success "Clone complete"
cd "$DESTDIR"
# ── Prepare wiki directory ─────────────────────────────────────────────────────
header "Preparing wiki directory"
rm -rf wiki
mkdir wiki
success "wiki/ ready"
# ── Set up .claude symlinks ────────────────────────────────────────────────────
header "Wiring .claude symlinks"
mkdir -p .claude
## NB. commands is excluded; seems to clash with skills
for target in skills hooks agents; do
if [[ -e "$target" ]]; then
ln -s "../$target" ".claude/$target"
success "Linked .claude/$target → ../$target"
else
warn "Skipping $target (directory not found)"
fi
done
# ── Run vault setup ────────────────────────────────────────────────────────────
header "Running vault setup"
bash bin/setup-vault.sh
success "Vault setup complete"
# ── Done ───────────────────────────────────────────────────────────────────────
echo
echo -e "${GREEN}${BOLD}All done!${RESET} Your vault is ready at: ${BOLD}$DESTDIR${RESET}"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment