@appeeky/open-slideshow 0.0.0-stage → 0.2.0

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -2
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +9 -0
  5. package/dist/brand.d.ts +57 -0
  6. package/dist/brand.js +263 -0
  7. package/dist/brandkit.d.ts +50 -0
  8. package/dist/brandkit.js +212 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +355 -0
  11. package/dist/decks.d.ts +44 -0
  12. package/dist/decks.js +100 -0
  13. package/dist/fonts.d.ts +45 -0
  14. package/dist/fonts.js +243 -0
  15. package/dist/gallery.d.ts +35 -0
  16. package/dist/gallery.js +109 -0
  17. package/dist/ideas.d.ts +50 -0
  18. package/dist/ideas.js +146 -0
  19. package/dist/images.d.ts +62 -0
  20. package/dist/images.js +241 -0
  21. package/dist/index.d.ts +21 -0
  22. package/dist/index.js +22 -0
  23. package/dist/lint.d.ts +36 -0
  24. package/dist/lint.js +197 -0
  25. package/dist/mcp.d.ts +3 -0
  26. package/dist/mcp.js +303 -0
  27. package/dist/preview.d.ts +18 -0
  28. package/dist/preview.js +96 -0
  29. package/dist/publish.d.ts +105 -0
  30. package/dist/publish.js +406 -0
  31. package/dist/readability.d.ts +19 -0
  32. package/dist/readability.js +42 -0
  33. package/dist/render.d.ts +92 -0
  34. package/dist/render.js +647 -0
  35. package/dist/results.d.ts +89 -0
  36. package/dist/results.js +252 -0
  37. package/dist/schedule.d.ts +19 -0
  38. package/dist/schedule.js +114 -0
  39. package/dist/schema.d.ts +1159 -0
  40. package/dist/schema.js +211 -0
  41. package/dist/screenshots.d.ts +18 -0
  42. package/dist/screenshots.js +69 -0
  43. package/dist/shape.d.ts +31 -0
  44. package/dist/shape.js +169 -0
  45. package/dist/skill.d.ts +7 -0
  46. package/dist/skill.js +17 -0
  47. package/dist/templates.d.ts +47 -0
  48. package/dist/templates.js +330 -0
  49. package/dist/text.d.ts +40 -0
  50. package/dist/text.js +231 -0
  51. package/dist/themes.d.ts +43 -0
  52. package/dist/themes.js +202 -0
  53. package/dist/variants.d.ts +48 -0
  54. package/dist/variants.js +175 -0
  55. package/dist/version.d.ts +1 -0
  56. package/dist/version.js +1 -0
  57. package/dist/video.d.ts +22 -0
  58. package/dist/video.js +59 -0
  59. package/dist/viral.d.ts +12 -0
  60. package/dist/viral.js +35 -0
  61. package/dist/workspace.d.ts +85 -0
  62. package/dist/workspace.js +322 -0
  63. package/package.json +65 -4
  64. package/skills/open-slideshow/SKILL.md +65 -0
  65. package/skills/open-slideshow/references/brand.md +64 -0
  66. package/skills/open-slideshow/references/channels.md +63 -0
  67. package/skills/open-slideshow/references/ideas.md +23 -0
  68. package/skills/open-slideshow/references/images.md +61 -0
  69. package/skills/open-slideshow/references/languages.md +51 -0
  70. package/skills/open-slideshow/references/publishing.md +70 -0
  71. package/skills/open-slideshow/references/results.md +47 -0
  72. package/skills/open-slideshow/references/review.md +81 -0
  73. package/skills/open-slideshow/references/screenshots.md +26 -0
  74. package/skills/open-slideshow/references/series.md +20 -0
  75. package/skills/open-slideshow/references/templates.md +96 -0
  76. package/skills/open-slideshow/references/troubleshooting.md +92 -0
  77. package/skills/open-slideshow/references/video.md +18 -0
  78. package/skills/open-slideshow/references/writing.md +76 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Appeeky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,298 @@
1
- # Temporary Holding Version
1
+ <p align="center"><img src="assets/cover.png" alt="Pixel-art night over mountains: open-slideshow, slideshows your agent writes. Its features with the TikTok and Instagram logos, where it posts through, and five slides open-slideshow rendered, standing in a row on the meadow." width="100%"></p>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # open-slideshow
4
+
5
+ Make TikTok photo slideshows and Instagram carousels for your app with the coding agent you already use: Claude Code, Codex or Cursor.
6
+
7
+ Your agent writes the words. open-slideshow renders the slides on your machine, checks them, and gets them to your phone or your accounts. It never calls a model, needs no account, and costs nothing to run.
8
+
9
+ And it learns what works for your app. Views and likes come back to each deck, so your agent sees which hooks, templates and posting times beat your usual post. It tests hooks against each other, turns a post that did well into part 2 or another language, puts your app's real screens in a phone, and finds the next idea in your comments and reviews.
10
+
11
+ **Set up with skills**, in any agent that reads skills (Claude Code, Codex, Cursor and more):
12
+
13
+ ```sh
14
+ npx skills add appeeky/open-slideshow
15
+ ```
16
+
17
+ Then ask your agent: *"make a TikTok slideshow about how to fall asleep faster"*. The first time, it gives you the one command that adds open-slideshow's tools (the MCP server) to your agent.
18
+
19
+ Or set up the skill and the tools in one go:
20
+
21
+ ```sh
22
+ npx @appeeky/open-slideshow agent claude # or codex, cursor
23
+ ```
24
+
25
+ More ways, including the Claude Code plugin, are under [Set up your agent](#set-up-your-agent).
26
+
27
+ ## What it makes
28
+
29
+ Every picture below was written by an agent and rendered by open-slideshow. The photos are CC0 photos found through open-slideshow's own image search.
30
+
31
+ **Tips** · `tiktok-classic`, the outlined captions people use on TikTok
32
+ ![Tips slideshow in the tiktok-classic theme](assets/examples/morning.jpg)
33
+
34
+ **Mistakes** · `bold-poster`, condensed capitals with one word on an accent block
35
+ ![Mistakes slideshow in the bold-poster theme](assets/examples/night.jpg)
36
+
37
+ **Checklist** · `magazine-cream`, a serif headline over the photo, then the lists
38
+ ![Checklist carousel in the magazine-cream theme](assets/examples/reset.jpg)
39
+
40
+ **Ranking** · `pastel-pop`, no photos needed
41
+ ![Ranking carousel in the pastel-pop theme](assets/examples/study.jpg)
42
+
43
+ **In Japanese** · `soft-shadow`, lines broken between phrases, not inside words
44
+ ![Japanese slideshow in the soft-shadow theme](assets/examples/asa.jpg)
45
+
46
+ ## What's included
47
+
48
+ Everything runs on your machine. The **Needs** column says when something needs more than open-slideshow itself.
49
+
50
+ ### Write
51
+
52
+ | Feature | What it does | Tools | Needs |
53
+ |---|---|---|---|
54
+ | Brand context | Before every deck the agent reads what your app does, who it is for, the tone, the claims you never make and every hook you already used, and asks for what is missing | `brand_context`, `brand_set` | |
55
+ | Brand kit | Colours (contrast checked), fonts and logo from your website, proposed before anything is saved | `brand_kit` | |
56
+ | 14 templates | Tips, mistakes, story, before / after, ranking, quotes, checklist, myth vs fact, this instead of that, things I wish I knew, how-to, comparison, POV, hot takes. Each sets the slide order, what goes on each slide and example hooks | `templates_list`, `templates_preview` | |
57
+ | Idea queue | Ideas from questions in comments, wishes and praise in reviews, your listing's features and channel topics, with the words behind each | `ideas_collect`, `ideas_list`, `idea_add` | |
58
+ | What already works | The most liked TikTok slideshows on your topic, to study their hooks ($0.01 a search) | `viral_search` | Appeeky key |
59
+ | Languages | Latin, Cyrillic, Greek and Vietnamese built in; Japanese, Chinese, Korean, Arabic, Hebrew, Thai and Hindi download once | | |
60
+
61
+ ### Design
62
+
63
+ | Feature | What it does | Tools | Needs |
64
+ |---|---|---|---|
65
+ | 10 themes | TikTok-style outlined captions to editorial pages, all in one picture so you pick once | `themes_preview` | |
66
+ | Photos | Search and import, with license and author kept: Openverse (no key), Unsplash, Pexels, or your own files | `image_search`, `image_import` | Unsplash or Pexels key (optional) |
67
+ | Screenshot slides | Your app's own screen inside a phone, from your repo or your App Store listing | `app_screenshots` | |
68
+ | Preview | The deck on a phone you can swipe, with TikTok's buttons on a toggle, plus a GIF for a pull request | `deck_preview` | |
69
+ | Video | The slides as an MP4 for Reels and Shorts | `deck_video` | ffmpeg |
70
+
71
+ ### Check
72
+
73
+ | Feature | What it does | Tools | Needs |
74
+ |---|---|---|---|
75
+ | Lint before posting | Text that does not fit, missing glyphs, platform limits, phrases that sound machine-written, hooks you already used | `deck_render`, `deck_lint` | |
76
+ | Readability | Words under TikTok's buttons and caption, small text, photos too bright or busy behind the words; a sheet with TikTok's buttons drawn on | `deck_render` (`safe_zones`) | |
77
+ | Image rights | Every image keeps its license; one nobody said you may post blocks publishing | `image_license` | |
78
+
79
+ ### Post
80
+
81
+ | Feature | What it does | Tools | Needs |
82
+ |---|---|---|---|
83
+ | Export | The images, caption and credits in a folder | `deck_publish` | |
84
+ | Photos | The images in a Photos album, to post from your phone with a trending sound | `deck_publish` | macOS |
85
+ | Post and schedule | To your TikTok and Instagram accounts, now or at a time | `deck_publish` | Appeeky or Postiz key |
86
+ | Spec draft | A draft file that Appeeky Spec sends after review | `deck_publish` | Appeeky Spec repo |
87
+ | Posting calendar | Channels with days, a time window or fixed times, time zones handled; a weekly run on GitHub Actions | `channel_save`, `plan`, `due` | |
88
+
89
+ ### Learn
90
+
91
+ | Feature | What it does | Tools | Needs |
92
+ |---|---|---|---|
93
+ | Results | Views, likes, comments, shares and saves back on each deck, or typed in for posts made from your phone | `results_sync`, `results_record` | Appeeky key or Spec repo for automatic sync |
94
+ | Insights | Which templates, themes, hook kinds and posting times beat your usual post, the best hooks, decks worth posting again | `insights` | |
95
+ | Hook tests | The same deck with up to five covers, posted on different days; a winner only once each has enough views | `hook_test` | |
96
+ | Series | Part 2 with the same look and a "Part 2/3" label | `series_next`, `series_list` | |
97
+ | Translations | The same deck in another language with the same photos | `deck_translate` | |
98
+ | Reposts | A deck that did well, again after 30 days with a new hook | `deck_repost` | |
99
+
100
+ ### For your agent
101
+
102
+ | Feature | What it does |
103
+ |---|---|
104
+ | MCP server | Every tool above, for Claude Code, Codex, Cursor or any MCP client |
105
+ | Skill | A short flow plus fourteen guides (brand, writing, templates, images, languages, review, publishing, channels, results, series, screenshots, video, ideas, troubleshooting), read only when needed |
106
+ | CLI | The same things from a terminal or CI (`open-slideshow help`) |
107
+
108
+ ## Set up your agent
109
+
110
+ <img src="assets/sections/setup.gif" alt="A terminal typing the open-slideshow plugin install, then asking for a TikTok slideshow, over a pixel-art night meadow with the coding agents." width="100%">
111
+
112
+ open-slideshow is two things your agent needs: an **MCP server** (the tools) and a **skill** (how to use them well). Pick one way to install both.
113
+
114
+ ### Claude Code
115
+
116
+ As a plugin, which installs the skill and the MCP server together:
117
+
118
+ ```
119
+ /plugin marketplace add appeeky/open-slideshow
120
+ /plugin install open-slideshow@open-slideshow
121
+ ```
122
+
123
+ Or with the CLI, in your project:
124
+
125
+ ```sh
126
+ npx @appeeky/open-slideshow agent claude
127
+ claude mcp add open-slideshow -- npx -y @appeeky/open-slideshow mcp
128
+ ```
129
+
130
+ This writes `.claude/skills/open-slideshow/` (the skill and its guides).
131
+
132
+ ### Codex
133
+
134
+ ```sh
135
+ npx @appeeky/open-slideshow agent codex
136
+ ```
137
+
138
+ This adds the skill to `AGENTS.md`. Add the MCP server to `~/.codex/config.toml`:
139
+
140
+ ```toml
141
+ [mcp_servers.open-slideshow]
142
+ command = "npx"
143
+ args = ["-y", "@appeeky/open-slideshow", "mcp"]
144
+ ```
145
+
146
+ ### Cursor
147
+
148
+ ```sh
149
+ npx @appeeky/open-slideshow agent cursor
150
+ ```
151
+
152
+ This writes `.cursor/rules/open-slideshow.mdc` and adds the server to `.cursor/mcp.json`.
153
+
154
+ ### Any agent that reads skills
155
+
156
+ The skill is a plain folder, `skills/open-slideshow/`, with `SKILL.md` and `references/`. Install it with the skills CLI:
157
+
158
+ ```sh
159
+ npx skills add appeeky/open-slideshow
160
+ ```
161
+
162
+ Or copy the folder into your agent's skills folder. Then add the MCP server: `npx -y @appeeky/open-slideshow mcp` (stdio).
163
+
164
+ ### Your app
165
+
166
+ In a new folder, tell open-slideshow about your app once:
167
+
168
+ ```sh
169
+ npx @appeeky/open-slideshow init --name "Your App" --app-store-id 123456789
170
+ ```
171
+
172
+ With an App Store id, it reads your listing and imports your icon for the app slide. Your agent asks for the rest (audience, tone, the claims you never make) the first time.
173
+
174
+ ## How a deck gets made
175
+
176
+ 1. **Brand.** The agent reads `brand_context` and asks you what it does not know.
177
+ 2. **Theme.** It shows you all 10 themes in one picture. You pick once.
178
+ 3. **What works.** For a new topic, it looks at the most liked slideshows on TikTok first (with an Appeeky key).
179
+ 4. **Template.** It suggests a shape that fits the topic, and can show you previews.
180
+ 5. **Write.** It writes the deck in your brand's voice.
181
+ 6. **Photos.** It searches for photos, shows you the thumbnails and imports the ones that fit.
182
+ 7. **Render and look.** It renders the deck, looks at every slide, fixes what does not read, and shows you the sheet. A phone preview shows it the way your viewers will see it.
183
+ 8. **Publish, with your yes.** It shows what would happen and waits for you before anything is exported, posted or scheduled.
184
+ 9. **Learn.** Once the numbers are in, it tells you what worked and suggests the next deck: a hook test, part 2, a translation or a repost.
185
+
186
+ ## A deck
187
+
188
+ ```yaml
189
+ id: fall-asleep-faster
190
+ theme: tiktok-classic
191
+ size: "4:5"
192
+ slides:
193
+ - kind: cover
194
+ title: How I fall asleep in *10 minutes* now
195
+ image: 3f2a9c0d1e4b5a6c.jpg
196
+ - kind: tip
197
+ title: Write tomorrow's list *before* bed
198
+ body: Your brain stops rehearsing it at 2am.
199
+ - kind: list
200
+ title: The last 30 minutes
201
+ items: [Lights low, Phone across the room, Same playlist every night]
202
+ - kind: app
203
+ title: I use *Your App* for it
204
+ body: Free on the App Store.
205
+ caption: Save this for tonight.
206
+ hashtags: [sleep, sleeptips]
207
+ accounts: [tiktok]
208
+ ```
209
+
210
+ Slide kinds: `cover`, `tip`, `list`, `quote`, `bridge`, `app`, `text`, `screenshot`. Set `template: tips` (or another) and lint checks the slides follow it. Words in `*stars*` get the accent.
211
+
212
+ ## Posting and scheduling
213
+
214
+ <img src="assets/sections/posting.gif" alt="open-slideshow scheduling a deck through Appeeky, its four slides, and notifications from Appeeky, Postiz and GitHub as posts go out." width="100%">
215
+
216
+ | | Needs | What happens |
217
+ |---|---|---|
218
+ | `export` | nothing | The images, `caption.txt` and `credits.txt` go to a folder |
219
+ | `photos` | macOS | The images go to a Photos album. Post from your phone and add a trending sound there |
220
+ | `appeeky` | `APPEEKY_API_KEY` | Posts now, or at a time, to the TikTok and Instagram accounts you connected in Appeeky. Scheduled posts go out from Appeeky's servers, so your computer can be off |
221
+ | `postiz` | `POSTIZ_API_KEY` (and `POSTIZ_API_URL` when self-hosted) | Posts now, or at a time, to the TikTok and Instagram channels you connected in your Postiz, cloud or self-hosted |
222
+ | `spec-draft` | an Appeeky Spec repo | A draft file that Spec sends after review |
223
+
224
+ A **channel** is a posting plan: accounts, days, a time window, a time zone and content rules. The simplest rhythm is weekly:
225
+
226
+ 1. Ask your agent to "prepare next week's posts".
227
+ 2. Look at the sheets.
228
+ 3. Say yes. Everything is scheduled.
229
+
230
+ ### On GitHub Actions
231
+
232
+ The same week can run without your laptop. Two example workflows are in [`examples/github-actions`](examples/github-actions):
233
+
234
+ - **`open-slideshow-prepare.yml`**, every Monday: your agent plans the week, writes and renders a deck for every slot, fixes the lint errors and opens a pull request. Nothing is posted.
235
+ - **`open-slideshow-schedule.yml`**, when you merge: `open-slideshow publish --scheduled --to appeeky --yes` schedules every rendered deck with a time still ahead. Appeeky posts each one at its time. With Postiz, change it to `--to postiz` and set the `POSTIZ_API_KEY` secret (and `POSTIZ_API_URL` when self-hosted).
236
+
237
+ Merging the pull request is your yes. Add `ANTHROPIC_API_KEY` and `APPEEKY_API_KEY` as repository secrets.
238
+
239
+ ## Inside an Appeeky Spec repo
240
+
241
+ <img src="assets/sections/spec.gif" alt="The files open-slideshow reads and writes in an Appeeky Spec repo, appearing one by one: the spec, the playbook, and a deck with its renders and draft." width="100%">
242
+
243
+ open-slideshow is a standalone tool. If it finds `appeeky.spec.yaml`, it works inside the Spec repo:
244
+
245
+ - It reads the app, `appeeky/playbook.md` (brand), the store listing and its languages, connected accounts and past posts from Spec.
246
+ - Ideas come from Spec's reviews and comments; screenshot slides use the screenshots in `appeeky/screenshots/`.
247
+ - Results come from Spec's `appeeky/social/posts.jsonl` once Spec has sent a draft and pulled its numbers.
248
+ - It writes decks under `appeeky/social/slides/`.
249
+ - It can publish as a Spec draft, which Spec sends after review.
250
+
251
+ It never changes Spec's own files.
252
+
253
+ ## Files
254
+
255
+ ```
256
+ open-slideshow.yaml app, brand and defaults
257
+ decks/<id>/deck.yaml the slides, caption, hashtags, accounts, time
258
+ decks/<id>/renders/ 01.jpg … NN.jpg, sheet.jpg, sheet-safe.jpg, manifest.json,
259
+ preview.html, preview.gif, video.mp4 when made
260
+ ideas.yaml the idea queue
261
+ channels/<id>.yaml a posting plan: schedule, content rules, design
262
+ images/<hash>.jpg/.json imported images with their license and author
263
+ .open-slideshow/ plan, history, cache
264
+ ```
265
+
266
+ ## CLI
267
+
268
+ ```
269
+ open-slideshow brand what the agent knows about your app
270
+ open-slideshow themes a picture of all themes
271
+ open-slideshow templates a picture of the slideshow shapes
272
+ open-slideshow render <deck> render to JPEGs
273
+ open-slideshow lint <deck> check a deck
274
+ open-slideshow viral <topic> the most liked TikTok slideshows on a topic (Appeeky key)
275
+ open-slideshow preview <deck> --gif a phone preview page and a GIF
276
+ open-slideshow video <deck> an MP4 for Reels and Shorts (needs ffmpeg)
277
+ open-slideshow screenshots import the app's screenshots
278
+ open-slideshow brand-kit <url> colours, fonts and logo from your website (--apply to save)
279
+ open-slideshow license <ref> <license> record who may post an image
280
+ open-slideshow results sync views and likes for published decks
281
+ open-slideshow insights what worked: hooks, templates, themes, times, hook tests
282
+ open-slideshow ideas collect ideas from comments, reviews and your listing
283
+ open-slideshow series series and their parts
284
+ open-slideshow publish <deck> --to export|photos|appeeky|postiz|spec-draft --yes
285
+ open-slideshow publish --scheduled --to appeeky|postiz --yes every rendered deck with a time ahead (CI)
286
+ open-slideshow plan / due posting calendar
287
+ open-slideshow mcp the MCP server your agent talks to
288
+ ```
289
+
290
+ ## Privacy
291
+
292
+ - Nothing leaves your machine unless you ask: an image search, a viral search, the App Store lookup for your app (and its reviews and screenshots), reading your website for a brand kit, fetching post results, or posting. The one exception: the first deck in Japanese, Chinese, Korean, Arabic, Hebrew, Thai or Hindi downloads that script's font from jsDelivr into `~/.cache/open-slideshow` (set `OPEN_SLIDESHOW_OFFLINE=1` to turn it off).
293
+ - No telemetry.
294
+ - Keys come from your environment (`APPEEKY_API_KEY`, `UNSPLASH_ACCESS_KEY`, `PEXELS_API_KEY`) and are never written to files.
295
+
296
+ ## License
297
+
298
+ MIT. Fonts: TikTok Sans, Inter, Anton, Instrument Serif and Noto Sans (SIL Open Font License). Emoji: Twemoji (CC BY 4.0). Text shaping: HarfBuzz (MIT).
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "./cli.js";
3
+ main().then((code) => {
4
+ if (code >= 0)
5
+ process.exitCode = code;
6
+ }, (e) => {
7
+ process.stderr.write(`${e.stack ?? e}\n`);
8
+ process.exitCode = 1;
9
+ });
@@ -0,0 +1,57 @@
1
+ import { type Brand, type Settings } from "./schema.js";
2
+ import { type Workspace } from "./workspace.js";
3
+ /** Phrases that make a slide sound written by a machine. Warnings by default; `strict_phrases` makes them errors. */
4
+ export declare const BANNED_PHRASES: string[];
5
+ export declare function bannedPhrases(settings: Settings): string[];
6
+ export interface AppStoreInfo {
7
+ id: string;
8
+ name: string;
9
+ seller?: string;
10
+ genre?: string;
11
+ description?: string;
12
+ subtitle?: string;
13
+ rating?: number;
14
+ ratings?: number;
15
+ icon_url?: string;
16
+ url?: string;
17
+ fetched_at: string;
18
+ }
19
+ /** Apple's public lookup: the store name, description and icon, so the agent writes about the real app. */
20
+ export declare function fetchAppStore(ws: Workspace, id: string, country?: string): Promise<AppStoreInfo | null>;
21
+ /** Sets the app icon from the App Store when the brand has none. */
22
+ export declare function ensureIcon(ws: Workspace, info: AppStoreInfo | null): Promise<string | undefined>;
23
+ /** The store listing Spec keeps (appeeky/store/<store>/<locale>.yaml), in the primary locale. */
24
+ export declare function specListing(ws: Workspace, locale?: string | undefined): string | undefined;
25
+ export interface UsedHook {
26
+ hook: string;
27
+ deck?: string;
28
+ at?: string;
29
+ views?: number;
30
+ likes?: number;
31
+ }
32
+ /** Hooks already used, newest first, with how they did when Spec has the numbers. */
33
+ export declare function usedHooks(ws: Workspace, limit?: number): UsedHook[];
34
+ export declare function normalizeHook(h: string): string;
35
+ export interface BrandContext {
36
+ mode: Workspace["mode"];
37
+ app: Settings["app"] & {
38
+ store?: AppStoreInfo | null;
39
+ };
40
+ brand: Brand;
41
+ playbook?: string;
42
+ listing?: string;
43
+ theme: {
44
+ id: string;
45
+ name: string;
46
+ description: string;
47
+ };
48
+ banned_phrases: string[];
49
+ used_hooks: UsedHook[];
50
+ missing: string[];
51
+ questions: string[];
52
+ markdown: string;
53
+ }
54
+ export declare function brandContext(ws: Workspace, opts?: {
55
+ offline?: boolean;
56
+ hooks?: number;
57
+ }): Promise<BrandContext>;
package/dist/brand.js ADDED
@@ -0,0 +1,263 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import YAML from "yaml";
4
+ import { brandSchema } from "./schema.js";
5
+ import { listDecks, readJson, readJsonl, historyFile, resolveImage, writeAtomic } from "./workspace.js";
6
+ import { plainText } from "./text.js";
7
+ import { getTheme, THEMES } from "./themes.js";
8
+ import { importImageFromUrl } from "./images.js";
9
+ /** Phrases that make a slide sound written by a machine. Warnings by default; `strict_phrases` makes them errors. */
10
+ export const BANNED_PHRASES = [
11
+ "game-changer",
12
+ "game changer",
13
+ "unlock",
14
+ "unleash",
15
+ "elevate",
16
+ "delve",
17
+ "dive into",
18
+ "deep dive",
19
+ "seamless",
20
+ "seamlessly",
21
+ "revolutionize",
22
+ "revolutionary",
23
+ "supercharge",
24
+ "level up your",
25
+ "in today's fast-paced world",
26
+ "in today's world",
27
+ "look no further",
28
+ "it's not just",
29
+ "here's the thing",
30
+ "let that sink in",
31
+ "the secret sauce",
32
+ "harness the power",
33
+ "transform your life",
34
+ "embark on",
35
+ "journey",
36
+ "tapestry",
37
+ "testament to",
38
+ "boost your productivity",
39
+ ];
40
+ export function bannedPhrases(settings) {
41
+ const remove = new Set(settings.banned_phrases.remove.map((p) => p.toLowerCase()));
42
+ return [...new Set([...BANNED_PHRASES.filter((p) => !remove.has(p)), ...settings.banned_phrases.add.map((p) => p.toLowerCase())])];
43
+ }
44
+ const appStoreCache = (ws) => join(ws.state, "cache", "app-store.json");
45
+ /** Apple's public lookup: the store name, description and icon, so the agent writes about the real app. */
46
+ export async function fetchAppStore(ws, id, country = "us") {
47
+ const cached = readJson(appStoreCache(ws), null);
48
+ if (cached && cached.id === id && Date.now() - Date.parse(cached.fetched_at) < 7 * 86_400_000)
49
+ return cached;
50
+ try {
51
+ const res = await fetch(`https://itunes.apple.com/lookup?id=${encodeURIComponent(id)}&country=${encodeURIComponent(country)}&entity=software`, { signal: AbortSignal.timeout(10_000) });
52
+ if (!res.ok)
53
+ return cached;
54
+ const data = (await res.json());
55
+ const r = data.results?.[0];
56
+ if (!r)
57
+ return null;
58
+ const info = {
59
+ id,
60
+ name: String(r.trackName ?? ""),
61
+ seller: r.sellerName ? String(r.sellerName) : undefined,
62
+ genre: r.primaryGenreName ? String(r.primaryGenreName) : undefined,
63
+ description: r.description ? String(r.description).slice(0, 4000) : undefined,
64
+ rating: typeof r.averageUserRating === "number" ? Math.round(r.averageUserRating * 10) / 10 : undefined,
65
+ ratings: typeof r.userRatingCount === "number" ? r.userRatingCount : undefined,
66
+ icon_url: r.artworkUrl512 ? String(r.artworkUrl512) : undefined,
67
+ url: r.trackViewUrl ? String(r.trackViewUrl).split("?")[0] : undefined,
68
+ fetched_at: new Date().toISOString(),
69
+ };
70
+ writeAtomic(appStoreCache(ws), JSON.stringify(info, null, 2));
71
+ return info;
72
+ }
73
+ catch {
74
+ return cached;
75
+ }
76
+ }
77
+ /** Sets the app icon from the App Store when the brand has none. */
78
+ export async function ensureIcon(ws, info) {
79
+ const current = ws.settings.brand.icon;
80
+ if (current && resolveImage(ws, current))
81
+ return current;
82
+ if (!info?.icon_url)
83
+ return undefined;
84
+ try {
85
+ const img = await importImageFromUrl(ws, info.icon_url, { source: "app-store", license: "own", note: "app icon" });
86
+ return img.ref;
87
+ }
88
+ catch {
89
+ return undefined;
90
+ }
91
+ }
92
+ function readText(file, max) {
93
+ if (!existsSync(file))
94
+ return undefined;
95
+ const t = readFileSync(file, "utf8").trim();
96
+ return t.length > max ? `${t.slice(0, max)}\n…(cut)` : t;
97
+ }
98
+ /** The store listing Spec keeps (appeeky/store/<store>/<locale>.yaml), in the primary locale. */
99
+ export function specListing(ws, locale = ws.spec?.locales[0]) {
100
+ const dir = ws.spec?.store_dir;
101
+ if (!dir || !existsSync(dir) || !locale)
102
+ return undefined;
103
+ for (const store of ["app-store", "google-play"]) {
104
+ const file = [join(dir, store, `${locale}.yaml`), join(dir, store, `${locale}.yml`)].find((f) => existsSync(f));
105
+ if (!file)
106
+ continue;
107
+ let data;
108
+ try {
109
+ data = (YAML.parse(readFileSync(file, "utf8")) ?? {});
110
+ }
111
+ catch {
112
+ continue;
113
+ }
114
+ const parts = [];
115
+ for (const key of ["name", "title", "subtitle", "shortDescription", "promotionalText", "description", "fullDescription"]) {
116
+ const v = data[key];
117
+ if (typeof v === "string" && v.trim())
118
+ parts.push(`${key}: ${v.trim().slice(0, 1500)}`);
119
+ }
120
+ if (parts.length)
121
+ return `(${store}, ${locale})\n${parts.join("\n")}`.slice(0, 3500);
122
+ }
123
+ return undefined;
124
+ }
125
+ /** Hooks already used, newest first, with how they did when Spec has the numbers. */
126
+ export function usedHooks(ws, limit = 200) {
127
+ const seen = new Set();
128
+ const out = [];
129
+ const add = (h) => {
130
+ const key = normalizeHook(h.hook);
131
+ if (!key || seen.has(key))
132
+ return;
133
+ seen.add(key);
134
+ out.push(h);
135
+ };
136
+ for (const d of listDecks(ws)) {
137
+ const cover = d.deck?.slides.find((s) => s.kind === "cover") ?? d.deck?.slides[0];
138
+ if (cover?.title)
139
+ add({ hook: plainText(cover.title), deck: d.id, at: d.deck?.published.at(-1)?.at });
140
+ }
141
+ for (const e of readJsonl(historyFile(ws)))
142
+ add({ hook: e.hook, deck: e.deck, at: e.at });
143
+ if (ws.spec && existsSync(ws.spec.posts_file)) {
144
+ for (const p of readJsonl(ws.spec.posts_file)) {
145
+ const first = (p.text ?? p.content ?? "").split("\n")[0]?.trim();
146
+ if (!first)
147
+ continue;
148
+ const m = (k) => (p.platforms ?? []).reduce((s, x) => s + (x.metrics?.[k] ?? 0), 0);
149
+ add({ hook: first.slice(0, 160), at: p.platforms?.find((x) => x.publishedAt)?.publishedAt ?? p.createdAt, views: m("views") || m("impressions") || undefined, likes: m("likes") || undefined });
150
+ }
151
+ }
152
+ return out.sort((a, b) => (b.at ?? "").localeCompare(a.at ?? "")).slice(0, limit);
153
+ }
154
+ export function normalizeHook(h) {
155
+ return plainText(h)
156
+ .toLowerCase()
157
+ .replace(/[^\p{L}\p{N}]+/gu, " ")
158
+ .trim();
159
+ }
160
+ const QUESTIONS = {
161
+ name: "What is the app called?",
162
+ one_liner: "In one sentence, what does the app do for someone?",
163
+ audience: "Who is it for? Describe one real person who loves it.",
164
+ tone: "How should the slides sound: e.g. warm, blunt, nerdy, funny, calm?",
165
+ claims_never: "Is there anything the slides must never claim or promise (medical, money, results)?",
166
+ cta: "When a slide mentions the app, what should it ask people to do (e.g. 'free on the App Store')?",
167
+ };
168
+ export async function brandContext(ws, opts = {}) {
169
+ const s = ws.settings;
170
+ const store = s.app.app_store_id && !opts.offline ? await fetchAppStore(ws, s.app.app_store_id, s.app.country) : s.app.app_store_id ? readJson(appStoreCache(ws), null) : null;
171
+ const brand = brandSchema.parse({ ...s.brand, name: s.brand.name ?? s.app.name ?? store?.name });
172
+ const playbook = ws.spec?.playbook ? readText(ws.spec.playbook, 8000) : undefined;
173
+ const listing = ws.mode === "spec" ? specListing(ws) : undefined;
174
+ const theme = getTheme(s.defaults.theme) ?? THEMES[0];
175
+ const missing = [];
176
+ if (!brand.name)
177
+ missing.push("name");
178
+ if (!brand.one_liner && !store?.description && !listing && !playbook)
179
+ missing.push("one_liner");
180
+ if (!brand.audience && !playbook)
181
+ missing.push("audience");
182
+ if (!brand.tone.length && !playbook)
183
+ missing.push("tone");
184
+ if (!brand.claims_never.length && !playbook)
185
+ missing.push("claims_never");
186
+ if (!brand.cta)
187
+ missing.push("cta");
188
+ const hooks = usedHooks(ws, opts.hooks ?? 200);
189
+ const banned = bannedPhrases(s);
190
+ const md = [`# Brand: ${brand.name ?? "(unnamed app)"}`, ""];
191
+ md.push(`Workspace: ${ws.mode === "spec" ? "Appeeky Spec repo (brand comes from appeeky/playbook.md)" : "open-slideshow (brand comes from open-slideshow.yaml)"}`);
192
+ if (brand.one_liner)
193
+ md.push(`What it does: ${brand.one_liner}`);
194
+ if (brand.audience)
195
+ md.push(`For: ${brand.audience}`);
196
+ if (brand.tone.length)
197
+ md.push(`Tone: ${brand.tone.join(", ")}`);
198
+ if (brand.handle)
199
+ md.push(`Handle: ${brand.handle}`);
200
+ if (brand.cta)
201
+ md.push(`Call to action: ${brand.cta}`);
202
+ if (brand.voice_examples.length)
203
+ md.push("", "Sounds like:", ...brand.voice_examples.map((v) => `- "${v}"`));
204
+ if (brand.words_to_use.length)
205
+ md.push(`Words we use: ${brand.words_to_use.join(", ")}`);
206
+ if (brand.words_to_avoid.length)
207
+ md.push(`Words we never use: ${brand.words_to_avoid.join(", ")}`);
208
+ if (brand.claims_allowed.length)
209
+ md.push("", "Claims we can make:", ...brand.claims_allowed.map((c) => `- ${c}`));
210
+ if (brand.claims_never.length)
211
+ md.push("", "Never claim:", ...brand.claims_never.map((c) => `- ${c}`));
212
+ if (brand.notes)
213
+ md.push("", "Notes:", brand.notes);
214
+ if (store) {
215
+ md.push("", `## App Store (${store.name})`);
216
+ if (store.genre)
217
+ md.push(`Category: ${store.genre}`);
218
+ if (store.rating)
219
+ md.push(`Rating: ${store.rating} (${store.ratings ?? 0} ratings)`);
220
+ if (store.url)
221
+ md.push(`Link: ${store.url}`);
222
+ if (store.description)
223
+ md.push("", store.description.slice(0, 1500));
224
+ }
225
+ if (playbook)
226
+ md.push("", "## Playbook (appeeky/playbook.md)", playbook);
227
+ if (listing)
228
+ md.push("", "## Store listing (appeeky/store)", listing);
229
+ md.push("", `## Default theme: ${theme.name} (${theme.id})`, theme.description);
230
+ md.push("", "## Do not write", banned.join(", "));
231
+ if (ws.spec && ws.spec.locales.length > 1)
232
+ md.push("", `## Store languages: ${ws.spec.locales.join(", ")}`, "A deck that did well can be translated for each (deck_translate).");
233
+ const { insights } = await import("./results.js");
234
+ const learned = insights(ws);
235
+ if (learned.measured >= 2)
236
+ md.push("", learned.markdown.replace(/^# /, "## "));
237
+ const { readIdeas } = await import("./ideas.js");
238
+ const fresh = readIdeas(ws).filter((i) => i.status === "new");
239
+ if (fresh.length)
240
+ md.push("", `## Ideas waiting (${fresh.length}, ideas_list): ${fresh.slice(0, 3).map((i) => `"${i.text}"`).join("; ")}`);
241
+ if (hooks.length) {
242
+ md.push("", `## Hooks already used (${hooks.length}, newest first): do not repeat them or their angle`);
243
+ for (const h of hooks.slice(0, 60))
244
+ md.push(`- ${h.hook}${h.views ? ` (${h.views} views${h.likes ? `, ${h.likes} likes` : ""})` : ""}`);
245
+ }
246
+ if (missing.length) {
247
+ md.push("", "## Missing: ask the user before writing slides", ...missing.map((m) => `- ${QUESTIONS[m]}`));
248
+ md.push(ws.mode === "spec" ? "Save the answers in appeeky/playbook.md (Spec) or with brand_set." : "Save the answers with brand_set.");
249
+ }
250
+ return {
251
+ mode: ws.mode,
252
+ app: { ...s.app, store },
253
+ brand,
254
+ playbook,
255
+ listing,
256
+ theme: { id: theme.id, name: theme.name, description: theme.description },
257
+ banned_phrases: banned,
258
+ used_hooks: hooks,
259
+ missing,
260
+ questions: missing.map((m) => QUESTIONS[m]),
261
+ markdown: md.join("\n"),
262
+ };
263
+ }