MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _build_docs_root

Function _build_docs_root

lib/devtools/tests/test_docs_versioning.py:16–98  ·  view source on GitHub ↗

Build a minimal docs/ tree with one previous snapshot + Edge + docs.json. The shape mirrors the real repo: an Edge directory with per-locale folders and YAMLs, one previously-frozen v1.14.7 snapshot, and a docs.json with Edge + the previous default in the version selector plus canonical

(tmp_path: Path)

Source from the content-addressed store, hash-verified

14
15
16def _build_docs_root(tmp_path: Path) -> Path:
17 """Build a minimal docs/ tree with one previous snapshot + Edge + docs.json.
18
19 The shape mirrors the real repo: an Edge directory with per-locale folders
20 and YAMLs, one previously-frozen v1.14.7 snapshot, and a docs.json with
21 Edge + the previous default in the version selector plus canonical-URL
22 wildcard redirects.
23 """
24 docs = tmp_path / "docs"
25
26 # Edge sources (what the release will freeze).
27 edge_en = docs / "edge" / "en"
28 edge_en.mkdir(parents=True)
29 (edge_en / "introduction.mdx").write_text("# Intro (Edge)\n")
30 (edge_en / "changelog.mdx").write_text("---\ntitle: Changelog\n---\n")
31 (edge_en / "api.mdx").write_text(
32 '---\nopenapi: "/enterprise-api.en.yaml GET /foo"\n---\n'
33 )
34 # A page added to Edge after the previous release. It exists as a file and
35 # is wired into the Edge nav, but is intentionally absent from the v1.14.7
36 # nav below — the freeze must still surface it in the new version.
37 (edge_en / "datadog.mdx").write_text("# Datadog (Edge)\n")
38 (docs / "edge" / "enterprise-api.en.yaml").write_text("openapi: 3.0.0\n")
39
40 # A pre-existing frozen snapshot to clone the nav structure from.
41 snap_en = docs / "v1.14.7" / "en"
42 snap_en.mkdir(parents=True)
43 (snap_en / "introduction.mdx").write_text("# Intro (1.14.7)\n")
44 (snap_en / "changelog.mdx").write_text("---\ntitle: Changelog\n---\n")
45 (snap_en / "api.mdx").write_text(
46 '---\nopenapi: "/v1.14.7/enterprise-api.en.yaml GET /foo"\n---\n'
47 )
48
49 docs_json = {
50 "navigation": {
51 "languages": [
52 {
53 "language": "en",
54 "versions": [
55 {
56 "version": "Edge",
57 "tag": "Edge",
58 "tabs": [
59 {
60 "tab": "Guides",
61 "pages": [
62 "edge/en/introduction",
63 "edge/en/changelog",
64 "edge/en/api",
65 "edge/en/datadog",
66 ],
67 }
68 ],
69 },
70 {
71 "version": "v1.14.7",
72 "default": True,
73 "tag": "Latest",

Calls

no outgoing calls

Tested by

no test coverage detected