A reference of every file in the Linearis codebase, organized by architectural layer.
- src/main.ts -- CLI setup with Commander.js. Registers all command groups and parses global options.
Thin wrappers around the Linear API. No business logic.
- graphql-client.ts --
GraphQLClientclass with a typedrequest<TResult>(document: DocumentNode, variables?: Record<string, unknown>)method for direct GraphQL execution. - linear-client.ts --
LinearSdkClientwrapper exposing a readonlysdk: LinearClientproperty for SDK-based lookups.
Each resolver converts a human-friendly identifier (name, key, or slug) into a UUID. Resolvers use LinearSdkClient exclusively.
- team-resolver.ts --
resolveTeamId(client, keyOrNameOrId) - project-resolver.ts --
resolveProjectId(client, nameOrId) - label-resolver.ts --
resolveLabelId(client, nameOrId),resolveLabelIds(client, namesOrIds) - cycle-resolver.ts --
resolveCycleId(client, nameOrId, teamFilter?) - status-resolver.ts --
resolveStatusId(client, nameOrId, teamId?) - issue-resolver.ts --
resolveIssueId(client, issueIdOrIdentifier) - milestone-resolver.ts --
resolveMilestoneId(gqlClient, sdkClient, nameOrId, projectNameOrId?)
Business logic and CRUD operations. Services use GraphQLClient exclusively and accept pre-resolved UUIDs.
- issue-service.ts --
listIssues,getIssue,searchIssues,createIssue,updateIssue - document-service.ts --
getDocument,createDocument,updateDocument,listDocuments,deleteDocument - attachment-service.ts --
createAttachment,deleteAttachment,listAttachments - milestone-service.ts --
listMilestones,getMilestone,createMilestone,updateMilestone - cycle-service.ts --
listCycles,getCycle - team-service.ts --
listTeams - user-service.ts --
listUsers - project-service.ts --
listProjects - label-service.ts --
listLabels - comment-service.ts --
createComment - file-service.ts -- File upload and download operations for Linear uploads
CLI orchestration. Each file registers a command group via a setup*Commands(program) function. Commands use createContext() to obtain both clients, call resolvers for ID conversion, then delegate to services.
- auth.ts --
auth login,auth status,auth logout— interactive authentication (for humans) - issues.ts --
issue list,issue search,issue read,issue create,issue update - documents.ts -- Document commands with attachment support
- project-milestones.ts -- Milestone CRUD commands
- cycles.ts -- Cycle listing and detail reading
- teams.ts -- Team listing
- users.ts -- User listing
- projects.ts -- Project listing
- labels.ts -- Label listing
- comments.ts -- Comment creation
- embeds.ts -- File download from Linear upload URLs
Shared utilities used across all layers.
- context.ts --
CommandContextinterface andcreateContext()factory that produces bothGraphQLClientandLinearSdkClient. - auth.ts --
resolveApiToken()with multi-source lookup:--api-tokenflag,LINEAR_API_TOKENenv var,~/.linearis/token(encrypted),~/.linear_api_token(deprecated). - token-storage.ts --
saveToken(),getStoredToken(),clearToken()for encrypted token storage in~/.linearis/token. - encryption.ts -- AES-256-CBC encryption for token storage.
- output.ts --
outputSuccess(),outputError(), andhandleCommand()wrapper for consistent JSON output and error handling. - errors.ts --
notFoundError(),multipleMatchesError(),invalidParameterError(),requiresParameterError(). - identifier.ts --
isUuid(),parseIssueIdentifier(),tryParseIssueIdentifier(). - types.ts -- Type aliases derived from codegen output (e.g.,
Issue,IssueDetail,Document). - embed-parser.ts --
extractEmbeds(),isLinearUploadUrl(),extractFilenameFromUrl()for parsing embedded files in markdown content. - usage.ts -- Token-optimized two-tier usage system with
DomainMetainterface,formatOverview()for tier 1 (all domains), andformatDomainUsage()for tier 2 (domain detail). Generates USAGE.md via build pipeline.
Auto-generated by GraphQL Code Generator. Do not edit these files manually.
- graphql.ts -- All generated TypeScript types and
DocumentNodeexports. - gql.ts -- Generated helper functions.
- fragment-masking.ts -- Fragment masking support.
- index.ts -- Barrel export.
Source .graphql files that feed into code generation.
queries/issues.graphqlqueries/documents.graphqlqueries/attachments.graphqlqueries/cycles.graphqlqueries/project-milestones.graphql
mutations/issues.graphqlmutations/documents.graphqlmutations/attachments.graphqlmutations/files.graphqlmutations/project-milestones.graphql
Unit tests mirror the source structure. Resolver tests mock the SDK client; service tests mock the GraphQL client; common tests require no mocks.
tests/unit/
resolvers/ # e.g., team-resolver.test.ts
services/ # e.g., issue-service.test.ts
common/ # e.g., identifier.test.ts
- package.json -- Project metadata, dependencies, and scripts. Requires Node.js >= 22.
- package-lock.json -- Dependency lock file.
- tsconfig.json -- TypeScript settings (ES2023 target, strict mode, ES modules).
- codegen.config.ts -- GraphQL Code Generator configuration.
- vitest.config.ts -- Test runner configuration.
- architecture.md -- Architecture overview and layer contracts
- build-system.md -- Build and compilation details
- deployment.md -- Deployment guide
- development.md -- Development patterns and workflows
- files.md -- This file
- performance.md -- Performance considerations
- project-overview.md -- High-level project summary
- testing.md -- Testing approach and conventions
- Linear-API@current.graphql -- Linear GraphQL API schema reference
CLI Input --> Command --> Resolver --> Service --> JSON Output
| | |
createContext() SDK GraphQL
(name->UUID) (CRUD)
Resolvers convert human-friendly identifiers to UUIDs exactly once. Services operate solely on UUIDs. Commands tie the pieces together.