Skip to content

Commit 4fc6691

Browse files
committed
refactor(context): migrate all imports to use index.js and fix type exports
- Update all direct imports from frame-manager.ts to use index.js - Update type-only imports to use frame-types.ts - Fix type exports to use `export type` for pure type definitions (required because esbuild strips type-only modules at runtime) - Update tests to use new import paths: - FrameManager now refers to RefactoredFrameManager - LegacyFrameManager available for backwards compatibility tests All code now imports FrameManager from index.js, which provides the RefactoredFrameManager as the primary implementation. https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
1 parent c46ca2b commit 4fc6691

16 files changed

+28
-30
lines changed

src/core/context/__tests__/context-bridge.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
22
import { ContextBridge, contextBridge } from '../context-bridge.js';
3-
import { FrameManager } from '../frame-manager.js';
3+
import { FrameManager, type Frame } from '../index.js';
44
import { sharedContextLayer } from '../shared-context-layer.js';
55
import { sessionManager } from '../../session/session-manager.js';
6-
import type { Frame } from '../frame-manager.js';
76

87
vi.mock('../shared-context-layer.js');
98
vi.mock('../../session/session-manager.js');

src/core/context/__tests__/dual-stack-manager-integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
77
import { DualStackManager } from '../dual-stack-manager.js';
8-
import { FrameManager } from '../frame-manager.js';
8+
import { FrameManager } from '../index.js';
99
import { SQLiteAdapter } from '../../database/sqlite-adapter.js';
1010
import * as fs from 'fs';
1111
import * as path from 'path';

src/core/context/__tests__/frame-manager-cycle-detection.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44

55
import { describe, it, expect, beforeEach } from 'vitest';
66
import Database from 'better-sqlite3';
7-
import { FrameManager } from '../frame-manager.js';
8-
import { RefactoredFrameManager } from '../refactored-frame-manager.js';
7+
import { FrameManager, LegacyFrameManager } from '../index.js';
98
import { ErrorCode } from '../../errors/index.js';
109

1110
describe('Frame Manager - Circular Reference Detection', () => {
1211
let db: Database.Database;
13-
let frameManager: FrameManager;
14-
12+
let frameManager: LegacyFrameManager;
13+
1514
beforeEach(() => {
1615
db = new Database(':memory:');
17-
frameManager = new FrameManager(db, 'test-project', {
16+
frameManager = new LegacyFrameManager(db, 'test-project', {
1817
skipContextBridge: true,
1918
maxFrameDepth: 10, // Lower limit for testing
2019
});
@@ -24,7 +23,7 @@ describe('Frame Manager - Circular Reference Detection', () => {
2423
db.close();
2524
});
2625

27-
describe('FrameManager', () => {
26+
describe('LegacyFrameManager', () => {
2827
it('should detect direct circular reference (A -> B -> A)', () => {
2928
// Create frame A
3029
const frameA = frameManager.createFrame({
@@ -214,11 +213,11 @@ describe('Frame Manager - Circular Reference Detection', () => {
214213
});
215214
});
216215

217-
describe('RefactoredFrameManager', () => {
218-
let refactoredManager: RefactoredFrameManager;
216+
describe('RefactoredFrameManager (now FrameManager)', () => {
217+
let refactoredManager: FrameManager;
219218

220219
beforeEach(() => {
221-
refactoredManager = new RefactoredFrameManager(db, 'test-project', {
220+
refactoredManager = new FrameManager(db, 'test-project', {
222221
maxStackDepth: 100, // Higher stack limit so we can test frame depth
223222
});
224223
});

src/core/context/__tests__/frame-manager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
77
import Database from 'better-sqlite3';
8-
import { FrameManager } from '../frame-manager';
8+
import { FrameManager } from '../index.js';
99
import { join } from 'path';
1010
import { mkdtempSync, rmSync } from 'fs';
1111
import { tmpdir } from 'os';

src/core/context/auto-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Automatically creates and manages context frames
44
*/
55

6-
import { FrameManager } from './frame-manager.js';
6+
import { FrameManager } from './index.js';
77
import { logger } from '../monitoring/logger.js';
88

99
export class AutoContext {

src/core/context/compaction-handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* Preserves critical context across token limit boundaries
44
*/
55

6-
import { FrameManager, Anchor, Event } from './frame-manager.js';
6+
import { FrameManager } from './index.js';
7+
import type { Anchor, Event } from './index.js';
78
import { logger } from '../monitoring/logger.js';
89

910
export interface CompactionMetrics {

src/core/context/context-bridge.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* - Maintains consistency across sessions
88
*/
99

10-
import { FrameManager } from './frame-manager.js';
10+
import { FrameManager, type Frame } from './index.js';
1111
import { sharedContextLayer } from './shared-context-layer.js';
1212
import { sessionManager } from '../session/session-manager.js';
1313
import { logger } from '../monitoring/logger.js';
14-
import type { Frame } from './frame-manager.js';
1514

1615
export interface BridgeOptions {
1716
autoSync: boolean;

src/core/context/dual-stack-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Manages both individual and shared team stacks for collaboration
44
*/
55

6-
import type { Frame, Event, Anchor } from './frame-manager.js';
7-
import { FrameManager } from './frame-manager.js';
6+
import type { Frame, Event, Anchor } from './frame-types.js';
7+
import { FrameManager } from './index.js';
88
import type { DatabaseAdapter } from '../database/database-adapter.js';
99
import { SQLiteAdapter } from '../database/sqlite-adapter.js';
1010
import { logger } from '../monitoring/logger.js';

src/core/context/enhanced-rehydration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as fs from 'fs/promises';
77
import * as path from 'path';
88
import { logger } from '../monitoring/logger.js';
9-
import { FrameManager } from './frame-manager.js';
9+
import { FrameManager } from './index.js';
1010
import { CompactionHandler } from './compaction-handler.js';
1111

1212
export interface FileSnapshot {

src/core/context/frame-handoff-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Handles frame transfers between individual and team stacks with approval workflows
44
*/
55

6-
import type { Frame, Event, Anchor } from './frame-manager.js';
6+
import type { Frame, Event, Anchor } from './frame-types.js';
77
import {
88
DualStackManager,
99
type StackContext,

0 commit comments

Comments
 (0)