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

@feniix/worktrees-core

v1.1.1

Published

TypeScript-first ESM library for git worktree primitives, validation, and higher-level workspace workflows

Readme

@feniix/worktrees-core

TypeScript-first library for git worktree primitives, validation, and higher-level workspace workflows.

Features

  • Git worktree primitives for listing, creating, removing, and pruning worktrees
  • Higher-level workspace workflows built on top of reusable primitives
  • Planning and validation helpers so callers can inspect operations before mutating state
  • Typed domain errors for unsafe operations and Git subprocess failures
  • Reusable branch naming helpers and policies

Install

npm install @feniix/worktrees-core

Requirements

  • Node.js >= 22
  • git available on PATH

The published package ships compiled ESM in dist/ plus .d.ts declaration files for TypeScript consumers.

Module format

This package is ESM-only.

  • ESM consumers can import it normally.
  • CommonJS consumers must use dynamic import() instead of require().

Stability and support

This package is now stable.

The semver-stable contract is:

  • the curated root export surface
  • exported option/result/type shapes
  • documented behavior in this README and docs/api.md

The following are not part of the stable contract:

  • internal modules
  • implementation details
  • exact error message wording

Quick start

import { defaultWorktreeRoot, listWorktrees, prepareWorkspace } from "@feniix/worktrees-core";

const cwd = process.cwd();
const worktrees = listWorktrees(cwd);

const workspace = prepareWorkspace({
  cwd,
  name: "login-flow",
  branchPrefix: "feature",
  from: "main",
  worktreeRoot: defaultWorktreeRoot(cwd),
});

console.log(workspace.directoryName); // "login-flow"
console.log(worktrees);
console.log(workspace);

Plan, validate, then execute

import { createWorktree, planPrepareWorkspace, validatePrepareWorkspace } from "@feniix/worktrees-core";

const cwd = process.cwd();
const planned = planPrepareWorkspace({
  cwd,
  name: "login-flow",
  branchPrefix: "feature",
  from: "main",
});

const validation = validatePrepareWorkspace({
  cwd,
  name: "login-flow",
  branchPrefix: "feature",
  from: "main",
});

if (!validation.valid) {
  console.error(validation.issues);
} else {
  const worktree = createWorktree({
    cwd,
    path: planned.path,
    branch: planned.branch,
    from: "main",
  });

  console.log(worktree);
}

Core concepts

  • Worktree primitives expose low-level git/worktree operations.
  • Workspace workflows compose naming, validation, and worktree creation into higher-level flows.
  • Validation helpers let callers inspect issues before attempting mutations.
  • Planning helpers make it easy to preview derived branch names and paths.
  • Error types expose stable WorktreesCoreError codes for validation failures and GitCommandError details for unexpected Git subprocess failures.
  • Force compatibility keeps force: true validation-skipping behavior for 1.x, emits a process warning, and offers validateOnForce: true to opt into the stricter 2.0 safety behavior now.
  • The release gate includes installed-package integration E2E checks against a packed tarball, not just repo-internal tests.

Documentation

License

MIT