Modernize public documentation
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"""Regression tests for user-facing documentation embedded in the web app."""
|
||||
|
||||
from cmdforge.web.docs_content import get_doc
|
||||
import re
|
||||
|
||||
from cmdforge.web.docs_content import DOCS, get_doc, get_toc
|
||||
|
||||
|
||||
def test_getting_started_documents_agent_first_workflow():
|
||||
@@ -24,3 +26,87 @@ def test_first_tool_explains_project_ownership():
|
||||
|
||||
assert "cmdforge create explain --project" in content
|
||||
assert "./.cmdforge/" in content
|
||||
|
||||
|
||||
def test_every_document_appears_once_in_the_book_navigation():
|
||||
slugs = []
|
||||
for chapter in get_toc():
|
||||
slugs.append(chapter.slug)
|
||||
slugs.extend(page.slug for page in chapter.children)
|
||||
|
||||
assert len(slugs) == len(set(slugs))
|
||||
assert set(slugs) == set(DOCS)
|
||||
|
||||
|
||||
def test_internal_documentation_links_resolve():
|
||||
links = set()
|
||||
for page in DOCS.values():
|
||||
links.update(re.findall(r'href="/docs/([^"#?]+)', page["content"]))
|
||||
|
||||
assert links <= set(DOCS)
|
||||
|
||||
|
||||
def test_modern_architecture_has_dedicated_chapters():
|
||||
expected = {
|
||||
"mcp-overview",
|
||||
"mcp-client",
|
||||
"mcp-server",
|
||||
"agent-integration",
|
||||
"contracts-quality",
|
||||
"provider-policy",
|
||||
"skills-delegation",
|
||||
"optimization-usage",
|
||||
"forge-tool",
|
||||
"trust-publishing",
|
||||
}
|
||||
assert expected <= set(DOCS)
|
||||
|
||||
|
||||
def test_mcp_documentation_covers_both_directions_and_transports():
|
||||
content = " ".join(
|
||||
get_doc(slug)["content"]
|
||||
for slug in ("mcp-overview", "mcp-client", "mcp-server")
|
||||
)
|
||||
|
||||
for term in (
|
||||
"type: mcp",
|
||||
"transport: stdio",
|
||||
"transport: streamable-http",
|
||||
"result_mode",
|
||||
"cmdforge mcp connect",
|
||||
"cmdforge mcp serve",
|
||||
"expose",
|
||||
"deny",
|
||||
):
|
||||
assert term in content
|
||||
|
||||
|
||||
def test_provider_documentation_covers_strict_execution_contract():
|
||||
content = get_doc("providers")["content"] + get_doc("provider-policy")["content"]
|
||||
|
||||
for term in (
|
||||
"subprocess",
|
||||
"API",
|
||||
"PTY",
|
||||
"--no-fallback",
|
||||
"--require-local",
|
||||
"--require-capability",
|
||||
"--data-classification",
|
||||
"--require-model-identity",
|
||||
"--require-model-digest",
|
||||
"--result-envelope json",
|
||||
):
|
||||
assert term in content
|
||||
|
||||
|
||||
def test_command_atlas_covers_every_top_level_cli_family():
|
||||
content = get_doc("cli-reference")["content"]
|
||||
commands = (
|
||||
"list", "create", "edit", "delete", "test", "run", "run-once", "ui",
|
||||
"refresh", "docs", "inspect", "optimize", "check", "providers", "registry",
|
||||
"collections", "deps", "install", "lock", "verify", "add", "remove", "init",
|
||||
"config", "settings", "system-deps", "mcp", "usage",
|
||||
)
|
||||
|
||||
for command in commands:
|
||||
assert f"cmdforge {command}" in content
|
||||
|
||||
Reference in New Issue
Block a user