Skip to content

Commit 88a0cdc

Browse files
committed
feat(chat): Introduce ChatHub service for importing chat history and refactor related components
1 parent e3ea62e commit 88a0cdc

File tree

13 files changed

+162
-44
lines changed

13 files changed

+162
-44
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"id": 278,
3+
"key": "fix-chat-system-build-errors-and-integration-issue",
4+
"title": "Fix: Chat System Build Errors and Integration Issues",
5+
"type": "bugfix",
6+
"description": "Multiple compilation errors and integration issues in the chat system implementation affecting core package build, TypeORM entity definitions, API endpoints, and MCP tool integration. Build failures are blocking development and testing of the chat feature.",
7+
"status": "new",
8+
"priority": "high",
9+
"createdAt": "2025-07-24T13:52:08.420Z",
10+
"updatedAt": "2025-07-24T13:52:08.420Z",
11+
"notes": [],
12+
"files": [],
13+
"relatedDevlogs": [],
14+
"context": {
15+
"businessContext": "The chat history feature implementation is currently broken with build failures preventing testing and integration. This blocks completion of the chat visualization system and impacts developer productivity.",
16+
"technicalContext": "Issues identified in multiple packages: core package TypeScript compilation errors in chat entities, potential API endpoint configuration problems, and MCP tool integration issues. Need systematic diagnosis and targeted fixes to restore functionality.",
17+
"dependencies": [],
18+
"decisions": [],
19+
"acceptanceCriteria": [
20+
"Core package builds successfully without TypeScript errors",
21+
"Chat entities compile correctly with proper TypeORM decorators",
22+
"API endpoints respond correctly to requests",
23+
"MCP tools can communicate with chat APIs",
24+
"Import functionality works end-to-end",
25+
"No runtime errors in chat-related operations",
26+
"All affected packages build and test successfully",
27+
"Integration between packages works correctly"
28+
],
29+
"risks": []
30+
},
31+
"aiContext": {
32+
"currentSummary": "",
33+
"keyInsights": [],
34+
"openQuestions": [],
35+
"relatedPatterns": [],
36+
"suggestedNextSteps": [],
37+
"lastAIUpdate": "2025-07-24T13:52:08.420Z",
38+
"contextVersion": 1
39+
}
40+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"id": 279,
3+
"key": "remove-legacy-codehist-references-from-codebase",
4+
"title": "Remove legacy 'codehist' references from codebase",
5+
"type": "refactor",
6+
"description": "Clean up remaining references to \"codehist\" throughout the codebase, replacing them with more appropriate terms like \"GitHub Copilot\", \"VS Code\", or generic chat import terminology. The package was renamed from @devlog/codehist → @devlog/ai-chat → @devlog/ai, but many comments, descriptions, method names, and configurations still reference the old \"codehist\" name which is confusing and outdated.",
7+
"status": "in-progress",
8+
"priority": "medium",
9+
"createdAt": "2025-07-24T13:59:47.120Z",
10+
"updatedAt": "2025-07-24T14:11:12.587Z",
11+
"notes": [
12+
{
13+
"id": "0f7318d0-40dc-4111-bca5-5a5949cc6e46",
14+
"timestamp": "2025-07-24T14:02:03.781Z",
15+
"category": "progress",
16+
"content": "Starting implementation with \"ChatHub\" as the new catchy name for the AI chat history handling module. This will replace all \"codehist\" references with \"ChatHub\" terminology throughout the codebase."
17+
},
18+
{
19+
"id": "7cd6abe4-816b-46af-866f-eb7404b5d727",
20+
"timestamp": "2025-07-24T14:05:04.685Z",
21+
"category": "idea",
22+
"content": "**Architecture Redesign Decision**: Instead of having a generic chat-import-service that references ChatHub, ChatHub itself should be the primary service. This means:\n\n1. Rename `chat-import-service.ts` → `chat-hub-service.ts` \n2. `DefaultChatImportService` → `ChatHubService`\n3. Methods become source-specific: `importFromGitHubCopilot()`, `importFromCursor()`, etc.\n4. ChatHub is positioned as the central hub for all AI chat history processing\n\nThis is much cleaner architecturally and makes the naming intuitive."
23+
},
24+
{
25+
"id": "a1ac9e15-3b6a-4b71-8f9e-4ea35d9cd823",
26+
"timestamp": "2025-07-24T14:05:25.356Z",
27+
"category": "progress",
28+
"content": "Updated Acceptance Criteria to reflect the ChatHub-centric architecture. The plan now focuses on making ChatHub the primary service rather than just removing 'codehist' references. This includes:\n\n- File rename: chat-import-service.ts → chat-hub-service.ts\n- Class rename: DefaultChatImportService → ChatHubService \n- Interface rename: ChatImportService → ChatHubService\n- Source-specific methods: importFromGitHubCopilot(), etc.\n- Complete package-wide refactoring to use ChatHub terminology\n\nThis gives us a much cleaner and more intuitive architecture."
29+
},
30+
{
31+
"id": "89fc76b4-27e2-44b3-873c-5ff60630e60c",
32+
"timestamp": "2025-07-24T14:11:12.587Z",
33+
"category": "progress",
34+
"content": "**Core refactoring completed**:\n\n✅ **Architecture Changes**:\n- Renamed `chat-import-service.ts` → `chat-hub-service.ts`\n- Created `IChatHubService` interface and `ChatHubService` implementation\n- Added typed `ChatSource` type with proper values: 'github-copilot', 'cursor', 'claude-code', 'windsurf', 'manual'\n\n✅ **Types Updated**:\n- Updated `ChatImportConfig.source` to use `ChatSource` type\n- Updated `ChatImportProgress.source` to use `ChatSource` type\n- Updated file comments to reference proper AI chat sources\n\n✅ **API Updates**:\n- Updated web API route to import and use `ChatHubService`\n- Default source changed to 'github-copilot'\n- Updated service exports in AI package\n\n**Next**: Update MCP tools and complete remaining references",
35+
"files": [
36+
"packages/core/src/types/chat.ts",
37+
"packages/ai/src/services/chat-hub-service.ts",
38+
"packages/ai/src/services/index.ts",
39+
"packages/web/app/api/workspaces/[id]/chat/import/route.ts"
40+
]
41+
}
42+
],
43+
"files": [],
44+
"relatedDevlogs": [],
45+
"context": {
46+
"businessContext": "Removing outdated terminology improves code maintainability and reduces confusion for new developers. The \"codehist\" name was specific to the original Python project and doesn't clearly communicate the current functionality of GitHub Copilot chat import capabilities.",
47+
"technicalContext": "Architecture decision: ChatHub should be the primary service name, not just a source reference. The current chat-import-service.ts is too generic - ChatHub itself should be the service that handles importing from various AI chat history sources (GitHub Copilot, Cursor, Claude, etc.). This requires renaming the service file and restructuring the architecture to be ChatHub-centric.",
48+
"dependencies": [],
49+
"decisions": [],
50+
"acceptanceCriteria": [
51+
"Rename chat-import-service.ts to chat-hub-service.ts",
52+
"Create ChatHubService class to replace DefaultChatImportService",
53+
"Update ChatImportService interface to ChatHubService interface",
54+
"Method names become source-specific: importFromGitHubCopilot(), importFromCursor(), etc.",
55+
"All imports across packages updated to use ChatHubService",
56+
"MCP tools reference ChatHub as the primary service",
57+
"API routes use ChatHubService instead of DefaultChatImportService",
58+
"Comments and documentation position ChatHub as the central AI chat processing hub",
59+
"Remove all legacy 'codehist' references from active code",
60+
"Update type definitions and interfaces to use ChatHub terminology",
61+
"Maintain backward compatibility in API responses where possible"
62+
],
63+
"risks": []
64+
},
65+
"aiContext": {
66+
"currentSummary": "",
67+
"keyInsights": [],
68+
"openQuestions": [],
69+
"relatedPatterns": [],
70+
"suggestedNextSteps": [
71+
"Rename chat-import-service.ts to chat-hub-service.ts",
72+
"Create ChatHubService class to replace DefaultChatImportService",
73+
"Update method names to be source-specific (importFromGitHubCopilot)",
74+
"Update all imports and references across packages",
75+
"Update MCP tools to use ChatHub terminology",
76+
"Update API routes to use ChatHub service"
77+
],
78+
"lastAIUpdate": "2025-07-24T14:04:58.728Z",
79+
"contextVersion": 2
80+
}
81+
}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
node-version: [ 22 ]
16+
node-version: [ 20, 22 ]
1717

1818
steps:
1919
- name: Checkout code

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@
5656
"vitest": "^2.1.9"
5757
},
5858
"engines": {
59-
"node": ">=22",
60-
"pnpm": ">=10.13.1"
59+
"node": ">=20"
6160
},
62-
"packageManager": "[email protected]",
6361
"lint-staged": {
6462
"packages/**/*.{ts,tsx}": [
6563
"prettier --write"

packages/ai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@
5555
"rimraf": "^5.0.5"
5656
},
5757
"engines": {
58-
"node": ">=22"
58+
"node": ">=20"
5959
}
6060
}

packages/ai/src/services/chat-import-service.ts renamed to packages/ai/src/services/chat-hub-service.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Chat import service for importing chat history from various sources
33
*
4-
* This service handles importing chat data from sources like codehist (GitHub Copilot)
4+
* This service handles importing chat data through ChatHub (GitHub Copilot, etc.)
55
* into the devlog storage system with proper workspace mapping and linking.
66
*/
77

@@ -14,16 +14,17 @@ import type {
1414
ChatMessage,
1515
ChatSession,
1616
ChatSessionId,
17+
ChatSource,
1718
ChatStatus,
1819
DevlogEntry,
1920
StorageProvider,
2021
} from '@devlog/core';
2122

22-
export interface ChatImportService {
23+
export interface IChatHubService {
2324
/**
24-
* Import chat history from codehist parser
25+
* Import chat history from GitHub Copilot
2526
*/
26-
importFromCodehist(config: ChatImportConfig): Promise<ChatImportProgress>;
27+
importFromGitHubCopilot(config: ChatImportConfig): Promise<ChatImportProgress>;
2728

2829
/**
2930
* Get import progress by ID
@@ -44,20 +45,20 @@ export interface ChatImportService {
4445
autoLinkSessions(sessionIds: ChatSessionId[], threshold?: number): Promise<ChatDevlogLink[]>;
4546
}
4647

47-
export class DefaultChatImportService implements ChatImportService {
48+
export class ChatHubService implements IChatHubService {
4849
private storageProvider: StorageProvider;
4950
private activeImports = new Map<string, ChatImportProgress>();
5051

5152
constructor(storageProvider: StorageProvider) {
5253
this.storageProvider = storageProvider;
5354
}
5455

55-
async importFromCodehist(config: ChatImportConfig): Promise<ChatImportProgress> {
56+
async importFromGitHubCopilot(config: ChatImportConfig): Promise<ChatImportProgress> {
5657
const importId = this.generateImportId();
5758
const progress: ChatImportProgress = {
5859
importId,
5960
status: 'pending',
60-
source: 'codehist',
61+
source: 'github-copilot',
6162
progress: {
6263
totalSessions: 0,
6364
processedSessions: 0,
@@ -178,9 +179,9 @@ export class DefaultChatImportService implements ChatImportService {
178179
progress.status = 'running';
179180

180181
try {
181-
console.log(`[ChatImportService] Starting import ${importId} from ${config.source}`);
182+
console.log(`[ChatHubService] Starting import ${importId} from ${config.source}`);
182183

183-
// Initialize codehist parser
184+
// Initialize GitHub Copilot parser
184185
const parser = new CopilotParser();
185186
const workspaceData = await parser.discoverVSCodeCopilotData();
186187

packages/ai/src/services/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* AI Services - Chat import and other AI-related services
2+
* AI Services - ChatHub and other AI-related services
33
*/
44

5-
export { DefaultChatImportService, type ChatImportService } from './chat-import-service.js';
5+
export { ChatHubService, type IChatHubService } from './chat-hub-service.js';

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@
5858
"vitest": "^2.1.9"
5959
},
6060
"engines": {
61-
"node": ">=22"
61+
"node": ">=20"
6262
}
6363
}

packages/core/src/types/chat.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Chat history types and interfaces for devlog integration
33
*
44
* These types support importing and managing AI chat histories from various sources
5-
* (primarily GitHub Copilot via codehist) and linking them to devlog entries.
5+
* (GitHub Copilot, Cursor, Claude Code, etc.) and linking them to devlog entries.
66
*/
77

88
import type { DevlogId } from './core.js';
@@ -302,7 +302,7 @@ export interface ChatImportProgress {
302302
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
303303

304304
/** Source being imported from */
305-
source: string;
305+
source: ChatSource;
306306

307307
/** Progress information */
308308
progress: {
@@ -336,11 +336,16 @@ export interface ChatImportProgress {
336336
}
337337

338338
/**
339-
* Configuration for chat import operations
339+
* Chat import source types
340+
*/
341+
export type ChatSource = 'github-copilot' | 'cursor' | 'claude-code' | 'windsurf' | 'manual';
342+
343+
/**
344+
* Configuration for importing chat history from various sources
340345
*/
341346
export interface ChatImportConfig {
342347
/** Source type */
343-
source: 'codehist' | 'vs-code' | 'cursor' | 'manual';
348+
source: ChatSource;
344349

345350
/** Source-specific configuration */
346351
sourceConfig: Record<string, any>;

packages/mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@
6565
"vitest": "^2.1.9"
6666
},
6767
"engines": {
68-
"node": ">=22"
68+
"node": ">=20"
6969
}
7070
}

0 commit comments

Comments
 (0)