[ 
https://issues.apache.org/jira/browse/CAMEL-23781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18089624#comment-18089624
 ] 

ASF GitHub Bot commented on CAMEL-23781:
----------------------------------------

davsclaus commented on code in PR #1666:
URL: https://github.com/apache/camel-website/pull/1666#discussion_r3427406068


##########
gulp/helpers/offline-bundle.js:
##########
@@ -0,0 +1,46 @@
+const fs = require('fs');

Review Comment:
   This runs on **every** build (wired into `generate-markdown`). For a large 
doc set, zipping thousands of .md files adds processing time even for local dev 
builds where the bundle isn't needed. Consider gating it behind an environment 
variable (e.g. `CAMEL_ENV=production`) or making it a separate gulp task.



##########
gulp/helpers/offline-bundle.js:
##########
@@ -0,0 +1,46 @@
+const fs = require('fs');
+const path = require('path');
+const { execFileSync } = require('child_process');
+
+const PUBLIC_DIR = 'public';
+const BUNDLE_NAME = 'camel-docs-offline.zip';
+
+/**
+ * Generates an offline documentation bundle: a single .zip archive of all 
generated Markdown (.md)
+ * files plus /llms.txt, preserving the website directory structure. It lets 
agents (and humans)
+ * with no or restricted internet access read the Camel docs locally - 
download, unzip (e.g. into
+ * /tmp) and read the Markdown from there. See CAMEL-23781.
+ *
+ * Must run after the .md files have been generated (see generate-markdown 
task). Uses the system
+ * `zip` tool, so no extra dependency is required.
+ */
+function generateOfflineBundle() {
+  const bundlePath = path.join(PUBLIC_DIR, BUNDLE_NAME);
+
+  if (!fs.existsSync(PUBLIC_DIR)) {
+    console.error(`Cannot generate ${BUNDLE_NAME}: '${PUBLIC_DIR}' directory 
not found`);
+    return;
+  }
+
+  // remove any stale bundle so it is never zipped into itself
+  if (fs.existsSync(bundlePath)) {
+    fs.unlinkSync(bundlePath);
+  }
+
+  try {
+    // run from public/ so paths stay relative to the site root; include only 
.md files and llms.txt
+    execFileSync('zip', ['-r', '-q', BUNDLE_NAME, '.', '-i', '*.md', 
'llms.txt'], {
+      cwd: PUBLIC_DIR,

Review Comment:
   This requires the system `zip` binary to be installed. While common on 
Linux/macOS (and GitHub Actions runners), it's an undocumented dependency. If 
`zip` is missing, the error is caught and logged but the build continues 
silently — which could be confusing when the bundle is expected but missing.
   
   Consider adding a pre-check:
   ```suggestion
       // verify zip is available
       try {
         execFileSync('zip', ['--version'], { stdio: 'pipe' });
       } catch {
         console.warn(`Skipping ${BUNDLE_NAME}: 'zip' command not found`);
         return;
       }
       // run from public/ so paths stay relative to the site root; include 
only .md files and llms.txt
       execFileSync('zip', ['-r', '-q', BUNDLE_NAME, '.', '-i', '*.md', 
'llms.txt'], {
   ```





> camel-website - Offline zip for offline coding agents
> -----------------------------------------------------
>
>                 Key: CAMEL-23781
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23781
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-ai, website
>            Reporter: Claus Ibsen
>            Assignee: Karol Krawczyk
>            Priority: Major
>             Fix For: 4.x
>
>
> [https://github.com/apache/camel/pull/24063]
> Companies may have restricted their AI coding agents to not access the 
> internet, or with controlled access. But even for controlled acccess it may 
> take time for a company to approve camel.apache.org as allowed list.
> Maybe we can have a offline website .zip for AIs that has the website 
> structure and only the .md files that coding agents need. Then it can source 
> the information there, and just unzip this file on the local disk in /tmp.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to