Files
dotfiles/obsidian/setup-obsidian.sh
T
David F GliddenandClaude 0838f1cf8c Initial commit: Complete macOS dotfiles system
🖖 Features:
- Master 'engage' script for one-command setup
- 120+ CLI tools via Homebrew
- 40+ Applications (casks + MAS apps)
- Complete macOS system configuration
- Security hardening and privacy settings
- Obsidian knowledge vault setup
- Comprehensive backup strategies
- Automated symlink management

Live long and prosper\! 🚀

🤖 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-27 13:17:01 +02:00

204 lines
6.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Obsidian configuration setup
set -euo pipefail
OBSIDIAN_VAULT_PATH="$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/David, root-and-branch"
DOTFILES_OBSIDIAN="$HOME/dotfiles/obsidian"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}Setting up Obsidian configuration...${NC}"
# Create obsidian config directory in dotfiles
mkdir -p "$DOTFILES_OBSIDIAN"
if [ ! -d "$OBSIDIAN_VAULT_PATH" ]; then
echo -e "${YELLOW}⚠ Obsidian vault not found at expected location${NC}"
echo "Expected: $OBSIDIAN_VAULT_PATH"
echo "Please update the path in this script if your vault is elsewhere"
exit 1
fi
# Copy community plugins list
if [ -f "$OBSIDIAN_VAULT_PATH/.obsidian/community-plugins.json" ]; then
cp "$OBSIDIAN_VAULT_PATH/.obsidian/community-plugins.json" "$DOTFILES_OBSIDIAN/"
echo -e "${GREEN}✓ Copied community plugins list${NC}"
fi
# Copy app configuration (settings)
if [ -f "$OBSIDIAN_VAULT_PATH/.obsidian/app.json" ]; then
cp "$OBSIDIAN_VAULT_PATH/.obsidian/app.json" "$DOTFILES_OBSIDIAN/"
echo -e "${GREEN}✓ Copied app settings${NC}"
fi
# Copy hotkeys
if [ -f "$OBSIDIAN_VAULT_PATH/.obsidian/hotkeys.json" ]; then
cp "$OBSIDIAN_VAULT_PATH/.obsidian/hotkeys.json" "$DOTFILES_OBSIDIAN/"
echo -e "${GREEN}✓ Copied hotkeys${NC}"
fi
# Copy workspace
if [ -f "$OBSIDIAN_VAULT_PATH/.obsidian/workspace.json" ]; then
cp "$OBSIDIAN_VAULT_PATH/.obsidian/workspace.json" "$DOTFILES_OBSIDIAN/"
echo -e "${GREEN}✓ Copied workspace layout${NC}"
fi
# Create plugin installation script
cat > "$DOTFILES_OBSIDIAN/install-plugins.sh" << 'EOF'
#!/usr/bin/env bash
# Install Obsidian community plugins
echo "Installing Obsidian community plugins..."
# Plugin list from community-plugins.json
PLUGINS=(
"calendar"
"templater-obsidian"
"dataview"
"longform"
"note-refactor-obsidian"
"obsidian-version-history-diff"
"obsidian-kanban"
"table-editor-obsidian"
"obsidian-tasks-plugin"
"obsidian-style-settings"
"obsidian-csv-table"
"tag-wrangler"
)
VAULT_PATH="$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/David, root-and-branch"
PLUGINS_DIR="$VAULT_PATH/.obsidian/plugins"
if [ ! -d "$VAULT_PATH" ]; then
echo "Error: Obsidian vault not found at $VAULT_PATH"
exit 1
fi
mkdir -p "$PLUGINS_DIR"
echo "Note: Obsidian community plugins must be installed through the app."
echo "This script serves as a reference for which plugins to install."
echo ""
echo "Required plugins:"
for plugin in "${PLUGINS[@]}"; do
echo " - $plugin"
done
echo ""
echo "To install:"
echo "1. Open Obsidian"
echo "2. Go to Settings > Community Plugins"
echo "3. Turn off Safe Mode"
echo "4. Browse and install each plugin from the list above"
echo "5. Enable each plugin after installation"
EOF
chmod +x "$DOTFILES_OBSIDIAN/install-plugins.sh"
# Create restore script
cat > "$DOTFILES_OBSIDIAN/restore-config.sh" << 'EOF'
#!/usr/bin/env bash
# Restore Obsidian configuration
VAULT_PATH="$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/David, root-and-branch"
DOTFILES_OBSIDIAN="$HOME/dotfiles/obsidian"
if [ ! -d "$VAULT_PATH" ]; then
echo "Error: Obsidian vault not found at $VAULT_PATH"
exit 1
fi
echo "Restoring Obsidian configuration..."
# Restore configurations
for config in community-plugins.json app.json hotkeys.json workspace.json; do
if [ -f "$DOTFILES_OBSIDIAN/$config" ]; then
cp "$DOTFILES_OBSIDIAN/$config" "$VAULT_PATH/.obsidian/"
echo "✓ Restored $config"
fi
done
echo ""
echo "Configuration restored!"
echo "Note: You'll still need to install the community plugins manually."
echo "Run: ~/dotfiles/obsidian/install-plugins.sh for the plugin list."
EOF
chmod +x "$DOTFILES_OBSIDIAN/restore-config.sh"
# Create README
cat > "$DOTFILES_OBSIDIAN/README.md" << 'EOF'
# Obsidian Configuration
This directory contains Obsidian vault configurations for the "David, root-and-branch" vault.
## What's Included
- `community-plugins.json` - List of installed community plugins
- `app.json` - Core application settings
- `hotkeys.json` - Custom keyboard shortcuts
- `workspace.json` - Workspace layout and panel configuration
## Essential Plugins
This vault relies on these community plugins:
1. **Templater** - Advanced template system with dynamic content
2. **Dataview** - Live data aggregation and queries
3. **Calendar** - Calendar view for daily notes
4. **Longform** - Long-form writing project management
5. **Tasks** - Task management and tracking
6. **Kanban** - Board view for project organization
7. **Table Editor** - Enhanced table editing
8. **Style Settings** - Theme customization
9. **Tag Wrangler** - Tag management
10. **Note Refactor** - Note splitting and organization
11. **Version History Diff** - Compare note versions
12. **CSV Table** - CSV import/export
## Setup on New Machine
1. Install Obsidian from cask: `brew install --cask obsidian`
2. Open Obsidian and create/open vault
3. Run restore script: `~/dotfiles/obsidian/restore-config.sh`
4. Install plugins manually: See `install-plugins.sh` for list
5. Enable plugins in Settings > Community Plugins
## Backup Process
To backup current configuration:
```bash
~/dotfiles/obsidian/setup-obsidian.sh
```
## Vault Philosophy
This vault follows Christopher Alexander's "Pattern Language" approach:
- Organic growth over rigid structure
- Meaning-making over productivity optimization
- Sustainable long-term use patterns
- Integration with analogue workflow (A6 notebook)
## Key Templates
The vault includes sophisticated templates in `98. Templates/`:
- Daily Note Template (morning/evening structure)
- Weekly/Monthly/Quarterly review cycles
- Project and people templates
- Zibaldone (fragment capture) template
## Important Notes
- Vault uses iCloud sync
- Templates require Templater plugin
- Dataview queries need Dataview plugin
- Daily workflow integrates with physical A6 notebook
- Multilingual content (EN/ES/FR/CA)
EOF
echo -e "${GREEN}Obsidian setup complete!${NC}"
echo -e "Files created in: $DOTFILES_OBSIDIAN"