Skip to content

peterfei/ai-agent-team / .claude/skills/thread-manager

thread-manager

Flagged

FileKindSize
.claude/.threads/current-context.mdmarkdown648 B
.gitignoreother76 B
.npmignoreother138 B
CHANGELOG.mdmarkdown1.1 KB
README.mdmarkdown4.7 KB
SKILL.mdskill md1.7 KB
USAGE_GUIDE.mdmarkdown6.7 KB
docs/clt-aliases.mdmarkdown2.2 KB
find-module.jsscript166 B
jest.config.jsscript1.1 KB
models/Xenova/all-MiniLM-L6-v2/config.jsonconfig650 B
models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnxother21.9 MB
models/Xenova/all-MiniLM-L6-v2/special_tokens_map.jsonconfig125 B
models/Xenova/all-MiniLM-L6-v2/tokenizer.jsonconfig695.0 KB
models/Xenova/all-MiniLM-L6-v2/tokenizer_config.jsonconfig366 B
package-lock.jsonmanifest406.8 KB
package.jsonmanifest1.1 KB
scripts/download-model.jsscript1.7 KB
scripts/migrate-embeddings.tsscript3.4 KB
src/core/embedding-service.tsscript4.3 KB
src/core/thread-manager.tsscript14.3 KB
src/core/vector-search-engine.tsscript1.2 KB
src/core/vector-utils.tsscript1.0 KB
src/database/db.tsscript4.5 KB
src/database/file-changes-dao.tsscript2.8 KB
src/database/index.tsscript121 B
src/database/messages-dao.tsscript5.1 KB
src/database/threads-dao.tsscript6.4 KB
src/git/git-integration.tsscript5.6 KB
src/index.tsscript257 B
src/server.tsscript6.1 KB
src/tools/add-message.tsscript1.5 KB
src/tools/create-thread.tsscript1.3 KB
src/tools/delete-thread.tsscript925 B
src/tools/get-current-thread.tsscript2.6 KB
src/tools/get-thread.tsscript1.2 KB
src/tools/list-threads.tsscript1.2 KB
src/tools/search-messages.tsscript4.4 KB
src/tools/switch-thread.tsscript1.4 KB
src/tools/track-file-change.tsscript1.7 KB
src/tools/update-thread.tsscript1.2 KB
src/types/index.tsscript2.6 KB
test-add-message.jsscript2.3 KB
test-output-format.jsscript546 B
tests/integration/file-tracker.test.tsscript3.3 KB
tests/integration/mcp-tools.test.tsscript5.4 KB
tests/integration/search-messages.test.tsscript5.8 KB
tests/unit/__mocks__/embedding-service.tsscript1.3 KB
tests/unit/database.test.tsscript1.6 KB
tests/unit/file-changes-dao.test.tsscript3.6 KB
tests/unit/git-integration.test.tsscript4.9 KB
tests/unit/messages-dao.test.tsscript3.9 KB
tests/unit/thread-manager.test.tsscript9.2 KB
tests/unit/threads-dao.test.tsscript6.0 KB
tests/unit/vector-search.test.tsscript3.7 KB
tsconfig.jsonconfig464 B

tests/unit/file-changes-dao.test.ts

View on GitHub
import { DatabaseManager, ThreadsDAO, FileChangesDAO } from '../../src/database';
import { FileChange } from '../../src/types';
import path from 'path';
import fs from 'fs-extra';
import { v4 as uuidv4 } from 'uuid';

describe('FileChangesDAO', () => {
  const testDir = path.join(__dirname, '../../tmp-test-db');
  let dbPath: string;
  let dbManager: DatabaseManager;
  let threadsDAO: ThreadsDAO;
  let fileChangesDAO: FileChangesDAO;
  let threadId: string;

  beforeAll(() => {
    fs.ensureDirSync(testDir);
  });

  afterAll(() => {
    // fs.removeSync(testDir); // Removed to avoid ENOTEMPTY error across test suites
  });

  beforeEach(() => {
    dbPath = path.join(testDir, `test-file-changes-${uuidv4()}.db`);
    dbManager = new DatabaseManager(dbPath);
    dbManager.init();
    threadsDAO = new ThreadsDAO(dbManager);
    fileChangesDAO = new FileChangesDAO(dbManager);

    const thread = threadsDAO.create({ title: 'Test Thread for File Changes' });
    threadId = thread.id;
  });

  afterEach(() => {
    dbManager.close();
    if (fs.existsSync(dbPath)) {
      fs.unlinkSync(dbPath);
    }
  });

  it('should create a new file change and update thread stats', () => {
    const fileChange = fileChangesDAO.create({
      threadId,
      filePath: '/src/file1.ts',
      changeType: 'added',
      linesAdded: 10,
      linesDeleted: 0
    });

    expect(fileChange).toBeDefined();
    expect(fileChange.threadId).toBe(threadId);
    expect(fileChange.filePath).toBe('/src/file1.ts');

    const fileChanges = fileChangesDAO.findByThreadId(threadId);
    expect(fileChanges.length).toBe(1);
    expect(fileChanges[0].filePath).toBe('/src/file1.ts');

    const updatedThread = threadsDAO.findById(threadId);
    expect(updatedThread?.metadata.filesChanged).toBe(1);
    expect(updatedThread?.metadata.linesAdded).toBe(10);
    expect(updatedThread?.metadata.linesDeleted).toBe(0);
  });

  it('should aggregate file change stats for a thread', () => {
    fileChangesDAO.create({ threadId, filePath: '/src/file1.ts', changeType: 'added', linesAdded: 10, linesDeleted: 0 });
    fileChangesDAO.create({ threadId, filePath: '/src/file2.ts', changeType: 'modified', linesAdded: 5, linesDeleted: 2 });
    fileChangesDAO.create({ threadId, filePath: '/src/file1.ts', changeType: 'modified', linesAdded: 3, linesDeleted: 1 }); // Same file, distinct count for filesChanged

    const updatedThread = threadsDAO.findById(threadId);
    expect(updatedThread?.metadata.filesChanged).toBe(2); // file1.ts and file2.ts
    expect(updatedThread?.metadata.linesAdded).toBe(18); // 10 + 5 + 3
    expect(updatedThread?.metadata.linesDeleted).toBe(3);  // 0 + 2 + 1
  });

  it('should find file changes by thread ID', () => {
    const change1 = fileChangesDAO.create({ threadId, filePath: 'path1', changeType: 'added', timestamp: new Date(Date.now() - 2000) });
    const change2 = fileChangesDAO.create({ threadId, filePath: 'path2', changeType: 'modified', timestamp: new Date(Date.now() - 1000) });

    const foundChanges = fileChangesDAO.findByThreadId(threadId);
    expect(foundChanges.length).toBe(2);
    // Should be sorted by timestamp DESC (newest first)
    expect(foundChanges[0].filePath).toBe('path2');
    expect(foundChanges[1].filePath).toBe('path1');
  });

  it('should handle gitCommit field', () => {
    const commitHash = 'a1b2c3d4e5f6';
    const fileChange = fileChangesDAO.create({
      threadId,
      filePath: '/src/commited.js',
      changeType: 'modified',
      linesAdded: 1,
      linesDeleted: 1,
      gitCommit: commitHash
    });

    const foundChange = fileChangesDAO.findByThreadId(threadId)[0];
    expect(foundChange.gitCommit).toBe(commitHash);
  });
});
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall