@deslop/stash 0.1.0 → 0.1.1018

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,45 +1,43 @@
1
1
  # Stash
2
2
 
3
- A personal link inbox for one iPhone, and a CLI that reads what a video or social post says. One package holds the Effect server for `dev`, the Expo iOS client with a Swift share extension, and the `stash` command.
3
+ A personal inbox for links, written notes, photos and videos on one iPhone, and a CLI that saves to it. One package holds the Effect server for `dev`, the Expo iOS client with a Swift share extension, and the `stash` command.
4
4
 
5
5
  ## CLI
6
6
 
7
- Runs on Linux or macOS (x64 or arm64) with Node 26+ and `ffmpeg` on `PATH`.
7
+ Needs Node 26+ and the tailnet.
8
8
 
9
9
  ```bash
10
- vpx @deslop/stash@latest media '<url>' [output directory] [--language it]
10
+ vpx @deslop/stash@latest save '<link or text>' [--server <url>]
11
11
  ```
12
12
 
13
- | Output | Content |
14
- | ---------------- | -------------------------------------------------------------------------------------------------------- |
15
- | `info.md` | Title, author, date, duration, description and chapters; the text of an X post and of the post it quotes |
16
- | `transcript.txt` | One `[mm:ss] text` line per caption or speech segment |
17
-
18
- The output directory defaults to `/tmp/media`. The spoken language comes from `--language`, the video's original caption track or its declared language, defaulting to English, and published captions in that language win. Without them, the audio is transcribed locally with Whisper `small.en`, in about a quarter of the audio's duration (a 38-minute talk took 9 minutes on an 8-core server). Speech that is not English uses the multilingual Whisper model.
19
-
20
- The first run downloads the standalone `yt-dlp`, and the first transcription the Whisper model, into `$XDG_CACHE_HOME/deslop/media` (`~/.cache` by default); later runs update `yt-dlp` in place. When YouTube refuses the connection, as it does for most datacenter addresses, `info.md` holds only the oEmbed title and channel. A URL nothing can be read from fails.
13
+ The CLI saves the entry through the server's RPC, waits until the server has read and tagged it, and prints the note as Markdown on stdout: title, author, link, tags, summary, the AI's notes, topics, words in the images, the source it read and the `[mm:ss]` transcript. Progress goes to stderr. The server defaults to `STASH_SERVER`, then `https://dev.tailnet-8c4c.ts.net:8443`.
21
14
 
22
15
  ## Server
23
16
 
24
- - **Run.** `vp -C apps/stash run preview` builds `dist/server.js` and serves it on `127.0.0.1:5017`; `sudo tailscale serve --bg --https=8443 http://127.0.0.1:5017` publishes it as `https://dev.tailnet-8c4c.ts.net:8443`. The tailnet is the only sign-in, so never bind it to `0.0.0.0` on `dev`, which has a public address.
25
- - **Environment.** `OPENROUTER_API_KEY` in `~/.deslop/stash.env` turns tagging on. `STASH_DATA_DIR` defaults to `~/.deslop/stash`, `STASH_AI_MODEL` to `openai/gpt-6-luna` and `STASH_AI_BUDGET_USD` to 1 per month.
26
- - **Routes.** The app uses the JSON WebSocket RPC at `/api/rpc` and downloads previews from `/api/images/<id>`; the Swift extension posts `{id, text}` to `/api/capture`, because it cannot speak the RPC protocol.
27
- - **Previews.** The server keeps each link's preview image on disk, because TikTok's image links expire within days.
28
- - **Transcripts.** A TikTok, X or YouTube note keeps what its video says, read like the CLI does, so tags and search cover it. Without captions, Whisper transcribes audio up to 30 minutes long, one video at a time.
17
+ - **Run.** `vp -C apps/stash run preview` builds `dist/server.js` and serves it on `127.0.0.1:5017`; `sudo tailscale serve --bg --https=8443 http://127.0.0.1:5017` publishes it on the tailnet. The tailnet is the only sign-in, so never bind it to `0.0.0.0` on `dev`, which has a public address.
18
+ - **Environment.** `~/.deslop/stash.env` holds the variables in [.env.example](.env.example). `ANTHROPIC_API_KEY` turns tagging on; without it a note fails with the reason. `STASH_AI_MODEL` defaults to `claude-haiku-5-5`, at high effort. `STASH_DATA_DIR` defaults to `~/.deslop/stash`.
19
+ - **Media.** The server runs the `yt-dlp` on `PATH` and downloads the Whisper model into `$XDG_CACHE_HOME/deslop/media` on first use. Published captions win; Whisper `small.en` takes about a quarter of the audio's length, up to two hours of audio. `STASH_MEDIA_PROXY` lists proxies, separated by commas; `yt-dlp` starts with the one that last got through and moves on when a site blocks it. On `dev` it lists the five Mullvad proxies from the environment skill.
20
+ - **Storage.** SQLite at `stash.db` in `STASH_DATA_DIR`, one row per note, without migrations: a change to its shape can drop it. Previews and uploaded files sit beside it in `images/` and `files/`.
21
+ - **Sync.** `notes.watch` sends every note's list fields once, then only the notes that changed, at most every 400 ms. `notes.get` loads the long texts and `notes.search` searches transcripts and pages on the server.
22
+ - **Routes.** The app uses the JSON WebSocket RPC at `/api/rpc` and loads previews from `/api/images/<id>`. The share extension posts `{id, text}` to `/api/capture`. Photos and videos arrive as the raw body of `/api/files/<id>`.
23
+ - **Organizer.** Claude reads each entry as a developer would: a title of at most 32 characters, a one-line summary, one to three tags, search topics, two to six lines of notes, and the words in the images. The preview and six video stills go with it. A short link resolves before saving, so another share of the same post finds the saved note.
29
24
 
30
25
  ## iOS client
31
26
 
32
- - **No controls.** Links arrive only from the share sheet and from the clipboard when the app opens; there is no button, composer or editor. Swipe deletes; a long press opens or copies.
33
- - **Theme.** Colors, square corners and JetBrains Mono follow the deslop shadcn theme in `packages/components/src/theme.css`, applied to `@expo/ui` SwiftUI views through `src/lib/theme.ts`.
34
- - **Outbox.** The app and the share extension both write `pending/<id>.json` to the App Group container before sending. The client picks the id, so a resend never makes a second note.
35
- - **Share extension.** `@bacons/apple-targets` adds `targets/share` at prebuild. It finds the server in the containing app's `StashServer` Info.plist key and the App Group as `group.<app bundle id>`; the fonts live there once for both targets.
36
- - **Variants.** `APP_VARIANT` from `eas.json` picks the bundle id, App Group and name, so the three builds install side by side. `APPLE_TEAM_ID` comes from the project's EAS environment variables, and `eas init` writes the project ID into `app.json`.
37
- - **Layout.** The folders follow `apps/portfolio`: `src/routes` holds the root, the list in `(home)` and the note detail, without a file router, and the icon. Expo needs `app.config.ts`, `app.json` and `eas.json` beside `package.json`, and `@bacons/apple-targets` reads `targets/`.
38
- - **Releases.** After check and test pass on main for a change under `apps/stash` or the lockfile, `deploy.yaml` calls `.github/workflows/stash.yaml`. It runs `eas build --local` on GitHub's `xcode-27` runner and submits the result to TestFlight with the `EXPO_TOKEN` secret. The first production build ran by hand on EAS, because it created the signing credentials, the App Group and the App Store Connect app `6821336145`, which `submit.production.ios.ascAppId` names for non-interactive submission. Each release is version `0.1.<run>` with build number `<run>`, the run number of `deploy.yaml` that also versions the npm package.
27
+ - **Capture.** Links, text, photos and videos arrive from the share sheet, which uploads in a background session and closes at once. When the app opens with a new link or image copied, a sheet asks whether to save it; the clipboard is read only after Save, so iOS shows its paste banner only then. The pencil writes a note.
28
+ - **List.** The layout follows iOS Mail: tag chips filter apart from search, and the bottom bar holds the kind filter, the search field and write. A long press opens the note in its app, regenerates or deletes it; swipe deletes. A note the server could not read shows why, and a tap retries it.
29
+ - **Note page.** The title sits in the bar and the app's logo opens the link. Below come the preview, the tags and the AI's notes. Pulling down regenerates the note.
30
+ - **Native module.** `modules/native` checks the clipboard without reading it and adds the bottom-bar search field through `@expo/ui`'s modifier API. The logos come from `@deslop/components-mobile`, which renders svgl's SVGs natively and cuts out their white parts for menu icons.
31
+ - **Share extension.** `@bacons/apple-targets` adds `targets/share` at prebuild. It finds the server in the app's `StashServer` Info.plist key and uploads from the App Group `group.<app bundle id>`. A failed background upload is not reported, because the sheet has already closed.
32
+ - **Variants.** `APP_VARIANT` from `eas.json` picks `development` or `production`; the development build installs beside the TestFlight one. `APPLE_TEAM_ID` comes from the EAS environment.
33
+
34
+ ## Releases
35
+
36
+ On main, `deploy.yaml` checks the native fingerprint of a change under `apps/stash` or `packages`. A known fingerprint ships the JavaScript as an EAS Update; a new one builds on GitHub's `xcode-27` runner with `eas build --local`, submits to TestFlight, then publishes the update. Any pushed tag builds its commit for TestFlight. Each release is version `0.1.<run>` with build number `<run>`.
39
37
 
40
38
  ## Development build
41
39
 
42
- `vp -C apps/stash run start` serves Metro on localhost only and writes the tailnet URL into its manifest; `sudo tailscale serve --bg --https=8081 http://localhost:8081` lets the iPhone's stash dev reach it. Use `localhost`, not `127.0.0.1`: Metro listens on `::1`.
40
+ `vp -C apps/stash run dev` serves Metro on localhost and writes the tailnet URL into its manifest; `sudo tailscale serve --bg --https=8081 http://localhost:8081` lets the iPhone's stash dev reach it. Use `localhost`, not `127.0.0.1`: Metro listens on `::1`.
43
41
 
44
42
  ## Checks without a Mac
45
43
 
@@ -54,23 +52,22 @@ The first EAS build is the first Swift compile.
54
52
  <details>
55
53
  <summary>For agents</summary>
56
54
 
57
- | Owner | Decision |
58
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
59
- | Package | Published as `@deslop/stash` with the `stash` bin; app dependencies are `devDependencies`, bundled by `vp pack` or by Metro. Only ONNX Runtime, sharp and the Expo, React and React Native packages that `expo prebuild` requires in `dependencies` install with the CLI |
60
- | `services/media` | `yt-dlp` stays an external binary because no maintained JavaScript extractor covers its sites. The iOS client never imports it: Metro must not reach Transformers.js, ONNX or child processes |
61
- | Transcription | Transformers.js with q8 Whisper, bundled because it imports `onnxruntime-common` without declaring it and `pnpm dlx` (pnpm 11) cannot resolve that. Update Transformers.js `4.3.0`, `onnxruntime-common`, `onnxruntime-node` and sharp together |
62
- | Publishing | Follows [tools/AGENTS.md](../../tools/AGENTS.md); the package replaced `@deslop/media` |
63
-
64
- | Rejected | Reason |
65
- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
66
- | `expo-sharing` and `expo-share-intent` | Both open the main app to save; sharing from TikTok must not leave TikTok |
67
- | `expo-share-extension` (React Native inside) | 6.0.0 is a beta with open crashes on SDK 57, and React Native in an extension costs most of its memory |
68
- | React Navigation and `react-native-screens` | `@expo/ui` gives SwiftUI's own stack, search and swipe actions |
69
- | Paste & Save button, composer, tag editor | The owner wants no controls: links come only from sharing and the clipboard |
70
- | A GitHub macOS runner without EAS | Signing on fresh runners and App Group registration need manual Apple setup and stayed unproven |
71
- | EAS cloud builds from the workflow | The free plan allows 15 iOS builds a month; macOS runners are free for this public repository |
72
- | Binary RPC serialization | The earlier web version failed to reopen a cancelled watch with it |
73
- | A PWA | iOS gives a web app no share sheet entry |
74
- | A separate `tools/media` package | Stash reads the same links; one package keeps one extractor, and notes get the transcripts |
55
+ | Owner | Decision |
56
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
57
+ | Package | Published as `@deslop/stash`; app dependencies are `devDependencies`. ONNX Runtime and sharp stay external through `deps.neverBundle`, because only the server loads them |
58
+ | Media | `yt-dlp` stays an external binary because no maintained JavaScript extractor covers its sites. The iOS client never imports `services/media` |
59
+ | Transcription | Update Transformers.js `4.3.0`, `onnxruntime-common`, `onnxruntime-node` and sharp together |
60
+ | Fingerprint | `fingerprint.config.js` adds `targets/share`, whose Swift the Expo fingerprint does not read |
61
+ | Toolbar order | `@expo/ui` shows the outermost toolbar's items first, so the list nests one `Toolbar` for write inside the one for the filter, with the search modifier between them; unproven until build |
62
+
63
+ | Rejected | Reason |
64
+ | --------------------------------------- | --------------------------------------------------------------------------------------------- |
65
+ | `expo-sharing` and `expo-share-intent` | Both open the main app to save; sharing from TikTok must not leave TikTok |
66
+ | React Native inside the share extension | It costs most of the extension's memory |
67
+ | A patch of `@expo/ui` | A patch breaks with each upgrade; the local module uses the public extension API |
68
+ | EAS cloud builds from the workflow | The free plan allows 15 iOS builds a month; macOS runners are free for this public repository |
69
+ | Binary RPC serialization | It failed to reopen a cancelled watch |
70
+ | An app outbox | The extension uploads in a background session, and the app saves through the RPC directly |
71
+ | `yt-dlp` and Whisper inside the CLI | API keys and models live on the server, and every analysis stays a note |
75
72
 
76
73
  </details>