TypeScript type definitions for Codmir
@codmir/types
TypeScript type definitions used across all Codmir packages.
Installation
npm install @codmir/types
# or included in @codmir/sdkCore Types
Events
import type {
CodmirEvent,
EventType,
EventPayload,
} from '@codmir/types';
// Base event structure
interface CodmirEvent<T = unknown> {
id: string;
type: string;
timestamp: string;
actor: Actor;
session: Session;
payload: T;
meta?: EventMeta;
}Projects
import type { Project, ProjectSettings } from '@codmir/types';
interface Project {
id: string;
name: string;
organizationId: string;
gitRemote?: string;
defaultBranch?: string;
settings: ProjectSettings;
createdAt: string;
updatedAt: string;
}Tickets
import type { Ticket, TicketStatus, TicketPriority } from '@codmir/types';
interface Ticket {
id: string;
projectId: string;
title: string;
description?: string;
status: TicketStatus;
priority: TicketPriority;
assigneeId?: string;
labels: string[];
createdAt: string;
updatedAt: string;
}
type TicketStatus = 'open' | 'in_progress' | 'review' | 'done' | 'closed';
type TicketPriority = 'low' | 'medium' | 'high' | 'critical';Chat
import type { ChatMessage, ChatRole, ChatContext } from '@codmir/types';
interface ChatMessage {
id: string;
role: ChatRole;
content: string;
context?: ChatContext;
createdAt: string;
}
type ChatRole = 'user' | 'assistant' | 'system';
interface ChatContext {
files?: string[];
repo?: string;
branch?: string;
ticketId?: string;
}CI/CD
import type {
CIWorkflow,
CIRun,
CIJob,
CIConclusion,
} from '@codmir/types';
interface CIRun {
id: number;
workflowId: number;
workflowName: string;
status: 'queued' | 'in_progress' | 'completed';
conclusion: CIConclusion;
branch: string;
commit: string;
startedAt: string;
completedAt?: string;
url: string;
}
type CIConclusion =
| 'success'
| 'failure'
| 'cancelled'
| 'skipped'
| 'timed_out';Users & Organizations
import type { User, Organization, Member } from '@codmir/types';
interface User {
id: string;
email: string;
name?: string;
avatarUrl?: string;
}
interface Organization {
id: string;
name: string;
slug: string;
plan: 'free' | 'pro' | 'enterprise';
}Utility Types
import type {
Paginated,
ApiResponse,
ApiError,
} from '@codmir/types';
// Paginated response
interface Paginated<T> {
data: T[];
total: number;
page: number;
pageSize: number;
hasMore: boolean;
}
// API response wrapper
interface ApiResponse<T> {
success: boolean;
data?: T;
error?: ApiError;
}Enums
import {
TicketStatus,
TicketPriority,
CIProvider,
EventCategory,
} from '@codmir/types';Type Guards
import {
isCIEvent,
isTicketEvent,
isAgentEvent,
} from '@codmir/types';
if (isCIEvent(event)) {
// event.payload is typed as CIPayload
console.log(event.payload.workflowName);
}Next Steps
- SDK Reference - Using types with SDK
- Events - Event type definitions