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

git-workspace-hook-tmux

v0.2.1

Published

Manage detached tmux sessions with git workspace command hooks

Readme

git-workspace-hook-tmux

Detached tmux sessions for git-workspace-bare. Add a checkout and its session is ready; rename it and keep your running programs; remove it and close its session.

Installation

Requires tmux on PATH, Bare, and a version of git-workspace-bare supporting post hooks. Install the published package from npm:

npm install -g bare git-workspace-hook-tmux

Verify that git-workspace discovers the installed hooks:

git workspace hook list

The package installs three executables on PATH:

git-workspace-hook-add-post-tmux
git-workspace-hook-remove-post-tmux
git-workspace-hook-rename-post-tmux

git-workspace discovers them automatically. There is no workspace configuration or registration step. Uninstall the package to disable the integration, or use git workspace <command> --no-hooks to skip hooks for one invocation.

Behavior

  • Add: create a detached session starting in each existing, registered checkout. An implicit root and its worktree each get a session. Repeating add restores a missing session, even when the checkout itself was unchanged.
  • Rename: follow each checkout that actually moved, preserving its session, windows, panes, and running programs. Update the session name and checkout metadata. If its session is missing, create one in the new directory.
  • Remove: kill the owned session when its checkout is gone, including when a later step failed. This terminates every pane and program in that session. If removal failed and the checkout remains, keep the session.

Hooks never attach to a session or switch your client. Attach when you want:

tmux attach-session -t '=nicolasfont/git-workspace-hook-tmux'

Sessions are named after the checkout, such as owner/repo or owner/repo@topic/one. Dots, colons, and whitespace become underscores to avoid tmux name restrictions. If a name is already occupied, append the stable checkout ID (and a counter if necessary).

On add or rename, an existing session with no workspace metadata is adopted when both its readable name and tmux's session starting directory match the checkout. Rename also checks the previous name and directory, so an older session can be adopted while its checkout moves. Adoption adds the manifest checkout's stable ID and workspace metadata, preserving all windows, panes, and running programs. Later renames and removals manage it just like a session created by the hook.

An existing session already owned by the checkout takes precedence. Sessions with partial metadata or belonging to another workspace are not adopted. If multiple unmarked sessions match the before/after snapshots, none is adopted. A name match alone is insufficient: unrelated sessions keep their collision protection. Remove never adopts an unmarked session just to kill it.

Ownership uses the workspace root and stable checkout ID, rather than the session name. Shared manifest IDs in a second local workspace do not claim the first workspace's sessions. Unregistered worktrees with no stable ID are ignored. Partial command results are handled using the actual before/after snapshots. Repeated delivery, including resumed pull operations, is safe.

The integration uses tmux's normal server selection, including an inherited TMUX environment variable, and your normal tmux configuration. Keep add/remove/rename on the same server to manage the same sessions. A missing server starts on add/rename and is a successful no-op on removal. Other tmux errors make the hook fail; git-workspace warns and preserves the original command's result.

Session metadata

These are local session options, available as tmux formats:

| Option | Value | | -------------------------- | ------------------------------ | | @git-workspace-hook-tmux | 1, the ownership marker | | @git-workspace-root | Absolute workspace root | | @git-workspace-id | Stable checkout ID | | @git-workspace-name | Current checkout name | | @git-workspace-path | Current absolute checkout path |

Renaming updates the path metadata without sending commands into your running shells or changing tmux's original session_path. To open new windows in the checkout's current directory after a rename, you can use this optional tmux binding:

bind-key c new-window -c '#{?@git-workspace-path,#{@git-workspace-path},#{pane_current_path}}'

This falls back to the current pane directory in other sessions. The package does not edit your tmux configuration.

As with git-workspace hooks generally, delivery is not transactional with tmux. An interrupted creation can leave an unmarked session; it remains untouched on retry. Re-running add can restore missing sessions. Installing the package does not scan existing checkouts until their commands run.

Development

Install dependencies and link this checkout to try local changes:

npm install
npm link

Run the checks:

npm test
npm run lint
npx prettier . --check

Tests require tmux and run against separate temporary sockets with /dev/null as their configuration. They do not use your live server. Tests cover stdin/argv, detached creation, root/worktree renames with running panes, removals, name collisions, ownership, partial failures, and repeated delivery.

License

Apache-2.0