@hernando15/count-lines-cli
v1.2.1
Published
CLI tool to count lines of code and show top files, respecting .gitignore
Maintainers
Readme
Count Lines CLI
CLI tool to count lines of code in your project and show the top files with the most lines, respecting .gitignore rules.
Features
- Counts lines of code across all project files
- Automatically respects
.gitignorerules - Auto-ignores common files (lock files, configs, builds)
- Supports
.countlinesignorefile for custom rules - Shows a ranking of files sorted by line count
- Project-wide statistics
Quick start
No installation needed — run directly with npx:
npx @hernando15/count-lines-cliUsage
Without installing
npx @hernando15/count-lines-cliWith a global install
npm install -g @hernando15/count-lines-cli
count-linesSpecify how many files to show
Default shows top 20, you can specify a different number:
npx @hernando15/count-lines-cli 10
npx @hernando15/count-lines-cli 50Example output
🔍 Contando líneas de código...
✓ Patrones por defecto cargados
✓ .gitignore cargado
✓ .countlinesignore cargado
📊 Top 4 archivos con más líneas:
──────────────────────────────────────────────────────────────────────────────
Líneas Archivo
──────────────────────────────────────────────────────────────────────────────
1. 177 cli.js
2. 118 README.md
3. 26 package.json
4. 15 skills-lock.json
──────────────────────────────────────────────────────────────────────────────
📈 Resumen:
Archivos procesados: 4
Líneas totales: 336
Promedio por archivo: 84Ignored files
The CLI has 3 levels of ignoring that are combined:
1. Default ignored patterns
These files are always ignored automatically:
node_modules/,.git/- Lock files:
package-lock.json,pnpm-lock.yaml,yarn.lock,bun.lockb - Common configs:
*.config.js,*.config.ts,tsconfig.json,jsconfig.json - Build outputs:
dist/,build/,.next/,.nuxt/,out/ - Other:
.DS_Store,Thumbs.db
2. .gitignore file
If a .gitignore exists in your project, all its rules are respected automatically.
3. .countlinesignore file (optional)
You can create a .countlinesignore file in your project root to add extra rules specific to the line counter.
Example .countlinesignore:
# Ignore test files
*.test.js
*.spec.ts
# Ignore file types
*.json
*.yaml
*.yml
# Ignore directories
docs/
examples/
# Ignore specific files
README.mdThis file is completely optional and complements (does not replace) the .gitignore.
License
MIT
