Skip to content

Commit 3d207f6

Browse files
alpslaclaude
andcommitted
Make database package build independently from core
- Added local type shims to database package - Created core-types.ts with essential type declarations - Updated database imports to use local shims - Removed core dependency from database tsconfig.json 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 33bc9ff commit 3d207f6

5 files changed

Lines changed: 87 additions & 11 deletions

File tree

packages/database/src/migrations/apply-migrations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33
import { config } from 'dotenv';
44
import { getSupabase } from '../supabase/client';
5-
import { createLogger } from '@codequal/core/utils';
5+
import { createLogger } from '../shims/core-types';
66

77
// Load environment variables from .env file
88
config();

packages/database/src/models/pr-review.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { getSupabase } from '../supabase/client';
22
import type { Tables } from '../supabase/client';
3-
import { AgentProvider, AgentRole } from '@codequal/core/config/agent-registry';
4-
import { AnalysisResult } from '@codequal/core/types/agent';
3+
import { AgentProvider, AgentRole, AnalysisResult } from '../shims/core-types';
54

65
/**
76
* Analysis mode for PR reviews
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Minimal type declarations to allow database to build without core
2+
3+
// Logger interface from core/utils
4+
export interface Logger {
5+
debug(message: string, data?: any): void;
6+
info(message: string, data?: any): void;
7+
warn(message: string, data?: any): void;
8+
error(message: string, data?: any): void;
9+
}
10+
11+
export function createLogger(name: string): Logger {
12+
return {
13+
debug: (message: string, data?: any) => console.log(`[DEBUG] [${name}]`, message, data || ''),
14+
info: (message: string, data?: any) => console.log(`[INFO] [${name}]`, message, data || ''),
15+
warn: (message: string, data?: any) => console.warn(`[WARN] [${name}]`, message, data || ''),
16+
error: (message: string, data?: any) => console.error(`[ERROR] [${name}]`, message, data || '')
17+
};
18+
}
19+
20+
// Agent enums from core/config/agent-registry
21+
export enum AgentProvider {
22+
ANTHROPIC = 'anthropic',
23+
DEEPSEEK = 'deepseek',
24+
OPENAI = 'openai',
25+
GOOGLE = 'google',
26+
OPENROUTER = 'openrouter'
27+
}
28+
29+
export enum AgentRole {
30+
PR_REVIEWER = 'pr_reviewer',
31+
REPO_ANALYZER = 'repo_analyzer',
32+
CODE_EXPLAINER = 'code_explainer'
33+
}
34+
35+
// Agent types from core/types/agent
36+
export interface Agent {
37+
id: string;
38+
name: string;
39+
provider: string;
40+
model: string;
41+
}
42+
43+
export interface AnalysisResult {
44+
id?: string;
45+
insights: Array<Insight>;
46+
suggestions: Array<Suggestion>;
47+
educationalContent?: Array<EducationalContent>;
48+
resources?: Array<Resource>;
49+
}
50+
51+
export interface Insight {
52+
id?: string;
53+
title: string;
54+
description: string;
55+
severity?: string;
56+
category?: string;
57+
location?: string;
58+
}
59+
60+
export interface Suggestion {
61+
id?: string;
62+
title: string;
63+
description: string;
64+
priority?: string;
65+
category?: string;
66+
location?: string;
67+
codeExample?: string;
68+
}
69+
70+
export interface EducationalContent {
71+
id?: string;
72+
title: string;
73+
content: string;
74+
category?: string;
75+
}
76+
77+
export interface Resource {
78+
id?: string;
79+
title: string;
80+
url: string;
81+
description?: string;
82+
}

packages/database/tsconfig.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@
66
"composite": true,
77
"declaration": true,
88
"paths": {
9-
"@codequal/database/*": ["./src/*"],
10-
"@codequal/core": ["../core/src"],
11-
"@codequal/core/*": ["../core/src/*"]
9+
"@codequal/database/*": ["./src/*"]
1210
}
1311
},
1412
"include": ["src/**/*"],
15-
"exclude": ["node_modules", "dist", "**/*.test.ts"],
16-
"references": [
17-
{ "path": "../core" }
18-
]
13+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
1914
}

packages/database/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)