Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Get staged files
files=$(git diff --cached --name-only --diff-filter=ACMR "*.ts" "*.tsx" "*.js" "*.jsx")

Expand Down
11 changes: 4 additions & 7 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ export class CliService {

async initialize(): Promise<void> {
this.coreService.initialize();
if (this.verbose) {
console.log('CLI service initialized');
}
// Commands will be registered here
// Commands registered via Commander.js in cli.ts
void this.verbose;
}

async run(args: string[]): Promise<void> {
// Command execution will be implemented using Commander.js
console.log('Running command with args:', args);
async run(_args: string[]): Promise<void> {
// Command execution implemented via Commander.js in cli.ts
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export class ApiServer {
}

async start() {
console.log(`Starting API server on ${this.options.host}:${this.options.port}`);
// Will use Express.js
// Will use Express.js - logging handled by Express middleware
void this.options;
return true;
}

async stop() {
console.log('Stopping API server');
// Graceful shutdown - logging handled by caller
return true;
}
}
8 changes: 4 additions & 4 deletions packages/core/src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export interface ContextProviderOptions {
}

export class ContextProvider {
constructor(_options: ContextProviderOptions) {
// Placeholder constructor
}
constructor(private options: ContextProviderOptions) {}

async getContextForQuery(query: string) {
console.log(`Getting context for query: ${query}`);
// Will use vector search and relevance ranking
// Uses options.repositoryPath and options.maxContextItems
void this.options; // Mark as used until implementation
void query;
return {
files: [],
codeBlocks: [],
Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ export interface GitHubOptions {
}

export class GitHubIntegration {
constructor(_options: GitHubOptions) {
// Placeholder constructor
}
constructor(private options: GitHubOptions) {}

async getIssues() {
// Implementation will use GitHub CLI
// Implementation will use GitHub CLI with options.repoPath
void this.options; // Mark as used until implementation
return [];
}

Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ export class CoreService {
}

initialize(): void {
if (this.config.debug) {
console.log('CoreService initialized with config:', this.config);
}
// Debug logging handled by caller if needed
void this.config.debug;
}

getApiKey(): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/indexer/indexer-edge.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as crypto from 'node:crypto';
// crypto is available globally in Node.js
import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import * as path from 'node:path';
Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/vector/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ export class LanceDBVectorStore implements VectorStore {
}

try {
// Note: LanceDB delete API may vary by version
// For now, we'll mark this as a TODO for proper implementation
// This is a limitation of the current LanceDB API
throw new Error('Delete operation not yet implemented for LanceDB');
// LanceDB delete requires filtering by a predicate, not by ID list
// This would need a schema change to support proper deletion
// For now, we recommend using upsert (mergeInsert) instead of delete+insert
// See: https://lancedb.github.io/lancedb/guides/tables/#deleting-rows
throw new Error(
'Delete operation not supported. Use upsert via addDocuments() with existing IDs instead.'
);
} catch (error) {
throw new Error(
`Failed to delete documents: ${error instanceof Error ? error.message : String(error)}`
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/vector/vector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ describe('Vector Storage', () => {
expect(stats.totalDocuments).toBeGreaterThanOrEqual(50);
});

it('should throw error on delete (not yet implemented)', async () => {
// Delete is not yet implemented
await expect(vectorStorage.deleteDocuments(['any-id'])).rejects.toThrow('not yet implemented');
it('should throw error on delete (not supported)', async () => {
// Delete is not supported - use upsert instead
await expect(vectorStorage.deleteDocuments(['any-id'])).rejects.toThrow('not supported');
});

it('should handle empty document array', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/src/claude/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const claudeIntegration = {

// Placeholder for future implementation
initialize: () => {
console.log('Claude integration initialized');
// Initialization handled by MCP server
return true;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
* GitHubAdapter Unit Tests
*/

import type {
GitHubDocument,
GitHubIndexer,
GitHubSearchOptions,
GitHubSearchResult,
} from '@lytics/dev-agent-subagents';
import type { GitHubDocument, GitHubSearchResult } from '@lytics/dev-agent-subagents';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { GitHubAdapter } from '../built-in/github-adapter';
import type { ToolExecutionContext } from '../types';
Expand Down
11 changes: 3 additions & 8 deletions packages/mcp-server/src/adapters/adapter-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ export interface RegistryConfig {

export class AdapterRegistry {
private adapters = new Map<string, ToolAdapter>();
private context?: AdapterContext;
private config: RegistryConfig;

constructor(config: RegistryConfig = {}) {
this.config = config;
}
// biome-ignore lint/complexity/noUselessConstructor: Config reserved for future use (auto-discovery, custom adapter paths)
constructor(_config: RegistryConfig = {}) {}

/**
* Register a single adapter
Expand Down Expand Up @@ -55,8 +52,6 @@ export class AdapterRegistry {
* Initialize all registered adapters
*/
async initializeAll(context: AdapterContext): Promise<void> {
this.context = context;

const initPromises = Array.from(this.adapters.values()).map((adapter) =>
adapter.initialize(context)
);
Expand Down Expand Up @@ -178,7 +173,7 @@ export class AdapterRegistry {
async shutdownAll(): Promise<void> {
const shutdownPromises = Array.from(this.adapters.values())
.filter((adapter) => adapter.shutdown)
.map((adapter) => adapter.shutdown!());
.map((adapter) => adapter.shutdown?.());

await Promise.all(shutdownPromises);
this.adapters.clear();
Expand Down
2 changes: 0 additions & 2 deletions packages/mcp-server/src/adapters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* Adapter Framework Types
*/

import type { JSONSchema, ToolDefinition } from '../server/protocol/types';

// Adapter Metadata
export interface AdapterMetadata {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('Formatters', () => {
const footerMatch = result.content.match(/🪙 ~(\d+) tokens$/);
expect(footerMatch).toBeTruthy();

const footerTokens = Number.parseInt(footerMatch![1], 10);
const footerTokens = Number.parseInt(footerMatch?.[1] ?? '0', 10);
expect(footerTokens).toBe(result.tokenEstimate);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export * from './formatters';
// Core exports
export { MCPServer, type MCPServerConfig } from './server/mcp-server';
// Protocol exports
export { JSONRPCHandler } from './server/protocol/jsonrpc';
export * from './server/protocol/jsonrpc';
export * from './server/protocol/types';
export { StdioTransport } from './server/transport/stdio-transport';
// Transport exports
Expand Down
18 changes: 9 additions & 9 deletions packages/mcp-server/src/server/mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ToolAdapter } from '../adapters/tool-adapter';
import type { AdapterContext, Config, ToolExecutionContext } from '../adapters/types';
import { ConsoleLogger } from '../utils/logger';
import { PromptRegistry } from './prompts';
import { JSONRPCHandler } from './protocol/jsonrpc';
import { createError, createErrorResponse, createResponse, isRequest } from './protocol/jsonrpc';
import type {
ErrorCode,
InitializeResult,
Expand Down Expand Up @@ -109,12 +109,12 @@ export class MCPServer {
private async handleMessage(message: TransportMessage): Promise<void> {
this.logger.debug('Raw message received', {
type: typeof message,
isRequest: JSONRPCHandler.isRequest(message),
isRequest: isRequest(message),
preview: JSON.stringify(message).substring(0, 200),
});

// Handle notifications
if (!JSONRPCHandler.isRequest(message)) {
if (!isRequest(message)) {
const method = (message as { method: string }).method;
this.logger.info('Received notification', { method });

Expand All @@ -134,7 +134,7 @@ export class MCPServer {
const result = await this.routeRequest(request);
// request.id is guaranteed to be defined for requests (checked by isRequest)
const requestId = request.id ?? 0;
const response = JSONRPCHandler.createResponse(requestId, result);
const response = createResponse(requestId, result);
this.logger.debug('Sending response', {
id: request.id,
method: request.method,
Expand All @@ -149,7 +149,7 @@ export class MCPServer {

const jsonrpcError = error as { code: ErrorCode; message: string; data?: unknown };
const requestId = request.id ?? 0;
const errorResponse = JSONRPCHandler.createErrorResponse(requestId, jsonrpcError);
const errorResponse = createErrorResponse(requestId, jsonrpcError);
await this.transport.send(errorResponse);
}
}
Expand Down Expand Up @@ -182,10 +182,10 @@ export class MCPServer {

case 'resources/list':
case 'resources/read':
throw JSONRPCHandler.createError(-32601, `Method not implemented: ${method}`);
throw createError(-32601, `Method not implemented: ${method}`);

default:
throw JSONRPCHandler.createError(-32601, `Unknown method: ${method}`);
throw createError(-32601, `Unknown method: ${method}`);
}
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export class MCPServer {
const prompt = this.promptRegistry.getPrompt(params.name, params.arguments || {});

if (!prompt) {
throw JSONRPCHandler.createError(
throw createError(
-32003 as ErrorCode, // PromptNotFound
`Prompt not found: ${params.name}`
);
Expand All @@ -309,7 +309,7 @@ export class MCPServer {
return prompt;
} catch (error) {
if (error instanceof Error && error.message.startsWith('Missing required argument')) {
throw JSONRPCHandler.createError(
throw createError(
-32602 as ErrorCode, // InvalidParams
error.message
);
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/src/server/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Defines reusable prompt templates that guide users through common workflows
*/

import type { PromptArgument, PromptDefinition } from './protocol/types';
import type { PromptDefinition } from './protocol/types';

/**
* Prompt message with role and content
Expand Down
Loading