mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
fix: 修复 Dashboard 概况页面无法显示项目信息的问题
添加 extractStringArray 辅助函数来处理混合数组类型(字符串数组和对象数组),
使 loadProjectOverview 函数能够正确处理 project-tech.json 中的数据结构。
修复的字段包括:
- languages: 对象数组 [{name, file_count, primary}] → 字符串数组
- frameworks: 保持兼容字符串数组
- key_components: 对象数组 [{name, description, path}] → 字符串数组
- layers/patterns: 保持兼容混合类型
Closes #79
This commit is contained in:
@@ -589,6 +589,18 @@ function loadProjectOverview(workflowDir: string): ProjectOverview | null {
|
|||||||
const statistics = (projectData.statistics || developmentStatus?.statistics) as Record<string, unknown> | undefined;
|
const statistics = (projectData.statistics || developmentStatus?.statistics) as Record<string, unknown> | undefined;
|
||||||
const metadata = projectData._metadata as Record<string, unknown> | undefined;
|
const metadata = projectData._metadata as Record<string, unknown> | undefined;
|
||||||
|
|
||||||
|
// Helper to extract string array from mixed array (handles both string[] and {name: string}[])
|
||||||
|
const extractStringArray = (arr: unknown[] | undefined): string[] => {
|
||||||
|
if (!arr) return [];
|
||||||
|
return arr.map(item => {
|
||||||
|
if (typeof item === 'string') return item;
|
||||||
|
if (typeof item === 'object' && item !== null && 'name' in item) {
|
||||||
|
return String((item as { name: unknown }).name);
|
||||||
|
}
|
||||||
|
return String(item);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Load guidelines from separate file if exists
|
// Load guidelines from separate file if exists
|
||||||
let guidelines: ProjectGuidelines | null = null;
|
let guidelines: ProjectGuidelines | null = null;
|
||||||
if (existsSync(guidelinesFile)) {
|
if (existsSync(guidelinesFile)) {
|
||||||
@@ -633,17 +645,17 @@ function loadProjectOverview(workflowDir: string): ProjectOverview | null {
|
|||||||
description: (overview?.description as string) || '',
|
description: (overview?.description as string) || '',
|
||||||
initializedAt: (projectData.initialized_at as string) || null,
|
initializedAt: (projectData.initialized_at as string) || null,
|
||||||
technologyStack: {
|
technologyStack: {
|
||||||
languages: (technologyStack?.languages as string[]) || [],
|
languages: extractStringArray(technologyStack?.languages),
|
||||||
frameworks: (technologyStack?.frameworks as string[]) || [],
|
frameworks: extractStringArray(technologyStack?.frameworks),
|
||||||
build_tools: (technologyStack?.build_tools as string[]) || [],
|
build_tools: extractStringArray(technologyStack?.build_tools),
|
||||||
test_frameworks: (technologyStack?.test_frameworks as string[]) || []
|
test_frameworks: extractStringArray(technologyStack?.test_frameworks)
|
||||||
},
|
},
|
||||||
architecture: {
|
architecture: {
|
||||||
style: (architecture?.style as string) || 'Unknown',
|
style: (architecture?.style as string) || 'Unknown',
|
||||||
layers: (architecture?.layers as string[]) || [],
|
layers: extractStringArray(architecture?.layers as unknown[] | undefined),
|
||||||
patterns: (architecture?.patterns as string[]) || []
|
patterns: extractStringArray(architecture?.patterns as unknown[] | undefined)
|
||||||
},
|
},
|
||||||
keyComponents: (overview?.key_components as string[]) || [],
|
keyComponents: extractStringArray(overview?.key_components as unknown[] | undefined),
|
||||||
features: (projectData.features as unknown[]) || [],
|
features: (projectData.features as unknown[]) || [],
|
||||||
developmentIndex: {
|
developmentIndex: {
|
||||||
feature: (developmentIndex?.feature as unknown[]) || [],
|
feature: (developmentIndex?.feature as unknown[]) || [],
|
||||||
|
|||||||
Reference in New Issue
Block a user