Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

chore: move screenpipe-js into packages

Louis Beaumont064e16cba8e2
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7960a9958..12b955af6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -67,7 +67,7 @@ jobs:
# todo: need to run backend ...
# - name: Run bun tests
# run: bun test
- # working-directory: ./screenpipe-js
+ # working-directory: ./packages/screenpipe-js
test-windows:
runs-on: windows-2019
diff --git a/.pi/agents/posthog.md b/.pi/agents/posthog.md
new file mode 100644
index 000000000..397ae1d88
--- /dev/null
+++ b/.pi/agents/posthog.md
@@ -0,0 +1,622 @@
+---
+name: posthog
+description: Query PostHog for product analytics, create insights, dashboards, and track user behavior. Auto-activates when user asks about analytics, user behavior, funnels, retention, or dashboards. Trigger words: "check posthog", "create insight", "analytics", "user behavior", "dashboard", "funnel", "retention", "user metrics", "usage stats"
+allowed-tools: Bash, Read
+---
+
+# PostHog Analytics Skill
+
+Query and manage PostHog product analytics for Screenpipe applications.
+
+---
+
+## ⚠️ IMPORTANT: Real Metrics vs Vanity Metrics
+
+**DO NOT use these as DAU/engagement metrics (vanity):**
+- `resource_usage` - passive health pings every few seconds
+- `app_still_running` - background heartbeat
+- `health_check_unhealthy` - error pings
+- `enabled_pipes_hourly` - hourly background check
+- `$autocapture`, `$pageview`, `$pageleave` - passive web events
+- `$set`, `$identify` - identity events
+
+**ALWAYS use CORE ACTIONS for real engagement:**
+- `search_performed` - user actively searched
+- `timeline_opened` - user opened timeline view
+- `shortcut_used` - user used keyboard shortcut
+- `timeline_selection_made` - user selected content in timeline
+- `timeline_date_changed` - user navigated timeline
+
+**Key Metrics to Track:**
+1. **Real DAU** = unique users doing core actions (target: 200+)
+2. **Activation Rate** = core_action_users / app_started_users (target: 40%+, currently ~23%)
+3. **Onboarding Completion** = onboarding_completed / onboarding_login_viewed (target: 50%+)
+
+---
+
+## Quick Health Check (Run This First)
+
+```bash
+# Real DAU + Activation Rate - THE MOST IMPORTANT QUERY
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT toDate(timestamp) as day, uniq(distinct_id) as real_dau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY day ORDER BY day"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print('Real DAU (core actions):'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"
+```
+
+```bash
+# Activation Rate (% of users who do a core action)
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT count(distinct a.distinct_id) as started, count(distinct c.distinct_id) as activated FROM (SELECT distinct_id FROM events WHERE event = '\''app_started'\'' AND timestamp > now() - INTERVAL 7 DAY) a LEFT JOIN (SELECT distinct_id FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY) c ON a.distinct_id = c.distinct_id"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; r=json.load(open('/tmp/ph.json'))['results'][0]; print(f'Activation: {r[1]}/{r[0]} = {r[1]/r[0]*100:.1f}%')"
+```
+
+```bash
+# Onboarding Funnel
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, uniq(distinct_id) as users FROM events WHERE event LIKE '\''%onboarding%'\'' AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print('Onboarding Funnel:'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"
+```
+
+---
+
+## Configuration
+
+**Host:** `https://eu.i.posthog.com`
+**SDK Project Key (public):** `phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce`
+
+**Personal API Key:** Stored in `.env.local` at the repo root. Always source it before running queries.
+
+### Loading the API Key
+
+**IMPORTANT:** Before running ANY PostHog query, always source the `.env.local` file first:
+
+```bash
+source /Users/louisbeaumont/Documents/screenpipe/.env.local
+```
+
+Or inline with commands:
+```bash
+export $(cat /Users/louisbeaumont/Documents/screenpipe/.env.local | xargs) && curl ...
+```
+
+### Getting a Personal API Key (if needed)
+
+1. Go to https://eu.posthog.com/settings/user-api-keys
+2. Click "Create personal API key"
+3. Name it (e.g., "claude-code")
+4. Select scopes: `insight:read`, `insight:write`, `dashboard:read`, `dashboard:write`, `query:read`
+5. Add to `.env.local`: `POSTHOG_API_KEY=phx_xxx...`
+
+---
+
+## Project IDs (Hardcoded)
+
+| Project | ID |
+|---------|-----|
+| screenpipe | 27525 |
+| mediar-app | 64593 |
+| mediar-merged | 65690 |
+
+---
+
+## Weekly Review Queries
+
+Run these every week to track progress on the metrics that matter:
+
+### 1. Real DAU Trend (Core Actions)
+```bash
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT toDate(timestamp) as day, uniq(distinct_id) as real_dau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 14 DAY GROUP BY day ORDER BY day"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print('Real DAU (14d):'); [print(f' {r[0]}: {r[1]}') for r in json.load(open('/tmp/ph.json')).get('results',[])]"
+```
+
+### 2. Activation Rate (The Key Metric)
+```bash
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT count(distinct a.distinct_id) as started, count(distinct c.distinct_id) as activated FROM (SELECT distinct_id FROM events WHERE event = '\''app_started'\'' AND timestamp > now() - INTERVAL 7 DAY) a LEFT JOIN (SELECT distinct_id FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY) c ON a.distinct_id = c.distinct_id"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; r=json.load(open('/tmp/ph.json'))['results'][0]; print(f'Activation: {r[1]}/{r[0]} = {r[1]/r[0]*100:.1f}% (target: 40%+)')"
+```
+
+### 3. Real WAU (Weekly Active on Core Actions)
+```bash
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT uniq(distinct_id) as real_wau FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'') AND timestamp > now() - INTERVAL 7 DAY"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print(f'Real WAU: {json.load(open(\"/tmp/ph.json\"))[\"results\"][0][0]}')"
+```
+
+### 4. Core Action Breakdown
+```bash
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, count() as cnt, uniq(distinct_id) as users FROM events WHERE event IN ('\''search_performed'\'', '\''timeline_opened'\'', '\''shortcut_used'\'', '\''timeline_selection_made'\'', '\''ai_chat_message'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print('Core Actions (7d):'); [print(f' {r[0]}: {r[2]} users, {r[1]} events') for r in json.load(open('/tmp/ph.json')).get('results',[])]"
+```
+
+### 5. Onboarding Drop-off
+```bash
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" -H "Content-Type: application/json" \
+ -d '{"query":{"kind":"HogQLQuery","query":"SELECT event, uniq(distinct_id) as users FROM events WHERE event IN ('\''onboarding_login_viewed'\'', '\''onboarding_usecases_viewed'\'', '\''onboarding_status_viewed'\'', '\''onboarding_completed'\'') AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC"}}' \
+ "https://eu.i.posthog.com/api/projects/27525/query/" > /tmp/ph.json && \
+ python3 -c "import json; print('Onboarding Funnel (7d):'); [print(f' {r[0]}: {r[1]} users') for r in json.load(open('/tmp/ph.json')).get('results',[])]"
+```
+
+---
+
+## Bash Queries (macOS/Linux)
+
+**Note:** All commands below assume you have sourced `.env.local` first. Project ID for screenpipe is **27525**.
+
+### List All Insights
+
+```bash
+curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ "https://eu.i.posthog.com/api/projects/27525/insights/?limit=20" > /tmp/ph.json && \
+ python3 -c "import json; [print(f'[{i[\"id\"]}] {i[\"name\"]}') for i in json.load(open('/tmp/ph.json')).get('results', [])]"
+```
+
+### List All Dashboards
+
+```bash
+PROJECT_ID="27525"
+curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/dashboards/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+for d in r.get('results', []):
+ print(f'[{d[\"id\"]}] {d[\"name\"]}')
+ print(f' Tiles: {len(d.get(\"tiles\", []))} | Created: {d[\"created_at\"]}')
+"
+```
+
+### Query Recent Events
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT event, count() as count FROM events WHERE timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY count DESC LIMIT 20"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print('Event | Count')
+print('-' * 40)
+for row in r.get('results', []):
+ print(f'{row[0]} | {row[1]}')
+"
+```
+
+### Query Events by Platform/OS
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT properties.`$os` as os, count() as count, uniq(distinct_id) as unique_users FROM events WHERE timestamp > now() - INTERVAL 30 DAY GROUP BY os ORDER BY count DESC"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/"
+```
+
+### Query User Onboarding Funnel
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT event, count() as count FROM events WHERE event LIKE '\''%onboarding%'\'' AND timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY count DESC"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/"
+```
+
+### Get Insight Results
+
+```bash
+PROJECT_ID="27525"
+INSIGHT_ID="YOUR_INSIGHT_ID"
+curl -s -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/$INSIGHT_ID/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print(f'Insight: {r[\"name\"]}')
+print(f'Last refresh: {r.get(\"last_refresh\", \"?\")}')
+print()
+import json as j
+print(j.dumps(r.get('result', []), indent=2)[:2000])
+"
+```
+
+---
+
+## PowerShell Queries (Windows)
+
+### Get Project ID
+
+```powershell
+$headers = @{ 'Authorization' = "Bearer $env:POSTHOG_API_KEY" }
+$response = Invoke-RestMethod -Uri 'https://eu.i.posthog.com/api/projects/' -Headers $headers
+$response.results | ForEach-Object { Write-Host "[$($_.id)] $($_.name)" }
+```
+
+### List All Insights
+
+```powershell
+$projectId = 'YOUR_PROJECT_ID'
+$headers = @{ 'Authorization' = "Bearer $env:POSTHOG_API_KEY" }
+$response = Invoke-RestMethod -Uri "https://eu.i.posthog.com/api/projects/$projectId/insights/?limit=20" -Headers $headers
+$response.results | ForEach-Object {
+ Write-Host "[$($_.id)] $($_.name)"
+ Write-Host " Type: $($_.filters.insight) | Created: $($_.created_at)"
+}
+```
+
+### List All Dashboards
+
+```powershell
+$projectId = 'YOUR_PROJECT_ID'
+$headers = @{ 'Authorization' = "Bearer $env:POSTHOG_API_KEY" }
+$response = Invoke-RestMethod -Uri "https://eu.i.posthog.com/api/projects/$projectId/dashboards/" -Headers $headers
+$response.results | ForEach-Object {
+ Write-Host "[$($_.id)] $($_.name)"
+ Write-Host " Tiles: $($_.tiles.Count) | Created: $($_.created_at)"
+}
+```
+
+### Query Recent Events (HogQL)
+
+```powershell
+$projectId = 'YOUR_PROJECT_ID'
+$headers = @{
+ 'Authorization' = "Bearer $env:POSTHOG_API_KEY"
+ 'Content-Type' = 'application/json'
+}
+$body = @{
+ query = @{
+ kind = 'HogQLQuery'
+ query = 'SELECT event, count() as count FROM events WHERE timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY count DESC LIMIT 20'
+ }
+} | ConvertTo-Json -Depth 5
+$response = Invoke-RestMethod -Uri "https://eu.i.posthog.com/api/projects/$projectId/query/" -Method POST -Headers $headers -Body $body
+$response.results | ForEach-Object { Write-Host "$($_[0]): $($_[1])" }
+```
+
+---
+
+## Create Insights
+
+### Create Pageviews by Page Insight
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Top Pages",
+ "filters": {
+ "insight": "TRENDS",
+ "events": [{"id": "$pageview", "type": "events"}],
+ "breakdown": "$pathname",
+ "breakdown_type": "event",
+ "date_from": "-7d"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/"
+```
+
+### Create User Funnel Insight
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Onboarding Funnel",
+ "filters": {
+ "insight": "FUNNELS",
+ "events": [
+ {"id": "app_started", "type": "events", "name": "App Started"},
+ {"id": "onboarding_started", "type": "events", "name": "Onboarding Started"},
+ {"id": "onboarding_completed", "type": "events", "name": "Onboarding Completed"}
+ ],
+ "date_from": "-30d"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/"
+```
+
+---
+
+## Dashboard Operations
+
+### Create Dashboard
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Screenpipe Overview",
+ "description": "Key metrics for Screenpipe app usage"
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/dashboards/"
+```
+
+---
+
+## Useful Filters
+
+### Event Properties
+- `$pageview` - Page view event
+- `$autocapture` - Auto-captured clicks
+- `$pathname` - Page path
+- `$current_url` - Full URL
+- `$browser` - Browser name
+- `$os` - Operating system (windows, macos, linux)
+- `$device_type` - desktop/mobile/tablet
+- `$screen_width` / `$screen_height` - Screen dimensions
+
+### Filter Operators
+- `exact` - Exact match
+- `icontains` - Case-insensitive contains
+- `regex` - Regular expression
+- `is_set` - Property exists
+- `is_not_set` - Property doesn't exist
+- `gt`, `lt`, `gte`, `lte` - Comparisons
+
+### Insight Types
+- `TRENDS` - Time series charts
+- `FUNNELS` - Conversion funnels
+- `RETENTION` - User retention
+- `PATHS` - User journey paths
+- `STICKINESS` - Feature stickiness
+- `LIFECYCLE` - User lifecycle
+
+---
+
+## Rate Limits
+
+- Analytics endpoints: 240/min, 1200/hour
+- Query endpoint: 2400/hour
+
+---
+
+## Debugging Windows Onboarding Issues
+
+When investigating user drop-off or issues in onboarding:
+
+1. Query onboarding events by OS:
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT properties.`$os` as os, event, count() as count FROM events WHERE event LIKE '\''%onboarding%'\'' AND timestamp > now() - INTERVAL 7 DAY GROUP BY os, event ORDER BY os, count DESC"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/"
+```
+
+2. Check onboarding completion rate by step:
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT event, properties.`$os` as os, count() as count, uniq(distinct_id) as unique_users FROM events WHERE event LIKE '\''%onboarding%'\'' AND timestamp > now() - INTERVAL 7 DAY GROUP BY event, os ORDER BY event, os"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/"
+```
+
+---
+
+## Audio Transcription Quality Insights
+
+These insights track audio deduplication performance across versions. Use them to verify fixes and catch regressions.
+
+### Available Metrics (in `resource_usage` event)
+
+| Property | Description | Healthy Range |
+|----------|-------------|---------------|
+| `audio_transcripts_total` | Total transcriptions received | >0 means audio active |
+| `audio_transcripts_inserted` | Successfully stored | Should match unique speech |
+| `audio_duplicates_blocked` | Exact duplicates caught | 20-50% of total for dual-device |
+| `audio_overlaps_trimmed` | Partial overlaps cleaned | Low numbers expected |
+| `audio_duplicate_rate` | `blocked / total` | 0.2-0.5 is healthy |
+| `audio_avg_word_count` | Average words per transcript | 5-20 typical |
+
+### Query: Audio Dedup Rate by Version
+
+Compare deduplication performance across releases:
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT properties.release as version, avg(properties.audio_duplicate_rate) as avg_dup_rate, sum(properties.audio_duplicates_blocked) as total_blocked, sum(properties.audio_transcripts_total) as total_transcripts, count() as sample_count FROM events WHERE event = '\''resource_usage'\'' AND properties.audio_transcripts_total > 0 AND timestamp > now() - INTERVAL 30 DAY GROUP BY version ORDER BY version DESC LIMIT 20"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print('Version | Avg Dup Rate | Total Blocked | Total Transcripts | Samples')
+print('-' * 75)
+for row in r.get('results', []):
+ rate = row[1] * 100 if row[1] else 0
+ print(f'{row[0]:<12} | {rate:>10.1f}% | {row[2]:>13} | {row[3]:>17} | {row[4]:>7}')
+"
+```
+
+### Query: Audio Quality Trend Over Time
+
+Track dedup rate over the past 7 days:
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT toDate(timestamp) as day, avg(properties.audio_duplicate_rate) as avg_dup_rate, sum(properties.audio_duplicates_blocked) as blocked, sum(properties.audio_transcripts_inserted) as inserted FROM events WHERE event = '\''resource_usage'\'' AND properties.audio_transcripts_total > 0 AND timestamp > now() - INTERVAL 7 DAY GROUP BY day ORDER BY day"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print('Date | Avg Dup Rate | Blocked | Inserted')
+print('-' * 50)
+for row in r.get('results', []):
+ rate = row[1] * 100 if row[1] else 0
+ print(f'{row[0]} | {rate:>10.1f}% | {row[2]:>7} | {row[3]:>8}')
+"
+```
+
+### Query: Users with Zero Dedup (Potential Bug)
+
+Find users where deduplication might not be working:
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT distinct_id, properties.release as version, properties.`$os` as os, sum(properties.audio_transcripts_total) as total, sum(properties.audio_duplicates_blocked) as blocked FROM events WHERE event = '\''resource_usage'\'' AND properties.audio_transcripts_total > 10 AND timestamp > now() - INTERVAL 7 DAY GROUP BY distinct_id, version, os HAVING blocked = 0 ORDER BY total DESC LIMIT 20"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/"
+```
+
+### Query: Audio Quality by OS
+
+Compare dedup performance across operating systems:
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "query": {
+ "kind": "HogQLQuery",
+ "query": "SELECT properties.`$os` as os, avg(properties.audio_duplicate_rate) as avg_dup_rate, avg(properties.audio_avg_word_count) as avg_words, count() as samples FROM events WHERE event = '\''resource_usage'\'' AND properties.audio_transcripts_total > 0 AND timestamp > now() - INTERVAL 14 DAY GROUP BY os ORDER BY samples DESC"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/query/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print('OS | Avg Dup Rate | Avg Words | Samples')
+print('-' * 50)
+for row in r.get('results', []):
+ rate = row[1] * 100 if row[1] else 0
+ words = row[2] if row[2] else 0
+ print(f'{row[0]:<12} | {rate:>10.1f}% | {words:>9.1f} | {row[3]:>7}')
+"
+```
+
+### Create Audio Quality Dashboard
+
+Create a dashboard with audio quality insights:
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Audio Transcription Quality",
+ "description": "Track audio deduplication performance and transcription quality across versions"
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/dashboards/"
+```
+
+### Create Audio Dedup Rate Trend Insight
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Audio Duplicate Rate Trend",
+ "filters": {
+ "insight": "TRENDS",
+ "events": [{"id": "resource_usage", "type": "events", "math": "avg", "math_property": "audio_duplicate_rate"}],
+ "date_from": "-14d",
+ "interval": "day"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/"
+```
+
+### Create Audio Quality by Version Insight
+
+```bash
+PROJECT_ID="27525"
+curl -s -X POST -H "Authorization: Bearer $POSTHOG_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Audio Dedup Rate by Version",
+ "filters": {
+ "insight": "TRENDS",
+ "events": [{"id": "resource_usage", "type": "events", "math": "avg", "math_property": "audio_duplicate_rate"}],
+ "breakdown": "release",
+ "breakdown_type": "event",
+ "date_from": "-30d",
+ "interval": "week"
+ }
+ }' \
+ "https://eu.i.posthog.com/api/projects/$PROJECT_ID/insights/"
+```
+
+### Alert Thresholds
+
+Monitor these conditions:
+
+| Condition | Query | Action |
+|-----------|-------|--------|
+| Zero dedup rate | `audio_duplicate_rate = 0` with `total > 10` | Bug - dedup not working |
+| Very high dedup | `audio_duplicate_rate > 0.7` | Too aggressive - blocking real content |
+| Low word count | `audio_avg_word_count < 3` | Transcription quality issue |
+| Sudden drop | Rate drops >20% vs previous version | Regression |
+
+---
+
+## Important Notes
+
+1. **API Key required:** Personal API key needed (not the public project key)
+2. **EU Region:** Screenpipe uses `eu.i.posthog.com` (not `app.posthog.com`)
+3. **Project ID:** Get from `/api/projects/` endpoint first
+4. **HogQL:** Use for complex queries not supported by filters
+5. **Rate limits:** 240 requests/min for analytics endpoints
+6. **Privacy:** Never log or expose user IDs, emails, or PII in queries
+7. **Audio metrics:** Only aggregate counts sent - no transcript content, fully privacy-safe
diff --git a/.pi/agents/screenpipe-health.md b/.pi/agents/screenpipe-health.md
new file mode 100644
index 000000000..3860224f5
--- /dev/null
+++ b/.pi/agents/screenpipe-health.md
@@ -0,0 +1,152 @@
+---
+name: screenpipe-health
+description: Check Screenpipe health status, process state, and diagnose common issues
+tools:
+ - Bash
+ - WebFetch
+---
+
+# Screenpipe Health Agent
+
+You are a specialized agent for checking Screenpipe's health status and diagnosing issues.
+
+## Quick Health Check
+
+### 1. Check if Screenpipe is Running
+```bash
+# Check for screenpipe processes
+pgrep -fl screenpipe
+
+# Check if API is responding
+curl -s http://localhost:3030/health | head -100
+```
+
+### 2. Check Recording Status
+```bash
+# Get health with recording info
+curl -s http://localhost:3030/health | jq '.frame_status, .audio_status' 2>/dev/null || curl -s http://localhost:3030/health
+```
+
+### 3. Check Disk Usage
+```bash
+# Screenpipe data directory size
+du -sh ~/.screenpipe/
+
+# Database size
+ls -lh ~/.screenpipe/db.sqlite* 2>/dev/null
+
+# Video/audio cache
+du -sh ~/.screenpipe/data/ 2>/dev/null
+```
+
+### 4. Check Recent Logs for Errors
+```bash
+# Last 10 errors from today
+grep -i "error" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log 2>/dev/null | tail -10
+```
+
+## Detailed Diagnostics
+
+### Process Information
+```bash
+# Detailed process info
+ps aux | grep -i screenpipe | grep -v grep
+
+# Memory usage
+ps aux | grep -i screenpipe | grep -v grep | awk '{sum+=$6} END {print "Total Memory: " sum/1024 " MB"}'
+
+# Check if app or CLI
+pgrep -fl "screenpipe-app" && echo "Desktop app running"
+pgrep -fl "screenpipe$" && echo "CLI running"
+```
+
+### API Endpoints Check
+```bash
+# Health endpoint
+curl -s http://localhost:3030/health
+
+# Search endpoint (test query)
+curl -s "http://localhost:3030/search?limit=1" | head -50
+
+# List audio devices
+curl -s http://localhost:3030/audio/list
+
+# List monitors
+curl -s http://localhost:3030/vision/list
+```
+
+### Database Health
+```bash
+# Check database integrity
+sqlite3 ~/.screenpipe/db.sqlite "PRAGMA integrity_check;" 2>/dev/null
+
+# Database size and tables
+sqlite3 ~/.screenpipe/db.sqlite "SELECT name, (SELECT COUNT(*) FROM main WHERE name=t.name) FROM sqlite_master t WHERE type='table';" 2>/dev/null
+
+# Recent frame count
+sqlite3 ~/.screenpipe/db.sqlite "SELECT COUNT(*) as frames_today FROM frames WHERE timestamp > datetime('now', '-1 day');" 2>/dev/null
+```
+
+### Permissions Check (macOS)
+```bash
+# Check screen recording permission
+sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "SELECT client,allowed FROM access WHERE service='kTCCServiceScreenCapture';" 2>/dev/null | grep -i screenpipe
+
+# Check microphone permission
+sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "SELECT client,allowed FROM access WHERE service='kTCCServiceMicrophone';" 2>/dev/null | grep -i screenpipe
+
+# Or use tccutil (if available)
+echo "Check System Preferences > Privacy & Security > Screen Recording and Microphone for screenpipe permissions"
+```
+
+## Common Issues & Fixes
+
+### Issue: Screenpipe not running
+```bash
+# Start CLI
+screenpipe
+
+# Or start app
+open /Applications/screenpipe.app
+```
+
+### Issue: No frames being captured
+1. Check screen recording permission in System Preferences
+2. Check logs for permission errors:
+```bash
+grep -i "permission\|denied\|cg\|capture" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -20
+```
+
+### Issue: No audio transcription
+1. Check microphone permission
+2. Check audio device selection:
+```bash
+curl -s http://localhost:3030/audio/list
+grep -i "audio\|device\|whisper" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -20
+```
+
+### Issue: High CPU/Memory
+```bash
+# Check current usage
+top -l 1 -s 0 | grep -i screenpipe
+
+# Check for memory leaks in logs
+grep -i "memory\|oom" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log
+```
+
+### Issue: Database locked
+```bash
+# Check for lock
+fuser ~/.screenpipe/db.sqlite 2>/dev/null
+
+# Check for multiple processes
+pgrep -c screenpipe
+```
+
+## Response Format
+
+When reporting health status:
+1. Start with overall status (healthy/unhealthy)
+2. List any issues found
+3. Provide specific error messages if relevant
+4. Suggest fixes for identified issues
diff --git a/.pi/agents/screenpipe-logs.md b/.pi/agents/screenpipe-logs.md
new file mode 100644
index 000000000..cc15ff714
--- /dev/null
+++ b/.pi/agents/screenpipe-logs.md
@@ -0,0 +1,134 @@
+---
+name: screenpipe-logs
+description: Retrieve and analyze Screenpipe CLI backend logs and desktop app logs for debugging
+tools:
+ - Bash
+ - Read
+ - Grep
+---
+
+# Screenpipe Logs Agent
+
+You are a specialized agent for retrieving and analyzing Screenpipe logs. Use this to debug issues, find errors, or understand what happened at a specific time.
+
+## Log Locations
+
+All logs are stored in `~/.screenpipe/`:
+
+| Log Type | Pattern | Description |
+|----------|---------|-------------|
+| CLI/Backend | `~/.screenpipe/screenpipe.YYYY-MM-DD.log` | Core recording engine logs (OCR, audio, frames) |
+| Desktop App | `~/.screenpipe/screenpipe-app.YYYY-MM-DD.log` | Tauri app logs (UI, settings, pipes) |
+
+## Common Commands
+
+### List Available Logs
+```bash
+ls -lht ~/.screenpipe/*.log | head -20
+```
+
+### Get Today's Logs
+```bash
+# Today's date
+TODAY=$(date +%Y-%m-%d)
+
+# CLI logs (last 100 lines)
+tail -100 ~/.screenpipe/screenpipe.$TODAY.log
+
+# App logs (last 100 lines)
+tail -100 ~/.screenpipe/screenpipe-app.$TODAY.log
+```
+
+### Find Errors
+```bash
+# Errors in CLI logs
+grep -i "error\|failed\|panic" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -50
+
+# Errors in app logs
+grep -i "error\|failed\|panic" ~/.screenpipe/screenpipe-app.$(date +%Y-%m-%d).log | tail -50
+```
+
+### Search for Specific Issues
+```bash
+# Search for text in recent logs
+grep -i "SEARCH_TERM" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log
+
+# Search with context (5 lines before/after)
+grep -i -B5 -A5 "SEARCH_TERM" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log
+```
+
+### Filter by Time
+```bash
+# Get logs from specific hour (e.g., 14:00-14:59)
+grep "^2026-01-22T14:" ~/.screenpipe/screenpipe.2026-01-22.log
+
+# Get logs from last N minutes
+SINCE=$(date -v-30M +%Y-%m-%dT%H:%M)
+awk -v since="$SINCE" '$0 >= since' ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -100
+```
+
+### Log Analysis
+```bash
+# Count errors by type
+grep -io "error[^:]*:" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | sort | uniq -c | sort -rn
+
+# Check recording status
+grep -i "recording\|started\|stopped" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -20
+
+# Check OCR processing
+grep -i "ocr\|frame" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -20
+
+# Check audio processing
+grep -i "audio\|transcription\|whisper" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | tail -20
+```
+
+## Log Format
+
+Logs use tracing format:
+```
+2026-01-22T10:30:45.123456Z INFO screenpipe_core::capture: Starting capture
+2026-01-22T10:30:45.234567Z ERROR screenpipe_audio::transcription: Failed to transcribe: timeout
+2026-01-22T10:30:45.345678Z DEBUG screenpipe_vision::ocr: Processing frame 12345
+```
+
+Fields:
+- Timestamp (ISO 8601 with microseconds)
+- Level: TRACE, DEBUG, INFO, WARN, ERROR
+- Target: module path
+- Message
+
+## Common Issues to Look For
+
+### Recording Issues
+```bash
+grep -i "capture\|monitor\|screen\|permission" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | grep -i "error\|fail\|denied"
+```
+
+### Audio Issues
+```bash
+grep -i "audio\|microphone\|device\|whisper" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | grep -i "error\|fail"
+```
+
+### Database Issues
+```bash
+grep -i "sqlite\|database\|db\|insert\|query" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log | grep -i "error\|fail\|lock"
+```
+
+### Memory/Performance
+```bash
+grep -i "memory\|oom\|killed\|slow" ~/.screenpipe/screenpipe.$(date +%Y-%m-%d).log
+```
+
+### Pipe Issues
+```bash
+grep -i "pipe\|plugin" ~/.screenpipe/screenpipe-app.$(date +%Y-%m-%d).log | grep -i "error\|fail"
+```
+
+## Response Guidelines
+
+When analyzing logs:
+1. Start with the most recent errors/warnings
+2. Provide timestamp and context for issues found
+3. Suggest potential causes and fixes
+4. If logs are large, summarize patterns rather than dumping everything
+5. Note if screenpipe service appears to be running or stopped
diff --git a/.pi/agents/screenpipe-query.md b/.pi/agents/screenpipe-query.md
new file mode 100644
index 000000000..9766f0177
--- /dev/null
+++ b/.pi/agents/screenpipe-query.md
@@ -0,0 +1,215 @@
+---
+name: screenpipe-query
+description: Query your Screenpipe data (screen OCR, audio transcriptions, UI/accessibility events) via REST API or direct SQL
+tools:
+ - Bash
+ - WebFetch
+---
+
+# Screenpipe Query Agent
+
+You are a specialized agent for querying Screenpipe data. Screenpipe captures three modalities:
+1. **Vision (OCR)** - Screen text from screenshots
+2. **Audio** - Transcribed speech from microphone/system audio
+3. **UI Events (Accessibility)** - Keyboard input, mouse clicks, app switches, clipboard (macOS)
+
+## Data Access Methods
+
+### Method 1: REST API (Preferred)
+The Screenpipe server runs at `http://localhost:3030`. Use curl to query:
+
+```bash
+# Search all content (OCR + audio)
+curl "http://localhost:3030/search?q=QUERY&limit=20"
+
+# Filter by content type: ocr, audio, ui, all
+curl "http://localhost:3030/search?q=QUERY&content_type=ocr"
+
+# Filter by time range (ISO 8601 UTC)
+curl "http://localhost:3030/search?q=QUERY&start_time=2024-01-01T00:00:00Z&end_time=2024-01-02T00:00:00Z"
+
+# Filter by app/window
+curl "http://localhost:3030/search?q=QUERY&app_name=Chrome&window_name=GitHub"
+
+# Pagination
+curl "http://localhost:3030/search?q=QUERY&limit=50&offset=0"
+
+# Health check
+curl "http://localhost:3030/health"
+
+# === UI Events API (Accessibility data - macOS) ===
+
+# Search UI events (keyboard input, clicks, app switches, clipboard)
+curl "http://localhost:3030/ui-events?limit=50"
+
+# Filter by event type: click, text, scroll, key, app_switch, window_focus, clipboard
+curl "http://localhost:3030/ui-events?event_type=text&limit=50"
+
+# Filter UI events by app
+curl "http://localhost:3030/ui-events?app_name=Slack&limit=50"
+
+# Filter UI events by time range
+curl "http://localhost:3030/ui-events?start_time=2024-01-01T10:00:00Z&end_time=2024-01-01T12:00:00Z"
+
+# Get UI event statistics (app usage, event counts)
+curl "http://localhost:3030/ui-events/stats"
+curl "http://localhost:3030/ui-events/stats?start_time=2024-01-01T00:00:00Z"
+```
+
+### Method 2: Direct SQL (if CLI available)
+If the `screenpipe` CLI is available, you can query the SQLite database directly:
+
+```bash
+# Check if CLI is available
+which screenpipe || where screenpipe
+
+# Query via CLI (if supported)
+screenpipe query "SELECT * FROM ocr_text LIMIT 10"
+
+# Or query the database directly with sqlite3
+sqlite3 ~/.screenpipe/db.sqlite "SELECT * FROM ocr_text ORDER BY frame_id DESC LIMIT 10"
+```
+
+## Database Schema Reference
+
+### OCR Text (Screen Content)
+```sql
+-- ocr_text: captured screen text
+SELECT ot.text, ot.app_name, ot.window_name, f.timestamp
+FROM ocr_text ot
+JOIN frames f ON ot.frame_id = f.id
+WHERE ot.text LIKE '%search_term%'
+ORDER BY f.timestamp DESC
+LIMIT 20;
+```
+
+### Audio Transcriptions
+```sql
+-- audio_transcriptions: speech-to-text
+SELECT transcription, device, timestamp, is_input_device
+FROM audio_transcriptions
+WHERE transcription LIKE '%search_term%'
+ORDER BY timestamp DESC
+LIMIT 20;
+```
+
+### UI Monitoring (Legacy)
+```sql
+-- ui_monitoring: captured UI elements (legacy table)
+SELECT text_output, app, window, timestamp
+FROM ui_monitoring
+WHERE text_output LIKE '%search_term%'
+ORDER BY timestamp DESC
+LIMIT 20;
+```
+
+### UI Events (Accessibility - macOS)
+```sql
+-- ui_events: keyboard input, mouse clicks, app switches, clipboard
+-- Event types: click, text, scroll, key, app_switch, window_focus, clipboard
+
+-- Recent keyboard input (what was typed)
+SELECT text_content, app_name, window_title, timestamp
+FROM ui_events
+WHERE event_type = 'text'
+ORDER BY timestamp DESC
+LIMIT 20;
+
+-- Recent mouse clicks with element context
+SELECT app_name, window_title, x, y, element_label, timestamp
+FROM ui_events
+WHERE event_type = 'click'
+ORDER BY timestamp DESC
+LIMIT 20;
+
+-- App switches (which apps were used)
+SELECT app_name, window_title, timestamp
+FROM ui_events
+WHERE event_type = 'app_switch'
+ORDER BY timestamp DESC
+LIMIT 50;
+
+-- Clipboard history
+SELECT text_content, app_name, timestamp
+FROM ui_events
+WHERE event_type = 'clipboard'
+ORDER BY timestamp DESC
+LIMIT 20;
+```
+
+### Useful Queries
+
+```sql
+-- What apps have I used today? (from frames)
+SELECT DISTINCT app_name, COUNT(*) as frames
+FROM frames
+WHERE timestamp > datetime('now', '-1 day')
+GROUP BY app_name
+ORDER BY frames DESC;
+
+-- What apps have I used today? (from UI events - more accurate for activity)
+SELECT app_name, event_type, COUNT(*) as count
+FROM ui_events
+WHERE timestamp > datetime('now', '-1 day')
+GROUP BY app_name, event_type
+ORDER BY count DESC;
+
+-- Recent screen content from specific app
+SELECT ot.text, f.timestamp, f.window_name
+FROM ocr_text ot
+JOIN frames f ON ot.frame_id = f.id
+WHERE f.app_name = 'Code'
+ AND f.timestamp > datetime('now', '-1 hour')
+ORDER BY f.timestamp DESC
+LIMIT 10;
+
+-- Recent audio from meetings
+SELECT transcription, timestamp, device
+FROM audio_transcriptions
+WHERE timestamp > datetime('now', '-2 hours')
+ AND LENGTH(transcription) > 50
+ORDER BY timestamp DESC;
+
+-- What did I type in the last hour?
+SELECT text_content, app_name, window_title, timestamp
+FROM ui_events
+WHERE event_type = 'text'
+ AND timestamp > datetime('now', '-1 hour')
+ORDER BY timestamp DESC;
+
+-- Most clicked elements today
+SELECT app_name, element_label, COUNT(*) as clicks
+FROM ui_events
+WHERE event_type = 'click'
+ AND timestamp > datetime('now', '-1 day')
+ AND element_label IS NOT NULL
+GROUP BY app_name, element_label
+ORDER BY clicks DESC
+LIMIT 20;
+```
+
+## Response Format
+
+When returning results to the user:
+1. Summarize what was found (count, time range)
+2. Present the most relevant results clearly
+3. Include timestamps and app context
+4. For long results, group by app or time period
+
+## Common Tasks
+
+- **"What was I working on?"** → Search recent OCR, group by app
+- **"Find mentions of X"** → Full-text search across all content types
+- **"Meeting notes about Y"** → Search audio transcriptions
+- **"Code I was looking at"** → Search OCR filtered by IDE apps (Code, Cursor, etc.)
+- **"Time spent in app X"** → Query UI events stats or frames table by app_name
+- **"What did I type?"** → Query UI events with event_type=text
+- **"What did I click on?"** → Query UI events with event_type=click
+- **"What apps did I use?"** → Query UI events stats endpoint or app_switch events
+- **"What did I copy/paste?"** → Query UI events with event_type=clipboard
+
+## Error Handling
+
+- If API returns connection error: "Screenpipe server may not be running. Start it with `screenpipe` or check the Screenpipe app."
+- If no results: Suggest broadening the search (time range, remove filters)
+- If CLI not found: Fall back to REST API
diff --git a/.pi/agents/sentry.md b/.pi/agents/sentry.md
new file mode 100644
index 000000000..d57bb15fa
--- /dev/null
+++ b/.pi/agents/sentry.md
@@ -0,0 +1,301 @@
+---
+name: sentry
+description: Query Sentry for application errors, issues, and events. Use when user asks about errors, exceptions, crashes, or debugging production issues.
+tools: Bash, Read
+---
+
+# Sentry Error Tracking Skill
+
+Query Sentry issues for Screenpipe applications.
+
+## Configuration
+
+**Org:** `mediar`
+**Projects:**
+- `screenpipe-desktop-app` - Desktop app (Tauri/Rust) - primary project for app crashes
+- `screenpipe-cli` - CLI/server (Rust) - for CLI crashes
+- `screenpipe-ai-proxy` - AI proxy service
+- Other projects may exist - list them with the projects query
+
+**Credentials:** Read `SENTRY_AUTH_TOKEN` from `.env.local`
+
+### Loading the Token
+
+**IMPORTANT:** Before running any Sentry query, first load the token from `.env.local`:
+
+```bash
+export SENTRY_AUTH_TOKEN=$(grep SENTRY_AUTH_TOKEN /Users/louisbeaumont/Documents/screenpipe/.env.local | cut -d'=' -f2)
+```
+
+### Getting a Sentry Auth Token
+
+1. Go to https://sentry.io/settings/account/api/auth-tokens/
+2. Click "Create New Token"
+3. Select scopes: `project:read`, `org:read`, `issue:read`, `issue:write` (optional for resolving)
+4. Set env var: `export SENTRY_AUTH_TOKEN=sntrys_xxx...`
+
+---
+
+## Bash Queries (macOS/Linux)
+
+### Auto-Detect Organization Slug
+
+Run this first to find your organization slug:
+
+```bash
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/" | \
+ python3 -c "import sys,json; orgs=json.load(sys.stdin); [print(f'[{o[\"slug\"]}] {o[\"name\"]}') for o in orgs]"
+```
+
+### List Projects
+
+```bash
+ORG_SLUG="mediar" # Replace with actual org slug from above
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/$ORG_SLUG/projects/" | \
+ python3 -c "import sys,json; projects=json.load(sys.stdin); [print(f'[{p[\"slug\"]}] {p[\"name\"]} - {p.get(\"platform\", \"unknown\")}') for p in projects]"
+```
+
+### Recent Unresolved Issues (All Projects)
+
+```bash
+ORG_SLUG="mediar"
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/$ORG_SLUG/issues/?query=is:unresolved&sort=date&limit=15" | \
+ python3 -c "
+import sys,json
+issues=json.load(sys.stdin)
+for i in issues:
+ print(f'[{i[\"shortId\"]}] {i[\"title\"]}')
+ print(f' Events: {i[\"count\"]} | Last seen: {i[\"lastSeen\"]} | Project: {i.get(\"project\", {}).get(\"slug\", \"?\")}')
+ print()
+"
+```
+
+### Issues for Specific Project (e.g., screenpipe-app)
+
+```bash
+ORG_SLUG="mediar"
+PROJECT_SLUG="screenpipe-app"
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/projects/$ORG_SLUG/$PROJECT_SLUG/issues/?query=is:unresolved&limit=15" | \
+ python3 -c "
+import sys,json
+issues=json.load(sys.stdin)
+for i in issues:
+ print(f'[{i[\"shortId\"]}] {i[\"title\"]}')
+ print(f' Events: {i[\"count\"]} | Last: {i[\"lastSeen\"]}')
+"
+```
+
+### Issues in Last 24 Hours
+
+```bash
+ORG_SLUG="mediar"
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/$ORG_SLUG/issues/?query=is:unresolved+lastSeen:-24h&sort=freq&limit=20" | \
+ python3 -c "
+import sys,json
+issues=json.load(sys.stdin)
+for i in issues:
+ print(f'[{i[\"shortId\"]}] {i[\"title\"]}')
+ print(f' Events: {i[\"count\"]} | Users: {i.get(\"userCount\", 0)} | Project: {i.get(\"project\", {}).get(\"slug\", \"?\")}')
+"
+```
+
+### Get Issue Details
+
+```bash
+ISSUE_ID="SCREENPIPE-APP-123" # Replace with actual issue ID
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/issues/$ISSUE_ID/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print(f'Issue: {r[\"shortId\"]}')
+print(f'Title: {r[\"title\"]}')
+print(f'Culprit: {r.get(\"culprit\", \"unknown\")}')
+print(f'Status: {r[\"status\"]}')
+print(f'Events: {r[\"count\"]}')
+print(f'Users: {r.get(\"userCount\", 0)}')
+print(f'First: {r[\"firstSeen\"]}')
+print(f'Last: {r[\"lastSeen\"]}')
+"
+```
+
+### Get Latest Event (Stack Trace)
+
+```bash
+ISSUE_ID="SCREENPIPE-APP-123" # Replace with actual issue ID
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/issues/$ISSUE_ID/events/latest/" | \
+ python3 -c "
+import sys,json
+r=json.load(sys.stdin)
+print(f'Event: {r.get(\"eventID\", \"?\")}')
+print(f'Message: {r.get(\"message\", r.get(\"title\", \"?\"))}')
+print(f'Timestamp: {r.get(\"dateCreated\", \"?\")}')
+print()
+print('Tags:')
+for t in r.get('tags', []):
+ print(f' {t[\"key\"]}: {t[\"value\"]}')
+print()
+print('Exception/Stack trace:')
+for entry in r.get('entries', []):
+ if entry.get('type') == 'exception':
+ for exc in entry.get('data', {}).get('values', []):
+ print(f' {exc.get(\"type\", \"?\")}: {exc.get(\"value\", \"?\")}')
+ for frame in exc.get('stacktrace', {}).get('frames', [])[-5:]:
+ print(f' at {frame.get(\"filename\", \"?\")}:{frame.get(\"lineNo\", \"?\")} in {frame.get(\"function\", \"?\")}')
+"
+```
+
+---
+
+## PowerShell Queries (Windows)
+
+### Auto-Detect Organization Slug
+
+```powershell
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri 'https://sentry.io/api/0/organizations/' -Headers $headers
+$response | ForEach-Object { Write-Host "[$($_.slug)] $($_.name)" }
+```
+
+### List Projects
+
+```powershell
+$orgSlug = 'mediar' # Replace with actual org slug
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri "https://sentry.io/api/0/organizations/$orgSlug/projects/" -Headers $headers
+$response | ForEach-Object { Write-Host "[$($_.slug)] $($_.name) - $($_.platform)" }
+```
+
+### Recent Unresolved Issues (All Projects)
+
+```powershell
+$orgSlug = 'mediar'
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri "https://sentry.io/api/0/organizations/$orgSlug/issues/?query=is:unresolved&sort=date&limit=15" -Headers $headers
+$response | ForEach-Object {
+ Write-Host "[$($_.shortId)] $($_.title)"
+ Write-Host " Events: $($_.count) | Last seen: $($_.lastSeen)"
+ Write-Host ''
+}
+```
+
+### Issues for Specific Project
+
+```powershell
+$orgSlug = 'mediar'
+$projectSlug = 'screenpipe-app'
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri "https://sentry.io/api/0/projects/$orgSlug/$projectSlug/issues/?query=is:unresolved&limit=15" -Headers $headers
+$response | ForEach-Object {
+ Write-Host "[$($_.shortId)] $($_.title)"
+ Write-Host " Events: $($_.count) | Last: $($_.lastSeen)"
+}
+```
+
+### Get Issue Details
+
+```powershell
+$issueId = 'SCREENPIPE-APP-123' # Replace with actual issue ID
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri "https://sentry.io/api/0/issues/$issueId/" -Headers $headers
+Write-Host "Issue: $($response.shortId)"
+Write-Host "Title: $($response.title)"
+Write-Host "Culprit: $($response.culprit)"
+Write-Host "Status: $($response.status)"
+Write-Host "Events: $($response.count)"
+Write-Host "Users: $($response.userCount)"
+Write-Host "First: $($response.firstSeen)"
+Write-Host "Last: $($response.lastSeen)"
+```
+
+### Get Latest Event (Stack Trace)
+
+```powershell
+$issueId = 'SCREENPIPE-APP-123' # Replace with actual issue ID
+$headers = @{ 'Authorization' = "Bearer $env:SENTRY_AUTH_TOKEN" }
+$response = Invoke-RestMethod -Uri "https://sentry.io/api/0/issues/$issueId/events/latest/" -Headers $headers
+Write-Host "Event: $($response.eventID)"
+Write-Host "Message: $($response.message)"
+Write-Host "Timestamp: $($response.dateCreated)"
+Write-Host ''
+Write-Host 'Tags:'
+$response.tags | ForEach-Object { Write-Host " $($_.key): $($_.value)" }
+Write-Host ''
+Write-Host 'Full response (for stack trace):'
+$response | ConvertTo-Json -Depth 10
+```
+
+---
+
+## Write Operations (Ask First)
+
+### Resolve an Issue
+
+```bash
+ISSUE_ID="SCREENPIPE-APP-123"
+curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d '{"status": "resolved"}' \
+ "https://sentry.io/api/0/issues/$ISSUE_ID/"
+```
+
+### Ignore an Issue
+
+```bash
+ISSUE_ID="SCREENPIPE-APP-123"
+curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d '{"status": "ignored"}' \
+ "https://sentry.io/api/0/issues/$ISSUE_ID/"
+```
+
+---
+
+## Query Syntax
+
+### Filters
+- `is:unresolved` / `is:resolved` / `is:ignored`
+- `environment:production` / `environment:staging`
+- `lastSeen:-24h` / `lastSeen:-7d`
+- `level:error` / `level:warning`
+- `os:windows` / `os:macos` / `os:linux`
+
+### Sort
+- `sort=date` - Most recent
+- `sort=freq` - Most frequent
+- `sort=user` - Most users affected
+
+### Examples
+```
+is:unresolved environment:production lastSeen:-24h
+is:unresolved level:error sort:user
+is:unresolved os:windows
+```
+
+---
+
+## Debugging Windows Onboarding Crash
+
+When investigating Windows-specific crashes (like onboarding issues):
+
+1. First, list all issues filtered by Windows:
+```bash
+ORG_SLUG="mediar"
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/$ORG_SLUG/issues/?query=is:unresolved+os:windows&sort=date&limit=20"
+```
+
+2. Search for onboarding-related issues:
+```bash
+ORG_SLUG="mediar"
+curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
+ "https://sentry.io/api/0/organizations/$ORG_SLUG/issues/?query=is:unresolved+onboarding&sort=date&limit=20"
+```
+
+3. Get the stack trace of the most recent crash to identify the root cause.
diff --git a/.pi/agents/supabase.md b/.pi/agents/supabase.md
new file mode 100644
index 000000000..0b9c5f7bf
--- /dev/null
+++ b/.pi/agents/supabase.md
@@ -0,0 +1,231 @@
+---
+name: supabase
+description: Query Supabase for user data, subscriptions, credits, and support issues. Use when user asks about customers, credits, subscriptions, or needs to look up user information.
+tools: Bash, Read
+---
+
+# Supabase Database Skill
+
+Query and manage Supabase data for Screenpipe applications.
+
+## Configuration
+
+**URL:** Read `NEXT_PUBLIC_SUPABASE_URL` from `.env.local`
+**Service Key:** Read `SUPABASE_SERVICE_KEY` from `.env.local`
+
+### Loading Credentials
+
+**IMPORTANT:** Before running any Supabase query, load credentials:
+
+```bash
+export SUPABASE_URL=$(grep NEXT_PUBLIC_SUPABASE_URL .env.local | cut -d'"' -f2)
+export SUPABASE_KEY=$(grep SUPABASE_SERVICE_KEY .env.local | cut -d'"' -f2)
+```
+
+Or for screenpipe repo specifically:
+```bash
+export SUPABASE_URL=$(grep NEXT_PUBLIC_SUPABASE_URL /Users/louisbeaumont/Documents/screenpipe/.env.local | cut -d'"' -f2)
+export SUPABASE_KEY=$(grep SUPABASE_SERVICE_KEY /Users/louisbeaumont/Documents/screenpipe/.env.local | cut -d'"' -f2)
+```
+
+---
+
+## Database Schema Overview
+
+### Key Tables
+
+| Table | Purpose |
+|-------|---------|
+| `users` | User accounts (email, clerk_id, credits) |
+| `credits` | User credit balances |
+| `pending_credits` | Unclaimed purchases |
+| `cloud_subscriptions` | Active subscriptions |
+| `payments` | Payment history |
+
+### Key Functions (RPC)
+
+| Function | Purpose |
+|----------|---------|
+| `get_user_credit(user_email)` | Get user credit info |
+| `increase_user_credit(target_email, amount_to_add)` | Add credits |
+| `has_active_subscription_by_email(target_email)` | Check subscription |
+| `give_subscription_to_user_by_email(target_email, subscription_price_id)` | Grant subscription |
+| `get_subscription_details_by_email(target_email)` | Get subscription details |
+
+---
+
+## Common Queries
+
+### Look Up User by Email
+
+```bash
+curl -s "$SUPABASE_URL/rest/v1/users?email=eq.USER_EMAIL" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+### Get User Credit Balance
+
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/get_user_credit" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"user_email": "USER_EMAIL"}' | python3 -m json.tool
+```
+
+### Check Credits Table Directly
+
+```bash
+# First get user ID, then query credits
+USER_ID="USER_UUID_HERE"
+curl -s "$SUPABASE_URL/rest/v1/credits?user_id=eq.$USER_ID" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+### Add Credits to User
+
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/increase_user_credit" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"target_email": "USER_EMAIL", "amount_to_add": 100}'
+```
+
+### Check Subscription Status
+
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/get_subscription_details_by_email" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"target_email": "USER_EMAIL"}' | python3 -m json.tool
+```
+
+### Check Pending Credits (Unclaimed Purchases)
+
+```bash
+curl -s "$SUPABASE_URL/rest/v1/pending_credits?email=eq.USER_EMAIL" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+---
+
+## Support Workflows
+
+### User Says "I Purchased But Have No Credits"
+
+1. Look up user:
+```bash
+curl -s "$SUPABASE_URL/rest/v1/users?email=eq.USER_EMAIL" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY"
+```
+
+2. Check credits table:
+```bash
+curl -s "$SUPABASE_URL/rest/v1/credits?user_id=eq.USER_ID" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY"
+```
+
+3. Check pending credits:
+```bash
+curl -s "$SUPABASE_URL/rest/v1/pending_credits?email=eq.USER_EMAIL&claimed=eq.false" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY"
+```
+
+4. If purchase verified (via Stripe), add credits:
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/increase_user_credit" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"target_email": "USER_EMAIL", "amount_to_add": AMOUNT}'
+```
+
+### Grant Free Subscription
+
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/give_subscription_to_user_by_email" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"target_email": "USER_EMAIL", "subscription_price_id": "PRICE_ID"}'
+```
+
+---
+
+## Admin Queries
+
+### List Recent Users
+
+```bash
+curl -s "$SUPABASE_URL/rest/v1/users?order=created_at.desc&limit=20" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | \
+ python3 -c "import sys,json; [print(f'{u[\"email\"]} - {u[\"created_at\"]}') for u in json.load(sys.stdin)]"
+```
+
+### List Users with Credits
+
+```bash
+curl -s "$SUPABASE_URL/rest/v1/credits?amount=gt.0&order=amount.desc&limit=20" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+### List Active Subscriptions
+
+```bash
+curl -s "$SUPABASE_URL/rest/v1/cloud_subscriptions?status=eq.active" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+### Get Sales Stats
+
+```bash
+curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/get_sales_stats" \
+ -H "apikey: $SUPABASE_KEY" \
+ -H "Authorization: Bearer $SUPABASE_KEY" | python3 -m json.tool
+```
+
+---
+
+## Query Syntax
+
+### Filters
+- `eq.VALUE` - Equals
+- `neq.VALUE` - Not equals
+- `gt.VALUE` - Greater than
+- `lt.VALUE` - Less than
+- `gte.VALUE` - Greater than or equal
+- `lte.VALUE` - Less than or equal
+- `like.*pattern*` - Pattern match
+- `ilike.*pattern*` - Case-insensitive pattern
+- `is.null` / `is.true` / `is.false`
+
+### Ordering
+- `order=column.asc`
+- `order=column.desc`
+
+### Pagination
+- `limit=N`
+- `offset=N`
+
+### Select Specific Columns
+- `select=col1,col2,col3`
+
+---
+
+## Important Notes
+
+1. **Service Key Required:** Use `SUPABASE_SERVICE_KEY` (not anon key) for admin operations
+2. **Never expose keys:** Always load from environment variables
+3. **User privacy:** Only query specific users when needed for support
+4. **Verify payments:** Cross-reference with Stripe before adding credits manually
diff --git a/.pi/skills/brand-style/SKILL.md b/.pi/skills/brand-style/SKILL.md
new file mode 100644
index 000000000..c0936bc1e
--- /dev/null
+++ b/.pi/skills/brand-style/SKILL.md
@@ -0,0 +1,259 @@
+---
+name: brand-style
+description: "Screenpipe brand style guide. Reference this when designing UI components, writing copy, or making visual decisions."
+allowed-tools: Read
+---
+
+# Screenpipe Brand Style Guide
+
+## Philosophy
+
+**"Black & White Geometric Minimalism"**
+
+No color. Sharp corners. Clean typography.
+
+---
+
+## Core Values
+
+| Value | Description |
+|-------|-------------|
+| **Privacy First** | 100% local, data never leaves your machine |
+| **Open Source** | Inspect, modify, own |
+| **Simplicity** | Clean, minimal interface |
+| **Transparency** | "You own your data" |
+| **Developer-Focused** | APIs, extensibility, power users |
+
+---
+
+## Typography
+
+### Font Stack
+
+| Purpose | Font | Fallbacks |
+|---------|------|-----------|
+| **Headings (sans)** | Space Grotesk | system-ui, sans-serif |
+| **Body (serif)** | Crimson Text | Baskerville, Times New Roman, serif |
+| **Code (mono)** | IBM Plex Mono | monospace |
+
+### Usage Patterns
+
+- **Headings**: Space Grotesk, lowercase preferred
+- **Body text**: Crimson Text for readability
+- **Code/technical**: IBM Plex Mono
+- **Buttons**: UPPERCASE with tracking-wide
+- **Labels**: lowercase, medium weight
+
+---
+
+## Colors
+
+### Palette: Grayscale Only
+
+**Light Mode:**
+- Background: #FFFFFF (pure white)
+- Foreground: #000000 (pure black)
+- Muted: #666666 (40% gray)
+- Border: #CCCCCC (80% gray)
+
+**Dark Mode:**
+- Background: #000000 (pure black)
+- Foreground: #FFFFFF (pure white)
+- Muted: #999999 (60% gray)
+- Border: #333333 (20% gray)
+
+### Text Hierarchy
+
+| Level | Light Mode | Dark Mode |
+|-------|------------|-----------|
+| Primary | #000000 | #FFFFFF |
+| Secondary | #666666 | #999999 |
+| Tertiary | #999999 | #666666 |
+| Disabled | #B3B3B3 | #4D4D4D |
+
+### Rule: NO COLOR
+
+- No accent colors (no blue, red, green, etc.)
+- Status indicators use grayscale only
+- Success/warning/error differentiated by icons, not color
+
+---
+
+## Geometry
+
+### Border Radius
+
+```
+--radius: 0
+```
+
+**All corners are sharp.** No rounded corners anywhere.
+
+### Borders
+
+- Width: 1px solid
+- Style: Sharp, binary (on/off)
+- No gradients, no shadows
+
+### Shadows
+
+**None.** Flat design throughout. Use borders for separation.
+
+---
+
+## Components
+
+### Buttons
+
+```
+- Font: UPPERCASE, tracking-wide
+- Border: 1px solid
+- Corners: Sharp (0px radius)
+- Transition: 150ms
+- Hover: Color inversion
+```
+
+### Cards
+
+```
+- Border: 1px solid
+- Shadow: None
+- Corners: Sharp
+- Padding: 24px (p-6)
+```
+
+### Inputs
+
+```
+- Style: Command-line aesthetic
+- Font: Monospace (IBM Plex Mono)
+- Border: 1px solid
+- Height: 40px (h-10)
+- Focus: Border color change
+```
+
+### Dialogs
+
+```
+- Border: 1px solid
+- Shadow: None
+- Animation: 150ms fade
+- Title: lowercase
+```
+
+---
+
+## Motion & Animation
+
+### Principles
+
+- **Fast**: 150ms standard duration
+- **Minimal**: Only essential state changes
+- **Binary**: On/off, no elaborate easing
+
+### Timing
+
+| Animation | Duration |
+|-----------|----------|
+| Button hover | 150ms |
+| Dialog open/close | 150ms |
+| Accordion | 200ms |
+| Page transitions | 150ms |
+
+---
+
+## Brand Voice
+
+### Tone
+
+- Lowercase, casual, direct
+- Technical but accessible
+- No marketing fluff
+- Developer-oriented
+
+### Examples
+
+**Good:**
+- "24/7 memory for your desktop"
+- "you own your data"
+- "100% local"
+
+**Bad:**
+- "REVOLUTIONARY AI-POWERED SOLUTION!"
+- "Best-in-class enterprise memory platform"
+
+---
+
+## Taglines
+
+- "24/7 memory for your desktop"
+- "Rewind but open source. 100% local. You own your data."
+- "Memory infrastructure for your computer"
+
+---
+
+## Design Checklist
+
+When creating new UI components:
+
+- [ ] Using Space Grotesk for headings
+- [ ] Using Crimson Text for body (or IBM Plex Mono for technical)
+- [ ] 1px solid border
+- [ ] No box shadows
+- [ ] 0px border radius (sharp corners)
+- [ ] Black, white, or gray only
+- [ ] 150ms transitions
+- [ ] UPPERCASE for buttons, lowercase for titles
+- [ ] Hover state: color inversion
+- [ ] Focus ring: 1px solid with offset
+
+---
+
+## Key Files
+
+| Purpose | Location |
+|---------|----------|
+| Design tokens | `screenpipe-app-tauri/app/globals.css` |
+| Tailwind config | `screenpipe-app-tauri/tailwind.config.ts` |
+| Color constants | `screenpipe-app-tauri/lib/constants/colors.ts` |
+| UI components | `screenpipe-app-tauri/components/ui/*.tsx` |
+| Website reference | `../screen-pipe-website/app/globals.css` |
+
+---
+
+## Website Typography Reference
+
+From `screen-pipe-website/app/layout.tsx`:
+
+```typescript
+const fontMono = IBM_Plex_Mono({
+ subsets: ["latin"],
+ weight: ["400", "500", "600"],
+ variable: "--font-mono",
+});
+
+const fontSans = Space_Grotesk({
+ subsets: ["latin"],
+ weight: ["400", "500", "700"],
+ variable: "--font-sans",
+});
+
+const fontSerif = Crimson_Text({
+ subsets: ["latin"],
+ weight: ["400", "600", "700"],
+ variable: "--font-serif",
+});
+```
+
+Usage in CSS:
+```css
+body {
+ font-family: var(--font-serif), "Crimson Text", serif;
+}
+h1, h2, h3, h4, h5, h6 {
+ font-family: var(--font-sans), "Space Grotesk", sans-serif;
+}
+code, pre, kbd, .font-mono {
+ font-family: var(--font-mono), "IBM Plex Mono", monospace;
+}
+```
diff --git a/.pi/skills/release/SKILL.md b/.pi/skills/release/SKILL.md
new file mode 100644
index 000000000..1cd16b80b
--- /dev/null
+++ b/.pi/skills/release/SKILL.md
@@ -0,0 +1,195 @@
+---
+name: release
+description: "Release the screenpipe monorepo. Bumps versions, generates changelog, triggers GitHub Actions for app, CLI, MCP, and JS packages."
+allowed-tools: Bash, Read, Edit, Grep, Write
+---
+
+# Screenpipe Monorepo Release Skill
+
+Automate releasing all components of the screenpipe monorepo.
+
+## Components & Versions
+
+| Component | Version File | Current Pattern | Workflow |
+|-----------|--------------|-----------------|----------|
+| Desktop App | `screenpipe-app-tauri/src-tauri/Cargo.toml` | `version = "X.Y.Z"` | `release-app.yml` |
+| CLI/Server | `Cargo.toml` (workspace.package) | `version = "0.2.X"` | `release-cli.yml` |
+| MCP | `screenpipe-integrations/screenpipe-mcp/package.json` | `"version": "X.Y.Z"` | `release-mcp.yml` |
+| JS Browser SDK | `screenpipe-js/browser-sdk/package.json` | `"version": "X.Y.Z"` | npm publish |
+| JS Node SDK | `screenpipe-js/node-sdk/package.json` | `"version": "X.Y.Z"` | npm publish |
+| JS CLI | `screenpipe-js/cli/package.json` | `"version": "X.Y.Z"` | npm publish |
+
+## When to Release What
+
+**Always release CLI** when there are changes to core screenpipe code:
+- `screenpipe-core/`
+- `screenpipe-vision/`
+- `screenpipe-audio/`
+- `screenpipe-server/`
+- `screenpipe-db/`
+- `screenpipe-events/`
+- `screenpipe-integrations/`
+
+**App-only release** is fine when changes are only in:
+- `screenpipe-app-tauri/` (UI/frontend changes)
+
+To check what changed since last CLI release:
+```bash
+# Find last CLI release commit
+git log --oneline --all | grep -E "CLI to v" | head -1
+
+# Check if core code changed since then
+git diff <COMMIT>..HEAD --stat -- screenpipe-core screenpipe-vision screenpipe-audio screenpipe-server screenpipe-db screenpipe-events screenpipe-integrations
+```
+
+## Release Workflow
+
+### 1. Check Current Versions
+```bash
+echo "=== App ===" && grep '^version' screenpipe-app-tauri/src-tauri/Cargo.toml | head -1
+echo "=== CLI ===" && grep '^version' Cargo.toml | head -1
+echo "=== MCP ===" && grep '"version"' screenpipe-integrations/screenpipe-mcp/package.json | head -1
+```
+
+### 2. Generate Changelog
+
+Get commits since last release and generate a user-friendly changelog:
+
+```bash
+# Get last release tag
+LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
+
+# Get commits since last release (or last 50 if no tag)
+if [ -n "$LAST_TAG" ]; then
+ git log $LAST_TAG..HEAD --oneline --no-merges
+else
+ git log -50 --oneline --no-merges
+fi
+```
+
+Then create changelog at `content/changelogs/vX.Y.Z.md` with format:
+
+```markdown
+## New Features
+- Feature description (from commit context)
+
+## Improvements
+- Improvement description
+
+## Bug Fixes
+- Fix description
+
+#### **Full Changelog:** [abc123..def456](https://github.com/mediar-ai/screenpipe/compare/abc123..def456)
+```
+
+Guidelines:
+- Only include changes that bring clear **customer value**
+- Skip: CI changes, refactors, dependency bumps, merge commits
+- Be concise but descriptive
+- Group related changes together
+
+Also copy to `screenpipe-app-tauri/public/CHANGELOG.md` for in-app display.
+
+### 3. Bump Version
+
+Edit `screenpipe-app-tauri/src-tauri/Cargo.toml` to update version.
+
+### 4. Commit & Push
+```bash
+git add -A && git commit -m "Bump app to vX.Y.Z" && git pull --rebase && git push
+```
+
+### 5. Trigger Release (Draft Only)
+```bash
+gh workflow run release-app.yml
+```
+
+**Important**: `workflow_dispatch` creates a **draft only** - does NOT auto-publish. This allows manual testing before publishing.
+
+### 6. Monitor Build Status
+```bash
+# Get latest run ID
+gh run list --workflow=release-app.yml --limit=1
+
+# Check status
+gh run view <RUN_ID> --json status,conclusion,jobs --jq '{status: .status, conclusion: .conclusion, jobs: [.jobs[] | {name: (.name | split(",")[0]), status: .status, conclusion: .conclusion}]}'
+```
+
+### 7. Test the Draft Release
+- Download from CrabNebula Cloud: https://web.crabnebula.cloud/mediar/screenpipe/releases
+- Test on macOS and Windows
+- Verify updater artifacts exist (.tar.gz, .sig files)
+
+### 8. Publish Release
+After testing, publish manually via CrabNebula Cloud dashboard, OR commit with magic words:
+```bash
+git commit --allow-empty -m "release-app-publish" && git push
+```
+
+## Quick Release (App Only)
+
+```bash
+# 1. Generate changelog (Claude does this)
+# 2. Bump version in Cargo.toml
+# 3. Commit and push
+git add -A && git commit -m "Bump app to vX.Y.Z" && git push
+
+# 4. Trigger release (draft)
+gh workflow run release-app.yml
+
+# 5. Monitor
+sleep 5 && gh run list --workflow=release-app.yml --limit=1
+```
+
+## Build Status Format
+
+```
+Build <RUN_ID>:
+| Platform | Status |
+|----------|--------|
+| macOS aarch64 | ✅ success / 🔄 in_progress / ❌ failure |
+| macOS x86_64 | ✅ success / 🔄 in_progress / ❌ failure |
+| Windows | ✅ success / 🔄 in_progress / ❌ failure |
+```
+
+## Troubleshooting
+
+### Build Failed
+```bash
+gh run view <RUN_ID> --log-failed 2>&1 | tail -100
+```
+
+### Cancel Running Build
+```bash
+gh run cancel <RUN_ID>
+```
+
+### Re-run Failed Jobs
+```bash
+gh run rerun <RUN_ID> --failed
+```
+
+### Missing Updater Artifacts (.tar.gz, .sig)
+The CI copies `tauri.prod.conf.json` to `tauri.conf.json` before building. If artifacts are missing:
+1. Check `tauri.prod.conf.json` has `"createUpdaterArtifacts": true`
+2. Check the "Use production config" step ran successfully
+
+## Configuration
+
+### Dev vs Prod Configs
+- `tauri.conf.json` - Dev config (identifier: `screenpi.pe.dev`)
+- `tauri.prod.conf.json` - Prod config (identifier: `screenpi.pe`, updater enabled)
+
+CI automatically uses prod config for releases by copying it before build.
+
+### Auto-Publish Behavior
+- `workflow_dispatch` (manual trigger) → Draft only, no publish
+- Commit with "release-app-publish" → Auto-publish after successful build
+
+## Notes
+
+- Linux desktop app is disabled (bundling issues)
+- App builds take ~25-35 minutes
+- CLI builds take ~15-20 minutes
+- Always pull before push to avoid conflicts
+- Updater artifacts: macOS uses `.tar.gz`/`.sig`, Windows uses `.nsis.zip`/`.sig`
diff --git a/docs/mintlify/docs-mintlify-mig-tmp/sdk-reference.mdx b/docs/mintlify/docs-mintlify-mig-tmp/sdk-reference.mdx
index 38bd74cba..96537e514 100644
--- a/docs/mintlify/docs-mintlify-mig-tmp/sdk-reference.mdx
+++ b/docs/mintlify/docs-mintlify-mig-tmp/sdk-reference.mdx
@@ -860,6 +860,6 @@ await pipe.inbox.clearMessages()
paste these links into your cursor chat for context:
-- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/browser-sdk/src/index.ts
-- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/node-sdk/src/index.ts
-- https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/common/Operator.ts
+- https://github.com/mediar-ai/screenpipe/blob/main/packages/screenpipe-js/browser-sdk/src/index.ts
+- https://github.com/mediar-ai/screenpipe/blob/main/packages/screenpipe-js/node-sdk/src/index.ts
+- https://github.com/mediar-ai/screenpipe/blob/main/packages/screenpipe-js/common/Operator.ts
diff --git a/screenpipe-js/.gitignore b/packages/screenpipe-js/.gitignore
similarity index 100%
rename from screenpipe-js/.gitignore
rename to packages/screenpipe-js/.gitignore
diff --git a/screenpipe-js/browser-sdk/.gitignore b/packages/screenpipe-js/browser-sdk/.gitignore
similarity index 100%
rename from screenpipe-js/browser-sdk/.gitignore
rename to packages/screenpipe-js/browser-sdk/.gitignore
diff --git a/screenpipe-js/browser-sdk/README.md b/packages/screenpipe-js/browser-sdk/README.md
similarity index 100%
rename from screenpipe-js/browser-sdk/README.md
rename to packages/screenpipe-js/browser-sdk/README.md
diff --git a/screenpipe-js/browser-sdk/package-lock.json b/packages/screenpipe-js/browser-sdk/package-lock.json
similarity index 100%
rename from screenpipe-js/browser-sdk/package-lock.json
rename to packages/screenpipe-js/browser-sdk/package-lock.json
diff --git a/screenpipe-js/browser-sdk/package.json b/packages/screenpipe-js/browser-sdk/package.json
similarity index 100%
rename from screenpipe-js/browser-sdk/package.json
rename to packages/screenpipe-js/browser-sdk/package.json
diff --git a/screenpipe-js/browser-sdk/src/index.ts b/packages/screenpipe-js/browser-sdk/src/index.ts
similarity index 100%
rename from screenpipe-js/browser-sdk/src/index.ts
rename to packages/screenpipe-js/browser-sdk/src/index.ts
diff --git a/screenpipe-js/browser-sdk/tests/deduplicateText.test.ts b/packages/screenpipe-js/browser-sdk/tests/deduplicateText.test.ts
similarity index 100%
rename from screenpipe-js/browser-sdk/tests/deduplicateText.test.ts
rename to packages/screenpipe-js/browser-sdk/tests/deduplicateText.test.ts
diff --git a/screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts b/packages/screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts
similarity index 100%
rename from screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts
rename to packages/screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts
diff --git a/screenpipe-js/browser-sdk/tests/streamVision.test.ts b/packages/screenpipe-js/browser-sdk/tests/streamVision.test.ts
similarity index 100%
rename from screenpipe-js/browser-sdk/tests/streamVision.test.ts
rename to packages/screenpipe-js/browser-sdk/tests/streamVision.test.ts
diff --git a/screenpipe-js/browser-sdk/tsconfig.json b/packages/screenpipe-js/browser-sdk/tsconfig.json
similarity index 100%
rename from screenpipe-js/browser-sdk/tsconfig.json
rename to packages/screenpipe-js/browser-sdk/tsconfig.json
diff --git a/screenpipe-js/browser-sdk/tsup.config.ts b/packages/screenpipe-js/browser-sdk/tsup.config.ts
similarity index 100%
rename from screenpipe-js/browser-sdk/tsup.config.ts
rename to packages/screenpipe-js/browser-sdk/tsup.config.ts
diff --git a/screenpipe-js/cli/package-lock.json b/packages/screenpipe-js/cli/package-lock.json
similarity index 100%
rename from screenpipe-js/cli/package-lock.json
rename to packages/screenpipe-js/cli/package-lock.json
diff --git a/screenpipe-js/cli/package.json b/packages/screenpipe-js/cli/package.json
similarity index 100%
rename from screenpipe-js/cli/package.json
rename to packages/screenpipe-js/cli/package.json
diff --git a/screenpipe-js/cli/src/commands/app/create.ts b/packages/screenpipe-js/cli/src/commands/app/create.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/app/create.ts
rename to packages/screenpipe-js/cli/src/commands/app/create.ts
diff --git a/screenpipe-js/cli/src/commands/app/index.ts b/packages/screenpipe-js/cli/src/commands/app/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/app/index.ts
rename to packages/screenpipe-js/cli/src/commands/app/index.ts
diff --git a/screenpipe-js/cli/src/commands/components/README.md b/packages/screenpipe-js/cli/src/commands/components/README.md
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/README.md
rename to packages/screenpipe-js/cli/src/commands/components/README.md
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/add.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/add.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/add.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/add.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/preflights/preflight-add.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/preflights/preflight-add.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/preflights/preflight-add.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/preflights/preflight-add.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/registry/api.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/registry/api.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/registry/api.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/registry/api.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/registry/registry.json b/packages/screenpipe-js/cli/src/commands/components/commands/add/registry/registry.json
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/registry/registry.json
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/registry/registry.json
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/registry/schema.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/registry/schema.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/registry/schema.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/registry/schema.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/add-components.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/add-components.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/add-components.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/add-components.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/download-file-from-github.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/download-file-from-github.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/download-file-from-github.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/download-file-from-github.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/handle-error.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/handle-error.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/handle-error.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/handle-error.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/logger.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/logger.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/logger.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/logger.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/package-manager.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/package-manager.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/package-manager.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/package-manager.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/prompt-for-component.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/prompt-for-component.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/prompt-for-component.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/prompt-for-component.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/shadcn.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/shadcn.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/shadcn.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/shadcn.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-dependencies.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-dependencies.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-dependencies.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-dependencies.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-files.ts b/packages/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-files.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-files.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/add/utils/updaters/update-files.ts
diff --git a/screenpipe-js/cli/src/commands/components/commands/register.ts b/packages/screenpipe-js/cli/src/commands/components/commands/register.ts
similarity index 95%
rename from screenpipe-js/cli/src/commands/components/commands/register.ts
rename to packages/screenpipe-js/cli/src/commands/components/commands/register.ts
index 2092730de..b165b035f 100644
--- a/screenpipe-js/cli/src/commands/components/commands/register.ts
+++ b/packages/screenpipe-js/cli/src/commands/components/commands/register.ts
@@ -15,7 +15,7 @@ async function writeJsonToFile(filePath: string, data: RegistrySchema) {
if (error instanceof Error) {
if (error.message === "No such file or directory") {
logger.break()
- logger.warn("this command can only be called from within the screenpipe-js/cli of screenpipe's repository");
+ logger.warn("this command can only be called from within the packages/screenpipe-js/cli of screenpipe's repository");
process.exit(1)
}
}
@@ -50,7 +50,7 @@ export const registerComponentCommand = new Command()
type: "input",
name: "src",
message: "where should we download the component from? (URL pattern: https://api.github.com/repos/{owner}/{repo}/contents/{path})",
- validate: input => input.startsWith("https://api.github.com/repos/") ? true : "URL must follow the pattern: https://api.github.com/repos/{owner}/{repo}/contents/{path}. \n \n \nvisit: https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/cli/src/commands/components/README.md for more details.",
+ validate: input => input.startsWith("https://api.github.com/repos/") ? true : "URL must follow the pattern: https://api.github.com/repos/{owner}/{repo}/contents/{path}. \n \n \nvisit: https://github.com/mediar-ai/screenpipe/blob/main/packages/screenpipe-js/cli/src/commands/components/README.md for more details.",
},
]);
opts.src = src;
diff --git a/screenpipe-js/cli/src/commands/components/index.ts b/packages/screenpipe-js/cli/src/commands/components/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/components/index.ts
rename to packages/screenpipe-js/cli/src/commands/components/index.ts
diff --git a/screenpipe-js/cli/src/commands/index.ts b/packages/screenpipe-js/cli/src/commands/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/index.ts
rename to packages/screenpipe-js/cli/src/commands/index.ts
diff --git a/screenpipe-js/cli/src/commands/login/index.ts b/packages/screenpipe-js/cli/src/commands/login/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/login/index.ts
rename to packages/screenpipe-js/cli/src/commands/login/index.ts
diff --git a/screenpipe-js/cli/src/commands/login/utils/api-key-login.ts b/packages/screenpipe-js/cli/src/commands/login/utils/api-key-login.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/login/utils/api-key-login.ts
rename to packages/screenpipe-js/cli/src/commands/login/utils/api-key-login.ts
diff --git a/screenpipe-js/cli/src/commands/login/utils/cli-login.ts b/packages/screenpipe-js/cli/src/commands/login/utils/cli-login.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/login/utils/cli-login.ts
rename to packages/screenpipe-js/cli/src/commands/login/utils/cli-login.ts
diff --git a/screenpipe-js/cli/src/commands/logout.ts b/packages/screenpipe-js/cli/src/commands/logout.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/logout.ts
rename to packages/screenpipe-js/cli/src/commands/logout.ts
diff --git a/screenpipe-js/cli/src/commands/pipe/create.ts b/packages/screenpipe-js/cli/src/commands/pipe/create.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/pipe/create.ts
rename to packages/screenpipe-js/cli/src/commands/pipe/create.ts
diff --git a/screenpipe-js/cli/src/commands/pipe/index.ts b/packages/screenpipe-js/cli/src/commands/pipe/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/pipe/index.ts
rename to packages/screenpipe-js/cli/src/commands/pipe/index.ts
diff --git a/screenpipe-js/cli/src/commands/pipe/list-versions.ts b/packages/screenpipe-js/cli/src/commands/pipe/list-versions.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/pipe/list-versions.ts
rename to packages/screenpipe-js/cli/src/commands/pipe/list-versions.ts
diff --git a/screenpipe-js/cli/src/commands/pipe/publish.ts b/packages/screenpipe-js/cli/src/commands/pipe/publish.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/pipe/publish.ts
rename to packages/screenpipe-js/cli/src/commands/pipe/publish.ts
diff --git a/screenpipe-js/cli/src/commands/pipe/register.ts b/packages/screenpipe-js/cli/src/commands/pipe/register.ts
similarity index 100%
rename from screenpipe-js/cli/src/commands/pipe/register.ts
rename to packages/screenpipe-js/cli/src/commands/pipe/register.ts
diff --git a/screenpipe-js/cli/src/constants.ts b/packages/screenpipe-js/cli/src/constants.ts
similarity index 100%
rename from screenpipe-js/cli/src/constants.ts
rename to packages/screenpipe-js/cli/src/constants.ts
diff --git a/screenpipe-js/cli/src/hooks/use-ai-provider.tsx b/packages/screenpipe-js/cli/src/hooks/use-ai-provider.tsx
similarity index 100%
rename from screenpipe-js/cli/src/hooks/use-ai-provider.tsx
rename to packages/screenpipe-js/cli/src/hooks/use-ai-provider.tsx
diff --git a/screenpipe-js/cli/src/hooks/use-health.tsx b/packages/screenpipe-js/cli/src/hooks/use-health.tsx
similarity index 100%
rename from screenpipe-js/cli/src/hooks/use-health.tsx
rename to packages/screenpipe-js/cli/src/hooks/use-health.tsx
diff --git a/screenpipe-js/cli/src/index.ts b/packages/screenpipe-js/cli/src/index.ts
similarity index 100%
rename from screenpipe-js/cli/src/index.ts
rename to packages/screenpipe-js/cli/src/index.ts
diff --git a/screenpipe-js/cli/src/types.ts b/packages/screenpipe-js/cli/src/types.ts
similarity index 100%
rename from screenpipe-js/cli/src/types.ts
rename to packages/screenpipe-js/cli/src/types.ts
diff --git a/screenpipe-js/cli/src/utils/colors.ts b/packages/screenpipe-js/cli/src/utils/colors.ts
similarity index 100%
rename from screenpipe-js/cli/src/utils/colors.ts
rename to packages/screenpipe-js/cli/src/utils/colors.ts
diff --git a/screenpipe-js/cli/src/utils/credentials.ts b/packages/screenpipe-js/cli/src/utils/credentials.ts
similarity index 100%
rename from screenpipe-js/cli/src/utils/credentials.ts
rename to packages/screenpipe-js/cli/src/utils/credentials.ts
diff --git a/screenpipe-js/cli/tests/.gitignore b/packages/screenpipe-js/cli/tests/.gitignore
similarity index 100%
rename from screenpipe-js/cli/tests/.gitignore
rename to packages/screenpipe-js/cli/tests/.gitignore
diff --git a/screenpipe-js/cli/tests/README.md b/packages/screenpipe-js/cli/tests/README.md
similarity index 100%
rename from screenpipe-js/cli/tests/README.md
rename to packages/screenpipe-js/cli/tests/README.md
diff --git a/screenpipe-js/cli/tests/index.ts b/packages/screenpipe-js/cli/tests/index.ts
similarity index 100%
rename from screenpipe-js/cli/tests/index.ts
rename to packages/screenpipe-js/cli/tests/index.ts
diff --git a/screenpipe-js/cli/tests/package.json b/packages/screenpipe-js/cli/tests/package.json
similarity index 100%
rename from screenpipe-js/cli/tests/package.json
rename to packages/screenpipe-js/cli/tests/package.json
diff --git a/screenpipe-js/cli/tests/tsconfig.json b/packages/screenpipe-js/cli/tests/tsconfig.json
similarity index 100%
rename from screenpipe-js/cli/tests/tsconfig.json
rename to packages/screenpipe-js/cli/tests/tsconfig.json
diff --git a/screenpipe-js/cli/tsconfig.json b/packages/screenpipe-js/cli/tsconfig.json
similarity index 100%
rename from screenpipe-js/cli/tsconfig.json
rename to packages/screenpipe-js/cli/tsconfig.json
diff --git a/screenpipe-js/common/PipesManager.ts b/packages/screenpipe-js/common/PipesManager.ts
similarity index 100%
rename from screenpipe-js/common/PipesManager.ts
rename to packages/screenpipe-js/common/PipesManager.ts
diff --git a/screenpipe-js/common/analytics.ts b/packages/screenpipe-js/common/analytics.ts
similarity index 100%
rename from screenpipe-js/common/analytics.ts
rename to packages/screenpipe-js/common/analytics.ts
diff --git a/screenpipe-js/common/types.ts b/packages/screenpipe-js/common/types.ts
similarity index 100%
rename from screenpipe-js/common/types.ts
rename to packages/screenpipe-js/common/types.ts
diff --git a/screenpipe-js/common/utils.ts b/packages/screenpipe-js/common/utils.ts
similarity index 100%
rename from screenpipe-js/common/utils.ts
rename to packages/screenpipe-js/common/utils.ts
diff --git a/screenpipe-js/examples/basic-transcription/.gitignore b/packages/screenpipe-js/examples/basic-transcription/.gitignore
similarity index 100%
rename from screenpipe-js/examples/basic-transcription/.gitignore
rename to packages/screenpipe-js/examples/basic-transcription/.gitignore
diff --git a/screenpipe-js/examples/basic-transcription/README.md b/packages/screenpipe-js/examples/basic-transcription/README.md
similarity index 100%
rename from screenpipe-js/examples/basic-transcription/README.md
rename to packages/screenpipe-js/examples/basic-transcription/README.md
diff --git a/screenpipe-js/examples/basic-transcription/index.ts b/packages/screenpipe-js/examples/basic-transcription/index.ts
similarity index 100%
rename from screenpipe-js/examples/basic-transcription/index.ts
rename to packages/screenpipe-js/examples/basic-transcription/index.ts
diff --git a/screenpipe-js/examples/basic-transcription/package.json b/packages/screenpipe-js/examples/basic-transcription/package.json
similarity index 100%
rename from screenpipe-js/examples/basic-transcription/package.json
rename to packages/screenpipe-js/examples/basic-transcription/package.json
diff --git a/screenpipe-js/examples/basic-transcription/tsconfig.json b/packages/screenpipe-js/examples/basic-transcription/tsconfig.json
similarity index 100%
rename from screenpipe-js/examples/basic-transcription/tsconfig.json
rename to packages/screenpipe-js/examples/basic-transcription/tsconfig.json
diff --git a/screenpipe-js/examples/capture-main-feature/.gitignore b/packages/screenpipe-js/examples/capture-main-feature/.gitignore
similarity index 100%
rename from screenpipe-js/examples/capture-main-feature/.gitignore
rename to packages/screenpipe-js/examples/capture-main-feature/.gitignore
diff --git a/screenpipe-js/examples/capture-main-feature/README.md b/packages/screenpipe-js/examples/capture-main-feature/README.md
similarity index 100%
rename from screenpipe-js/examples/capture-main-feature/README.md
rename to packages/screenpipe-js/examples/capture-main-feature/README.md
diff --git a/screenpipe-js/examples/capture-main-feature/index.ts b/packages/screenpipe-js/examples/capture-main-feature/index.ts
similarity index 100%
rename from screenpipe-js/examples/capture-main-feature/index.ts
rename to packages/screenpipe-js/examples/capture-main-feature/index.ts
diff --git a/screenpipe-js/examples/capture-main-feature/package.json b/packages/screenpipe-js/examples/capture-main-feature/package.json
similarity index 100%
rename from screenpipe-js/examples/capture-main-feature/package.json
rename to packages/screenpipe-js/examples/capture-main-feature/package.json
diff --git a/screenpipe-js/examples/capture-main-feature/tsconfig.json b/packages/screenpipe-js/examples/capture-main-feature/tsconfig.json
similarity index 100%
rename from screenpipe-js/examples/capture-main-feature/tsconfig.json
rename to packages/screenpipe-js/examples/capture-main-feature/tsconfig.json
diff --git a/screenpipe-js/examples/deduplicate/.gitignore b/packages/screenpipe-js/examples/deduplicate/.gitignore
similarity index 100%
rename from screenpipe-js/examples/deduplicate/.gitignore
rename to packages/screenpipe-js/examples/deduplicate/.gitignore
diff --git a/screenpipe-js/examples/deduplicate/README.md b/packages/screenpipe-js/examples/deduplicate/README.md
similarity index 100%
rename from screenpipe-js/examples/deduplicate/README.md
rename to packages/screenpipe-js/examples/deduplicate/README.md
diff --git a/screenpipe-js/examples/deduplicate/app/favicon.ico b/packages/screenpipe-js/examples/deduplicate/app/favicon.ico
similarity index 100%
rename from screenpipe-js/examples/deduplicate/app/favicon.ico
rename to packages/screenpipe-js/examples/deduplicate/app/favicon.ico
diff --git a/screenpipe-js/examples/deduplicate/app/globals.css b/packages/screenpipe-js/examples/deduplicate/app/globals.css
similarity index 100%
rename from screenpipe-js/examples/deduplicate/app/globals.css
rename to packages/screenpipe-js/examples/deduplicate/app/globals.css
diff --git a/screenpipe-js/examples/deduplicate/app/layout.tsx b/packages/screenpipe-js/examples/deduplicate/app/layout.tsx
similarity index 100%
rename from screenpipe-js/examples/deduplicate/app/layout.tsx
rename to packages/screenpipe-js/examples/deduplicate/app/layout.tsx
diff --git a/screenpipe-js/examples/deduplicate/app/page.tsx b/packages/screenpipe-js/examples/deduplicate/app/page.tsx
similarity index 100%
rename from screenpipe-js/examples/deduplicate/app/page.tsx
rename to packages/screenpipe-js/examples/deduplicate/app/page.tsx
diff --git a/screenpipe-js/examples/deduplicate/bun.lock b/packages/screenpipe-js/examples/deduplicate/bun.lock
similarity index 100%
rename from screenpipe-js/examples/deduplicate/bun.lock
rename to packages/screenpipe-js/examples/deduplicate/bun.lock
diff --git a/screenpipe-js/examples/deduplicate/eslint.config.mjs b/packages/screenpipe-js/examples/deduplicate/eslint.config.mjs
similarity index 100%
rename from screenpipe-js/examples/deduplicate/eslint.config.mjs
rename to packages/screenpipe-js/examples/deduplicate/eslint.config.mjs
diff --git a/screenpipe-js/examples/deduplicate/next.config.ts b/packages/screenpipe-js/examples/deduplicate/next.config.ts
similarity index 100%
rename from screenpipe-js/examples/deduplicate/next.config.ts
rename to packages/screenpipe-js/examples/deduplicate/next.config.ts
diff --git a/screenpipe-js/examples/deduplicate/package.json b/packages/screenpipe-js/examples/deduplicate/package.json
similarity index 100%
rename from screenpipe-js/examples/deduplicate/package.json
rename to packages/screenpipe-js/examples/deduplicate/package.json
diff --git a/screenpipe-js/examples/deduplicate/postcss.config.mjs b/packages/screenpipe-js/examples/deduplicate/postcss.config.mjs
similarity index 100%
rename from screenpipe-js/examples/deduplicate/postcss.config.mjs
rename to packages/screenpipe-js/examples/deduplicate/postcss.config.mjs
diff --git a/screenpipe-js/examples/deduplicate/public/file.svg b/packages/screenpipe-js/examples/deduplicate/public/file.svg
similarity index 100%
rename from screenpipe-js/examples/deduplicate/public/file.svg
rename to packages/screenpipe-js/examples/deduplicate/public/file.svg
diff --git a/screenpipe-js/examples/deduplicate/public/globe.svg b/packages/screenpipe-js/examples/deduplicate/public/globe.svg
similarity index 100%
rename from screenpipe-js/examples/deduplicate/public/globe.svg
rename to packages/screenpipe-js/examples/deduplicate/public/globe.svg
diff --git a/screenpipe-js/examples/deduplicate/public/next.svg b/packages/screenpipe-js/examples/deduplicate/public/next.svg
similarity index 100%
rename from screenpipe-js/examples/deduplicate/public/next.svg
rename to packages/screenpipe-js/examples/deduplicate/public/next.svg
diff --git a/screenpipe-js/examples/deduplicate/public/vercel.svg b/packages/screenpipe-js/examples/deduplicate/public/vercel.svg
similarity index 100%
rename from screenpipe-js/examples/deduplicate/public/vercel.svg
rename to packages/screenpipe-js/examples/deduplicate/public/vercel.svg
diff --git a/screenpipe-js/examples/deduplicate/public/window.svg b/packages/screenpipe-js/examples/deduplicate/public/window.svg
similarity index 100%
rename from screenpipe-js/examples/deduplicate/public/window.svg
rename to packages/screenpipe-js/examples/deduplicate/public/window.svg
diff --git a/screenpipe-js/examples/deduplicate/tailwind.config.ts b/packages/screenpipe-js/examples/deduplicate/tailwind.config.ts
similarity index 100%
rename from screenpipe-js/examples/deduplicate/tailwind.config.ts
rename to packages/screenpipe-js/examples/deduplicate/tailwind.config.ts
diff --git a/screenpipe-js/examples/deduplicate/tsconfig.json b/packages/screenpipe-js/examples/deduplicate/tsconfig.json
similarity index 100%
rename from screenpipe-js/examples/deduplicate/tsconfig.json
rename to packages/screenpipe-js/examples/deduplicate/tsconfig.json
diff --git a/screenpipe-js/examples/query-screenpipe/.gitignore b/packages/screenpipe-js/examples/query-screenpipe/.gitignore
similarity index 100%
rename from screenpipe-js/examples/query-screenpipe/.gitignore
rename to packages/screenpipe-js/examples/query-screenpipe/.gitignore
diff --git a/screenpipe-js/examples/query-screenpipe/README.md b/packages/screenpipe-js/examples/query-screenpipe/README.md
similarity index 100%
rename from screenpipe-js/examples/query-screenpipe/README.md
rename to packages/screenpipe-js/examples/query-screenpipe/README.md
diff --git a/screenpipe-js/examples/query-screenpipe/index.ts b/packages/screenpipe-js/examples/query-screenpipe/index.ts
similarity index 100%
rename from screenpipe-js/examples/query-screenpipe/index.ts
rename to packages/screenpipe-js/examples/query-screenpipe/index.ts
diff --git a/screenpipe-js/examples/query-screenpipe/package.json b/packages/screenpipe-js/examples/query-screenpipe/package.json
similarity index 100%
rename from screenpipe-js/examples/query-screenpipe/package.json
rename to packages/screenpipe-js/examples/query-screenpipe/package.json
diff --git a/screenpipe-js/examples/query-screenpipe/tsconfig.json b/packages/screenpipe-js/examples/query-screenpipe/tsconfig.json
similarity index 100%
rename from screenpipe-js/examples/query-screenpipe/tsconfig.json
rename to packages/screenpipe-js/examples/query-screenpipe/tsconfig.json
diff --git a/screenpipe-js/examples/stream-screenshots/.gitignore b/packages/screenpipe-js/examples/stream-screenshots/.gitignore
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/.gitignore
rename to packages/screenpipe-js/examples/stream-screenshots/.gitignore
diff --git a/screenpipe-js/examples/stream-screenshots/README.md b/packages/screenpipe-js/examples/stream-screenshots/README.md
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/README.md
rename to packages/screenpipe-js/examples/stream-screenshots/README.md
diff --git a/screenpipe-js/examples/stream-screenshots/app/favicon.ico b/packages/screenpipe-js/examples/stream-screenshots/app/favicon.ico
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/app/favicon.ico
rename to packages/screenpipe-js/examples/stream-screenshots/app/favicon.ico
diff --git a/screenpipe-js/examples/stream-screenshots/app/globals.css b/packages/screenpipe-js/examples/stream-screenshots/app/globals.css
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/app/globals.css
rename to packages/screenpipe-js/examples/stream-screenshots/app/globals.css
diff --git a/screenpipe-js/examples/stream-screenshots/app/layout.tsx b/packages/screenpipe-js/examples/stream-screenshots/app/layout.tsx
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/app/layout.tsx
rename to packages/screenpipe-js/examples/stream-screenshots/app/layout.tsx
diff --git a/screenpipe-js/examples/stream-screenshots/app/page.tsx b/packages/screenpipe-js/examples/stream-screenshots/app/page.tsx
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/app/page.tsx
rename to packages/screenpipe-js/examples/stream-screenshots/app/page.tsx
diff --git a/screenpipe-js/examples/stream-screenshots/bun.lock b/packages/screenpipe-js/examples/stream-screenshots/bun.lock
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/bun.lock
rename to packages/screenpipe-js/examples/stream-screenshots/bun.lock
diff --git a/screenpipe-js/examples/stream-screenshots/eslint.config.mjs b/packages/screenpipe-js/examples/stream-screenshots/eslint.config.mjs
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/eslint.config.mjs
rename to packages/screenpipe-js/examples/stream-screenshots/eslint.config.mjs
diff --git a/screenpipe-js/examples/stream-screenshots/next.config.ts b/packages/screenpipe-js/examples/stream-screenshots/next.config.ts
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/next.config.ts
rename to packages/screenpipe-js/examples/stream-screenshots/next.config.ts
diff --git a/screenpipe-js/examples/stream-screenshots/package.json b/packages/screenpipe-js/examples/stream-screenshots/package.json
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/package.json
rename to packages/screenpipe-js/examples/stream-screenshots/package.json
diff --git a/screenpipe-js/examples/stream-screenshots/postcss.config.mjs b/packages/screenpipe-js/examples/stream-screenshots/postcss.config.mjs
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/postcss.config.mjs
rename to packages/screenpipe-js/examples/stream-screenshots/postcss.config.mjs
diff --git a/screenpipe-js/examples/stream-screenshots/public/file.svg b/packages/screenpipe-js/examples/stream-screenshots/public/file.svg
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/public/file.svg
rename to packages/screenpipe-js/examples/stream-screenshots/public/file.svg
diff --git a/screenpipe-js/examples/stream-screenshots/public/globe.svg b/packages/screenpipe-js/examples/stream-screenshots/public/globe.svg
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/public/globe.svg
rename to packages/screenpipe-js/examples/stream-screenshots/public/globe.svg
diff --git a/screenpipe-js/examples/stream-screenshots/public/next.svg b/packages/screenpipe-js/examples/stream-screenshots/public/next.svg
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/public/next.svg
rename to packages/screenpipe-js/examples/stream-screenshots/public/next.svg
diff --git a/screenpipe-js/examples/stream-screenshots/public/vercel.svg b/packages/screenpipe-js/examples/stream-screenshots/public/vercel.svg
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/public/vercel.svg
rename to packages/screenpipe-js/examples/stream-screenshots/public/vercel.svg
diff --git a/screenpipe-js/examples/stream-screenshots/public/window.svg b/packages/screenpipe-js/examples/stream-screenshots/public/window.svg
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/public/window.svg
rename to packages/screenpipe-js/examples/stream-screenshots/public/window.svg
diff --git a/screenpipe-js/examples/stream-screenshots/tailwind.config.ts b/packages/screenpipe-js/examples/stream-screenshots/tailwind.config.ts
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/tailwind.config.ts
rename to packages/screenpipe-js/examples/stream-screenshots/tailwind.config.ts
diff --git a/screenpipe-js/examples/stream-screenshots/tsconfig.json b/packages/screenpipe-js/examples/stream-screenshots/tsconfig.json
similarity index 100%
rename from screenpipe-js/examples/stream-screenshots/tsconfig.json
rename to packages/screenpipe-js/examples/stream-screenshots/tsconfig.json
diff --git a/screenpipe-js/node-sdk/.gitignore b/packages/screenpipe-js/node-sdk/.gitignore
similarity index 100%
rename from screenpipe-js/node-sdk/.gitignore
rename to packages/screenpipe-js/node-sdk/.gitignore
diff --git a/screenpipe-js/node-sdk/README.md b/packages/screenpipe-js/node-sdk/README.md
similarity index 100%
rename from screenpipe-js/node-sdk/README.md
rename to packages/screenpipe-js/node-sdk/README.md
diff --git a/screenpipe-js/node-sdk/package.json b/packages/screenpipe-js/node-sdk/package.json
similarity index 100%
rename from screenpipe-js/node-sdk/package.json
rename to packages/screenpipe-js/node-sdk/package.json
diff --git a/screenpipe-js/node-sdk/src/InboxManager.ts b/packages/screenpipe-js/node-sdk/src/InboxManager.ts
similarity index 100%
rename from screenpipe-js/node-sdk/src/InboxManager.ts
rename to packages/screenpipe-js/node-sdk/src/InboxManager.ts
diff --git a/screenpipe-js/node-sdk/src/SettingsManager.ts b/packages/screenpipe-js/node-sdk/src/SettingsManager.ts
similarity index 100%
rename from screenpipe-js/node-sdk/src/SettingsManager.ts
rename to packages/screenpipe-js/node-sdk/src/SettingsManager.ts
diff --git a/screenpipe-js/node-sdk/src/Task.ts b/packages/screenpipe-js/node-sdk/src/Task.ts
similarity index 100%
rename from screenpipe-js/node-sdk/src/Task.ts
rename to packages/screenpipe-js/node-sdk/src/Task.ts
diff --git a/screenpipe-js/node-sdk/src/inbox-server.ts b/packages/screenpipe-js/node-sdk/src/inbox-server.ts
similarity index 100%
rename from screenpipe-js/node-sdk/src/inbox-server.ts
rename to packages/screenpipe-js/node-sdk/src/inbox-server.ts
diff --git a/screenpipe-js/node-sdk/src/index.ts b/packages/screenpipe-js/node-sdk/src/index.ts
similarity index 100%
rename from screenpipe-js/node-sdk/src/index.ts
rename to packages/screenpipe-js/node-sdk/src/index.ts
diff --git a/screenpipe-js/node-sdk/tsconfig.json b/packages/screenpipe-js/node-sdk/tsconfig.json
similarity index 100%
rename from screenpipe-js/node-sdk/tsconfig.json
rename to packages/screenpipe-js/node-sdk/tsconfig.json
diff --git a/screenpipe-js/node-sdk/tsup.config.ts b/packages/screenpipe-js/node-sdk/tsup.config.ts
similarity index 100%
rename from screenpipe-js/node-sdk/tsup.config.ts
rename to packages/screenpipe-js/node-sdk/tsup.config.ts
diff --git a/screenpipe-js/browser-sdk/bun.lockb b/screenpipe-js/browser-sdk/bun.lockb
deleted file mode 100755
index b391e445c..000000000
Binary files a/screenpipe-js/browser-sdk/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/cli/bun.lockb b/screenpipe-js/cli/bun.lockb
deleted file mode 100755
index f001311f1..000000000
Binary files a/screenpipe-js/cli/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/cli/dist/index.js b/screenpipe-js/cli/dist/index.js
deleted file mode 100755
index 7fd8f81a7..000000000
--- a/screenpipe-js/cli/dist/index.js
+++ /dev/null
@@ -1,2487 +0,0 @@
-#!/usr/bin/env bun
-var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
-}) : x)(function(x) {
- if (typeof require !== "undefined") return require.apply(this, arguments);
- throw Error('Dynamic require of "' + x + '" is not supported');
-});
-
-// src/index.ts
-import { Command as Command13 } from "commander";
-
-// src/commands/login/index.ts
-import { Command } from "commander";
-import * as p3 from "@clack/prompts";
-
-// src/commands/login/utils/cli-login.ts
-import http from "http";
-import { spawn } from "child_process";
-import url from "url";
-import { listen } from "async-listen";
-import { customAlphabet } from "nanoid";
-
-// src/commands/components/commands/add/utils/logger.ts
-import * as p from "@clack/prompts";
-import chalk from "chalk";
-var logger = {
- error: (...args) => console.error(chalk.red(...args)),
- warn: (...args) => console.warn(chalk.yellow(...args)),
- info: (...args) => console.info(chalk.blue(...args)),
- success: (...args) => console.log(chalk.green(...args)),
- log: (...args) => console.log(...args),
- break: () => console.log("")
-};
-var highlighter = {
- info: (text5) => chalk.blue(text5),
- error: (text5) => chalk.red(text5),
- warning: (text5) => chalk.yellow(text5),
- success: (text5) => chalk.green(text5),
- code: (text5) => chalk.gray(text5)
-};
-var spinner2 = (text5, options = {}) => {
- const s = p.spinner();
- return {
- start: (newText) => {
- if (!options.silent) {
- s.start(newText || text5);
- }
- return s;
- },
- stop: () => {
- if (!options.silent) {
- s.stop();
- }
- return s;
- },
- succeed: (text6) => {
- if (!options.silent) {
- s.stop(text6 ? chalk.green(`\u2714 ${text6}`) : void 0);
- }
- return s;
- },
- fail: (text6) => {
- if (!options.silent) {
- s.stop(text6 ? chalk.red(`\u2716 ${text6}`) : void 0);
- }
- return s;
- },
- info: (text6) => {
- if (!options.silent) {
- s.stop(text6 ? chalk.blue(`\u2139 ${text6}`) : void 0);
- }
- return s;
- },
- warn: (text6) => {
- if (!options.silent) {
- s.stop(text6 ? chalk.yellow(`\u26A0 ${text6}`) : void 0);
- }
- return s;
- }
- };
-};
-
-// src/utils/colors.ts
-import chalk2 from "chalk";
-var colors = {
- primary: chalk2.cyan,
- success: chalk2.green,
- error: chalk2.red,
- warning: chalk2.yellow,
- info: chalk2.blue,
- dim: chalk2.gray,
- highlight: chalk2.magenta,
- bold: chalk2.bold,
- header: (text5) => chalk2.bold.cyan(`
-${text5}`),
- subHeader: (text5) => chalk2.dim(`${text5}`),
- listItem: (text5) => chalk2.cyan(` * ${text5}`),
- label: (text5) => chalk2.bold.blue(`${text5}:`),
- value: (text5) => chalk2.white(`${text5}`)
-};
-var symbols = {
- success: "+",
- error: "x",
- warning: "!",
- info: "i",
- arrow: ">"
-};
-
-// src/commands/components/commands/add/utils/handle-error.ts
-import { z } from "zod";
-function handleError(error) {
- if (typeof error === "string") {
- logger.error(error);
- logger.break();
- process.exit(1);
- }
- if (error instanceof z.ZodError) {
- logger.error("validation failed:");
- for (const [key, value] of Object.entries(error.flatten().fieldErrors)) {
- logger.error(`- ${highlighter.info(key)}: ${value}`);
- }
- logger.break();
- process.exit(1);
- }
- if (error instanceof Error) {
- logger.error(error.message);
- logger.break();
- process.exit(1);
- }
- logger.break();
- process.exit(1);
-}
-var ERRORS = {
- MISSING_DIR_OR_EMPTY_PIPE: "1",
- COMPONENT_NOT_FOUND: "2",
- BUILD_MISSING_REGISTRY_FILE: "3"
-};
-
-// src/commands/login/utils/cli-login.ts
-import { z as z2 } from "zod";
-
-// src/utils/credentials.ts
-import os from "os";
-import fs from "fs";
-import path from "path";
-var Credentials = class {
- static configDir = path.join(os.homedir(), ".screenpipe");
- static configFile = path.join(this.configDir, "config-developer.json");
- static getApiKey() {
- try {
- if (!fs.existsSync(this.configFile)) {
- return null;
- }
- const config = JSON.parse(fs.readFileSync(this.configFile, "utf-8"));
- return config.apiKey || null;
- } catch (error) {
- return null;
- }
- }
- static setApiKey(apiKey, developerId) {
- if (!fs.existsSync(this.configDir)) {
- fs.mkdirSync(this.configDir);
- }
- fs.writeFileSync(
- this.configFile,
- JSON.stringify(
- {
- apiKey,
- developerId
- },
- null,
- 2
- )
- );
- }
- static clearCredentials() {
- if (fs.existsSync(this.configFile)) {
- fs.unlinkSync(this.configFile);
- }
- }
-};
-
-// src/commands/login/utils/cli-login.ts
-var UserCancellationError = class extends Error {
- constructor(message) {
- super(message);
- this.name = "UserCancellationError";
- }
-};
-var authPayload = z2.object({
- token: z2.string(),
- email: z2.string(),
- user_id: z2.string(),
- developer_id: z2.string(),
- api_key: z2.string()
-});
-async function sendAuthData(authPayload2) {
- try {
- const response = await fetch(`http://localhost:11435/auth`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(authPayload2)
- });
- if (!response.ok) {
- throw new Error("failed to send auth data");
- }
- const data = await response.json();
- return data;
- } catch (error) {
- if (error instanceof TypeError && error.message.includes("fetch")) {
- throw new Error("Make sure to run the app before attempting to login");
- }
- throw error;
- }
-}
-var nanoid = customAlphabet("123456789qazwsxedcrfvtgbyhnujmikolp", 8);
-async function cliLogin() {
- const server = http.createServer();
- const { port } = await listen(server, 0, "127.0.0.1");
- logger.info(`server listening on http://127.0.0.1:${port}`);
- const authPromise = new Promise((resolve, reject) => {
- server.on("request", (req, res) => {
- res.setHeader("Access-Control-Allow-Origin", "*");
- res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
- res.setHeader(
- "Access-Control-Allow-Headers",
- "Content-Type, Authorization"
- );
- if (req.method === "OPTIONS") {
- res.writeHead(200);
- res.end();
- } else if (req.method === "GET") {
- const parsedUrl = url.parse(req.url, true);
- const queryParams = parsedUrl.query;
- if (queryParams.cancelled) {
- res.writeHead(200);
- res.end("Cancelled");
- reject(new UserCancellationError("Login process cancelled by user."));
- } else {
- res.writeHead(200);
- res.end("Success");
- const authData = authPayload.parse(queryParams);
- if (!authData) {
- reject(new Error("invalid response from server"));
- }
- resolve(authData);
- }
- } else {
- res.writeHead(405);
- res.end("Method not allowed");
- }
- });
- });
- const redirect = `http://127.0.0.1:${port}`;
- const code = nanoid();
- const confirmationUrl = new URL("http://screenpi.pe/login");
- confirmationUrl.searchParams.append("code", code);
- confirmationUrl.searchParams.append("redirect", redirect);
- logger.log(`confirmation code: ${colors.bold(code)}
-`);
- logger.log(
- `if something goes wrong, copy and paste this url into your browser: ${colors.bold(
- confirmationUrl.toString()
- )}
-`
- );
- const openBrowser = (url2) => {
- const platform = process.platform;
- switch (platform) {
- case "win32":
- const escapedUrl = url2.replace(/&/g, "^&");
- return spawn("cmd", ["/c", "start", "", escapedUrl]);
- case "darwin":
- return spawn("open", [url2]);
- default:
- return spawn("xdg-open", [url2]);
- }
- };
- openBrowser(confirmationUrl.toString());
- const loadingSpinner = spinner2("waiting for authentication...");
- try {
- loadingSpinner.start();
- const authData = await authPromise;
- Credentials.setApiKey(authData.api_key, authData.developer_id);
- await sendAuthData(authData).catch((_) => {
- logger.warn(
- "could not set app credentials, is it app running? \nignore this warning if you're just trying to publish a pipe!"
- );
- });
- loadingSpinner.succeed("authentication successful");
- server.close();
- } catch (error) {
- if (error instanceof UserCancellationError) {
- server.close();
- logger.log("\n");
- logger.error("authentication cancelled.\n");
- process.exit(0);
- } else {
- server.close();
- handleError(`authentication failed: + ${error}`);
- }
- } finally {
- server.close();
- process.exit(0);
- }
-}
-
-// src/constants.ts
-var API_BASE_URL = process.env.SC_API_BASE_URL || "https://screenpi.pe";
-
-// src/commands/login/utils/api-key-login.ts
-import * as p2 from "@clack/prompts";
-async function apiKeyLogin(apiKey) {
- try {
- logger.info(`
-${symbols.info} validating API key...`);
- const response = await fetch(`${API_BASE_URL}/api/plugins/dev-status`, {
- method: "GET",
- headers: {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- }
- });
- if (!response.ok) {
- const error = await response.json();
- throw new Error(`Failed to validate API key ${error.error}`);
- }
- const data = await response.json();
- if (data.data.needs_name) {
- const developerName = await p2.text({
- message: "enter your developer name:",
- validate: (input) => {
- if (input.length < 2) {
- return "developer name must be at least 2 characters";
- }
- if (input.length > 50) {
- return "developer name must be less than 50 characters";
- }
- return;
- }
- });
- if (p2.isCancel(developerName)) {
- p2.cancel("Operation cancelled");
- process.exit(1);
- }
- const updateResponse = await fetch(
- `${API_BASE_URL}/api/plugins/dev-status`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- },
- body: JSON.stringify({ developer_name: developerName })
- }
- );
- if (!updateResponse.ok) {
- const error = await updateResponse.json();
- throw new Error(`failed to set developer name: ${error.error}`);
- }
- const updateData = await updateResponse.json();
- data.data.developer_name = updateData.data.developer_name;
- }
- logger.info(`
-${symbols.success} successfully logged in!`);
- console.log(
- colors.listItem(
- `${colors.label("developer id")} ${data.data.developer_id}`
- )
- );
- console.log(
- colors.listItem(
- `${colors.label("developer name")} ${data.data.developer_name}`
- )
- );
- Credentials.setApiKey(apiKey, data.data.developer_id);
- } catch (error) {
- if (error instanceof Error) {
- handleError(`
-${symbols.error} login failed: ${error.message}`);
- } else {
- handleError(`
-${symbols.error} login failed with unexpected error`);
- }
- process.exit(1);
- }
-}
-
-// src/commands/login/index.ts
-var loginCommand = new Command().name("login").description("authenticate with screenpipe").action(async () => {
- p3.intro("Welcome to Screenpipe");
- const type = await p3.select({
- message: "Select login type",
- options: [
- { value: "browser", label: "Browser" },
- { value: "apiKey", label: "API Key" }
- ]
- });
- if (p3.isCancel(type)) {
- p3.cancel("Login cancelled");
- process.exit(1);
- }
- if (type === "browser") {
- await cliLogin();
- } else {
- const apiKey = await p3.text({
- message: "Enter your API key"
- // validate: (value) => {
- // if (value.length !== 32) {
- // return 'API key must be 32 characters long';
- // }
- // }
- });
- if (p3.isCancel(apiKey)) {
- p3.cancel("Login cancelled");
- process.exit(1);
- }
- await apiKeyLogin(apiKey);
- }
- p3.outro("Login complete");
-});
-
-// src/commands/logout.ts
-import { Command as Command2 } from "commander";
-var logoutCommand = new Command2().name("logout").description("end current session").action(async () => {
- Credentials.clearCredentials();
- logger.success(`
-${symbols.success} successfully logged out`);
- logger.info(`${symbols.info} thanks for using screenpipe! come back soon.`);
-});
-
-// src/commands/pipe/index.ts
-import { Command as Command7 } from "commander";
-
-// src/commands/pipe/register.ts
-import fs2 from "fs";
-import { Command as Command3 } from "commander";
-import * as p4 from "@clack/prompts";
-function validateGitHubRepo(url2) {
- try {
- if (!url2.includes("github.com")) {
- return false;
- }
- return true;
- } catch (error) {
- return false;
- }
-}
-var registerCommand = new Command3().name("register").description("register a new pipe").requiredOption("--name <name>", "name of the pipe", (value) => {
- if (value.includes(" ")) {
- throw new Error("name cannot contain spaces");
- }
- if (!/^[a-zA-Z0-9-_]+$/.test(value)) {
- throw new Error(
- "name can only contain letters, numbers, hyphens, underscores, and periods"
- );
- }
- if (value.length > 20) {
- throw new Error("name cannot be longer than 20 characters");
- }
- return value;
-}).option("--paid", "set this flag to create a paid pipe").option(
- "--price <price>",
- "price in usd (required for paid pipes)",
- parseFloat
-).requiredOption(
- "--source <source>",
- "source code url (e.g., github repository)",
- (value) => {
- if (!value.startsWith("https://github.com/")) {
- throw new Error("source must start with https://github.com/");
- }
- return value;
- }
-).option(
- "--discord <handle>",
- "your discord handle (e.g., username or user.name)",
- (value) => {
- const modernDiscordPattern = /^(?!.*\.\.)[a-z0-9_.]{2,32}(?<!\.)$/;
- const legacyDiscordPattern = /^[a-zA-Z0-9_]{2,32}#[0-9]{4}$/;
- if (!modernDiscordPattern.test(value) && !legacyDiscordPattern.test(value)) {
- throw new Error(
- "invalid discord handle format. should be a valid discord username (2-32 characters containing lowercase letters, numbers, periods, underscores; no consecutive periods; cannot start/end with period) or legacy format (username#1234)"
- );
- }
- return value;
- }
-).action(async (opts) => {
- p4.intro(`${colors.highlight("\u26A0\uFE0F IMPORTANT: Publishing Process \u26A0\uFE0F")}`);
- const githubValidationSpinner = p4.spinner();
- githubValidationSpinner.start("Validating GitHub repository");
- const isValidRepo = validateGitHubRepo(opts.source);
- if (!isValidRepo) {
- githubValidationSpinner.stop("GitHub validation failed");
- handleError(
- `${symbols.error} repository doesn't exist or isn't accessible: ${opts.source}`
- );
- return;
- }
- githubValidationSpinner.stop("GitHub repository validated successfully");
- p4.note(
- `Before publishing your pipe, you MUST contact ${colors.highlight(
- "louis030195"
- )} on Discord.
- Join the Discord server: ${colors.highlight(
- "https://discord.gg/dU9EBuw7Uq"
- )}
- This step is required to complete the publishing process.`,
- "Contact Required"
- );
- const confirmed = await p4.confirm({
- message: "Have you contacted louis030195 on Discord before proceeding?",
- initialValue: false
- });
- if (p4.isCancel(confirmed) || !confirmed) {
- p4.cancel(
- "Please contact louis030195 on Discord before publishing your pipe."
- );
- process.exit(0);
- }
- if (opts.paid && opts.price == null) {
- handleError(
- "error: price is required for paid pipes, i.e., --price <amount>"
- );
- }
- if (opts.paid && opts.price <= 0) {
- handleError("error: price must be positive for paid pipes");
- }
- try {
- const apiKey = Credentials.getApiKey();
- if (!apiKey) {
- handleError(
- symbols.error + " not logged in. please login first using" + colors.highlight("screenpipe login")
- );
- }
- const isPaid = opts.paid || false;
- const price = opts.price;
- let description = null;
- try {
- const readmeContent = fs2.readFileSync("README.md", "utf-8");
- if (readmeContent) {
- description = readmeContent;
- }
- } catch (error) {
- logger.warn(
- `${symbols.arrow} no README.md found, required for description`
- );
- }
- const response = await fetch(`${API_BASE_URL}/api/plugins/create`, {
- method: "POST",
- headers: {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- name: opts.name,
- description,
- is_paid: isPaid,
- price: isPaid ? price : null,
- source_url: opts.source,
- discord_handle: opts.discord
- })
- });
- if (!response.ok) {
- const errorData = await response.json();
- handleError(errorData.error || "failed to create plugin");
- }
- logger.success(
- `
-${symbols.success} successfully created pipe: ${colors.highlight(
- opts.name
- )}`
- );
- logger.info(`
-${symbols.info} plugin details:`);
- console.log(colors.listItem(`${colors.label("name")} ${opts.name}`));
- console.log(
- colors.listItem(
- `${colors.label("type")} ${isPaid ? `paid ($${price})` : "free"}`
- )
- );
- console.log(colors.listItem(`${colors.label("source")} ${opts.source}`));
- console.log(
- colors.listItem(`${colors.label("discord")} ${opts.discord}`)
- );
- p4.outro(`Successfully registered your pipe! \u{1F389}`);
- } catch (error) {
- if (error instanceof Error) {
- handleError(`
-${symbols.error} creating failed: ${error.message}`);
- } else {
- handleError(`
-${symbols.error} creating failed with unexpected error`);
- }
- }
-});
-
-// src/commands/pipe/publish.ts
-import fs3 from "fs";
-import path2 from "path";
-import archiver from "archiver";
-import crypto from "crypto";
-import ignore from "ignore";
-import { Command as Command4 } from "commander";
-import http2 from "http";
-import https from "https";
-import { URL as URL2 } from "url";
-import { execSync } from "child_process";
-var NEXTJS_FILES = {
- required: ["package.json", ".next"],
- optional: [
- "package-lock.json",
- "bun.lockb",
- "next.config.js",
- "next.config.mjs"
- ]
-};
-var MAX_FILE_SIZE = 500 * 1024 * 1024;
-async function archiveNextJsProject(archive) {
- const { required, optional } = NEXTJS_FILES;
- const missingFiles = required.filter((file) => !fs3.existsSync(file));
- if (missingFiles.length > 0) {
- throw new Error(
- `Required files not found: ${missingFiles.join(", ")}. Make sure you're in the correct directory and the project is built.`
- );
- }
- for (const file of required) {
- if (file === ".next") {
- archive.directory(".next", ".next", (entry) => {
- return entry.name.startsWith(".next/cache/") ? false : entry;
- });
- } else {
- archive.file(file, { name: file });
- }
- }
- optional.filter((file) => fs3.existsSync(file)).forEach((file) => {
- archive.file(file, { name: file });
- });
-}
-function archiveStandardProject(archive, ig) {
- archive.glob("**/*", {
- ignore: [".git/**", "node_modules/**", ".next/cache/**"],
- dot: true,
- nodir: false,
- mark: true
- });
-}
-async function httpRequest(url2, method, data, headers, onProgress, verbose = false) {
- const MAX_RETRIES = 10;
- const INITIAL_DELAY = 1e3;
- const parsedUrl = new URL2(url2);
- const isHttps = parsedUrl.protocol === "https:";
- const requestModule = isHttps ? https : http2;
- let bodyData = data;
- if (data && typeof data === "object" && !(data instanceof Buffer)) {
- bodyData = JSON.stringify(data);
- headers = { ...headers, "Content-Type": "application/json" };
- }
- if (bodyData) {
- const contentLength = Buffer.isBuffer(bodyData) ? bodyData.length : Buffer.byteLength(bodyData, "utf8");
- headers = { ...headers, "Content-Length": contentLength.toString() };
- if (verbose) {
- console.log(
- colors.dim(`${symbols.arrow} setting content-length: ${contentLength}`)
- );
- }
- }
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
- try {
- if (attempt > 1) {
- console.log(
- colors.dim(
- `${symbols.arrow} retry attempt ${attempt}/${MAX_RETRIES}...`
- )
- );
- }
- const result = await new Promise((resolve, reject) => {
- const requestOptions = {
- method,
- hostname: parsedUrl.hostname,
- port: parsedUrl.port || (isHttps ? 443 : 80),
- path: parsedUrl.pathname + parsedUrl.search,
- headers
- };
- if (verbose && attempt === 1) {
- console.log(
- colors.dim(
- `${symbols.arrow} request options: ${JSON.stringify(
- {
- method,
- url: parsedUrl.toString(),
- headers
- },
- null,
- 2
- )}`
- )
- );
- }
- const req = requestModule.request(requestOptions, (res) => {
- const chunks = [];
- let receivedLength = 0;
- res.on("data", (chunk) => {
- chunks.push(chunk);
- receivedLength += chunk.length;
- });
- res.on("end", () => {
- const responseData = Buffer.concat(chunks);
- if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
- resolve({
- statusCode: res.statusCode,
- headers: res.headers,
- data: responseData
- });
- } else {
- let errorMessage = `HTTP error ${res.statusCode}`;
- try {
- const contentType = res.headers["content-type"] || "";
- if (contentType.includes("json")) {
- errorMessage += `: ${responseData.toString("utf8")}`;
- } else if (contentType.includes("xml")) {
- const xmlString = responseData.toString("utf8");
- console.log(
- colors.dim(
- `${symbols.arrow} error response (XML): ${xmlString}`
- )
- );
- const errorCodeMatch = xmlString.match(/<Code>(.*?)<\/Code>/);
- const errorMessageMatch = xmlString.match(
- /<Message>(.*?)<\/Message>/
- );
- if (errorCodeMatch && errorMessageMatch) {
- errorMessage += `: ${errorCodeMatch[1]} - ${errorMessageMatch[1]}`;
- }
- } else if (contentType.includes("text")) {
- errorMessage += `: ${responseData.toString("utf8")}`;
- }
- } catch (e) {
- }
- reject(new Error(errorMessage));
- }
- });
- });
- req.on("error", (error) => {
- reject(error);
- });
- if (onProgress && method === "PUT" && bodyData) {
- let uploadedBytes = 0;
- const totalBytes = Buffer.isBuffer(bodyData) ? bodyData.length : Buffer.byteLength(bodyData, "utf8");
- const originalWrite = req.write;
- req.write = function(chunk, encoding, callback) {
- const result2 = originalWrite.call(this, chunk, encoding, callback);
- if (Buffer.isBuffer(chunk)) {
- uploadedBytes += chunk.length;
- } else if (typeof chunk === "string") {
- uploadedBytes += Buffer.byteLength(
- chunk,
- encoding
- );
- }
- onProgress(uploadedBytes, totalBytes);
- return result2;
- };
- }
- if (bodyData) {
- req.write(bodyData);
- }
- req.end();
- });
- return result;
- } catch (error) {
- if (error instanceof Error && error.message.includes("400") && (error.message.includes("already exists") || error.message.includes("Version") || error.message.includes("version"))) {
- console.log(
- colors.dim(
- `${symbols.arrow} detected version conflict, not retrying with same version`
- )
- );
- throw error;
- }
- if (attempt === MAX_RETRIES) {
- throw error;
- }
- console.log(
- colors.dim(
- `${symbols.arrow} request failed (attempt ${attempt}/${MAX_RETRIES}): ${error instanceof Error ? error.message : "unknown error"}`
- )
- );
- const delay = INITIAL_DELAY * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5);
- console.log(
- colors.dim(
- `${symbols.arrow} waiting ${Math.round(delay)}ms before retry...`
- )
- );
- await new Promise((resolve) => setTimeout(resolve, delay));
- }
- }
- throw new Error("Max retries exceeded");
-}
-function runBuildCommand() {
- logger.info(
- colors.info(
- `
-${symbols.info} Project needs to be built. Running build command...`
- )
- );
- try {
- const packageJson = JSON.parse(fs3.readFileSync("package.json", "utf-8"));
- if (packageJson.scripts && packageJson.scripts.build) {
- try {
- logger.log(colors.dim(`${symbols.arrow} Executing: bun run build`));
- execSync("bun run build", { stdio: "inherit" });
- } catch (error) {
- logger.log(
- colors.dim(`${symbols.arrow} Bun not available, trying npm instead`)
- );
- execSync("npm run build", { stdio: "inherit" });
- }
- logger.success(`${symbols.success} Build completed successfully`);
- } else {
- throw new Error("No build script found in package.json");
- }
- } catch (error) {
- if (error instanceof Error) {
- throw new Error(`Failed to build project: ${error.message}`);
- }
- throw new Error("Failed to build project");
- }
-}
-function bumpVersion(version, type = "patch") {
- console.log(colors.dim(`${symbols.arrow} bumping version from ${version}`));
- const [major, minor, patch] = version.split(".").map(Number);
- let newVersion;
- if (type === "patch") newVersion = `${major}.${minor}.${patch + 1}`;
- else if (type === "minor") newVersion = `${major}.${minor + 1}.0`;
- else if (type === "major") newVersion = `${major + 1}.0.0`;
- else newVersion = `${major}.${minor}.${patch + 1}`;
- console.log(colors.dim(`${symbols.arrow} new version: ${newVersion}`));
- return newVersion;
-}
-function updatePackageVersion(newVersion) {
- const packageJsonPath = path2.join(process.cwd(), "package.json");
- const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
- packageJson.version = newVersion;
- fs3.writeFileSync(
- packageJsonPath,
- JSON.stringify(packageJson, null, 2) + "\n"
- );
-}
-var publishCommand = new Command4("publish").description("publish or update a pipe to the store").requiredOption("-n, --name <name>", "name of the pipe").option("-v, --verbose", "enable verbose logging", false).option(
- "--skip-build-check",
- "skip checking if the project has been built",
- false
-).option("--build", "automatically run the build command if needed", false).action(async (opts) => {
- try {
- if (opts.verbose) {
- console.log(colors.dim(`${symbols.arrow} starting publish command...`));
- }
- const apiKey = Credentials.getApiKey();
- if (!apiKey) {
- console.error(
- colors.error(
- `${symbols.error} not logged in. please login first using ${colors.highlight(
- "screenpipe login"
- )}`
- )
- );
- process.exit(1);
- }
- if (!opts.skipBuildCheck) {
- try {
- runBuildCommand();
- } catch (error) {
- if (error instanceof Error) {
- console.error(colors.error(`${symbols.error} ${error.message}`));
- process.exit(1);
- }
- }
- }
- if (opts.verbose) {
- console.log(colors.dim(`${symbols.arrow} reading package.json...`));
- }
- let packageJson;
- try {
- packageJson = JSON.parse(fs3.readFileSync("package.json", "utf-8"));
- } catch (error) {
- console.error(
- colors.error(
- `${symbols.error} failed to read package.json. Make sure you're in the correct directory.`
- )
- );
- process.exit(1);
- }
- if (!packageJson.name || !packageJson.version) {
- console.error(
- colors.error(
- `${symbols.error} package name and version are required in package.json`
- )
- );
- process.exit(1);
- }
- logger.info(
- colors.info(
- `
-${symbols.info} publishing ${colors.highlight(
- packageJson.name
- )} v${packageJson.version}...`
- )
- );
- logger.log(colors.dim(`${symbols.arrow} creating package archive...`));
- let zipPath = path2.join(
- process.cwd(),
- `${packageJson.name}-${packageJson.version}.zip`
- );
- const output = fs3.createWriteStream(zipPath);
- const archive = archiver("zip", { zlib: { level: 9 } });
- const ig = ignore();
- if (fs3.existsSync(".gitignore")) {
- ig.add(fs3.readFileSync(".gitignore").toString());
- }
- const isNextProject = fs3.existsSync("next.config.js") || fs3.existsSync("next.config.mjs") || fs3.existsSync("next.config.ts");
- archive.pipe(output);
- if (isNextProject) {
- await archiveNextJsProject(archive);
- } else {
- archiveStandardProject(archive, ig);
- }
- await new Promise((resolve, reject) => {
- output.on("close", resolve);
- archive.on("error", reject);
- archive.finalize();
- });
- if (opts.verbose) {
- console.log(
- colors.dim(
- `${symbols.arrow} detected project type: ${isNextProject ? "nextjs" : "standard"}`
- )
- );
- console.log(
- colors.dim(`${symbols.arrow} starting archive creation...`)
- );
- }
- let fileBuffer = fs3.readFileSync(zipPath);
- const hashSum = crypto.createHash("sha256");
- hashSum.update(fileBuffer);
- let fileHash = hashSum.digest("hex");
- let fileSize = fs3.statSync(zipPath).size;
- if (fileSize > MAX_FILE_SIZE) {
- console.error(
- colors.error(
- `${symbols.error} Package size (${(fileSize / 1024 / 1024).toFixed(
- 2
- )}MB) exceeds maximum allowed size (${MAX_FILE_SIZE / 1024 / 1024}MB)`
- )
- );
- fs3.unlinkSync(zipPath);
- process.exit(1);
- }
- let description = null;
- try {
- const readmeContent = fs3.readFileSync("README.md", "utf-8");
- if (readmeContent) {
- description = readmeContent;
- }
- } catch (error) {
- console.log(
- colors.dim(
- `${symbols.arrow} No README.md found, required for description`
- )
- );
- }
- if (!description) {
- console.error(colors.error(`${symbols.error} Description is required`));
- process.exit(1);
- }
- if (opts.verbose) {
- console.log(colors.dim(`${symbols.arrow} calculating file hash...`));
- }
- try {
- console.log(colors.dim(`${symbols.arrow} getting upload URL...`));
- console.log(
- colors.dim(
- `${symbols.arrow} requesting URL from: ${API_BASE_URL}/api/plugins/publish`
- )
- );
- let urlResponse;
- try {
- const response = await httpRequest(
- `${API_BASE_URL}/api/plugins/publish`,
- "POST",
- {
- name: opts.name,
- version: packageJson.version,
- fileSize,
- fileHash,
- description,
- useS3: true
- },
- {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- },
- opts.verbose
- );
- urlResponse = { data: JSON.parse(response.data.toString("utf8")) };
- console.log(colors.dim(`${symbols.arrow} storage provider: S3`));
- console.log(
- colors.dim(
- `${symbols.arrow} url response status: ${response.statusCode}`
- )
- );
- } catch (error) {
- console.log(
- colors.dim(
- `${symbols.arrow} server error details: ${error instanceof Error ? error.message : "unknown error"}`
- )
- );
- if (error instanceof Error && (error.message.includes("already exists") || error.message.includes("Version") || error.message.includes("version"))) {
- console.log(
- colors.dim(
- `${symbols.arrow} detected version conflict, preparing to bump version`
- )
- );
- const readline = __require("readline").createInterface({
- input: process.stdin,
- output: process.stdout
- });
- const newVersion = bumpVersion(packageJson.version);
- const question = `
-${symbols.info} ${colors.info(
- `Version ${packageJson.version} already exists.`
- )}
-${colors.info(
- `Would you like to bump to version ${newVersion} and continue? (y/n): `
- )}`;
- const answer = await new Promise((resolve) => {
- readline.question(question, (ans) => {
- readline.close();
- resolve(ans.toLowerCase());
- });
- });
- if (answer === "y" || answer === "yes") {
- updatePackageVersion(newVersion);
- logger.success(
- `${symbols.success} Updated package.json to version ${newVersion}`
- );
- packageJson.version = newVersion;
- if (fs3.existsSync(zipPath)) {
- fs3.unlinkSync(zipPath);
- if (opts.verbose) {
- console.log(
- colors.dim(`${symbols.arrow} cleaned up old zip file`)
- );
- }
- }
- try {
- logger.info(
- colors.info(
- `
-${symbols.info} Rebuilding project with new version ${newVersion}...`
- )
- );
- runBuildCommand();
- } catch (error2) {
- if (error2 instanceof Error) {
- console.error(
- colors.error(`${symbols.error} ${error2.message}`)
- );
- process.exit(1);
- }
- }
- zipPath = path2.join(
- process.cwd(),
- `${packageJson.name}-${newVersion}.zip`
- );
- const newOutput = fs3.createWriteStream(zipPath);
- const newArchive = archiver("zip", { zlib: { level: 9 } });
- newArchive.pipe(newOutput);
- logger.log(
- colors.dim(
- `${symbols.arrow} creating new package archive with version ${newVersion}...`
- )
- );
- if (isNextProject) {
- await archiveNextJsProject(newArchive);
- } else {
- archiveStandardProject(newArchive, ig);
- }
- await new Promise((resolve, reject) => {
- newOutput.on("close", resolve);
- newArchive.on("error", reject);
- newArchive.finalize();
- });
- fileBuffer = fs3.readFileSync(zipPath);
- const newHashSum = crypto.createHash("sha256");
- newHashSum.update(fileBuffer);
- fileHash = newHashSum.digest("hex");
- fileSize = fs3.statSync(zipPath).size;
- if (opts.verbose) {
- console.log(
- colors.dim(`${symbols.arrow} new archive created: ${zipPath}`)
- );
- console.log(
- colors.dim(
- `${symbols.arrow} new file size: ${fileSize} bytes`
- )
- );
- console.log(
- colors.dim(`${symbols.arrow} new file hash: ${fileHash}`)
- );
- }
- console.log(
- colors.dim(
- `${symbols.arrow} retrying with new version: ${newVersion}`
- )
- );
- const response = await httpRequest(
- `${API_BASE_URL}/api/plugins/publish`,
- "POST",
- {
- name: opts.name,
- version: newVersion,
- fileSize,
- fileHash,
- description,
- useS3: true
- },
- {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- },
- void 0,
- opts.verbose
- );
- urlResponse = {
- data: JSON.parse(response.data.toString("utf8"))
- };
- } else {
- throw new Error(
- `Publishing canceled. Please update the version manually in package.json.`
- );
- }
- } else {
- throw error;
- }
- }
- const { uploadUrl, path: storagePath } = urlResponse.data;
- console.log(
- colors.dim(
- `${symbols.arrow} received upload URL: ${uploadUrl.substring(
- 0,
- 50
- )}...`
- )
- );
- console.log(
- colors.dim(`${symbols.arrow} storage path: ${storagePath}`)
- );
- console.log(
- colors.dim(`${symbols.arrow} file size: ${fileSize} bytes`)
- );
- let currentUploadUrl = uploadUrl;
- let currentStoragePath = storagePath;
- logger.log(colors.dim(`${symbols.arrow} uploading to storage...`));
- console.log(
- colors.dim(`${symbols.arrow} starting upload with native http...`)
- );
- console.log(
- colors.dim(
- `${symbols.arrow} upload file size: ${(fileSize / (1024 * 1024)).toFixed(2)} MB`
- )
- );
- const progressBar = {
- current: 0,
- total: fileSize,
- width: 40,
- update(loaded, total) {
- const percent = Math.floor(loaded / total * 100);
- const filledWidth = Math.floor(loaded / total * this.width);
- const emptyWidth = this.width - filledWidth;
- if (percent > this.current) {
- this.current = percent;
- process.stdout.write("\r");
- const bar = "\u2588".repeat(filledWidth) + "\u2591".repeat(emptyWidth);
- const loadedSize = (loaded / (1024 * 1024)).toFixed(2);
- const totalSize = (total / (1024 * 1024)).toFixed(2);
- process.stdout.write(
- `${colors.dim(`${symbols.arrow} uploading: [`)}${colors.info(
- bar
- )}${colors.dim(`] ${percent}%`)} ${colors.dim(
- `(${loadedSize}/${totalSize} MB)`
- )}`
- );
- }
- },
- complete() {
- process.stdout.write("\n");
- logger.success(`${symbols.success} upload completed successfully`);
- }
- };
- const uploadResponse = await httpRequest(
- currentUploadUrl,
- "PUT",
- fileBuffer,
- {
- "Content-Type": "application/zip",
- "Content-Length": fileSize.toString()
- },
- (loaded, total) => progressBar.update(loaded, total),
- opts.verbose
- );
- progressBar.complete();
- console.log(
- colors.dim(
- `${symbols.arrow} upload completed with status: ${uploadResponse.statusCode}`
- )
- );
- console.log(
- colors.dim(`${symbols.arrow} waiting for S3 to process the upload...`)
- );
- await new Promise((resolve) => setTimeout(resolve, 5e3));
- logger.log(
- colors.dim(`${symbols.arrow} finalizing upload with S3 storage...`)
- );
- console.log(
- colors.dim(
- `${symbols.arrow} sending finalize request to: ${API_BASE_URL}/api/plugins/publish/finalize`
- )
- );
- const finalizeResponse = await httpRequest(
- `${API_BASE_URL}/api/plugins/publish/finalize`,
- "POST",
- {
- name: opts.name,
- version: packageJson.version,
- fileHash,
- storagePath: currentStoragePath,
- description,
- fileSize
- },
- {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
- },
- void 0,
- opts.verbose
- );
- console.log(
- colors.dim(
- `${symbols.arrow} finalize response status: ${finalizeResponse.statusCode}`
- )
- );
- const finalizeData = JSON.parse(finalizeResponse.data.toString("utf8"));
- console.log(
- colors.dim(
- `${symbols.arrow} finalize response data: ${JSON.stringify(
- finalizeData
- )}`
- )
- );
- logger.success(`
-${symbols.success} successfully published plugin!`);
- console.log(
- colors.listItem(`${colors.label("name")} ${packageJson.name}`)
- );
- console.log(
- colors.listItem(`${colors.label("version")} ${packageJson.version}`)
- );
- console.log(
- colors.listItem(
- `${colors.label("size")} ${(fileSize / 1024).toFixed(2)} KB`
- )
- );
- if (finalizeData.message) {
- logger.info(`
-${symbols.info} ${finalizeData.message}`);
- }
- if (fs3.existsSync(zipPath)) {
- if (opts.verbose) {
- console.log(
- colors.dim(`${symbols.arrow} cleaning up zip file: ${zipPath}`)
- );
- }
- fs3.unlinkSync(zipPath);
- }
- } catch (error) {
- console.error(
- colors.error(
- `${symbols.error} ${error instanceof Error ? error.message : "unknown error"}`
- )
- );
- if (zipPath && fs3.existsSync(zipPath)) {
- if (opts.verbose) {
- console.log(
- colors.dim(
- `${symbols.arrow} cleaning up zip file after error: ${zipPath}`
- )
- );
- }
- fs3.unlinkSync(zipPath);
- }
- process.exit(1);
- }
- } catch (error) {
- console.error(
- colors.error(
- `${symbols.error} ${error instanceof Error ? error.message : "unknown error"}`
- )
- );
- process.exit(1);
- }
-});
-
-// src/commands/pipe/list-versions.ts
-import { Command as Command5 } from "commander";
-var listVersionsCommand = new Command5().name("list-versions").description("List all versions of a pipe").requiredOption("--name <name>", "name of the pipe").action(async (opts) => {
- try {
- const response = await fetch(
- `${API_BASE_URL}/api/plugins/list-versions`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${Credentials.getApiKey()}`,
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- name: opts.name
- })
- }
- );
- if (!response.ok) {
- const error = await response.json();
- throw new Error(`failed to list versions ${error.error}`);
- }
- const data = await response.json();
- console.log(colors.header(`plugin Information`));
- console.log(colors.listItem(`${colors.label("Name")} ${opts.name}`));
- console.log(colors.listItem(`${colors.label("ID")} ${data.plugin_id}`));
- console.log(colors.header("version History"));
- data.versions.forEach((version) => {
- const status = version.status === "published" ? colors.success(version.status) : colors.warning(version.status);
- console.log(
- colors.primary(
- `
- ${symbols.arrow} version ${colors.bold(
- version.version
- )} ${colors.dim(`(${status})`)}`
- )
- );
- console.log(
- colors.listItem(
- `${colors.label("created")} ${new Date(
- version.created_at
- ).toLocaleString()}`
- )
- );
- console.log(
- colors.listItem(
- `${colors.label("size")} ${(version.file_size / 1024).toFixed(
- 2
- )} KB`
- )
- );
- console.log(
- colors.listItem(
- `${colors.label("hash")} ${colors.dim(version.file_hash)}`
- )
- );
- if (version.changelog) {
- console.log(
- colors.listItem(`${colors.label("changelog")} ${version.changelog}`)
- );
- }
- });
- } catch (error) {
- if (error instanceof Error) {
- handleError(
- `
-${symbols.error} list versions failed: ${error.message}`
- );
- } else {
- handleError(
- `
-${symbols.error} list versions failed with unexpected error`
- );
- }
- }
-});
-
-// src/commands/pipe/create.ts
-import fs4 from "fs-extra";
-import path3 from "path";
-import * as p5 from "@clack/prompts";
-import chalk3 from "chalk";
-import { Command as Command6 } from "commander";
-import { extract } from "tar-stream";
-import { createGunzip } from "zlib";
-import { Readable } from "stream";
-process.removeAllListeners("warning");
-var PIPE_ADDITIONS = {
- dependencies: {
- "@screenpipe/js": "latest"
- },
- devDependencies: {
- "bun-types": "latest"
- }
-};
-async function downloadAndExtractSubdir(subdir, destPath) {
- const tempDir = path3.join(destPath, "_temp");
- const s = p5.spinner();
- try {
- s.start("preparing to download template...");
- await fs4.ensureDir(destPath);
- await fs4.ensureDir(tempDir);
- s.message("downloading template files...");
- const repoOwner = "mediar-ai";
- const repoName = "screenpipe";
- const branch = "main";
- const tarballUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/tarball/${branch}`;
- const response = await fetch(tarballUrl);
- if (!response.ok) {
- throw new Error(`Failed to download template: ${response.statusText}`);
- }
- const arrayBuffer = await response.arrayBuffer();
- const buffer = Buffer.from(arrayBuffer);
- s.message("extracting template files...");
- const extractedDirName = await extractTarball(buffer, tempDir, subdir);
- s.message("checking template directory...");
- const sourcePath = path3.join(tempDir, extractedDirName, subdir);
- if (!await fs4.pathExists(sourcePath)) {
- throw new Error(`template directory '${subdir}' not found in repository`);
- }
- s.message("copying template files to destination...");
- await fs4.copy(sourcePath, destPath);
- s.message("cleaning up temporary files...");
- await fs4.remove(tempDir);
- s.stop("template downloaded and extracted successfully!");
- } catch (error) {
- if (await fs4.pathExists(tempDir)) {
- s.message("cleaning up after error...");
- await fs4.remove(tempDir);
- }
- s.stop("download failed!");
- throw new Error(`failed to setup pipe: ${error.message}`);
- }
-}
-async function extractTarball(buffer, tempDir, targetSubdir) {
- return new Promise((resolve, reject) => {
- const extractor = extract();
- let extractedDirName = "";
- extractor.on("entry", async (header, stream, next) => {
- const parts = header.name.split("/");
- if (parts.length > 0 && !extractedDirName) {
- extractedDirName = parts[0];
- }
- if (header.name.includes(`/${targetSubdir}/`) || header.name.endsWith(`/${targetSubdir}`)) {
- const resolvedPath = path3.resolve(tempDir, header.name);
- if (!resolvedPath.startsWith(tempDir)) {
- console.warn(`Skipping potentially unsafe path: ${header.name}`);
- stream.resume();
- return next();
- }
- const filePath = resolvedPath;
- if (header.type === "directory") {
- await fs4.ensureDir(filePath);
- stream.resume();
- } else {
- await fs4.ensureDir(path3.dirname(filePath));
- stream.pipe(fs4.createWriteStream(filePath));
- }
- } else {
- stream.resume();
- }
- stream.on("end", next);
- });
- extractor.on("finish", () => {
- if (!extractedDirName) {
- reject(new Error("Could not determine extracted directory name"));
- } else {
- resolve(extractedDirName);
- }
- });
- extractor.on("error", reject);
- const bufferStream = Readable.from(buffer);
- bufferStream.pipe(createGunzip()).pipe(extractor);
- });
-}
-var createPipeCommand = new Command6().name("create").description("create a new pipe").action(async () => {
- p5.intro(chalk3.bold("\nwelcome to screenpipe!\n"));
- const pipeNameInput = await p5.text({
- message: "what is your pipe name?",
- placeholder: "my-screenpipe",
- validate: (value) => {
- if (value.trim().length === 0) return "pipe name is required";
- return void 0;
- }
- });
- if (p5.isCancel(pipeNameInput)) {
- p5.cancel("operation cancelled");
- process.exit(1);
- }
- const pipeName = pipeNameInput;
- const directoryInput = await p5.text({
- message: "where would you like to create your pipe?",
- placeholder: pipeName,
- validate: (value) => {
- if (value.trim().length === 0) return "directory is required";
- return void 0;
- }
- });
- if (p5.isCancel(directoryInput)) {
- p5.cancel("operation cancelled");
- process.exit(1);
- }
- const directory = directoryInput;
- const s = p5.spinner();
- s.start("creating your pipe...");
- try {
- const absoluteDirectory = path3.resolve(process.cwd(), directory);
- await downloadAndExtractSubdir("pipes/example-pipe", absoluteDirectory);
- const pkgPath = path3.join(absoluteDirectory, "package.json");
- const pkg = await fs4.readJson(pkgPath);
- pkg.name = pipeName;
- pkg.dependencies = {
- ...pkg.dependencies,
- ...PIPE_ADDITIONS.dependencies
- };
- pkg.devDependencies = {
- ...pkg.devDependencies,
- ...PIPE_ADDITIONS.devDependencies
- };
- await fs4.writeJson(pkgPath, pkg, { spaces: 2 });
- s.stop(chalk3.green(`> pipe created successfully!`));
- console.log("\nto get started:");
- console.log(chalk3.cyan(`cd ${absoluteDirectory}`));
- console.log(
- chalk3.cyan("bun install # or use: npm install, pnpm install, yarn")
- );
- console.log(
- chalk3.cyan("bun dev # or use: npm run dev, pnpm dev, yarn dev")
- );
- console.log(
- "\nwhen you're ready, you can ship your pipe to the app by adding it to the pipe store using the UI and then send a PR to the main repo.\n"
- );
- } catch (error) {
- s.stop("failed to create pipe");
- handleError(error);
- }
-});
-
-// src/commands/pipe/index.ts
-var pipeCommands = new Command7().name("pipe").description("create and manage pipes");
-pipeCommands.addCommand(createPipeCommand);
-pipeCommands.addCommand(registerCommand);
-pipeCommands.addCommand(publishCommand);
-pipeCommands.addCommand(listVersionsCommand);
-
-// src/commands/app/index.ts
-import { Command as Command9 } from "commander";
-
-// src/commands/app/create.ts
-import * as p6 from "@clack/prompts";
-import { Command as Command8 } from "commander";
-import simpleGit from "simple-git";
-var TEMPLATE_REPOS = {
- electron: "https://github.com/neo773/screenpipe-electron",
- tauri: "https://github.com/LorenzoBloedow/screenpipe-tauri-template-dev"
-};
-var createAppCommand = new Command8().name("create").description("create a new desktop app project").option("-a, --name <name>", "the name of your app (optional)").option("-t, --appType <type>", "the type of desktop app (electron or tauri)").action(async (options) => {
- let { name, appType } = options;
- if (!appType) {
- try {
- appType = await p6.select({
- message: "what type of desktop app would you like to create?",
- options: [
- { value: "electron", label: "electron" },
- { value: "tauri", label: "tauri" }
- ]
- });
- if (p6.isCancel(appType)) {
- p6.cancel("operation cancelled");
- process.exit(1);
- }
- } catch (error) {
- handleError(error);
- }
- }
- if (!name || name.length === 0) {
- try {
- name = await p6.text({
- message: "what is your project name?",
- placeholder: "my-desktop-app",
- validate: (input) => {
- if (input.trim().length === 0) return "project name is required.";
- return;
- }
- });
- if (p6.isCancel(name)) {
- p6.cancel("operation cancelled");
- process.exit(1);
- }
- } catch (error) {
- handleError(error);
- }
- }
- const loadingSpinner = spinner2("creating your desktop app...");
- try {
- await simpleGit().clone(
- TEMPLATE_REPOS[appType],
- name
- );
- loadingSpinner.succeed(`> project created successfully! \u{1F389}`);
- logger.info("\ncredits to the template authors:");
- if (appType === "electron") {
- logger.info("electron template by: Neo @ https://github.com/neo773");
- } else {
- logger.info(
- "tauri template by: Lorenzo @ https://github.com/LorenzoBloedow"
- );
- }
- logger.info("\nto get started:");
- logger.info(`cd ${name}`);
- logger.info("npm install # or bun install, pnpm install, yarn");
- logger.info("npm run dev # or bun dev, pnpm dev, yarn dev");
- logger.info(
- "\nwhen you're ready, you can deploy your app following the documentation for the respective framework.\n"
- );
- } catch (error) {
- loadingSpinner.failed("failed to create project");
- handleError(error instanceof Error ? error.message : String(error));
- }
-});
-
-// src/commands/app/index.ts
-var appCommands = new Command9().name("app").description("create a new screenpipe application using default templates");
-appCommands.addCommand(createAppCommand);
-
-// src/commands/components/commands/add/utils/prompt-for-component.ts
-import { z as z4 } from "zod";
-import * as p7 from "@clack/prompts";
-
-// src/commands/components/commands/add/registry/schema.ts
-import { z as z3 } from "zod";
-var registryComponentSchema = z3.object({
- name: z3.string(),
- src: z3.string(),
- internal: z3.boolean().optional(),
- docs: z3.string().optional(),
- target: z3.string(),
- dependencies: z3.array(z3.string()).optional(),
- registryDependencies: z3.array(z3.string()).optional(),
- devDependencies: z3.array(z3.string()).optional(),
- shadcnComponent: z3.array(z3.string()).optional()
-});
-var registrySchema = z3.record(z3.string(), registryComponentSchema);
-var registryResolvedComponentsTreeSchema = registryComponentSchema.pick({
- dependencies: true,
- devDependencies: true,
- docs: true,
- shadcnComponent: true
-}).merge(
- z3.object({
- files: z3.array(z3.object({
- src: z3.string(),
- target: z3.string()
- }))
- })
-);
-
-// src/commands/components/commands/add/registry/registry.json
-var registry_default = {
- "use-health": {
- name: "use-health",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/lib/hooks/use-health-check.tsx",
- target: "./src/hooks/use-health.tsx",
- dependencies: [
- "lodash"
- ],
- devDependencies: [
- "@types/lodash"
- ]
- },
- "update-pipe-config": {
- name: "update-pipe-config",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/lib/actions/update-pipe-config.ts",
- target: "./src/lib/actions/update-pipe-config.tsx",
- dependencies: [
- "@screenpipe/browser"
- ],
- registryDependencies: [
- "types"
- ]
- },
- "use-pipe-settings": {
- name: "use-pipe-settings",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/lib/hooks/use-pipe-settings.tsx",
- target: "./src/lib/hooks/use-pipe-settings.ts",
- dependencies: [
- "@screenpipe/browser"
- ],
- registryDependencies: [
- "get-screenpipe-app-settings",
- "types",
- "use-settings"
- ]
- },
- "get-screenpipe-app-settings": {
- name: "get-screenpipe-app-settings",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/lib/actions/get-screenpipe-app-settings.ts",
- target: "./src/lib/actions/get-screenpipe-app-settings.ts",
- dependencies: [
- "@screenpipe/js"
- ],
- registryDependencies: []
- },
- types: {
- name: "types",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/obsidian/src/lib/types.ts",
- target: "./src/lib/types.ts",
- dependencies: [
- "@screenpipe/js"
- ],
- registryDependencies: []
- },
- "use-sql-autocomplete": {
- name: "use-sql-autocomplete",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/screenpipe-app-tauri/components/sql-autocomplete-input.tsx",
- target: "./src/hooks/use-sql-autocomplete.ts"
- },
- "sql-autocomplete-input": {
- name: "sql-autocomplete-input",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/screenpipe-app-tauri/components/sql-autocomplete-input.tsx",
- target: "./src/components/sql-autocomplete-input.ts",
- dependencies: [
- "cmdk",
- "lucide-react"
- ],
- registryDependencies: [
- "use-sql-autocomplete"
- ]
- },
- "use-ai-provider": {
- name: "use-ai-provider",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/search/src/lib/hooks/use-ai-provider.tsx",
- target: "./src/hooks/use-ai-provider.tsx",
- dependencies: [
- "@screenpipe/browser"
- ],
- registryDependencies: [],
- devDependencies: []
- },
- "ai-presets-selector": {
- name: "ai-presets-selector",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/components/ai-presets-selector.tsx",
- target: "./src/components/ai-presets-selector.tsx",
- registryDependencies: [
- "use-pipe-settings",
- "use-settings"
- ],
- shadcnComponent: [
- "button",
- "command",
- "dialog",
- "popover",
- "tooltip",
- "input",
- "label",
- "select",
- "textarea",
- "slider",
- "sonner"
- ]
- },
- "ai-presets-dialog": {
- name: "ai-presets-dialog",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/components/ai-presets-dialog.tsx",
- target: "./src/components/ai-presets-dialog.tsx",
- registryDependencies: [
- "use-pipe-settings",
- "use-settings"
- ],
- shadcnComponent: [
- "button",
- "command",
- "dialog",
- "tooltip",
- "input",
- "label",
- "select",
- "textarea",
- "slider",
- "sonner"
- ]
- },
- "use-settings": {
- name: "use-settings",
- src: "https://api.github.com/repos/mediar-ai/screenpipe/contents/pipes/example-pipe/lib/hooks/use-settings.tsx",
- target: "./src/lib/hooks/use-settings.ts",
- dependencies: [
- "@screenpipe/browser"
- ],
- registryDependencies: [
- "get-screenpipe-app-settings"
- ]
- }
-};
-
-// src/commands/components/commands/add/registry/api.ts
-import deepmerge from "deepmerge";
-function getRegistry() {
- try {
- const parsedRegistry = registrySchema.parse(registry_default);
- return parsedRegistry;
- } catch (error) {
- logger.break();
- handleError(error);
- }
-}
-function resolveRegistryItems(names) {
- let registryDependencies = {};
- const registry = getRegistry();
- if (!registry) return;
- for (const name of names) {
- const itemRegistryDependencies = resolveRegistryDependencies(
- name,
- registry
- );
- registryDependencies = {
- ...registryDependencies,
- ...itemRegistryDependencies
- };
- }
- return registryDependencies;
-}
-function resolveRegistryDependencies(name, registry) {
- const components = {};
- function resolveDependencies(componentName) {
- if (registry[componentName]) {
- components[componentName] = registry[componentName];
- } else {
- logger.break();
- handleError(
- `Component ${componentName} not found.`
- );
- }
- if (registry[componentName].registryDependencies) {
- for (const dependency of registry[componentName].registryDependencies) {
- resolveDependencies(dependency);
- }
- }
- }
- resolveDependencies(name);
- return components;
-}
-function registryResolveItemsTree(names) {
- let relevantItemsRegistry = resolveRegistryItems(names);
- const payload = registrySchema.parse(relevantItemsRegistry);
- if (!payload) {
- return null;
- }
- const componentArray = Object.values(payload);
- let docs = "";
- componentArray.forEach((item) => {
- if (item.docs) {
- docs += `${item.docs}
-`;
- }
- });
- return registryResolvedComponentsTreeSchema.parse({
- dependencies: deepmerge.all(
- componentArray.map((item) => item.dependencies ?? [])
- ),
- devDependencies: deepmerge.all(
- componentArray.map((item) => item.devDependencies ?? [])
- ),
- files: componentArray.map((item) => {
- return {
- src: item.src,
- target: item.target
- };
- }),
- docs,
- shadcnComponent: Array.from(new Set(
- componentArray.flatMap((item) => item.shadcnComponent ?? [])
- ))
- });
-}
-
-// src/commands/components/commands/add/utils/prompt-for-component.ts
-async function promptForRegistryComponents(all) {
- const registrySpinner = spinner2("Checking registry...");
- registrySpinner.start();
- const registryIndex = getRegistry();
- if (!registryIndex) {
- registrySpinner.fail("Failed to fetch registry index.");
- logger.break();
- handleError(new Error("Failed to fetch registry index."));
- return [];
- }
- registrySpinner.succeed("Registry checked successfully.");
- if (all) {
- return Object.values(registryIndex).map((entry) => entry.name);
- }
- const components = await p7.multiselect({
- message: "Which components would you like to add?",
- options: Object.values(registryIndex).filter((item) => item.internal !== true).map((entry) => ({
- value: entry.name,
- label: entry.name
- }))
- });
- if (p7.isCancel(components)) {
- p7.cancel("No components selected. Exiting.");
- process.exit(1);
- }
- const result = z4.array(z4.string()).safeParse(components);
- if (!result.success) {
- handleError(new Error("Something went wrong. Please try again."));
- return [];
- }
- return result.data;
-}
-
-// src/commands/components/commands/add/preflights/preflight-add.ts
-import fs5 from "fs";
-import path4 from "path";
-function preFlightAdd(cwd) {
- const errors = {};
- if (!fs5.existsSync(cwd) || !fs5.existsSync(path4.resolve(cwd, "package.json"))) {
- errors[ERRORS.MISSING_DIR_OR_EMPTY_PIPE] = true;
- return {
- errors
- };
- }
- const hasSrcDir = fs5.existsSync(path4.join(cwd, "src"));
- if (!hasSrcDir) {
- logger.warn(
- "No src directory found. Components will be installed in the root directory instead."
- );
- }
-}
-
-// src/commands/components/commands/add/utils/updaters/update-dependencies.ts
-import { execSync as execSync2 } from "child_process";
-
-// src/commands/components/commands/add/utils/package-manager.ts
-import { existsSync } from "fs";
-import { join } from "path";
-function detectPackageManager(cwd) {
- if (existsSync(join(cwd, "bun.lockb")) || existsSync(join(cwd, "bun.lock"))) return "bun";
- if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
- if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
- if (existsSync(join(cwd, "package-lock.json"))) return "npm";
- return "npm";
-}
-
-// src/commands/components/commands/add/utils/updaters/update-dependencies.ts
-async function updateDependencies(dependencies, options) {
- if (!dependencies?.length) {
- return;
- }
- const uniqueDependencies = Array.from(new Set(dependencies));
- try {
- const packageManager = detectPackageManager(options.cwd);
- const command = getPackageManagerCommand(packageManager, uniqueDependencies, options.devDependency);
- const spinnerText = `Installing ${options.devDependency ? "dev dependencies" : "dependencies"}: ${uniqueDependencies.join(", ")}...`;
- const dependenciesSpinner = spinner2(spinnerText, { silent: options.silent });
- dependenciesSpinner.start();
- try {
- execSync2(command.join(" "), {
- cwd: options.cwd,
- stdio: ["ignore", "pipe", "pipe"]
- });
- if (!options.silent) {
- dependenciesSpinner.succeed(`Installed ${options.devDependency ? "dev dependencies" : "dependencies"}: ${uniqueDependencies.join(", ")}`);
- }
- } catch (error) {
- if (!options.silent) {
- dependenciesSpinner.fail(`Failed to install ${options.devDependency ? "dev dependencies" : "dependencies"}`);
- }
- throw error;
- }
- } catch (error) {
- throw error;
- }
-}
-function getPackageManagerCommand(packageManager, dependencies, isDevDependency = false) {
- const commands = {
- npm: ["npm", isDevDependency ? "install --save-dev" : "install", ...dependencies],
- yarn: ["yarn", "add", isDevDependency ? "--dev" : "", ...dependencies],
- pnpm: ["pnpm", "add", isDevDependency ? "--save-dev" : "", ...dependencies],
- bun: ["bun", "add", isDevDependency ? "--dev" : "", ...dependencies]
- };
- return commands[packageManager].filter(Boolean);
-}
-
-// src/commands/components/commands/add/utils/updaters/update-files.ts
-import fs7 from "fs-extra";
-import path5 from "path";
-import * as p8 from "@clack/prompts";
-import { existsSync as existsSync2 } from "fs";
-
-// src/commands/components/commands/add/utils/download-file-from-github.ts
-import fs6 from "fs-extra";
-async function fetchFileFromGitHubAPI(apiUrl, outputPath) {
- try {
- const response = await fetch(apiUrl);
- if (!response.ok) {
- throw new Error(`Failed to fetch file info from GitHub API. HTTP Status: ${response.status}`);
- }
- const data = await response.json();
- const fileContent = Buffer.from(data.content, "base64").toString("utf-8");
- fs6.writeFileSync(outputPath, fileContent);
- } catch (err) {
- handleError(`Error: ${err.message}`);
- }
-}
-
-// src/commands/components/commands/add/utils/updaters/update-files.ts
-async function updateFiles(componentLocations, options) {
- if (!componentLocations?.length) {
- return {
- filesCreated: [],
- filesUpdated: [],
- filesSkipped: []
- };
- }
- options = {
- overwrite: false,
- silent: false,
- ...options
- };
- const hasSrcDir = fs7.existsSync(path5.join(options.cwd, "src"));
- if (!hasSrcDir) {
- logger.info(
- "No src directory found. Components will be installed in the root directory instead."
- );
- componentLocations = componentLocations.map((location) => {
- if (location.target.startsWith("./src/")) {
- return {
- ...location,
- target: "./" + location.target.substring(6)
- // Remove the 'src/' part
- };
- }
- return location;
- });
- }
- const filesCreatedSpinner = spinner2(`Creating files...`, {
- silent: options.silent
- });
- filesCreatedSpinner.start();
- const filesCreated = [];
- const filesUpdated = [];
- const filesSkipped = [];
- for (const location of componentLocations) {
- const targetDir = path5.dirname(location.target);
- const existingFile = existsSync2(location.target);
- if (existingFile && !options.overwrite) {
- filesCreatedSpinner.stop();
- const overwrite = await p8.confirm({
- message: `The file ${highlighter.info(
- location.target
- )} already exists. Would you like to overwrite?`
- });
- if (p8.isCancel(overwrite) || !overwrite) {
- filesSkipped.push(path5.relative(options.cwd, location.target));
- continue;
- }
- filesCreatedSpinner.start();
- if (!existsSync2(targetDir)) {
- await fs7.mkdir(targetDir, { recursive: true });
- }
- }
- if (!existsSync2(targetDir)) {
- await fs7.mkdir(targetDir, { recursive: true });
- }
- await fetchFileFromGitHubAPI(location.src, location.target);
- existingFile ? filesUpdated.push(path5.relative(options.cwd, location.target)) : filesCreated.push(path5.relative(options.cwd, location.target));
- }
- const hasUpdatedFiles = filesCreated.length || filesUpdated.length;
- if (!hasUpdatedFiles && !filesSkipped.length) {
- filesCreatedSpinner.info("No files created.");
- return { filesCreated, filesUpdated, filesSkipped };
- }
- if (!options.silent) {
- filesCreatedSpinner.stop();
- if (filesCreated.length) {
- p8.note(
- [
- `Created ${filesCreated.length} ${filesCreated.length === 1 ? "file" : "files"}:`,
- ...filesCreated.map((file) => ` - ${file}`)
- ].join("\n"),
- "Created"
- );
- }
- if (filesUpdated.length) {
- p8.note(
- [
- `Updated ${filesUpdated.length} ${filesUpdated.length === 1 ? "file" : "files"}:`,
- ...filesUpdated.map((file) => ` - ${file}`)
- ].join("\n"),
- "Updated"
- );
- }
- if (filesSkipped.length) {
- p8.note(
- [
- `Skipped ${filesSkipped.length} ${filesSkipped.length === 1 ? "file" : "files"}:`,
- ...filesSkipped.map((file) => ` - ${file}`),
- "",
- "Use --overwrite to overwrite existing files"
- ].join("\n"),
- "Skipped"
- );
- }
- }
- return {
- filesCreated,
- filesUpdated,
- filesSkipped
- };
-}
-
-// src/commands/components/commands/add/utils/shadcn.ts
-import { execSync as execSync3 } from "child_process";
-import { existsSync as existsSync3 } from "fs";
-import { join as join2 } from "path";
-import * as p9 from "@clack/prompts";
-async function getValidShadcnComponents() {
- try {
- const response = await fetch("https://ui.shadcn.com/r/index.json");
- const data = await response.json();
- return data.map((item) => item.name);
- } catch (error) {
- return [
- "accordion",
- "alert",
- "alert-dialog",
- "aspect-ratio",
- "avatar",
- "badge",
- "button",
- "calendar",
- "card",
- "carousel",
- "checkbox",
- "collapsible",
- "command",
- "context-menu",
- "dialog",
- "dropdown-menu",
- "form",
- "hover-card",
- "input",
- "label",
- "menubar",
- "navigation-menu",
- "popover",
- "progress",
- "radio-group",
- "scroll-area",
- "select",
- "separator",
- "sheet",
- "skeleton",
- "slider",
- "switch",
- "table",
- "tabs",
- "textarea",
- "toast",
- "toggle",
- "tooltip"
- ];
- }
-}
-function getShadcnAddCommand(components, packageManager, options = {}) {
- const flags = [];
- if (options.noPrompt) {
- flags.push("-y");
- }
- if (options.overwrite) {
- flags.push("--overwrite");
- }
- const baseCommand = {
- bun: ["bunx", "--bun", "shadcn@latest"],
- pnpm: ["pnpm", "dlx", "shadcn@latest"],
- yarn: ["yarn", "dlx", "shadcn@latest"],
- npm: ["npx", "shadcn@latest"]
- };
- const command = baseCommand[packageManager] || baseCommand.npm;
- return [...command, "add", ...components, ...flags];
-}
-function getShadcnInitCommand(packageManager) {
- const baseCommand = {
- bun: ["bunx", "--bun", "shadcn@latest"],
- pnpm: ["pnpm", "dlx", "shadcn@latest"],
- yarn: ["yarn", "dlx", "shadcn@latest"],
- npm: ["npx", "shadcn@latest"]
- };
- const command = baseCommand[packageManager] || baseCommand.npm;
- return [...command, "init", "-yd"];
-}
-function isShadcnInitialized(cwd) {
- return existsSync3(join2(cwd, "components.json"));
-}
-async function initializeShadcn(cwd, silent = false) {
- const initSpinner = spinner2("Checking shadcn-ui initialization...");
- try {
- if (!silent) {
- const shouldInit = await p9.confirm({
- message: "shadcn-ui is not initialized in this project. Would you like to initialize it now?"
- });
- if (p9.isCancel(shouldInit) || !shouldInit) {
- console.log("Please initialize shadcn-ui manually by running: npx shadcn@latest init");
- return false;
- }
- }
- initSpinner.start("Initializing shadcn-ui...");
- const packageManager = detectPackageManager(cwd);
- const commandParts = getShadcnInitCommand(packageManager);
- execSync3(commandParts.join(" "), {
- cwd,
- stdio: ["ignore", "pipe", "pipe"],
- env: {
- ...process.env,
- FORCE_COLOR: "true",
- CI: "true"
- // Always run in CI mode for init
- }
- });
- initSpinner.succeed("Initialized shadcn-ui");
- return true;
- } catch (error) {
- initSpinner.fail("Failed to initialize shadcn-ui");
- const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
- throw new Error(`Failed to initialize shadcn-ui: ${errorMessage}`);
- }
-}
-async function installShadcnComponents(components = [], options) {
- if (!components?.length) {
- return;
- }
- try {
- if (!isShadcnInitialized(options.cwd)) {
- const initialized = await initializeShadcn(options.cwd, options.silent);
- if (!initialized) {
- return handleError(
- new Error("shadcn-ui must be initialized before installing components")
- );
- }
- }
- const validComponents = await getValidShadcnComponents();
- const invalidComponents = components.filter((component) => !validComponents.includes(component));
- if (invalidComponents.length > 0) {
- return handleError(
- new Error(
- `Invalid shadcn components: ${invalidComponents.join(", ")}
-Available components are: ${validComponents.join(", ")}`
- )
- );
- }
- const packageManager = detectPackageManager(options.cwd);
- const componentList = components.join(", ");
- const commandParts = getShadcnAddCommand(components, packageManager, {
- overwrite: options.overwrite,
- noPrompt: options.silent
- });
- const shadcnSpinner = spinner2(`Installing shadcn components: ${componentList}...`, { silent: options.silent });
- shadcnSpinner.start();
- try {
- execSync3(commandParts.join(" "), {
- cwd: options.cwd,
- stdio: ["ignore", "pipe", "pipe"],
- env: {
- ...process.env,
- FORCE_COLOR: "true",
- CI: options.silent ? "true" : "false"
- }
- });
- shadcnSpinner.succeed(`Installed shadcn components: ${componentList}
-`);
- } catch (error) {
- shadcnSpinner.fail(`Failed to install shadcn components
-`);
- throw error;
- }
- } catch (error) {
- const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
- return handleError(new Error(`Failed to install shadcn components: ${errorMessage}`));
- }
-}
-
-// src/commands/components/commands/add/utils/add-components.ts
-async function addComponents(components, options) {
- const registrySpinner = spinner2(`Checking registry.`, {
- silent: options.silent
- });
- registrySpinner.start();
- const tree = registryResolveItemsTree(components);
- if (!tree) {
- registrySpinner.fail("Failed to fetch components from registry.");
- return handleError(new Error("Failed to fetch components from registry."));
- }
- registrySpinner.succeed("Registry checked successfully.");
- await updateDependencies(tree.dependencies, {
- cwd: options.cwd,
- silent: options.silent
- });
- await updateDependencies(tree.devDependencies, {
- cwd: options.cwd,
- silent: options.silent,
- devDependency: true
- });
- await installShadcnComponents(tree.shadcnComponent ?? [], {
- cwd: options.cwd,
- silent: options.silent,
- overwrite: options.overwrite
- });
- await updateFiles(tree.files, {
- cwd: options.cwd,
- overwrite: options.overwrite,
- silent: options.silent
- });
-}
-
-// src/commands/components/commands/add/add.ts
-import { Command as Command10 } from "commander";
-var addComponentCommand = new Command10().name("add").description("add components and dependencies to your pipe").argument("[components...]", "List of components by name").option("--path <path>", "The path to add the component to.").option("--silent", "Mute output.", false).option("--overwrite", "Overwrite existing files.", false).option(
- "--cwd <cwd>",
- "The working directory. Defaults to the current directory.",
- process.cwd()
-).action(async (comps, opts) => {
- try {
- let components;
- if (!comps?.length) {
- components = await promptForRegistryComponents();
- } else {
- components = [comps];
- }
- const result = preFlightAdd(opts.cwd);
- if (result?.errors[ERRORS.MISSING_DIR_OR_EMPTY_PIPE]) {
- logger.warn(
- "you need to create a pipe first. run bunx --bun @screenpipe/dev@latest pipe create or visit https://docs.screenpi.pe/plugins for more information."
- );
- process.exit(1);
- }
- await addComponents(components, {
- silent: opts.silent,
- cwd: opts.cwd,
- overwrite: opts.overwrite
- });
- } catch (error) {
- logger.break();
- handleError(error);
- }
-});
-
-// src/commands/components/commands/register.ts
-import fs8 from "fs-extra";
-import { Command as Command11 } from "commander";
-import inquirer from "inquirer";
-async function writeJsonToFile(filePath, data) {
- try {
- await fs8.promises.writeFile(filePath, JSON.stringify(data, null, 2), "utf8");
- logger.success(`component registry successfully updated.`);
- } catch (error) {
- if (error) {
- if (error instanceof Error) {
- if (error.message === "No such file or directory") {
- logger.break();
- logger.warn("this command can only be called from within the screenpipe-js/cli of screenpipe's repository");
- process.exit(1);
- }
- }
- }
- logger.break();
- handleError("critical: could not save information to registry");
- process.exit(1);
- }
-}
-var registerComponentCommand = new Command11().name("register").description("register a new component in screenpipe's component registry").option("-n, --name <name>", "name of the component").option("-s, --src", "github url for the component").option("-t, --target", "path where file should be created").action(async (opts) => {
- try {
- if (!opts.name) {
- const { name } = await inquirer.prompt([
- {
- type: "input",
- name: "name",
- message: "what's your component's name?"
- }
- ]);
- opts.name = name;
- }
- if (!opts.src) {
- const { src } = await inquirer.prompt([
- {
- type: "input",
- name: "src",
- message: "where should we download the component from? (URL pattern: https://api.github.com/repos/{owner}/{repo}/contents/{path})",
- validate: (input) => input.startsWith("https://api.github.com/repos/") ? true : "URL must follow the pattern: https://api.github.com/repos/{owner}/{repo}/contents/{path}. \n \n \nvisit: https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-js/cli/src/commands/components/README.md for more details."
- }
- ]);
- opts.src = src;
- }
- if (!opts.target) {
- const { target } = await inquirer.prompt([
- {
- type: "input",
- name: "target",
- message: "where should the component be created?"
- }
- ]);
- opts.target = target;
- }
- if (!opts.name?.length || !opts.src?.length || !opts.target?.length) {
- logger.break();
- handleError("invalid component");
- process.exit(1);
- }
- const { deps } = await inquirer.prompt([
- {
- type: "input",
- name: "deps",
- message: "type all of the component's runtime dependencies by name, separated by a comma",
- filter: (input) => input.split(",").map((item) => item.trim()).filter((item) => item !== "")
- }
- ]);
- const { devDeps } = await inquirer.prompt([
- {
- type: "input",
- name: "devDeps",
- message: "type all of the component's dev dependencies by name, separated by a comma",
- filter: (input) => input.split(",").map((item) => item.trim()).filter((item) => item !== "")
- }
- ]);
- const { registryDeps } = await inquirer.prompt([
- {
- type: "input",
- name: "registryDeps",
- message: "type all of the component's registry dependencies by name, separated by a comma",
- filter: (input) => input.split(",").map((item) => item.trim()).filter((item) => item !== "")
- }
- ]);
- const componentObject = {
- name: opts.name,
- src: opts.src,
- target: opts.target,
- dependencies: deps,
- devDependencies: devDeps,
- registryDependencies: registryDeps
- };
- const currentRegistry = getRegistry();
- if (!currentRegistry) {
- logger.break();
- handleError("critical: build is missing registry file.");
- process.exit(1);
- }
- currentRegistry[opts.name] = componentObject;
- await writeJsonToFile("./src/commands/components/commands/add/registry/registry.json", currentRegistry);
- logger.log("run `bun run build` and open a PR at https://github.com/mediar-ai/screenpipe to update registry.");
- } catch (error) {
- logger.break();
- handleError(error);
- }
-});
-
-// src/commands/components/index.ts
-import { Command as Command12 } from "commander";
-var componentsCommands = new Command12().name("components").description("easily add screenpipe components to your project");
-componentsCommands.addCommand(addComponentCommand);
-componentsCommands.addCommand(registerComponentCommand);
-
-// src/index.ts
-process.on("SIGINT", () => process.exit(0));
-process.on("SIGTERM", () => process.exit(0));
-async function main() {
- const program = new Command13();
- program.name("screenpipe-dev").description("screenpipe development CLI tool").version("0.0.1");
- program.addCommand(loginCommand);
- program.addCommand(logoutCommand);
- program.addCommand(appCommands);
- program.addCommand(pipeCommands);
- program.addCommand(componentsCommands);
- program.parse();
-}
-main();
diff --git a/screenpipe-js/cli/tests/bun.lockb b/screenpipe-js/cli/tests/bun.lockb
deleted file mode 100755
index 268efd9bf..000000000
Binary files a/screenpipe-js/cli/tests/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/examples/basic-transcription/bun.lockb b/screenpipe-js/examples/basic-transcription/bun.lockb
deleted file mode 100755
index 01fe23bb5..000000000
Binary files a/screenpipe-js/examples/basic-transcription/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/examples/capture-main-feature/bun.lockb b/screenpipe-js/examples/capture-main-feature/bun.lockb
deleted file mode 100755
index 01fe23bb5..000000000
Binary files a/screenpipe-js/examples/capture-main-feature/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/examples/query-screenpipe/bun.lockb b/screenpipe-js/examples/query-screenpipe/bun.lockb
deleted file mode 100755
index 01fe23bb5..000000000
Binary files a/screenpipe-js/examples/query-screenpipe/bun.lockb and /dev/null differ
diff --git a/screenpipe-js/node-sdk/bun.lockb b/screenpipe-js/node-sdk/bun.lockb
deleted file mode 100755
index e8ff8532b..000000000
Binary files a/screenpipe-js/node-sdk/bun.lockb and /dev/null differ