"+slugTitle(pn)+"
Built with PantheraHive BOS
This deliverable outlines the execution of Step 3 in your "Site SEO Auditor" workflow: leveraging Google's Gemini AI to batch generate exact fixes for identified SEO issues. Following the comprehensive crawl and audit of your site, this critical step transforms detected problems into actionable solutions, providing you with precise recommendations to enhance your site's search engine performance.
The core objective of this step is to move beyond mere problem identification. Once the headless crawler (Puppeteer) has thoroughly audited your site against the 12-point SEO checklist and flagged "broken elements" or non-compliant areas, Gemini AI takes over. Its role is to intelligently analyze each specific issue, understand its context within the page's content and structure, and then generate the most accurate and effective fix. This ensures that the solutions provided are not generic, but tailored to your site's unique content and technical architecture.
Below are specific examples demonstrating the type of actionable fixes Gemini AI generates for common SEO issues identified by the crawler:
https://yourdomain.com/ and https://yourdomain.com/index.html. * Recommendation: Implement a canonical tag for https://yourdomain.com/index.html pointing to https://yourdomain.com/. Alternatively, if content differs, generate unique, descriptive titles.
* Proposed Code (for index.html if content is identical and canonicalization is preferred):
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "New Widget 5000",
"image": "https://yourdomain.com/images/product-hero.jpg",
"description": "The New Widget 5000 is a revolutionary device offering unparalleled performance and efficiency...",
"sku": "NW5000-V1",
"offers": {
"@type": "Offer",
"url": "https://yourdomain.com/products/new-widget",
"priceCurrency": "USD",
"price": "199.99",
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/InStock"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"reviewCount": "125"
}
}
</script>
This document details the execution and outcomes of the initial phase of your Site SEO Auditor workflow: the comprehensive site crawl and foundational data collection.
This crucial first step involves a deep, programmatic exploration of your entire website to identify every discoverable page and gather its raw content. Think of it as mapping out your website's complete structure and collecting all the building blocks before we begin our detailed inspection.
The primary goal of the "puppeteer → crawl" step is to:
We leverage Puppeteer, a Node.js library, to control a headless Chrome or Chromium browser. This sophisticated approach offers significant advantages over traditional, text-based crawlers:
https://www.yourdomain.com/) or a provided sitemap, if available.<a> tags (hyperlinks) within the rendered HTML.robots.txt directives where applicable to avoid disallowed paths.For every unique page successfully crawled, the following raw data points are meticulously captured:
<title> tag.<meta name="description"> tag.<h1> tags and their content.<img> tags, including their src, alt attributes, and dimensions.rel="canonical" link, if present.<meta property="og:..."> tags and their content.<script type="application/ld+json"> blocks found.<meta name="viewport"> tag.Upon completion of this crawling phase, the immediate output is a comprehensive, raw data set stored temporarily for the next stage. This data is not yet "audited" but represents the complete digital footprint of your website as seen by a modern browser.
Next Step: The collected raw data for each page will be passed to Step 2: SEO Data Extraction & Normalization, where specific SEO elements will be parsed, extracted, and formatted for the detailed 12-point audit. This separation ensures efficient data collection and focused analysis.
This document details the execution of Step 2 of 5: hive_db → diff for the "Site SEO Auditor" workflow. This crucial step is responsible for comparing the most recent SEO audit results with the previous audit stored in our hive_db (MongoDB), providing a comprehensive "before-and-after" analysis.
hive_db Diff AnalysisThis step focuses on generating a detailed comparison between the newly completed SEO audit and the last recorded audit report for your site. The primary objective is to identify improvements, regressions, newly introduced issues, and resolved problems, offering immediate, actionable insights into your site's SEO performance changes over time.
The hive_db → diff step provides an invaluable historical perspective on your site's SEO health. By automatically comparing audit reports, we can:
hive_dbBefore performing the comparison, the system retrieves the necessary historical data:
SiteAuditReport (from Step 1: "Crawl & Audit") is used as the "after" state. This report contains detailed findings for every audited page against the 12-point SEO checklist.hive_db (MongoDB) to fetch the most recent successfully completed SiteAuditReport for your specific site. This report serves as the "before" state for the comparison. Retrieval is based on the site identifier and the timestamp of the audit.The comparison is performed at a granular, page-by-page level, and then aggregated for a site-wide overview.
For each URL audited in the current report, its findings are compared against its corresponding findings in the previous report. The comparison covers all 12 SEO checklist points:
* Changes in content, length, or uniqueness status.
* Detection of new duplicate titles/descriptions.
* Changes in H1 text or the detection of missing/multiple H1s.
* Coverage changes (e.g., more images missing alt text, or improved coverage).
* Specific images gaining or losing alt text.
* Significant changes in the number of internal links on a page.
* Identification of newly broken internal links.
* Changes in the canonical URL specified.
* Detection of missing or incorrect canonical tags.
* Changes in content (e.g., og:title, og:description, og:image).
* Detection of missing or malformed Open Graph tags.
* Quantitative changes in scores for Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), and First Input Delay (FID).
* Identification of pages crossing performance thresholds (e.g., LCP worsening from "good" to "needs improvement").
* Changes in detected schema types.
* Validation status changes (e.g., new errors, resolved warnings).
* Presence of new or removed structured data blocks.
* Detection of changes in viewport meta tag configuration or rendering issues specific to mobile.
Beyond individual pages, the diff also identifies broader trends and changes across the entire site:
Each identified change is classified for clarity:
The detailed diff results are meticulously structured and integrated directly into the new SiteAuditReport document before it is stored in hive_db.
diffSummary Object: A high-level overview providing quick statistics: * totalImprovements: Count of overall positive changes.
* totalRegressions: Count of overall negative changes.
* totalNewIssues: Count of issues identified for the first time.
* totalResolvedIssues: Count of issues that are no longer present.
* pagesWithChanges: Count of unique URLs that experienced at least one change.
pageDiffs Array: An array of objects, each representing a specific URL that had significant changes. * url: The specific page URL.
* changes: An array detailing individual changes for that URL, including:
* type: (e.g., "regression", "improvement", "new_issue", "resolved_issue")
* category: (e.g., "meta_title", "h1", "core_web_vitals_lcp")
* description: A human-readable description of the change (e.g., "Meta Title changed from 'Old Title' to 'New Title'", "H1 tag is now missing", "LCP improved from 3.5s to 2.1s").
* oldValue: The value from the previous audit.
* newValue: The value from the current audit.
siteWideDiffs Array (Optional): Captures changes that impact the entire site's configuration or aggregated metrics.The complete SiteAuditReport, now enriched with comprehensive diff information, is then persisted in your dedicated hive_db (MongoDB) instance. This ensures a complete historical record and enables future comparisons.
The generated diff report is a critical input for the subsequent workflow steps:
regressions and new_issues are automatically flagged for immediate attention.diff (especially regressions and new issues) will be sent to Gemini in the next step to generate precise, actionable fixes. This ensures that only relevant issues are addressed, rather than re-generating fixes for already resolved problems.The output of this gemini → batch_generate step is a comprehensive collection of precise, AI-generated fixes for every SEO issue identified during the audit. Each fix will be associated with the specific URL and element it pertains to.
These generated fixes will now be:
SiteAuditReport document, creating a clear "before" (identified issue) and "after" (proposed fix) snapshot.This step ensures that you receive not just a list of problems, but a direct, actionable roadmap for improving your site's SEO, significantly reducing the time and effort required for issue resolution.
hive_db → upsertThis step is critical for the persistence, historical tracking, and comparative analysis of your website's SEO performance. Following the comprehensive crawling and auditing of your site, and the AI-driven generation of fixes for identified issues, the resulting SiteAuditReport is now being securely stored in your dedicated PantheraHive database.
The hive_db → upsert operation ensures that every SEO audit conducted for your website is:
Your SiteAuditReport data is stored in MongoDB, a highly scalable NoSQL database, optimized for handling complex, nested data structures like the one generated by this auditor.
SiteAuditReport SchemaEach audit run generates a comprehensive SiteAuditReport document with the following structure. This schema is designed to capture every detail from the 12-point SEO checklist, Gemini's generated fixes, and the historical diff.
{
"auditId": "UUID", // Unique identifier for this specific audit run (e.g., "b8f2a7e0-1c3d-4f5b-9a8c-6d1e0f2a3b4c")
"siteUrl": "String", // The root URL of the site audited (e.g., "https://www.yourwebsite.com")
"auditDate": "ISODate", // Timestamp of when the audit was completed (e.g., "2023-10-27T02:00:00.000Z")
"status": "String", // Overall status of the audit (e.g., "completed", "completed_with_issues", "failed")
"previousAuditId": "UUID | null", // Reference to the auditId of the immediately preceding successful audit for comparison
"pagesAudited": [ // An array containing detailed audit results for each page visited
{
"pageUrl": "String", // The full URL of the audited page (e.g., "https://www.yourwebsite.com/products/item-a")
"statusCode": "Number", // HTTP status code of the page (e.g., 200, 404)
"pageTitle": "String", // The <title> tag content of the page
"crawlTimeMs": "Number", // Time taken to crawl and audit this specific page in milliseconds
"seoChecks": { // Detailed results for each SEO checklist item
"metaTitle": {
"value": "String", // Content of the meta title
"isUnique": "Boolean", // True if unique across the site, False if duplicate
"issues": ["String"] // List of issues related to meta title (e.g., "Too long", "Missing")
},
"metaDescription": {
"value": "String", // Content of the meta description
"isUnique": "Boolean", // True if unique across the site, False if duplicate
"issues": ["String"] // List of issues related to meta description (e.g., "Too short", "Missing")
},
"h1Tag": {
"present": "Boolean", // True if an H1 tag is present
"value": "String | null", // Content of the first H1 tag found
"issues": ["String"] // List of issues (e.g., "Missing H1", "Multiple H1s")
},
"imageAltTextCoverage": {
"totalImages": "Number", // Total images found on the page
"imagesWithAlt": "Number", // Images with valid alt text
"coveragePercentage": "Number", // Percentage of images with alt text
"issues": ["String"] // List of issues (e.g., "Missing alt text on image: /img/logo.png")
},
"internalLinks": {
"count": "Number", // Total number of internal links on the page
"issues": ["String"] // List of issues (e.g., "Broken internal link: /old-page")
},
"canonicalTag": {
"present": "Boolean", // True if a canonical tag is present
"value": "String | null", // The URL specified in the canonical tag
"isCorrect": "Boolean", // True if canonical points to self or correct version
"issues": ["String"] // List of issues (e.g., "Canonical points to different domain", "Missing canonical")
},
"openGraphTags": {
"present": "Boolean", // True if essential Open Graph tags are present
"ogTitle": "String | null", // Open Graph title
"ogDescription": "String | null", // Open Graph description
"issues": ["String"] // List of issues (e.g., "Missing og:title", "Invalid og:image URL")
},
"coreWebVitals": { // Core Web Vitals metrics
"LCP": "String", // Largest Contentful Paint (e.g., "2.1s")
"CLS": "Number", // Cumulative Layout Shift (e.g., 0.03)
"FID": "String", // First Input Delay (e.g., "45ms")
"issues": ["String"] // List of issues (e.g., "LCP exceeds recommended threshold")
},
"structuredData": {
"present": "Boolean", // True if structured data is detected
"types": ["String"], // Array of detected schema types (e.g., ["Article", "BreadcrumbList"])
"issues": ["String"] // List of issues (e.g., "Missing required property in Article schema")
},
"mobileViewport": {
"present": "Boolean", // True if viewport meta tag is present
"isCorrect": "Boolean", // True if viewport configuration is optimal for mobile
"issues": ["String"] // List of issues (e.g., "Missing viewport meta tag", "Fixed width viewport detected")
}
},
"issuesDetected": [ // Specific, actionable issues identified on this page
{
"type": "String", // Categorical type of issue (e.g., "MissingH1", "LowAltCoverage")
"element": "String", // HTML element or context where the issue was found (e.g., "<body>", "<img src='/image.jpg'>")
"description": "String", // Detailed description of the issue
"severity": "String" // Severity level (e.g., "Critical", "High", "Medium", "Low")
}
],
"recommendedFixes": [ // Gemini-generated fixes for issues on this page
{
"issueType": "String", // Corresponds to an issue type in issuesDetected
"fixDescription": "String", // Human-readable explanation of the fix
"codeSnippet": "String | null", // Optional code example for the fix (e.g., HTML, CSS, JS)
"confidence": "String" // Gemini's confidence level in the fix (e.g., "High", "Medium")
}
]
}
],
"siteWideSummary": { // Aggregated statistics and issues across the entire site
"totalPagesAudited": "Number",
"totalIssuesFound": "Number",
"pagesWithCriticalIssues": "Number",
"pagesWithMissingH1": "Number",
"averageImageAltCoverage": "Number",
"duplicateMetaTitleCount": "Number",
"averageLCP": "String",
"averageCLS": "Number",
"averageFID": "String",
// ... other aggregated metrics
},
"diffFromPreviousAudit": { // Highlights changes since the last audit
"hasSignificantChanges": "Boolean", // True if any key metrics or issues have changed
"newIssuesFound": [ // List of issues that were NOT present in the
This concludes the "Site SEO Auditor" workflow. In this final step, all collected audit data, identified issues, recommended fixes, and performance metrics have been securely stored and updated within your dedicated PantheraHive database instance (MongoDB).
hive_db → conditional_update - Detailed Execution SummaryStatus: COMPLETED SUCCESSFULLY
All audit findings, Gemini-generated fixes, and performance metrics have been persisted to your MongoDB database. A new SiteAuditReport document has been created or an existing one updated, providing a comprehensive historical record of your site's SEO performance.
Your SiteAuditReport document in MongoDB is structured to provide a granular and actionable overview of your site's SEO health. Each report includes:
* Page URL: The specific URL audited.
* Audit Checklist Results: Status (Pass/Fail) for each of the 12 SEO points:
* Meta Title Uniqueness
* Meta Description Uniqueness
* H1 Presence & Uniqueness
* Image Alt Text Coverage
* Internal Link Density
* Canonical Tag Presence & Correctness
* Open Graph Tag Presence & Correctness
* Core Web Vitals (LCP, CLS, FID) Scores
* Structured Data Presence
* Mobile Viewport Configuration
* Identified Issues: For any failed checklist item, a detailed description of the issue.
* Gemini-Generated Fixes: For each identified issue, the precise, actionable code snippet or recommendation generated by Gemini to resolve it.
* Before/After Diff (for recurring audits): If this is not the first audit, a comparison against the previous report highlighting changes in scores and issue status. This allows you to track progress and regressions.
* Raw Lighthouse Data: Comprehensive performance metrics from Google Lighthouse (used for Core Web Vitals and other performance checks).
Your comprehensive Site Audit Reports are now available for review and action:
SiteAuditReport data can be retrieved programmatically via the PantheraHive API. Documentation for the relevant endpoints is available in your developer portal.With the audit report finalized and stored, you can now leverage this data for continuous SEO improvement:
PantheraHive remains committed to providing you with the tools for optimal website performance and visibility. Should you have any questions regarding your Site Audit Report or require assistance with implementation, please do not hesitate to contact our support team.
\")\n \"description\": \"String\", // Detailed description of the issue\n \"severity\": \"String\" // Severity level (e.g., \"Critical\", \"High\", \"Medium\", \"Low\")\n }\n ],\n \"recommendedFixes\": [ // Gemini-generated fixes for issues on this page\n {\n \"issueType\": \"String\", // Corresponds to an issue type in issuesDetected\n \"fixDescription\": \"String\", // Human-readable explanation of the fix\n \"codeSnippet\": \"String | null\", // Optional code example for the fix (e.g., HTML, CSS, JS)\n \"confidence\": \"String\" // Gemini's confidence level in the fix (e.g., \"High\", \"Medium\")\n }\n ]\n }\n ],\n\n \"siteWideSummary\": { // Aggregated statistics and issues across the entire site\n \"totalPagesAudited\": \"Number\",\n \"totalIssuesFound\": \"Number\",\n \"pagesWithCriticalIssues\": \"Number\",\n \"pagesWithMissingH1\": \"Number\",\n \"averageImageAltCoverage\": \"Number\",\n \"duplicateMetaTitleCount\": \"Number\",\n \"averageLCP\": \"String\",\n \"averageCLS\": \"Number\",\n \"averageFID\": \"String\",\n // ... other aggregated metrics\n },\n\n \"diffFromPreviousAudit\": { // Highlights changes since the last audit\n \"hasSignificantChanges\": \"Boolean\", // True if any key metrics or issues have changed\n \"newIssuesFound\": [ // List of issues that were NOT present in the\n\n## Site SEO Auditor Workflow: Step 5/5 - Database Update & Report Finalization\n\nThis concludes the \"Site SEO Auditor\" workflow. In this final step, all collected audit data, identified issues, recommended fixes, and performance metrics have been securely stored and updated within your dedicated PantheraHive database instance (MongoDB).\n\n---\n\n### Step 5: `hive_db` → `conditional_update` - Detailed Execution Summary\n\n**Status:** **COMPLETED SUCCESSFULLY**\n\nAll audit findings, Gemini-generated fixes, and performance metrics have been persisted to your MongoDB database. A new `SiteAuditReport` document has been created or an existing one updated, providing a comprehensive historical record of your site's SEO performance.\n\n---\n\n### Audit Report Data Storage & Structure\n\nYour `SiteAuditReport` document in MongoDB is structured to provide a granular and actionable overview of your site's SEO health. Each report includes:\n\n* **Audit ID & Timestamp:** Unique identifier and exact time of the audit run.\n* **Site URL:** The root URL of the audited website.\n* **Audit Scope:** List of all crawled URLs.\n* **Overall Site SEO Score:** An aggregated score reflecting the site's performance across all 12 checklist points.\n* **Page-Level Details:** For each crawled URL, the report stores:\n * **Page URL:** The specific URL audited.\n * **Audit Checklist Results:** Status (Pass/Fail) for each of the 12 SEO points:\n * Meta Title Uniqueness\n * Meta Description Uniqueness\n * H1 Presence & Uniqueness\n * Image Alt Text Coverage\n * Internal Link Density\n * Canonical Tag Presence & Correctness\n * Open Graph Tag Presence & Correctness\n * Core Web Vitals (LCP, CLS, FID) Scores\n * Structured Data Presence\n * Mobile Viewport Configuration\n * **Identified Issues:** For any failed checklist item, a detailed description of the issue.\n * **Gemini-Generated Fixes:** For each identified issue, the precise, actionable code snippet or recommendation generated by Gemini to resolve it.\n * **Before/After Diff (for recurring audits):** If this is not the first audit, a comparison against the previous report highlighting changes in scores and issue status. This allows you to track progress and regressions.\n * **Raw Lighthouse Data:** Comprehensive performance metrics from Google Lighthouse (used for Core Web Vitals and other performance checks).\n* **Summary Statistics:** Aggregated counts of passed/failed items, number of pages with critical issues, etc.\n\n---\n\n### Accessing Your Site Audit Reports\n\nYour comprehensive Site Audit Reports are now available for review and action:\n\n1. **PantheraHive Dashboard:** The most convenient way to access your reports is through your dedicated PantheraHive dashboard. Navigate to the \"Site SEO Auditor\" section to view a summary of your latest audit, drill down into specific page reports, and track historical performance.\n2. **API Access:** For advanced users or integration with other systems, the full `SiteAuditReport` data can be retrieved programmatically via the PantheraHive API. Documentation for the relevant endpoints is available in your developer portal.\n3. **Automated Notifications:** You will receive an email notification summarizing the key findings of this audit. Critical issues and significant changes will be highlighted.\n\n---\n\n### Next Steps & Continuous Optimization\n\nWith the audit report finalized and stored, you can now leverage this data for continuous SEO improvement:\n\n* **Review & Prioritize:** Examine the identified issues and Gemini-generated fixes. Prioritize critical issues (e.g., broken canonicals, severe Core Web Vitals) for immediate action.\n* **Implement Fixes:** Utilize the precise fixes provided by Gemini to address the identified problems on your website.\n* **Monitor Progress:** The \"Site SEO Auditor\" is configured to run automatically every Sunday at 2 AM. This ensures that your site is continuously monitored, and you can track the impact of your implemented fixes through the \"before/after diff\" in subsequent reports.\n* **On-Demand Audits:** If you implement significant changes and wish to verify their impact immediately, you can trigger an on-demand audit at any time through your PantheraHive dashboard.\n\n---\n\n**PantheraHive remains committed to providing you with the tools for optimal website performance and visibility. Should you have any questions regarding your Site Audit Report or require assistance with implementation, please do not hesitate to contact our support team.**";function phTab(btn,name){document.querySelectorAll(".ph-panel").forEach(function(el){el.classList.remove("active");});document.querySelectorAll(".ph-tab").forEach(function(el){el.classList.remove("active");el.classList.add("inactive");});var p=document.getElementById("panel-"+name);if(p)p.classList.add("active");btn.classList.remove("inactive");btn.classList.add("active");if(name==="preview"){var fr=document.getElementById("ph-preview-frame");if(fr&&!fr.dataset.loaded){if(_phIsHtml){fr.srcdoc=_phCode;}else{var vc=document.getElementById("panel-content");fr.srcdoc=vc?""+vc.innerHTML+"":"No content
";}fr.dataset.loaded="1";}}}function phCopyCode(){navigator.clipboard.writeText(_phCode).then(function(){var b=document.getElementById("tab-code");if(b){var o=b.innerHTML;b.innerHTML=' Copied!';setTimeout(function(){b.innerHTML=o;},2000);}});}function phCopyAll(){var txt=_phAll;if(!txt){var vc=document.getElementById("panel-content");if(vc)txt=vc.innerText||vc.textContent||"";}navigator.clipboard.writeText(txt).then(function(){alert("Content copied to clipboard!");});}function phDownload(){var content=_phCode||_phAll;if(!content){var vc=document.getElementById("panel-content");if(vc)content=vc.innerText||vc.textContent||"";}if(!content){alert("No content to download.");return;}var fn=_phFname;if(!_phCode&&fn.endsWith(".txt"))fn=fn.replace(/\.txt$/,".md");var a=document.createElement("a");a.href="data:text/plain;charset=utf-8,"+encodeURIComponent(content);a.download=fn;a.click();}function phDownloadZip(){ var lbl=document.getElementById("ph-zip-lbl"); if(lbl)lbl.textContent="Preparing…"; /* ===== HELPERS ===== */ function cc(s){ return s.replace(/[_-s]+([a-z])/g,function(m,c){return c.toUpperCase();}) .replace(/^[a-z]/,function(m){return m.toUpperCase();}); } function pkgName(app){ return app.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"my_app"; } function slugTitle(app){ return app.replace(/_/g," "); } /* Generic code block extractor. Finds marker comments like: // lib/main.dart or # lib/main.dart or ## lib/main.dart and collects lines until the next marker. Also strips markdown fences (```lang ... ```) from each block. */ function extractFiles(txt, pathRe){ var files={}, cur=null, buf=[]; function flush(){ if(cur&&buf.length){ files[cur]=buf.join(" ").trim(); } } txt.split(" ").forEach(function(line){ var m=line.trim().match(pathRe); if(m){ flush(); cur=m[1]; buf=[]; return; } if(cur) buf.push(line); }); flush(); // Strip ```...``` fences from each file Object.keys(files).forEach(function(k){ files[k]=files[k].replace(/^```[a-z]* ?/,"").replace(/ ?```$/,"").trim(); }); return files; } /* General path extractor that covers most languages */ function extractCode(txt){ var re=/^(?://|#|##)s*((?:lib|src|test|tests|Sources?|app|components?|screens?|views?|hooks?|routes?|store|services?|models?|pages?)/[w/-.]+.w+|pubspec.yaml|Package.swift|angular.json|babel.config.(?:js|ts)|vite.config.(?:js|ts)|tsconfig.(?:json|app.json)|app.json|App.(?:tsx|jsx|vue|kt|swift)|MainActivity(?:.kt)?|ContentView.swift)/i; return extractFiles(txt, re); } /* Detect language from combined code+panel text */ function detectLang(code, panel){ var t=(code+" "+panel).toLowerCase(); if(t.indexOf("import 'package:flutter")>=0||t.indexOf('import "package:flutter')>=0) return "flutter"; if(t.indexOf("statelesswidget")>=0||t.indexOf("statefulwidget")>=0) return "flutter"; if((t.indexOf(".dart")>=0)&&(t.indexOf("pubspec")>=0||t.indexOf("flutter:")>=0)) return "flutter"; if(t.indexOf("react-native")>=0||t.indexOf("react_native")>=0) return "react-native"; if(t.indexOf("stylesheet.create")>=0||t.indexOf("view, text, touchableopacity")>=0) return "react-native"; if(t.indexOf("expo(")>=0||t.indexOf(""expo":")>=0||t.indexOf("from 'expo")>=0) return "react-native"; if(t.indexOf("import swiftui")>=0||t.indexOf("import uikit")>=0) return "swift"; if(t.indexOf(".swift")>=0&&(t.indexOf("func body")>=0||t.indexOf("@main")>=0||t.indexOf("var body: some view")>=0)) return "swift"; if(t.indexOf("import android.")>=0||t.indexOf("package com.example")>=0) return "kotlin"; if(t.indexOf("@composable")>=0||t.indexOf("fun mainactivity")>=0||(t.indexOf(".kt")>=0&&t.indexOf("androidx")>=0)) return "kotlin"; if(t.indexOf("@ngmodule")>=0||t.indexOf("@component")>=0) return "angular"; if(t.indexOf("angular.json")>=0||t.indexOf("from '@angular")>=0) return "angular"; if(t.indexOf(".vue")>=0||t.indexOf("")>=0||t.indexOf("definecomponent")>=0) return "vue"; if(t.indexOf("createapp(")>=0&&t.indexOf("vue")>=0) return "vue"; if(t.indexOf("import react")>=0||t.indexOf("reactdom")>=0||(t.indexOf("jsx.element")>=0)) return "react"; if((t.indexOf("usestate")>=0||t.indexOf("useeffect")>=0)&&t.indexOf("from 'react'")>=0) return "react"; if(t.indexOf(".dart")>=0) return "flutter"; if(t.indexOf(".kt")>=0) return "kotlin"; if(t.indexOf(".swift")>=0) return "swift"; if(t.indexOf("import numpy")>=0||t.indexOf("import pandas")>=0||t.indexOf("#!/usr/bin/env python")>=0) return "python"; if(t.indexOf("const express")>=0||t.indexOf("require('express')")>=0||t.indexOf("app.listen(")>=0) return "node"; return "generic"; } /* ===== PLATFORM BUILDERS ===== */ /* --- Flutter --- */ function buildFlutter(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var all=code+" "+panelTxt; var extracted=extractCode(panelTxt); var treeFiles=(code.match(/[w_]+.dart/g)||[]).filter(function(f,i,a){return a.indexOf(f)===i;}); if(!extracted["lib/main.dart"]) extracted["lib/main.dart"]="import 'package:flutter/material.dart'; void main()=>runApp(const "+cc(pn)+"App()); class "+cc(pn)+"App extends StatelessWidget{ const "+cc(pn)+"App({super.key}); @override Widget build(BuildContext context)=>MaterialApp( title: '"+slugTitle(pn)+"', debugShowCheckedModeBanner: false, theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: Scaffold(appBar: AppBar(title: const Text('"+slugTitle(pn)+"')), body: const Center(child: Text('Welcome!'))), ); } "; // pubspec.yaml — sniff deps var deps=[" flutter: sdk: flutter"]; var devDeps=[" flutter_test: sdk: flutter"," flutter_lints: ^5.0.0"]; var knownPkg={"go_router":"^14.0.0","flutter_riverpod":"^2.6.1","riverpod_annotation":"^2.6.1","shared_preferences":"^2.3.4","http":"^1.2.2","dio":"^5.7.0","firebase_core":"^3.12.1","firebase_auth":"^5.5.1","cloud_firestore":"^5.6.5","get_it":"^8.0.3","flutter_bloc":"^9.1.0","provider":"^6.1.2","cached_network_image":"^3.4.1","url_launcher":"^6.3.1","intl":"^0.19.0","google_fonts":"^6.2.1","equatable":"^2.0.7","freezed_annotation":"^2.4.4","json_annotation":"^4.9.0","path_provider":"^2.1.5","image_picker":"^1.1.2","uuid":"^4.4.2","flutter_svg":"^2.0.17","lottie":"^3.2.0","hive_flutter":"^1.1.0"}; var knownDev={"build_runner":"^2.4.14","freezed":"^2.5.7","json_serializable":"^6.8.0","riverpod_generator":"^2.6.3","hive_generator":"^2.0.1"}; Object.keys(knownPkg).forEach(function(p){if(all.indexOf("package:"+p)>=0)deps.push(" "+p+": "+knownPkg[p]);}); Object.keys(knownDev).forEach(function(p){if(all.indexOf(p)>=0)devDeps.push(" "+p+": "+knownDev[p]);}); zip.file(folder+"pubspec.yaml","name: "+pn+" description: Flutter app — PantheraHive BOS. version: 1.0.0+1 environment: sdk: '>=3.3.0 <4.0.0' dependencies: "+deps.join(" ")+" dev_dependencies: "+devDeps.join(" ")+" flutter: uses-material-design: true assets: - assets/images/ "); zip.file(folder+"analysis_options.yaml","include: package:flutter_lints/flutter.yaml "); zip.file(folder+".gitignore",".dart_tool/ .flutter-plugins .flutter-plugins-dependencies /build/ .pub-cache/ *.g.dart *.freezed.dart .idea/ .vscode/ "); zip.file(folder+"README.md","# "+slugTitle(pn)+" Generated by PantheraHive BOS. ## Setup ```bash flutter pub get flutter run ``` ## Build ```bash flutter build apk # Android flutter build ipa # iOS flutter build web # Web ``` "); zip.file(folder+"assets/images/.gitkeep",""); Object.keys(extracted).forEach(function(p){ zip.file(folder+p,extracted[p]); }); treeFiles.forEach(function(fn){ if(fn.indexOf("_test.dart")>=0) return; var found=Object.keys(extracted).some(function(p){return p.endsWith("/"+fn)||p===fn;}); if(!found){ var path="lib/"+fn; var cls=cc(fn.replace(".dart","")); var isScr=fn.indexOf("screen")>=0||fn.indexOf("page")>=0||fn.indexOf("view")>=0; var stub=isScr?"import 'package:flutter/material.dart'; class "+cls+" extends StatelessWidget{ const "+cls+"({super.key}); @override Widget build(BuildContext ctx)=>Scaffold( appBar: AppBar(title: const Text('"+fn.replace(/_/g," ").replace(".dart","")+"')), body: const Center(child: Text('"+cls+" — TODO')), ); } ":"// TODO: implement class "+cls+"{ // "+fn+" } "; zip.file(folder+path,stub); } }); } /* --- React Native (Expo) --- */ function buildReactNative(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var extracted=extractCode(panelTxt); var allT=code+" "+panelTxt; var usesTS=allT.indexOf(".tsx")>=0||allT.indexOf(": React.")>=0||allT.indexOf("interface ")>=0; var ext=usesTS?"tsx":"jsx"; zip.file(folder+"package.json",'{ "name": "'+pn+'", "version": "1.0.0", "main": "expo-router/entry", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "expo": "~52.0.0", "expo-router": "~4.0.0", "expo-status-bar": "~2.0.1", "expo-font": "~13.0.1", "react": "18.3.1", "react-native": "0.76.7", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.3.0", "@react-navigation/native": "^7.0.14" }, "devDependencies": { "@babel/core": "^7.25.0", "typescript": "~5.3.3", "@types/react": "~18.3.12" } } '); zip.file(folder+"app.json",'{ "expo": { "name": "'+slugTitle(pn)+'", "slug": "'+pn+'", "version": "1.0.0", "orientation": "portrait", "scheme": "'+pn+'", "platforms": ["ios","android","web"], "icon": "./assets/icon.png", "splash": {"image": "./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff"}, "ios": {"supportsTablet": true}, "android": {"package": "com.example.'+pn+'"}, "newArchEnabled": true } } '); zip.file(folder+"tsconfig.json",'{ "extends": "expo/tsconfig.base", "compilerOptions": { "strict": true, "paths": {"@/*": ["./src/*"]} } } '); zip.file(folder+"babel.config.js","module.exports=function(api){ api.cache(true); return {presets:['babel-preset-expo']}; }; "); var hasApp=Object.keys(extracted).some(function(k){return k.toLowerCase().indexOf("app.")>=0;}); if(!hasApp) zip.file(folder+"App."+ext,"import React from 'react'; import {View,Text,StyleSheet,StatusBar,SafeAreaView} from 'react-native'; export default function App(){ return(Built with PantheraHive BOS
Built with PantheraHive BOS
Built with PantheraHive BOS
"); h+="
"+hc+"