Blame
|
1 | --- |
||||||
| 2 | category: dev |
|||||||
| 3 | tags: [phase-2, templates, bootstrap] |
|||||||
| 4 | last_updated: 2026-03-13 |
|||||||
| 5 | confidence: high |
|||||||
| 6 | --- |
|||||||
| 7 | ||||||||
| 8 | # P2-6 Wiki Bootstrap Template — Summary |
|||||||
| 9 | ||||||||
| 10 | ## Status: Complete |
|||||||
| 11 | ||||||||
| 12 | Branch: `feat/P2-6-bootstrap-template` in `wikibot-io` repo. Not pushed. |
|||||||
| 13 | ||||||||
| 14 | ## Acceptance Criteria |
|||||||
| 15 | ||||||||
| 16 | | Criterion | Status | |
|||||||
| 17 | |---|---| |
|||||||
| 18 | | Template renders correctly with wiki name and purpose substituted | Pass | |
|||||||
| 19 | | Wiki Usage Guide covers all 12 MCP tools, session protocol, frontmatter schema, WikiLink syntax, page size guidance, gardening | Pass | |
|||||||
| 20 | | Page Template shows correct frontmatter format | Pass | |
|||||||
| 21 | | Default category set matches PRD (actor, event, trend, hypothesis, variable, reference, index) | Pass | |
|||||||
| 22 | | Template is generic — no Third Gulf War specific content | Pass | |
|||||||
| 23 | ||||||||
| 24 | ## Files Changed |
|||||||
| 25 | ||||||||
| 26 | - `app/management/__init__.py` — Package init |
|||||||
| 27 | - `app/management/template.py` — Template engine (render_template, render_all, format helpers) |
|||||||
| 28 | - `app/templates/wiki/Home.md` — Parameterized landing page with category sections and Meta links |
|||||||
| 29 | - `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 |
|||||||
| 30 | - `app/templates/wiki/Meta/Page Template.md` — Reference page with frontmatter format, example page, category-specific conventions |
|||||||
| 31 | - `tests/test_bootstrap_template.py` — 27 unit tests |
|||||||
| 32 | ||||||||
| 33 | ## Design Decisions |
|||||||
| 34 | ||||||||
| 35 | 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). |
|||||||
| 36 | ||||||||
| 37 | 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). |
|||||||
| 38 | ||||||||
| 39 | 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. |
|||||||
| 40 | ||||||||
| 41 | 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. |
|||||||
| 42 | ||||||||
| 43 | 5. **`today` parameter defaults to `date.today().isoformat()`** but can be overridden for deterministic testing. |
|||||||
| 44 | ||||||||
| 45 | 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. |
|||||||
| 46 | ||||||||
| 47 | ## Test Results |
|||||||
| 48 | ||||||||
| 49 | 27 tests, all passing. Test classes: |
|||||||
| 50 | ||||||||
| 51 | - **TestFormatHelpers** (4) — category list formatting, enum formatting, directory list with index exclusion and pluralization |
|||||||
| 52 | - **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 |
|||||||
| 53 | - **TestRenderWithCustomCategories** (3) — custom category set flows through to usage guide, page template enum, and directory list |
|||||||
| 54 | - **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 |
|||||||