athityakumar/colorls
A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. :tada:
Healthy across the board
Permissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 7w ago
- ✓10 active contributors
- ✓Distributed ownership (top contributor 35% of recent commits)
Show 3 more →Show less
- ✓MIT licensed
- ✓CI configured
- ✓Tests present
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/athityakumar/colorls)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/athityakumar/colorls on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: athityakumar/colorls
Generated by RepoPilot · 2026-05-10 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/athityakumar/colorls shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across the board
- Last commit 7w ago
- 10 active contributors
- Distributed ownership (top contributor 35% of recent commits)
- MIT licensed
- CI configured
- Tests present
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live athityakumar/colorls
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/athityakumar/colorls.
What it runs against: a local clone of athityakumar/colorls — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in athityakumar/colorls | Confirms the artifact applies here, not a fork |
| 2 | License is still MIT | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 81 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of athityakumar/colorls. If you don't
# have one yet, run these first:
#
# git clone https://github.com/athityakumar/colorls.git
# cd colorls
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of athityakumar/colorls and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "athityakumar/colorls(\\.git)?\\b" \\
&& ok "origin remote is athityakumar/colorls" \\
|| miss "origin remote is not athityakumar/colorls (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
&& ok "license is MIT" \\
|| miss "license drift — was MIT at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 4. Critical files exist
test -f "exe/colorls" \\
&& ok "exe/colorls" \\
|| miss "missing critical file: exe/colorls"
test -f "lib/colorls/core.rb" \\
&& ok "lib/colorls/core.rb" \\
|| miss "missing critical file: lib/colorls/core.rb"
test -f "lib/colorls/fileinfo.rb" \\
&& ok "lib/colorls/fileinfo.rb" \\
|| miss "missing critical file: lib/colorls/fileinfo.rb"
test -f "lib/colorls/flags.rb" \\
&& ok "lib/colorls/flags.rb" \\
|| miss "missing critical file: lib/colorls/flags.rb"
test -f "lib/colorls/layout.rb" \\
&& ok "lib/colorls/layout.rb" \\
|| miss "missing critical file: lib/colorls/layout.rb"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 81 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~51d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/athityakumar/colorls"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
colorls is a Ruby gem that replaces the standard ls command with a colorized, icon-enhanced version using Font Awesome icons and YAML-based theming. It wraps the output of filesystem listings with color codes and nerd-font icons to make directory traversal more visually intuitive in the terminal, supporting both light and dark color schemes via lib/yaml/light_colors.yaml and lib/yaml/dark_colors.yaml. Single-gem structure: lib/colorls/ contains modular concerns (core.rb orchestrates, fileinfo.rb models file metadata, flags.rb parses CLI args, git.rb integrates git status, layout.rb formats output, yaml.rb loads theme configs). Entry point is exe/colorls executable. YAML configs in lib/yaml/ (files.yaml, folders.yaml, their aliases, and color themes) drive icon/color mappings via data rather than code.
👥Who it's for
Terminal-heavy developers and sysadmins who spend significant time in shell environments (particularly macOS with iTerm2, oh-my-zsh, and nerd fonts) and want immediate visual feedback about file types and git status without switching tools or installing separate dependencies.
🌱Maturity & risk
Actively maintained production-ready gem (Gem Version badge present, CI/CD via GitHub Actions at .github/workflows/ruby.yml, comprehensive test suite in spec/). The codebase shows regular updates through release-drafter setup and dependabot configuration, indicating ongoing maintenance, though as a terminal utility with stable feature set, release frequency may be moderate rather than rapid.
Low risk for a stable utility: single maintainer (athityakumar) creates some version risk, but the project has clear CONTRIBUTING.md and PULL_REQUEST_TEMPLATE.md suggesting community contributions are welcome. No obvious dependency explosions (Ruby stdlib-focused with Font Awesome assumption). Main risk is nerd-font availability assumptions—if terminal lacks proper font config, icons render as garbage, which is user-environment rather than code risk.
Active areas of work
CI is active (.github/workflows/ruby.yml suggests regular test runs), release automation is configured (release-drafter.yml), and dependabot is enabled for dependency updates. The presence of .github/dependabot.yml indicates ongoing maintenance of dependencies. No specific recent feature work evident from file list alone, suggesting focus is stability and dependency health rather than new features.
🚀Get running
git clone https://github.com/athityakumar/colorls.git
cd colorls
bundle install
bundle exec exe/colorls
Or install as gem: gem install colorls then run colorls directly.
Daily commands:
Dev: bundle install && bundle exec rspec (runs tests). To use locally during dev: bundle exec exe/colorls [flags] [path]. Install globally: gem install --local pkg/colorls-*.gem after gem build colorls.gemspec.
🗺️Map of the codebase
exe/colorls— Entry point executable that handles CLI argument parsing and invokes the main ColorLS logic.lib/colorls/core.rb— Core business logic orchestrating file listing, filtering, sorting, git integration, and output formatting.lib/colorls/fileinfo.rb— File metadata abstraction (permissions, size, icons, colors) essential for representing individual files throughout the codebase.lib/colorls/flags.rb— CLI flag parsing and validation logic defining all user-facing options and their default behaviors.lib/colorls/layout.rb— Output formatting and layout engine handling grid/table/single-column rendering modes.lib/yaml/files.yaml— Configuration mapping file extensions to icons and colors; foundational for visual customization.lib/colorls/git.rb— Git status integration layer for per-file git state detection (modified, staged, untracked).
🛠️How to make changes
Add support for a new file type (extension) with custom icon and color
- Open lib/yaml/files.yaml and add an entry under the appropriate category (e.g., 'erb': { icon: '🔶', color: 'yellow' }) (
lib/yaml/files.yaml) - If the file type maps to an icon not yet in FontAwesome, use an existing icon or add an alias in lib/yaml/file_aliases.yaml (
lib/yaml/file_aliases.yaml) - Test the change by running colorls on a directory with files matching your extension; verify colors and icons render correctly (
spec/color_ls/yaml_spec.rb)
Add a new command-line flag
- Define the flag in lib/colorls/flags.rb using OptionParser's option() method; set a sensible default and help text (
lib/colorls/flags.rb) - Access the flag value in lib/colorls/core.rb via @options[:<flag_name>] and implement conditional logic accordingly (
lib/colorls/core.rb) - Add test cases in spec/color_ls/flags_spec.rb and spec/color_ls/core_spec.rb to verify flag parsing and behavior (
spec/color_ls/flags_spec.rb)
Customize output formatting or add a new layout mode
- Review the existing layout implementations (grid, table, single-column) in lib/colorls/layout.rb (
lib/colorls/layout.rb) - Add a new method (e.g., def my_layout_mode) that iterates over @files and formats output according to your requirements (
lib/colorls/layout.rb) - Wire the new layout into lib/colorls/core.rb's display logic (typically in the main output dispatch method) (
lib/colorls/core.rb) - Test the new layout with spec/color_ls/layout_spec.rb; verify alignment, wrapping, and colorization (
spec/color_ls/layout_spec.rb)
Add a new color theme (dark/light variant)
- Create a new YAML file (e.g., lib/yaml/solarized_colors.yaml) with color mappings for file types, folders, and system colors (
lib/yaml/dark_colors.yaml) - Modify lib/colorls/yaml.rb to load and register the new theme, conditionally selecting it based on environment or flag (
lib/colorls/yaml.rb) - Test theme switching by running colorls with the appropriate flag or environment variable; verify colors apply correctly (
spec/color_ls/yaml_spec.rb)
🔧Why these technologies
- Ruby — Primary language; chosen for rapid development, excellent string/regex handling, and gem ecosystem maturity.
- YAML configuration files — Human-readable, easy to customize; decouples icon/color mappings from code logic, enabling non-programmers to contribute.
- FontAwesome icons — Extensive icon library; already familiar to terminal customization community; renders via Nerd Font integration.
- ANSI color codes — Universal terminal color support; lightweight; no external dependencies beyond Ruby stdlib.
- RSpec — Ruby standard testing framework; enables comprehensive validation of file sorting, filtering, and rendering logic.
⚖️Trade-offs already made
-
YAML-driven configuration over hard-coded icon maps
- Why: Allows users to customize without rebuilding the gem; lowers maintenance burden for maintainers.
- Consequence: Adds YAML parsing overhead (minimal) and introduces versioning complexity if schema changes; but significant gain in flexibility.
-
Pure Ruby implementation vs. native C/Rust performance optimization
- Why: Simplicity, ease of installation, and broad Ruby adoption; prioritizes developer experience.
- Consequence: Slower than native implementations for very large directories (10k+ files); acceptable for typical terminal use.
-
Monkeypatching String class for colorization (lib/colorls/monkeys.rb)
- Why: Enables fluent, readable syntax (e.g., 'text'.colorize(:red)); avoids verbose utility function calls.
- Consequence: Risk of conflicts with other gems; implicit behavior can confuse newcomers; trade-off accepted for ergonomics.
-
Git status detection per file (lib/colorls/git.rb) rather than batch repository query
- Why: Provides per-file context (modified, staged, untracked); more informative for developers.
- Consequence: Higher I/O cost on large repositories; mitigated by caching git output per invocation.
🚫Non-goals (don't propose these)
- Real-time file system watching or daemon mode
- Cross-platform Windows native support (runs on WSL/Cygwin but not native Windows cmd.exe)
- Authentication or permission elevation beyond standard Unix ownership model
- Network file system optimization (NFS, SMB performance not a priority)
- Custom scripting language or plugin system
🪤Traps & gotchas
Font dependency: colorls assumes nerd-fonts (or Font Awesome equivalent) are installed in user's terminal; without proper font config, icons display as control characters or boxes—this is silent failure, not code error. Git integration assumes git is in PATH and that it's safe to shell out (lib/colorls/git.rb runs git status); will fail silently in non-git directories or restricted environments. YAML loading is permissive: lib/colorls/yaml.rb may not validate icon/color keys exist before use, leading to nil-reference crashes if YAML is malformed. Tree depth flag parsing (--tree=N) may have edge cases in lib/colorls/flags.rb if depth is non-numeric. macOS/Linux path assumptions: lib/colorls/monkeys.rb likely patches filesystem methods; behavior may differ on Windows.
🏗️Architecture
💡Concepts to learn
- ANSI color codes — colorls colorizes output by injecting ANSI escape sequences (e.g.,
\033[31mfor red); understanding these codes is essential for debugging color output or tweaking the layout logic inlib/colorls/layout.rb - Monkey-patching in Ruby — colorls extends Ruby's built-in
FileandDirclasses inlib/colorls/monkeys.rbto add display metadata without modifying the source; understanding this metaprogramming pattern is key to understanding how colorls integrates with stdlib - YAML data-driven configuration — Icon and color mappings live in YAML files (
lib/yaml/files.yaml,lib/yaml/light_colors.yaml) rather than code; this allows theme customization and icon updates without recompiling, making colorls user-configurable - Git porcelain interface — colorls shells out to
git statusto determine file change state for the --git-status flag;lib/colorls/git.rbparses git's output to overlay VCS context on the file listing - Terminal-aware formatting (layout & pagination) — colorls must adapt output to terminal width (single-column vs. grid layout);
lib/colorls/layout.rbhandles responsive layout logic and tree-depth rendering, requiring awareness of terminal capabilities - Nerd Fonts / Ligatures — colorls relies on Font Awesome icons bundled in nerd fonts; without a font that includes these Unicode code points, icons render as garbage; this is an implicit hard dependency on user environment setup
- CLI argument parsing / flags — colorls implements its own flag parser in
lib/colorls/flags.rbto support both short (-a, -d) and long (--all, --dirs) forms, plus compound flags like --tree=DEPTH; understanding this custom parser is essential for adding new features
🔗Related repos
ogham/exa— Rust-based modern replacement for ls with colors and icons; direct competitor solving identical problem in different languageabishekvashok/cmatrix— Another terminal utility that enhances CLI output with formatting; demonstrates similar nerd-font / ANSI color patterns in Ruby ecosystemohmyzsh/ohmyzsh— oh-my-zsh framework that integrates colorls as a shell plugin and manages themes; primary distribution / integration point for colorls usersryanoasis/nerd-fonts— Font collection that provides the Font Awesome icons colorls relies on; required hard dependency for full functionalitypowerline/powerline— Companion statusline tool for terminal and editors; often used alongside colorls for consistent terminal theming (mentioned in README gist reference)
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add comprehensive test coverage for lib/colorls/git.rb module
The git.rb module handles Git integration (status indicators, commit info), but spec/color_ls/git_spec.rb likely has incomplete coverage. Git operations are complex and error-prone (uninitialized repos, permission issues, detached heads). Adding tests for edge cases would catch regressions and improve reliability for users working in various Git states.
- [ ] Review current git_spec.rb to identify untested code paths in lib/colorls/git.rb
- [ ] Add tests for: non-git directories, shallow clones, submodules, permission errors, and detached HEAD states
- [ ] Add fixtures in spec/fixtures with .git directories for realistic testing
- [ ] Ensure tests pass in CI with ruby.yml workflow
Add unit tests for lib/colorls/yaml.rb YAML parsing and validation
The yaml.rb module parses YAML config files (files.yaml, folders.yaml, color schemes), but spec/color_ls/yaml_spec.rb may not fully cover malformed input handling. Invalid YAML in user config files (dark_colors.yaml, light_colors.yaml) can crash the app. Tests should validate parser robustness and user-friendly error messages.
- [ ] Review lib/colorls/yaml.rb to understand all parsing logic and config loading
- [ ] Add test cases in spec/color_ls/yaml_spec.rb for: missing keys, invalid syntax, type mismatches, missing color values
- [ ] Create fixture YAML files in spec/fixtures with intentional errors
- [ ] Test fallback behavior when user config is invalid
Add integration test for tab completion script (lib/tab_complete.sh)
The bash completion script lib/tab_complete.sh enables shell integration but has no automated tests. This script is critical for UX but easy to break during refactoring. Adding a test workflow would validate it works across different shells and colorls versions.
- [ ] Create new test script in test/ directory (e.g., test/tab_complete_test.sh or add to test/run)
- [ ] Test that tab_complete.sh sources correctly without errors
- [ ] Validate completion suggestions work for flags (--help, --dark, etc.) and file patterns
- [ ] Consider adding a GitHub Actions workflow step to test shell compatibility (bash, zsh, sh)
- [ ] Document expected behavior in CONTRIBUTING.md
🌿Good first issues
- Add test coverage for
lib/colorls/monkeys.rb— currently mentioned in file list but no spec file exists (spec/color_ls/monkey_spec.rbexists but likely sparse); document or expand tests for all monkey-patched File/Dir methods: Core monkey-patching behavior lacks visibility and is risky; tests would improve safety - Create a user-facing guide document for adding custom file icons — currently only
lib/yaml/files.yamlandlib/yaml/file_aliases.yamlexist with no inline documentation; writedocs/CUSTOM_ICONS.mdwith examples: Low barrier to entry (just YAML editing) but currently undocumented; would improve contribution velocity - Add integration tests for --tree flag with varying depths (--tree=1, --tree=3, --tree=unlimited) —
spec/color_ls/flags_spec.rblikely tests parsing but not output correctness: Tree feature is advertised in README but output correctness is not validated; fills a gap in spec coverage
⭐Top contributors
Click to expand
Top contributors
- @avdv — 35 commits
- @ayushpoddar — 29 commits
- @dependabot[bot] — 18 commits
- @athityakumar — 6 commits
- @t-mangoe — 4 commits
📝Recent commits
Click to expand
Recent commits
65ef77a— Merge pull request #560 from NuclearMachine/readme (NuclearMachine)f066e32— Merge pull request #640 from athityakumar/dependabot/bundler/rdoc-tw-7.0 (avdv)815de6d— Update rdoc requirement from ~> 6.1 to ~> 7.0 (dependabot[bot])9b176f3— Merge pull request #630 from athityakumar/dependabot/bundler/unicode-display_width-gte-1.7-and-lt-4.0 (avdv)6446f73— Update unicode-display_width requirement from >= 1.7, < 3.0 to >= 1.7, < 4.0 (dependabot[bot])9914606— Merge pull request #622 from ayushpoddar/fix/rounding-large-files (avdv)6679c38— Fix test running on CI with small terminal width (avdv)8708fa3— Use ronn-ng instead of ronn (avdv)4c1824c— Simplify implementation (avdv)e3292e0— Merge pull request #624 from t-mangoe/issue_621 (avdv)
🔒Security observations
The colorls codebase is a relatively simple Ruby gem with moderate security posture. Primary concerns include potential YAML deserialization attacks, path traversal vulnerabilities when processing file paths, command injection risks in shell scripts, and incomplete input validation on command-line flags. The project has good infrastructure (GitHub Actions, Dependabot) for dependency management. Recommendations focus on secure YAML parsing (safe_load), path validation, shell script hardening, and input validation. No hardcoded secrets or exposed credentials were detected in the provided file structure.
- Medium · Potential Command Injection via Shell Script —
lib/tab_complete.sh. The file 'lib/tab_complete.sh' is a shell script that may be sourced or executed by users. Shell scripts can be vulnerable to command injection if they process user input without proper sanitization. This is especially concerning for a tool that processes file system paths and names. Fix: Review the shell script for unsafe command substitution patterns. Use quotes around variables, avoid eval, and validate/sanitize all user inputs. Consider using shellcheck for static analysis. - Medium · Arbitrary Code Execution via YAML Deserialization —
lib/colorls/yaml.rb. The codebase loads YAML configuration files (lib/yaml/*.yaml). Ruby's YAML.load() is vulnerable to arbitrary code execution if untrusted YAML is deserialized. If colorls processes user-supplied YAML files or merges them with user input, this could be exploited. Fix: Use YAML.safe_load() instead of YAML.load(). Ensure all YAML parsing is done with safe_load to prevent instantiation of arbitrary Ruby objects. Validate YAML structure against an expected schema. - Medium · Potential Path Traversal Vulnerability —
lib/colorls/core.rb, lib/colorls/fileinfo.rb. The core.rb and fileinfo.rb files process file paths. If user input (directory paths or file names) is not properly validated, path traversal attacks (e.g., '../../../etc/passwd') could allow unauthorized file access or information disclosure. Fix: Validate and canonicalize all file paths. Use File.expand_path and ensure the resolved path stays within intended directories. Reject paths containing '..' or symbolic link loops. Use realpath() to resolve symlinks securely. - Low · Git Module Information Disclosure —
lib/colorls/git.rb. The lib/colorls/git.rb module executes git commands to retrieve repository information. If colorls is run on untrusted repositories or with sensitive git configurations, information about private branches, commits, or credentials in git config could be exposed. Fix: Restrict git command execution to read-only operations. Use --no-optional-locks flag with git commands. Avoid exposing raw git output. Consider filtering sensitive information from git operations. - Low · Missing Input Validation on Command-Line Flags —
lib/colorls/flags.rb. The lib/colorls/flags.rb file processes command-line arguments. Insufficient validation of flag inputs could lead to unexpected behavior or resource exhaustion (e.g., very large recursion depth with -R flag). Fix: Implement bounds checking on numeric flags. Set reasonable limits on recursion depth, output size, and file count. Validate all flag combinations for logical consistency. - Low · Dependency Management - Missing Gemfile Lock Visibility —
Gemfile, Gemfile.lock (missing from analysis). The Gemfile exists but the Gemfile.lock was not provided for analysis. This prevents verification of locked dependency versions and potential known vulnerabilities in transitive dependencies. Fix: Maintain and commit Gemfile.lock to ensure reproducible builds. Regularly run 'bundle audit' to check for known vulnerabilities in dependencies. Use Dependabot (already configured) to receive security updates.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.