LogoLogo
Packmind CloudChangelogGet supportJoin Slack
  • 👋Welcome!
  • 🪐Manage spaces
  • 🔐Security and data
  • 🐞Troubleshooting guides
  • 🚀First steps
    • Enable and configure AI
    • Connect your Git platform
  • 📥Capture your coding practices
    • How to create coding practices
    • Review practices in the Inbox
  • 🔍Enforce practices in your code
    • Setup practices detection with the AI Agent
    • Packmind CLI
      • Run with NPM
      • Run with Docker
      • SonarQube Integration
      • Run in Gitlab CI
      • Usage
  • Coding Assistants Integration
  • 👩‍💻Plugins & Integrations
    • IDE Plugins
      • 🚀Packmind's IDE plugins use cases
      • Visual Studio Code
      • Visual Studio
      • JetBrains IDEs
      • Eclipse
      • Xcode
      • Packmind Tech Coach
    • 🔔Get notifications
  • 📖Best practices management
    • Manage your practices
      • Import, copy and export practices
      • Use categories to organize your practices
      • Manage duplications of practices
      • Move all practices from a space to another space
      • Styling with Markdown
      • Multi-file examples on coding practices
    • 📰Scheduler to push practices
  • ↔️API Reference
    • Authentication
    • Documentation
  • ⚙️Account & Settings
    • 👩‍💼Manage users
    • 💵Subscription and Billing
    • 🔓Single Sign-On (SSO) in Packmind
      • Enable SSO for Packmind Cloud
      • Enable SSO for Packmind Self-Hosted
  • 🏠On-Premise version
    • Release notes - Self-Hosted versions
    • Install the Self-Hosted version
      • Migrate from a legacy setup (Mongo 2.x)
    • Connect a SMTP server
    • Authentication
      • Authentication with OpenLDAP
      • Authentication by SSO
      • Authentication with Active Directory
Powered by GitBook
On this page
  • Packmind CLI Tutorial
  • Getting Help
  • Basic Usage
  • Glob Patterns 🌟
  • Output Formats
  • Advanced Usage

Was this helpful?

  1. Enforce practices in your code
  2. Packmind CLI

Usage

Packmind CLI Tutorial

This tutorial will guide you through using the Packmind CLI to scan your codebase for best practice violations.

Getting Help

For complete command reference and options:

packmind-cli scan -h

Basic Usage

1. Scan Current Directory

packmind-cli scan .

Scans all files in the current directory and subdirectories.

2. Scan Specific Files

packmind-cli scan src/main.js,src/utils.js

Scans only the specified files (comma-separated).

3. Scan Specific Directories

packmind-cli scan src,test

Scans all files in the src and test directories.

Glob Patterns 🌟

Important: Always quote glob patterns to prevent shell expansion!

Basic Patterns

# Scan all TypeScript files
packmind-cli scan "**/*.ts"

# Scan all JavaScript and TypeScript files
packmind-cli scan "**/*.{js,ts}"

# Scan all test files
packmind-cli scan "**/*.{test,spec}.{js,ts}"

Directory-Based Patterns

# Scan all files in any "src" directory
packmind-cli scan "**/src/**"

# Scan all files in "components" directories
packmind-cli scan "**/components/**"

# Scan all files in nested utility directories
packmind-cli scan "**/utils/**"

File-Specific Patterns

# Find all package.json files
packmind-cli scan "**/package.json"

# Find all pom.xml files (Maven projects)
packmind-cli scan "**/pom.xml"

# Find all Docker files
packmind-cli scan "**/Dockerfile"

Combining Multiple Patterns

# Scan source code AND configuration files
packmind-cli scan "**/src/**,**/pom.xml"

# Scan multiple file types across the project
packmind-cli scan "**/*.{js,ts},**/*.{java,kt},**/pom.xml"

# Scan source and test directories
packmind-cli scan "**/src/**,**/test/**,**/*.spec.*"

Output Formats

Console Output (Default)

# Group results by files (default)
packmind-cli scan "**/src/**"

# Group results by practices
packmind-cli scan "**/src/**" --grouped practices

Export Results

# Export to SonarQube format
packmind-cli scan "**/src/**" \
  --formatters sonarqube \
  --output sonarqube-report.json

# Export to SARIF format (for GitHub, etc.)
packmind-cli scan "**/src/**" \
  --formatters sarif \
  --output sarif-report.json

# Multiple formats
packmind-cli scan "**/src/**" \
  --formatters console,sonarqube \
  --output analysis-report.json

Advanced Usage

Scanning Changed Files Only

# Scan only files changed in Git
packmind-cli scan --mode onlyChanged

# Scan only files in GitLab Merge Request
packmind-cli scan --gitlabMR true

Space Filtering

# Scan using practices from specific spaces only
packmind-cli scan "**/src/**" --spaces "JavaScript,React"

# Multiple spaces
packmind-cli scan "**/src/**" --spaces "Java,Spring Boot,Security"

Debugging

# Enable debug logging
packmind-cli scan "**/src/**" --log debug

# See detailed information about pattern matching
packmind-cli scan "**/src/**" --log debug | grep "Expanding\|matched"
PreviousRun in Gitlab CINextCoding Assistants Integration

Last updated 1 day ago

Was this helpful?

🔍