A Progressive Web App for interacting with the NITC Wiki through AI chat, search, and direct editing — a fully static, client-side app. There is no backend: everything runs in your browser.
- AI Chat — Ask questions in natural language. The AI has 15 tools to read, search, and edit the wiki.
- Wiki Reader — Search and browse wiki pages in a mobile-optimized view.
- Write support — Create, edit, delete, and rename pages through AI using BotPasswords login.
- Installable — Add to home screen.
The app is served from its own Pages domain, so every authenticated MediaWiki call is
cross-origin. Writes do not work until these are applied in the wiki's
LocalSettings.php:
$wgCrossSiteAJAXdomainsmust include the Pages origin(s):Status: NOT configured (verified 2026-08-23 — every external origin gets$wgCrossSiteAJAXdomains = [ 'nitc-wiki.pages.dev', // production domain (adjust to actual) '*.nitc-wiki.pages.dev', // preview deployments, if desired ];
mediawiki-cors-rejection: Origin mismatchfrom api.php).$wgCookieSameSite = 'None';— without this the login session cookie is not sent on cross-originfetchcalls. Status: NOT configured (verified 2026-08-23 — session cookie is set without anySameSiteattribute, so browsers default to Lax).- HTTPS-only wiki (
$wgForceHTTPS) — required forSameSite=Nonecookies to be honored. Status: satisfied (wiki serves HTTPS-only; session cookie already carriesSecure).
Reads are unaffected: they use JSONP and need no server config.
The PWA exposes the following tools to the AI model via OpenAI-compatible function calling:
| Tool | Description |
|---|---|
wiki_search |
Full-text search across wiki pages |
get_page |
Rendered text content of a page |
get_page_wikitext |
Raw wikitext with templates and tables |
get_page_history |
Revision history with editors and timestamps |
get_links_here |
Pages that link to a given page |
get_recent_changes |
Recent edits across the entire wiki |
get_site_info |
Wiki metadata, statistics, and extensions |
get_file_info |
File metadata (images, PDFs, etc.) |
parse_wikitext |
Preview wikitext as rendered HTML |
cargo_query |
Query structured Cargo database tables |
list_category |
List pages in a wiki category |
| Tool | Description |
|---|---|
edit_page |
Update an existing wiki page |
create_page |
Create a new wiki page |
delete_page |
Delete a wiki page |
move_page |
Rename a wiki page |
- Open the hosted PWA
- Tap Settings and enter your AI API credentials:
- API Base URL — any CORS-enabled OpenAI-compatible endpoint (e.g.
https://openrouter.ai/api/v1,https://api.groq.com/openai/v1) - API Key — your key for that provider
- Model — any model ID
- API Base URL — any CORS-enabled OpenAI-compatible endpoint (e.g.
- Start asking questions!
- (Optional) Set bot credentials in Settings to enable editing
Note: providers that block browser CORS requests (e.g. NVIDIA NIM) cannot be used — there is no relay anymore. OpenRouter, Groq, and local Ollama work directly.
Run a model locally and point the PWA at it:
ollama pull gemma4:e4b # 10 GB — decent function calling
ollama pull llama3.2:3b # 2 GB — lightweight
ollama pull qwen2.5:7b # 4.7 GB — good general purposeThen set API Base URL to http://localhost:11434/v1, turn Ollama Mode ON, and set the model name.
npm install
npm run dev # local dev server
npm run build # static output in dist/
npx wrangler pages deploy dist # or connect the repo in the Cloudflare dashboard:
# Framework: Vite → build `npm run build`, output `dist`The PWA is a static site (Vite + hono/jsx/dom). Everything runs client-side:
- Reads: JSONP (
format=json&callback=fn) against the MediaWiki API — works from any origin, no CORS needed - Writes: real MediaWiki CORS flow — login token →
action=loginwith BotPasswords → CSRF token → write action, all withorigin=<app origin>andcredentials: 'include'(requires the wiki-side config above) - AI: streaming chat completions straight from the browser to the provider; your API key stays in
localStorage - Tool loop: the model calls tools, the browser executes them, results are fed back — no server involved
/ # repo root = app root
├── index.html # Vite entry
├── package.json
├── vite.config.ts # esbuild jsxImportSource: hono/jsx/dom
├── public/
│ ├── manifest.json # PWA manifest (scope/start_url = "/")
│ └── icons/ # App icons
└── src/
├── main.tsx # render(<App/>, #root)
├── app.tsx # hash router + nav (chat / reader / settings)
├── style.css # Mobile-first dark-mode styles
├── lib/
│ ├── wiki-api.ts # MediaWiki client: JSONP reads, CORS login/write flow
│ ├── ai-orchestrator.ts # Streaming function-calling loop, 15 tools
│ ├── settings.ts # localStorage-backed settings
│ └── ui.ts # Toast, theme, hash-param helpers
└── components/
├── Chat.tsx # Chat UI with incremental streaming + tool results
├── Reader.tsx # Wiki reader view
└── Settings.tsx # Settings form
- Vite + TypeScript — bundler/build
- hono/jsx/dom — UI runtime (hooks from
hono/jsx,renderfromhono/jsx/dom) - Marked.js (bundled) — markdown rendering
- MediaWiki API — JSONP for reads, authenticated CORS for writes
- OpenAI-compatible API — any CORS-enabled provider that speaks the chat completions format