mango-lollipop 0.1.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.
@@ -0,0 +1,295 @@
1
+ # Generate Developer Hand-Off Documents
2
+
3
+ You are a technical documentation specialist bridging the gap between lifecycle marketing and engineering. Your job is to extract all product events from the messaging matrix, infer their payload schemas, and produce two deliverables: an introduction email marketing can send to the dev team, and a detailed technical event implementation spec.
4
+
5
+ ## Input
6
+
7
+ Read from the project output directory:
8
+ 1. **`analysis.json`** -- Company info, channels, voice profile, event taxonomy
9
+ 2. **`matrix.json`** -- All messages with triggers, guards, suppressions
10
+
11
+ Locate the project output directory by checking the current working directory or `output/*/` subdirectories.
12
+
13
+ ---
14
+
15
+ ## Step 1: Extract Events
16
+
17
+ Collect all unique events from two sources:
18
+
19
+ ### From `matrix.json`
20
+ - Every `trigger.event` value across all messages
21
+ - Note which messages reference each event as a trigger
22
+
23
+ ### From `analysis.json`
24
+ - All events listed in `events.identity`, `events.activation`, `events.engagement`, `events.conversion`, `events.retention`
25
+ - Some events may be defined in the taxonomy but not yet used by any message -- include them anyway
26
+
27
+ Deduplicate and build a master event list.
28
+
29
+ ---
30
+
31
+ ## Step 2: Cross-Reference
32
+
33
+ For each event, build a reference map:
34
+
35
+ - **Triggered messages**: Which messages use this event as their `trigger.event`
36
+ - **Guard references**: Which messages reference this event (or related attributes) in `guards[].expression`
37
+ - **Suppression references**: Which messages reference this event (or related attributes) in `suppressions[].expression`
38
+
39
+ ---
40
+
41
+ ## Step 3: Assign Priority
42
+
43
+ Assign a priority to each event based on its impact:
44
+
45
+ | Priority | Criteria |
46
+ |----------|----------|
47
+ | **Critical** | Triggers 3 or more messages |
48
+ | **High** | Triggers 2 messages |
49
+ | **Medium** | Triggers 1 message |
50
+ | **Low** | Referenced only in guards/suppressions, or defined in taxonomy but unused |
51
+
52
+ ---
53
+
54
+ ## Step 4: Categorize Events
55
+
56
+ Group events into categories based on their name prefix:
57
+
58
+ | Prefix | Category |
59
+ |--------|----------|
60
+ | `user.*` | Identity & Account |
61
+ | `feature.*` | Feature Usage |
62
+ | `onboarding.*` | Onboarding |
63
+ | `trial.*` / `subscription.*` | Billing & Subscription |
64
+ | `session.*` | Sessions |
65
+ | `usage.*` | Usage & Limits |
66
+ | `milestone.*` | Milestones |
67
+ | `project.*` / `content.*` / `collaboration.*` | Product Activity |
68
+
69
+ If an event doesn't match a known prefix, categorize it as "Custom".
70
+
71
+ ---
72
+
73
+ ## Step 5: Infer Payloads
74
+
75
+ Since events are just strings, infer a reasonable property schema for each event. Every event includes base properties:
76
+
77
+ ```javascript
78
+ {
79
+ user_id: "string", // Always required
80
+ timestamp: "ISO 8601" // Always required
81
+ }
82
+ ```
83
+
84
+ Then add event-specific properties based on:
85
+
86
+ 1. **Event name pattern:**
87
+ - `user.*` events: add `email`, `plan`, `account_id`
88
+ - `feature.*` events: add `feature_name`, `session_id`
89
+ - `trial.*` events: add `plan`, `days_remaining`, `trial_start_date`
90
+ - `subscription.*` events: add `plan`, `amount`, `currency`, `billing_period`
91
+ - `onboarding.*` events: add `step_name`, `step_number`, `total_steps`
92
+ - `session.*` events: add `session_id`, `duration_seconds`
93
+ - `milestone.*` events: add `milestone_name`, `milestone_value`
94
+ - `usage.*` events: add `metric_name`, `current_value`, `limit_value`
95
+
96
+ 2. **Product context:** Use `analysis.company.key_features` and `analysis.company.product_type` to add domain-specific properties where relevant.
97
+
98
+ 3. **Guard/suppression expressions:** Parse all `expression` strings that reference this event's domain. If a guard checks `user.plan == 'free'`, the `user.*` events should include `plan`. If a suppression checks `feature.agenda_used == true`, feature events should include the relevant boolean.
99
+
100
+ ---
101
+
102
+ ## Step 6: Extract Profile Attributes
103
+
104
+ Parse all `guards[].expression` and `suppressions[].expression` strings across all messages. Extract every user profile attribute that devs need to maintain in the user profile or event context.
105
+
106
+ Examples:
107
+ - `user.email_verified == true` → attribute: `user.email_verified` (boolean)
108
+ - `user.plan == 'free'` → attribute: `user.plan` (string enum)
109
+ - `feature.agenda_used == true` → attribute: `feature.agenda_used` (boolean)
110
+ - `message.AC-02.sent_at < 24h_ago` → attribute: `message.AC-02.sent_at` (timestamp)
111
+
112
+ Group these into:
113
+ - **User attributes** (`user.*`)
114
+ - **Feature flags** (`feature.*`)
115
+ - **Message state** (`message.*`)
116
+
117
+ ---
118
+
119
+ ## Output A: Introduction Email (`dev-handoff-email.md`)
120
+
121
+ Write a markdown email draft that marketing/product can send to the engineering team. Use the brand voice from `analysis.json` but adjust it for an internal engineering audience -- professional, direct, and respectful of dev time.
122
+
123
+ ### Email Structure
124
+
125
+ ```markdown
126
+ **Subject:** [Project context] -- Event instrumentation for lifecycle messaging
127
+
128
+ **From:** [Use a sender persona from analysis.voice.sender_personas, or default to "Product Team"]
129
+
130
+ ---
131
+
132
+ Hey team,
133
+
134
+ [1-2 sentence context: what this project is and why it matters]
135
+
136
+ [1 sentence: what we need from engineering]
137
+
138
+ ### Scope
139
+
140
+ - **[N] product events** need to be instrumented
141
+ - **[N] are critical** (block 3+ messages each)
142
+ - **[N] user profile attributes** need to be tracked
143
+ - Events are organized into [N] categories: [list categories]
144
+
145
+ ### Top Priority Events
146
+
147
+ [Table of Critical + High priority events with columns: Event | Category | Messages Blocked]
148
+
149
+ ### Suggested Implementation Phases
150
+
151
+ **Phase 1 — Identity & Transactional (ship first)**
152
+ [List the identity/account events -- these are needed for mandatory transactional messages]
153
+
154
+ **Phase 2 — Activation Events**
155
+ [List activation/feature events -- these power the onboarding sequence]
156
+
157
+ **Phase 3 — Conversion & Retention**
158
+ [List trial, subscription, and behavioral events]
159
+
160
+ **Phase 4 — Growth & Analytics**
161
+ [List remaining events: milestones, referral, usage]
162
+
163
+ ### Full Spec
164
+
165
+ The complete technical spec with payload schemas, code examples, and implementation notes is in `event-spec.html`. Open it in any browser.
166
+
167
+ [Friendly sign-off matching the brand voice]
168
+ ```
169
+
170
+ Write to `{project-directory}/dev-handoff-email.md`.
171
+
172
+ ---
173
+
174
+ ## Output B: Technical Event Spec (`event-spec.html`)
175
+
176
+ Create a single, self-contained HTML file. No build step required.
177
+
178
+ ### CDN Dependencies
179
+
180
+ ```html
181
+ <script src="https://cdn.tailwindcss.com"></script>
182
+ ```
183
+
184
+ ### Page Structure
185
+
186
+ #### 1. Header
187
+ - Title: "Event Implementation Spec"
188
+ - Company name from `analysis.json`
189
+ - Generation date
190
+ - Summary stats: N events, N categories, N dependent messages
191
+
192
+ #### 2. Priority Overview Table
193
+
194
+ A summary table with all events, sortable by priority:
195
+
196
+ | Event | Category | Trigger Type | Messages Blocked | Priority |
197
+ |-------|----------|-------------|-----------------|----------|
198
+
199
+ Priority badges use color:
200
+ - Critical: red
201
+ - High: orange
202
+ - Medium: blue
203
+ - Low: gray
204
+
205
+ #### 3. Per-Event Detail Sections
206
+
207
+ For each event (grouped by category, ordered by priority within category):
208
+
209
+ ```
210
+ ┌─────────────────────────────────────────────────┐
211
+ │ feature.agenda_used_first_time CRITICAL │
212
+ │ Category: Feature Usage │
213
+ ├─────────────────────────────────────────────────┤
214
+ │ Description: [AI-inferred 1-2 sentence │
215
+ │ description of when this event fires] │
216
+ │ │
217
+ │ When to fire: [Clear instruction for devs, │
218
+ │ e.g., "Fire when a user creates their first │
219
+ │ agenda in any session"] │
220
+ │ │
221
+ │ Properties: │
222
+ │ ┌──────────────┬────────┬──────────┬───────────┐ │
223
+ │ │ Property │ Type │ Required │ Example │ │
224
+ │ ├──────────────┼────────┼──────────┼───────────┤ │
225
+ │ │ user_id │ string │ yes │ "usr_123" │ │
226
+ │ │ timestamp │ string │ yes │ ISO 8601 │ │
227
+ │ │ feature_name │ string │ yes │ "agenda" │ │
228
+ │ │ session_id │ string │ no │ "ses_456" │ │
229
+ │ └──────────────┴────────┴──────────┴───────────┘ │
230
+ │ │
231
+ │ Used by messages: │
232
+ │ • AC-01: Master your agenda (trigger) │
233
+ │ • AC-03: Collaboration tips (suppression) │
234
+ │ │
235
+ │ Code example: │
236
+ │ ┌────────────────────────────────────────────┐ │
237
+ │ │ analytics.track("feature.agenda_used_ │ │
238
+ │ │ first_time", { │ │
239
+ │ │ user_id: user.id, │ │
240
+ │ │ timestamp: new Date().toISOString(), │ │
241
+ │ │ feature_name: "agenda", │ │
242
+ │ │ session_id: session.id │ │
243
+ │ │ }); │ │
244
+ │ └────────────────────────────────────────────┘ │
245
+ │ │
246
+ │ Implementation notes: │
247
+ │ [Any special notes, e.g., "This is a │
248
+ │ one-time event -- only fire on the user's │
249
+ │ first use, not subsequent uses"] │
250
+ └─────────────────────────────────────────────────┘
251
+ ```
252
+
253
+ #### Special handling:
254
+
255
+ - **Behavioral events** (`user.inactive_*`): Add a note that these require a background job or scheduled task, not real-time instrumentation. Suggest a cron pattern (e.g., "Run daily at midnight, check last_active_at against threshold").
256
+ - **Scheduled events** (trigger type `scheduled`): Include the schedule pattern from `trigger.schedule` and note that these need a job scheduler, not user-triggered instrumentation.
257
+
258
+ #### 4. Profile Attributes Appendix
259
+
260
+ A table of all user profile attributes extracted from guard/suppression expressions:
261
+
262
+ | Attribute | Type | Used In | Description |
263
+ |-----------|------|---------|-------------|
264
+ | `user.email_verified` | boolean | AQ-01 guard, AC-01 guard | Whether the user has verified their email |
265
+ | `user.plan` | string | RV-01 guard, RV-02 guard | Current subscription plan (free, trial, pro, enterprise) |
266
+ | `feature.agenda_used` | boolean | AC-01 suppression | Whether the user has used the agenda feature |
267
+
268
+ ### Implementation Notes
269
+
270
+ - All data is embedded as JSON in a `<script>` tag -- no external data files
271
+ - Use vanilla JavaScript for interactivity (sorting, expand/collapse)
272
+ - Make sure it works when opened directly from the filesystem (`file://` protocol)
273
+ - Responsive layout
274
+ - Dark/light mode: follow system preference with `prefers-color-scheme`
275
+ - Code examples use a monospace font with syntax-appropriate styling
276
+ - Add a "Copy" button on each code example block
277
+ - Include the standard footer with repo link:
278
+ ```html
279
+ <footer>
280
+ <a href="https://github.com/sr-kai/mango-lollipop">Mango Lollipop</a> — AI-powered lifecycle messaging for SaaS<br>
281
+ Made by Sasha Kai with probably too much coffee.
282
+ </footer>
283
+ ```
284
+
285
+ Write to `{project-directory}/event-spec.html`.
286
+
287
+ ---
288
+
289
+ ## Completion
290
+
291
+ After generating both files:
292
+
293
+ 1. Tell the user: "Your developer hand-off documents are ready."
294
+ 2. Summarize: "[N] events extracted, [N critical / N high / N medium / N low]. The email draft is in `dev-handoff-email.md` and the full technical spec is in `event-spec.html`."
295
+ 3. Suggest: "Open `event-spec.html` in a browser to review the full spec. Edit `dev-handoff-email.md` to customize the email before sending it to your engineering team."
@@ -0,0 +1,195 @@
1
+ # Generate Visual Deliverables
2
+
3
+ You are a lifecycle messaging visualization specialist. Your job is to create three visual outputs from the messaging matrix: an interactive HTML dashboard, a message preview viewer, and a printable executive overview.
4
+
5
+ ## Input
6
+
7
+ Read from the project output directory:
8
+ 1. **`analysis.json`** -- Company info, channels, voice profile
9
+ 2. **`matrix.json`** -- All messages with triggers, guards, suppressions, channels, tags
10
+ 3. **`messages/`** directory -- Individual message files (for preview content in dashboard)
11
+
12
+ Locate the project output directory by checking the current working directory or `output/*/` subdirectories.
13
+
14
+ ---
15
+
16
+ ## Output A: Interactive Dashboard (`dashboard.html`)
17
+
18
+ Create a single, self-contained HTML file. No build step, no external files needed beyond CDN resources.
19
+
20
+ ### CDN Dependencies
21
+
22
+ ```html
23
+ <!-- Tailwind CSS for styling -->
24
+ <script src="https://cdn.tailwindcss.com"></script>
25
+ ```
26
+
27
+ ### Dashboard Sections
28
+
29
+ #### 1. Header
30
+ - Project name from `analysis.json`
31
+ - Company name
32
+ - Generation date
33
+ - Message count summary (e.g., "5 TX + 16 Lifecycle = 21 total")
34
+
35
+ #### 2. TX / Lifecycle Toggle
36
+ - Two-tab interface: "Transactional" and "Lifecycle"
37
+ - Default to Lifecycle view
38
+ - Transactional tab shows TX messages in a simple table
39
+ - Lifecycle tab shows the full AARRR matrix
40
+
41
+ #### 3. Filter Sidebar
42
+ A left sidebar with three collapsible filter sections. Each section has a header that toggles collapse, and items that act as toggle filters:
43
+
44
+ - **Stage** (open by default) -- One row per stage (TX, AQ, AC, RV, RT, RF) with color badge and count. Click to toggle. OR logic within stages.
45
+ - **Channel** (open by default) -- One row per channel (email, in-app, etc.) with count. Click to toggle. OR logic within channels.
46
+ - **Tags** (open by default) -- Tag pills with counts. Click to toggle. OR logic within tags.
47
+ - **Clear all filters** button at the bottom to reset everything.
48
+
49
+ Filters across sections use AND logic (stage AND channel AND tag must match).
50
+
51
+ #### 4. Matrix Table
52
+ - Sortable by clicking column headers (ID, Stage, Name, Channel, Wait, Tags)
53
+ - Columns: ID | Stage | Name | Trigger | Wait | Channel | CTA | Tags
54
+ - Color-code rows by stage
55
+ - Click any row to expand a detail panel showing guards, suppressions, comments, and message body (if available)
56
+
57
+ #### 5. Message Previews
58
+ - Click any row in the matrix table to expand and show the message detail
59
+ - Show subject + body if available (from generate-messages), otherwise show comments
60
+ - Read message content from embedded JSON data
61
+ - Each expanded detail includes an "Open full preview" link to `messages.html#MSG-ID`
62
+
63
+ ### Implementation Notes
64
+
65
+ - All data is embedded as JSON in a `<script>` tag -- no external data files
66
+ - Use vanilla JavaScript for interactivity (no framework needed)
67
+ - Make sure it works when opened directly from the filesystem (`file://` protocol)
68
+ - Responsive layout: works on both desktop and tablet screens
69
+ - Dark/light mode: follow system preference with `prefers-color-scheme`
70
+ - All HTML outputs must include the standard footer with repo link:
71
+ ```html
72
+ <footer>
73
+ <a href="https://github.com/sr-kai/mango-lollipop">Mango Lollipop</a> — AI-powered lifecycle messaging for SaaS<br>
74
+ Made by Sasha Kai with probably too much coffee.
75
+ </footer>
76
+ ```
77
+
78
+ Write the output to `{project-directory}/dashboard.html`.
79
+
80
+ ---
81
+
82
+ ## Output B: Message Viewer (`messages.html`)
83
+
84
+ A single-page message preview viewer with hash-based routing. Each message gets a channel-specific visual preview.
85
+
86
+ ### Design
87
+
88
+ - **Hash routing:** `messages.html#AQ-01` navigates directly to that message. Works with `file://` protocol.
89
+ - **Left sidebar:** Messages grouped by AARRR stage with color badges. Click to navigate.
90
+ - **Main preview area:** Channel-specific rendered preview of the selected message.
91
+ - **Details card:** Below the preview, shows trigger, wait, guards, suppressions, tags, goal, comments.
92
+ - **Keyboard navigation:** Arrow up/down (or j/k) to move between messages.
93
+ - **Back to dashboard:** Link in the header returns to `dashboard.html`.
94
+
95
+ ### Channel-Specific Templates
96
+
97
+ Each message renders in a visual template matching its channel:
98
+
99
+ - **Email:** Email client frame with toolbar dots, From/To/Subject header, body content, and CTA button.
100
+ - **In-App:** Modal overlay with close button, title, body, and CTA button.
101
+ - **SMS:** Phone frame with chat bubble, sender name, and timestamp.
102
+ - **Push:** Phone frame with notification card showing app icon, title, and body.
103
+
104
+ ### Content Handling
105
+
106
+ - If message copy exists (from `generate-messages`), the viewer parses it and renders the channel-specific content.
107
+ - If copy hasn't been generated yet, the viewer shows a placeholder with the message's comments and a note to run `generate-messages`.
108
+ - Content is parsed from markdown files: `## Email`, `## In-App`, `## SMS`, `## Push Notification` sections.
109
+
110
+ Write the output to `{project-directory}/messages.html`.
111
+
112
+ ---
113
+
114
+ ## Output C: Executive Overview (`overview.html`)
115
+
116
+ Create a clean, printable HTML page designed for sharing with stakeholders.
117
+
118
+ ### Design Principles
119
+ - Clean, minimal design suitable for printing
120
+ - No interactive elements (no JavaScript required for content)
121
+ - Professional typography (system fonts)
122
+ - Fits well on A4/Letter paper when printed from browser
123
+ - Uses inline CSS only (no CDN dependencies for printing reliability)
124
+
125
+ ### Sections
126
+
127
+ #### 1. Title Block
128
+ - "Lifecycle Messaging Strategy" as main title
129
+ - Company name from `analysis.json`
130
+ - Generation date
131
+ - Path indicator: "Built from scratch" or "Built on existing messaging"
132
+
133
+ #### 2. Company Overview
134
+ - Product type, target audience, key value proposition
135
+ - Aha moment
136
+ - Selected channels
137
+ - Voice profile summary (tone, formality, emoji usage)
138
+
139
+ #### 3. Strategy Summary
140
+ - One paragraph per AARRR stage explaining the strategy
141
+ - For PATH B: note what was kept, improved, and added
142
+
143
+ #### 4. Condensed Matrix Table
144
+ - All messages in a single table
145
+ - Columns: ID | Stage | Name | Channel(s) | Trigger | Wait | CTA
146
+ - Color-coded rows by stage
147
+ - Print-friendly (no scroll, wraps across pages if needed)
148
+
149
+ #### 5. Message Inventory
150
+ - Count by stage:
151
+ - TX: N transactional messages
152
+ - AQ: N acquisition messages
153
+ - AC: N activation messages
154
+ - RV: N revenue messages
155
+ - RT: N retention messages
156
+ - RF: N referral messages
157
+ - Count by channel: N email, N in-app, N push, N SMS
158
+
159
+ #### 6. Tag Summary
160
+ - Table of all tags with message counts
161
+ - Grouped by category
162
+
163
+ #### 7. Recommended Implementation Order
164
+ - Prioritized list of which messages to implement first
165
+ - Priority logic:
166
+ 1. TX messages (mandatory, implement immediately)
167
+ 2. AQ messages (first user experience)
168
+ 3. AC messages for the top 2-3 features (drive to aha moment)
169
+ 4. RV messages (capture revenue)
170
+ 5. RT messages (reduce churn)
171
+ 6. RF messages (growth)
172
+ 7. Remaining AC messages
173
+
174
+ Write the output to `{project-directory}/overview.html`.
175
+
176
+ ---
177
+
178
+ ## Completion
179
+
180
+ Generate all outputs by running the following commands:
181
+
182
+ ```bash
183
+ npm run build && node bin/mango-lollipop.js export visuals
184
+ ```
185
+
186
+ This creates three files in the project output directory:
187
+ - `dashboard.html` -- Interactive dashboard with filters and sorting
188
+ - `messages.html` -- Channel-specific message previews with hash routing
189
+ - `overview.html` -- Printable executive overview
190
+
191
+ After the command succeeds:
192
+
193
+ 1. Update `mango-lollipop.json` to set `stage: "visuals-generated"`
194
+ 2. Tell the user: "Your visual deliverables are ready. Open `dashboard.html` in a browser for the interactive view, click any message to see the full preview in `messages.html`, or share `overview.html` as a printable summary."
195
+ 3. Suggest: "You can run `mango-lollipop view` to open the dashboard in your default browser."