Skip to content

Discord /help: searchable, self-growing knowledge base#167

Merged
alexandermayes merged 2 commits into
mainfrom
feat/discord-help-knowledge-base
Jul 4, 2026
Merged

Discord /help: searchable, self-growing knowledge base#167
alexandermayes merged 2 commits into
mainfrom
feat/discord-help-knowledge-base

Conversation

@alexandermayes

Copy link
Copy Markdown
Owner

What & why

Upgrades the /help slash command from a flat faq.md (whole-file dumped into a prompt, 5 entries) to a searchable, self-growing knowledge base shared with the in-app help center. Delivers the three asks: better search/indexing, a content audit, and retroactive article growth — all driven through the Discord bot.

How it works

lib/help-content.ts ──seed──► help_articles table ◄──rpc search + insert── discord-bot/help.js
  (curated, git)      +audit    (searchable, grows)        ├─ /help answers now
                                                           └─ novel? draft → #ops (✅/🗑️) → published
  • Search: Postgres full-text (tsvector/GIN) + pg_trgm fuzzy, hybrid-ranked in search_help_articles(). No new vendor — Anthropic-only, as before.
  • Self-growth: an answered-but-uncovered question is drafted into an article (pending_review) and posted to the ops channel; an officer approves with ✅ (→ published, searchable) or discards with 🗑️. Reuses the existing 🐛/💡 reaction-permission model.
  • Shared corpus: seeded from lib/help-content.ts (which also powers the in-app help center); approved community articles are merged back into the website via /api/help/articles.

Contents

  • supabase/migrations/20260704000001_create_help_articles.sql — table + indexes + RLS + RPC (auto-deploys on merge).
  • scripts/seed-help-articles.ts + npm run seed:help.
  • lib/help-content.ts — 16 new audit articles.
  • discord-bot/help.js (rewrite), help-review.js (new), bot.js/feedback.js/commands.js/interactions.js wiring, help.test.js (parser tests).
  • app/api/help/articles/route.ts + help-center merge.

After merge

  1. Migration auto-deploys via the deploy-migrations workflow.
  2. Run npm run seed:help (needs SUPABASE_URL + SUPABASE_SERVICE_ROLE_KEY).
  3. Restart the Railway bot (re-registers /help, loads the review handler). Ensure ANTHROPIC_API_KEY, FEEDBACK_OPS_CHANNEL_ID, FEEDBACK_REACTION_ROLE_IDS/NAMES are set.

Verification note

Authored without a local Node runtime, so lint/typecheck/test were not run locally — relying on this PR's CI. Manual review done; one template-literal escaping bug in the new articles was caught and fixed.

🤖 Generated with Claude Code

Replace the flat faq.md behind the /help slash command with a searchable,
self-growing knowledge base shared with the in-app help center.

- Migration: help_articles table (generated tsvector, GIN FTS + pg_trgm fuzzy
  indexes, RLS + published-read policy) and a hybrid search_help_articles() RPC.
- Seed: scripts/seed-help-articles.ts (npm run seed:help) imports the shared
  corpus from lib/help-content.ts (articles + glossary), upsert-on-slug.
- Content audit: 16 new high-value articles added to lib/help-content.ts
  (item classifications, submission statuses, attendance window, raid teams,
  reserves, roles, invites, transfer/delete, Discord, Gargul, addon, WCL, Bnet).
- Bot: help.js rewritten to search the RPC + known GitHub issues, answer via a
  structured Claude reply with a confidence gate, and — for novel answers —
  draft an article, store it pending_review, and post it to the ops channel.
- help-review.js: officers approve/reject drafts with reactions (reuses the
  isAllowedReactor permission model); wired as a second MessageReactionAdd
  listener in bot.js.
- Web loop: /api/help/articles + help-center merge so approved community
  articles appear on the website too.
- faq.md removed; HELP_FAQ_PATH dropped; .env.example updated; parser unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
loot-list-plus Ready Ready Preview, Comment Jul 4, 2026 4:18am

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

Load Test Results

Metric Value
Status Smoke test completed

Vitest can't be loaded via require() in a CommonJS module. Convert the
co-located help parser test from .js (require) to .mjs (import). .mjs is
unambiguously ESM for Vitest and stays out of the tsconfig include globs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

Load Test Results

Metric Value
Status Smoke test completed

@alexandermayes alexandermayes merged commit 80d603e into main Jul 4, 2026
9 checks passed
@alexandermayes alexandermayes deleted the feat/discord-help-knowledge-base branch July 4, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant