diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..36e8449 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,64 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Repository Overview + +This is an Alfred preferences sync repository. It contains Alfred workflows, snippets, and preferences that are version-controlled via git and synced across machines. + +**Directory Structure:** +- `Alfred.alfredpreferences/` - Main Alfred preferences package + - `workflows/` - Alfred workflows (UUID-named directories, each containing `info.plist`) + - `snippets/` - Text snippet collections (JSON files with Alfred snippet format) + - `preferences/` - General Alfred preferences (`prefs.plist`, features, etc.) + - `resources/` - Alfred resources (icons, images) + - `remote/` - Remote sync data +- `alfred-sync.sh` - Git sync script + +## Syncing Changes + +To commit and push Alfred preference changes: + +```bash +./alfred-sync.sh +``` + +This script stages all changes, creates a timestamped commit, and pushes to the remote repository. + +## Alfred Workflow Structure + +Each workflow is stored in `workflows/user.workflow.{UUID}/` and contains: +- `info.plist` - Main workflow configuration (name, objects, connections, script definitions) + +Workflows are defined as XML plist files containing: +- Workflow metadata (name, bundleid, createdby) +- Objects (script actions, inputs, outputs, notifications) +- Connections between objects +- UI layout data (uidata) + +## Snippet Collections + +Snippets are organized in themed collections under `snippets/`: +- `術語速查字典/` - Technical terminology cheat sheets +- `中文輸出速查/` - Chinese text output shortcuts +- `特殊字元輸出集/` - Special character collections +- `topsecret/` - Sensitive credentials (be cautious when committing) + +Each snippet is a JSON file with the structure: +```json +{ + "alfredsnippet": { + "snippet": "expansion text", + "uid": "UUID", + "name": "display name", + "keyword": "trigger keyword" + } +} +``` + +## Notes + +- The `Alfred.alfredpreferences` directory is macOS package format +- Workflow UUIDs are generated by Alfred and should not be changed +- When editing workflows, ensure plist XML syntax remains valid +- Be mindful of sensitive data in snippets (especially `topsecret/` collection) diff --git a/QUICKSTART.md b/QUICKSTART.md new file mode 100644 index 0000000..f680926 --- /dev/null +++ b/QUICKSTART.md @@ -0,0 +1,79 @@ +# Quick Start + +Get your Alfred preferences synced in a few steps. + +## Initial Setup + +### 1. Clone the Repository + +```bash +git clone ~/Sync/AlfredPrefs +cd ~/Sync/AlfredPrefs +``` + +### 2. Link Alfred Preferences + +Replace Alfred's default preferences with a symlink to this repository: + +```bash +# Backup existing preferences first (if they exist) +mv ~/Library/Application\ Support/Alfred/Alfred.alfredpreferences \ + ~/Library/Application\ Support/Alfred/Alfred.alfredpreferences.backup + +# Create the symlink +ln -s ~/Sync/AlfredPrefs/Alfred.alfredpreferences \ + ~/Library/Application\ Support/Alfred/Alfred.alfredpreferences +``` + +### 3. Restart Alfred + +Quit and relaunch Alfred. Your workflows and snippets will now be loaded from this repository. + +## Daily Usage + +### Sync Your Changes + +After modifying workflows or snippets in Alfred: + +```bash +cd ~/Sync/AlfredPrefs +./alfred-sync.sh +``` + +That's it! Your changes are now committed and pushed. + +### Pull Changes from Another Machine + +```bash +cd ~/Sync/AlfredPrefs +git pull +``` + +Then restart Alfred to load the updated preferences. + +## Sync Script + +The `alfred-sync.sh` script does the following: + +```bash +cd /Users/timmy/Sync/AlfredPrefs +git add -A +git commit -m "sync YYYY-MM-DD HH:MM" +git push +``` + +Customize the path in the script if your repository location differs. + +## Troubleshooting + +**Alfred doesn't show new workflows** +- Restart Alfred from the menu bar +- Check that the symlink is correctly created + +**Sync fails** +- Ensure you have git access to the repository +- Check your SSH keys or authentication + +**Changes not appearing** +- Run `git pull` to get latest changes +- Restart Alfred after pulling diff --git a/README.md b/README.md new file mode 100644 index 0000000..a72111d --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# Alfred Preferences Sync + +This repository contains synchronized Alfred preferences, including workflows, snippets, and configurations. The setup allows for easy backup and synchronization across multiple Mac machines. + +## Overview + +Alfred is a productivity application for macOS. This repository uses git to version-control and sync: + +- **Workflows** - Custom automation scripts and workflows +- **Snippets** - Text expansion collections organized by theme +- **Preferences** - Alfred application settings + +## Repository Structure + +``` +AlfredPrefs/ +├── Alfred.alfredpreferences/ # Main Alfred preferences package +│ ├── workflows/ # Alfred workflows (UUID directories) +│ ├── snippets/ # Text snippet collections +│ ├── preferences/ # General settings +│ ├── resources/ # Icons and assets +│ └── remote/ # Sync metadata +└── alfred-sync.sh # Sync script +``` + +## Cloning to a New Machine + +1. Clone this repository: + ```bash + git clone ~/Sync/AlfredPrefs + ``` + +2. Symlink to Alfred's expected location (if needed): + ```bash + ln -s ~/Sync/AlfredPrefs/Alfred.alfredpreferences ~/Library/Application\ Support/Alfred/Alfred.alfredpreferences + ``` + +3. Restart Alfred to load the preferences + +## Syncing Changes + +After making changes to Alfred workflows or snippets: + +```bash +cd ~/Sync/AlfredPrefs +./alfred-sync.sh +``` + +This will: +- Stage all changes +- Create a timestamped commit +- Push to the remote repository + +## Workflows Included + +| Workflow Name | Description | +|--------------|-------------| +| 無腦生密碼 | Password generator (easy to read/all characters) | +| TextTaiwanizer | Convert text to Taiwan-style Chinese | +| 盤古之白自動加空格 | Auto-add spaces between Chinese and English | +| 使用Prettier自動格式化程式碼 | Prettier code formatter | +| 使用urldecode解碼URL編碼字串 | URL decoder | +| Office 滅證 | Office metadata cleaner | + +## Snippet Collections + +- **術語速查字典** - Technical terminology (SQL, Oracle, Docker, etc.) +- **中文輸出速查** - Chinese text expansion shortcuts +- **特殊字元輸出集** - Special character collections +- **常用密碼快速鍵** - Password shortcuts +- Various tool-specific collections (Homebrew, Docker, VS Code, etc.) + +## Caution + +Some snippet collections contain sensitive information (e.g., `topsecret/`). Be mindful when committing and sharing this repository. + +## License + +Personal use only. diff --git a/SUMMARY.md b/SUMMARY.md new file mode 100644 index 0000000..0279344 --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,85 @@ +# Repository Summary + +Alfred Preferences Sync - A git-based synchronization setup for Alfred workflows, snippets, and preferences across multiple Mac machines. + +## Contents + +### Workflows (6 total) + +| ID | Name | Bundle ID | +|----|------|-----------| +| 35C994AB... | 無腦生密碼 | DELL | +| 60982561... | 使用Prettier自動格式化程式碼 | - | +| 88DDE590... | Office 滅證 | com.timmy.officecleaner | +| CB674C87... | 使用urldecode解碼URL編碼字串 | - | +| D7139EE1... | 盤古之白自動加空格 | - | +| F776EB14... | TextTaiwanizer | - | + +### Snippet Collections (30+ categories) + +**Chinese/Text Collections:** +- 中文輸出速查 - Chinese vocabulary and phrases +- 術語速查字典 - Technical terminology (SQL, Oracle, Marketing, etc.) +- 特殊字元輸出集 - Special characters +- 日本語 - Japanese snippets + +**Tool-Specific Collections:** +- Docker +- Homebrew 工具箱 +- Podman +- Lima +- Visual Studio Code +- gcloud +- pyenv +- pipenv +- Supervisor 管理工具 +- OpenWrt UCI 工具箱 +- Sudo 管理小幫手 +- Tone & Prompt 工具箱 + +**Other Collections:** +- 常用密碼快速鍵 +- Note +- alias +- cmd +- 寶可夢 +- 標籤 +- topsecret (credentials) + +### Preferences + +- `prefs.plist` - Main Alfred preferences (location: Taiwan) +- Features and workflow configurations + +## Files + +| File | Purpose | +|------|---------| +| `alfred-sync.sh` | Git sync script (add, commit, push) | +| `Alfred.alfredpreferences/` | Alfred preferences package | +| `CLAUDE.md` | Guidance for Claude Code AI | +| `README.md` | Repository overview | +| `QUICKSTART.md` | Quick start guide | +| `SUMMARY.md` | This file | + +## Quick Commands + +```bash +# Sync changes +./alfred-sync.sh + +# Pull latest changes +git pull + +# Check workflow names +for dir in Alfred.alfredpreferences/workflows/*/; do + plutil -p "$dir/info.plist" | grep "name" +done +``` + +## Technical Details + +- **Format**: XML plist for workflows, JSON for snippets +- **Sync Method**: Git with manual sync script +- **Alfred Version**: Compatible with Alfred 4+ +- **macOS Location**: `~/Library/Application Support/Alfred/` diff --git a/alfred-sync.sh b/alfred-sync.sh new file mode 100755 index 0000000..13e9778 --- /dev/null +++ b/alfred-sync.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd /Users/timmy/Sync/AlfredPrefs +git add -A +git commit -m "sync $(date '+%Y-%m-%d %H:%M')" +git push