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

@logickernel/pipe-inspector

v0.2.0

Published

Detect which components changed between semver tags in monorepo CI pipelines

Readme

Pipe Inspector

Detect which components changed between semver tags in monorepo CI pipelines.

In a monorepo with multiple components (each in its own directory), CI pipelines triggered by version tags have no reliable way to know which components actually changed. GitLab's rules: changes: doesn't work on tag pipelines, and GitHub Actions has similar limitations. Pipe Inspector fills this gap by comparing the current tag against the previous one using git diff, reporting exactly which paths have changes.

Designed to work alongside AgileFlow but compatible with any tag-based release workflow.

Installation

npm install -g @logickernel/pipe-inspector

Or run directly in CI without installing:

npx @logickernel/pipe-inspector component-a/ component-b/

Requires Node.js >= 14.0.0. No runtime dependencies.

Usage

pipe-inspector [options] <path> [<path>...]

Check if specific directories changed between the last two semver tags:

pipe-inspector component-a/ component-b/ component-c/
component-a/  changed
component-b/  unchanged
component-c/  unchanged

Options

| Option | Description | |---|---| | --tag <tag> | Set the current tag explicitly (default: auto-detect from CI_COMMIT_TAG, GITHUB_REF_NAME, or git describe) | | --format <fmt> | Output format: text (default), json, dotenv | | --version | Print the version | | -h, --help | Show help |

Exit codes

| Code | Meaning | |---|---| | 0 | At least one specified path has changes | | 1 | None of the specified paths have changes | | 2 | Error (bad arguments, not a git repo, shallow clone, etc.) |

Output formats

json — machine-readable, includes tag info and the list of changed files:

pipe-inspector --format json component-a/ component-b/
{"changed":true,"currentTag":"v0.9.0","previousTag":"v0.8.0","paths":{"component-a/":true,"component-b/":false},"files":["component-a/main.py"]}

dotenv — one variable per path plus version info, suitable for GitLab dotenv artifacts:

pipe-inspector --format dotenv component-a/ component-b/
CHANGED_COMPONENT_A=true
CHANGED_COMPONENT_B=false
CURRENT_VERSION=0.9.0
PREV_VERSION=0.8.0

The CURRENT_VERSION and PREV_VERSION variables (without v prefix) are included automatically, so downstream CI jobs can use them for retagging without additional shell logic.

CI Examples

GitLab CI — skip build when unchanged

The || exit 0 pattern makes the job succeed immediately when no changes are detected, skipping all subsequent script lines:

build-component-a:
  stage: build
  image: node:20
  script:
    - npx @logickernel/pipe-inspector component-a/ || exit 0
    - echo "Building component-a..."
  rules:
    - if: '$CI_COMMIT_TAG =~ /^v/'

GitLab CI — kaniko build with crane retag

For Docker image builds using kaniko, a detect-changes job runs pipe-inspector once and exports dotenv variables. Build jobs then either compile with kaniko or retag the previous image with crane (a manifest-level operation that skips downloading image layers entirely):

stages:
  - detect
  - build

detect-changes:
  stage: detect
  image: node:20-alpine
  before_script:
    - apk add --no-cache git
  script:
    - npx @logickernel/pipe-inspector --format dotenv component-a/ component-b/ | tee changes.env || true
    - cat changes.env
    - wget -qO- "https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_x86_64.tar.gz" | tar xz crane
    - chmod +x crane
  artifacts:
    reports:
      dotenv: changes.env
    paths:
      - crane
  rules:
    - if: '$CI_COMMIT_TAG =~ /^v/'

.build-component:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  needs:
    - detect-changes
  script:
    - VERSION=${CI_COMMIT_TAG#v}
    - IMAGE=${CI_REGISTRY_IMAGE}/${COMPONENT}
    - CHANGE_VAR="CHANGED_$(echo "${COMPONENT}" | tr '[:lower:]' '[:upper:]' | tr '-/./' '____' | sed 's/_*$//')"
    - eval "IS_CHANGED=\${${CHANGE_VAR}:-false}"
    - |
      build_image() {
        echo "Building ${COMPONENT}..."
        /kaniko/executor \
          --context "${CI_PROJECT_DIR}/${COMPONENT}" \
          --dockerfile "${CI_PROJECT_DIR}/${COMPONENT}/Dockerfile" \
          --build-arg VERSION=${VERSION} \
          --destination "${IMAGE}:${VERSION}" \
          --cache=true \
          --cache-repo="${IMAGE}/cache"
      }
    - |
      mkdir -p /kaniko/.docker
      echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf '%s:%s' "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64)\"}}}" > /kaniko/.docker/config.json
    - |
      if [ "${IS_CHANGED}" = "true" ]; then
        build_image
      elif [ -n "${PREV_VERSION}" ]; then
        echo "No changes in ${COMPONENT}, retagging ${PREV_VERSION} as ${VERSION}..."
        ${CI_PROJECT_DIR}/crane auth login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
        ${CI_PROJECT_DIR}/crane tag "${IMAGE}:${PREV_VERSION}" "${VERSION}" || build_image
      else
        build_image
      fi
  rules:
    - if: '$CI_COMMIT_TAG =~ /^v/'

build-component-a:
  extends: .build-component
  variables:
    COMPONENT: component-a

build-component-b:
  extends: .build-component
  variables:
    COMPONENT: component-b

GitHub Actions

jobs:
  build:
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: npx @logickernel/pipe-inspector component-a/ || exit 0
      - run: echo "Building component-a..."

CI Requirements

  • Full git history is required. Shallow clones cannot diff between tags. Set GIT_DEPTH: 0 in GitLab CI or fetch-depth: 0 in GitHub Actions.
  • Tag auto-detection reads CI_COMMIT_TAG (GitLab) or GITHUB_REF_NAME (GitHub Actions). Use --tag to override.

Development

git clone https://code.logickernel.com/tools/pipe-inspector.git
cd pipe-inspector
npm install
npm test

License

ISC