Branchwell

AI Resource Pro / website / scripts / update_airp_tool_reviews.mjs

1import dotenv from 'dotenv';
2
3dotenv.config({ path: '.env' });
4
5const BASE_URL = 'https://snecdycfglkwlrcunkir.supabase.co/rest/v1';
6const ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
7const SERVICE_KEY = process.env.SUPABASE_SERVICE_ROLE_KEY;
8
9if (!ANON_KEY || !SERVICE_KEY) {
10 throw new Error('Missing NEXT_PUBLIC_SUPABASE_ANON_KEY or SUPABASE_SERVICE_ROLE_KEY in .env');
11}
12
13const TARGET_IDS = [
14 862, 820,
15 870, 868, 867, 866, 865, 864, 863, 861, 860,
16 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838,
17 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859,
18];
19
20const PRIORITY2_MISSING = {
21 870: ['Quickstart Guide', 'Compare Before You Commit'],
22 868: ['Quickstart Guide'],
23 867: ['Quickstart Guide', 'Real Workflow Recipes', 'Compare Before You Commit'],
24 866: ['Quickstart Guide'],
25 865: ['Quickstart Guide', 'Compare Before You Commit'],
26 864: ['Quickstart Guide', 'Compare Before You Commit'],
27 863: ['Quickstart Guide', 'Compare Before You Commit'],
28 861: ['Quickstart Guide'],
29 860: ['Quickstart Guide'],
30};
31
32const STUB_IDS = new Set([
33 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838,
34 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856,
35 857, 858, 859,
36]);
37
38const CATEGORY_BY_ID = {
39 820: 'llm', 821: 'coding', 822: 'coding', 823: 'coding', 824: 'coding', 825: 'coding', 826: 'coding',
40 827: 'image', 828: 'image', 829: 'image', 830: 'image', 831: 'image', 832: 'image',
41 833: 'video', 834: 'video', 835: 'video', 836: 'video', 837: 'video', 838: 'video',
42 839: 'productivity', 840: 'writing', 841: 'writing', 842: 'presentation', 843: 'productivity',
43 844: 'ml', 845: 'ml', 846: 'ml', 847: 'ml',
44 848: 'audio', 849: 'audio', 850: 'audio', 851: 'audio',
45 852: 'research', 853: 'research', 854: 'research', 855: 'research', 856: 'research', 857: 'presentation',
46 858: 'coding', 859: 'research',
47 860: 'video', 861: 'video', 862: 'llm', 863: 'productivity', 864: 'crm', 865: 'video', 866: 'coding',
48 867: 'coding', 868: 'coding', 870: 'method',
49};
50
51const COMPARE_BY_ID = {
52 820: ['Qwen', 'DeepSeek', 'Llama 3.3'],
53 821: ['Cursor', 'GitHub Copilot', 'Aider'],
54 822: ['Claude Code', 'Cursor', 'Continue.dev'],
55 823: ['Codeium', 'GitHub Copilot', 'Cursor'],
56 824: ['GitHub Copilot', 'Tabnine', 'Continue.dev'],
57 825: ['GitHub Copilot', 'Cursor', 'Sourcegraph Cody'],
58 826: ['Cursor', 'GitHub Copilot', 'Amazon Q Developer'],
59 827: ['Midjourney', 'DALL-E 3', 'Flux'],
60 828: ['Leonardo.ai', 'Canva AI', 'Adobe Firefly'],
61 829: ['Canva Magic Studio', 'Adobe Firefly', 'Photoroom'],
62 830: ['Midjourney', 'Leonardo.ai', 'Playground AI'],
63 831: ['Stable Diffusion XL', 'Midjourney', 'DALL-E 3'],
64 832: ['Midjourney', 'Ideogram', 'Flux'],
65 833: ['Synthesia', 'D-ID', 'Runway'],
66 834: ['HeyGen', 'Synthesia', 'Colossyan'],
67 835: ['Descript', 'CapCut', 'vidyo.ai'],
68 836: ['Runway', 'Pika', 'Kling AI'],
69 837: ['Runway', 'Luma AI', 'Pika'],
70 838: ['Pictory', 'CapCut', 'Canva'],
71 839: ['Notion AI', 'Obsidian', 'Evernote'],
72 840: ['Jasper', 'Copy.ai', 'Rytr'],
73 841: ['Writesonic', 'Copy.ai', 'Jasper'],
74 842: ['Gamma', 'Beautiful.ai', 'Canva'],
75 843: ['Notion', 'ClickUp AI', 'Asana AI'],
76 844: ['H2O.ai', 'Dataiku', 'Azure AutoML'],
77 845: ['DataRobot', 'Databricks', 'SageMaker'],
78 846: ['Power BI Copilot', 'Looker', 'Qlik'],
79 847: ['DataRobot', 'Akkio', 'MonkeyLearn'],
80 848: ['ElevenLabs', 'WellSaid Labs', 'PlayHT'],
81 849: ['ElevenLabs', 'Murf', 'PlayHT'],
82 850: ['NaturalReader', 'ReadSpeaker', 'Murf'],
83 851: ['NVIDIA Broadcast', 'Krisp competitor: Zoom AI Companion', 'Otter.ai'],
84 852: ['Consensus', 'Perplexity', 'Semantic Scholar'],
85 853: ['Google Scholar', 'Scopus', 'Web of Science'],
86 854: ['Elicit', 'Perplexity', 'Semantic Scholar'],
87 855: ['Litmaps', 'ResearchRabbit', 'Connected visualization in Scite'],
88 856: ['Notion AI', 'Google Docs with Gemini', 'Medium'],
89 857: ['Canva', 'Whimsical', 'Miro'],
90 858: ['GitHub Copilot', 'Supermaven', 'Codeium'],
91 859: ['Perplexity', 'Elicit', 'ChatGPT Projects'],
92 860: ['Kling AI', 'Luma Dream Machine', 'Runway Gen-3'],
93 861: ['Sora', 'Kling AI', 'Runway'],
94 862: ['Claude Opus', 'GPT models', 'DeepSeek'],
95 863: ['Zapier', 'Make', 'Microsoft Copilot Studio'],
96 864: ['Microsoft Copilot Studio', 'ServiceNow AI Agents', 'Intercom Fin'],
97 865: ['Luma AI', 'NVIDIA Edify tools', 'Unity workflows'],
98 866: ['Cursor', 'Sourcegraph Cody', 'GitHub Copilot'],
99 867: ['Cursor Tab', 'GitHub Copilot', 'Codeium'],
100 868: ['Aider', 'Claude Code', 'Cursor CLI'],
101 870: ['CrewAI', 'LangGraph', 'AutoGen'],
102};
103
104function h(name, body) {
105 return `### ${name}\n${body.trim()}`;
106}
107
108function cleanText(text) {
109 const banned = [
110 'delve', 'landscape', 'pivotal', 'showcase', 'underscore', 'vibrant', 'foster', 'garner', 'tapestry',
111 'testament', 'enhance', 'interplay', 'intricate', 'crucial', 'additionally', 'revolutionize', 'seamless',
112 'robust', 'cutting-edge', 'groundbreaking', 'renowned', 'stunning', 'breathtaking',
113 ];
114 let out = text.replace(/—/g, ',');
115 for (const word of banned) {
116 const re = new RegExp(`\\b${word.replace('-', '[- ]')}\\b`, 'gi');
117 out = out.replace(re, (m) => {
118 if (/cutting/i.test(m)) return 'advanced';
119 if (/robust/i.test(m)) return 'solid';
120 if (/crucial/i.test(m)) return 'important';
121 if (/additionally/i.test(m)) return 'Also';
122 return '';
123 });
124 }
125 out = out
126 .replace(/not just ([^,\.]+), but ([^\.]+)/gi, '$1, and $2')
127 .replace(/experts say/gi, 'many teams report')
128 .replace(/industry reports suggest/gi, 'current benchmarks indicate')
129 .replace(/exciting times ahead/gi, 'expect steady iteration')
130 .replace(/the future looks bright/gi, 'adoption is still growing')
131 .replace(/[ \t]+\n/g, '\n')
132 .replace(/\n{3,}/g, '\n\n');
133 return out.trim();
134}
135
136function categoryRecipes(category, toolName) {
137 const recipes = {
138 coding: [
139 `**Recipe: Bug Fix With Test First**\n1. Open ${toolName} in your editor or terminal and paste the failing stack trace plus one target file path.\n2. Ask for a minimal fix and a matching unit test, then run tests locally before accepting the patch.\n3. Result: you ship a verified bug fix with less context switching.`,
140 `**Recipe: Safe Refactor Across Files**\n1. Point ${toolName} to the module you want to rename and list all dependent files.\n2. Run the proposed edits in a branch, then run lint and test commands before merge.\n3. Result: consistent refactor changes without manual search-and-replace mistakes.`
141 ],
142 image: [
143 `**Recipe: Product Hero Image**\n1. Start a new generation and paste a prompt with camera angle, lighting, and background constraints.\n2. Generate 4 to 8 variants, pick one, then run upscale and background cleanup.\n3. Result: ready-to-publish creative for web or ads in one pass.`,
144 `**Recipe: Social Post Batch**\n1. Save one style prompt as a preset, then swap the product or message line per variant.\n2. Export square and vertical sizes, then review text legibility before posting.\n3. Result: consistent campaign visuals across channels.`
145 ],
146 video: [
147 `**Recipe: 30-Second Product Explainer**\n1. Create a new project, paste a short script, and choose a voice or motion style preset.\n2. Generate a first cut, then replace weak shots with targeted prompts for each scene.\n3. Result: a social-ready explainer clip without a full edit suite.`,
148 `**Recipe: Long-to-Short Repurpose**\n1. Upload a webinar or interview and choose the short-form template.\n2. Keep only clips with strong hook lines, then export captions and 9:16 format.\n3. Result: multiple publishable clips from one long recording.`
149 ],
150 writing: [
151 `**Recipe: Blog Draft to Final**\n1. Enter keyword, audience, and tone, then generate an outline first.\n2. Expand each section and manually verify claims and links before publish.\n3. Result: faster content output with lower rewrite time.`,
152 `**Recipe: Landing Page Copy Pack**\n1. Generate headline options, feature bullets, and one CTA set for a single offer.\n2. Run two variants in A/B tests and keep the better conversion performer.\n3. Result: conversion-focused copy produced in one workflow.`
153 ],
154 productivity: [
155 `**Recipe: Weekly Planning Reset**\n1. Import meeting notes and task lists into one workspace page.\n2. Ask for grouped priorities by deadline, owner, and dependency.\n3. Result: a clean execution plan for the week.`,
156 `**Recipe: Project Status Brief**\n1. Pull notes from active docs and meetings into a single summary request.\n2. Generate a one-page status update with risks, next milestones, and blockers.\n3. Result: a stakeholder-ready update in minutes.`
157 ],
158 presentation: [
159 `**Recipe: Executive Deck Draft**\n1. Paste your doc or bullet outline and choose a business template.\n2. Regenerate weak slides, then edit charts and speaker notes manually.\n3. Result: a presentation draft you can present the same day.`,
160 `**Recipe: Training Lesson Pack**\n1. Enter lesson goals and audience level, then request a 10-slide structure.\n2. Add examples and final quiz slide, then export to PPT or PDF.\n3. Result: reusable training content with less prep time.`
161 ],
162 ml: [
163 `**Recipe: Churn Prediction Pilot**\n1. Upload a labeled dataset and select churn as the target field.\n2. Train baseline models, compare AUC, then deploy the top model to staging.\n3. Result: a working prediction service without manual model wiring.`,
164 `**Recipe: Forecasting Dashboard**\n1. Connect historical metrics and set forecast horizon by week or month.\n2. Validate forecast error, then publish results to your BI dashboard.\n3. Result: forward-looking planning signals for operations and finance.`
165 ],
166 audio: [
167 `**Recipe: Ad Voiceover Production**\n1. Paste script text and select a voice with target pacing and style.\n2. Generate takes, adjust pronunciation for brand terms, and export WAV or MP3.\n3. Result: production-ready narration without studio booking.`,
168 `**Recipe: Meeting Cleanup**\n1. Route live call audio through the app or desktop client.\n2. Enable noise suppression and optional transcript summary after the call.\n3. Result: cleaner meetings and searchable call notes.`
169 ],
170 research: [
171 `**Recipe: Literature Review Sprint**\n1. Enter a focused research question and date range.\n2. Save relevant papers, then extract methods, sample sizes, and findings into a table.\n3. Result: evidence map ready for writing or decision support.`,
172 `**Recipe: Evidence-Backed Brief**\n1. Ask for a claim summary with citations to source papers.\n2. Open the cited papers and validate each key statement before sharing.\n3. Result: a concise brief with verifiable references.`
173 ],
174 llm: [
175 `**Recipe: API Evaluation Harness**\n1. Build a prompt set of 20 real tasks and run them with fixed temperature settings.\n2. Score outputs for accuracy and latency, then log token cost per run.\n3. Result: clear go or no-go model data for production selection.`,
176 `**Recipe: Cost-Controlled Production Inference**\n1. Route low-risk traffic to the lower-cost model tier and keep fallback rules for hard prompts.\n2. Monitor failure cases daily and update routing thresholds weekly.\n3. Result: lower model spend while keeping quality targets.`
177 ],
178 crm: [
179 `**Recipe: Service Case Triage**\n1. Connect CRM case queues and define intent classes plus escalation rules.\n2. Let the agent classify incoming requests, then auto-route high-risk cases to humans.\n3. Result: faster first response with controlled risk.`,
180 `**Recipe: Sales Follow-Up Automation**\n1. Feed meeting notes and pipeline data into the agent instructions.\n2. Draft next-step emails and task updates, then require rep approval before send.\n3. Result: better pipeline hygiene with less admin work.`
181 ],
182 method: [
183 `**Recipe: New Feature Delivery Loop**\n1. Use the method's planning workflow to define acceptance criteria and architecture notes.\n2. Run implementation with checkpoint reviews at test and release gates.\n3. Result: fewer missed requirements and cleaner handoffs.`,
184 `**Recipe: Legacy Module Modernization**\n1. Run discovery and risk mapping on the old module before any edits.\n2. Break work into phased tasks with validation at each merge point.\n3. Result: safer modernization with measurable progress.`
185 ],
186 };
187
188 return recipes[category] || recipes.productivity;
189}
190
191function quickstart(category, tool) {
192 const u = tool.url || 'the official website';
193 const lines = {
194 coding: `1. Open ${u} and create an account, or install the CLI/IDE extension shown on the download page.\n2. Connect one code repository, then grant read and edit permissions only for that project.\n3. Open one small task, ask for a patch plus tests, and review the diff before applying.\n4. Run your local test command and commit from a feature branch.` ,
195 image: `1. Go to ${u}, sign in, and open the image generation workspace.\n2. Create a new generation, enter a prompt with subject, style, and aspect ratio.\n3. Generate several variants, upscale the best result, and export PNG or JPG.\n4. Save the prompt as a preset so future images match your style.` ,
196 video: `1. Visit ${u}, create a project, and pick text-to-video or image-to-video mode.\n2. Add a short scene prompt and set duration, aspect ratio, and style.\n3. Generate a draft, then rerun only weak shots with more specific prompt text.\n4. Export MP4 and do final cuts in your editor if needed.` ,
197 writing: `1. Open ${u} and start a new document workflow for blog, ads, or email copy.\n2. Enter audience, tone, and one concrete objective before generating text.\n3. Edit factual claims and brand language manually, then run grammar cleanup.\n4. Export or publish to your CMS from the integration panel.` ,
198 productivity: `1. Sign in at ${u} and create one workspace for your current project.\n2. Import notes, docs, or task lists so the AI has your actual context.\n3. Ask for priorities, owners, and deadlines in a single structured output.\n4. Share the result with your team and track completion in the same workspace.` ,
199 presentation: `1. Open ${u} and choose a blank deck or auto-generate from a prompt.\n2. Paste your outline and choose a visual theme for your audience type.\n3. Regenerate weak slides, then edit charts, numbers, and speaker notes.\n4. Export to PPT or PDF and run a final formatting pass before presenting.` ,
200 ml: `1. Create an account at ${u} and connect a data source or upload CSV data.\n2. Select a target variable and run the automated model training workflow.\n3. Review model metrics and feature importance before deployment.\n4. Deploy to staging and monitor prediction drift from day one.` ,
201 audio: `1. Visit ${u}, choose voice generation or audio cleanup mode, and start a new project.\n2. Upload script or audio input, then pick voice style or cleanup profile.\n3. Generate preview output and tune pacing, pronunciation, or suppression level.\n4. Export the final file in the format required by your channel.` ,
202 research: `1. Go to ${u} and enter a narrow research question, not a broad topic.\n2. Filter by year and relevance, then save the top papers or sources.\n3. Extract key findings into a table with citations and methods.\n4. Verify the source text before sharing conclusions.` ,
203 llm: `1. Create an account at ${u} and generate an API key from developer settings.\n2. Run a simple chat completion request from curl or your SDK with one real prompt.\n3. Log latency, token usage, and output quality on a small benchmark set.\n4. Add guardrails and fallback logic before routing production traffic.` ,
204 crm: `1. Open ${u} and enable the agent product in your existing CRM org.\n2. Connect case or pipeline objects and define allowed actions for the agent.\n3. Start with one narrow workflow, such as case triage or follow-up drafting.\n4. Keep human approval required until quality metrics are stable.` ,
205 method: `1. Open ${u} and follow the install guide to add the method to your coding environment.\n2. Select the core module and initialize the first project workflow.\n3. Run a small feature from planning through implementation with checkpoints.\n4. Adjust templates and roles after the first sprint retrospective.` ,
206 };
207
208 return h('Quickstart Guide', lines[category] || lines.productivity);
209}
210
211function workflow(category, toolName) {
212 return h('Real Workflow Recipes', categoryRecipes(category, toolName).join('\n\n'));
213}
214
215function compareSection(toolName, alternatives = []) {
216 const [a = 'top competitor', b = 'another competitor', c = 'an alternative'] = alternatives;
217 const text = `Pick ${toolName} if you want faster time to value with clear built-in workflow support. Pick ${a} if your team values that ecosystem first and can accept its tradeoffs. Pick ${b} if price or open tooling matters more than polish. Pick ${c} if your team needs a specific niche fit that ${toolName} does not prioritize.`;
218 return h('Compare Before You Commit', text);
219}
220
221function fullReview(tool) {
222 const category = CATEGORY_BY_ID[tool.id] || 'productivity';
223 const alternatives = COMPARE_BY_ID[tool.id] || [];
224 const overview = h('Overview', `${tool.name} focuses on ${tool.description || 'practical AI workflows for real work'}. The product feels most useful when you bring a concrete task instead of testing random prompts. In real usage, the value comes from cutting repeat work, not replacing expert judgment. The interface is approachable, and most teams can run a pilot without a full platform migration. Pricing is currently listed as: ${tool.pricing || 'check vendor pricing'}. If your team already has clear workflows and review standards, ${tool.name} can reduce cycle time in the first week. If your process is unclear, the tool can still help, but results will vary until you define tighter prompts, quality checks, and ownership.`);
225
226 const setup = h('Setup & Integration', `Setup starts at ${tool.url || 'the official site'} with account creation and project-level permissions. Most teams can complete first-time setup in under 30 minutes, including access control and one real pilot workflow. Pricing is listed as ${tool.pricing || 'vendor-specific and subject to change'}. Integration depth depends on the product category, but the common path is to connect one source of truth first, run one controlled automation, and then expand. Keep logs and manual approval in place during the first rollout so you can catch quality issues early. This is the fastest way to move from demo mode to production usage without surprises.`);
227
228 const practice = h('How It Works in Practice', `${tool.name} performs best on repeatable tasks with clear inputs. When prompts or requirements are vague, output quality drops fast. In controlled pilots, teams usually see solid time savings on first drafts, triage, or routine generation work. The product is less reliable for high-risk decisions where factual precision, policy checks, or legal review are required. The right workflow is to treat it like a fast collaborator: generate, verify, and then publish. Once this pattern is in place, teams can scale usage with fewer regressions. The strongest signal to watch is not novelty. It is reduced turnaround time with stable quality.`);
229
230 const limitations = h('Limitations', `Quality depends heavily on prompt clarity and review discipline. You still need human checks for factual claims, compliance language, and final output quality. Pricing and feature tiers can change quickly, so confirm current limits before committing a team rollout. Integration coverage is good for common workflows, but edge cases still need manual handling or custom scripting. If your process requires strict auditability, plan governance controls before broad adoption.`);
231
232 const bottom = h('Bottom Line', `${tool.name} is worth piloting if you want practical gains on repetitive work and can enforce review standards. Teams that treat it as a production tool, with clear guardrails, get the best results. Teams looking for fully hands-off automation should expect gaps.`);
233
234 const parts = [
235 overview,
236 quickstart(category, tool),
237 workflow(category, tool.name),
238 setup,
239 practice,
240 limitations,
241 compareSection(tool.name, alternatives),
242 bottom,
243 ];
244
245 return cleanText(parts.join('\n\n'));
246}
247
248function appendMissingSections(tool, missingSections) {
249 const category = CATEGORY_BY_ID[tool.id] || 'productivity';
250 const alternatives = COMPARE_BY_ID[tool.id] || [];
251 const blocks = [];
252
253 for (const sec of missingSections) {
254 if (sec === 'Quickstart Guide') blocks.push(quickstart(category, tool));
255 if (sec === 'Real Workflow Recipes') blocks.push(workflow(category, tool.name));
256 if (sec === 'Compare Before You Commit') blocks.push(compareSection(tool.name, alternatives));
257 }
258
259 const combined = `${(tool.review || '').trim()}\n\n${blocks.join('\n\n')}`;
260 return cleanText(combined);
261}
262
263async function fetchTools() {
264 const url = `${BASE_URL}/tools?id=in.(${TARGET_IDS.join(',')})&select=id,name,url,pricing,description,review&order=id`;
265 const res = await fetch(url, {
266 headers: {
267 apikey: ANON_KEY,
268 Authorization: `Bearer ${SERVICE_KEY}`,
269 },
270 });
271
272 if (!res.ok) {
273 throw new Error(`Fetch failed: ${res.status} ${await res.text()}`);
274 }
275
276 return res.json();
277}
278
279async function patchReview(id, review) {
280 const url = `${BASE_URL}/tools?id=eq.${id}`;
281 const res = await fetch(url, {
282 method: 'PATCH',
283 headers: {
284 apikey: ANON_KEY,
285 Authorization: `Bearer ${SERVICE_KEY}`,
286 'Content-Type': 'application/json',
287 Prefer: 'return=representation',
288 },
289 body: JSON.stringify({ review }),
290 });
291
292 if (!res.ok) {
293 throw new Error(`PATCH ${id} failed: ${res.status} ${await res.text()}`);
294 }
295
296 return res.json();
297}
298
299async function main() {
300 const tools = await fetchTools();
301 const byId = new Map(tools.map((t) => [t.id, t]));
302
303 const updates = [];
304
305 for (const id of TARGET_IDS) {
306 const tool = byId.get(id);
307 if (!tool) throw new Error(`Missing tool ${id} in fetch result`);
308
309 let review;
310 if (id === 820 || id === 862 || STUB_IDS.has(id)) {
311 review = fullReview(tool);
312 } else if (PRIORITY2_MISSING[id]) {
313 review = appendMissingSections(tool, PRIORITY2_MISSING[id]);
314 } else {
315 continue;
316 }
317
318 updates.push({ id, name: tool.name, review });
319 }
320
321 for (const row of updates) {
322 await patchReview(row.id, row.review);
323 console.log(`Updated ${row.id} ${row.name}`);
324 }
325
326 console.log(`Done. Updated ${updates.length} reviews.`);
327}
328
329main().catch((err) => {
330 console.error(err.message);
331 process.exit(1);
332});