Registry / devops / dir-cli

dir-cli

JSON →
library2.0.0jsnpmunverified

dir-cli is a professional project migration assistant CLI tool (v2.0) that provides Git status checking, smart cleanup of dependencies and build artifacts, and migration preparation reports. It supports multiple project types including Node.js, Python, Java, Rust, and Go. Key features include dry-run mode, interactive cleanup, configurable white-listing, path validation, and multi-format output (HTML/Markdown/JSON/table). The tool is safety-oriented with dry-run previews, symlink protection, and failure isolation. It requires Node >=16 and works on macOS, Linux, or Windows (WSL).

npm install dir-cli
INSTALL
IMPORT
SIG · DIR-CLI
D
dir-cli
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

exec
✓ import { exec } from 'dir-cli'
✗ const { exec } = require('dir-cli');
dir-cli is a CLI tool intended for command-line usage; programmatic API is experimental. For ESM-only environments, use `import` with `createRequire` or dynamic import.
DirCli
✓ import DirCli from 'dir-cli'
✗ import { DirCli } from 'dir-cli';
Default export is the main class; named export is incorrect.
types
✓ import type { CheckOptions, CleanOptions, ReportOptions } from 'dir-cli'
✗ import { CheckOptions } from 'dir-cli';
Use `import type` for TypeScript types; runtime import is unnecessary.

Demonstrates common CLI commands: check status, dry-run cleanup, generate HTML report, interactive cleanup, config management, and locale switching.

// Ensure Node.js >= 16.0.0 // Install globally // npm install -g dir-cli // Check project status and migration readiness (current directory) import { execSync } from 'child_process'; console.log(execSync('dir-cli check --format plain').toString()); // Preview cleanup for all types (dry-run) console.log(execSync('dir-cli clean all --dry-run').toString()); // Generate migration report in HTML console.log(execSync('dir-cli report migration --format html --output migration-report.html').toString()); // Interactive cleanup for node projects console.log(execSync('dir-cli clean node --interactive').toString()); // Set configuration console.log(execSync('dir-cli config set scan.maxDepth 5').toString()); // List current configuration console.log(execSync('dir-cli config list').toString()); // Change locale to English console.log(execSync('dir-cli locale en').toString());
Debug
Known issues
breakingv2.0 changed command structure: `dir-cli scan` is now `dir-cli check`, and `dir-cli prepare` is `dir-cli report migration`.
fix
Update scripts to use new command names: `dir-cli check` and `dir-cli report migration`.
affects: <2.0.0
breakingv2.0 requires Node.js >=16.0.0; older versions (v1.x) supported Node >=12.
fix
Upgrade Node.js to >=16.0.0 or stay on v1.x if locked to older Node.
affects: <2.0.0
deprecatedThe `--dry` option for `clean` is deprecated in v2.0; use `--dry-run` instead.
fix
Replace `--dry` with `--dry-run`.
affects: >=2.0.0
gotchaThe `clean go` command does NOT clean `vendor/` directory by default; only `bin`, `dist`, `build`, and `coverage.out` are targeted.
fix
If you need to remove `vendor/`, use `--exclude vendor` after confirming your project does not require it.
affects: >=2.0.0
gotchaPath validation prevents deletions outside the project root; operations targeting paths like `../` will be blocked and logged but may cause confusion.
fix
Ensure run directory is the project root. Use `--dry-run` to preview before actual cleanup.
affects: >=2.0.0
gotchaBy default, the config command reads/writes global config; changes affect all projects. Use `--local` flag for per-project config (if supported) or manually specify config file.
fix
Check documentation for local config support; consider using environment variables or per-project `.dir-clirc` file.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'dir-cli'
dir-cli was not installed globally or locally.
fix
Run `npm install -g dir-cli` to install globally.
error: unknown option '--dry'
`--dry` option was removed in v2.0; use `--dry-run`.
fix
Replace `--dry` with `--dry-run`.
Error: dir-cli requires Node.js >= 16.0.0 (current: v12.22.12)
Node.js version is too old for dir-cli v2.0.
fix
Upgrade Node.js to version >=16.0.0, or use dir-cli v1.x (if compatible).
The `check` command requires a project root containing recognized files (package.json, go.mod, etc.).
Running `dir-cli check` in a directory without supported project files.
fix
Navigate to a directory containing a supported project (e.g., has `package.json` or `go.mod`).
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
chalkrequiredterminal string coloring for log and output formatting
commanderrequiredcommand-line argument parsing and CLI framework
fast-globrequiredfile system scanning matching patterns
inquirerrequiredinteractive prompts for cleanup selection
orarequiredterminal spinners for progress indication
Agent activity
39 hits · last 30 days
node
34
OpenAI (training)
1
Resources