-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtest_feature_guide_docs.py
More file actions
83 lines (59 loc) · 2.6 KB
/
Copy pathtest_feature_guide_docs.py
File metadata and controls
83 lines (59 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
FEATURES = ROOT / "docs" / "features.md"
COMMANDS = ROOT / "docs" / "commands.md"
README = ROOT / "README.md"
INTERACTIVE_TUI = ROOT / "docs" / "interactive-tui.md"
INTERACTIVE_COMMAND_SOURCE = ROOT / "koder_agent" / "harness" / "commands" / "interactive.py"
TOPIC_GUIDES = [
"docs/getting-started.md",
"docs/interactive-tui.md",
"docs/configuration.md",
"docs/sessions-and-memory.md",
"docs/agents-and-teams.md",
"docs/workflows.md",
"docs/extensions.md",
"docs/permissions-and-privacy.md",
"docs/hooks.md",
"docs/voice-mode.md",
"docs/commands.md",
]
def _read_user_docs() -> str:
paths = [README, FEATURES, *(ROOT / path for path in TOPIC_GUIDES)]
return "\n".join(path.read_text(encoding="utf-8") for path in paths)
def test_readme_links_main_user_docs():
text = README.read_text(encoding="utf-8")
for relative_path in TOPIC_GUIDES:
link = relative_path.removeprefix("docs/")
if relative_path.startswith("docs/"):
assert f"({relative_path})" in text or f"({link})" in text
def test_feature_guide_links_topic_docs():
text = FEATURES.read_text(encoding="utf-8")
for relative_path in TOPIC_GUIDES:
link = relative_path.removeprefix("docs/")
assert f"]({link})" in text
def test_user_docs_do_not_link_internal_tmux_validation_design():
text = _read_user_docs()
internal_doc_slug = "tmux" + "-validation-design"
internal_doc_title = "Tmux Feature" + " Validation Design"
assert internal_doc_slug not in text
assert internal_doc_title not in text
assert "/".join(("docs", "audit")) not in text
def test_command_reference_has_no_generic_execute_descriptions():
text = COMMANDS.read_text(encoding="utf-8")
assert "| Execute /" not in text
def test_command_reference_has_no_test_fixture_wording():
"""Fixture vocabulary belongs in the scenario manifest, not user docs."""
import re
text = COMMANDS.read_text(encoding="utf-8")
fixture_terms = re.compile(r"\b(stub|stubbed|fake|fixture)\b", re.IGNORECASE)
for line in text.splitlines():
if line.startswith("|"):
assert not fixture_terms.search(line), line
def test_multiline_shortcuts_name_shift_enter_and_fallbacks():
guide = INTERACTIVE_TUI.read_text(encoding="utf-8")
command_source = INTERACTIVE_COMMAND_SOURCE.read_text(encoding="utf-8")
assert "`Shift+Enter` (`Ctrl+J` or `Alt+Enter` fallback)" in guide
assert "Shift+Enter" in command_source
assert "Ctrl+J/Alt+Enter" in command_source