fix: resolve architecture disconnects and codebase weaknesses

- Standardize MessageRecord types — single source of truth from @bete/shared
- Clean up config: remove unused GUILD_ID/TEXT_GUILD_ID/TEXT_CHANNEL_ID, fix WEBSERVER_PORT default (3001), remove default admin password
- Move mascot_chat_messages table to Drizzle schema with proper migration
- Remove runtime DDL (CREATE TABLE IF NOT EXISTS) from mascot-chat repository
- Remove phantom analytics/ module from documentation
- Add better-sqlite3 dependency to root devDependencies
- Replace 'as any' casts with proper type assertions across AI moderation
- Add error logging to silent catch blocks in LLM client
- Apply Biome formatting and import organization

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-09 13:07:01 +07:00
co-authored by Claude Opus 4.8
parent 67d66bb5dd
commit 3614d32701
21 changed files with 206 additions and 150 deletions
@@ -0,0 +1,12 @@
-- Move mascot_chat_messages from runtime CREATE TABLE to Drizzle migration
-- Previously created at runtime by mascot-chat.repository.ts ensureSchema()
CREATE TABLE IF NOT EXISTS "mascot_chat_messages" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" text NOT NULL,
"user_message" text NOT NULL,
"mascot_response" text NOT NULL,
"context" jsonb DEFAULT '{}' NOT NULL,
"created_at" timestamptz DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "idx_mascot_chat_messages_user_created" ON "mascot_chat_messages" USING btree ("user_id", "created_at" DESC);
@@ -50,6 +50,13 @@
"when": 1780900000000,
"tag": "0006_replace_base64_with_image_url",
"breakpoints": true
},
{
"idx": 7,
"version": "7",
"when": 1781174400000,
"tag": "0007_mascot_chat_table",
"breakpoints": true
}
]
}