Restructure chat service, web routes, and add test suite
Split monolithic chat service into modular structure with Matrix client support, extract web server into per-resource route modules, introduce bootstrap/main-loop separation, and add comprehensive vitest coverage across services, repositories, and utilities. Adds project docs and CLAUDE.md agent instructions.
This commit is contained in:
1 parent
dfa0580859
commit
633bb0ec04
84 files changed
+19278
-3888
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { Router } from 'express';
|
||||
import type { WebContext } from '../context.js';
|
||||
|
||||
export function createDebugRouter(ctx: WebContext): Router {
|
||||
const router = Router();
|
||||
|
||||
router.post('/debug/inspect-dom', async (req, res) => {
|
||||
if (!ctx.services.chat) {
|
||||
res.status(500).json({ error: 'Chat service not initialized' });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const chatUrl = req.body?.url;
|
||||
if (!chatUrl) {
|
||||
res.status(400).json({ error: 'url is required' });
|
||||
return;
|
||||
}
|
||||
const result = await ctx.services.chat.debugInspectDom(chatUrl);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
ctx.logger.error('DOM inspection failed:', error);
|
||||
res.status(500).json({ error: String(error) });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/debug/check-responses', async (_req, res) => {
|
||||
if (!ctx.services.responseChecker) {
|
||||
res.status(500).json({ error: 'Response checker not initialized' });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ctx.logger.info('Manual response check triggered via API');
|
||||
const results = await ctx.services.responseChecker.checkForResponses();
|
||||
res.json({ success: true, results });
|
||||
} catch (error) {
|
||||
ctx.logger.error('Manual response check failed:', error);
|
||||
res.status(500).json({ error: String(error) });
|
||||
}
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
||||
Reference in new issue
Block a user