Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/infrastructure/di/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { IGitClient } from '../../domain/interfaces/IGitClient';
import { NotesService } from '../services/NotesService';
import { GitClient } from '../git/GitClient';
import { MemoryRepository } from '../repositories/MemoryRepository';
import { TrailerService } from '../services/TrailerService';
import { EventBus } from '../events/EventBus';
import { createLogger } from '../logging/factory';
import { createLLMClient } from '../llm/LLMClientFactory';
Expand Down Expand Up @@ -55,6 +56,7 @@ export function createContainer(options?: IContainerOptions): AwilixContainer<IC
notesService: asClass(NotesService).singleton(),
gitClient: asClass(GitClient).singleton(),
memoryRepository: asClass(MemoryRepository).singleton(),
trailerService: asClass(TrailerService).singleton(),

eventBus: asFunction(() => {
const bus = new EventBus(container.cradle.logger);
Expand Down
2 changes: 2 additions & 0 deletions src/infrastructure/di/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import type { ILiberateService } from '../../application/interfaces/ILiberateSer
import type { IMemoryContextLoader } from '../../domain/interfaces/IMemoryContextLoader';
import type { IContextFormatter } from '../../domain/interfaces/IContextFormatter';
import type { ISessionCaptureService } from '../../domain/interfaces/ISessionCaptureService';
import type { ITrailerService } from '../../domain/interfaces/ITrailerService';

export interface ICradle {
// Infrastructure
logger: ILogger;
notesService: INotesService;
gitClient: IGitClient;
memoryRepository: IMemoryRepository;
trailerService: ITrailerService;
triageService: IGitTriageService;
llmClient: ILLMClient | null;
eventBus: IEventBus;
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/infrastructure/di/container.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('createContainer', () => {
assert.ok(cradle.notesService);
assert.ok(cradle.gitClient);
assert.ok(cradle.memoryRepository);
assert.ok(cradle.trailerService);
assert.ok(cradle.eventBus);
assert.ok(cradle.triageService);
assert.ok(cradle.memoryService);
Expand Down Expand Up @@ -162,6 +163,22 @@ describe('createContainer', () => {
});
});

describe('trailerService', () => {
it('should resolve with expected interface', () => {
const container = createContainer();
const { trailerService } = container.cradle;

assert.equal(typeof trailerService.readTrailers, 'function');
assert.equal(typeof trailerService.formatTrailers, 'function');
assert.equal(typeof trailerService.queryTrailers, 'function');
});

it('should return singleton within container scope', () => {
const container = createContainer();
assert.equal(container.cradle.trailerService, container.cradle.trailerService);
});
});

describe('hook services', () => {
it('should resolve hook services with expected interfaces', () => {
const container = createContainer();
Expand Down
Loading