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

Function add_docs_version

lib/devtools/src/crewai_devtools/cli.py:387–420  ·  view source on GitHub ↗

Freeze Edge into a new snapshot and register the version in docs.json. Thin compatibility wrapper around :func:`crewai_devtools.docs_versioning.freeze`. Materialises ``docs/v /`` from ``docs/edge/`` (copies files, rewrites ``openapi:`` refs inside the snapshot), inserts a new ``

(docs_json_path: Path, version: str)

Source from the content-addressed store, hash-verified

385
386
387def add_docs_version(docs_json_path: Path, version: str) -> bool:
388 """Freeze Edge into a new snapshot and register the version in docs.json.
389
390 Thin compatibility wrapper around :func:`crewai_devtools.docs_versioning.freeze`.
391 Materialises ``docs/v<version>/`` from ``docs/edge/`` (copies files, rewrites
392 ``openapi:`` refs inside the snapshot), inserts a new ``vX.Y.Z`` entry into
393 every language&#x27;s ``versions[]`` block just after Edge, marks it
394 default + ``Latest`` (demoting the prior default), and updates the wildcard
395 ``/<lang>/:slug*`` redirects to point at the new version.
396
397 Skipped (returns False) for pre-release versions like ``1.10.1b1`` since
398 those don&#x27;t get their own snapshot — pre-release docs stay on Edge.
399
400 Args:
401 docs_json_path: Path to docs/docs.json.
402 version: Version string (e.g., ``"1.10.1"``). Pre-releases are skipped.
403
404 Returns:
405 True if docs.json was updated, False otherwise (missing file, missing
406 Edge sources, pre-release, or snapshot already up to date).
407 """
408 if not docs_json_path.exists():
409 return False
410 if _is_prerelease(version):
411 return False
412
413 docs_root = docs_json_path.parent
414 try:
415 result = freeze_docs(version, docs_root)
416 except (InvalidVersionError, MissingEdgeSourcesError) as e:
417 console.print(f"[yellow]Warning:[/yellow] {e}")
418 return False
419
420 return result.docsjson_entries_inserted > 0 or result.redirects_upserted > 0
421
422
423ChangelogLang = Literal["en", "pt-BR", "ko", "ar"]

Callers 1

Calls 2

_is_prereleaseFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected