mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
refactor: Address PR review feedback on shared packages
- Standardize vitest to v4.0.16 across all packages - Clean up type imports in events.ts (remove verbose inline casting) - Expand skipDirs to support Python, Rust, Go, PHP, Gradle projects - Document circular dependency prevention in @automaker/types - Add comprehensive error handling documentation to @automaker/git-utils 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,19 +2,21 @@
|
||||
* Event emitter for streaming events to WebSocket clients
|
||||
*/
|
||||
|
||||
import type { EventType, EventCallback } from "@automaker/types";
|
||||
|
||||
// Re-export event types from shared package
|
||||
export type { EventType, EventCallback } from "@automaker/types";
|
||||
export type { EventType, EventCallback };
|
||||
|
||||
export interface EventEmitter {
|
||||
emit: (type: import("@automaker/types").EventType, payload: unknown) => void;
|
||||
subscribe: (callback: import("@automaker/types").EventCallback) => () => void;
|
||||
emit: (type: EventType, payload: unknown) => void;
|
||||
subscribe: (callback: EventCallback) => () => void;
|
||||
}
|
||||
|
||||
export function createEventEmitter(): EventEmitter {
|
||||
const subscribers = new Set<import("@automaker/types").EventCallback>();
|
||||
const subscribers = new Set<EventCallback>();
|
||||
|
||||
return {
|
||||
emit(type: import("@automaker/types").EventType, payload: unknown) {
|
||||
emit(type: EventType, payload: unknown) {
|
||||
for (const callback of subscribers) {
|
||||
try {
|
||||
callback(type, payload);
|
||||
@@ -24,7 +26,7 @@ export function createEventEmitter(): EventEmitter {
|
||||
}
|
||||
},
|
||||
|
||||
subscribe(callback: import("@automaker/types").EventCallback) {
|
||||
subscribe(callback: EventCallback) {
|
||||
subscribers.add(callback);
|
||||
return () => {
|
||||
subscribers.delete(callback);
|
||||
|
||||
Reference in New Issue
Block a user