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

fosh

v0.1.0

Published

Execute shell commands in multiple directories grouped by tags

Readme

Fosh: Execute shell commands in multiple directories grouped by tags

For developers who running the same command in different directories repeatedly, Fosh is a productivity tool that saves time by executing the command without having to change the directory. Unlike other similar tools, Fosh does not bound to a certain software (like Git for example), it can execute any shell command. It works at least on Windows and Linux.

  • Manage multiple Git repositors together
    • Checkout the same branch for project and its submodules
    • Commit with the same message: walk through the repos without interruption and copy / paste the same commit message
    • Prevent early push: you do not have to remember which repositories have modified, just look at them at the end of the day to see where you need to push
  • Control multiple vagrant machines at the same time

The essence of the code in a nutshell:

for(dir in selectedDirectories) {
  cd(dir);
  shellCommand();
}

This also means the name: for ... shell ... -> fosh.

Installation

$ npm install -g fosh

Get the source code, report bugs, open pull requests, or just star because you didn't know that you need it:

  • https://gitlab.com/bimlas/node-fosh (official repository)
  • https://github.com/bimlas/node-fosh (mirror, star if you like it)

Commands

Tag: Assign tags to directories

The tags can be specified as command-line parameters prefixed with @, directories should be listed in the prompt, or piped to stdin.

$ fosh tag "@pictures" "@personal"
fosh: tag > /home/myself/photos
fosh: tag > /home/mom/my_little_family

$ echo -e "/home/myself/photos \n /home/mom/my_little_family" | fosh tag "@pictures" "@personal"

Find Git repositories

Tagging Git repositories under the current directory (./) with "git-repos" tag:

# Linux / Windows Git Bash / ...
$ find "./" -name ".git" -printf "%h\n" | fosh tag "@git-repos"

# Windows PowerShell
$ Get-ChildItem './' -Recurse -Directory -Hidden -Filter '.git' | ForEach-Object { Split-Path $_.FullName -Parent } | fosh tag '@git-repos'

On Windows you can use Everything search engine's es command-line interface to find Git repositories rapidly. Use the following command in PowerShell for this (omit the path of the root directory (./src) to find everywhere):

$ es -regex '^\.git$' './src' | Split-Path -Parent | fosh tag '@git-repos'

List: Prints the path of the tag list file

You can edit it in a texteditor (Notepad, Vim, etc.).

Run: Execute commands in multiple directories

Arguments can be tags and paths.

$ fosh run "@git-repos" "../wip-project"
fosh: run > git status --short --branch

__ @1 awesome-project (/home/me/src/) ________________________________________
## master
AM README.md
 M package.json

__ @2 git-test (/home/me/src/) _______________________________________________
## master...origin/master
 M README.adoc
 M encoding/cp1250-encoding-dos-eol.txt
 M encoding/dos-eol.txt

__ @3 wip-project (/home/me/helping-tom/) ____________________________________
## master...origin/master
 M example-code.js

==============================================================================
fosh: run > another command and so on ...

Filtering the directory list

If you want to execute a command only in certain directories, you can select them by their index.

fosh: run > @1,3 git status --short --branch

__ @1 awesome-project (/home/me/src/) ________________________________________
## master
AM README.md
 M package.json

__ @3 wip-project (/home/me/helping-tom/) ____________________________________
## master...origin/master
 M example-code.js

Execute in the most recently used directories

This is useful if the output is long and you want to execute additional commands on certain directories. In this case, open a new terminal window (so you can look back at results in the current terminal) and run the program without arguments: the directory list is always stored when tag or directory arguments are given, but if you run it without arguments, it executes the commands on the last specified directories.

$ fosh run "@git-repos" "../wip-project"
fosh: run > git status --short --branch

__ @1 awesome-project (/home/me/src/) ________________________________________
## master
AM README.md
...

# Another terminal

$ fosh run
fosh: WARNING: Using most recently used directory list
fosh: run > @3 git diff

__ @3 wip-project (/home/me/helping-tom/) ____________________________________
 example-code.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/example-code.js b/example-code.js
index 12b5e40..733220f 100644
--- a/example-code.js
+++ b/example-code.js
...

FAQ

I use MinTTY on Windows and XY don't work or work differently

Under MinTTY (default terminal emulator of Git for Windows), it is not possible to identify exactly that stdin is a terminal or pipe (see https://duckduckgo.com/?q=MinTTY+is+not+a+TTY), so some things may work differently than in other terminals. Try using another terminal like system default, your IDE's builtin terminal, Conemu, Alacritty.

Similar projects

  • https://github.com/joowani/dtags
  • https://github.com/coderaiser/node-longrun
  • https://github.com/MamadouSy/fed
  • https://github.com/isacikgoz/gitbatch