npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@triargos/effect-linear

v0.0.4

Published

> ⚠️ **Work in Progress** - This package is nowhere near complete and things are still changing rapidly. APIs may break without notice.

Downloads

27

Readme

@triargos/effect-linear

⚠️ Work in Progress - This package is nowhere near complete and things are still changing rapidly. APIs may break without notice.

An Effect-based TypeScript client for the Linear API, providing type-safe and composable operations.

Installation

npm install @triargos/effect-linear effect
# or
pnpm add @triargos/effect-linear effect
# or
yarn add @triargos/effect-linear effect

Basic Usage

Environment Configuration

This package uses the Effect config system to manage the Linear API key. By default, the environment config provider is used, but any config provider that provides a LINEAR_API_KEY will work.

Set your Linear API key as an environment variable:

export LINEAR_API_KEY="your_api_key_here"

Simple Example

import { LinearClient } from "@triargos/effect-linear";
import { Effect } from "effect";

const program = Effect.gen(function* () {
  const client = yield* LinearClient;
  const triageResponsibilities = yield* client.triageResponsibilities.list();
  console.log(`Found ${triageResponsibilities.length} triage responsibilities`);
  return triageResponsibilities;
});

const runnable = Effect.provide(program, LinearClient.layerConfig());
Effect.runPromise(runnable);

Using Explicit API Key

Use this approach when your API key comes from somewhere other than environment variables (e.g., a configuration file, database, or secrets manager).

import { LinearClient } from "@triargos/effect-linear";
import { Effect, Redacted } from "effect";

const program = Effect.gen(function* () {
  const client = yield* LinearClient;
  const responsibilities = yield* client.triageResponsibilities.list();
  return responsibilities;
});

const runnable = Effect.provide(
  program,
  LinearClient.layer({ apiKey: Redacted.make("your_api_key_here") })
);

Effect.runPromise(runnable);

Reading API Key from Configuration File

import { LinearClient } from "@triargos/effect-linear";
import { Effect, Layer, Redacted, Schema } from "effect";
import { FileSystem } from "@effect/platform";
import { NodeFileSystem } from "@effect/platform-node";

const ConfigSchema = Schema.Struct({
  linearApiKey: Schema.String,
});

const ConfigLayer = Layer.unwrapEffect(
  Effect.gen(function* () {
    const fs = yield* FileSystem.FileSystem;
    
    const configContent = yield* fs.readFileString("config.json");
    const config = yield* Schema.decodeUnknown(
      Schema.parseJson(ConfigSchema)
    )(configContent);
    
    return LinearClient.layer({ 
      apiKey: Redacted.make(config.linearApiKey) 
    });
  })
).pipe(Layer.provide(NodeFileSystem.layer));

const program = Effect.gen(function* () {
  const client = yield* LinearClient;
  const responsibilities = yield* client.triageResponsibilities.list();
  return responsibilities;
});

const runnable = Effect.provide(program, ConfigLayer);
Effect.runPromise(runnable);

Error Handling

This package returns wrapped errors that enhance the base Linear API errors with additional context (such as operation-specific IDs, team IDs, or input parameters). This provides better debugging information and error traceability.

If you need to access the underlying Linear API error (for example, to handle specific error types like rate limits or authentication failures), use the getLinearErrorCause helper:

import { LinearClient } from "@triargos/effect-linear";
import { 
  LinearAuthenticationError,
  LinearRateLimitError,
  getLinearErrorCause
} from "@triargos/effect-linear/errors";
import { Effect } from "effect";

const program = Effect.gen(function* () {
  const client = yield* LinearClient;
  return yield* client.triageResponsibilities.list();
});

// Handle specific Linear API error types with catchTag
const safeProgram = program.pipe(
  Effect.mapError(getLinearErrorCause),
  Effect.catchTag("LinearRateLimitError", (error) => {
    console.error("Rate limit exceeded, retry after:", error.retryAfter);
    return Effect.succeed([]);
  }),
  Effect.catchTag("LinearAuthenticationError", (error) => {
    console.error("Authentication failed:", error.message);
    return Effect.succeed([]);
  })
);

const runnable = Effect.provide(safeProgram, LinearClient.layerConfig());

Error Types

The package exports various error types for different scenarios:

  • LinearAuthenticationError - API key issues
  • LinearForbiddenError - If the permission is denied or the user does not have access to a specific feature
  • LinearInternalError - Internal or unknown errors that can occur
  • LinearInvalidInputError - Invalid request parameters
  • LinearRateLimitError - Rate limiting

Development Status

This package is in early development. Current features:

  • ✅ Basic Linear client setup
  • ✅ Triage responsibility management
  • ❌ Issue management (planned)
  • ❌ Project management (planned)
  • ❌ Comment management (planned)
  • ❌ Webhook support (planned)

Contributing

This is a work-in-progress package. APIs are subject to change without notice until we reach a stable release.