MCPcopy Create free account
hub / github.com/chokcoco/iCSS / DebugTester

Class DebugTester

MCP/debug.js:8–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6console.log('🔍 MCP Server Debug Tool\n');
7
8class DebugTester {
9 constructor() {
10 this.db = null;
11 this.searchEngine = null;
12 this.isReady = false;
13 }
14
15 async init() {
16 return new Promise((resolve, reject) => {
17 console.log('📂 Connecting to database...');
18
19 this.db = new Database.Database('./data/icss.db', (err) => {
20 if (err) {
21 console.error('❌ Database connection failed:', err.message);
22 reject(err);
23 return;
24 }
25
26 console.log('✅ Database connected');
27 this.loadSearchIndex().then(resolve).catch(reject);
28 });
29 });
30 }
31
32 async loadSearchIndex() {
33 return new Promise((resolve, reject) => {
34 console.log('🔄 Loading search index...');
35
36 this.db.all('SELECT * FROM issues', (err, rows) => {
37 if (err) {
38 console.error('❌ Failed to load search index:', err.message);
39 reject(err);
40 return;
41 }
42
43 console.log(`📊 Loaded ${rows.length} articles`);
44
45 const fuseOptions = {
46 keys: [
47 { name: 'title', weight: 0.4 },
48 { name: 'search_content', weight: 0.4 },
49 { name: 'labels', weight: 0.2 }
50 ],
51 threshold: 0.3,
52 includeScore: true,
53 includeMatches: true
54 };
55
56 this.searchEngine = new Fuse(rows, fuseOptions);
57 this.isReady = true;
58 console.log('✅ Search index ready');
59 resolve();
60 });
61 });
62 }
63
64 async testSearchFunction(query = "透明 边框") {
65 console.log(`\n🔍 Testing search for: "${query}"`);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected