firecrawl-cli 1.9.7 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +7 -4
  2. package/dist/__tests__/commands/init.test.d.ts +2 -0
  3. package/dist/__tests__/commands/init.test.d.ts.map +1 -0
  4. package/dist/__tests__/commands/init.test.js +36 -0
  5. package/dist/__tests__/commands/init.test.js.map +1 -0
  6. package/dist/__tests__/commands/setup.test.d.ts +2 -0
  7. package/dist/__tests__/commands/setup.test.d.ts.map +1 -0
  8. package/dist/__tests__/commands/setup.test.js +25 -0
  9. package/dist/__tests__/commands/setup.test.js.map +1 -0
  10. package/dist/commands/browser.d.ts.map +1 -1
  11. package/dist/commands/browser.js +5 -3
  12. package/dist/commands/browser.js.map +1 -1
  13. package/dist/commands/experimental/index.d.ts.map +1 -1
  14. package/dist/commands/experimental/index.js +45 -4
  15. package/dist/commands/experimental/index.js.map +1 -1
  16. package/dist/commands/experimental/workflows/company-directories.d.ts +11 -0
  17. package/dist/commands/experimental/workflows/company-directories.d.ts.map +1 -0
  18. package/dist/commands/experimental/workflows/company-directories.js +245 -0
  19. package/dist/commands/experimental/workflows/company-directories.js.map +1 -0
  20. package/dist/commands/experimental/workflows/competitive-intel.d.ts +11 -0
  21. package/dist/commands/experimental/workflows/competitive-intel.d.ts.map +1 -0
  22. package/dist/commands/experimental/workflows/competitive-intel.js +226 -0
  23. package/dist/commands/experimental/workflows/competitive-intel.js.map +1 -0
  24. package/dist/commands/experimental/workflows/dashboard-reporting.d.ts +11 -0
  25. package/dist/commands/experimental/workflows/dashboard-reporting.d.ts.map +1 -0
  26. package/dist/commands/experimental/workflows/dashboard-reporting.js +254 -0
  27. package/dist/commands/experimental/workflows/dashboard-reporting.js.map +1 -0
  28. package/dist/commands/experimental/workflows/knowledge-ingest.d.ts +12 -0
  29. package/dist/commands/experimental/workflows/knowledge-ingest.d.ts.map +1 -0
  30. package/dist/commands/experimental/workflows/knowledge-ingest.js +251 -0
  31. package/dist/commands/experimental/workflows/knowledge-ingest.js.map +1 -0
  32. package/dist/commands/experimental/workflows/lead-gen.d.ts +11 -0
  33. package/dist/commands/experimental/workflows/lead-gen.d.ts.map +1 -0
  34. package/dist/commands/experimental/workflows/lead-gen.js +257 -0
  35. package/dist/commands/experimental/workflows/lead-gen.js.map +1 -0
  36. package/dist/commands/experimental/workflows/market-research.d.ts +11 -0
  37. package/dist/commands/experimental/workflows/market-research.d.ts.map +1 -0
  38. package/dist/commands/experimental/workflows/market-research.js +260 -0
  39. package/dist/commands/experimental/workflows/market-research.js.map +1 -0
  40. package/dist/commands/init.d.ts.map +1 -1
  41. package/dist/commands/init.js +14 -19
  42. package/dist/commands/init.js.map +1 -1
  43. package/dist/commands/scrape.d.ts.map +1 -1
  44. package/dist/commands/scrape.js +9 -0
  45. package/dist/commands/scrape.js.map +1 -1
  46. package/dist/commands/setup.d.ts.map +1 -1
  47. package/dist/commands/setup.js +6 -7
  48. package/dist/commands/setup.js.map +1 -1
  49. package/dist/commands/skills-install.d.ts +9 -0
  50. package/dist/commands/skills-install.d.ts.map +1 -0
  51. package/dist/commands/skills-install.js +25 -0
  52. package/dist/commands/skills-install.js.map +1 -0
  53. package/dist/index.js +11 -3
  54. package/dist/index.js.map +1 -1
  55. package/dist/types/scrape.d.ts +2 -0
  56. package/dist/types/scrape.d.ts.map +1 -1
  57. package/dist/utils/options.d.ts.map +1 -1
  58. package/dist/utils/options.js +1 -0
  59. package/dist/utils/options.js.map +1 -1
  60. package/package.json +2 -2
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow: Competitive Intelligence
4
+ *
5
+ * Logs into competitor dashboards using saved browser profiles, clicks through
6
+ * pricing tiers, feature pages, and changelogs to detect plan changes.
7
+ * Designed for weekly monitoring runs with structured diff output.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.register = register;
44
+ const backends_1 = require("../backends");
45
+ const shared_1 = require("../shared");
46
+ // ─── Input gathering ────────────────────────────────────────────────────────
47
+ async function gatherInputs(prefill) {
48
+ if (prefill?.competitors) {
49
+ return {
50
+ competitors: prefill.competitors,
51
+ focus: 'all',
52
+ profile: '',
53
+ output: 'json',
54
+ context: '',
55
+ };
56
+ }
57
+ const { input, select } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
58
+ const competitors = await input({
59
+ message: 'Which competitors to monitor? (URLs or names, comma-separated)',
60
+ validate: (0, shared_1.validateRequired)('At least one competitor'),
61
+ });
62
+ const focus = await select({
63
+ message: 'What should the agent focus on?',
64
+ choices: [
65
+ { name: 'Everything (pricing, features, changelog)', value: 'all' },
66
+ { name: 'Pricing tiers & plan changes only', value: 'pricing' },
67
+ { name: 'Feature pages & product updates', value: 'features' },
68
+ { name: 'Blog / changelog / release notes', value: 'changelog' },
69
+ ],
70
+ });
71
+ const profile = await input({
72
+ message: 'Browser profile to use for auth? (leave blank for anonymous browsing)',
73
+ default: '',
74
+ });
75
+ const output = await select({
76
+ message: 'How should the report be delivered?',
77
+ choices: [
78
+ { name: 'Print to terminal', value: 'terminal' },
79
+ { name: 'Save as JSON (structured diffs)', value: 'json' },
80
+ { name: 'Save as Markdown file', value: 'markdown' },
81
+ ],
82
+ });
83
+ const context = await input({
84
+ message: 'Any other context? (e.g., "compare to our Pro plan", "focus on API limits")',
85
+ default: '',
86
+ });
87
+ return { competitors, focus, profile, output, context };
88
+ }
89
+ // ─── System prompt ──────────────────────────────────────────────────────────
90
+ function buildSystemPrompt(opts) {
91
+ const focusInstructions = {
92
+ all: 'Extract pricing tiers (plan names, prices, feature lists, limits), product feature pages, and recent changelog/blog entries.',
93
+ pricing: 'Focus exclusively on pricing pages. Extract every plan name, price, billing period, feature list, and usage limit. Note any "Contact Sales" tiers.',
94
+ features: 'Focus on product/feature pages. Extract feature names, descriptions, availability per plan, and any recent additions or deprecations.',
95
+ changelog: 'Focus on blogs, changelogs, and release notes. Extract recent product updates, new features, breaking changes, and deprecation notices.',
96
+ };
97
+ const profileBlock = opts.profile
98
+ ? `\n### Browser Profile\n\nUse the saved browser profile \`${opts.profile}\` to access auth-gated pages:\n\`\`\`bash\nfirecrawl browser "open <url>" --profile ${opts.profile}\n\`\`\`\nAfter the first \`open\` with \`--profile\`, subsequent browser commands don't need the flag.`
99
+ : '';
100
+ const outputInstructions = {
101
+ terminal: 'Print the full intelligence report to the terminal in well-formatted markdown.',
102
+ json: `Save the report as structured JSON to \`competitive-intel.json\` in the current directory. Tell the user the file path when done.
103
+
104
+ Use this schema:
105
+ \`\`\`json
106
+ {
107
+ "generatedAt": "ISO-8601",
108
+ "competitors": [
109
+ {
110
+ "name": "string",
111
+ "url": "string",
112
+ "pricing": {
113
+ "lastChecked": "ISO-8601",
114
+ "tiers": [{ "name": "string", "price": "string", "period": "string", "features": ["string"], "limits": {} }]
115
+ },
116
+ "recentChanges": [{ "date": "string", "type": "pricing | feature | deprecation", "summary": "string", "details": "string", "source": "url" }],
117
+ "features": [{ "name": "string", "description": "string", "availableOn": ["plan names"] }],
118
+ "sources": ["url"]
119
+ }
120
+ ]
121
+ }
122
+ \`\`\``,
123
+ markdown: 'Save the report to a file called `competitive-intel.md` in the current directory. Tell the user the file path when done.',
124
+ };
125
+ return `You are a competitive intelligence agent powered by Firecrawl. You use a real cloud browser to visit competitor sites, navigate dashboards, and extract pricing and feature data.
126
+
127
+ ## STEP 1: Launch Browser and Open Live View
128
+
129
+ Before anything else, launch a browser session so the user can watch:
130
+
131
+ \`\`\`bash
132
+ firecrawl browser launch-session --json
133
+ \`\`\`
134
+
135
+ Extract the \`interactiveLiveViewUrl\` from the JSON output and open it (NOT the regular \`liveViewUrl\` -- the interactive one lets the user click and interact):
136
+
137
+ \`\`\`bash
138
+ open "<interactiveLiveViewUrl>" # macOS
139
+ xdg-open "<interactiveLiveViewUrl>" # Linux
140
+ \`\`\`
141
+
142
+ If the \`open\` command fails, print the URL clearly so the user can copy-paste it.
143
+ ${profileBlock}
144
+
145
+ ## STEP 2: Visit Each Competitor
146
+
147
+ For each competitor:
148
+
149
+ 1. Navigate to their main site
150
+ 2. Find and visit their **pricing page** -- click through every tier, toggle annual/monthly, expand feature comparison tables
151
+ 3. Find **feature/product pages** -- click into each feature, note capabilities and limits
152
+ 4. Find **changelog / blog / release notes** -- look for recent updates in the last 30 days
153
+ 5. Take snapshots at each step to extract data
154
+
155
+ ### Browser commands:
156
+ \`\`\`bash
157
+ firecrawl browser "open <url>"
158
+ firecrawl browser "snapshot"
159
+ firecrawl browser "click @<ref>"
160
+ firecrawl browser "type @<ref> <text>"
161
+ firecrawl browser "scroll down"
162
+ firecrawl browser "scrape"
163
+ \`\`\`
164
+
165
+ You can also use \`firecrawl scrape <url>\` for quick page grabs when browser interaction isn't needed.
166
+
167
+ ## Focus
168
+
169
+ ${focusInstructions[opts.focus]}
170
+
171
+ ## Output Format
172
+
173
+ ${outputInstructions[opts.output]}
174
+
175
+ Structure your report with:
176
+
177
+ ### Per-Competitor Breakdown
178
+ - Company name & URL
179
+ - Pricing tiers (plan name, price, billing period, key features, limits)
180
+ - Recent changes detected (with dates and source URLs)
181
+ - Feature inventory
182
+
183
+ ### Cross-Competitor Comparison
184
+ - Pricing comparison table (plans side-by-side)
185
+ - Feature matrix
186
+ - Key differentiators
187
+
188
+ ### Alerts & Insights
189
+ - Notable pricing changes or new tiers
190
+ - Feature gaps or opportunities
191
+ - Market positioning shifts
192
+
193
+ ### Sources
194
+ - Every URL visited with what was found
195
+
196
+ ---
197
+
198
+ Do everything sequentially -- visit one competitor at a time. Be thorough: click toggle switches, expand accordions, scroll to load lazy content. Extract real data, not summaries of page titles.
199
+
200
+ Start immediately.`;
201
+ }
202
+ // ─── Command registration ───────────────────────────────────────────────────
203
+ function register(parentCmd, backend) {
204
+ const config = backends_1.BACKENDS[backend];
205
+ parentCmd
206
+ .command('competitive-intel')
207
+ .description('Monitor competitor pricing, features, and changes via browser')
208
+ .argument('[competitors...]', 'Competitor URLs or names')
209
+ .option('-y, --yes', 'Auto-approve all tool permissions')
210
+ .action(async (competitorParts, options) => {
211
+ const prefillCompetitors = competitorParts.length > 0 ? competitorParts.join(' ') : undefined;
212
+ const inputs = await gatherInputs(prefillCompetitors ? { competitors: prefillCompetitors } : undefined);
213
+ const parts = [`Monitor these competitors: ${inputs.competitors}`];
214
+ if (inputs.context)
215
+ parts.push(inputs.context);
216
+ const userMessage = parts.join('. ') + '.';
217
+ const skipPermissions = true;
218
+ console.log(`\nLaunching ${config.displayName}...\n`);
219
+ (0, backends_1.launchAgent)(backend, buildSystemPrompt({
220
+ focus: inputs.focus,
221
+ profile: inputs.profile,
222
+ output: inputs.output,
223
+ }), userMessage, skipPermissions);
224
+ });
225
+ }
226
+ //# sourceMappingURL=competitive-intel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"competitive-intel.js","sourceRoot":"","sources":["../../../../src/commands/experimental/workflows/competitive-intel.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyMH,4BAmCC;AAzOD,0CAAkE;AAClE,sCAA6C;AAY7C,+EAA+E;AAE/E,KAAK,UAAU,YAAY,CAAC,OAE3B;IACC,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QACzB,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IAE5D,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC;QAC9B,OAAO,EAAE,gEAAgE;QACzE,QAAQ,EAAE,IAAA,yBAAgB,EAAC,yBAAyB,CAAC;KACtD,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC;QACzB,OAAO,EAAE,iCAAiC;QAC1C,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,2CAA2C,EAAE,KAAK,EAAE,KAAK,EAAE;YACnE,EAAE,IAAI,EAAE,mCAAmC,EAAE,KAAK,EAAE,SAAS,EAAE;YAC/D,EAAE,IAAI,EAAE,iCAAiC,EAAE,KAAK,EAAE,UAAU,EAAE;YAC9D,EAAE,IAAI,EAAE,kCAAkC,EAAE,KAAK,EAAE,WAAW,EAAE;SACjE;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;QAC1B,OAAO,EACL,uEAAuE;QACzE,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;IAE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@@
1
+ /**
2
+ * Workflow: Dashboard Reporting
3
+ *
4
+ * Uses saved browser profiles to log into analytics platforms and internal
5
+ * tools, navigate dashboards, extract metrics, trigger exports, and compile
6
+ * cross-platform reports. Supports any login-gated web dashboard.
7
+ */
8
+ import { Command } from 'commander';
9
+ import { type Backend } from '../backends';
10
+ export declare function register(parentCmd: Command, backend: Backend): void;
11
+ //# sourceMappingURL=dashboard-reporting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-reporting.d.ts","sourceRoot":"","sources":["../../../../src/commands/experimental/workflows/dashboard-reporting.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,aAAa,CAAC;AA6NlE,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAuCnE"}
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow: Dashboard Reporting
4
+ *
5
+ * Uses saved browser profiles to log into analytics platforms and internal
6
+ * tools, navigate dashboards, extract metrics, trigger exports, and compile
7
+ * cross-platform reports. Supports any login-gated web dashboard.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.register = register;
44
+ const backends_1 = require("../backends");
45
+ const shared_1 = require("../shared");
46
+ // ─── Input gathering ────────────────────────────────────────────────────────
47
+ async function gatherInputs(prefill) {
48
+ if (prefill?.dashboards) {
49
+ return {
50
+ dashboards: prefill.dashboards,
51
+ profile: '',
52
+ metrics: '',
53
+ dateRange: 'last 7 days',
54
+ output: 'json',
55
+ context: '',
56
+ };
57
+ }
58
+ const { input, select } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
59
+ const dashboards = await input({
60
+ message: 'Which dashboards to pull from? (URLs, comma-separated -- e.g., "analytics.google.com, app.mixpanel.com")',
61
+ validate: (0, shared_1.validateRequired)('At least one dashboard URL'),
62
+ });
63
+ const profile = await input({
64
+ message: 'Browser profile for auth? (required for most dashboards)',
65
+ default: '',
66
+ });
67
+ const metrics = await input({
68
+ message: 'What metrics or data to extract? (leave blank for "everything visible")',
69
+ default: '',
70
+ });
71
+ const dateRange = await select({
72
+ message: 'Date range?',
73
+ choices: [
74
+ { name: 'Last 7 days', value: 'last 7 days' },
75
+ { name: 'Last 30 days', value: 'last 30 days' },
76
+ { name: 'Last 90 days', value: 'last 90 days' },
77
+ { name: 'Month to date', value: 'month to date' },
78
+ { name: 'Year to date', value: 'year to date' },
79
+ { name: 'Custom (specify in context)', value: 'custom' },
80
+ ],
81
+ });
82
+ const output = await select({
83
+ message: 'Output format?',
84
+ choices: [
85
+ { name: 'JSON (structured metrics)', value: 'json' },
86
+ { name: 'Markdown report', value: 'markdown' },
87
+ { name: 'Print to terminal', value: 'terminal' },
88
+ ],
89
+ });
90
+ const context = await input({
91
+ message: 'Any other instructions? (e.g., "compare to previous period", "focus on conversion funnel")',
92
+ default: '',
93
+ });
94
+ return { dashboards, profile, metrics, dateRange, output, context };
95
+ }
96
+ // ─── System prompt ──────────────────────────────────────────────────────────
97
+ function buildSystemPrompt(opts) {
98
+ const profileBlock = opts.profile
99
+ ? `\n### Authentication\n\nUse the saved browser profile \`${opts.profile}\` to access dashboards:\n\`\`\`bash\nfirecrawl browser "open <url>" --profile ${opts.profile}\n\`\`\`\nAfter the first \`open\` with \`--profile\`, subsequent browser commands don't need the flag.\n\nIf you encounter a login page, use the profile's saved cookies/session. If those have expired, tell the user and ask them to re-authenticate the profile.`
100
+ : `\n### Authentication\n\nNo browser profile was specified. If dashboards require login, tell the user they need to provide a browser profile with saved auth. You can still attempt to access public dashboards or demo instances.`;
101
+ const outputInstructions = {
102
+ terminal: 'Print the full dashboard report to the terminal in well-formatted markdown with data tables.',
103
+ json: `Save the report to \`dashboard-report.json\` in the current directory. Tell the user the file path when done.
104
+
105
+ Use this schema:
106
+ \`\`\`json
107
+ {
108
+ "reportedAt": "ISO-8601",
109
+ "dateRange": "string",
110
+ "dashboards": [
111
+ {
112
+ "name": "string (platform name)",
113
+ "url": "string",
114
+ "metrics": [
115
+ {
116
+ "name": "string",
117
+ "value": "string | number",
118
+ "unit": "string (e.g. %, users, $)",
119
+ "change": "string (e.g. +12% vs previous period)",
120
+ "period": "string"
121
+ }
122
+ ],
123
+ "tables": [
124
+ {
125
+ "title": "string",
126
+ "headers": ["string"],
127
+ "rows": [["string"]]
128
+ }
129
+ ],
130
+ "exports": [{ "filename": "string", "description": "string" }],
131
+ "notes": "string"
132
+ }
133
+ ],
134
+ "summary": {
135
+ "highlights": ["string"],
136
+ "alerts": ["string"],
137
+ "trends": ["string"]
138
+ }
139
+ }
140
+ \`\`\``,
141
+ markdown: 'Save the report to `dashboard-report.md` in the current directory. Tell the user the file path when done.',
142
+ };
143
+ return `You are a dashboard reporting agent powered by Firecrawl. You use a real cloud browser to log into analytics platforms and internal tools, navigate dashboards, extract metrics, and compile cross-platform reports.
144
+
145
+ ## STEP 1: Launch Browser and Open Live View
146
+
147
+ Before anything else, launch a browser session so the user can watch:
148
+
149
+ \`\`\`bash
150
+ firecrawl browser launch-session --json
151
+ \`\`\`
152
+
153
+ Extract the \`interactiveLiveViewUrl\` from the JSON output and open it (NOT the regular \`liveViewUrl\` -- the interactive one lets the user click and interact):
154
+
155
+ \`\`\`bash
156
+ open "<interactiveLiveViewUrl>" # macOS
157
+ xdg-open "<interactiveLiveViewUrl>" # Linux
158
+ \`\`\`
159
+
160
+ If the \`open\` command fails, print the URL clearly.
161
+ ${profileBlock}
162
+
163
+ ## STEP 2: Visit Each Dashboard
164
+
165
+ For each dashboard URL the user provides:
166
+
167
+ 1. **Navigate** to the dashboard
168
+ 2. **Snapshot** to see the current state
169
+ 3. **Set the date range** to "${opts.dateRange}" -- look for date pickers, dropdowns, or preset buttons and click them
170
+ 4. **Extract visible metrics** -- KPIs, summary cards, headline numbers
171
+ 5. **Explore data tables** -- click through tabs, expand sections, scroll tables
172
+ 6. **Look for exports** -- if there's a "Download CSV", "Export", or "Report" button, click it
173
+ 7. **Screenshot key views** by scraping the page content
174
+
175
+ ### Browser commands:
176
+ \`\`\`bash
177
+ firecrawl browser "open <url>"
178
+ firecrawl browser "snapshot"
179
+ firecrawl browser "click @<ref>"
180
+ firecrawl browser "type @<ref> <text>"
181
+ firecrawl browser "scroll down"
182
+ firecrawl browser "scrape"
183
+ \`\`\`
184
+
185
+ ### Common dashboard patterns:
186
+ - **Google Analytics**: Navigate to Reports > Engagement, Acquisition, etc.
187
+ - **Mixpanel / Amplitude**: Click through funnels, retention, user flows
188
+ - **Stripe / Billing dashboards**: Revenue, MRR, churn, customer counts
189
+ - **Internal tools**: Look for nav menus, sidebar items, tab strips
190
+ - **Grafana / Datadog**: Expand panels, hover charts for values, adjust time range
191
+
192
+ ### Handling charts and visualizations:
193
+ - Charts can't be "read" visually -- instead, look for:
194
+ - Data tables below/beside charts
195
+ - Hover tooltips (snapshot after hovering)
196
+ - "View as table" or "Show data" toggles
197
+ - Export/download buttons for raw data
198
+ - If a metric is only in a chart, describe what you can see from the page content
199
+
200
+ ## STEP 3: Compile Report
201
+
202
+ After visiting all dashboards, compile findings into a unified report:
203
+
204
+ ### Dashboard-by-Dashboard Breakdown
205
+ For each platform:
206
+ - Platform name and URL
207
+ - All metrics extracted with values and units
208
+ - Any data tables captured
209
+ - Files exported (if any)
210
+
211
+ ### Cross-Platform Summary
212
+ - Key highlights across all dashboards
213
+ - Alerts (metrics that changed significantly)
214
+ - Trends (patterns across platforms)
215
+
216
+ ## Output Format
217
+
218
+ ${outputInstructions[opts.output]}
219
+
220
+ ---
221
+
222
+ Do everything sequentially -- visit one dashboard at a time. Be thorough: click through tabs, expand sections, scroll to load lazy content. Extract actual numbers, not just labels.
223
+
224
+ Start immediately.`;
225
+ }
226
+ // ─── Command registration ───────────────────────────────────────────────────
227
+ function register(parentCmd, backend) {
228
+ const config = backends_1.BACKENDS[backend];
229
+ parentCmd
230
+ .command('dashboard-reporting')
231
+ .description('Pull metrics from analytics dashboards and internal tools via browser')
232
+ .argument('[dashboards...]', 'Dashboard URLs to pull from')
233
+ .option('-y, --yes', 'Auto-approve all tool permissions')
234
+ .action(async (dashboardParts, options) => {
235
+ const prefillDashboards = dashboardParts.length > 0 ? dashboardParts.join(' ') : undefined;
236
+ const inputs = await gatherInputs(prefillDashboards ? { dashboards: prefillDashboards } : undefined);
237
+ const parts = [`Pull reports from: ${inputs.dashboards}`];
238
+ if (inputs.metrics)
239
+ parts.push(`Focus on these metrics: ${inputs.metrics}`);
240
+ if (inputs.dateRange !== 'custom')
241
+ parts.push(`Date range: ${inputs.dateRange}`);
242
+ if (inputs.context)
243
+ parts.push(inputs.context);
244
+ const userMessage = parts.join('. ') + '.';
245
+ const skipPermissions = true;
246
+ console.log(`\nLaunching ${config.displayName}...\n`);
247
+ (0, backends_1.launchAgent)(backend, buildSystemPrompt({
248
+ profile: inputs.profile,
249
+ dateRange: inputs.dateRange,
250
+ output: inputs.output,
251
+ }), userMessage, skipPermissions);
252
+ });
253
+ }
254
+ //# sourceMappingURL=dashboard-reporting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-reporting.js","sourceRoot":"","sources":["../../../../src/commands/experimental/workflows/dashboard-reporting.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgOH,4BAuCC;AApQD,0CAAkE;AAClE,sCAA6C;AAa7C,+EAA+E;AAE/E,KAAK,UAAU,YAAY,CAAC,OAE3B;IACC,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IAE5D,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC;QAC7B,OAAO,EACL,0GAA0G;QAC5G,QAAQ,EAAE,IAAA,yBAAgB,EAAC,4BAA4B,CAAC;KACzD,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;QAC1B,OAAO,EAAE,0DAA0D;QACnE,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;QAC1B,OAAO,EACL,yEAAyE;QAC3E,OAAO,EAAE,EAAE;KACZ,CAAC,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AAC,eAAe,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAE3C,MAAM,eAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,WAAW,OAAO,CAAC,CAAC;QAEtD,IAAA,sBAAW,EACT,OAAO,EACP,iBAAiB,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,EACF,WAAW,EACX,eAAe,CAChB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Workflow: Knowledge Base Ingestion
3
+ *
4
+ * Navigates auth-gated documentation portals using saved browser profiles,
5
+ * paginates through articles and sections, and extracts everything into
6
+ * structured JSON. Built for portals that require login, have pagination,
7
+ * or use JS-heavy rendering that static scraping can't handle.
8
+ */
9
+ import { Command } from 'commander';
10
+ import { type Backend } from '../backends';
11
+ export declare function register(parentCmd: Command, backend: Backend): void;
12
+ //# sourceMappingURL=knowledge-ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-ingest.d.ts","sourceRoot":"","sources":["../../../../src/commands/experimental/workflows/knowledge-ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,aAAa,CAAC;AAuNlE,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CA+BnE"}