Skip to content
Closed
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
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,20 @@ jobs:
- name: Lint
run: npm run lint --no-workspaces

- name: Build
run: npm run build --no-workspaces
- name: Build core package first
run: |
echo "Building core package first to ensure proper type exports..."
cd packages/core
npm run build || (echo "Core build failed" && exit 1)
echo "Verifying core build output..."
ls -la dist/
ls -la dist/utils/ || echo "No utils directory"
ls -la dist/types/ || echo "No types directory"
ls -la dist/config/ || echo "No config directory"
cd ../..

- name: Build all other packages
run: npx turbo run build --filter='!@codequal/core'

- name: Test
run: npm run test --no-workspaces
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Environment variables
.env
.env.*
.env.local
.env.development.local
.env.test.local
Expand Down
2 changes: 1 addition & 1 deletion packages/agents/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"./config/*": "./dist/config/*.js"
},
"scripts": {
"build": "tsc --skipLibCheck || true",
"build": "tsc --skipLibCheck",
"dev": "tsc -w",
"lint": "eslint src",
"test": "jest --passWithNoTests"
Expand Down
48 changes: 27 additions & 21 deletions packages/core/src/deepwiki/ThreeTierAnalysisUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,12 @@ export class ThreeTierAnalysisUtils {
// Convert DeepWiki chart format to our standard format
const reportViz: ReportVisualization = {
id: `viz_${visualizations.length}`,
title: viz.title || 'Visualization',
type: this.mapVisualizationType(viz.type),
chartType: this.mapChartType(viz.chartType),
data: viz.data,
title: (viz.title as string) || 'Visualization',
type: this.mapVisualizationType(viz.type as string),
chartType: this.mapChartType(viz.chartType as string),
data: (viz.data as Record<string, unknown>) || {},
config: this.convertVisualizationConfig(viz),
description: viz.description
description: viz.description as string | undefined
};

visualizations.push(reportViz);
Expand All @@ -594,7 +594,7 @@ export class ThreeTierAnalysisUtils {
* @returns Our visualization type
* @private
*/
private mapVisualizationType(deepWikiType: string): 'chart' | 'graph' | 'table' | 'code' | 'image' {
private mapVisualizationType(deepWikiType: string | undefined): 'chart' | 'graph' | 'table' | 'code' | 'image' {
const typeMap: Record<string, 'chart' | 'graph' | 'table' | 'code' | 'image'> = {
'chart': 'chart',
'graph': 'graph',
Expand All @@ -610,7 +610,7 @@ export class ThreeTierAnalysisUtils {
'heatmap': 'chart'
};

return typeMap[deepWikiType] || 'chart';
return (deepWikiType && typeMap[deepWikiType]) || 'chart';
}

/**
Expand All @@ -619,7 +619,7 @@ export class ThreeTierAnalysisUtils {
* @returns Our chart type
* @private
*/
private mapChartType(deepWikiChartType: string): 'bar' | 'line' | 'pie' | 'radar' | 'heatmap' | 'scatter' | 'network' | undefined {
private mapChartType(deepWikiChartType: string | undefined): 'bar' | 'line' | 'pie' | 'radar' | 'heatmap' | 'scatter' | 'network' | undefined {
const chartTypeMap: Record<string, 'bar' | 'line' | 'pie' | 'radar' | 'heatmap' | 'scatter' | 'network'> = {
'bar': 'bar',
'line': 'line',
Expand Down Expand Up @@ -647,7 +647,7 @@ export class ThreeTierAnalysisUtils {
const config: Record<string, unknown> = {
responsive: true,
maintainAspectRatio: true,
...deepWikiViz.config
...(deepWikiViz.config as Record<string, unknown> || {})
};

// Add type-specific configurations
Expand Down Expand Up @@ -775,7 +775,7 @@ export class ThreeTierAnalysisUtils {
*/
private generateTableHtml(visualization: ReportVisualization): string {
// Extract data for the table
const { headers, rows } = visualization.data;
const { headers, rows } = visualization.data as { headers?: unknown[], rows?: unknown[][] };

// Generate HTML for the table
let tableHtml = `
Expand All @@ -789,8 +789,10 @@ export class ThreeTierAnalysisUtils {
`;

// Add headers
for (const header of headers) {
tableHtml += `<th>${header}</th>`;
if (headers && Array.isArray(headers)) {
for (const header of headers) {
tableHtml += `<th>${header}</th>`;
}
}

tableHtml += `
Expand All @@ -800,12 +802,16 @@ export class ThreeTierAnalysisUtils {
`;

// Add rows
for (const row of rows) {
tableHtml += '<tr>';
for (const cell of row) {
tableHtml += `<td>${cell}</td>`;
if (rows && Array.isArray(rows)) {
for (const row of rows) {
tableHtml += '<tr>';
if (Array.isArray(row)) {
for (const cell of row) {
tableHtml += `<td>${cell}</td>`;
}
}
tableHtml += '</tr>';
}
tableHtml += '</tr>';
}

tableHtml += `
Expand All @@ -826,14 +832,14 @@ export class ThreeTierAnalysisUtils {
*/
private generateCodeHtml(visualization: ReportVisualization): string {
// Extract code and language
const { code, language } = visualization.data;
const { code, language } = visualization.data as { code?: string, language?: string };

// Generate HTML for the code with syntax highlighting
return `
<div class="visualization code-visualization">
<h3>${visualization.title}</h3>
${visualization.description ? `<p>${visualization.description}</p>` : ''}
<pre><code class="language-${language || 'plaintext'}">${code}</code></pre>
<pre><code class="language-${language || 'plaintext'}">${code || ''}</code></pre>
</div>
`;
}
Expand All @@ -846,15 +852,15 @@ export class ThreeTierAnalysisUtils {
*/
private generateImageHtml(visualization: ReportVisualization): string {
// Extract image data
const { src, alt, width, height } = visualization.data;
const { src, alt, width, height } = visualization.data as { src?: string, alt?: string, width?: string | number, height?: string | number };

// Generate HTML for the image
return `
<div class="visualization image-visualization">
<h3>${visualization.title}</h3>
${visualization.description ? `<p>${visualization.description}</p>` : ''}
<div class="image-container">
<img src="${src}" alt="${alt || visualization.title}" ${width ? `width="${width}"` : ''} ${height ? `height="${height}"` : ''}>
<img src="${src || ''}" alt="${alt || visualization.title}" ${width ? `width="${width}"` : ''} ${height ? `height="${height}"` : ''}>
</div>
</div>
`;
Expand Down
31 changes: 26 additions & 5 deletions packages/core/src/services/deepwiki-kubernetes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,14 @@ export class DeepWikiKubernetesService {
* @param output Raw output from the analysis
* @returns Parsed output
*/
private async parseAnalysisOutput(output: string): Promise<Record<string, unknown> | string> {
private async parseAnalysisOutput(output: string): Promise<Record<string, unknown>> {
// This implementation will be updated based on the actual output format
try {
// Try to parse as JSON
return JSON.parse(output);
} catch (error: unknown) {
// If not JSON, return as is
return output;
// If not JSON, return as a wrapped string object
return { raw: output };
}
}

Expand All @@ -519,14 +519,35 @@ export class DeepWikiKubernetesService {
* @param output Raw output from the chat query
* @returns Parsed output
*/
private async parseChatOutput(output: string): Promise<{ answer: string; usage?: Record<string, unknown> }> {
private async parseChatOutput(output: string): Promise<{
answer: string;
usage?: { promptTokens: number; completionTokens: number; totalTokens: number; }
}> {
// This implementation will be updated based on the actual output format
try {
// Try to parse as JSON
const parsed = JSON.parse(output);

// Type guard for usage property
let usage: { promptTokens: number; completionTokens: number; totalTokens: number; } | undefined;
if (parsed.usage &&
typeof parsed.usage === 'object' &&
'promptTokens' in parsed.usage &&
'completionTokens' in parsed.usage &&
'totalTokens' in parsed.usage &&
typeof parsed.usage.promptTokens === 'number' &&
typeof parsed.usage.completionTokens === 'number' &&
typeof parsed.usage.totalTokens === 'number') {
usage = {
promptTokens: parsed.usage.promptTokens,
completionTokens: parsed.usage.completionTokens,
totalTokens: parsed.usage.totalTokens
};
}

return {
answer: parsed.answer || parsed.text || parsed.result || output,
usage: parsed.usage
usage
};
} catch (error: unknown) {
// If not JSON, return as is
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/database/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tools/mcp-custom-prompts/copy-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ I'm working on the CodeQual project. Please follow these guidelines:
3. At the beginning of each session, review the most recent summary in '/Users/alpinro/Code Prjects/codequal/docs/session-summaries/'
4. When I indicate we're finishing our conversation (by saying something like "let's end here", "that's all for today", or similar), create a detailed summary of our chat in '/Users/alpinro/Code Prjects/codequal/docs/session-summaries/' with filename format: YYYY-MM-DD-session-summary.md

Please confirm you can access the filesystem and verify access to "/Users/alpinro/Code Prjects/codequal/packages"
Please confirm you can access the filesystem and verify access to "/Users/alpinro/Code Prjects/codequal/packages and Supabase project and wait for next request"
EOL

# Copy to clipboard
Expand Down
Loading