diff --git a/PLAN.md b/PLAN.md index 7d55772..3dc41a9 100644 --- a/PLAN.md +++ b/PLAN.md @@ -413,7 +413,7 @@ Integrated into the fight viewer: - [x] Fight schedule / card system - [x] Commentary engine - [x] Achievement system -- [ ] API docs page +- [x] API docs page ### Phase 4: Go Live - [ ] Docker containerization diff --git a/frontend/src/components/NavBar.vue b/frontend/src/components/NavBar.vue index 6c6a8e1..9df2e4e 100644 --- a/frontend/src/components/NavBar.vue +++ b/frontend/src/components/NavBar.vue @@ -11,6 +11,7 @@ const links = [ { to: '/join', label: 'FIGHT!' }, { to: '/arena', label: 'WATCH' }, { to: '/leaderboard', label: 'RANKINGS' }, + { to: '/docs', label: 'DOCS' }, ] diff --git a/frontend/src/pages/DocsPage.vue b/frontend/src/pages/DocsPage.vue new file mode 100644 index 0000000..6d8c995 --- /dev/null +++ b/frontend/src/pages/DocsPage.vue @@ -0,0 +1,262 @@ + + + + + + + + + API DOCS + + + How to build a fighter. Webhook spec, scoring, and tips. + + + + + {{ error }} + + + + + + + {{ tab }} + + + + + + + {{ docs.overview }} + + + + + + REQUEST (POST to your webhook) + + + + {{ key }} + {{ field.type }} + {{ field.description }} + + + + Example + {{ JSON.stringify(docs.webhook_request.example, null, 2) }} + + + + + + + RESPONSE (your bot returns) + + + + {{ key }} + {{ field.type }} + {{ field.description }} + (optional) + + + + Example + {{ JSON.stringify(docs.webhook_response.example, null, 2) }} + + + + + + + FAILURE MODES + + + + {{ mode }} + {{ desc }} + + + + + + + + + + FACTUAL CHALLENGES + + + {{ docs.scoring.factual_challenges.description }} + + + + Answer Matching + + + {{ rule }} + + + + + Scoring + + + {{ rule }} + + + + + + + + + CREATIVE CHALLENGES + + + {{ docs.scoring.creative_challenges.description }} + + + + {{ rule }} + + + + + + + + + + FACTUAL ({{ docs.challenge_types.factual.length }}) + + + + {{ ct.type }} + {{ ct.timeout_ms }}ms + {{ ct.description }} + + + + + + + CREATIVE ({{ docs.challenge_types.creative.length }}) + + + + {{ ct.type }} + {{ ct.timeout_ms }}ms + {{ ct.description }} + + + + + + + + + + {{ (test as any).method }} {{ (test as any).path }} + + + {{ (test as any).description }} + + + + + + + TIPS + + + + {{ tip }} + + + + + + + + + diff --git a/frontend/src/router.ts b/frontend/src/router.ts index cf8c309..aa5fc31 100644 --- a/frontend/src/router.ts +++ b/frontend/src/router.ts @@ -51,6 +51,11 @@ const routes = [ name: 'sprites', component: () => import('./pages/SpritePreviewPage.vue'), }, + { + path: '/docs', + name: 'docs', + component: () => import('./pages/DocsPage.vue'), + }, ] export const router = createRouter({
+ How to build a fighter. Webhook spec, scoring, and tips. +
+ {{ docs.overview }} +
Example
{{ JSON.stringify(docs.webhook_request.example, null, 2) }}
{{ JSON.stringify(docs.webhook_response.example, null, 2) }}
+ {{ docs.scoring.factual_challenges.description }} +
Answer Matching
Scoring
+ {{ docs.scoring.creative_challenges.description }} +
+ {{ (test as any).description }} +