CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-linear--sdk

The Linear Client SDK for interacting with the Linear GraphQL API

Overview
Eval results
Files

project-management.mddocs/

Project Management

Project operations for creating, managing, and tracking Linear projects and initiatives, including project updates and status reporting.

Capabilities

Project Queries

Query individual projects or collections with filtering and pagination support.

/**
 * Get a single project by ID
 * @param id - The project ID
 * @returns Promise resolving to the project
 */
project(id: string): LinearFetch<Project>;

/**
 * Get a paginated list of projects with optional filtering
 * @param variables - Query parameters including filters and pagination
 * @returns Promise resolving to a connection of projects
 */
projects(variables?: ProjectsQueryVariables): LinearFetch<ProjectConnection>;

interface ProjectsQueryVariables extends LinearConnectionVariables {
  /** Filter conditions for projects */
  filter?: ProjectFilter;
  /** Sort order for projects */
  orderBy?: PaginationOrderBy;
  /** Include archived projects */
  includeArchived?: boolean;
}

interface ProjectFilter {
  /** Filter by name */
  name?: StringFilter;
  /** Filter by slug */
  slugId?: StringFilter;
  /** Filter by state */
  state?: ProjectStatusFilter;
  /** Filter by creator */
  creator?: UserFilter;
  /** Filter by lead */
  lead?: NullableUserFilter;
  /** Filter by members */
  members?: UserCollectionFilter;
  /** Filter by teams */
  accessibleTeams?: TeamCollectionFilter;
  /** Filter by creation date */
  createdAt?: DateTimeFilter;
  /** Filter by update date */
  updatedAt?: DateTimeFilter;
  /** Filter by target date */
  targetDate?: NullableDateTimeFilter;
  /** Combine filters with AND logic */
  and?: ProjectFilter[];
  /** Combine filters with OR logic */
  or?: ProjectFilter[];
}

Usage Examples:

import { LinearClient } from "@linear/sdk";

const client = new LinearClient({ apiKey: "your-api-key" });

// Get a single project
const project = await client.project("project-id");
console.log(project.name);

// Get active projects
const activeProjects = await client.projects({
  filter: {
    state: { type: { eq: "started" } }
  }
});

// Get projects by lead
const myProjects = await client.projects({
  filter: {
    lead: { isMe: { eq: true } }
  }
});

Project Mutations

Create, update, archive, and manage projects with comprehensive configuration options.

/**
 * Create a new project
 * @param input - Project creation data
 * @returns Promise resolving to the creation result
 */
createProject(input: ProjectCreateInput): LinearFetch<ProjectPayload>;

/**
 * Update an existing project
 * @param id - The project ID to update
 * @param input - Project update data
 * @returns Promise resolving to the update result
 */
updateProject(id: string, input: ProjectUpdateInput): LinearFetch<ProjectPayload>;

/**
 * Archive a project
 * @param id - The project ID to archive
 * @returns Promise resolving to the archive result
 */
archiveProject(id: string): LinearFetch<ArchivePayload>;

/**
 * Unarchive a project
 * @param id - The project ID to unarchive
 * @returns Promise resolving to the unarchive result
 */
unarchiveProject(id: string): LinearFetch<ArchivePayload>;

interface ProjectCreateInput {
  /** Project name */
  name: string;
  /** Project description */
  description?: string;
  /** Project slug for URLs */
  slugId?: string;
  /** Project status */
  state?: string;
  /** Project lead user ID */
  leadId?: string;
  /** Member user IDs */
  memberIds?: string[];
  /** Team IDs with access */
  teamIds: string[];
  /** Target completion date */
  targetDate?: DateTime;
  /** Icon to represent the project */
  icon?: string;
  /** Color for the project */
  color?: string;
  /** Project priority */
  priority?: number;
  /** Initiative ID to associate with */
  initiativeId?: string;
}

interface ProjectUpdateInput {
  /** Update project name */
  name?: string;
  /** Update project description */
  description?: string;
  /** Update project slug */
  slugId?: string;
  /** Update project status */
  state?: string;
  /** Update project lead */
  leadId?: string;
  /** Update project members */
  memberIds?: string[];
  /** Update team access */
  teamIds?: string[];
  /** Update target date */
  targetDate?: DateTime;
  /** Update project icon */
  icon?: string;
  /** Update project color */
  color?: string;
  /** Update project priority */
  priority?: number;
}

Usage Examples:

// Create a new product project
const newProject = await client.createProject({
  name: "Mobile App Redesign",
  description: "Complete redesign of the mobile application",
  state: "planned",
  leadId: "user-project-manager",
  teamIds: ["team-design", "team-mobile"],
  targetDate: "2024-12-01",
  color: "#3b82f6"
});

// Update project status and add team
const updatedProject = await client.updateProject("project-id", {
  state: "started",
  teamIds: ["team-design", "team-mobile", "team-backend"]
});

Project Updates

Manage project status updates and progress reports.

/**
 * Get project updates with filtering and pagination
 * @param variables - Query parameters
 * @returns Promise resolving to a connection of project updates
 */
projectUpdates(variables?: ProjectUpdatesQueryVariables): LinearFetch<ProjectUpdateConnection>;

/**
 * Create a project update
 * @param input - Project update creation data
 * @returns Promise resolving to the creation result
 */
createProjectUpdate(input: ProjectUpdateCreateInput): LinearFetch<ProjectUpdatePayload>;

/**
 * Update a project update
 * @param id - The project update ID to update
 * @param input - Project update modification data
 * @returns Promise resolving to the update result
 */
updateProjectUpdate(id: string, input: ProjectUpdateUpdateInput): LinearFetch<ProjectUpdatePayload>;

/**
 * Delete a project update
 * @param id - The project update ID to delete
 * @returns Promise resolving to the deletion result
 */
deleteProjectUpdate(id: string): LinearFetch<DeletePayload>;

interface ProjectUpdateCreateInput {
  /** Associated project ID */
  projectId: string;
  /** Update body content */
  body: string;
  /** Health status of the project */
  health?: ProjectUpdateHealthType;
  /** Update diff from previous state */
  diff?: string;
  /** Diff markdown content */
  diffMarkdown?: string;
}

enum ProjectUpdateHealthType {
  OnTrack = "onTrack",
  AtRisk = "atRisk",
  OffTrack = "offTrack"
}

Initiative Management

Manage initiatives that group related projects and work streams.

/**
 * Get initiatives with filtering and pagination
 * @param variables - Query parameters
 * @returns Promise resolving to a connection of initiatives
 */
initiatives(variables?: InitiativesQueryVariables): LinearFetch<InitiativeConnection>;

/**
 * Get a single initiative by ID
 * @param id - The initiative ID
 * @returns Promise resolving to the initiative
 */
initiative(id: string): LinearFetch<Initiative>;

/**
 * Create a new initiative
 * @param input - Initiative creation data
 * @returns Promise resolving to the creation result
 */
createInitiative(input: InitiativeCreateInput): LinearFetch<InitiativePayload>;

/**
 * Update an initiative
 * @param id - The initiative ID to update
 * @param input - Initiative update data
 * @returns Promise resolving to the update result
 */
updateInitiative(id: string, input: InitiativeUpdateInput): LinearFetch<InitiativePayload>;

interface InitiativeCreateInput {
  /** Initiative name */
  name: string;
  /** Initiative description */
  description?: string;
  /** Initiative status */
  status?: InitiativeStatus;
  /** Target completion date */
  targetDate?: DateTime;
}

enum InitiativeStatus {
  Planned = "planned",
  Started = "started",
  Paused = "paused",
  Completed = "completed",
  Canceled = "canceled"
}

Core Project Types

/** Project model representing a Linear project */
class Project extends Request {
  /** Unique project identifier */
  id: string;
  /** Project name */
  name: string;
  /** Project description */
  description: string;
  /** Project URL slug */
  slugId: string;
  /** Project state/status */
  state: string;
  /** Project progress (0-1) */
  progress: number;
  /** Project icon */
  icon?: string;
  /** Project color */
  color: string;
  /** Project priority */
  priority: number;
  /** Target completion date */
  targetDate?: DateTime;
  /** Project lead user */
  lead?: User;
  /** Project creator */
  creator: User;
  /** Project members */
  members: UserConnection;
  /** Teams with access to project */
  teams: TeamConnection;
  /** Issues in this project */
  issues: IssueConnection;
  /** Project updates */
  projectUpdates: ProjectUpdateConnection;
  /** Associated initiative */
  initiative?: Initiative;
  /** Creation timestamp */
  createdAt: DateTime;
  /** Last update timestamp */
  updatedAt: DateTime;
  /** Completion timestamp */
  completedAt?: DateTime;
  /** Archive timestamp */
  archivedAt?: DateTime;
}

/** Project update model */
class ProjectUpdate extends Request {
  /** Unique update identifier */
  id: string;
  /** Update body content */
  body: string;
  /** Project health status */
  health: ProjectUpdateHealthType;
  /** Associated project */
  project: Project;
  /** Update author */
  user: User;
  /** Update diff content */
  diff?: string;
  /** Diff in markdown format */
  diffMarkdown: string;
  /** Creation timestamp */
  createdAt: DateTime;
  /** Last update timestamp */
  updatedAt: DateTime;
}

/** Initiative model */
class Initiative extends Request {
  /** Unique initiative identifier */
  id: string;
  /** Initiative name */
  name: string;
  /** Initiative description */
  description?: string;
  /** Initiative status */
  status: InitiativeStatus;
  /** Target completion date */
  targetDate?: DateTime;
  /** Associated projects */
  projects: ProjectConnection;
  /** Creation timestamp */
  createdAt: DateTime;
  /** Last update timestamp */
  updatedAt: DateTime;
}

/** Response payload for project mutations */
interface ProjectPayload {
  /** The mutated project */
  project?: Project;
  /** Whether the mutation was successful */
  success: boolean;
  /** Last sync ID */
  lastSyncId: number;
}

/** Paginated connection of projects */
class ProjectConnection extends Connection<Project> {
  /** Projects in this page */
  nodes: Project[];
  /** Pagination information */
  pageInfo: PageInfo;
}

Install with Tessl CLI

npx tessl i tessl/npm-linear--sdk

docs

comments-attachments.md

core-client.md

error-handling.md

index.md

issue-management.md

pagination-connections.md

project-management.md

team-user-management.md

webhook-processing.md

workflow-cycle-management.md

tile.json