create-bubblelab-app 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -28,15 +28,17 @@ async function main() {
28
28
  name: 'template',
29
29
  message: 'Select a template:',
30
30
  choices: [
31
- {
32
- title: 'Weather Agent (Recommended)',
33
- value: 'basic',
34
- description: 'AI agent that researches weather using web search',
35
- },
36
31
  {
37
32
  title: 'Reddit News Scraper',
38
33
  value: 'reddit-scraper',
39
- description: 'AI agent that scrapes Reddit and summarizes news',
34
+ description:
35
+ 'AI agent that scrapes Reddit and summarizes news (uses Google API key)',
36
+ },
37
+ {
38
+ title: 'Weather Agent (Recommended)',
39
+ value: 'basic',
40
+ description:
41
+ 'AI agent that researches weather using web search (uses Google API key and Firecrawl API key)',
40
42
  },
41
43
  ],
42
44
  initial: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bubblelab-app",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Create BubbleLab AI agent applications with one command",
@@ -52,7 +52,7 @@ async function main() {
52
52
  }
53
53
  // Inject the credentials
54
54
  runner.injector.injectCredentials(bubbles, [], {
55
- [CredentialType.GOOGLE_GEMINI_CRED]: process.env.GOOGLE_GEMINI_CRED,
55
+ [CredentialType.GOOGLE_GEMINI_CRED]: process.env.GOOGLE_API_KEY,
56
56
  [CredentialType.FIRECRAWL_API_KEY]: process.env.FIRECRAWL_API_KEY,
57
57
  });
58
58
 
@@ -4,6 +4,9 @@ import { readFileSync } from 'fs';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { dirname, join } from 'path';
6
6
  import { CredentialType } from '@bubblelab/shared-schemas';
7
+ import { config } from 'dotenv';
8
+ // Load environment variables from .env file
9
+ config();
7
10
 
8
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
12
 
@@ -1,103 +0,0 @@
1
- /**
2
- * Reddit News Scraper Flow
3
- *
4
- * This is a simple BubbleFlow that scrapes Reddit and summarizes news posts.
5
- */
6
- import {
7
- BubbleFlow,
8
- RedditScrapeTool,
9
- AIAgentBubble,
10
- type WebhookEvent,
11
- } from '@bubblelab/bubble-core';
12
- import { CredentialType } from '@bubblelab/shared-schemas';
13
- import { config } from 'dotenv';
14
-
15
- // Load environment variables from .env file
16
- config();
17
-
18
- /**
19
- * Payload interface for the Reddit news flow
20
- */
21
- interface RedditNewsPayload extends WebhookEvent {
22
- subreddit: string;
23
- limit: number;
24
- }
25
-
26
- /**
27
- * RedditNewsFlow - Scrapes Reddit and summarizes news
28
- *
29
- * This flow demonstrates:
30
- * - Using RedditScrapeTool to scrape subreddit posts
31
- * - Using AIAgentBubble to analyze and summarize content
32
- * - Simple 2-step workflow
33
- */
34
- export class RedditNewsFlow extends BubbleFlow<'webhook/http'> {
35
- async handle(payload: RedditNewsPayload) {
36
- const subreddit = payload.subreddit || 'worldnews';
37
- this.logger?.logLine(36, 'Statement: VariableDeclaration');
38
- const limit = payload.limit || 10;
39
- this.logger?.logLine(37, 'Statement: VariableDeclaration');
40
-
41
- // Step 1: Scrape Reddit for posts
42
- const scrapeResult = await new RedditScrapeTool({
43
- subreddit: subreddit,
44
- sort: 'hot',
45
- limit: limit
46
- }, {logger: this.logger, variableId: 417, dependencyGraph: {"name":"reddit-scrape-tool","uniqueId":"417","variableId":417,"variableName":"scrapeResult","nodeType":"tool","dependencies":[]}, currentUniqueId: "417"}).action();
47
- this.logger?.logLine(44, 'Statement: VariableDeclaration');
48
-
49
- if (!scrapeResult.success || !scrapeResult.data?.posts) {
50
- throw new Error('Failed to scrape Reddit or no posts found.');
51
- this.logger?.logLine(47, 'Statement: ThrowStatement');
52
- }
53
- this.logger?.logLine(48, 'Statement: IfStatement');
54
-
55
- const posts = scrapeResult.data.posts;
56
- this.logger?.logLine(50, 'Statement: VariableDeclaration');
57
-
58
- // Format posts for AI
59
- const postsText = posts
60
- .map(
61
- (
62
- post: {
63
- title: string;
64
- score: number;
65
- selftext: string;
66
- postUrl: string;
67
- },
68
- i: number
69
- ) =>
70
- `${i + 1}. "${post.title}" (${post.score} upvotes)\n ${post.selftext || 'No description'}\n URL: ${post.postUrl}`
71
- )
72
- .join('\n\n');
73
- this.logger?.logLine(66, 'Statement: VariableDeclaration');
74
-
75
- // Step 2: Summarize the news using AI
76
- const summaryResult = await new AIAgentBubble({
77
- message: `Here are the top ${posts.length} posts from r/${subreddit}:
78
-
79
- ${postsText}
80
-
81
- Please provide:
82
- 1. A summary of the top 5 most important/popular news items
83
- 2. Key themes or trends you notice
84
- 3. A one-paragraph executive summary
85
-
86
- Format the response in a clear, readable way.`,
87
- model: {
88
- model: 'google/gemini-2.5-flash',
89
- },
90
- tools: []
91
- }, {logger: this.logger, variableId: 422, dependencyGraph: {"name":"ai-agent","uniqueId":"422","variableId":422,"variableName":"summaryResult","nodeType":"service","dependencies":[]}, currentUniqueId: "422"}).action();
92
- this.logger?.logLine(84, 'Statement: VariableDeclaration');
93
-
94
- return {
95
- subreddit,
96
- postsScraped: posts.length,
97
- summary: summaryResult.data?.response,
98
- timestamp: new Date().toISOString(),
99
- status: 'success',
100
- };
101
- this.logger?.logLine(92, 'Statement: ReturnStatement');
102
- }
103
- }