Skip to content

Commit ff3fafb

Browse files
committed
feat(cli): scaffold entities/ in init and count it in status
- `openkb init` now creates wiki/entities/ alongside wiki/concepts/ - init seed index.md gains ## Entities between ## Concepts and ## Explorations, matching the _update_index template in compiler.py - print_status subdirs list gains "entities" after "concepts" - Tests updated: assert wiki/entities/ exists and index.md contains ## Entities; status test asserts "entities" appears in output
1 parent 3242844 commit ff3fafb

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

openkb/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,12 @@ def init(model, language):
538538
Path("wiki/sources/images").mkdir(parents=True, exist_ok=True)
539539
Path("wiki/summaries").mkdir(parents=True, exist_ok=True)
540540
Path("wiki/concepts").mkdir(parents=True, exist_ok=True)
541+
Path("wiki/entities").mkdir(parents=True, exist_ok=True)
541542

542543
# Write wiki files
543544
Path("wiki/AGENTS.md").write_text(AGENTS_MD, encoding="utf-8")
544545
Path("wiki/index.md").write_text(
545-
"# Knowledge Base Index\n\n## Documents\n\n## Concepts\n\n## Explorations\n",
546+
"# Knowledge Base Index\n\n## Documents\n\n## Concepts\n\n## Entities\n\n## Explorations\n",
546547
encoding="utf-8",
547548
)
548549
Path("wiki/log.md").write_text("# Operations Log\n\n", encoding="utf-8")
@@ -1307,7 +1308,7 @@ def list_cmd(ctx):
13071308
def print_status(kb_dir: Path) -> None:
13081309
"""Print knowledge base status. Usable from CLI and chat REPL."""
13091310
wiki_dir = kb_dir / "wiki"
1310-
subdirs = ["sources", "summaries", "concepts", "reports"]
1311+
subdirs = ["sources", "summaries", "concepts", "entities", "reports"]
13111312

13121313
# Print the active KB path as the first line. Agents and scripts
13131314
# parse this to locate the wiki without assuming cwd == KB root.

tests/test_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_init_creates_structure(tmp_path):
2424
assert (cwd / "wiki" / "sources" / "images").is_dir()
2525
assert (cwd / "wiki" / "summaries").is_dir()
2626
assert (cwd / "wiki" / "concepts").is_dir()
27+
assert (cwd / "wiki" / "entities").is_dir()
2728
assert (cwd / ".openkb").is_dir()
2829

2930
# Files
@@ -39,7 +40,7 @@ def test_init_creates_structure(tmp_path):
3940

4041
# index.md header
4142
index_content = (cwd / "wiki" / "index.md").read_text()
42-
assert index_content == "# Knowledge Base Index\n\n## Documents\n\n## Concepts\n\n## Explorations\n"
43+
assert index_content == "# Knowledge Base Index\n\n## Documents\n\n## Concepts\n\n## Entities\n\n## Explorations\n"
4344

4445

4546
def test_init_schema_content(tmp_path):

tests/test_list_status.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def _setup_kb(tmp_path: Path) -> Path:
1717
(kb_dir / "wiki" / "sources" / "images").mkdir(parents=True)
1818
(kb_dir / "wiki" / "summaries").mkdir(parents=True)
1919
(kb_dir / "wiki" / "concepts").mkdir(parents=True)
20+
(kb_dir / "wiki" / "entities").mkdir(parents=True)
2021
(kb_dir / "wiki" / "reports").mkdir(parents=True)
2122
openkb_dir = kb_dir / ".openkb"
2223
openkb_dir.mkdir()
@@ -111,6 +112,7 @@ def test_status_shows_directory_counts(self, tmp_path):
111112
assert "sources" in result.output
112113
assert "summaries" in result.output
113114
assert "concepts" in result.output
115+
assert "entities" in result.output
114116
assert "reports" in result.output
115117

116118
def test_status_shows_total_indexed(self, tmp_path):

0 commit comments

Comments
 (0)