experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(backup): expand tilde in backup directory paths

+152 -2
+132
.agent-task.md
··· 1 + # Agent Instructions 2 + 3 + You are a **Dev Agent** (full stack) working in an isolated workspace. Your role: 4 + - Implement features and fix bugs 5 + - Write tests and documentation 6 + - Run quality checks before marking done 7 + - Prepare deployments when needed 8 + 9 + The **Coordinator** (human) manages the project, reviews your plans, and merges completed work. 10 + 11 + ## Resources 12 + 13 + - `TODO.md` - Project tasks and priorities 14 + - `CLAUDE.md` - Project-specific instructions 15 + - `notes/development.md` - Architecture and dev guide 16 + 17 + ## Status Reporting 18 + 19 + Report status so the coordinator knows your progress: 20 + 21 + ```bash 22 + agent-status "working" "brief description" 23 + agent-status "blocked" "what you need" # Only when truly stuck 24 + agent-status "review" "ready for review" 25 + agent-status "done" "what you accomplished" 26 + ``` 27 + 28 + --- 29 + 30 + ## Policies 31 + 32 + ### Policy: Autonomy 33 + 34 + - **Work independently** - Make reasonable decisions without asking. You have full access to the codebase. 35 + - **Don't ask for basic permissions** - Common tools (ls, find, npm, yarn, jj, node, etc.) are pre-approved. 36 + - **Batch your work** - Do multiple related operations before pausing. 37 + - **Only interrupt when truly blocked** - Not for confirmations, only for missing information you can't find. 38 + 39 + ### Policy: Workspace 40 + 41 + - **Work in your current directory** - Your workspace is an isolated jj worktree with a full copy of the repo. 42 + - **CRITICAL: Use YOUR workspace path for all file operations** - When using Read/Edit tools, files must be in YOUR workspace directory (check with `pwd`), NOT the main repo. Example: if your workspace is `/path/to/repo/tmp/mobile-1234/`, edit `/path/to/repo/tmp/mobile-1234/src/file.js`, NOT `/path/to/repo/src/file.js`. 43 + - **Never use hardcoded paths to ~/misc/mpeek or similar** - Always resolve paths relative to your current working directory. 44 + 45 + ### Policy: Commands 46 + 47 + - **Use package.json scripts or shell scripts** - Always prefer `yarn test`, `yarn build`, `./scripts/foo.sh` over raw commands. These can be added to the allow list permanently. 48 + - **NEVER combine commands** - Do not use `&&`, `;`, or `|` to chain commands. Combined commands cannot be added to the allow list and require approval every time. Run commands separately instead. 49 + - **NEVER write giant compound shell sequences** - If you need a multi-step shell operation, create a script in `package.json` or `scripts/`. Do not attempt to execute long inline command chains. This applies to build processes, deployment steps, file operations, etc. Always prefer a named, reusable script over inline complexity. 50 + 51 + ### Policy: Version Control 52 + 53 + **This repo uses jj (Jujutsu), not git. Never use git commands directly.** 54 + 55 + ```bash 56 + jj st # status 57 + jj log # log recent changes 58 + jj diff # diff working copy 59 + jj commit -m "message" # commit your work 60 + jj squash -m "message" # squash into parent with message (when finishing) 61 + ``` 62 + 63 + Key differences from git: 64 + - No staging area - all changes tracked automatically 65 + - `jj commit` creates new empty change on top 66 + - **NEVER move the main bookmark** - coordinator handles that via `mmerge` 67 + - Don't push directly - coordinator handles pushing after merge 68 + 69 + ### Policy: Sync Before Starting Work 70 + 71 + After your plan is approved and before starting implementation, **always rebase on main** to get the latest changes: 72 + 73 + ```bash 74 + jj rebase -d main 75 + ``` 76 + 77 + This ensures you have the latest code and TODO.md state from other agents or the coordinator. 78 + 79 + ### Policy: Commits 80 + 81 + - Ask before committing - don't commit automatically, but do offer to commit when work is done 82 + - User (dietrich ayala) is sole author of all commits 83 + 84 + ### Policy: Quality 85 + 86 + Before marking any task as done: 87 + 88 + 1. **Tests** - Write tests for new functionality. Run all tests and ensure they pass. 89 + 2. **Documentation** - Update relevant docs (README, API docs, etc.) if behavior changes. 90 + 3. **Development notes** - Add notes to `notes/` if you discovered important context, gotchas, or architectural decisions. 91 + 4. **Verify** - Run the build/lint/tests. Do NOT mark done if tests fail. 92 + 93 + ### Policy: Cleanup 94 + 95 + When your task is complete, you MUST complete this checklist: 96 + 97 + **1. Mark task complete in TODO.md** 98 + - Find your task in the Today section, change `- [~]` (in-progress) to `- [x]` (done) 99 + - Move to Done section under current week heading (`### YYYY-WNN`) 100 + 101 + **2. Write development notes** (if applicable) 102 + - Add to existing file in `notes/` or create new one 103 + - Focus on what future developers need to know 104 + 105 + **3. Sync changes back to agent-workflow repo** (only if you have new learnings) 106 + - **Learnings**: Append new tips/gotchas to `~/sync/Dev/agent-workflow/CLAUDE.md` using Edit tool (don't overwrite - other agents may have added content) 107 + - **Permissions**: Skip - coordinator will consolidate permissions manually 108 + 109 + **4. Merge workspace back to main** 110 + ```bash 111 + jj squash -m "description of changes" # Squash your work 112 + # Coordinator will handle the actual merge with mmerge 113 + ``` 114 + 115 + **5. Check if deployment needed** 116 + - Server changes (`backend/server/`): Ask coordinator about Railway deploy 117 + - Mobile changes (`backend/tauri-mobile/`): Note TestFlight build may be needed 118 + - Desktop only: No deployment needed 119 + 120 + **6. Report completion** 121 + ```bash 122 + agent-status "done" "summary of what you accomplished" 123 + ``` 124 + 125 + **Do NOT skip these steps.** The coordinator relies on TODO.md and permissions being updated. 126 + 127 + --- 128 + 129 + ## Your Taskdaily data snapshots saved to compress archives in ~/sync/peek-backups 130 + 131 + Enter plan mode (use EnterPlanMode tool) and create a detailed implementation plan. 132 + Wait for my review before executing. Do NOT auto-execute.
+1 -1
TODO.md
··· 11 11 Be able to use the app on mobile and desktop with the safety of knowing there's also at least one remote copy. 12 12 13 13 Today 14 - - [~][desktop] daily data snapshots saved to compress archives in ~/sync/peek-backups 15 14 - [ ][desktop] e2e sync test: desktop + server in debug and then in prod, verify via railway logs for production package 16 15 - [ ][mobile] pull-to-refresh triggers sync 17 16 - [ ][mobile] fix big bottom bar showing again ··· 423 422 424 423 ### 2026-W04 425 424 425 + - [x][desktop] daily data snapshots saved to compress archives in ~/sync/peek-backups 426 426 - [x][workflow] restore git/github push for Railway deploys 427 427 - [x][desktop] fix better-sqlite3 node vs electron version mismatch 428 428 - [x][sync] investigate remaining sync edge cases
+19 -1
backend/electron/backup.ts
··· 13 13 */ 14 14 15 15 import fs from 'node:fs'; 16 + import os from 'node:os'; 16 17 import path from 'node:path'; 17 18 import archiver from 'archiver'; 18 19 import { app } from 'electron'; ··· 27 28 const DEFAULT_RETENTION_COUNT = 7; 28 29 const BACKUP_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours 29 30 31 + // ==================== Helpers ==================== 32 + 33 + /** 34 + * Expand tilde (~) in file paths to user's home directory. 35 + * Node.js fs operations don't expand ~ automatically. 36 + */ 37 + function expandTilde(filepath: string): string { 38 + if (filepath.startsWith('~/')) { 39 + return path.join(os.homedir(), filepath.slice(2)); 40 + } 41 + if (filepath === '~') { 42 + return os.homedir(); 43 + } 44 + return filepath; 45 + } 46 + 30 47 // ==================== Settings Storage ==================== 31 48 32 49 /** ··· 43 60 if (!row?.value) return ''; 44 61 45 62 const prefs = JSON.parse(row.value); 46 - return prefs?.backupDir || ''; 63 + const backupDir = prefs?.backupDir || ''; 64 + return expandTilde(backupDir); 47 65 } catch { 48 66 return ''; 49 67 }