peterfei/ai-agent-team / .claude/skills/thread-manager
thread-manager
Flaggedtest-add-message.js
View on GitHub#!/usr/bin/env node
/**
* Test script for add_message functionality
* Run: node test-add-message.js
*/
const { MCPServer } = require('./dist/server.js');
const { dbManager } = require('./dist/database/db.js');
async function test() {
console.log('Starting add_message test...\n');
const server = new MCPServer(dbManager);
const threadManager = server.getThreadManager();
try {
// 1. Create a test thread
console.log('1. Creating test thread...');
const createResult = await threadManager.createThread({
title: 'Test Thread for Messages',
description: 'Testing message recording',
switchTo: true
});
console.log(`✓ Thread created: ${createResult.thread.id}\n`);
// 2. Add a user message
console.log('2. Adding user message...');
const userMessage = await threadManager.addMessageToThread(
createResult.thread.id,
'user',
'这是一条用户消息'
);
console.log(`✓ User message added: ${userMessage.id}\n`);
// 3. Add an assistant message
console.log('3. Adding assistant message...');
const assistantMessage = await threadManager.addMessageToThread(
createResult.thread.id,
'assistant',
'这是一条助手消息'
);
console.log(`✓ Assistant message added: ${assistantMessage.id}\n`);
// 4. Get thread with messages
console.log('4. Retrieving thread with messages...');
const { thread, messages } = await threadManager.getThread(
createResult.thread.id,
true // includeMessages
);
console.log(`✓ Thread retrieved:`);
console.log(` - Title: ${thread.title}`);
console.log(` - Message Count: ${thread.messageCount}`);
console.log(` - Messages retrieved: ${messages.length}\n`);
// 5. Display messages
console.log('5. Messages in thread:');
messages.forEach((msg, idx) => {
console.log(` [${idx + 1}] ${msg.role}: ${msg.content}`);
});
console.log('\n✓ All tests passed!');
} catch (error) {
console.error('✗ Test failed:', error.message);
process.exit(1);
}
}
test();
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |