Skip to content

A tool to scan GitLab groups and subgroups, list all repositories, detect monorepos, and fetch the latest tag.

License

Notifications You must be signed in to change notification settings

jinghaihan/gitlab-repo-inspector

Repository files navigation

gitlab-repo-inspector

npm version JSDocs License

A tool to scan GitLab groups and subgroups, list all repositories, detect monorepos, and fetch the latest tags or releases.

npx gitlab-repo-inspector [mode] [options]

Features

Repository Discovery

  • Scans GitLab groups and subgroups recursively
  • Fetches repository metadata including descriptions and latest tags
  • Supports both GitLab.com and self-hosted GitLab instances

Monorepo Detection

The tool automatically detects and analyzes monorepo structures:

pnpm Workspaces:

  • Reads pnpm-workspace.yaml to discover workspace packages
  • Extracts package information from package.json files
  • Supports workspace patterns like packages/*

Maven Projects:

  • Parses pom.xml files to discover multi-module projects
  • Recursively analyzes nested modules
  • Extracts artifact information and descriptions

Configuration

Create a gitlab-repo-inspector.config.ts file to customize default settings:

import { defineConfig } from 'gitlab-repo-inspector'

export default defineConfig({
  cwd: process.cwd(),
  registry: 'https://gitlab.com',
  apiVersion: 'v4',
  projectType: 'pnpm',
  token: 'access-token',
  perPage: 500,
  group: 'gitlab-group',
  subgroups: true,
  archived: false,
  monorepo: true,
  preRelease: false,
  ignoreGroups: ['legacy'],
  ignoreRepos: ['decrypted-repo'],
  ignorePackages: ['internal-packages'],
  ignorePatterns: ['playground', 'examples/*'],
  json: 'gitlab-repo-inspector.json',
  merge: false
})

Configuration Options:

  • cwd: Current working directory
  • registry: GitLab instance URL
  • apiVersion: API version (default: 'v4')
  • projectType: Project type ('pnpm' or 'maven')
  • token: GitLab access token
  • perPage: Number of repositories per page (default: 500)
  • group: Default group to scan
  • subgroups: Include subgroups in scan (default: true)
  • archived: Include archived repositories (default: false)
  • monorepo: Enable monorepo detection (default: true)
  • preRelease: Include pre-release versions (default: true)
  • ignoreGroups: Array of group names to ignore
  • ignoreRepos: Array of repository names to ignore
  • ignorePackages: Array of package names to ignore
  • ignorePatterns: Array of monorepo patterns to ignore
  • json: Output JSON file name (default: 'gitlab-repo-inspector.json')
  • merge: Merge with existing JSON file (default: false)

Authentication

The tool requires a GitLab access token with appropriate permissions:

  1. Go to GitLab → Settings → Access Tokens
  2. Create a token with read_repository and read_api scopes
  3. Provide the token via:
    • --token command line option
    • Configuration file
    • Interactive prompt (if not provided)

License

MIT License © jinghaihan

About

A tool to scan GitLab groups and subgroups, list all repositories, detect monorepos, and fetch the latest tag.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published