vibebusiness 1.2.46 → 1.2.49

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 (108) hide show
  1. package/.next/standalone/.env +5 -1
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/app-build-manifest.json +17 -17
  4. package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/standalone/.next/build-manifest.json +2 -2
  6. package/.next/standalone/.next/prerender-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  10. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  11. package/.next/standalone/.next/server/app/api/analyze/route.js.nft.json +1 -1
  12. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  13. package/.next/standalone/.next/server/app/api/epics/[id]/ideas/route.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/api/epics/[id]/route.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/api/epics/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/goals/[id]/kpis/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/goals/[id]/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/goals/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/hypotheses/[id]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/hypotheses/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/ideas/[id]/comments/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/ideas/[id]/implement/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/ideas/[id]/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/ideas/[id]/transition/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/ideas/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/implementations/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/kpis/refresh/route.js +1 -1
  28. package/.next/standalone/.next/server/app/api/kpis/refresh/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/social/[id]/publish/route.js +1 -1
  30. package/.next/standalone/.next/server/app/api/social/[id]/publish/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/social/[id]/route.js +1 -1
  32. package/.next/standalone/.next/server/app/api/social/[id]/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/social/route.js +1 -1
  34. package/.next/standalone/.next/server/app/api/social/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/goals/[id]/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/goals/page.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/goals/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/hypotheses/[id]/page.js +1 -1
  39. package/.next/standalone/.next/server/app/hypotheses/[id]/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/hypotheses/page.js +1 -1
  41. package/.next/standalone/.next/server/app/hypotheses/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/hypotheses/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/ideas/[id]/page.js +1 -1
  44. package/.next/standalone/.next/server/app/ideas/[id]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/ideas/[id]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/page.js +1 -1
  47. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/roadmap/[id]/page.js +1 -1
  50. package/.next/standalone/.next/server/app/roadmap/[id]/page_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/roadmap/page.js +1 -1
  52. package/.next/standalone/.next/server/app/roadmap/page.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/roadmap/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/sessions/page.js +1 -1
  55. package/.next/standalone/.next/server/app/sessions/page.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  58. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/settings.html +1 -1
  60. package/.next/standalone/.next/server/app/settings.rsc +2 -2
  61. package/.next/standalone/.next/server/app/social/page.js +1 -1
  62. package/.next/standalone/.next/server/app/social/page_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/social.html +1 -1
  64. package/.next/standalone/.next/server/app/social.rsc +3 -3
  65. package/.next/standalone/.next/server/app-paths-manifest.json +13 -13
  66. package/.next/standalone/.next/server/chunks/3644.js +1 -1
  67. package/.next/standalone/.next/server/chunks/{7809.js → 3794.js} +103 -2
  68. package/.next/standalone/.next/server/pages/404.html +1 -1
  69. package/.next/standalone/.next/server/pages/500.html +1 -1
  70. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  71. package/.next/standalone/data/business-context.json +7 -4
  72. package/.next/standalone/data/copy/landing-landing-page-2026-02-20.md +1 -1
  73. package/.next/standalone/data/heartbeat-sessions.json +211 -10
  74. package/.next/standalone/data/hypotheses.json +2 -2
  75. package/.next/standalone/data/ideas.json +958 -449
  76. package/.next/standalone/data/implementations.json +136 -2
  77. package/.next/standalone/data/positioning.json +1 -1
  78. package/.next/standalone/data/reports/visuals/promo-launch.png +0 -0
  79. package/.next/standalone/data/reports/visuals/promo-ship-fast.png +0 -0
  80. package/.next/standalone/data/reports/visuals/promo-while-you-slept-v2.png +0 -0
  81. package/.next/standalone/data/reports/visuals/promo-while-you-slept-v3.png +0 -0
  82. package/.next/standalone/data/reports/visuals/promo-while-you-slept.png +0 -0
  83. package/.next/standalone/package.json +2 -2
  84. package/.next/standalone/scripts/analyze.ts +2 -2
  85. package/.next/standalone/scripts/implement.ts +5 -5
  86. package/.next/standalone/scripts/skills/social-media.ts +310 -9
  87. package/.next/static/chunks/{444-125b7b0fa8cbdb81.js → 444-1826396aef4dab2f.js} +1 -1
  88. package/.next/static/chunks/app/hypotheses/[id]/{page-65032da79ae146c5.js → page-8999ee91b824d378.js} +1 -1
  89. package/.next/static/chunks/app/hypotheses/page-6206bce440c44569.js +1 -0
  90. package/.next/static/chunks/app/ideas/[id]/{page-dc9746061e58eea5.js → page-89e3625db9017166.js} +1 -1
  91. package/.next/static/chunks/app/{page-fb66ff080390f20a.js → page-8ba52ac74c75461b.js} +1 -1
  92. package/.next/static/chunks/app/roadmap/[id]/{page-c8c4baf233e0d480.js → page-f437e783039534c4.js} +1 -1
  93. package/.next/static/chunks/app/roadmap/{page-b15554a207ed2813.js → page-6177b8774b4af79f.js} +1 -1
  94. package/.next/static/chunks/app/social/{page-6c61fb0c2546313e.js → page-69e480936711ccf2.js} +1 -1
  95. package/README.md +1 -1
  96. package/dist/bin/vibebusiness.js +22 -0
  97. package/dist/scripts/analyze.js +4 -3
  98. package/dist/scripts/chat.js +10 -2
  99. package/dist/scripts/generate-idea.js +1 -0
  100. package/dist/scripts/heartbeat.js +2265 -653
  101. package/dist/scripts/implement.js +5 -4
  102. package/dist/scripts/init.js +5 -0
  103. package/dist/scripts/scan.js +2 -1
  104. package/package.json +2 -2
  105. package/templates/commands/setup-posthog.md +116 -0
  106. package/.next/static/chunks/app/hypotheses/page-8314da4be7c533bd.js +0 -1
  107. /package/.next/static/{Tko0dnk2wKPorUxfNnm0x → zIIaTqrawBK1MmHg37JOr}/_buildManifest.js +0 -0
  108. /package/.next/static/{Tko0dnk2wKPorUxfNnm0x → zIIaTqrawBK1MmHg37JOr}/_ssgManifest.js +0 -0
@@ -7,13 +7,18 @@
7
7
  * 3. User reviews and publishes from the /social dashboard
8
8
  *
9
9
  * Task prefixes handled:
10
- * social-setup-x → Validate X credentials, save username
11
- * social-draft-ship → Draft a "just shipped" tweet from latest shipped idea
12
- * social-draft-update → Draft a product update from positioning data
13
- * social-draft-milestone → Draft a milestone tweet from a KPI that hit target
14
- * social-draft-digest → Draft a weekly recap tweet
15
- * social-publish-{id} Post draft {id} to Twitter/X
16
- * social-check-statusAudit: credentials valid? Draft count? Post streak?
10
+ * social-setup-x → Validate X credentials, save username
11
+ * social-draft-ship → Draft a "just shipped" tweet from latest shipped idea
12
+ * social-draft-ship-visual → Draft ship tweet with card/video media
13
+ * social-draft-update → Draft a product update from positioning data
14
+ * social-draft-milestone → Draft a milestone tweet from a KPI that hit target
15
+ * social-draft-digest Draft a weekly recap tweet
16
+ * social-draft-viral-{type}AI-generated viral tweet (ship|milestone|update|insight|question)
17
+ * social-draft-thread-{topic} → AI-generated viral thread on a topic
18
+ * social-publish-{id} → Post draft {id} to Twitter/X (supports threads)
19
+ * social-track-metrics → Fetch engagement metrics for recent published tweets
20
+ * social-score-{id} → Score a draft for viral potential (0-100)
21
+ * social-check-status → Audit: credentials valid? Draft count? Post streak?
17
22
  */
18
23
 
19
24
  import * as fs from 'fs';
@@ -27,6 +32,9 @@ import {
27
32
  postTweet,
28
33
  uploadMedia,
29
34
  postTweetWithMedia,
35
+ postThread,
36
+ getTweetMetrics,
37
+ getBatchTweetMetrics,
30
38
  } from '../lib/social/x-api';
31
39
  import {
32
40
  generateShipTweet,
@@ -34,7 +42,13 @@ import {
34
42
  generateDigestTweet,
35
43
  generateProductUpdateTweet,
36
44
  } from '../lib/social/content-generator';
37
- import type { SocialConfig, SocialDraft, SocialDraftSource, BusinessGoal } from '../../src/lib/types';
45
+ import {
46
+ generateViralTweet,
47
+ generateViralThread,
48
+ scoreDraft,
49
+ type TweetTopic,
50
+ } from '../lib/social/ai-content-generator';
51
+ import type { SocialConfig, SocialDraft, SocialDraftSource, TweetEngagement, BusinessGoal } from '../../src/lib/types';
38
52
 
39
53
  // ─── State ───────────────────────────────────────────────────────────────────
40
54
 
@@ -150,7 +164,11 @@ const SOCIAL_PREFIXES = [
150
164
  'social-draft-update',
151
165
  'social-draft-milestone',
152
166
  'social-draft-digest',
167
+ 'social-draft-viral-',
168
+ 'social-draft-thread-',
153
169
  'social-publish-',
170
+ 'social-track-metrics',
171
+ 'social-score-',
154
172
  'social-check-status',
155
173
  ] as const;
156
174
 
@@ -188,10 +206,25 @@ export async function executeSocialTask(
188
206
  if (taskId === 'social-draft-digest') {
189
207
  return executeDraftDigest();
190
208
  }
209
+ if (taskId.startsWith('social-draft-viral-')) {
210
+ const topic = taskId.replace('social-draft-viral-', '') as TweetTopic;
211
+ return await executeDraftViral(topic, description);
212
+ }
213
+ if (taskId.startsWith('social-draft-thread-')) {
214
+ const topic = taskId.replace('social-draft-thread-', '');
215
+ return await executeDraftThread(topic, description);
216
+ }
191
217
  if (taskId.startsWith('social-publish-')) {
192
218
  const draftId = taskId.replace('social-publish-', '');
193
219
  return await executePublish(draftId);
194
220
  }
221
+ if (taskId === 'social-track-metrics') {
222
+ return await executeTrackMetrics();
223
+ }
224
+ if (taskId.startsWith('social-score-')) {
225
+ const draftId = taskId.replace('social-score-', '');
226
+ return await executeScoreDraft(draftId);
227
+ }
195
228
  if (taskId === 'social-check-status') {
196
229
  return await executeCheckStatus();
197
230
  }
@@ -214,11 +247,37 @@ export function readSocialFreshness(): {
214
247
  post_streak_days: number;
215
248
  total_posts: number;
216
249
  last_post_date: string | null;
250
+ avg_engagement_rate: number | null;
251
+ best_tweet_id: string | null;
252
+ best_engagement_rate: number | null;
253
+ thread_count: number;
217
254
  } {
218
255
  const state = loadState();
219
256
  const pendingDrafts = state.drafts.filter((d) => d.status === 'draft').length;
220
257
  const streak = computeStreak(state);
221
258
 
259
+ // Aggregate engagement data from published drafts
260
+ const allEngagement: TweetEngagement[] = [];
261
+ for (const draft of state.drafts) {
262
+ if (draft.engagement_history && draft.engagement_history.length > 0) {
263
+ // Use the most recent snapshot for each draft
264
+ allEngagement.push(draft.engagement_history[draft.engagement_history.length - 1]);
265
+ }
266
+ }
267
+
268
+ let avgEngagementRate: number | null = null;
269
+ let bestTweetId: string | null = null;
270
+ let bestEngagementRate: number | null = null;
271
+
272
+ if (allEngagement.length > 0) {
273
+ avgEngagementRate = allEngagement.reduce((s, e) => s + e.engagement_rate, 0) / allEngagement.length;
274
+ const best = allEngagement.reduce((a, b) => a.engagement_rate > b.engagement_rate ? a : b);
275
+ bestTweetId = best.tweet_id;
276
+ bestEngagementRate = best.engagement_rate;
277
+ }
278
+
279
+ const threadCount = state.drafts.filter((d) => d.is_thread && d.status === 'published').length;
280
+
222
281
  return {
223
282
  configured: state.credentials_valid,
224
283
  credentials_valid: state.credentials_valid,
@@ -227,6 +286,10 @@ export function readSocialFreshness(): {
227
286
  post_streak_days: streak,
228
287
  total_posts: state.metrics.total_posts,
229
288
  last_post_date: state.metrics.last_post_date,
289
+ avg_engagement_rate: avgEngagementRate,
290
+ best_tweet_id: bestTweetId,
291
+ best_engagement_rate: bestEngagementRate,
292
+ thread_count: threadCount,
230
293
  };
231
294
  }
232
295
 
@@ -411,7 +474,30 @@ async function executePublish(draftId: string): Promise<{ success: boolean; outp
411
474
 
412
475
  const client = createXClient(credentials);
413
476
 
414
- // Upload media if attached, then post tweet
477
+ // Thread publishing
478
+ if (draft.is_thread && draft.thread_tweets && draft.thread_tweets.length > 0) {
479
+ const results = await postThread(client, draft.thread_tweets);
480
+
481
+ draft.status = 'published';
482
+ draft.published_at = new Date().toISOString();
483
+ draft.tweet_id = results[0].id;
484
+ draft.tweet_url = results[0].url;
485
+ draft.thread_tweet_ids = results.map((r) => r.id);
486
+
487
+ state.metrics.total_posts++;
488
+ state.metrics.last_post_date = new Date().toISOString().split('T')[0];
489
+ state.metrics.post_streak_days = computeStreak(state);
490
+
491
+ saveState(state);
492
+ syncKPIs(state);
493
+
494
+ return {
495
+ success: true,
496
+ output: `Published thread (${results.length} tweets): ${results[0].url}`,
497
+ };
498
+ }
499
+
500
+ // Single tweet publishing (with optional media)
415
501
  let result;
416
502
  if (draft.media_paths && draft.media_paths.length > 0) {
417
503
  const validPaths = draft.media_paths.filter((p) => fs.existsSync(p));
@@ -452,6 +538,213 @@ async function executePublish(draftId: string): Promise<{ success: boolean; outp
452
538
  };
453
539
  }
454
540
 
541
+ // ─── AI-Powered Draft Tasks ───────────────────────────────────────────────
542
+
543
+ async function executeDraftViral(
544
+ topic: TweetTopic,
545
+ description: string,
546
+ ): Promise<{ success: boolean; output: string }> {
547
+ const state = loadState();
548
+
549
+ // Collect engagement history from published drafts for AI optimization
550
+ const pastPerformance = collectEngagementHistory(state);
551
+
552
+ const result = await generateViralTweet({
553
+ topic,
554
+ context: description || `A ${topic} tweet about our product`,
555
+ pastPerformance,
556
+ });
557
+
558
+ const source: SocialDraftSource = topic === 'insight' || topic === 'question' ? 'insight' : topic as SocialDraftSource;
559
+ const draft = createDraft(state, result.text, source, null);
560
+ saveState(state);
561
+
562
+ return {
563
+ success: true,
564
+ output: [
565
+ `Created AI-generated ${topic} draft: "${draft.text}" (${draft.id})`,
566
+ `Hook type: ${result.hook_type}`,
567
+ `Estimated engagement: ${result.estimated_engagement}`,
568
+ ].join('\n'),
569
+ };
570
+ }
571
+
572
+ async function executeDraftThread(
573
+ topic: string,
574
+ description: string,
575
+ ): Promise<{ success: boolean; output: string }> {
576
+ const state = loadState();
577
+
578
+ const pastPerformance = collectEngagementHistory(state);
579
+
580
+ const result = await generateViralThread({
581
+ topic,
582
+ context: description || `A thread about ${topic}`,
583
+ threadLength: 5,
584
+ pastPerformance,
585
+ });
586
+
587
+ if (!result.tweets || result.tweets.length === 0) {
588
+ return { success: false, output: 'AI failed to generate thread content.' };
589
+ }
590
+
591
+ const draft: SocialDraft = {
592
+ id: `draft-${uuidv4().slice(0, 8)}`,
593
+ text: result.tweets[0],
594
+ source: 'thread',
595
+ source_ref: null,
596
+ status: 'draft',
597
+ created_at: new Date().toISOString(),
598
+ published_at: null,
599
+ tweet_id: null,
600
+ tweet_url: null,
601
+ is_thread: true,
602
+ thread_tweets: result.tweets,
603
+ };
604
+
605
+ state.drafts.push(draft);
606
+ saveState(state);
607
+
608
+ return {
609
+ success: true,
610
+ output: [
611
+ `Created thread draft (${result.tweets.length} tweets): ${draft.id}`,
612
+ `Hook type: ${result.hook_type}`,
613
+ `Preview:`,
614
+ ...result.tweets.map((t, i) => ` ${i + 1}. "${t.slice(0, 60)}${t.length > 60 ? '...' : ''}"`),
615
+ ].join('\n'),
616
+ };
617
+ }
618
+
619
+ // ─── Engagement Tracking ──────────────────────────────────────────────────
620
+
621
+ async function executeTrackMetrics(): Promise<{ success: boolean; output: string }> {
622
+ const state = loadState();
623
+
624
+ const credentials = loadCredentials();
625
+ if (!credentials) {
626
+ return { success: false, output: 'X API credentials not configured. Run social-setup-x first.' };
627
+ }
628
+
629
+ const client = createXClient(credentials);
630
+
631
+ // Find all published tweets from the last 7 days
632
+ const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
633
+ const recentPublished = state.drafts.filter(
634
+ (d) => d.status === 'published' && d.published_at && d.published_at > sevenDaysAgo && d.tweet_id,
635
+ );
636
+
637
+ if (recentPublished.length === 0) {
638
+ return { success: true, output: 'No published tweets in the last 7 days to track.' };
639
+ }
640
+
641
+ // Collect all tweet IDs (including thread tweets)
642
+ const tweetIds: string[] = [];
643
+ for (const draft of recentPublished) {
644
+ if (draft.thread_tweet_ids && draft.thread_tweet_ids.length > 0) {
645
+ tweetIds.push(...draft.thread_tweet_ids);
646
+ } else if (draft.tweet_id) {
647
+ tweetIds.push(draft.tweet_id);
648
+ }
649
+ }
650
+
651
+ const metrics = await getBatchTweetMetrics(client, tweetIds);
652
+
653
+ if (metrics.length === 0) {
654
+ return { success: true, output: 'Could not fetch metrics (API may require elevated access).' };
655
+ }
656
+
657
+ // Update engagement_history on each draft
658
+ for (const draft of recentPublished) {
659
+ if (!draft.engagement_history) {
660
+ draft.engagement_history = [];
661
+ }
662
+
663
+ // For threads, aggregate metrics across all tweets
664
+ if (draft.thread_tweet_ids && draft.thread_tweet_ids.length > 0) {
665
+ const threadMetrics = metrics.filter((m) => draft.thread_tweet_ids!.includes(m.tweet_id));
666
+ if (threadMetrics.length > 0) {
667
+ const aggregated: TweetEngagement = {
668
+ tweet_id: draft.tweet_id!,
669
+ impressions: threadMetrics.reduce((s, m) => s + m.impressions, 0),
670
+ likes: threadMetrics.reduce((s, m) => s + m.likes, 0),
671
+ retweets: threadMetrics.reduce((s, m) => s + m.retweets, 0),
672
+ replies: threadMetrics.reduce((s, m) => s + m.replies, 0),
673
+ bookmarks: threadMetrics.reduce((s, m) => s + m.bookmarks, 0),
674
+ profile_clicks: threadMetrics.reduce((s, m) => s + m.profile_clicks, 0),
675
+ engagements: threadMetrics.reduce((s, m) => s + m.engagements, 0),
676
+ engagement_rate: 0,
677
+ fetched_at: new Date().toISOString(),
678
+ };
679
+ aggregated.engagement_rate = aggregated.impressions > 0
680
+ ? aggregated.engagements / aggregated.impressions
681
+ : 0;
682
+ draft.engagement_history.push(aggregated);
683
+ }
684
+ } else {
685
+ const tweetMetric = metrics.find((m) => m.tweet_id === draft.tweet_id);
686
+ if (tweetMetric) {
687
+ draft.engagement_history.push(tweetMetric);
688
+ }
689
+ }
690
+ }
691
+
692
+ saveState(state);
693
+
694
+ // Summary
695
+ const lines = [`Tracked metrics for ${metrics.length} tweet(s):`];
696
+ for (const m of metrics) {
697
+ lines.push(
698
+ ` ${m.tweet_id}: ${m.impressions} impressions, ${m.likes} likes, ${m.bookmarks} bookmarks, ${(m.engagement_rate * 100).toFixed(2)}% rate`,
699
+ );
700
+ }
701
+
702
+ return { success: true, output: lines.join('\n') };
703
+ }
704
+
705
+ async function executeScoreDraft(draftId: string): Promise<{ success: boolean; output: string }> {
706
+ const state = loadState();
707
+ const draft = state.drafts.find((d) => d.id === draftId);
708
+
709
+ if (!draft) {
710
+ return { success: false, output: `Draft not found: ${draftId}` };
711
+ }
712
+
713
+ const textToScore = draft.is_thread && draft.thread_tweets
714
+ ? draft.thread_tweets.join('\n\n---\n\n')
715
+ : draft.text;
716
+
717
+ const pastPerformance = collectEngagementHistory(state);
718
+ const result = await scoreDraft(textToScore, pastPerformance);
719
+
720
+ return {
721
+ success: true,
722
+ output: [
723
+ `Draft Score: ${result.score}/100`,
724
+ '',
725
+ 'Feedback:',
726
+ ...result.feedback.map((f) => ` - ${f}`),
727
+ '',
728
+ `Optimized version: "${result.optimized_version}"`,
729
+ ].join('\n'),
730
+ };
731
+ }
732
+
733
+ // ─── Helpers ────────────────────────────────────────────────────────────────
734
+
735
+ /**
736
+ * Collect the latest engagement snapshot from each published draft.
737
+ */
738
+ function collectEngagementHistory(state: SocialConfig): TweetEngagement[] {
739
+ const result: TweetEngagement[] = [];
740
+ for (const draft of state.drafts) {
741
+ if (draft.engagement_history && draft.engagement_history.length > 0) {
742
+ result.push(draft.engagement_history[draft.engagement_history.length - 1]);
743
+ }
744
+ }
745
+ return result;
746
+ }
747
+
455
748
  async function executeCheckStatus(): Promise<{ success: boolean; output: string }> {
456
749
  const state = loadState();
457
750
  const freshness = readSocialFreshness();
@@ -486,8 +779,16 @@ async function executeCheckStatus(): Promise<{ success: boolean; output: string
486
779
  lines.push(` Pending drafts: ${freshness.draft_count}`);
487
780
  lines.push(` Post streak: ${freshness.post_streak_days} day(s)`);
488
781
  lines.push(` Total posts: ${freshness.total_posts}`);
782
+ lines.push(` Threads published: ${freshness.thread_count}`);
489
783
  lines.push(` Last post: ${freshness.last_post_date || 'never'}`);
490
784
 
785
+ if (freshness.avg_engagement_rate != null) {
786
+ lines.push(` Avg engagement rate: ${(freshness.avg_engagement_rate * 100).toFixed(2)}%`);
787
+ }
788
+ if (freshness.best_tweet_id) {
789
+ lines.push(` Best tweet: ${freshness.best_tweet_id} (${((freshness.best_engagement_rate ?? 0) * 100).toFixed(2)}% rate)`);
790
+ }
791
+
491
792
  return { success: true, output: lines.join('\n') };
492
793
  }
493
794
 
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[444],{2934:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},7168:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},3085:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]])},525:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},6865:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},1259:function(e,t,n){n.d(t,{default:function(){return f}});var r=n(7437),a=n(7648),i=n(9376),l=n(5466),s=n(2048),o=n(8896),c=n(8220),d=n(2718),u=n(5621),b=n(8728),g=n(2222),h=n(2023),x=n(1994),m=n(257);let p=[{href:"/",label:"Dashboard",icon:(0,r.jsx)(l.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,r.jsx)(s.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,r.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,r.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,r.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,r.jsx)(u.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,r.jsx)(b.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,n=(0,i.usePathname)();return(0,r.jsxs)("div",{className:"min-h-screen flex",children:[(0,r.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,r.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,r.jsxs)(a.default,{href:"/",className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,r.jsx)(g.Z,{className:"w-6 h-6 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,r.jsx)("p",{className:"text-xs text-slate-400",children:m.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,r.jsx)("nav",{className:"flex-1 p-4",children:(0,r.jsx)("ul",{className:"space-y-1",children:p.map(e=>{let t="/"===e.href?"/"===n:n.startsWith(e.href);return(0,r.jsx)("li",{children:(0,r.jsxs)(a.default,{href:e.href,className:(0,x.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,r.jsx)("span",{children:e.label})]})},e.href)})})}),(0,r.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,r.jsx)(h.Z,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,r.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},104:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(7437),a=n(1994);let i={on_track:"bg-emerald-500",at_risk:"bg-amber-500",behind:"bg-red-500",achieved:"bg-blue-500"};function l(e){let{current:t,target:n,unit:l,status:s,showLabels:o=!0}=e,c=null!==t?Math.min(t/n*100,100):0,d=e=>null===e?"--":"percent"===l||"%"===l?"".concat(e,"%"):"hours"===l?"".concat(e,"h"):"".concat(e," ").concat(l);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"relative h-2 bg-slate-100 rounded-full overflow-hidden",children:[(0,r.jsx)("div",{className:(0,a.Z)("absolute left-0 top-0 h-full rounded-full transition-all duration-500",i[s]),style:{width:"".concat(c,"%")}}),(0,r.jsx)("div",{className:"absolute top-0 w-0.5 h-full bg-slate-400",style:{left:"100%"},title:"Target: ".concat(d(n))})]}),o&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsxs)("span",{className:"text-xs text-slate-500",children:["Current: ",(0,r.jsx)("span",{className:"font-medium text-slate-700",children:d(t)})]}),(0,r.jsxs)("span",{className:"text-xs text-slate-500",children:["Target: ",(0,r.jsx)("span",{className:"font-medium text-slate-700",children:d(n)})]})]})]})}},281:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(7437),a=n(2265);function i(e){let{kpi:t,height:n=40,width:i,showTarget:l=!1}=e,{path:s,areaPath:o,minValue:c,maxValue:d,points:u}=(0,a.useMemo)(()=>{let e=t.history;if(0===e.length)return{path:"",areaPath:"",minValue:0,maxValue:0,points:[]};let r=e.map(e=>e.value),a=l&&null!==t.target_value?[...r,t.target_value]:r,s=Math.min(...a),o=Math.max(...a),c=o-s||1,d=s-.1*c,u=o+.1*c-d||1,b=n-4,g=(i||100)/Math.max(e.length-1,1),h=e.map((e,t)=>({x:t*g,y:b-(e.value-d)/u*b+2,value:e.value,date:e.date}));return 1===h.length?{path:"M ".concat(h[0].x," ").concat(h[0].y),areaPath:"",minValue:s,maxValue:o,points:h}:{path:h.map((e,t)=>0===t?"M ".concat(e.x," ").concat(e.y):"L ".concat(e.x," ").concat(e.y)).join(" "),areaPath:["M ".concat(h[0].x," ").concat(b+2),"L ".concat(h[0].x," ").concat(h[0].y),...h.slice(1).map(e=>"L ".concat(e.x," ").concat(e.y)),"L ".concat(h[h.length-1].x," ").concat(b+2),"Z"].join(" "),minValue:s,maxValue:o,points:h}},[t.history,t.target_value,n,i,l]),b=(()=>{if(t.history.length<2)return{stroke:"#94a3b8",fill:"rgba(148, 163, 184, 0.1)"};let e=t.history[0].value,n=t.history[t.history.length-1].value;return("higher_is_better"===t.direction?n>=e:n<=e)?{stroke:"#10b981",fill:"rgba(16, 185, 129, 0.1)"}:{stroke:"#ef4444",fill:"rgba(239, 68, 68, 0.1)"}})();if(0===t.history.length)return(0,r.jsx)("div",{className:"flex items-center justify-center text-xs text-slate-400",style:{height:n,width:i||"100%"},children:"No data"});let g=(()=>{if(!l||null===t.target_value||0===t.history.length)return null;let e=[...t.history.map(e=>e.value),t.target_value],r=Math.min(...e),a=Math.max(...e),i=a-r||1,s=r-.1*i,o=n-4;return o-(t.target_value-s)/(a+.1*i-s||1)*o+2})();return(0,r.jsxs)("svg",{width:i||"100%",height:n,viewBox:"0 0 ".concat(i||100," ").concat(n),preserveAspectRatio:"none",className:"overflow-visible",children:[o&&(0,r.jsx)("path",{d:o,fill:b.fill}),(0,r.jsx)("path",{d:s,fill:"none",stroke:b.stroke,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l&&null!==g&&(0,r.jsx)("line",{x1:0,y1:g,x2:i||100,y2:g,stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"4 2"}),u.length>0&&(0,r.jsx)("circle",{cx:u[u.length-1].x,cy:u[u.length-1].y,r:3,fill:b.stroke})]})}},6153:function(e,t,n){n.d(t,{G:function(){return s},GK:function(){return N},Gs:function(){return d},Hs:function(){return r},PN:function(){return h},PW:function(){return w},Q_:function(){return x},R$:function(){return j},Vr:function(){return u},Wb:function(){return g},aR:function(){return b},bi:function(){return o},en:function(){return y},i2:function(){return v},kT:function(){return m},l5:function(){return p},lE:function(){return k},lv:function(){return l},pG:function(){return a},rF:function(){return c},tV:function(){return f},tl:function(){return _},xP:function(){return M},yb:function(){return i}});let r={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},a={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},i={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},l={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},s=["inbox","under_review","approved","in_progress","testing","shipped"],o={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},d={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},u={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},b={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},g={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},h={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual"},x={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800"},m={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},p={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},y={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},j={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},k={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},_={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},N={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},M={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[444],{2934:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},7168:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},3085:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]])},525:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},6865:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},1259:function(e,t,n){n.d(t,{default:function(){return f}});var r=n(7437),a=n(7648),i=n(9376),l=n(5466),s=n(2048),o=n(8896),c=n(8220),d=n(2718),u=n(5621),g=n(8728),h=n(2222),b=n(2023),x=n(1994),m=n(257);let p=[{href:"/",label:"Dashboard",icon:(0,r.jsx)(l.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,r.jsx)(s.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,r.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,r.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,r.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,r.jsx)(u.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,r.jsx)(g.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,n=(0,i.usePathname)();return(0,r.jsxs)("div",{className:"min-h-screen flex",children:[(0,r.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,r.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,r.jsxs)(a.default,{href:"/",className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,r.jsx)(h.Z,{className:"w-6 h-6 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,r.jsx)("p",{className:"text-xs text-slate-400",children:m.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,r.jsx)("nav",{className:"flex-1 p-4",children:(0,r.jsx)("ul",{className:"space-y-1",children:p.map(e=>{let t="/"===e.href?"/"===n:n.startsWith(e.href);return(0,r.jsx)("li",{children:(0,r.jsxs)(a.default,{href:e.href,className:(0,x.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,r.jsx)("span",{children:e.label})]})},e.href)})})}),(0,r.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,r.jsx)(b.Z,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,r.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},104:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(7437),a=n(1994);let i={on_track:"bg-emerald-500",at_risk:"bg-amber-500",behind:"bg-red-500",achieved:"bg-blue-500"};function l(e){let{current:t,target:n,unit:l,status:s,showLabels:o=!0}=e,c=null!==t?Math.min(t/n*100,100):0,d=e=>null===e?"--":"percent"===l||"%"===l?"".concat(e,"%"):"hours"===l?"".concat(e,"h"):"".concat(e," ").concat(l);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"relative h-2 bg-slate-100 rounded-full overflow-hidden",children:[(0,r.jsx)("div",{className:(0,a.Z)("absolute left-0 top-0 h-full rounded-full transition-all duration-500",i[s]),style:{width:"".concat(c,"%")}}),(0,r.jsx)("div",{className:"absolute top-0 w-0.5 h-full bg-slate-400",style:{left:"100%"},title:"Target: ".concat(d(n))})]}),o&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsxs)("span",{className:"text-xs text-slate-500",children:["Current: ",(0,r.jsx)("span",{className:"font-medium text-slate-700",children:d(t)})]}),(0,r.jsxs)("span",{className:"text-xs text-slate-500",children:["Target: ",(0,r.jsx)("span",{className:"font-medium text-slate-700",children:d(n)})]})]})]})}},281:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(7437),a=n(2265);function i(e){let{kpi:t,height:n=40,width:i,showTarget:l=!1}=e,{path:s,areaPath:o,minValue:c,maxValue:d,points:u}=(0,a.useMemo)(()=>{let e=t.history;if(0===e.length)return{path:"",areaPath:"",minValue:0,maxValue:0,points:[]};let r=e.map(e=>e.value),a=l&&null!==t.target_value?[...r,t.target_value]:r,s=Math.min(...a),o=Math.max(...a),c=o-s||1,d=s-.1*c,u=o+.1*c-d||1,g=n-4,h=(i||100)/Math.max(e.length-1,1),b=e.map((e,t)=>({x:t*h,y:g-(e.value-d)/u*g+2,value:e.value,date:e.date}));return 1===b.length?{path:"M ".concat(b[0].x," ").concat(b[0].y),areaPath:"",minValue:s,maxValue:o,points:b}:{path:b.map((e,t)=>0===t?"M ".concat(e.x," ").concat(e.y):"L ".concat(e.x," ").concat(e.y)).join(" "),areaPath:["M ".concat(b[0].x," ").concat(g+2),"L ".concat(b[0].x," ").concat(b[0].y),...b.slice(1).map(e=>"L ".concat(e.x," ").concat(e.y)),"L ".concat(b[b.length-1].x," ").concat(g+2),"Z"].join(" "),minValue:s,maxValue:o,points:b}},[t.history,t.target_value,n,i,l]),g=(()=>{if(t.history.length<2)return{stroke:"#94a3b8",fill:"rgba(148, 163, 184, 0.1)"};let e=t.history[0].value,n=t.history[t.history.length-1].value;return("higher_is_better"===t.direction?n>=e:n<=e)?{stroke:"#10b981",fill:"rgba(16, 185, 129, 0.1)"}:{stroke:"#ef4444",fill:"rgba(239, 68, 68, 0.1)"}})();if(0===t.history.length)return(0,r.jsx)("div",{className:"flex items-center justify-center text-xs text-slate-400",style:{height:n,width:i||"100%"},children:"No data"});let h=(()=>{if(!l||null===t.target_value||0===t.history.length)return null;let e=[...t.history.map(e=>e.value),t.target_value],r=Math.min(...e),a=Math.max(...e),i=a-r||1,s=r-.1*i,o=n-4;return o-(t.target_value-s)/(a+.1*i-s||1)*o+2})();return(0,r.jsxs)("svg",{width:i||"100%",height:n,viewBox:"0 0 ".concat(i||100," ").concat(n),preserveAspectRatio:"none",className:"overflow-visible",children:[o&&(0,r.jsx)("path",{d:o,fill:g.fill}),(0,r.jsx)("path",{d:s,fill:"none",stroke:g.stroke,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l&&null!==h&&(0,r.jsx)("line",{x1:0,y1:h,x2:i||100,y2:h,stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"4 2"}),u.length>0&&(0,r.jsx)("circle",{cx:u[u.length-1].x,cy:u[u.length-1].y,r:3,fill:g.stroke})]})}},6153:function(e,t,n){n.d(t,{G:function(){return s},GK:function(){return N},Gs:function(){return d},Hs:function(){return r},PN:function(){return b},PW:function(){return w},Q_:function(){return x},R$:function(){return j},Vr:function(){return u},Wb:function(){return h},aR:function(){return g},bi:function(){return o},en:function(){return y},i2:function(){return v},kT:function(){return m},l5:function(){return p},lE:function(){return k},lv:function(){return l},pG:function(){return a},rF:function(){return c},tV:function(){return f},tl:function(){return _},xP:function(){return M},yb:function(){return i}});let r={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},a={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},i={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},l={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},s=["inbox","under_review","approved","in_progress","testing","shipped"],o={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},d={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},u={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},g={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},h={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},b={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},x={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},m={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},p={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},y={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},j={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},k={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},_={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},N={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},M={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{4110:function(e,t,s){Promise.resolve().then(s.bind(s,4553))},2660:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},6362:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},5846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},7168:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},933:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("SquareCheckBig",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]])},7157:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]])},1810:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]])},4553:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return j}});var a=s(7437),r=s(2265),l=s(7648),n=s(7168),i=s(2660),d=s(8220),c=s(9205);let o=(0,c.Z)("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);var x=s(1810),h=s(7157),m=s(933),u=s(6362),p=s(5846);let b=(0,c.Z)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var g=s(1994),f=s(1259),v=s(6153);function j(e){let{params:t}=e,{id:s}=t,[c,j]=(0,r.useState)(null),[N,y]=(0,r.useState)([]),[w,k]=(0,r.useState)(!0),[_,Z]=(0,r.useState)(null),M=async()=>{try{let e=await fetch("/api/hypotheses/".concat(s)),t=await e.json();if(!t.success){Z(t.error||"Failed to load hypothesis");return}if(j(t.data),t.data.validation_ideas.length>0){let e=await fetch("/api/ideas"),s=await e.json();if(s.success){let e=s.data.filter(e=>t.data.validation_ideas.includes(e.id));y(e)}}}catch(e){Z("Failed to load hypothesis"),console.error("Error fetching hypothesis:",e)}finally{k(!1)}};(0,r.useEffect)(()=>{M()},[s]);let A=async e=>{try{let t=await fetch("/api/hypotheses/".concat(s),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})}),a=await t.json();a.success&&j(a.data)}catch(e){console.error("Failed to update status:",e)}};return w?(0,a.jsx)(f.default,{children:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)(n.Z,{className:"w-8 h-8 text-slate-400 animate-spin"})})}):_||!c?(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(l.default,{href:"/hypotheses",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Hypotheses"})]}),(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,a.jsx)("p",{className:"text-red-600",children:_||"Hypothesis not found"})})]})}):(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(l.default,{href:"/hypotheses",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Hypotheses"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"w-14 h-14 bg-amber-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(d.Z,{className:"w-7 h-7 text-amber-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-2 py-0.5 rounded-full",v.tl[c.funnel_stage]),children:v.PW[c.funnel_stage]}),(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded border",v.Gs[c.priority]),children:v.rF[c.priority]}),(0,a.jsxs)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 font-medium",children:["Effort: ",v.bi[c.effort_to_test]]})]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:c.title}),(0,a.jsxs)("p",{className:"text-slate-600 italic",children:["“",c.statement,"”"]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,a.jsx)("span",{className:(0,g.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",v.lE[c.status]),children:v.R$[c.status]}),(0,a.jsxs)("select",{value:c.status,onChange:e=>A(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,a.jsx)("option",{value:"stated",children:"Stated"}),(0,a.jsx)("option",{value:"testing",children:"Testing"}),(0,a.jsx)("option",{value:"validated",children:"Validated"}),(0,a.jsx)("option",{value:"invalidated",children:"Invalidated"}),(0,a.jsx)("option",{value:"deferred",children:"Deferred"})]})]})]}),c.reference_model&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mt-4 p-3 bg-slate-50 rounded-lg",children:[(0,a.jsx)(o,{className:"w-4 h-4 text-slate-400 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500 uppercase",children:"Reference Model"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:c.reference_model})]})]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-3",children:"Description"}),(0,a.jsx)("p",{className:"text-sm text-slate-600 whitespace-pre-line",children:c.description})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-emerald-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Evidence For (",c.evidence_for.length,")"]})]}),c.evidence_for.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.evidence_for.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-emerald-50 rounded-lg border border-emerald-100",children:[(0,a.jsx)("span",{className:"text-emerald-500 mt-0.5 flex-shrink-0",children:"+"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No supporting evidence collected yet."})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(h.Z,{className:"w-5 h-5 text-red-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Evidence Against (",c.evidence_against.length,")"]})]}),c.evidence_against.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.evidence_against.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-red-50 rounded-lg border border-red-100",children:[(0,a.jsx)("span",{className:"text-red-500 mt-0.5 flex-shrink-0",children:"-"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No counter-evidence collected yet."})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Validation Criteria (",c.validation_criteria.length,")"]})]}),c.validation_criteria.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.validation_criteria.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-blue-50 rounded-lg border border-blue-100",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 text-blue-400 mt-0.5 flex-shrink-0"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No validation criteria defined yet."})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Validation Ideas"}),N.length>0?(0,a.jsx)("div",{className:"space-y-3",children:N.map(e=>(0,a.jsxs)(l.default,{href:"/ideas/".concat(e.id),className:"block bg-white rounded-lg border border-slate-200 p-4 hover:border-amber-300 hover:shadow-sm transition-all",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-1",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2",children:e.summary})]}),(0,a.jsx)(u.Z,{className:"w-4 h-4 text-slate-400 flex-shrink-0"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 mt-2",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","shipped"===e.stage?"bg-green-100 text-green-700":"in_progress"===e.stage?"bg-violet-100 text-violet-700":"bg-slate-100 text-slate-600"),children:e.stage.replace("_"," ")})})]},e.id))}):(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 text-center",children:[(0,a.jsx)(p.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"No ideas linked to this hypothesis yet."}),(0,a.jsx)(l.default,{href:"/",className:"text-sm text-amber-600 hover:text-amber-700",children:"Browse Ideas"})]}),(0,a.jsxs)("div",{className:"mt-6 bg-slate-50 rounded-lg border border-slate-200 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-700 mb-2",children:"Tip: Link Ideas to Hypotheses"}),(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["When creating ideas for experiments, link them to this hypothesis via the ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1 rounded",children:"validation_ideas"})," field. This tracks which ideas serve as tests for your business assumptions."]})]})]})]}),c.tags.length>0&&(0,a.jsxs)("div",{className:"mt-6 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(b,{className:"w-4 h-4 text-slate-400"}),c.tags.map(e=>(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded-full bg-slate-100 text-slate-600",children:e},e))]}),(0,a.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,a.jsxs)("p",{children:["Created: ",new Date(c.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:["Last updated: ",new Date(c.updated_at).toLocaleString()]})]})]})})}},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return f}});var a=s(7437),r=s(7648),l=s(9376),n=s(5466),i=s(2048),d=s(8896),c=s(8220),o=s(2718),x=s(5621),h=s(8728),m=s(2222),u=s(2023),p=s(1994),b=s(257);let g=[{href:"/",label:"Dashboard",icon:(0,a.jsx)(n.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(h.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,s=(0,l.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(m.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:b.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t="/"===e.href?"/"===s:s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,p.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return _},Gs:function(){return o},Hs:function(){return a},PN:function(){return u},PW:function(){return w},Q_:function(){return p},R$:function(){return N},Vr:function(){return x},Wb:function(){return m},aR:function(){return h},bi:function(){return d},en:function(){return j},i2:function(){return v},kT:function(){return b},l5:function(){return g},lE:function(){return y},lv:function(){return n},pG:function(){return r},rF:function(){return c},tV:function(){return f},tl:function(){return k},xP:function(){return Z},yb:function(){return l}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},l={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},n={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},x={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},h={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},m={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},u={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual"},p={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800"},b={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},j={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},N={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},y={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},k={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},_={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},Z={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=4110)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{4110:function(e,t,s){Promise.resolve().then(s.bind(s,4553))},2660:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},6362:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},5846:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},7168:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},933:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("SquareCheckBig",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]])},7157:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]])},1810:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]])},4553:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return j}});var a=s(7437),r=s(2265),l=s(7648),n=s(7168),i=s(2660),d=s(8220),c=s(9205);let o=(0,c.Z)("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);var x=s(1810),h=s(7157),m=s(933),u=s(6362),p=s(5846);let b=(0,c.Z)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var g=s(1994),f=s(1259),v=s(6153);function j(e){let{params:t}=e,{id:s}=t,[c,j]=(0,r.useState)(null),[N,y]=(0,r.useState)([]),[w,k]=(0,r.useState)(!0),[_,Z]=(0,r.useState)(null),M=async()=>{try{let e=await fetch("/api/hypotheses/".concat(s)),t=await e.json();if(!t.success){Z(t.error||"Failed to load hypothesis");return}if(j(t.data),t.data.validation_ideas.length>0){let e=await fetch("/api/ideas"),s=await e.json();if(s.success){let e=s.data.filter(e=>t.data.validation_ideas.includes(e.id));y(e)}}}catch(e){Z("Failed to load hypothesis"),console.error("Error fetching hypothesis:",e)}finally{k(!1)}};(0,r.useEffect)(()=>{M()},[s]);let A=async e=>{try{let t=await fetch("/api/hypotheses/".concat(s),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})}),a=await t.json();a.success&&j(a.data)}catch(e){console.error("Failed to update status:",e)}};return w?(0,a.jsx)(f.default,{children:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)(n.Z,{className:"w-8 h-8 text-slate-400 animate-spin"})})}):_||!c?(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(l.default,{href:"/hypotheses",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Hypotheses"})]}),(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,a.jsx)("p",{className:"text-red-600",children:_||"Hypothesis not found"})})]})}):(0,a.jsx)(f.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(l.default,{href:"/hypotheses",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Hypotheses"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"w-14 h-14 bg-amber-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(d.Z,{className:"w-7 h-7 text-amber-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-2 py-0.5 rounded-full",v.tl[c.funnel_stage]),children:v.PW[c.funnel_stage]}),(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded border",v.Gs[c.priority]),children:v.rF[c.priority]}),(0,a.jsxs)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 font-medium",children:["Effort: ",v.bi[c.effort_to_test]]})]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:c.title}),(0,a.jsxs)("p",{className:"text-slate-600 italic",children:["“",c.statement,"”"]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,a.jsx)("span",{className:(0,g.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",v.lE[c.status]),children:v.R$[c.status]}),(0,a.jsxs)("select",{value:c.status,onChange:e=>A(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,a.jsx)("option",{value:"stated",children:"Stated"}),(0,a.jsx)("option",{value:"testing",children:"Testing"}),(0,a.jsx)("option",{value:"validated",children:"Validated"}),(0,a.jsx)("option",{value:"invalidated",children:"Invalidated"}),(0,a.jsx)("option",{value:"deferred",children:"Deferred"})]})]})]}),c.reference_model&&(0,a.jsxs)("div",{className:"flex items-start gap-2 mt-4 p-3 bg-slate-50 rounded-lg",children:[(0,a.jsx)(o,{className:"w-4 h-4 text-slate-400 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500 uppercase",children:"Reference Model"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:c.reference_model})]})]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-3",children:"Description"}),(0,a.jsx)("p",{className:"text-sm text-slate-600 whitespace-pre-line",children:c.description})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-emerald-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Evidence For (",c.evidence_for.length,")"]})]}),c.evidence_for.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.evidence_for.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-emerald-50 rounded-lg border border-emerald-100",children:[(0,a.jsx)("span",{className:"text-emerald-500 mt-0.5 flex-shrink-0",children:"+"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No supporting evidence collected yet."})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(h.Z,{className:"w-5 h-5 text-red-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Evidence Against (",c.evidence_against.length,")"]})]}),c.evidence_against.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.evidence_against.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-red-50 rounded-lg border border-red-100",children:[(0,a.jsx)("span",{className:"text-red-500 mt-0.5 flex-shrink-0",children:"-"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No counter-evidence collected yet."})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Validation Criteria (",c.validation_criteria.length,")"]})]}),c.validation_criteria.length>0?(0,a.jsx)("ul",{className:"space-y-2",children:c.validation_criteria.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm text-slate-700 p-2 bg-blue-50 rounded-lg border border-blue-100",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 text-blue-400 mt-0.5 flex-shrink-0"}),(0,a.jsx)("span",{children:e})]},t))}):(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No validation criteria defined yet."})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Validation Ideas"}),N.length>0?(0,a.jsx)("div",{className:"space-y-3",children:N.map(e=>(0,a.jsxs)(l.default,{href:"/ideas/".concat(e.id),className:"block bg-white rounded-lg border border-slate-200 p-4 hover:border-amber-300 hover:shadow-sm transition-all",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-1",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2",children:e.summary})]}),(0,a.jsx)(u.Z,{className:"w-4 h-4 text-slate-400 flex-shrink-0"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 mt-2",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","shipped"===e.stage?"bg-green-100 text-green-700":"in_progress"===e.stage?"bg-violet-100 text-violet-700":"bg-slate-100 text-slate-600"),children:e.stage.replace("_"," ")})})]},e.id))}):(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 text-center",children:[(0,a.jsx)(p.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"No ideas linked to this hypothesis yet."}),(0,a.jsx)(l.default,{href:"/",className:"text-sm text-amber-600 hover:text-amber-700",children:"Browse Ideas"})]}),(0,a.jsxs)("div",{className:"mt-6 bg-slate-50 rounded-lg border border-slate-200 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-700 mb-2",children:"Tip: Link Ideas to Hypotheses"}),(0,a.jsxs)("p",{className:"text-xs text-slate-500",children:["When creating ideas for experiments, link them to this hypothesis via the ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1 rounded",children:"validation_ideas"})," field. This tracks which ideas serve as tests for your business assumptions."]})]})]})]}),c.tags.length>0&&(0,a.jsxs)("div",{className:"mt-6 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(b,{className:"w-4 h-4 text-slate-400"}),c.tags.map(e=>(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded-full bg-slate-100 text-slate-600",children:e},e))]}),(0,a.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,a.jsxs)("p",{children:["Created: ",new Date(c.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:["Last updated: ",new Date(c.updated_at).toLocaleString()]})]})]})})}},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return f}});var a=s(7437),r=s(7648),l=s(9376),n=s(5466),i=s(2048),d=s(8896),c=s(8220),o=s(2718),x=s(5621),h=s(8728),m=s(2222),u=s(2023),p=s(1994),b=s(257);let g=[{href:"/",label:"Dashboard",icon:(0,a.jsx)(n.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(h.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,s=(0,l.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(m.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:b.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t="/"===e.href?"/"===s:s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,p.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return _},Gs:function(){return o},Hs:function(){return a},PN:function(){return u},PW:function(){return w},Q_:function(){return p},R$:function(){return N},Vr:function(){return x},Wb:function(){return m},aR:function(){return h},bi:function(){return d},en:function(){return j},i2:function(){return v},kT:function(){return b},l5:function(){return g},lE:function(){return y},lv:function(){return n},pG:function(){return r},rF:function(){return c},tV:function(){return f},tl:function(){return k},xP:function(){return Z},yb:function(){return l}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},l={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},n={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},x={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},h={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},m={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},u={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},p={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},b={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},j={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},N={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},y={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},k={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},_={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},Z={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=4110)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204],{7856:function(e,t,r){Promise.resolve().then(r.bind(r,1259)),Promise.resolve().then(r.bind(r,786))},5846:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},7157:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]])},1810:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]])},1259:function(e,t,r){"use strict";r.d(t,{default:function(){return f}});var n=r(7437),a=r(7648),s=r(9376),i=r(5466),l=r(2048),d=r(8896),c=r(8220),o=r(2718),u=r(5621),b=r(8728),x=r(2222),m=r(2023),g=r(1994),h=r(257);let p=[{href:"/",label:"Dashboard",icon:(0,n.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,n.jsx)(l.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,n.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,n.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,n.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,n.jsx)(u.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,n.jsx)(b.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,r=(0,s.usePathname)();return(0,n.jsxs)("div",{className:"min-h-screen flex",children:[(0,n.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,n.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,n.jsxs)(a.default,{href:"/",className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,n.jsx)(x.Z,{className:"w-6 h-6 text-white"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,n.jsx)("p",{className:"text-xs text-slate-400",children:h.env.NEXT_PUBLIC_PRODUCT_NAME||"Business"})]})]})}),(0,n.jsx)("nav",{className:"flex-1 p-4",children:(0,n.jsx)("ul",{className:"space-y-1",children:p.map(e=>{let t="/"===e.href?"/"===r:r.startsWith(e.href);return(0,n.jsx)("li",{children:(0,n.jsxs)(a.default,{href:e.href,className:(0,g.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,n.jsx)("span",{children:e.label})]})},e.href)})})}),(0,n.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,n.jsx)(m.Z,{className:"w-4 h-4"}),(0,n.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,n.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},786:function(e,t,r){"use strict";r.d(t,{default:function(){return u}});var n=r(7437),a=r(7648),s=r(8220),i=r(1810),l=r(7157),d=r(5846),c=r(1994),o=r(6153);function u(e){let{hypothesis:t}=e,r=t.evidence_for.length,u=t.evidence_against.length;return(0,n.jsx)(a.default,{href:"/hypotheses/".concat(t.id),children:(0,n.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-4 hover:border-amber-300 hover:shadow-md transition-all cursor-pointer",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("span",{className:(0,c.Z)("inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium border",o.lE[t.status]),children:o.R$[t.status]}),(0,n.jsx)("span",{className:(0,c.Z)("text-xs px-2 py-0.5 rounded-full",o.tl[t.funnel_stage]),children:o.PW[t.funnel_stage]})]}),(0,n.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,n.jsx)("div",{className:"w-10 h-10 bg-amber-100 rounded-lg flex items-center justify-center flex-shrink-0",children:(0,n.jsx)(s.Z,{className:"w-5 h-5 text-amber-600"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h3",{className:"font-semibold text-slate-900 text-base leading-tight mb-1",children:t.title}),(0,n.jsx)("p",{className:"text-sm text-slate-500 line-clamp-2",children:t.statement})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-sm",children:[(0,n.jsx)(i.Z,{className:"w-3.5 h-3.5 text-emerald-500"}),(0,n.jsx)("span",{className:"text-emerald-700 font-medium",children:r}),(0,n.jsx)("span",{className:"text-slate-400",children:"for"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-sm",children:[(0,n.jsx)(l.Z,{className:"w-3.5 h-3.5 text-red-500"}),(0,n.jsx)("span",{className:"text-red-700 font-medium",children:u}),(0,n.jsx)("span",{className:"text-slate-400",children:"against"})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-slate-100",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 font-medium",children:o.bi[t.effort_to_test]}),(0,n.jsx)("span",{className:(0,c.Z)("text-xs px-1.5 py-0.5 rounded border",o.Gs[t.priority]),children:o.rF[t.priority]})]}),t.validation_ideas.length>0&&(0,n.jsxs)("span",{className:"text-xs text-amber-600 flex items-center gap-1",children:[(0,n.jsx)(d.Z,{className:"w-3 h-3"}),t.validation_ideas.length," idea",1!==t.validation_ideas.length?"s":""]})]})]})})}},6153:function(e,t,r){"use strict";r.d(t,{G:function(){return l},GK:function(){return k},Gs:function(){return o},Hs:function(){return n},PN:function(){return m},PW:function(){return w},Q_:function(){return g},R$:function(){return N},Vr:function(){return u},Wb:function(){return x},aR:function(){return b},bi:function(){return d},en:function(){return j},i2:function(){return v},kT:function(){return h},l5:function(){return p},lE:function(){return y},lv:function(){return i},pG:function(){return a},rF:function(){return c},tV:function(){return f},tl:function(){return _},xP:function(){return Z},yb:function(){return s}});let n={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},a={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},s={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},i={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},l=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},u={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",manual:"Manual"},b={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},x={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},m={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},g={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},h={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},p={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},j={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},N={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},y={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},w={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},_={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},k={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},Z={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[746,971,117,744],function(){return e(e.s=7856)}),_N_E=e.O()}]);