Mirror the module tree in the docs folder by default - #128
Merged
Merged
Conversation
Pages now live in folders that follow the module tree: a module's page sits next to the folder holding its sub-modules (auth.md, auth/login.md), and overview.md stays at the root. Module names stay unique across the wiki, so the module-tree key is still the page's filename stem. - doc_layout: one place that maps modules to page paths, finds pages in either layout, and after each run moves misplaced pages and rewrites links between pages to correct relative paths - prompts give each agent its page path and every module's page path; the sub-module tool reports links relative to the parent page - --flat keeps the old single-folder layout for small models - the layout is recorded in metadata.json and --update keeps it; docs without a recorded layout are treated as flat - the updater, GitHub Pages viewer, web app (now with a path traversal guard), MCP tools (doc_path in processing_order.json) and the wiki-generator skill follow the layout - '&' is no longer allowed in module names: agents shell-escape it and write pages into a stray folder Closes #125 (hierarchical output; OKF export not included)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #125 (the hierarchical output part; OKF export is not included).
What changes
Pages now live in folders that follow the module tree instead of one flat folder. A module's page sits next to the folder that holds its sub-modules, and
overview.mdstays at the root:A page never moves when sub-modules are added to it during a run. Module names stay unique across the wiki, so the
module_tree.jsonkey is still the page's filename stem and the tree format is unchanged.The flat layout was originally chosen because small models kept getting relative links wrong. Current models handle nesting, so it is now the default, and
--flatkeeps the old layout for small models.How
codewiki/src/be/doc_layout.py(new) is the one place that maps modules to page paths, finds an existing page in either layout, and runsorganize_docsafter each run. That step moves pages an agent saved in the wrong folder and rewrites links between pages to correct relative paths. It is the safety net that makes nesting safe for weaker models.metadata.json(generation_info.layout).--updatekeeps the stored layout. Passing--flatagainst nested docs warns and is ignored.DOC_PATHS) and resolves links against the current page. A link that misses its page is matched by module name.processing_order.jsonhas adoc_path.get_promptacceptsmodule_path.close_sessionruns the same cleanup and records the layout.&in module names is now replaced with_. In a real run the agent shell-escaped it and wrote pages into a strayA_\&_B/folder. This only affects newly clustered trees.Testing
tests/test_doc_layout.py(20 tests) covers:test_clustering_skip::test_over_threshold_calls_llm_and_bad_response_falls_back, which also fails onmain.tests/smoke_test_mcp.pypasses.claude-code/ Haiku on a copy ofupdater/+agent_tools/:Known gaps
README.md) inside module folders. They are not in the module tree, so the navigation doesn't list them, as in the flat layout.--updatekeeps them flat. Regenerating without--updatereuses the existing pages and moves them into folders.