--- 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 init - `app/management/template.py` — Template engine (render_template, render_all, format helpers) - `app/templates/wiki/Home.md` — Parameterized landing page with category sections and Meta links - `app/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 table - `app/templates/wiki/Meta/Page Template.md` — Reference page with frontmatter format, example page, category-specific conventions - `tests/test_bootstrap_template.py` — 27 unit tests ## Design Decisions 1. **Python string.Template, not Jinja2.** Task spec called for simplicity. `string.Template` uses `${var}` syntax and `safe_substitute` (leaves unrecognized variables as-is rather than erroring). 2. **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). 3. **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. 4. **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. 5. **`today` parameter defaults to `date.today().isoformat()`** but can be overridden for deterministic testing. 6. **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