Properties
category: dev tags: [phase-2, templates, bootstrap] last_updated: 2026-03-13 confidence: high
P2-6 Wiki Bootstrap Template — Summary
Status: Complete
Branch: feat/P2-6-bootstrap-template in wikibot-io repo. Not pushed.
Acceptance Criteria
| Criterion | Status |
|---|---|
| Template renders correctly with wiki name and purpose substituted | Pass |
| Wiki Usage Guide covers all 12 MCP tools, session protocol, frontmatter schema, WikiLink syntax, page size guidance, gardening | Pass |
| Page Template shows correct frontmatter format | Pass |
| Default category set matches PRD (actor, event, trend, hypothesis, variable, reference, index) | Pass |
| Template is generic — no Third Gulf War specific content | Pass |
Files Changed
app/management/__init__.py— Package initapp/management/template.py— Template engine (render_template, render_all, format helpers)app/templates/wiki/Home.md— Parameterized landing page with category sections and Meta linksapp/templates/wiki/Meta/Wiki Usage Guide.md— Full tool reference, session protocol, frontmatter schema, WikiLink syntax, page size guidance, source citations, gardening protocol, quick reference tableapp/templates/wiki/Meta/Page Template.md— Reference page with frontmatter format, example page, category-specific conventionstests/test_bootstrap_template.py— 27 unit tests
Design Decisions
Python string.Template, not Jinja2. Task spec called for simplicity.
string.Templateuses${var}syntax andsafe_substitute(leaves unrecognized variables as-is rather than erroring).Five substitution variables:
wiki_name,wiki_purpose,today,category_enum(pipe-delimited),category_list(markdown bullet list with descriptions),category_directories(directory tree for page organization).Categories as list of (name, description) tuples. Allows custom categories to flow through to all templates — the enum, the definition list, and the directory tree are all derived from the same source data.
Naive pluralization for directory names with special cases for "hypothesis" -> "Hypotheses" and "reference" -> "References". "index" is excluded from directory listing since the Home page lives at the root.
todayparameter defaults todate.today().isoformat()but can be overridden for deterministic testing.Wiki Usage Guide modeled on the Third Gulf War research wiki's guide but stripped of all domain-specific content. Covers the same sections: tool reference (12 tools), session protocol, frontmatter schema, category definitions, WikiLink syntax, page size guidance, source citations, gardening, and quick reference table.
Test Results
27 tests, all passing. Test classes:
- TestFormatHelpers (4) — category list formatting, enum formatting, directory list with index exclusion and pluralization
- TestRenderTemplate (14) — individual template rendering: name/date/purpose substitution, meta links, all 12 MCP tools present, session protocol, frontmatter schema, WikiLink syntax, page size guidance, gardening, category definitions
- TestRenderWithCustomCategories (3) — custom category set flows through to usage guide, page template enum, and directory list
- TestRenderAll (6) — returns 3 pages, wiki name in all pages, no unsubstituted
${...}variables, default categories match PRD, no domain-specific content (checks for "Third Gulf War", "Iran", "Trump", "IRGC", "interceptor", "Hormuz", "TACO", "Schuyler"), default date behavior