Skip to content

Instantly share code, notes, and snippets.

@Jonahbkerr
Created February 23, 2026 01:26
Show Gist options
  • Select an option

  • Save Jonahbkerr/89d79185d836bf7b39b05fae5a8a1db7 to your computer and use it in GitHub Desktop.

Select an option

Save Jonahbkerr/89d79185d836bf7b39b05fae5a8a1db7 to your computer and use it in GitHub Desktop.
types.ts for Replit deploy
export interface User {
id: string;
email: string;
name: string;
avatar_url: string | null;
provider: 'github' | 'google' | 'okta' | 'apple' | 'internal';
provider_id: string;
organization_id: string | null;
created_at: Date;
last_login: Date | null;
}
export interface OrgMember {
id: string;
organization_id: string;
user_id: string;
role: 'owner' | 'admin' | 'member';
joined_at: Date;
invited_by: string | null;
}
export interface Thread {
id: string;
repo: string;
branch: string;
commit_hash: string | null;
context_type: 'code' | 'ui';
// Code context
file_path: string | null;
line_start: number | null;
line_end: number | null;
code_snippet: string | null;
// UI context
selector: string | null;
xpath: string | null;
coordinates: Coordinates | null;
screenshot_url: string | null;
element_tag: string | null;
element_text: string | null;
view_context: ViewContext | null;
element_context: ElementContextData | null;
page_url: string | null;
// Metadata
status: 'open' | 'resolved';
priority: 'low' | 'normal' | 'high' | 'critical';
tags: string[];
// Audit
created_by: string;
resolved_by: string | null;
created_at: Date;
updated_at: Date;
resolved_at: Date | null;
// Jira integration
jira_issue_id: string | null;
jira_issue_key: string | null;
jira_status: string | null;
jira_status_category: 'new' | 'indeterminate' | 'done' | null;
// Linear integration
linear_issue_id: string | null;
linear_issue_identifier: string | null;
// PR tracking (set by MCP server)
pr_number: number | null;
pr_url: string | null;
pr_branch: string | null;
// Working branch tracking
fix_commit_sha: string | null;
working_branch_id: string | null;
// Denormalized first message (avoids N+1 subquery in thread listing)
first_message_content: string | null;
// Iteration tracking
parent_thread_id: string | null;
iteration_type: 'refinement' | 'revision' | null;
iteration_number: number | null;
// Attached elements
attached_elements: any[] | null;
}
export interface Coordinates {
x: number;
y: number;
width?: number;
height?: number;
}
export interface ViewContext {
hash?: string;
pathname?: string;
activeTabs?: string[];
activeModal?: string | null;
}
export interface ElementContextData {
full_selector?: string;
dom_path?: string[];
bounding_box?: { x: number; y: number; w: number; h: number };
attributes?: Record<string, string>;
computed_styles?: Record<string, string>;
framework_hints?: { frameworkGuess: string; devServer: string };
class_list?: string[];
page?: {
url: string;
title: string;
viewport: { w: number; h: number };
devicePixelRatio: number;
};
}
export interface Message {
id: string;
thread_id: string;
author_id: string;
content: string;
parent_message_id: string | null;
mentions: string[];
attachments: Attachment[] | null;
author_display_name: string | null;
created_at: Date;
updated_at: Date;
edited: boolean;
}
export interface Attachment {
url: string;
type: string;
name: string;
size?: number;
}
export interface Permission {
id: string;
repo: string;
user_id: string | null;
team_id: string | null;
role: 'admin' | 'write' | 'read';
created_at: Date;
}
export interface ThreadSummary extends Thread {
creator_name: string;
creator_email: string;
creator_avatar: string | null;
message_count: number;
last_activity: Date | null;
}
export interface CreateThreadRequest {
repo: string;
branch: string;
commit_hash?: string;
context_type: 'code' | 'ui';
// Code context
file_path?: string;
line_start?: number;
line_end?: number;
code_snippet?: string;
// UI context
selector?: string;
xpath?: string;
coordinates?: Coordinates;
screenshot_url?: string;
screenshot?: string; // Base64 data URL
element_tag?: string;
element_text?: string;
view_context?: ViewContext;
element_context?: ElementContextData;
// Initial message
message: string;
// Optional metadata
priority?: 'low' | 'normal' | 'high' | 'critical';
tags?: string[];
// Attached elements
attached_elements?: any[];
}
export interface CreateMessageRequest {
content: string;
parent_message_id?: string;
author_display_name?: string;
}
export interface UpdateThreadRequest {
status?: 'open' | 'resolved';
priority?: 'low' | 'normal' | 'high' | 'critical';
tags?: string[];
coordinates?: { x: number; y: number };
selector?: string;
view_context?: ViewContext;
pr_number?: number;
pr_url?: string;
pr_branch?: string;
fix_commit_sha?: string;
working_branch_id?: string;
claude_code_pending?: boolean;
}
import { Request } from 'express';
export interface AuthenticatedRequest extends Request {
user?: User;
}
export interface JWTPayload {
id: string;
email: string;
name: string;
}
export interface WebSocketMessage {
type: 'subscribe' | 'unsubscribe' | 'thread:created' | 'thread:updated' | 'message:added';
data?: any;
repo?: string;
branch?: string;
}
export interface UserPermission {
user_id: string;
email: string;
repo: string;
role: 'admin' | 'write' | 'read';
source: string;
}
export interface Notification {
id: string;
user_id: string;
thread_id: string | null;
message_id: string | null;
type: 'mention' | 'reply' | 'resolved' | 'assigned' | 'pr_created' | 'pr_approved';
content: string;
read: boolean;
created_at: Date;
read_at: Date | null;
}
export interface AuditLog {
id: string;
user_id: string | null;
action: string;
resource_type: string;
resource_id: string | null;
metadata: Record<string, any> | null;
ip_address: string | null;
user_agent: string | null;
created_at: Date;
}
export interface Organization {
id: string;
name: string;
slug: string;
logo_url: string | null;
contact_name: string | null;
contact_email: string | null;
status: 'active' | 'suspended' | 'churned';
notes: string | null;
created_at: Date;
updated_at: Date;
// SSO fields
sso_provider: 'okta' | null;
sso_enabled: boolean;
sso_enforce_only: boolean;
sso_email_domain: string | null;
}
export interface SSOConfig {
provider: 'okta';
okta_domain: string;
client_id: string;
client_secret: string;
}
export interface Plan {
id: string;
name: string;
slug: string;
max_repos: number | null;
max_users: number | null;
max_teams: number | null;
price_monthly: number;
price_yearly: number;
features: Record<string, any>;
sort_order: number;
is_active: boolean;
created_at: Date;
}
export interface Subscription {
id: string;
organization_id: string;
plan_id: string;
status: 'active' | 'past_due' | 'cancelled' | 'trial';
billing_cycle: 'monthly' | 'yearly';
started_at: Date;
expires_at: Date | null;
cancelled_at: Date | null;
notes: string | null;
created_at: Date;
updated_at: Date;
}
// --- Jira integration types ---
export interface JiraConfig {
site_url: string;
user_email: string;
api_token: string;
}
export interface JiraProjectMapping {
id: string;
organization_id: string;
repo: string;
jira_project_key: string;
jira_issue_type: string;
sync_enabled: boolean;
pr_transition_status: string | null;
created_at: Date;
updated_at: Date;
}
export interface WorkingBranch {
id: string;
repo: string;
base_branch: string;
branch_name: string;
pr_number: number | null;
pr_url: string | null;
status: 'active' | 'merged' | 'closed';
head_sha: string | null;
thread_count: number;
description: string | null;
approval_status: 'pending' | 'approved';
approved_by: string | null;
approved_at: Date | null;
created_at: Date;
updated_at: Date;
}
export interface JiraSyncLogEntry {
id: string;
thread_id: string | null;
jira_issue_id: string | null;
direction: 'to_jira' | 'from_jira';
event_type: string;
status: 'success' | 'failed' | 'skipped';
metadata: Record<string, any> | null;
created_at: Date;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment