···11+# Development Guide
22+33+## Commands
44+55+```bash
66+# Install dependencies
77+yarn install
88+99+# Run in development mode (with devtools)
1010+yarn debug
1111+1212+# Start the application normally
1313+yarn start
1414+1515+# Package the application (output: out/mac-arm64/)
1616+yarn package
1717+1818+# Package and install to /Applications (macOS)
1919+yarn package:install
2020+2121+# Build distributable packages
2222+yarn make
2323+2424+# Check for security vulnerabilities
2525+yarn npm audit
2626+2727+# Test packaged build with dev profile
2828+PROFILE=dev out/mac-arm64/Peek.app/Contents/MacOS/Peek
2929+```
3030+3131+## Architecture Overview
3232+3333+### Core Structure
3434+3535+The application uses a multi-window Electron architecture:
3636+3737+1. **Main Process** (`index.js`):
3838+ - Manages app lifecycle, windows, shortcuts, IPC communication
3939+ - Implements custom `peek://` protocol for internal navigation
4040+ - Handles profile management and data persistence
4141+ - Hosts the TinyBase datastore with IPC handlers for renderer access
4242+4343+2. **Renderer Process** (`app/`):
4444+ - Core app logic loads from `peek://app/background.html`
4545+ - Feature modules: peeks, slides, scripts, cmd, groups
4646+ - Settings UI at `peek://app/settings/settings.html`
4747+ - Datastore viewer at `peek://app/datastore/viewer.html`
4848+4949+3. **Preload Script** (`preload.js`):
5050+ - Bridges main/renderer with secure API exposure via contextBridge
5151+ - Provides shortcuts, window management, pubsub, and datastore APIs
5252+5353+### Custom Protocol
5454+5555+- Uses `peek://` scheme for internal pages
5656+- Cross-origin network access enabled for peek:// pages
5757+- Special APIs available: window control, global hotkeys, pubsub messaging
5858+5959+### Profile Management
6060+6161+Profile is determined automatically:
6262+- Packaged app (`/Applications/Peek.app`) uses `default` profile
6363+- Running from source (`yarn start`) uses `dev` profile
6464+- `PROFILE` env var overrides (e.g., `PROFILE=test yarn start`)
6565+6666+Profile data stored in `{userData}/{PROFILE}/` directory.
6767+6868+## App Icon Generation
6969+7070+The macOS app icon is generated from a source PNG using ImageMagick. The process applies rounded corners and adds padding to match macOS icon guidelines.
7171+7272+### Icon files in `assets/`
7373+7474+- `appicon-source.png` - Original source image (1232x1232, no rounding)
7575+- `appicon-rounded.png` - Processed version with rounded corners and padding (1024x1024)
7676+- `appicon.icns` - Final macOS icon file used by electron-builder
7777+7878+### Regenerating the icon
7979+8080+Requires ImageMagick (`brew install imagemagick`).
8181+8282+```bash
8383+SRC="assets/appicon-source.png"
8484+ROUNDED="assets/appicon-rounded.png"
8585+8686+SIZE=1232
8787+RADIUS=222 # ~18% of size for rounded corners
8888+8989+# Step 1: Apply rounded corners to source
9090+magick "$SRC" \
9191+ \( +clone -alpha extract \
9292+ -draw 'fill black polygon 0,0 0,'"$RADIUS $RADIUS"',0 fill white circle '"$RADIUS,$RADIUS $RADIUS"',0' \
9393+ \( +clone -flip \) -compose Multiply -composite \
9494+ \( +clone -flop \) -compose Multiply -composite \
9595+ \) -alpha off -compose CopyOpacity -composite \
9696+ /tmp/rounded-temp.png
9797+9898+# Step 2: Add padding (scale to 80% and center on 1024x1024 canvas)
9999+magick /tmp/rounded-temp.png \
100100+ -resize 824x824 \
101101+ -gravity center \
102102+ -background transparent \
103103+ -extent 1024x1024 \
104104+ "$ROUNDED"
105105+106106+# Step 3: Generate iconset and convert to icns
107107+mkdir -p assets/AppIcon.iconset
108108+for size in 16 32 64 128 256 512 1024; do
109109+ magick "$ROUNDED" -resize ${size}x${size} PNG32:"assets/AppIcon.iconset/icon_${size}x${size}.png"
110110+done
111111+112112+# Create @2x variants
113113+cp assets/AppIcon.iconset/icon_32x32.png assets/AppIcon.iconset/icon_16x16@2x.png
114114+cp assets/AppIcon.iconset/icon_64x64.png assets/AppIcon.iconset/icon_32x32@2x.png
115115+cp assets/AppIcon.iconset/icon_256x256.png assets/AppIcon.iconset/icon_128x128@2x.png
116116+cp assets/AppIcon.iconset/icon_512x512.png assets/AppIcon.iconset/icon_256x256@2x.png
117117+cp assets/AppIcon.iconset/icon_1024x1024.png assets/AppIcon.iconset/icon_512x512@2x.png
118118+rm assets/AppIcon.iconset/icon_64x64.png assets/AppIcon.iconset/icon_1024x1024.png
119119+120120+iconutil -c icns assets/AppIcon.iconset -o assets/appicon.icns
121121+rm -rf assets/AppIcon.iconset /tmp/rounded-temp.png
122122+```
123123+124124+### Icon design notes
125125+126126+- Rounded corners at ~18% radius matches common macOS app icon style
127127+- 80% content size with 10% padding on each side matches Apple HIG
128128+- Source image should be square, ideally 1024x1024 or larger
129129+130130+## Known Issues
131131+132132+- **Tray icon in packaged builds**: Tray icon displays correctly in debug mode but not in packaged app builds. Works fine in dev.
+57-18
TODO.md
···2233## v0.4 - Minimum viable web workbench
4455+- [ ] Design philosophy write-up w/ driving principles and characteristics
56- [ ] Multi-protocol architecture
67- [ ] Content publishing
78- [ ] Event model
89- [ ] Chaining
1010+- [ ] Images
1111+- [ ] Lists/feeds
1212+1313+## v? - Editor & Notes
1414+1515+Requires chaining and "activities"
1616+1717+- [ ] Notes in datastore
1818+- [ ] Editor app (in/out datastore)
1919+2020+## v? - Extensibility
2121+2222+Peek extensions
2323+- [ ] figure out background app vs other
2424+- [ ] maybe cmd stays in core?
2525+- [ ] is background runtime aware? eg mobile/extension/desktop
2626+- [ ] background app separation from "feature" apps, is runtime aware
2727+2828+Web extensions
2929+- [ ] WebExtension integration for priority only, on some platforms
3030+3131+- [ ] App cmds (eg Editor -> cmd to edit note X)
3232+9331034## v? Portability
11351212-- [ ] Abstraction of subset of core API to work in extension too
3636+- [ ] Common background runtime
3737+ - [ ] Datastore -> background
3838+ - [ ] API -> background
3939+- [ ] Define subset of core API for portability
4040+- [ ] Extension back-end
4141+- [ ] Mobile (webview) back-end
4242+- [ ] Tauri back-end
4343+4444+## v? Pages, Tagging & Groups
4545+4646+Opening pages
4747+- [x] Open page by default in cmd
4848+- [x] Open page from OS, other apps
4949+5050+Page model & metadata
5151+- [ ] Basic overlay
5252+- [ ] Page embedding
5353+5454+Tagging
5555+- [x] Cmd to tag current page
5656+5757+Groups
5858+- [x] Groups based on tags, for now
5959+- [x] Untagged -> default group
6060+- [x] Cmd to open groups home
6161+6262+- [ ] What does it mean for a group to be active/not
6363+- [ ] Open new empty page (in a group or not)
6464+6565+Cmd
6666+- [ ] adaptive matching
6767+- [ ] frecency
13681414-## v0.3 - Personal daily driver
6969+## V.0.3 - Datastore
15701671- [x] Datastore
1717-- [x] Open URLs by default
1818-- [ ] Cmd bar adaptive matching and frecency
1919-- [ ] Page model and user interface
2020-- [ ] Peek:// extensibility model
2121- - [ ] figure out background app vs other
2222- - [ ] maybe cmd stays in core?
2323- - [ ] is background runtime aware? eg mobile/extension/desktop
2424- - [ ] background app separation from "feature" apps, is runtime aware
2525-- [ ] Notes in datastore
2626-- [ ] Editor app (in/out datastore)
2727-- [ ] App cmds (eg Editor -> cmd to edit note X)
2828-- [ ] Tags + Groups
2929-- [ ] Images
3030-- [ ] Lists/feeds
3131-- [ ] WebExtension integration for priority only
3232-- [ ] Design philosophy write-up w/ driving principles and characteristics
33723473## v0.2 - MVCP (minimum viable concept preview)
3574
assets/appicon-rounded.png
This is a binary file and will not be displayed.
assets/appicon.icns
This is a binary file and will not be displayed.
+10-2
notes/extensibility.md
···1818- Hotkey registration
1919- Pubsub messaging
20202121-2221Open questions for later:
23222323+- Dirty writes - add ext or sys as source. also ensure no direct writes, only api adds
2424+- Sharded space, in/outbox style too maybe
2425- Trade off exfiltration-proof-ness for sensitive access, eg history?
2525-- How to provide authorship verification?
2626+- How to provide authorship verification? regular website + sigs
2627- How to provide tamper detection?
2728- How to do extension-specific settings? Manifest link to bundled settings UI? Or a api for placement into Settings app?
2829- How to allow for maximal unloading vs always persistent
2930- How to do remixes, eg take verified extension X, copy and hack
3131+3232+Mobile:
3333+- open web pages
3434+- if calls a registration api, user can choose to add
3535+- permissions
3636+- expose peek api upon approval
3737+- also, preverification via sync
+11
notes/groups-model.md
···11+# Peek Groups model
22+33+- Peek stores addresses
44+- Addresses have tags
55+- A basic group is the set of addresses with a given tag
66+77+Special groups
88+99+- Untagged addresses
1010+- Search groups
1111+- Feed groups
+1
notes/page-model.md
···1919- Easily access website information, such as the URL
2020- See extended information, such as the SSL cert info
2121- See extended information, provided by extensions or customizations
2222+