codeseeker 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,31 +41,31 @@ class PostgresVectorStore {
41
41
  // Check if pgvector extension is available
42
42
  await client.query(`CREATE EXTENSION IF NOT EXISTS vector`);
43
43
  // Create documents table with vector column
44
- await client.query(`
45
- CREATE TABLE IF NOT EXISTS vector_documents (
46
- id TEXT PRIMARY KEY,
47
- project_id TEXT NOT NULL,
48
- file_path TEXT NOT NULL,
49
- content TEXT NOT NULL,
50
- embedding vector(1536),
51
- metadata JSONB,
52
- content_tsvector TSVECTOR GENERATED ALWAYS AS (
53
- setweight(to_tsvector('english', file_path), 'A') ||
54
- setweight(to_tsvector('english', content), 'B')
55
- ) STORED,
56
- created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
57
- updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
58
- );
59
-
60
- CREATE INDEX IF NOT EXISTS idx_vd_project ON vector_documents(project_id);
61
- CREATE INDEX IF NOT EXISTS idx_vd_file ON vector_documents(file_path);
62
- CREATE INDEX IF NOT EXISTS idx_vd_fts ON vector_documents USING GIN(content_tsvector);
44
+ await client.query(`
45
+ CREATE TABLE IF NOT EXISTS vector_documents (
46
+ id TEXT PRIMARY KEY,
47
+ project_id TEXT NOT NULL,
48
+ file_path TEXT NOT NULL,
49
+ content TEXT NOT NULL,
50
+ embedding vector(1536),
51
+ metadata JSONB,
52
+ content_tsvector TSVECTOR GENERATED ALWAYS AS (
53
+ setweight(to_tsvector('english', file_path), 'A') ||
54
+ setweight(to_tsvector('english', content), 'B')
55
+ ) STORED,
56
+ created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
57
+ updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
58
+ );
59
+
60
+ CREATE INDEX IF NOT EXISTS idx_vd_project ON vector_documents(project_id);
61
+ CREATE INDEX IF NOT EXISTS idx_vd_file ON vector_documents(file_path);
62
+ CREATE INDEX IF NOT EXISTS idx_vd_fts ON vector_documents USING GIN(content_tsvector);
63
63
  `);
64
64
  // Create vector index (IVFFlat for larger datasets)
65
- await client.query(`
66
- CREATE INDEX IF NOT EXISTS idx_vd_embedding ON vector_documents
67
- USING ivfflat (embedding vector_cosine_ops)
68
- WITH (lists = 100);
65
+ await client.query(`
66
+ CREATE INDEX IF NOT EXISTS idx_vd_embedding ON vector_documents
67
+ USING ivfflat (embedding vector_cosine_ops)
68
+ WITH (lists = 100);
69
69
  `).catch(() => {
70
70
  // IVFFlat requires training data; fall back to HNSW or skip
71
71
  console.log('Note: IVFFlat index creation skipped (requires more data)');
@@ -81,16 +81,16 @@ class PostgresVectorStore {
81
81
  const embeddingStr = doc.embedding.length > 0
82
82
  ? `[${doc.embedding.join(',')}]`
83
83
  : null;
84
- await this.pool.query(`
85
- INSERT INTO vector_documents (id, project_id, file_path, content, embedding, metadata, updated_at)
86
- VALUES ($1, $2, $3, $4, $5::vector, $6, NOW())
87
- ON CONFLICT (id) DO UPDATE SET
88
- project_id = EXCLUDED.project_id,
89
- file_path = EXCLUDED.file_path,
90
- content = EXCLUDED.content,
91
- embedding = EXCLUDED.embedding,
92
- metadata = EXCLUDED.metadata,
93
- updated_at = NOW()
84
+ await this.pool.query(`
85
+ INSERT INTO vector_documents (id, project_id, file_path, content, embedding, metadata, updated_at)
86
+ VALUES ($1, $2, $3, $4, $5::vector, $6, NOW())
87
+ ON CONFLICT (id) DO UPDATE SET
88
+ project_id = EXCLUDED.project_id,
89
+ file_path = EXCLUDED.file_path,
90
+ content = EXCLUDED.content,
91
+ embedding = EXCLUDED.embedding,
92
+ metadata = EXCLUDED.metadata,
93
+ updated_at = NOW()
94
94
  `, [
95
95
  doc.id,
96
96
  doc.projectId,
@@ -109,16 +109,16 @@ class PostgresVectorStore {
109
109
  const embeddingStr = doc.embedding.length > 0
110
110
  ? `[${doc.embedding.join(',')}]`
111
111
  : null;
112
- await client.query(`
113
- INSERT INTO vector_documents (id, project_id, file_path, content, embedding, metadata, updated_at)
114
- VALUES ($1, $2, $3, $4, $5::vector, $6, NOW())
115
- ON CONFLICT (id) DO UPDATE SET
116
- project_id = EXCLUDED.project_id,
117
- file_path = EXCLUDED.file_path,
118
- content = EXCLUDED.content,
119
- embedding = EXCLUDED.embedding,
120
- metadata = EXCLUDED.metadata,
121
- updated_at = NOW()
112
+ await client.query(`
113
+ INSERT INTO vector_documents (id, project_id, file_path, content, embedding, metadata, updated_at)
114
+ VALUES ($1, $2, $3, $4, $5::vector, $6, NOW())
115
+ ON CONFLICT (id) DO UPDATE SET
116
+ project_id = EXCLUDED.project_id,
117
+ file_path = EXCLUDED.file_path,
118
+ content = EXCLUDED.content,
119
+ embedding = EXCLUDED.embedding,
120
+ metadata = EXCLUDED.metadata,
121
+ updated_at = NOW()
122
122
  `, [
123
123
  doc.id,
124
124
  doc.projectId,
@@ -143,14 +143,14 @@ class PostgresVectorStore {
143
143
  if (embedding.length === 0)
144
144
  return [];
145
145
  const embeddingStr = `[${embedding.join(',')}]`;
146
- const result = await this.pool.query(`
147
- SELECT
148
- id, project_id, file_path, content, metadata, created_at, updated_at,
149
- 1 - (embedding <=> $1::vector) as similarity
150
- FROM vector_documents
151
- WHERE project_id = $2 AND embedding IS NOT NULL
152
- ORDER BY embedding <=> $1::vector
153
- LIMIT $3
146
+ const result = await this.pool.query(`
147
+ SELECT
148
+ id, project_id, file_path, content, metadata, created_at, updated_at,
149
+ 1 - (embedding <=> $1::vector) as similarity
150
+ FROM vector_documents
151
+ WHERE project_id = $2 AND embedding IS NOT NULL
152
+ ORDER BY embedding <=> $1::vector
153
+ LIMIT $3
154
154
  `, [embeddingStr, projectId, limit]);
155
155
  return result.rows.map(row => ({
156
156
  document: this.rowToDocument(row),
@@ -167,15 +167,15 @@ class PostgresVectorStore {
167
167
  .join(' | ');
168
168
  if (!tsQuery)
169
169
  return [];
170
- const result = await this.pool.query(`
171
- SELECT
172
- id, project_id, file_path, content, metadata, created_at, updated_at,
173
- ts_rank_cd(content_tsvector, to_tsquery('english', $1)) as rank
174
- FROM vector_documents
175
- WHERE project_id = $2
176
- AND content_tsvector @@ to_tsquery('english', $1)
177
- ORDER BY rank DESC
178
- LIMIT $3
170
+ const result = await this.pool.query(`
171
+ SELECT
172
+ id, project_id, file_path, content, metadata, created_at, updated_at,
173
+ ts_rank_cd(content_tsvector, to_tsquery('english', $1)) as rank
174
+ FROM vector_documents
175
+ WHERE project_id = $2
176
+ AND content_tsvector @@ to_tsquery('english', $1)
177
+ ORDER BY rank DESC
178
+ LIMIT $3
179
179
  `, [tsQuery, projectId, limit]);
180
180
  return result.rows.map(row => ({
181
181
  document: this.rowToDocument(row),
@@ -251,9 +251,9 @@ class PostgresVectorStore {
251
251
  }
252
252
  async getFileHashes(projectId) {
253
253
  await this.initialize();
254
- const result = await this.pool.query(`SELECT DISTINCT ON (file_path) file_path, metadata
255
- FROM vector_documents
256
- WHERE project_id = $1 AND metadata IS NOT NULL
254
+ const result = await this.pool.query(`SELECT DISTINCT ON (file_path) file_path, metadata
255
+ FROM vector_documents
256
+ WHERE project_id = $1 AND metadata IS NOT NULL
257
257
  ORDER BY file_path`, [projectId]);
258
258
  const hashes = new Map();
259
259
  for (const row of result.rows) {
@@ -279,8 +279,8 @@ class PostgresVectorStore {
279
279
  async getFileMetadata(projectId, filePath) {
280
280
  await this.initialize();
281
281
  // Fast indexed query to get file metadata from first chunk
282
- const result = await this.pool.query(`SELECT metadata FROM vector_documents
283
- WHERE project_id = $1 AND file_path = $2
282
+ const result = await this.pool.query(`SELECT metadata FROM vector_documents
283
+ WHERE project_id = $1 AND file_path = $2
284
284
  LIMIT 1`, [projectId, filePath]);
285
285
  if (result.rows.length === 0 || !result.rows[0].metadata) {
286
286
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeseeker",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Graph-powered code intelligence for Claude Code. Semantic search + knowledge graph for better AI code understanding.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -148,5 +148,6 @@
148
148
  "homepage": "https://github.com/jghiringhelli/codeseeker#readme",
149
149
  "publishConfig": {
150
150
  "access": "public"
151
- }
151
+ },
152
+ "mcpName": "io.github.jghiringhelli/codeseeker"
152
153
  }