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

@effect-patterns/ep-shared-services

v1.0.1

Published

Shared services for Effect Patterns CLI tools

Downloads

121

Readme

@effect-patterns/ep-shared-services

Shared services for Effect Patterns CLI tools

Overview

This package provides shared services for Effect-TS based CLI tools including TUI, Logger, Display, and Execution services. The package eliminates code duplication and ensures consistent behavior across all CLI applications in the Effect Patterns ecosystem.

Services

  • 🖥️ TUI Service - Dynamic loading of effect-cli-tui with graceful fallbacks
  • 📝 Logger Service - Structured logging with multiple output formats and color support
  • 🖥️ Display Service - Output formatting with TUI adapter pattern for different CLI tools
  • Execution Service - Script execution with TUI spinner support and error handling

Quick Start

import { TUIService, Logger, Display, Execution } from "@effect-patterns/ep-shared-services";

// Use services in your CLI application
const logger = yield* Logger;
const display = yield* Display;
const execution = yield* Execution;

Documentation

Architecture

The shared services use the Effect.Service pattern for dependency injection and composability. Each service is designed to be:

  1. Composable: Services can be easily combined
  2. Testable: Services include comprehensive error handling
  3. Configurable: Services support runtime configuration
  4. Portable: Services work across different CLI tools

Service Dependencies

TUI → Logger → Console
Display → Logger → Console
Execution → Logger → Console

TUI Adapter Pattern

Services that need TUI functionality use the TUI adapter pattern:

export interface TUIAdapter {
  load: () => Effect.Effect<TUIDisplayMethods | null>;
}

This allows different CLI tools to provide their own TUI implementations while using a shared service interface.

Installation

npm install @effect-patterns/ep-shared-services

Usage Examples

Basic Service Usage

import { TUIService, Logger, Display, Execution } from "@effect-patterns/ep-shared-services";

// Load TUI module
const tuiModule = yield* TUIService.load();

// Check availability
const isAvailable = yield* TUIService.isAvailable();

// Log messages
yield* Logger.info("Application started");
yield* Logger.error("Error occurred");

// Display output
yield* Display.showSuccess("Operation completed");

Advanced Usage

// Script execution with TUI spinner
yield* Execution.executeScriptWithTUI(
  "./scripts/build.sh",
  "Building project...",
  { verbose: false }
);

// Capture script output
const output = yield* Execution.executeScriptCapture(
  "./scripts/test.sh",
  { timeout: 30000 }
);

// Wrap effects with spinner
const result = yield* Execution.withSpinner(
  "Processing data...",
  Effect.succeed("Processing complete"),
  { verbose: false }
);

Runtime Configuration

ep-admin

const ProductionLayer = Layer.mergeAll(
  FetchHttpClient.layer,
  NodeFileSystem.layer,
  Logger.Default,
  Layer.provide(Display.Default, Logger.Default),
  Layer.provide(Execution.Default, Logger.Default),
  StateStore.Default
);

ep-cli

const BaseLayer = Layer.mergeAll(
  FetchHttpClient.layer,
  layerNoop({ /* FileSystem methods */ }),
  LoggerLive(globalConfig),
  LiveTUILoader,
  StateStore.Default
);

const ServiceLayer = Layer.mergeAll(
  Linter.Default,
  Skills.Default,
  Display.Default,
  Layer.provide(Execution.Default, Logger.Default)
);

Development

Building

cd packages/ep-shared-services
npm run build

Testing

cd packages/ep-shared-services
npm test

Linting

cd packages/ep-shared-services
npm run lint

Contributing

  1. Follow Effect-TS patterns and conventions
  2. Maintain backward compatibility
  3. Add comprehensive tests
  4. Update documentation
  5. Consider impact on all consuming applications

License

This package is part of the Effect Patterns project and follows its licensing terms.

Changelog

See CHANGELOG.md for detailed version information and breaking changes.