Skip to content

Commit f700547

Browse files
Merge branch 'production' into marcio/pcx17803-mconn-kvm
2 parents ff31f34 + 09417f8 commit f700547

File tree

271 files changed

+1235
-1152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+1235
-1152
lines changed

.github/workflows/publish-production.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,36 @@ jobs:
4141
cd distmd && zip -r markdown.zip .
4242
npx wrangler r2 object put vendored-markdown/markdown.zip --file=markdown.zip --remote
4343
rm markdown.zip
44+
cd ..
45+
46+
cd distllms
47+
for file in $(find . -type f); do
48+
npx wrangler r2 object put vendored-markdown/$file --file=$file --remote
49+
done
50+
- name: Install rclone
51+
run: sudo -v ; curl https://rclone.org/install.sh | sudo bash
4452
- name: Upload vendored Markdown files to ZT DevDocs bucket
4553
env:
4654
AWS_ACCESS_KEY_ID: ${{ secrets.ZT_DEVDOCS_ACCESS_KEY_ID }}
4755
AWS_SECRET_ACCESS_KEY: ${{ secrets.ZT_DEVDOCS_SECRET_ACCESS_KEY }}
4856
run: |
49-
sudo -v ; curl https://rclone.org/install.sh | sudo bash
5057
rclone sync \
5158
--s3-env-auth \
5259
--s3-provider="Cloudflare" \
5360
--s3-endpoint="https://e76c849bd111ee7d3006b6625713991e.r2.cloudflarestorage.com" \
5461
distmd \
5562
:s3:/zt-dashboard-dev-docs
63+
- name: Upload vendored Markdown files to AutoRAG DevDocs bucket
64+
env:
65+
AWS_ACCESS_KEY_ID: ${{ secrets.AUTORAG_DEVDOCS_ACCESS_KEY_ID }}
66+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AUTORAG_DEVDOCS_SECRET_ACCESS_KEY }}
67+
run: |
68+
rclone sync \
69+
--s3-env-auth \
70+
--s3-provider="Cloudflare" \
71+
--s3-endpoint="https://cf9267a5bf4f6b3cceca48d554d81679.r2.cloudflarestorage.com" \
72+
distmd \
73+
:s3:/developer-docs-full
5674
- uses: actions/cache/save@v4
5775
if: always()
5876
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# build output
22
dist/
33
distmd/
4+
distllms/
45
# generated types
56
.astro/
67

astro.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ export default defineConfig({
137137
"/api/**",
138138
"/changelog/**",
139139
"/http/resources/**",
140+
"/llms.txt",
141+
"/llms-full.txt",
140142
"{props.*}",
141143
"/",
142144
"/glossary/",
@@ -146,7 +148,12 @@ export default defineConfig({
146148
"/ruleset-engine/rules-language/fields/reference/**",
147149
"/workers/examples/?languages=*",
148150
"/workers/examples/?tags=*",
151+
"/workers/llms-full.txt",
149152
"/workers-ai/models/**",
153+
"**index.md",
154+
"/markdown.zip",
155+
"/style-guide/index.md",
156+
"/style-guide/fixtures/markdown/index.md",
150157
],
151158
}),
152159
]

bin/generate-index-md.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
1+
import {
2+
readFileSync,
3+
writeFileSync,
4+
mkdirSync,
5+
appendFileSync,
6+
} from "node:fs";
27

38
import glob from "fast-glob";
49
import { parse } from "node-html-parser";
510
import { htmlToMarkdown } from "~/util/markdown";
611

12+
import YAML from "yaml";
13+
714
const files = await glob("dist/**/*.html");
815

916
for (const file of files) {
17+
if (file === "dist/index.html" || file === "dist/404.html") {
18+
continue;
19+
}
20+
1021
const html = readFileSync(file, "utf-8");
1122
const dom = parse(html);
1223

@@ -24,9 +35,42 @@ for (const file of files) {
2435
continue;
2536
}
2637

38+
const product = file.split("/")[1];
2739
const path = file.replace("dist/", "distmd/").replace(".html", ".md");
2840

2941
mkdirSync(path.split("/").slice(0, -1).join("/"), { recursive: true });
30-
3142
writeFileSync(path, markdown);
43+
44+
const llmsFullContent = ["<page>", markdown, "</page>\n\n"].join("\n");
45+
46+
mkdirSync(`distllms/${product}`, { recursive: true });
47+
appendFileSync("distllms/llms-full.txt", llmsFullContent);
48+
appendFileSync(`distllms/${product}/llms-full.txt`, llmsFullContent);
49+
50+
try {
51+
const path = await glob(`src/content/products/${product}.*`).then((arr) =>
52+
arr.at(0),
53+
);
54+
55+
if (!path) {
56+
continue;
57+
}
58+
59+
const yaml = YAML.parse(readFileSync(path, "utf-8"));
60+
const group = yaml.product?.group?.replaceAll(" ", "-").toLowerCase();
61+
62+
if (!group) {
63+
continue;
64+
}
65+
66+
mkdirSync(`distllms/${group}`, { recursive: true });
67+
appendFileSync(`distllms/${group}/llms-full.txt`, llmsFullContent);
68+
} catch (error) {
69+
if (error instanceof Error) {
70+
console.error(
71+
`Failed to find a product group for ${product}:`,
72+
error.message,
73+
);
74+
}
75+
}
3276
}

0 commit comments

Comments
 (0)