codeinput
is a powerful CLI tool for parsing, analyzing, and managing CODEOWNERS files across your repositories. It provides advanced querying capabilities, ownership analysis, and tag-based file organization.
Table of Contents
Features
CodeOwners
- Advanced Parsing: Parse CODEOWNERS files recursively across directory structures
- Ownership Analysis: Analyze file ownership patterns and generate detailed reports
- Tag Support: Organize and query files using custom tags in CODEOWNERS
- High Performance: Efficient caching and parallel processing for large repositories
- Flexible Filtering: Filter files by owners, tags, or ownership status
- Multiple Output Formats: Support for text, JSON, and binary output formats
Installation
Pre-built Binaries
Latest Release: 0.0.1-beta
- Linux x86_64: Download
- Linux ARM64: Download
- Windows x86_64: Download
- macOS Intel: Download
- macOS Apple Silicon: Download
Installation Instructions
- Download the appropriate binary for your platform
- Rename the downloaded file to
ci
(Linux/macOS) orci.exe
(Windows) - Move the binary to your PATH:
mv ci /usr/local/bin/
(Linux/macOS) - Make it executable:
chmod +x /usr/local/bin/ci
(Linux/macOS)
What's New in 0.0.1-beta
codeinput - 0.0.1-beta
From Cargo
You can install the CLI using Cargo. Rust Toolchain required.
From Source
Quick Start
-
Parse your CODEOWNERS files to build the cache:
-
List all files with their owners:
-
Find files owned by a specific team:
-
Inspect ownership of a specific file:
Commands
CodeOwners
Parse CODEOWNERS
Build a cache of parsed CODEOWNERS files for fast querying:
Options:
--cache-file <FILE>
: Custom cache file location (default:.codeowners.cache
)--format <FORMAT>
: Cache format -bincode
orjson
(default:bincode
)
Examples:
# Parse current directory
# Parse specific directory with JSON cache
# Use custom cache location
List Files
Find and list files with their owners based on filter criteria:
Options:
--tags <LIST>
: Filter by tags (comma-separated)--owners <LIST>
: Filter by owners (comma-separated)--unowned
: Show only unowned files--show-all
: Show all files including unowned/untagged--format <FORMAT>
: Output format -text
,json
, orbincode
Examples:
# List all owned files
# Find files with specific tags
# Find files owned by multiple teams
# Show unowned files
# Output as JSON
List Owners
Display aggregated owner statistics and file associations:
Options:
--format <FORMAT>
: Output format -text
,json
, orbincode
Examples:
# Show all owners with file counts
# Get owner data as JSON
List Tags
Analyze tag usage across CODEOWNERS files:
Options:
--format <FORMAT>
: Output format -text
,json
, orbincode
Examples:
# Show all tags with usage statistics
# Export tag data as JSON
Inspect Files
Get detailed ownership and tag information for a specific file:
Options:
--repo <PATH>
: Repository path (default: current directory)--format <FORMAT>
: Output format -text
,json
, orbincode
Examples:
# Inspect a specific file
# Inspect with different repo path
# Get inspection data as JSON
Configuration
View current configuration settings:
Shell Completion
Generate shell completion scripts:
# For bash
# For zsh
# For fish
CODEOWNERS Format
The tool supports two approaches for defining code ownership:
1. Traditional CODEOWNERS Files
Standard CODEOWNERS syntax with additional tag support:
# Standard ownership
*.rs @rust-team
/docs/ @documentation-team
# With tags for categorization
*.security.rs @security-team #security #critical
/api/ @backend-team #api #core
# Multiple owners and tags
*.config @devops @security-team #config #infrastructure #security
# Special patterns
* @default-team #general
Pattern Matching Rules:
/path/to/dir/
- Matches all files and subdirectories recursively (GitHub compatible)/path/to/dir/*
- Matches direct files in the directory only/path/to/dir/**
- Matches all files and subdirectories recursively (explicit)*.ext
- Matches files with specific extensionpattern
- Relative path matching
Priority Rules:
- Closest CODEOWNERS file: Files in subdirectories take precedence over parent directories
- Last match wins: Later entries in the same CODEOWNERS file override earlier ones
- Inline declarations: Per-file inline ownership
2. Inline Per-File Ownership
For fine-grained control, declare ownership directly within individual files using the !!!CODEOWNERS
marker:
Rust Example:
// !!!CODEOWNERS @security-team @alice #security #critical
use crypto;
JavaScript/TypeScript Example:
// !!!CODEOWNERS @frontend-team #ui #components
export const ;
HTML Example:
<!-- !!!CODEOWNERS @design-team #ui #templates -->
Welcome
CSS Example:
/* !!!CODEOWNERS @design-team #styles #branding */
}
Inline Format Rules:
- Must appear within the first 50 lines of the file
- Can be used in any comment style (
//
,#
,/**/
,<!-- -->
) - Takes highest priority over all CODEOWNERS file patterns
- Supports same owner and tag syntax as CODEOWNERS files
- Only one inline declaration per file (first one found is used)
Supported Owner Types:
- Users:
@username
- Teams:
@org/team-name
- Email:
user@example.com
Tag Format:
- Tags start with
#
and appear after owners - Multiple tags are supported:
#tag1 #tag2 #tag3
- Tags can contain letters, numbers, hyphens, and underscores
- Comments after tags are ignored (e.g.,
#tag1 # this is a comment
)
How to Contribute
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.