Skip to content

Commit c7c39c8

Browse files
Merge branch 'production' into patricia/pcx17148-seq-custom-rules
2 parents 30bdffd + 068e796 commit c7c39c8

File tree

328 files changed

+1825
-1356
lines changed

Some content is hidden

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

328 files changed

+1825
-1356
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150

151151
# Docs team areas
152152

153-
/src/content/docs/docs-guide/ @dcpena @cloudflare/pcx-technical-writing
154153
/src/content/docs/style-guide/ @dcpena @cloudflare/pcx-technical-writing
155154

156155
# Google tag gateway

.github/workflows/publish-production.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,49 @@ jobs:
3333
name: Deploy to Cloudflare Workers
3434
env:
3535
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
36-
- name: Build vendored Markdown archive
36+
- name: Install rclone
37+
run: sudo -v ; curl https://rclone.org/install.sh | sudo bash
38+
- name: Build vendored Markdown
39+
run: npx tsx bin/generate-index-md.ts
40+
- name: Upload vendored Markdown archives to Vendored Markdown bucket
3741
env:
38-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
42+
AWS_ACCESS_KEY_ID: ${{ secrets.VENDORED_DEVDOCS_ACCESS_KEY_ID }}
43+
AWS_SECRET_ACCESS_KEY: ${{ secrets.VENDORED_DEVDOCS_SECRET_ACCESS_KEY }}
3944
run: |
40-
npx tsx bin/generate-index-md.ts
4145
cd distmd && zip -r markdown.zip .
42-
npx wrangler r2 object put vendored-markdown/markdown.zip --file=markdown.zip --remote
46+
rclone copy \
47+
--config ../bin/rclone.conf \
48+
./markdown.zip \
49+
devdocs:vendored-markdown
4350
rm markdown.zip
51+
cd ..
52+
53+
cd distllms
54+
for file in $(find . -type f); do
55+
rclone copy \
56+
--config ../bin/rclone.conf \
57+
$file \
58+
devdocs:vendored-markdown
59+
done
60+
cd ..
4461
- name: Upload vendored Markdown files to ZT DevDocs bucket
4562
env:
4663
AWS_ACCESS_KEY_ID: ${{ secrets.ZT_DEVDOCS_ACCESS_KEY_ID }}
4764
AWS_SECRET_ACCESS_KEY: ${{ secrets.ZT_DEVDOCS_SECRET_ACCESS_KEY }}
4865
run: |
49-
sudo -v ; curl https://rclone.org/install.sh | sudo bash
5066
rclone sync \
51-
--s3-env-auth \
52-
--s3-provider="Cloudflare" \
53-
--s3-endpoint="https://e76c849bd111ee7d3006b6625713991e.r2.cloudflarestorage.com" \
67+
--config bin/rclone.conf \
68+
distmd \
69+
zt:zt-dashboard-dev-docs
70+
- name: Upload vendored Markdown files to AutoRAG DevDocs bucket
71+
env:
72+
AWS_ACCESS_KEY_ID: ${{ secrets.AUTORAG_DEVDOCS_ACCESS_KEY_ID }}
73+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AUTORAG_DEVDOCS_SECRET_ACCESS_KEY }}
74+
run: |
75+
rclone sync \
76+
--config bin/rclone.conf \
5477
distmd \
55-
:s3:/zt-dashboard-dev-docs
78+
autorag:developer-docs-full
5679
- uses: actions/cache/save@v4
5780
if: always()
5881
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/.htmltest.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ DirectoryPath: "dist"
22
EnforceHTTPS: false
33
IgnoreURLs:
44
- "/api/*"
5-
- "#_top"
5+
- "/llms-full.txt$"
6+
IgnoreDir:
7+
- "changelog"
68
CheckLinks: true
79
CheckImages: false
810
CheckScripts: false

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
}

bin/rclone.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[devdocs]
2+
type = s3
3+
provider = Cloudflare
4+
env_auth = true
5+
endpoint = https://b54f07a6c269ecca2fa60f1ae4920c99.r2.cloudflarestorage.com
6+
acl = private
7+
8+
[zt]
9+
type = s3
10+
provider = Cloudflare
11+
env_auth = true
12+
endpoint = https://e76c849bd111ee7d3006b6625713991e.r2.cloudflarestorage.com
13+
acl = private
14+
15+
[autorag]
16+
type = s3
17+
provider = Cloudflare
18+
env_auth = true
19+
endpoint = https://cf9267a5bf4f6b3cceca48d554d81679.r2.cloudflarestorage.com
20+
acl = private

0 commit comments

Comments
 (0)