# Setup Guide - Memory Palace

Quick setup guide for using this workspace on a new computer.

## 🚀 Quick Start

### 1. Clone the Repository

```bash
git clone ssh://git@gitea.gregrjacobs.com:2222/fragginwagon/memory-infrastructure-palace.git MemoryPalace
cd MemoryPalace
```

### 2. Install Dependencies

```bash
npm install
```

### 3. Open in VS Code

```bash
code .
```

VS Code will automatically:

- Prompt to install recommended extensions
- Apply workspace settings
- Enable GitDoc for auto-commit/push

### 4. Install Recommended Extensions

When prompted, click **"Install All"** for recommended extensions, or install manually:

- Foam (wiki-links, backlinks, graph)
- Markdown All in One
- Markdown Notes
- Todo Tree
- Code Runner
- Bookmarks
- Project Manager
- Git History
- Git Graph
- GitLens

## 🔑 SSH Key Setup (for Git)

If you haven't set up SSH keys on the new machine:

```bash
# Generate SSH key
ssh-keygen -t ed25519 -C "your_email@example.com"

# Copy public key
cat ~/.ssh/id_ed25519.pub

# Add to SSH agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

# macOS: Add to keychain
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
```

Then add the public key to Gitea:

1. Go to https://gitea.gregrjacobs.com
2. Settings → SSH / GPG Keys
3. Add Key → Paste public key

### SSH Config for Gitea

Add to `~/.ssh/config`:

```
Host gitea.gregrjacobs.com
    Port 2222
    User git
    IdentityFile ~/.ssh/id_ed25519
```

## ✅ Verify Setup

Test Git connection:

```bash
ssh -T -p 2222 git@gitea.gregrjacobs.com
```

Test bookmarklet generator:

```bash
npm run bookmarklet -- code/bookmarklets/highlight-links.js
```

## 🎯 Key Features Enabled

### Auto-Commit & Push

- GitDoc automatically commits on save (1 second delay)
- Pushes after each commit
- Pulls on workspace open

### View History

- **Git Graph**: `Cmd+Shift+P` → "Git Graph: View Git Graph"
- **File Timeline**: Right-click file → "Open Timeline"
- **GitLens**: Inline blame annotations and rich git features

### Rollback Changes

```bash
# View history
git log --oneline

# Rollback specific file
git checkout <commit-hash> -- path/to/file

# Undo last commit (keep changes)
git reset --soft HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1
```

## 📦 npm Scripts

```bash
npm run bookmarklet -- <path>  # Generate bookmarklet
npm run readme                 # Auto-generate README (if using)
npm run format                 # Format code with Prettier
```

## 🔧 Customization

All settings are in:

- `.vscode/settings.json` - Workspace settings
- `.vscode/extensions.json` - Recommended extensions
- `package.json` - npm scripts and dependencies

## 🌐 Using on Multiple Computers

This workspace is fully portable:

1. **All settings** are in `.vscode/` (committed to git)
2. **Extensions** are listed in `extensions.json`
3. **Dependencies** are in `package.json`

Just clone, run `npm install`, and open in VS Code!

## 💡 Tips

- **First time setup**: Allow 2-3 minutes for extensions to install
- **Git conflicts**: If you edit on multiple machines, pull before starting work
- **Extension sync**: VS Code will prompt to install missing extensions
- **Manual extension install**: `Cmd+Shift+P` → "Extensions: Show Recommended Extensions"

## 🐛 Troubleshooting

### GitDoc not auto-committing

- Check: `Cmd+Shift+P` → "GitDoc: Enable"
- Verify: `.vscode/settings.json` has `"gitdoc.enabled": true`

### SSH Permission Denied

- Verify SSH key is added to Gitea
- Check: `ssh -T -p 2222 git@gitea.gregrjacobs.com`
- Ensure SSH agent is running: `eval "$(ssh-agent -s)"`

### Extensions not installing

- Open: `Cmd+Shift+P` → "Extensions: Show Recommended Extensions"
- Click "Install" on each extension

## 📚 Documentation

- [Main README](README.md) - Project overview
- [Code README](code/README.md) - Code development guide
- [Docs README](docs/README.md) - Documentation guide
- [Copilot Instructions](.github/copilot-instructions.md) - AI assistant guidelines

---

**Ready to go!** Start by creating your first note: `Cmd+Shift+P` → "Foam: Create New Note"
